chenhaozhe
15 小时以前 72fd20db54200971976d22db77e2a11f0bafdb9f
新增设备故障登记单 设备故障登记单列表 页面 (原有页面废弃)
2个文件已添加
10个文件已修改
1729 ■■■■ 已修改文件
App.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages.json 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/MJGL/Sb_EquipConkBook/Sb_EquipConkBookBill.vue 816 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/MJGL/Sb_EquipConkBook/Sb_EquipConkBookBillList.vue 455 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/ZLGL/lailiaojianyan_fast/Kf_QCStockInCheckBill_Fast.vue 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/guzhangdengji/EqpConkBookBillList.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/index/login.vue 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/index/mine.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/index/tab2.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/index/tab3.vue 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
utils/WebSocketServices.js 412 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
utils/common.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
App.vue
@@ -11,7 +11,7 @@
        onLaunch: function() {
            console.log('App Launch')
            // #ifdef H5
            // // 测试时,H5页面刷新会丢失WebSocket连接,需触发重连 (需要测试的时候再解除注释,否则会影响热更新)
            // 测试时,H5页面刷新会丢失WebSocket连接,需触发重连 (需要测试的时候再解除注释,否则会影响热更新)
            // if (uni.getStorageSync("userinfo")) {
            //     if (WebSocketServices.wsInstance) { // 假设你的 WebSocket 实例存在 wsInstance 中
            //         WebSocketServices.closeConnect(); // 调用你封装的“关闭连接”方法
pages.json
@@ -1590,6 +1590,19 @@
            {
                "navigationBarTitleText" : "员工签到记录表列表"
            }
        },
        {
            "path" : "pages/MJGL/Sb_EquipConkBook/Sb_EquipConkBookBill",
            "style" :
            {
                "navigationBarTitleText" : "设备故障登记单"
            }
        },{
            "path" : "pages/MJGL/Sb_EquipConkBook/Sb_EquipConkBookBillList",
            "style" :
            {
                "navigationBarTitleText" : "设备故障登记单列表"
            }
        }
        
pages/MJGL/Sb_EquipConkBook/Sb_EquipConkBookBill.vue
New file
@@ -0,0 +1,816 @@
<template>
    <view>
        <view class="tabs" id="tabs">
            <view :class="tabs == 0 ? 'on':''" @tap="tabs = 0">基本信息</view>
            <view :class="tabs == 2 ? 'on':''" @tap="tabs = 2">其他信息</view>
        </view>
        <!-- 基本信息 -->
        <template v-if="tabs == 0">
            <view class="form" :style="{
                height: containerHeight + 'px',
                overflow: 'auto'
            }">
                <view class="form-item">
                    <view class="title">设备条码:</view>
                    <view :class="enableEdit?'right':'righton'">
                        <input v-model="hform.HBarCode" :disabled="!enableEdit"
                            @confirm="GetMessageByBarCode(hform.HBarCode)" placeholder="请输入(或扫描)设备条码" />
                    </view>
                    <view class="icon-wrapper">
                        <uni-icons type="scan" size="20" @click="toScanCode"></uni-icons>
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">开始时间:</view>
                    <view class="right">
                        <uni-datetime-picker type="datetime" :clear-icon="false" v-model="hform.HRepairPlanBeginDate">
                            <input :value="hform.HConkBeginDate" />
                        </uni-datetime-picker>
                    </view>
                </view>
                <view class="form-item">
                    <view class="title required">故障类别:</view>
                    <zxz-uni-data-select required class="right" :localdata="HConkTypeList" dataKey="故障类别名称"
                        dataValue="hitemid" v-model="hform.HConkTypeID">
                    </zxz-uni-data-select>
                    <!-- <input disabled v-model="hform.HDeptName" placeholder="请选择部门" /> -->
                </view>
                <view class="form-item">
                    <view class="title required">故障原因:</view>
                    <zxz-uni-data-select required class="right" :localdata="HConkReasonList" dataKey="HName"
                        dataValue="HItemID" v-model="hform.HConkReasonID">
                    </zxz-uni-data-select>
                    <!-- <input disabled v-model="hform.HDeptName" placeholder="请选择部门" /> -->
                </view>
                <view class="form-item">
                    <view class="title">故障描述:</view>
                    <view class="right">
                        <textarea v-model="hform.HExplanation" placeholder="请输入故障描述" />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">单据号:</view>
                    <view class="righton">
                        <input disabled v-model="hform.HBillNo" />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">单据日期:</view>
                    <view class="righton">
                        <input disabled v-model="hform.HDate" />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title required">部门:</view>
                    <zxz-uni-data-select required class="right" :localdata="HDeptList" dataKey="部门名称"
                        dataValue="HItemID" v-model="hform.HDeptID">
                    </zxz-uni-data-select>
                    <!-- <input disabled v-model="hform.HDeptName" placeholder="请选择部门" /> -->
                </view>
                <view class="form-item">
                    <view class="title required">发现人:</view>
                    <zxz-uni-data-select required class="right" :localdata="HEmpList" dataKey="HName"
                        dataValue="HItemID" v-model="hform.HEmpID">
                    </zxz-uni-data-select>
                    <!-- <input disabled v-model="hform.HDeptName" placeholder="请选择部门" /> -->
                </view>
                <view class="form-item">
                    <view class="title required">负责人:</view>
                    <zxz-uni-data-select required class="right" :localdata="HEmpList" dataKey="HName"
                        dataValue="HItemID" v-model="hform.HManagerID">
                    </zxz-uni-data-select>
                    <!-- <input disabled v-model="hform.HDeptName" placeholder="请选择部门" /> -->
                </view>
                <view class="form-item">
                    <view class="title">设备名称:</view>
                    <view class="righton">
                        <input v-model="hform.HBarName" disabled />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">设备规格:</view>
                    <view class="righton">
                        <input v-model="hform.HBarSpec" disabled />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">设备型号:</view>
                    <view class="righton">
                        <input v-model="hform.HBarModel" disabled />
                    </view>
                </view>
            </view>
        </template>
        <!-- 其他信息 -->
        <template v-if="tabs == 2">
            <view class="form" :style="{
                height: containerHeight + 'px',
                overflow: 'auto'
            }">
                <view class="form-item">
                    <view class="title">创建人:</view>
                    <view class="righton">
                        <input v-model="hform.HMaker" />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">创建日期:</view>
                    <view class="righton">
                        <input v-model="hform.HMakeDate" />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">修改人:</view>
                    <view class="righton">
                        <input v-model="hform.HUpDater" />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">修改日期:</view>
                    <view class="righton">
                        <input v-model="hform.HUpDateDate" />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">审核人:</view>
                    <view class="righton">
                        <input v-model="hform.HChecker" />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">审核时间:</view>
                    <view class="righton">
                        <input v-model="hform.HCheckDate" />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">作废人:</view>
                    <view class="righton">
                        <input v-model="hform.HDeleteMan" />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">作废日期:</view>
                    <view class="righton">
                        <input v-model="hform.HDeleteDate" />
                    </view>
                </view>
            </view>
        </template>
        <!-- 操作按钮 -->
        <view class="buttons" id="buttons">
            <button class="btn-a" size="mini" @tap="submit">提交</button>
            <view style="flex: 1;"></view>
            <button class="btn-a" size="mini" @tap="addNew">新增</button>
            <button class="btn-c" size="mini" @tap="goBack">退出</button>
        </view>
        <!-- <xe-upload ref="XeUpload" :options="uploadOptions" @callback="handleUploadCallback"></xe-upload> -->
    </view>
