yusijie
2026-02-06 28328db7ef0b0270e9e94b6a11b32cb5f9bdac88
pages/MJGL/SC_MouldRepairCheck/Sc_MouldRepairCheckBill.vue
@@ -2,9 +2,7 @@
    <view>
        <view class="tabs" id="tabs">
            <view :class="tabs == 0 ? 'on':''" @tap="tabs = 0">基本信息</view>
            <!-- <view :class="tabs == 1 ? 'on':''" @tap="tabs = 1">明细信息</view> -->
            <view :class="tabs == 2 ? 'on':''" @tap="tabs = 2">其他信息</view>
            <!-- <view :class="tabs == 3 ? 'on':''" @tap="tabs = 3">附件信息</view> -->
        </view>
        <!-- 基本信息 -->
        <template v-if="tabs == 0">
@@ -48,22 +46,31 @@
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">源单类型:</view>
                    <zxz-uni-data-select class="right" :localdata="[
                        {key: '手工录入', value: '-1'},
                        {key: '模具故障登记单', value: '3815'}
                        ]" dataKey="key" dataValue="value" v-model="hform.HMainSourceBillType">
                    <view class="title">源单类型</view>
                    <view class="right" v-show="showHMainSourceBillType">
                        <picker :range="arrayHMainSourceBillType" @change="HMainSourceBillTypeChange">
                    </zxz-uni-data-select>
                    <!-- <input disabled v-model="hform.HDeptName" placeholder="请选择部门" /> -->
                            <input disabled name="HMainSourceBillType" v-model="HMainSourceBillType"
                                placeholder="请选择源单类型" />
                            <view class="picker-overlay"></view>
                        </picker>
                    </view>
                    <view class="righton" v-show="!showHMainSourceBillType">
                        <input name="HMainSourceBillType" disabled v-model="HMainSourceBillType"
                            placeholder="请选择源单类型" />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">源单号:</view>
                    <view class="right">
                        <input v-model="hform.HMainSourceBillNo" />
                    <view class="title required">故障登记单</view>
                    <view class="right" v-show="hform.HMainSourceBillType != 1">
                        <input type="text" name="HBarCode" v-model="hform.HMainSourceBillNo" />
                    </view>
                    <view class="icon-wrapper">
                        <uni-icons type="search" size="20" @click="toCheckFile"></uni-icons>
                    <view class="icon-wrapper" v-show="hform.HMainSourceBillType != 1"
                        :disabled="hform.HMainSourceBillType == -1">
                        <uni-icons type="search" size="20" @click="showBillList"></uni-icons>
                    </view>
                    <view class="righton" v-show="hform.HMainSourceBillType == 1">
                        <input type="text" disabled name="HBarCode" v-model="hform.HMainSourceBillNo" />
                    </view>
                </view>
                <view class="form-item">
@@ -84,40 +91,38 @@
                        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="HRepairCheckList" dataKey="维修验收项目"
                        dataValue="hitemid" v-model="hform.HRepairCheckMainID">
                    </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 required">维修记录:</view>
                    <view class="right">
                        <input type="text" value="" />
                    <view class="right" v-show="hform.HMainSourceBillType != 1">
                        <input type="text" v-model="hform.HMouldRepairWorkName"
                            :disabled="hform.HMainSourceBillType == -1" placeholder="请选择维修记录" />
                    </view>
                    <view class="icon-wrapper">
                        <uni-icons type="search" size="20" @click="toCheckFile"></uni-icons>
                    <view class="icon-wrapper" v-show="hform.HMainSourceBillType != 1"
                        :disabled="hform.HMainSourceBillType == -1">
                        <uni-icons type="search" size="20" @click="showRepairRecordList"></uni-icons>
                    </view>
                    <view class="righton" v-show="hform.HMainSourceBillType == 1">
                        <input type="text" disabled v-model="hform.HMouldRepairWorkName" />
                    </view>
                </view>
                <view class="form-item">
@@ -204,7 +209,13 @@
            <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>
        <!-- 弹出模具故障登记单的选择列表 -->
        <BillListPopupMouldConkBookBillVue ref="billList" :HBillType="hform.HBillType"
            :HSourceBillType="hform.HMainSourceBillType" :HStockOrgID="hform.HStockOrgID">
        </BillListPopupMouldConkBookBillVue>
        <!-- 弹出模具维修记录单的选择列表 -->
        <RepairRecordPopup ref="repairRecordList" :HBillType="hform.HBillType" :HStockOrgID="hform.HStockOrgID">
        </RepairRecordPopup>
    </view>
