qq_41295110
2026-02-26 423c1948a631cff298e6348cc55626f5149c111a
pages/MJGL/Sb_EquipRepairCheckBill/Sb_EquipRepairCheckBill.vue
@@ -42,9 +42,26 @@
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">验证内容:</view>
                    <view class="title">验收内容:</view>
                    <view class="right">
                        <textarea v-model="hform.HRepairCheckMainContent" placeholder="请输入验证内容" />
                        <textarea v-model="HDetailList[0].HRepairCheckContent" placeholder="请输入验收内容" />
                    </view>
                </view>
                <!-- 维修记录(源单) -->
                <view class="form-item">
                    <view class="title required">维修记录:</view>
                    <view :class="enableSourceBillEdit?'right':'righton'">
                        <input v-model="hform.HMainSourceBillNo" :disabled="!enableSourceBillEdit"
                            @confirm="GetMessageByHMainSourceBillNo(hform.HMainSourceBillNo)"
                            placeholder="请输入(或扫描)维修记录单号" />
                    </view>
                    <!-- 放大镜图标 -->
                    <view class="icon-wrapper">
                        <uni-icons type="search" size="20" @click="showBillList"></uni-icons>
                    </view>
                    <!-- 扫描图标 -->
                    <view class="icon-wrapper">
                        <uni-icons type="scan" size="20" @click="toScanHMainSourceBillNo"></uni-icons>
                    </view>
                </view>
                <view class="form-item">
@@ -63,33 +80,25 @@
                    <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>
                    <view class="title">验收项目:</view>
                    <zxz-uni-data-select required class="right" :localdata="HRepairCheckList" dataKey="维修验收项目"
                        dataValue="hitemid" v-model="hform.HRepairCheckMainID">
                        dataValue="hitemid" v-model="hform.HRepairCheckID">
                    </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>
@@ -176,6 +185,11 @@
            <button class="btn-c" size="mini" @tap="goBack">退出</button>
        </view>
        <xe-upload ref="XeUpload" :options="uploadOptions" @callback="handleUploadCallback"></xe-upload>
        <!-- 源单单据列表弹窗 -->
        <BillListPopupEquipConkBookBillVue ref="billList" :HBillType="hform.HBillType" :HSourceBillType="'设备维修记录单'"
            :HStockOrgID="hform.HStockOrgID">
        </BillListPopupEquipConkBookBillVue>
    </view>