</template>
<script>
    import dayjs from "dayjs";
    import {
        CommonUtils
    } from "@/utils/common";
    import {
        MpaasScan
    } from "@/utils/mpaasScan.js"
    import {
        getUserInfo
    } from "../../../utils/auth";
    export default {
        // 设备故障登记单
        name: 'Sb_EquipConkBookBill',
        data() {
            return {
                tabs: 0,
                HMainSourceBillType: "",
                btnTop: 0,
                tabsBottom: 0,
                HModName: "Sb_EquipConkBookBill",
                HBillType: '3907',
                operationType: 1,
                uploadOptions: {},
                enableEdit: true,
                HDeptList: [],
                HEmpList: [],
                HConkTypeList: [],
                HConkReasonList: [],
                hform: {
                    HBarCode: "",
                    HConkBeginDate: dayjs(new Date()).format("YYYY-MM-DD HH:mm:ss"),
                    HConkTypeName: "",
                    HConkTypeID: 0,
                    HConkReasonName: "",
                    HConkReasonID: 0,
                    HExplanation: "",
                    HBillNo: "",
                    HInterID: 0,
                    HDate: dayjs(new Date()).format("YYYY-MM-DD HH:mm:ss"),
                    HDeptName: "",
                    HDeptID: 0,
                    HEmpName: "",
                    HEmpID: 0,
                    HManagerName: "",
                    HManagerID: 0,
                    HBarName: "",
                    HEquipID: 0,
                    HBarSpec: "",
                    HBarModel: "",
                    HMaker: getUserInfo()["Czymc"],
                    HChecker: '',
                    HCloseMan: '',
                    HUpDater: '',
                    HMakeDate: dayjs(new Date()).format("YYYY-MM-DD HH:mm:ss"),
                    HCheckDate: '',
                    HCloseDate: '',
                    HUpDateDate: '',
                    HDeleteMan: '',
                    HDeleteDate: ''
                },
                HDetailList: [{ // 后端接口提交需要 明细信息
                    "HConkReasonID": "",
                    "HConkReasonCode": "",
                    "HConkReasonName": "",
                    "HConkExplanation": "",
                    "HManagerID": "",
                    "HManagerCode": "",
                    "HManagerName": "",
                    "HRemark": "  "
                }]
            };
        },
        computed: {
            containerHeight: {
                get() {
                    return this.btnTop - this.tabsBottom - 5
                }
            },
        },
        methods: {
            // 获取故障类别
            async getConkType() {
                try {
                    let res = await CommonUtils.doRequest2Async({
                        url: "/Gy_ConkType/List_PDA",
                        data: {
                            sWhere: ``,
                            user: getUserInfo()['Czymc']
                        }
                    })
                    let {
                        data,
                        count,
                        Message
                    } = res.data
                    if (count == 1) {
                        this.HConkTypeList = data
                    } else {
                        CommonUtils.showTips({
                            title: '温馨提示',
                            message: `获取故障类别失败: ${Message}`
                        })
                    }
                } catch (err) {
                    CommonUtils.showTips({
                        title: '温馨提示',
                        message: `获取故障类别失败: ${err}`
                    })
                }
            },
            // 获取故障原因
            async getConkReason() {
                try {
                    let res = await CommonUtils.doRequest2Async({
                        url: "/PublicPageMethod/Gy_ConkReasonList_PDA",
                        data: {
                            sWhere: ``,
                        }
                    })
                    let {
                        data,
                        count,
                        Message
                    } = res.data
                    if (count == 1) {
                        this.HConkReasonList = data
                    } else {
                        CommonUtils.showTips({
                            title: '温馨提示',
                            message: `获取故障原因失败: ${Message}`
                        })
                    }
                } catch (err) {
                    CommonUtils.showTips({
                        title: '温馨提示',
                        message: `获取故障原因失败: ${err}`
                    })
                }
            },
            // 删除明细
            delDetail(item) {
            },
            // 提交数据有效性校验
            ValidCheck() {
                if (this.hform.HEquipID == 0) {
                    return {
                        Message: "未录入设备信息,请先录入设备信息!",
                        state: false
                    }
                }
                if (this.hform.HDeptID == 0) {
                    return {
                        Message: "部门不得为空!",
                        state: false
                    }
                }
                if (this.hform.HEmpID == 0) {
                    return {
                        Message: "发现人不得为空!",
                        state: false
                    }
                }
                if (this.hform.HManagerID == 0) {
                    return {
                        Message: "负责人不得为空!",
                        state: false
                    }
                }
                if (this.hform.HConkReasonID == 0) {
                    return {
                        Message: "故障原因不得为空!",
                        state: false
                    }
                }
                if (this.hform.HConkTypeID == 0) {
                    return {
                        Message: "故障类别不得为空!",
                        state: false
                    }
                }
                return {
                    Message: "",
                    state: true
                }
            },
            addNew() {
                uni.redirectTo({
                    url: './Sb_EquipConkBookBill?operationType=1'
                })
            },
            goBack() {
                uni.navigateBack()
            },
            checkBoxChangeHandler(index, e) {
                let cr = e.detail.value
                if (cr.length == 0) {
                    this.HCheckFileList[index]["HDotCheckResult"] = false
                } else {
                    this.HCheckFileList[index]["HDotCheckResult"] = true
                }
            },
            uploadFile(index) {
                console.log('filePath: ', this.attachmentInfo[index].filePath);
                // 通过临时路径读取文件
                uni.uploadFile({
                    url: CommonUtils.getServerUrl() + "/Sb_EquipDotCheckBill/UploadFile",
                    filePath: this.attachmentInfo[index].filePath,
                    name: 'file',
                    formData: {
                        HBillNo: this.hform.HBillNo,
                        HRemark: "",
                        HUserName: getUserInfo()["Czymc"]
                    },
                    success: (uploadRes) => {
                        CommonUtils.showTips({
                            message: "上传成功"
                        })
                        this.attachmentInfo[index].status = "上传成功"
                    },
                    fail: (err) => {
                        CommonUtils.showTips({
                            title: '温馨提示',
                            message: `上传失败: ${err}`
                        })
                    }
                })
            },
            delFile(index) {
                console.log('attachmentInfo: ', this.attachmentInfo[index]);
                uni.showModal({
                    title: '提示',
                    content: '确认要删除 " ' + this.attachmentInfo[index].fileName + ' " 删除后将不可恢复!',
                    success: (res) => {
                        if (res.confirm) {
                            this.attachmentInfo.splice(index, 1)
                        }
                    },
                })
            },
            handleUploadCallback(res) { // 文件上传回调
                console.log('file: ', res);
                let fileInfo = res.data[0]
                this.attachmentInfo.push({
                    fileName: fileInfo.name,
                    size: fileInfo.size,
                    status: '等待上传',
                    filePath: fileInfo.tempFilePath
                })
            },
            // 上传文件
            fileUpload() {
                this.$refs.XeUpload.upload('file', {});
            },
            //获取班次数据
            async getShiftList() {
                try {
                    let res = await CommonUtils.doRequest2Async({
                        url: '/Web/GetGy_ShiftsList_Json',
                        data: {
                            Shifts: "",
                        }
                    })
                    let {
                        data,
                        count,
                        Message
                    } = res.data
                    if (count == 1) {
                        this.HShiftsList = data
                    } else {
                        CommonUtils.showTips({
                            title: '温馨提示',
                            message: Message
                        })
                    }
                } catch (err) {
                    CommonUtils.showTips({
                        title: '温馨提示',
                        message: err
                    })
                }
            },
            //获取使用部门数据
            async getHDeptList() {
                try {
                    let res = await CommonUtils.doRequest2Async({
                        url: '/Gy_Department/list',
                        data: {
                            sWhere: ` and HUSEORGID = ${uni.getStorageSync('OrganizationID')} `,
                            user: uni.getStorageSync('HUserName'),
                            Organization: uni.getStorageSync('Organization')
                        }
                    })
                    let {
                        data,
                        count,
                        Message
                    } = res.data
                    if (count == 1) {
                        this.HDeptList = data
                    } else {
                        CommonUtils.showTips({
                            title: '温馨提示',
                            message: Message
                        })
                    }
                } catch (err) {
                    CommonUtils.showTips({
                        title: '温馨提示',
                        message: err
                    })
                }
            },
            // 获取职员数据
            async getEmpList() {
                try {
                    let res = await CommonUtils.doRequest2Async({
                        url: '/PublicPageMethod/UserList',
                        data: {
                            sWhere: " where 1=1",
                        }
                    })
                    let {
                        data,
                        count,
                        Message
                    } = res.data
                    if (count == 1) {
                        this.HEmpList = data
                    } else {
                        CommonUtils.showTips({
                            title: '温馨提示',
                            message: Message
                        })
                    }
                } catch (err) {
                    CommonUtils.showTips({
                        title: '温馨提示',
                        message: err
                    })
                }
            },
            toScanCode() {
                MpaasScan.scanCode(cb => {
                    this.hfrom.HBarCode = cb
                    this.GetMessageByBarCode(cb)
                })
            },
            async GetMessageByBarCode(HBarCode) {
                try {
                    let res = await CommonUtils.doRequest2Sync({
                        url: "/Sb_PDA_EquipDotCheckBill/txtHBarCode_KeyDown_List",
                        data: {
                            HBarCode: HBarCode,
                        },
                    })
                    if (!res) {
                        return
                    }
                    let {
                        data,
                        count,
                        Message
                    } = res.data
                    if (count == 1) {
                        console.log('data: ', data);
                        this.hform.HEquipID = data[0].hmainid
                        this.hform.HBarName = data[0].设备名称
                        this.hform.HBarSpec = data[0].设备规格
                        this.hform.HBarModel = data[0].设备型号
                        this.hform.HQty = 1
                        this.enableEdit = false
                    } else {
                        CommonUtils.showTips({
                            title: "温馨提示",
                            message: Message
                        })
                    }
                } catch (err) {
                    CommonUtils.showTips({
                        title: "温馨提示",
                        message: err
                    })
                }
            },
            async GetItemByEquipFile() {
                try {
                    let res = await CommonUtils.doRequest2Async({
                        url: "/Web/GetItemByEquipFile",
                        data: {
                            "EquipProjectID": this.hform.HEquipID,
                            "Type": "DJ",
                            "HDate": this.hform.HBeginDate
                        }
                    })
                    let {
                        data,
                        Message,
                        count
                    } = res.data
                    if (count == 1) {
                        this.hform.HEquipDotCheckRuleInterID = data[0].点检规程ID
                        this.hform.HEquipDotCheckRuleInterNo = data[0].点检规程单号
                        this.hform.HPlanNo = data[0].点检计划单
                        this.hform.HPlanInterID = (data[0].点检计划ID == null ? 0 : data[0].点检计划ID) == "" ? 0 : data[0]
                            .点检计划ID
                        this.hform.HPlanEntryID = (data[0].点检计划子ID == null ? 0 : data[0].点检计划子ID) == "" ? 0 : data[
                            0].点检计划子ID
                        this.HCheckFileList = Array.from(data).map(item => {
                            return {
                                "HDotCheckItemID": item.HDotCheckItemID,
                                "HDotCheckCode": item.点检项目代码,
                                "HDotCheckItem": item.点检项目,
                                "HDotCheckPart": item.点检部位,
                                "HClaim": item.具体要求,
                                "HManagerID": item.负责人ID,
                                "HManagerCode": item.负责人代码,
                                "HManagerName": item.负责人名称,
                                "HSourceInterID": item.点检计划ID == null ? 0 : item.点检计划ID,
                                "HSourceEntryID": item.点检计划子ID == null ? 0 : item.点检计划子ID,
                                "HSourceBillNo": item.点检计划单,
                                "HDotCheckItemClassID": 0,
                                "HDotCheckItemClassName": "",
                                "HDotCheckItemMethodID": 0,
                                "HDotCheckItemMethodName": "",
                                "HDotCheckResult": item.默认结论 == 1 ? true : false
                            }
                        })
                    } else {
                        CommonUtils.showTips({
                            title: '温馨提示',
                            message: `获取点检规程错误: ${Message}`
                        })
                    }
                } catch (err) {
                    CommonUtils.showTips({
                        title: '温馨提示',
                        message: `获取点检规程错误: ${err}`
                    })
                }
            },
            radioChange({
                detail: {
                    value
                }
            }) {
                this.hform.HCheckResult = value
            },
            async getMaxNum() {
                try {
                    let res = await CommonUtils.doRequest2Async({
                        url: "/Web/GetMAXNum",
                        data: {
                            "HBillType": this.HBillType
                        }
                    })
                    let {
                        count,
                        data,
                        Message
                    } = res.data
                    console.log('data: ', data);
                    // this.hform.HInterID = data[0]["HInterID"]
                    this.hform.HInterID = 0
                    this.hform.HBillNo = data[0]["HBillNo"]
                } catch (err) {
                    CommonUtils.showTips({
                        title: "温馨提示",
                        message: "获取单据信息异常: " + err
                    })
                }
            },
            async submit() {
                let valid = this.ValidCheck()
                if (!valid.state) {
                    CommonUtils.showTips({
                        message: valid.Message
                    })
                    return
                }
                try {
                    let oMain = JSON.stringify(this.hform);
                    this.HDetailList[0].HConkReasonID = this.hform.HConkReasonID
                    this.HDetailList[0].HConkExplanation = this.hform.HExplanation
                    this.HDetailList[0].HManagerID = this.hform.HManagerID
                    let sSubStr = JSON.stringify(this.HDetailList);
                    let sMainSub = oMain + ';' + sSubStr + `;` + getUserInfo()[
                        'Czymc'] + ";1";
                    let res = await CommonUtils.doRequest2Sync({
                        url: "/Sb_EqpRepairWorkBill/SaveGetEqpConkBookBillList",
                        data: {
                            "msg": sMainSub
                        },
                        method: "POST"
                    })
                    if (!res) {
                        return
                    }
                    let {
                        count,
                        Message
                    } = res.data
                    if (count == 1) {
                        uni.showModal({
                            title: '提示',
                            content: res.data.Message + '。是否继续新增?(点击取消返回上级页面)',
                            success: (res) => {
                                if (res.confirm) {
                                    console.log('用户点击确定');
                                    uni.redirectTo({
                                        url: './Sb_EquipConkBookBill?operationType=1'
                                    })
                                } else if (res.cancel) {
                                    console.log('用户点击取消');
                                    setTimeout(() => {
                                        uni.navigateBack();
                                    }, 50)
                                }
                            }
                        });
                    } else {
                        CommonUtils.showTips({
                            title: "温馨提示",
                            message: "提交单据失败: " + Message
                        })
                    }
                } catch (err) {
                    CommonUtils.showTips({
                        title: "温馨提示",
                        message: "提交单据失败: " + err
                    })
                }
            },
            async getEditData(hmainid) {
                try {
                    let res = await CommonUtils.doRequest2Async({
                        url: '/Sb_EqpRepairWorkBill/Sb_EqpConkBookBillListCheckDetai',
                        data: {
                            HID: hmainid
                        },
                    })
                    let {
                        data,
                        count,
                        msg,
                        code
                    } = res.data
                    if (code == 1) {
                        data = data.h_v_Sb_EquipConkBookBillList_Edit[0]
                        this.enableEdit = false
                    } else {
                        CommonUtils.showTips({
                            title: '温馨提示',
                            message: `获取故障登记单失败: ${msg}`
                        })
                    }
                } catch (err) {
                    CommonUtils.showTips({
                        title: '温馨提示',
                        message: `获取故障登记单失败: ${err}`
                    })
                }
            }
        },
        onLoad(e) {
            console.log('e: ', e);
            if (!e.operationType) {
                this.operationType = 1
            } else {
                this.operationType = e.operationType
            }
            if (this.operationType == 1) {
                // 新增
                this.getMaxNum()
            } else if (this.operationType == 2) {
                // 复制
            } else if (this.operationType == 3) {
                // 编辑 (PDA中没有编辑功能,故此处编辑功能先不使用)
                let hmainid = e.hmainid
                this.getEditData(hmainid)
            } else if (this.operationType == 4) {
                // 浏览
            }
            this.getHDeptList()
            this.getEmpList()
            this.getConkReason()
            this.getConkType()
        },
        onReady() {
            const query = uni.createSelectorQuery().in(this)
            query.select("#buttons")
                .boundingClientRect()
                .select("#tabs")
                .boundingClientRect()
                .exec(res => {
                    this.btnTop = Math.floor(res[0].top)
                    this.tabsBottom = Math.ceil(res[1].bottom)
                })
        }
    }