</template>
@@ -219,25 +230,37 @@
    import {
        getUserInfo
    } from "../../../utils/auth";
    import BillListPopupMouldConkBookBillVue from '../../../components/BillListPopup/BillListPopupMouldConkBookBill.vue';
    import RepairRecordPopup from '../../../components/BillListPopup/BillListPopuMouldRepairRecordPopup.vue';
    export default {
        components: {
            BillListPopupMouldConkBookBillVue,
            RepairRecordPopup
        },
        name: 'Sc_MouldRepairCheckBill',
        data() {
            return {
                tabs: 0,
                HMainSourceBillType: "",
                btnTop: 0,
                tabsBottom: 0,
                HModName: "Sc_MouldRepairCheckBill",
                HBillType: '3817',
                operationType: 1,
                uploadOptions: {},
                enableEdit: true,
                // 控制源单类型是否可编辑
                showHMainSourceBillType: true,
                HMainSourceBillType: '模具故障登记单',
                arrayHMainSourceBillType: ['模具故障登记单'],
                arrayHMainSourceBillTypeID: ['3815'],
                HDeptList: [],
                HRepairCheckList: [],
                HEmpList: [],
                hform: {
                    "HBillType": 3817,
                    "HBarCode": "",
                    "HBillNo": "",
                    "HInterID": 0,
@@ -247,23 +270,24 @@
                    "HMouldSpec": "",
                    "HMouldModel": "",
                    "HMouldID": 0,
                    "HMainSourceBillType": "-1",
                    "HMainSourceBillType": "3815",
                    "HMainSourceInterID": 0,
                    "HMainSourceEntryID": 0,
                    "HCheckResult": "OK",
                    "HEmpName": "",
                    "HEmpID": 0,
                    "HEmpName": getUserInfo().HEmpName,
                    "HEmpID": getUserInfo().HEmpID,
                    "HCheckBeginDate": dayjs(new Date()).format("YYYY-MM-DD"),
                    "HDeptName": "",
                    "HDeptID": 0,
                    "HDeptName": getUserInfo().HDeptName,
                    "HDeptID": getUserInfo().HDeptID,
                    "HMainSourceBillNo": "",
                    "HManagerName": "",
                    "HManagerID": 0,
                    "HManagerName": getUserInfo().HManagerName,
                    "HManagerID": getUserInfo().HManagerID,
                    "HMouldRepairWorkName": "",
                    "HMouldRepairWorkID": 0,
                    "HExplanation": "",
                    "HRemark": "",
                    "HOrgID": uni.getStorageSync("OrganizationID"),
                    "HStockOrgID": uni.getStorageSync("OrganizationID"),
                    "HMaker": getUserInfo()["Czymc"],
                    "HChecker": "",
                    "HCloseMan": "",
@@ -338,11 +362,44 @@
            },
            addNew() {
                uni.redirectTo({
                    url: './Sb_MouldRepairCheckBill?operationType=1'
                    url: './Sc_MouldRepairCheckBill?operationType=1'
                })
            },
            goBack() {
                uni.navigateBack()
            },
            showBillList() {
                this.$refs.billList.showPopup()
            },
            showRepairRecordList() {
                if (this.hform.HMouldID === 0) {
                    CommonUtils.showTips({
                        title: '提示',
                        message: '请先选择模具'
                    });
                    return;
                }
                this.$refs.repairRecordList.showPopup(this.hform.HMouldID);
            },
            //选择源单类型
            HMainSourceBillTypeChange(e) {
                if (e.detail.value == -1 || e.detail.value == NaN) {
                    this.HMainSourceBillType = '手工录入'
                    this.hform.HMainSourceBillType = -1
                    return
                }
                console.log(e.detail.value)
                console.log(e)
                this.HMainSourceBillType = this.arrayHMainSourceBillType[e.detail.value]
                this.hform.HMainSourceBillType = this.arrayHMainSourceBillTypeID[e.detail.value]
                const pages = getCurrentPages()
                // 获取页面栈中的最后一个元素,也就是当前显示的页面
                const currentPage = pages[pages.length - 1]
                // 选择源单类型后 缓存当前页面选择
                uni.setStorageSync(`${currentPage.route.split("/").pop()}_HSourceBillTypeCache`, {
                    HSourceBillTypeName: this.HMainSourceBillType,
                    HSourceBillType: this.hform.HMainSourceBillType
                })
            },
            checkBoxChangeHandler(index, e) {
                let cr = e.detail.value
@@ -352,96 +409,13 @@
                    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: "",
                            sWhere: ` and HUSEORGID = ${uni.getStorageSync('OrganizationID')}`,
                            user: uni.getStorageSync('HUserName'),
                            Organization: uni.getStorageSync('Organization')
                        }
@@ -530,7 +504,7 @@
            },
            toScanCode() {
                MpaasScan.scanCode(cb => {
                    this.hfrom.HBarCode = cb
                    this.hform.HBarCode = cb
                    this.GetMessageByBarCode(cb)
                })
            },
@@ -574,65 +548,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}`
                    })
                }
            },
@@ -731,6 +646,60 @@
                        message: "提交单据失败: " + err
                    })
                }
            },
            async getSendWorkBill(HRepairSendWorkID) {
                let res2 = await CommonUtils.doRequest2Async({
                    url: "/Sc_MouldRepairSendWorkBill/Sc_MouldRepairSendWorkBill_Edit",
                    data: {
                        "linterid": HRepairSendWorkID,
                        "user": getUserInfo()["Czymc"]
                    }
                })
                let {data, count, Message} = res2.data
                if(count == 1) {
                    this.hform.HRepairCheckMainID = this.HRepairCheckList.find(item => item["维修验收项目"] == data[0]["维修项目"])?.hitemid
                    this.hform.HRepairCheckMainContent = data[0]["维修内容"]
                } else {
                }
            },
            async getSourceBillInfo(HSourceBillType, HInterID, HBillNo, HRepairSendWorkID) {
                // 下推单据类型为设备故障登记单
                if(HSourceBillType == 3815) {
                    let res = await CommonUtils.doRequest2Async({
                        url: "/Sc_MouldConkBookBill/Sb_MouldConkBookBillListCheckDetai",
                        data: {
                            HID: HInterID
                        }
                    })
                    let {data,code, count, Message} = res.data
                    console.log('data: ',data);
                    if(code == 1) {
                        console.log('data: ',data.h_v_Sc_MouldConkBookBillList_Edit);
                        let data1 = data.h_v_Sc_MouldConkBookBillList_Edit[0]
                        this.hform.HMainSourceBillType = HSourceBillType
                        this.HMainSourceBillType = '器具故障登记单'
                        this.hform.HMainSourceBillNo = data1.单据号
                        this.hform.HMainSourceInterID = data1.hmainid
                        this.hform.HMainSourceEntryID = data1.hsubid
                        this.hform.HMouldID = data1.HMouldID
                        this.hform.HManagerName = data1.负责人
                        this.hform.HManagerID = data1.HManagerID
                        this.hform.HMouldName = data1.产品模具
                        this.hform.HMouldModel = data1.产品模具型号
                        this.hform.HMouldSpec = data1.产品模具规格
                        this.getSendWorkBill(HRepairSendWorkID)
                    }
                    else {
                        CommonUtils.showTips({
                            title: '温馨提示',
                            message: `获取源单失败: ${Message}`
                        })
                    }
                }
            }
        },
        onLoad(e) {
@@ -750,13 +719,56 @@
                // 编辑
            } else if (this.operationType == 4) {
                // 浏览
                // 下推
                // 下推
                let {
                    HSourceBillType,
                    HInterID,
                    HBillNo,
                    HRepairBillNo,
                    HRepairID,
                    HRepairSendWorkID
                } = e
                // 下推
                // this.enableEdit = false;
                // this.enableSourceBillEdit = false;
                // this.showHMainSourceBillType = false;
                this.hform.HMouldRepairWorkID = HRepairID
                this.hform.HMouldRepairWorkName = HRepairBillNo
                this.getMaxNum()
                this.getSourceBillInfo(HSourceBillType, HInterID, HBillNo, HRepairSendWorkID)
            }
            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.HMouldID = e.HMouldID
                this.hform.HMouldName = e.HMouldName
                this.hform.HMouldSpec = e.HMouldSpec
                this.hform.HMouldModel = e.HMouldModel
                this.$refs.billList.exit()
            })
            // 监听维修记录选择完成事件
            uni.$on('RepairRecordSelectComplete', (e) => {
                console.log("接收到维修记录选择: ", e);
                if (e.HInterID) {
                    this.hform.HMouldRepairWorkName = e.HBillNo;
                    this.hform.HMouldRepairWorkID = e.HInterID;
                    // 可以根据需要设置其他字段
                }
                this.$refs.repairRecordList.exit();
            });
        },
        onUnload() {
            uni.$off('BillSelectComplete');
            uni.$off('RepairRecordSelectComplete');
        },
        onReady() {
            const query = uni.createSelectorQuery().in(this)