</template>
@@ -190,12 +204,17 @@
    import {
        getUserInfo
    } from "../../../utils/auth";
    // 引入源单单据列表弹窗组件
    import BillListPopupEquipConkBookBillVue from '../../../components/BillListPopup/BillListPopupEquipConkBookBill.vue';
    export default {
        name: 'sb_EquipRepairCheckBill',
        components: {
            BillListPopupEquipConkBookBillVue
        },
        data() {
            return {
                tabs: 0,
                HMainSourceBillType: "",
                btnTop: 0,
                tabsBottom: 0,
                HModName: "sb_EquipRepairCheckBill",
@@ -203,33 +222,35 @@
                operationType: 1,
                uploadOptions: {},
                enableEdit: true,
                enableSourceBillEdit: true, // 新增:控制维修记录编辑状态
                HDeptList: [],
                HRepairCheckList: [],
                HEmpList: [],
                hform: {
                    "HBillType": '3911',
                    "HBarCode": "",
                    "HCheckBeginDate": dayjs(new Date()).format("YYYY-MM-DD HH:mm:ss"),
                    "HCheckBeginDate": dayjs(new Date()).format("YYYY-MM-DD"),
                    "HCheckResult": "OK",
                    "HRepairCheckMainContent": "",
                    "HRepairCheckContent": "",
                    "HBillNo": "",
                    "HInterID": 0,
                    "HDate": dayjs(new Date()).format("YYYY-MM-DD HH:mm:ss"),
                    "HDeptName": "",
                    "HDeptID": 0,
                    "HEmpName": "",
                    "HEmpID": 0,
                    "HDate": dayjs(new Date()).format("YYYY-MM-DD"),
                    "HDeptName": getUserInfo().HDeptName,
                    "HDeptID": getUserInfo().HDeptID,
                    "HEmpName": getUserInfo().HEmpName,
                    "HEmpID": getUserInfo().HEmpID,
                    "HManagerName": getUserInfo().HManagerName,
                    "HManagerID": getUserInfo().HManagerID,
                    "HRepairCheckMainName": "",
                    "HRepairCheckMainID": 0,
                    "HManagerName": "",
                    "HManagerID": 0,
                    "HRepairCheckID": 0,
                    "HBarName": "",
                    "HEquipID": 0,
                    "HBarSpec": "",
                    "HBarModel": "",
                    "HMaker": getUserInfo()["Czymc"],
                    "HMakeDate": dayjs(new Date()).format("YYYY-MM-DD HH:mm:ss"),
                    "HMakeDate": dayjs(new Date()).format("YYYY-MM-DD"),
                    "HUpDater": "",
                    "HUpDateDate": "",
                    "HChecker": "",
@@ -237,16 +258,23 @@
                    "HDeleteMan": "",
                    "HDeleteDate": "",
                    "lngBillKey": "",
                    "lngBillSubKey": ""
                    "lngBillSubKey": "",
                    // 新增:维修记录(源单)相关字段
                    "HMainSourceBillNo": "",
                    "HMainSourceInterID": 0,
                    "HMainSourceEntryID": 0,
                    "HMouldRepairWorkName": "",
                    "HMouldRepairWorkID": 0,
                    "HStockOrgID": uni.getStorageSync("OrganizationID"),
                },
                HBillSub: [{ // 后端接口需要。否则数据不会显示在缓存中
                    "HRepairID": 0,
                HDetailList: [{ // 后端接口提交需要 明细信息
                    "HRepairCheckID": 0,
                    "HRepairCode": "",
                    "HRepairName": "",
                    "HManagerID": 0,
                    "HManagerCode": "",
                    "HManagerName": "",
                    "HRepairExplanation": "",
                    "HRepairCheckContent": "",
                    "HRemark": "",
                    "LAY_TABLE_INDEX": 0
                }]
@@ -260,6 +288,106 @@
            },
        },
        methods: {
            // 显示源单单据列表弹窗
            showBillList() {
                this.$refs.billList.showPopup();
            },
            // 扫描维修记录单号
            toScanHMainSourceBillNo() {
                MpaasScan.scanCode(cb => {
                    this.hform.HMainSourceBillNo = cb;
                    this.GetMessageByHMainSourceBillNo(cb);
                });
            },
            // 根据维修记录单号获取信息
            async GetMessageByHMainSourceBillNo(HSouceBillNo) {
                try {
                    let url = "/Sb_EqpRepairWorkBill/GetEqpRepairWorkBillListPage";
                    let dataField = {
                        sWhere: ` and 单据号 = '${HSouceBillNo}'`,
                        user: getUserInfo()["Czymc"],
                        page: 1,
                        size: 1,
                    };
                    let res = await CommonUtils.doRequest2Async({
                        url: url,
                        data: dataField
                    });
                    let {
                        count,
                        Message,
                        data
                    } = res.data;
                    if (count == 1) {
                        this.hform.HMainSourceBillNo = data[0]["单据号"];
                        this.hform.HMainSourceInterID = data[0]["hmainid"];
                        this.hform.HMainSourceEntryID = data[0]["hsubid"];
                        // 如果源单有设备信息,可以自动填充
                        if (data[0].HEquipID) {
                            this.hform.HEquipID = data[0].HEquipID;
                            this.getEquipFileMain(data[0].HEquipID);
                        }
                    } else {
                        CommonUtils.showTips({
                            title: "温馨提示",
                            message: `获取维修记录单失败: ${Message}`
                        });
                    }
                } catch (err) {
                    CommonUtils.showTips({
                        title: "温馨提示",
                        message: `获取维修记录单失败: ${err}`
                    });
                }
            },
            // 根据设备ID获取设备信息
            async getEquipFileMain(HInterID) {
                try {
                    let res = await CommonUtils.doRequest2Sync({
                        url: "/Sb_PDA_EquipDotCheckBill/txtHBarCode_KeyDown_ListByHEquipID",
                        data: {
                            HEquipID: HInterID,
                        },
                    });
                    if (!res) {
                        return;
                    }
                    let {
                        data,
                        count,
                        Message
                    } = res.data;
                    if (count == 1) {
                        this.hform.HEquipID = data[0].hmainid;
                        this.hform.HBarName = data[0].设备名称;
                        this.hform.HBarSpec = data[0].设备规格;
                        this.hform.HBarModel = data[0].设备型号;
                        this.hform.HBarCode = data[0].设备条码 || "";
                        this.enableEdit = false;
                    } else {
                        CommonUtils.showTips({
                            title: "温馨提示",
                            message: Message
                        });
                    }
                } catch (err) {
                    CommonUtils.showTips({
                        title: "温馨提示",
                        message: err
                    });
                }
            },
            // 提交数据有效性校验
            ValidCheck() {
                if (this.hform.HEquipID == 0) {
@@ -280,7 +408,7 @@
                        state: false
                    }
                }
                if (this.hform.HRepairCheckMainID == 0) {
                if (this.hform.HRepairCheckID == 0) {
                    return {
                        Message: "验证项目不得为空!",
                        state: false
@@ -289,6 +417,13 @@
                if (this.hform.HManagerID == 0) {
                    return {
                        Message: "负责人不得为空!",
                        state: false
                    }
                }
                // 新增:维修记录校验
                if (!this.hform.HMainSourceBillNo || this.hform.HMainSourceBillNo.trim() === '') {
                    return {
                        Message: "维修记录不得为空!",
                        state: false
                    }
                }
@@ -432,10 +567,14 @@
            // 获取职员数据
            async getEmpList() {
                try {
                    let sWhere=  " where 1=1 "
                    if(this.hform.HDeptName && uni.getStorageSync("Organization") == '宁波市华舟包装有限公司'){
                        // sWhere += ` and HDeptName = '${this.hform.HDeptName}'`
                    }
                    let res = await CommonUtils.doRequest2Async({
                        url: '/PublicPageMethod/UserList',
                        data: {
                            sWhere: " where 1=1",
                            sWhere: sWhere,
                        }
                    })
@@ -492,7 +631,7 @@
            },
            toScanCode() {
                MpaasScan.scanCode(cb => {
                    this.hfrom.HBarCode = cb
                    this.hform.HBarCode = cb; // 修复:原来是 hfrom 应该是 hform
                    this.GetMessageByBarCode(cb)
                })
            },
@@ -504,7 +643,6 @@
                            HBarCode: HBarCode,
                        },
                    })
                    if (!res) {
                        return
@@ -522,6 +660,7 @@
                        this.hform.HBarName = data[0].设备名称
                        this.hform.HBarSpec = data[0].设备规格
                        this.hform.HBarModel = data[0].设备型号
                        this.hform.HBarCode = HBarCode;
                        this.hform.HQty = 1
                        this.enableEdit = false
@@ -536,65 +675,6 @@
                    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}`
                    })
                }
            },
@@ -629,6 +709,73 @@
                    })
                }
            },
            async getSendWorkBill(HSendWorkID) {
                try{
                    let res = await CommonUtils.doRequest2Async({
                        url: "/Sb_EquipRepairSendWorkBill/GetEquipRepairSendWorkBillList",
                        data: {
                            sWhere: ` and hmainid ='${HSendWorkID}' `,
                            user: getUserInfo()["Czymc"]
                        }
                    })
                    let {data, count, Message} = res.data
                    if(count == 1) {
                        this.hform.HRepairCheckID = this.HRepairCheckList.find(item => data[0]["表体维修项目"] == item["维修验收项目"])?.hitemid
                        this.HDetailList[0].HRepairCheckContent = data[0].维修内容
                    }else {
                       CommonUtils.showTips({
                           title: "温馨提示",
                           message: `获取派工单失败: ${Message}`
                       })
                    }
                }catch(err) {
                    CommonUtils.showTips({
                        title: "温馨提示",
                        message: `获取派工单失败: ${err}`
                    })
                }
            },
            async getSourceBillInfo(HSourceBillType, HInterID, HBillNo, HSendWorkID) {
                // 下推单据类型为设备故障登记单
                if (HSourceBillType == 3907) {
                    let res = await CommonUtils.doRequest2Async({
                        url: "/Sb_EqpRepairWorkBill/GetEquipMatainanceBillBySourceInterID",
                        data: {
                            user: getUserInfo()["Czymc"],
                            HSourceInterID: HInterID
                        }
                    })
                    let {
                        data,
                        code,
                        count,
                        Message
                    } = res.data
                    if (count == 1) {
                        console.log('data: ', data);
                        let data1 = data[0]
                        this.hform.HEquipID = data[0].HEquipID
                        this.hform.HBarName = data[0].设备名称
                        this.hform.HBarModel = data[0].设备规格
                        this.hform.HBarSpec = data[0].设备规格
                        this.hform.HMainSourceBillNo = data[0]["设备维修记录单"];
                        this.hform.HMainSourceInterID = data[0]["HEquipRepairCheckBillInterID"];
                        this.hform.HMainSourceEntryID = data[0]["HEquipRepairCheckBillEntryID"];
                        this.hform.HManagerID = data[0]["HManagerID"];
                        this.hform.HEmpID = data[0]["HEmpID"];
                        this.getSendWorkBill(HSendWorkID)
                    } else {
                        CommonUtils.showTips({
                            title: '温馨提示',
                            message: `获取源单失败: ${Message}`
                        })
                    }
                }
            },
            async submit() {
                let valid = this.ValidCheck()
                if (!valid.state) {
@@ -640,7 +787,9 @@
                try {
                    let oMain = JSON.stringify(this.hform);
                    let sSubStr = JSON.stringify(this.HBillSub);
                    this.HDetailList[0].HManagerID = this.hform.HManagerID
                    this.HDetailList[0].HRepairCheckID = this.hform.HRepairCheckID
                    let sSubStr = JSON.stringify(this.HDetailList);
                    let sMainSub = oMain + ';' + sSubStr + ';' + getUserInfo()['Czymc'];
                    let res = await CommonUtils.doRequest2Sync({
                        url: "/Sb_EqpRepairWorkBill/SaveGetEqpRepairCheckBillList",
@@ -683,7 +832,6 @@
                        })
                    }
                } catch (err) {
                    CommonUtils.showTips({
                        title: "温馨提示",
@@ -703,19 +851,47 @@
            if (this.operationType == 1) {
                // 新增
                this.getMaxNum()
                this.enableEdit = true;
                this.enableSourceBillEdit = true;
            } else if (this.operationType == 2) {
                // 复制
            } else if (this.operationType == 3) {
                // 编辑
            } else if (this.operationType == 4) {
                // 浏览
                // 下推
                let {
                    HSourceBillType,
                    HInterID,
                    HBillNo,
                    HSendWorkID
                } = e
                // 下推
                this.getMaxNum()
                this.getSourceBillInfo(HSourceBillType, HInterID, HBillNo, HSendWorkID)
            }
            this.getHDeptList()
            this.getEmpList()
            this.getCheckProjList()
            // 监听单据选择完成事件
            uni.$on('BillSelectComplete', (e) => {
                console.log("接收到的消息: ", e)
                this.hform.HMainSourceInterID = e.HInterID
                this.hform.HMainSourceBillNo = e.HBillNo
                this.hform.HMainSourceEntryID = e.HEntryID
                this.hform.HMouldRepairWorkID = e.HInterID
                this.hform.HMouldRepairWorkName = e.HBillNo
                this.hform.HEquipID = e.HEquipID
                this.hform.HBarName = e.HEquipName
                this.hform.HBarSpec = e.HEquipSpec
                this.hform.HBarModel = e.HEquipModel
                this.hform.HBarCode = e.HEquipBarCode || ""
                this.$refs.billList.exit()
            })
        },
        onUnload() {
            uni.$off('BillSelectComplete')
        },
        onReady() {
            const query = uni.createSelectorQuery().in(this)