</script>
<style lang="scss" scoped>
    @import "@/pages/MJGL/style/MJBillStyle.scss"
</style>
pages/MJGL/Sb_EquipConkBook/Sb_EquipConkBookBillList.vue
New file
@@ -0,0 +1,455 @@
<template>
    <view class="content">
        <view class="form">
            <view class="form-item">
                <view class="title">开始时间:</view>
                <view class="right">
                    <uni-datetime-picker type="date" :clear-icon="false" v-model="hform.HBeginDate">
                        <input :value="hform.HBeginDate" />
                    </uni-datetime-picker>
                </view>
            </view>
            <view class="form-item">
                <view class="title">结束时间:</view>
                <view class="right">
                    <uni-datetime-picker type="date" :clear-icon="false" v-model="hform.HEndDate">
                        <input :value="hform.HEndDate" />
                    </uni-datetime-picker>
                </view>
            </view>
            <view v-if="showmore">
                <view class="form-item">
                    <view class="title">单据号:</view>
                    <view class="right">
                        <input v-model="hform.HBillNo" placeholder="请输入单据号" />
                    </view>
                </view>
            </view>
            <view class="other">
                <view v-if="!showmore" @tap="changeShowMore">
                    展开其他条件<uni-icons color="#1890FF" style="margin-left: 8rpx;" type="bottom"></uni-icons>
                </view>
                <view v-if="showmore" @tap="changeShowMore">
                    折叠其他条件<uni-icons color="#1890FF" style="margin-left: 8rpx;" type="top"></uni-icons>
                </view>
            </view>
            <view class="buttons">
                <button class="btn-a" size="mini" type="default" @tap="clear">重置</button>
                <button class="btn-b" size="mini" type="default" @tap="add">新增</button>
                <button class="btn-c" size="mini" type="default" @tap="search">查询</button>
            </view>
        </view>
        <view id="divide" style="width: 100%;height: 16rpx;background-color: #e5e5e5;"></view>
        <view :style="{
            height: calcContentHeight + 'px',
            overflowY: 'auto'
        }">
            <view class="list" v-for="(item,index) in showList" :key="index" v-if="tabs==0">
                <uni-card :title="item.制单日期.substr(0,10)" :extra="item.单据号" style="margin: 10px;"
                    @tap="showDetail = showDetail==index?-1:index">
                    <view class="card-detail"
                        v-for="(HBillField, index) in CommonUtils.emptyValueFilter(item,HFieldList).slice(0,10)" :key="index">
                        <template
                            v-if="HBillField.ColmType == 'DateTime'"><text>{{ HBillField.ColmCols }}:</text>{{ item[HBillField.ColmCols] ? dayjs(item[HBillField.ColmCols]).format("YYYY-MM-DD HH:mm:ss") : "" }}
                        </template>
                        <template
                            v-else><text>{{ HBillField.ColmCols }}:</text>{{ item[HBillField.ColmCols] }}</template>
                    </view>
                    <view class="card-detail" v-if="showDetail == index">
                        <view class="card-detail"
                            v-for="(HBillField, index) in CommonUtils.emptyValueFilter(item,HFieldList).slice(10,-1)"
                            :key="index">
                            <template
                                v-if="HBillField.ColmType == 'DateTime'"><text>{{ HBillField.ColmCols }}:</text>{{ item[HBillField.ColmCols] ? dayjs(item[HBillField.ColmCols]).format("YYYY-MM-DD HH:mm:ss") : "" }}
                            </template>
                            <template
                                v-else><text>{{ HBillField.ColmCols }}:</text>{{ item[HBillField.ColmCols] }}</template>
                        </view>
                    </view>
                    <view class="more" v-if="showDetail == index && operations != index">
                        <view class="part" style="border-right: 1px solid #eee;">
                            <uni-icons type="top" style="color: #888;margin-right: 10rpx;" size="14"></uni-icons>收起
                        </view>
                        <view class="part" @tap.stop="operations = operations==index?-1:index">
                            <uni-icons type="more-filled" style="color: #888;margin-right: 10rpx;"
                                size="14"></uni-icons>操作
                        </view>
                    </view>
                    <view class="more" v-if="showDetail != index && operations != index">
                        <view class="part" style="border-right: 1px solid #eee;">
                            <uni-icons type="bottom" style="color: #888;margin-right: 10rpx;" size="14"></uni-icons>更多信息
                        </view>
                        <view class="part" @tap.stop="operations = operations==index?-1:index">
                            <uni-icons type="more-filled" style="color: #888;margin-right: 10rpx;"
                                size="14"></uni-icons>操作
                        </view>
                    </view>
                    <view class="op" v-if="operations == index">
                        <!-- <button class="op3" size="mini" plain @tap.stop="edit(item)">编辑</button> -->
                        <button class="op4" size="mini" plain @tap.stop="del(item)">删除</button>
                        <button class="op5" size="mini" plain @tap.stop="operations = -1">取消操作</button>
                    </view>
                </uni-card>
            </view>
        </view>
        <view class="pagination-zone" id="pagination-zone">
            <uni-pagination show-icon :page-size="size" :total="dataLength" :current="page"
                @change="onPaginationChangeHandler"></uni-pagination>
        </view>
        <BarCodePopupVue ref="barcodePopup"></BarCodePopupVue>
    </view>
</template>
<script>
    import {
        getUserInfo
    } from "@/utils/auth.js";
    import BarCodePopupVue from "@/components/BarCodePopup/BarCodePopup.vue";
    import {
        CommonUtils
    } from "@/utils/common";
    import dayjs from "dayjs";
    export default {
        data() {
            return {
                dayjs,
                CommonUtils,
                userInfo: getUserInfo(),
                serverUrl: uni.getStorageSync('serverUrl') || 'http://47.96.97.237/API',
                tabs: 0,
                urls: '/Web/GetEquipmentBillsList',
                MvarReportTitle: '设备故障登记单缓存',
                hform: {
                    HBillNo: '',
                    HSourceBillNo: '',
                    HBillType: '',
                    user: uni.getStorageSync('HUserName'),
                    HStockOrgID: uni.getStorageSync('OrganizationID'),
                    Type: "GZ",
                    sWhere: "",
                    HBeginDate: dayjs(new Date()).subtract(30, 'day').format("YYYY-MM-DD"),
                    HEndDate: dayjs(new Date()).format("YYYY-MM-DD"),
                },
                sWhere: '',
                listData: [],
                showList: [],
                HFieldList: [],
                showDetail: -1,
                operations: -1,
                page: 1,
                size: 20,
                dataLength: 0,
                divideBottom: 0,
                paginationTop: 0,
                showmore: false,
            }
        },
        computed: {
            calcContentHeight: {
                get() {
                    return this.paginationTop - this.divideBottom
                }
            }
        },
        onShow() {
            //用户模块权限判断
            // this.CheckModRight()
            this.changeTab(0)
            console.log(this.userInfo, uni.getStorageSync('HUserName'))
        },
        components: {
            BarCodePopupVue
        },
        onPullDownRefresh: function() {
            this.clear()
            setTimeout(() => {
                uni.stopPullDownRefresh();
            }, 1000);
        },
        onReady() {
            this.getCalcHeight()
        },
        methods: {
            changeShowMore() {
                this.showmore = !this.showmore
                this.$nextTick(() => {
                    // 重新计算内容视口高度
                    this.getCalcHeight()
                })
            },
            getCalcHeight() {
                let query = uni.createSelectorQuery().in(this)
                query
                    .select("#divide")
                    .boundingClientRect()
                    .select("#pagination-zone")
                    .boundingClientRect()
                    .exec(res => {
                        this.divideBottom = Math.ceil(res[0].bottom)
                        this.paginationTop = Math.floor(res[1].top)
                    })
            },
            async qrCodeDisplay(item) {
                this.$refs.barcodePopup.setCodeInfo(item.HBillNo)
                await this.$nextTick()
                this.$refs.barcodePopup.open()
            },
            CheckModRight() {
                uni.request({
                    url: this.serverUrl + '/WEBSController/CheckModRight_Json',
                    data: {
                        ModRightName: 'CE_OtherOut',
                        HUserName: uni.getStorageSync('HUserName')
                    },
                    success: (res) => {
                        if (res.data.count == 1) {} else {
                            uni.showToast({
                                title: res.data.Message,
                                icon: 'none'
                            })
                        }
                    },
                    fail: (res) => {
                        console.log(res);
                        uni.showToast({
                            title: '接口请求失败',
                            icon: 'none'
                        })
                    },
                });
            },
            onPaginationChangeHandler({
                current
            }) {
                this.page = current
                this.showList = this.getPage(current, this.size, this.listData)
            },
            getPage(page, size, list) {
                let sindex = (parseInt(page) - 1) * size
                let eindex = parseInt(page) * size
                let newList = list.slice(sindex, eindex)
                return newList
            },
            changeTab(e) {
                this.tabs = e
                this.page = 1
                this.showList = []
                if (this.tabs == 0) {
                    this.urls = '/Web/GetEquipmentBillsList'
                }
                // if (this.tabs == 1) {
                //     this.urls = '/WEBSController/GetKf_ICStockBillQueryList_User_Json'
                // }
                this.search()
            },
            async getList() {
                try {
                    let res = await CommonUtils.doRequest2Async({
                        url: this.urls,
                        data: this.hform
                    })
                    let {
                        count,
                        data,
                        Message,
                        list
                    } = res.data
                    if (count == 1) {
                        if (data == null) {
                            data = []
                        }
                        this.listData = data
                        this.showList = this.getPage(this.page, this.size, data)
                        this.dataLength = data.length
                        this.HFieldList = CommonUtils.fieldListFilterRole({
                            ExcludeKeys: ["制单日期", "单据号"],
                            FieldList: Array.from(list)
                        }).data
                    } else {
                        CommonUtils.showTips({
                            title: "温馨提示",
                            message: `获取设备故障登记单失败: ${Message}`
                        })
                    }
                } catch (err) {
                    CommonUtils.showTips({
                        title: "温馨提示",
                        message: `获取设备故障登记单失败: ${err}`
                    })
                }
            },
            search() {
                this.hform.sWhere = ''
                this.listData = []
                this.page = 1
                this.showList = []
                if (this.hform.HBillNo) {
                    this.hform.sWhere += " and 单据号 like '%" + this.hform.HBillNo + "%'";
                }
                if (this.hform.HBeginDate && this.hform.HEndDate) {
                    this.hform.sWhere +=
                        ` and convert(date,日期) between convert(date, '${this.hform.HBeginDate}') and convert(date, '${this.hform.HEndDate}')`;
                }
                this.getList()
            },
            clear() {
                this.listData = []
                this.page = 1
                this.showList = []
                this.sWhere = ''
                this.hform = {
                    HBillNo: '',
                    HSourceBillNo: '',
                    HBillType: '',
                    user: uni.getStorageSync('HUserName'),
                    HStockOrgID: uni.getStorageSync('OrganizationID'),
                    Type: "GZ",
                    sWhere: "",
                    HBeginDate: dayjs(new Date()).subtract(30, 'day').format("YYYY-MM-DD"),
                    HEndDate: dayjs(new Date()).format("YYYY-MM-DD"),
                }
                this.search()
            },
            add() {
                uni.navigateTo({
                    url: '/pages/MJGL/Sb_EquipConkBook/Sb_EquipConkBookBill?operationType=1'
                })
            },
            //编辑
            edit(item) {
                return
                console.log(item)
                uni.request({
                    url: this.serverUrl + '/WEBSController/TempList_Modify_Json',
                    data: {
                        "HInterID": item.HInterID,
                        "HBillNo": item.单据号,
                        "HBillType": this.hform.HBillType
                    },
                    success: (res) => {
                        console.log(1, res);
                        if (res.data.count == 1) {
                            uni.navigateTo({
                                url: './OtherOutBill?OperationType=2&HInterID=' + item.HInterID
                            })
                        } else {
                            uni.showToast({
                                title: res.data.Message,
                                icon: 'none'
                            })
                        }
                    },
                    fail: (res) => {
                        console.log(res);
                        uni.hideLoading()
                        uni.showToast({
                            title: '接口请求失败',
                            icon: 'none'
                        })
                    },
                })
            },
            //删除
            del(item) {
                // console.log(item.hmainid,uni.getStorageSync('HUserName'))
                uni.showModal({
                    title: '提示',
                    content: '确认要删除记录?删除后不能恢复',
                    success: (res) => {
                        if (res.confirm) {
                            console.log('用户点击确定');
                            uni.request({
                                url: this.serverUrl +
                                    '/Sb_EqpRepairWorkBill/DeltetEqpConkBookBill',
                                data: {
                                    HInterID: item.hmainid,
                                    user: uni.getStorageSync('HUserName'),
                                },
                                success: (res) => {
                                    console.log(1, res);
                                    if (res.data.count == 1) {
                                        this.clear()
                                    }
                                    uni.showToast({
                                        title: res.data.Message,
                                        icon: 'none'
                                    })
                                },
                                fail: (res) => {
                                    console.log(res);
                                    uni.hideLoading()
                                    uni.showToast({
                                        title: '接口请求失败',
                                        icon: 'none'
                                    })
                                },
                            });
                        } else if (res.cancel) {
                            console.log('用户点击取消');
                        }
                    }
                });
            },
            //撤销
            revoke(item) {
                // console.log(item.hmainid,uni.getStorageSync('HUserName'))
                uni.showModal({
                    title: '提示',
                    content: '是否确认撤销',
                    success: (res) => {
                        if (res.confirm) {
                            console.log('用户点击确定');
                            uni.request({
                                url: this.serverUrl +
                                    '/WEBSController/set_DeleteICStockBillAndWMS_Json',
                                data: {
                                    HInterID: item.HInterID,
                                    HBillNo: item.单据号,
                                    HBillType: this.hform.HBillType,
                                    HMaker: uni.getStorageSync('HUserName'),
                                    MvarReportTitle: this.MvarReportTitle,
                                },
                                success: (res) => {
                                    console.log(1, res);
                                    if (res.data.count == 1) {
                                        this.clear()
                                    }
                                    uni.showToast({
                                        title: res.data.Message,
                                        icon: 'none'
                                    })
                                },
                                fail: (res) => {
                                    console.log(res);
                                    uni.hideLoading()
                                    uni.showToast({
                                        title: '接口请求失败',
                                        icon: 'none'
                                    })
                                },
                            });
                        } else if (res.cancel) {
                            console.log('用户点击取消');
                        }
                    }
                });
            },
        }
    }
</script>
<style lang="scss" scoped>
    @import "@/pages/MJGL/style/MJListStyle.scss"
</style>
pages/ZLGL/lailiaojianyan_fast/Kf_QCStockInCheckBill_Fast.vue
@@ -475,10 +475,16 @@
                    this.HCheckResultList.find(elem => elem.text == e)?.value
                if (e == '合格') {
                    this.HUseResultValueList = ["接收", "让步接收"]
                    this.detailManifestItem.HUseResultName = "接收"
                    this.detailManifestItem.HUseResult = "A"
                } else if (e == '不合格') {
                    this.HUseResultValueList = ["挑选(全检)", "判退"]
                    this.detailManifestItem.HUseResultName = "挑选(全检)"
                    this.detailManifestItem.HUseResult = "E"
                } else if (e == '保留') {
                    this.HUseResultValueList = ["接收", "让步接收", "挑选(全检)", "判退"]
                    this.detailManifestItem.HUseResultName = "接收"
                    this.detailManifestItem.HUseResult = "A"
                }
                this.HUseResultChangeHandle(this.HUseResultValueList[0])
pages/guzhangdengji/EqpConkBookBillList.vue
@@ -371,7 +371,7 @@
            edit(item){
                console.log(item)
                uni.navigateTo({
                    url:'/pages/guzhangdengji/EqpConkBookBill?hmainid=' + item.hmainid
                    url:'/pages/MJGL/Sb_EquipConkBook/Sb_EquipConkBookBill?operationType=3&hmainid=' + item.hmainid
                })
            },
            //删除
pages/index/login.vue
@@ -334,14 +334,8 @@
                                uni.setStorageSync('HWorkCenterName', res.data.data[0].HWorkCenterName);
                                uni.setStorageSync('HSecManagerID', res.data.data[0].HSecManagerID); //对应验收
                                uni.setStorageSync('HSecManagerName', res.data.data[0].HSecManagerName);
                                uni.setStorageSync('HProcID', res.data.data[0].HProcID);
                                uni.setStorageSync('HProcName', res.data.data[0].HProcName);
                                uni.setStorageSync('HSourceID', res.data.data[0].HSourceID);
                                uni.setStorageSync('HSourceName', res.data.data[0].HSourceName);
                                uni.setStorageSync('HGroupID', res.data.data[0].HGroupID);
                                uni.setStorageSync('HGroupName', res.data.data[0].HGroupName);
                                this.CommonUtils.setServerUrl(this.serverUrl)
                                this.WebSocketServices.createConnect(res.data.data[0].Czybm,res.data.data[0].Czymc);
                                // this.WebSocketServices.createConnect(res.data.data[0].Czybm,res.data.data[0].Czymc);
                                uni.reLaunch({
                                    url: '/pages/index/index'
                                })
pages/index/mine.vue
@@ -101,7 +101,7 @@
                        if (res.confirm) {
                            console.log('用户点击确定');
                            // 断开Socket连接
                            WebSocketServices.closeSocket();
                            // WebSocketServices.closeSocket();
                            // 销毁 userInfo 缓存
                            uni.removeStorageSync("userinfo")
                            uni.reLaunch({
pages/index/tab2.vue
@@ -407,11 +407,12 @@
                    },
                    {
                        "img": "../../static/icon/icon6.png",
                        "text": "设备故障登记表列表",
                        "url": "/pages/guzhangdengji/EqpConkBookBillList",
                        "text": "设备故障登记单列表",
                        "url": "/pages/MJGL/Sb_EquipConkBook/Sb_EquipConkBookBillList",
                        "id": 50,
                        "hidden": false
                    },
                    {
                        "img": "../../static/icon/icon8.png",
                        "text": "设备维修派工单列表",
pages/index/tab3.vue
@@ -74,6 +74,13 @@
                        "hidden": false
                    },
                    {
                        "img": "../../static/icon/icon6.png",
                        "text": "设备故障登记单",
                        "url": "/pages/MJGL/Sb_EquipConkBook/Sb_EquipConkBookBill?operationType=1",
                        "id": 20,
                        "hidden": false
                    },
                    {
                        "img": "../../static/icon/icon8.png",
                        "text": "模具维修派工单",
                        "url": "/pages/MJGL/Sc_MouldRepairSendWork/Sc_MouldRepairSendWorkBill",
utils/WebSocketServices.js
@@ -3,210 +3,214 @@
} from "@/utils/common.js";
class WebSocketServices {
   constructor() {
       this.wsInstance = null; // WebSocket 实例
       this.isConnecting = false; // 连接中状态(避免并发重连)
       this.isConnected = false; // 已连接状态
       this.isReconnectStopped = false; // 停止重连标记
       this.wsUrl = CommonUtils.httpFormatWs(); // WebSocket 基础地址
       // 超时校验配置
       this.noMessageTimeout = 45000; // 45秒内没收到任何业务消息 → 判定连接失效(服务端30秒发一次Ping,留15秒容错)
       this.noMessageTimer = null; // 无消息超时定时器
       // 监听函数引用
       this.openListener = null;
       this.messageListener = null;
       this.closeListener = null;
       this.errorListener = null;
       // 缓存用户信息
       this.currentUserId = "";
       this.currentUserName = "";
     }
     /**
      * 建立 WebSocket 连接
      * @param {string/number} userId - 用户ID(必填)
      * @param {string} userName - 用户名(必填)
      * @param {number} count - 当前重连次数
      * @param {number} limit - 最大重连次数(默认3次)
      */
     createConnect(userId, userName, count = 0, limit = 3) {
       // 缓存用户信息(用于重连)
       this.currentUserId = userId;
       this.currentUserName = userName;
       // 前置校验:避免无效连接和并发重连
       if (this.isConnecting || this.isConnected) return;
       if (!userId && userId !== 0) { // 兼容 userId 为 0 的合法场景
         CommonUtils.showTips({ message: "用户标识不能为空,无法建立WebSocket连接" });
         return;
       }
       if (count > limit) {
         CommonUtils.showTips({
           message: `WebSocket 重连次数超出最大限制(${limit}次),已停止重连`,
         });
         this.isReconnectStopped = true;
         return;
       }
       console.log(`[WebSocket] 开始建立连接(第 ${count || 0} 次)`, {
         wsUrl: this.wsUrl,
         userId,
         userName,
       });
       // 清除历史残留:监听+定时器
       this.clearAllListeners();
       this.clearNoMessageTimer();
       // 发起连接
       this.isConnecting = true;
       this.wsInstance = uni.connectSocket({
         url: `${this.wsUrl}?userId=${encodeURIComponent(userId)}&userName=${encodeURIComponent(userName)}`,
         fail: (error) => {
           console.error("[WebSocket] 连接发起失败", error);
           this.isConnecting = false;
           this.triggerReconnect(count);
         },
       });
       // 监听连接成功:启动无消息超时校验
       this.openListener = uni.onSocketOpen((res) => {
         console.log("[WebSocket] 连接建立成功", res);
         this.isConnecting = false;
         this.isConnected = true;
         this.isReconnectStopped = false;
         this.startNoMessageCheck();
         count = 0;
       });
       this.messageListener = uni.onSocketMessage((res) => {
         try {
           const message = JSON.parse(res.data);
           console.log("[WebSocket] 收到业务消息", message);
           // 重置无消息定时器(有业务消息=连接正常)
           this.resetNoMessageTimer();
           // 处理业务消息
           if (message.Type === "Message") {
             const content = JSON.parse(message.Content);
             this.showTaskTip(`您有${content.length}条消息需要处理!`);
             // this.emit("message", content); // 支持外部监听
           }
         } catch (error) {
           console.error("[WebSocket] 消息解析失败", error, res.data);
         }
       });
       // 监听连接关闭:仅异常关闭触发重连
       this.closeListener = uni.onSocketClose((res) => {
         console.log("[WebSocket] 连接关闭", res);
         this.isConnecting = false;
         this.isConnected = false;
         this.clearNoMessageTimer();
         // 正常关闭(code=1000)或主动停止重连时,不重连
         if (!this.isReconnectStopped && res.code !== 1000) {
           this.triggerReconnect(count);
         }
       });
       // 监听连接错误:触发重连
       this.errorListener = uni.onSocketError((error) => {
         console.error("[WebSocket] 连接错误", error);
         this.isConnecting = false;
         this.clearNoMessageTimer();
         if (!this.isReconnectStopped) {
           this.triggerReconnect(count);
         }
       });
     }
     /**
      * 统一触发重连(延迟3秒)
      * @param {number} count - 当前重连次数
      */
     triggerReconnect(count) {
       console.log(`[WebSocket] 准备第 ${count + 1} 次重连`);
       setTimeout(() => {
         this.createConnect(this.currentUserId, this.currentUserName, count + 1);
       }, 3000);
     }
     /**
      * 启动“无业务消息”超时校验
      * 逻辑:45秒内没收到任何业务消息 → 判定连接失效(服务端30秒发Ping,底层已处理,此处仅校验业务通道)
      */
     startNoMessageCheck() {
       this.clearNoMessageTimer();
       this.noMessageTimer = setTimeout(() => {
         console.warn("[WebSocket] 45秒未收到业务消息,判定连接失效,主动重连");
         this.closeSocket();
         this.createConnect(this.currentUserId, this.currentUserName);
       }, this.noMessageTimeout);
     }
     /**
      * 收到业务消息后,重置无消息定时器
      */
     resetNoMessageTimer() {
       this.startNoMessageCheck();
     }
     /**
      * 清除无消息定时器
      */
     clearNoMessageTimer() {
       if (this.noMessageTimer) {
         clearTimeout(this.noMessageTimer);
         this.noMessageTimer = null;
       }
     }
     /**
      * 清除所有 Socket 监听
      */
     clearAllListeners() {
       if (this.openListener) {
         uni.offSocketOpen(this.openListener);
         this.openListener = null;
       }
       if (this.messageListener) {
         uni.offSocketMessage(this.messageListener);
         this.messageListener = null;
       }
       if (this.closeListener) {
         uni.offSocketClose(this.closeListener);
         this.closeListener = null;
       }
       if (this.errorListener) {
         uni.offSocketError(this.errorListener);
         this.errorListener = null;
       }
     }
     /**
      * 主动关闭 WebSocket 连接 (登出时关闭WebSocket连接)
      */
     closeSocket() {
       this.isReconnectStopped = true;
       this.clearAllListeners();
       this.clearNoMessageTimer();
       if (this.wsInstance) {
         uni.closeSocket({
           success: () => console.log("[WebSocket] 主动关闭连接成功"),
           fail: (error) => console.error("[WebSocket] 主动关闭连接失败", error),
         });
         this.wsInstance = null;
       }
       this.isConnected = false;
       this.isConnecting = false;
     }
    constructor() {
        this.wsInstance = null; // WebSocket 实例
        this.isConnecting = false; // 连接中状态(避免并发重连)
        this.isConnected = false; // 已连接状态
        this.isReconnectStopped = false; // 停止重连标记
        this.wsUrl = CommonUtils.httpFormatWs(); // WebSocket 基础地址
        // 超时校验配置
        this.businessMessageInterval = 5 * 60 * 1000;
        this.noMessageTimeout = this.businessMessageInterval + 2 * 60 * 1000;
        this.noMessageTimer = null; // 无消息超时定时器
        // 监听函数引用
        this.openListener = null;
        this.messageListener = null;
        this.closeListener = null;
        this.errorListener = null;
        // 缓存用户信息
        this.currentUserId = "";
        this.currentUserName = "";
    }
    /**
     * 建立 WebSocket 连接
     * @param {string/number} userId - 用户ID(必填)
     * @param {string} userName - 用户名(必填)
     * @param {number} count - 当前重连次数
     * @param {number} limit - 最大重连次数(默认3次)
     */
    createConnect(userId, userName, count = 0, limit = 3) {
        // 登录建立连接时,需要重新获取http地址,可能会变更
        this.wsUrl = CommonUtils.httpFormatWs();
        // 缓存用户信息(用于重连)
        this.currentUserId = userId;
        this.currentUserName = userName;
        // 前置校验:避免无效连接和并发重连
        if (this.isConnecting || this.isConnected) return;
        if (!userId && userId !== 0) { // 兼容 userId 为 0 的合法场景
            CommonUtils.showTips({
                message: "用户标识不能为空,无法建立WebSocket连接"
            });
            return;
        }
        if (count > limit) {
            CommonUtils.showTips({
                message: `WebSocket 重连次数超出最大限制(${limit}次),已停止重连`,
            });
            this.isReconnectStopped = true;
            return;
        }
        console.log(`[WebSocket] 开始建立连接(第 ${count || 0} 次)`, {
            wsUrl: this.wsUrl,
            userId,
            userName,
        });
        // 清除历史残留:监听+定时器
        this.clearAllListeners();
        this.clearNoMessageTimer();
        // 发起连接
        this.isConnecting = true;
        this.wsInstance = uni.connectSocket({
            url: `${this.wsUrl}?userId=${encodeURIComponent(userId)}&userName=${encodeURIComponent(userName)}`,
            fail: (error) => {
                console.error("[WebSocket] 连接发起失败", error);
                this.isConnecting = false;
                this.triggerReconnect(count);
            },
        });
        // 监听连接成功:启动无消息超时校验
        this.openListener = uni.onSocketOpen((res) => {
            console.log("[WebSocket] 连接建立成功", res);
            this.isConnecting = false;
            this.isConnected = true;
            this.isReconnectStopped = false;
            this.startNoMessageCheck();
            count = 0;
        });
        this.messageListener = uni.onSocketMessage((res) => {
            try {
                const message = JSON.parse(res.data);
                console.log("[WebSocket] 收到业务消息", message);
                // 重置无消息定时器(有业务消息=连接正常)
                this.resetNoMessageTimer();
                // 处理业务消息
                if (message.Type === "Message") {
                    const content = JSON.parse(message.Content);
                    this.showTaskTip(`您有${content.length}条消息需要处理!`);
                    // this.emit("message", content); // 支持外部监听
                }
            } catch (error) {
                console.error("[WebSocket] 消息解析失败", error, res.data);
            }
        });
        // 监听连接关闭:仅异常关闭触发重连
        this.closeListener = uni.onSocketClose((res) => {
            console.log("[WebSocket] 连接关闭", res);
            this.isConnecting = false;
            this.isConnected = false;
            this.clearNoMessageTimer();
            // 正常关闭(code=1000)或主动停止重连时,不重连
            if (!this.isReconnectStopped && res.code !== 1000) {
                this.triggerReconnect(count);
            }
        });
        // 监听连接错误:触发重连
        this.errorListener = uni.onSocketError((error) => {
            console.error("[WebSocket] 连接错误", error);
            this.isConnecting = false;
            this.clearNoMessageTimer();
            if (!this.isReconnectStopped) {
                this.triggerReconnect(count);
            }
        });
    }
    /**
     * 统一触发重连(延迟3秒)
     * @param {number} count - 当前重连次数
     */
    triggerReconnect(count) {
        console.log(`[WebSocket] 准备第 ${count + 1} 次重连`);
        setTimeout(() => {
            this.createConnect(this.currentUserId, this.currentUserName, count + 1);
        }, 3000);
    }
    /**
     * 启动“无业务消息”超时校验
     */
    startNoMessageCheck() {
        this.clearNoMessageTimer();
        this.noMessageTimer = setTimeout(() => {
            console.warn("[WebSocket] 7分钟未收到业务消息,判定连接失效,主动重连");
            this.closeSocket();
            this.createConnect(this.currentUserId, this.currentUserName);
        }, this.noMessageTimeout);
    }
    /**
     * 收到业务消息后,重置无消息定时器
     */
    resetNoMessageTimer() {
        this.startNoMessageCheck();
    }
    /**
     * 清除无消息定时器
     */
    clearNoMessageTimer() {
        if (this.noMessageTimer) {
            clearTimeout(this.noMessageTimer);
            this.noMessageTimer = null;
        }
    }
    /**
     * 清除所有 Socket 监听
     */
    clearAllListeners() {
        if (this.openListener) {
            uni.offSocketOpen(this.openListener);
            this.openListener = null;
        }
        if (this.messageListener) {
            uni.offSocketMessage(this.messageListener);
            this.messageListener = null;
        }
        if (this.closeListener) {
            uni.offSocketClose(this.closeListener);
            this.closeListener = null;
        }
        if (this.errorListener) {
            uni.offSocketError(this.errorListener);
            this.errorListener = null;
        }
    }
    /**
     * 主动关闭 WebSocket 连接 (登出时关闭WebSocket连接)
     */
    closeSocket() {
        this.isReconnectStopped = true;
        this.clearAllListeners();
        this.clearNoMessageTimer();
        if (this.wsInstance) {
            uni.closeSocket({
                success: () => console.log("[WebSocket] 主动关闭连接成功"),
                fail: (error) => console.error("[WebSocket] 主动关闭连接失败", error),
            });
            this.wsInstance = null;
        }
        this.isConnected = false;
        this.isConnecting = false;
    }
    showTaskTip(Content) {
utils/common.js
@@ -496,7 +496,6 @@
    }
    
    httpFormatWs(httpUrl=this.serverUrl) {
        console.log('httpUrl: ',httpUrl);
        if(httpUrl.indexOf("http://") === 0){
            httpUrl = httpUrl.replace("http://", "")
            httpUrl = "ws://" + httpUrl.split(":")[0]+":8089/ws"