chenhaozhe
2026-02-05 c141b01c990146b4ef41c17a69ad3066d721a91c
pages/MJGL/Sc_MouldRepairWorkBill/Sc_MouldRepairWorkBill.vue
@@ -14,23 +14,22 @@
                            @confirm="getHBarCodeData(hform.HBarCode)" />
                    </view>
                    <uni-icons type="scan"
                       style="background-color: #3A78FF;padding: 6rpx;color: #fff;border-radius: 100%;flex-shrink: 0;"
                       size="20" @click="toScanCode"></uni-icons>
                        style="background-color: #3A78FF;padding: 6rpx;color: #fff;border-radius: 100%;flex-shrink: 0;"
                        size="20" @click="toScanCode"></uni-icons>
                </view>
            <view class="form-item" @click="searchModule">
                <view class="title">器具</view>
                <view class="righton" style="width: 350rpx;">
                    <input  placeholder="请选择器具" />
                </view>
                <uni-icons type="search"
                    style="margin-left: 10rpx;background-color: #3A78FF;padding: 6rpx;color: #fff;border-radius: 100%;"
                    size="20" ></uni-icons>
            </view>
                <view class="form-item" @click="searchModule">
                    <view class="title">器具</view>
                    <view class="righton" style="width: 350rpx;">
                        <input placeholder="请选择器具" />
                    </view>
                    <uni-icons type="search"
                        style="margin-left: 10rpx;background-color: #3A78FF;padding: 6rpx;color: #fff;border-radius: 100%;"
                        size="20"></uni-icons>
                </view>
                <view class="form-item">
                    <view class="title">源单类型</view>
                    <view class="right" v-show="showHMainSourceBillType">
                        <picker :range="arrayHMainSourceBillType"
                            @change="HMainSourceBillTypeChange">
                        <picker :range="arrayHMainSourceBillType" @change="HMainSourceBillTypeChange">
                            <input disabled name="HMainSourceBillType" v-model="HMainSourceBillType"
                                placeholder="请选择源单类型" />
@@ -175,8 +174,7 @@
                <view class="form-item">
                    <view class="title">新设计寿命</view>
                    <view class="right">
                        <input v-model="hform.HNewDesignLife"
                            placeholder="请输入新设计寿命..." />
                        <input v-model="hform.HNewDesignLife" placeholder="请输入新设计寿命..." />
                    </view>
                </view>
                <view class="form-item">
@@ -261,7 +259,7 @@
            :HSourceBillType="hform.HMainSourceBillType" :HStockOrgID="hform.HStockOrgID">
        </BillListPopupMouldConkBookBillVue>
        <BarCodePopupVue ref="barcodePopup"></BarCodePopupVue>
      <BillListPopupMouldVue @BillSelectComplete="MouldBillHandler" ref="billListMould"></BillListPopupMouldVue>
        <BillListPopupMouldVue @BillSelectComplete="MouldBillHandler" ref="billListMould"></BillListPopupMouldVue>
    </view>
</template>
<script>
@@ -277,13 +275,13 @@
    } from '../../../utils/userRelationManager';
    import BillListPopupMouldConkBookBillVue from '../../../components/BillListPopup/BillListPopupMouldConkBookBill.vue';
    import BarCodePopupVue from "../../../components/BarCodePopup/BarCodePopup.vue";
   import BillListPopupMouldVue from '../../../components/BillListPopup/BillListPopup_Mould.vue';
    import BillListPopupMouldVue from '../../../components/BillListPopup/BillListPopup_Mould.vue';
    import dayjs from 'dayjs';
    export default {
        components: {
            BarCodePopupVue,
            BillListPopupMouldConkBookBillVue,
         BillListPopupMouldVue,
            BillListPopupMouldVue,
        },
        data() {
@@ -347,15 +345,15 @@
                    "HMainSourceInterID": "0",
                    "HMainSourceEntryID": "0",
                    "XDHList": "",
                    "HRepairBeginDate": dayjs(new Date()).format("YYYY-MM-DD HH:mm:ss"),
                    "HRepairEndDate": dayjs(new Date()).format("YYYY-MM-DD HH:mm:ss"),
                    "HRepairAccepDate": dayjs(new Date()).format("YYYY-MM-DD HH:mm:ss"),
                    "HRepairBeginDate": dayjs(new Date()).format("YYYY-MM-DD"),
                    "HRepairEndDate": dayjs(new Date()).format("YYYY-MM-DD"),
                    "HRepairAccepDate": dayjs(new Date()).format("YYYY-MM-DD"),
                    "HRepairContent": "",
                    "HPlanTimes": "0",
                    "HTimes": "0",
                    "HBillNo": "",
                    "HInterID": "0",
                    "HDate": dayjs(new Date()).format("YYYY-MM-DD HH:mm:ss"),
                    "HDate": dayjs(new Date()).format("YYYY-MM-DD"),
                    "HDeptName": getUserInfo()["HDeptName"],
                    "HDeptID": getUserInfo()["HDeptID"],
                    "HEmpName": getUserInfo().HEmpName,
@@ -397,12 +395,25 @@
        computed: {},
        onLoad(e) {
            console.log(e, this.userInfo)
            this.OperationType = e.OperationType
            this.operationType = e.operationType || 1
            if (e.HInterID) {
                this.HInterID_Temp = e.HInterID
                // this.btnType = 1
                this.RoadBillMain(e.HInterID)
                this.barCodeFocus = true
                if (this.operationType == 5) {
                    // 下推
                    let {
                        HSourceBillType,
                        HInterID,
                        HBillNo,
                        HRepairSendWorkID
                    } = e
                    // 下推
                    this.getNewData()
                    this.getSourceBillInfo(HSourceBillType, HInterID, HBillNo, HRepairSendWorkID)
                } else {
                    this.HInterID_Temp = e.HInterID
                    // this.btnType = 1
                    this.RoadBillMain(e.HInterID)
                    this.barCodeFocus = true
                }
            } else {
                this.getNewData()
                this.HSourceBillNoFocus = true
@@ -412,7 +423,7 @@
            this.InitEmp()
            this.InitSupplier()
            this.InitRepairName()
         this.loadCache()
            this.loadCache()
            uni.$on('BillSelectComplete', (e) => {
                console.log("接收到的消息: ", e)
                this.hform.HMainSourceInterID = e.HInterID
@@ -429,27 +440,86 @@
            uni.$off('BillSelectComplete')
        },
        methods: {
         searchModule() {
             this.$refs['billListMould'].showPopup()
         },
         MouldBillHandler(mould) {
             if(!mould.enableMultiSourceBill){
                 let val = mould.val[0]
                 this.hform.HBarCode = val['条码编号']
                 this.getHBarCodeData(this.hform.HBarCode)
             }
             this.$refs['billListMould'].exit()
         },
            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.RepairNameChange(data[0]["维修项目"])
                    this.hform.HRepairContent = 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
                    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.HEmpID = getUserInfo()["HEmpID"]
                        this.hform.HBarName = data1.产品模具
                        this.hform.HBarModel = data1.模具型号
                        this.hform.HBarSpec = data1.模具规格
                        this.getSendWorkBill(HRepairSendWorkID)
                    } else {
                        CommonUtils.showTips({
                            title: '温馨提示',
                            message: `获取源单失败: ${Message}`
                        })
                    }
                }
            },
            searchModule() {
                this.$refs['billListMould'].showPopup()
            },
            MouldBillHandler(mould) {
                if (!mould.enableMultiSourceBill) {
                    let val = mould.val[0]
                    this.hform.HBarCode = val['条码编号']
                    this.getHBarCodeData(this.hform.HBarCode)
                }
                this.$refs['billListMould'].exit()
            },
            // 维修项目
            async InitRepairName() { // 初始化维修项目
                try {
                    let res = await CommonUtils.doRequest2Async({
                        url: '/PublicPageMethod/Gy_RepairList_PDA',
                        data: {
                           sWhere: ''
                            sWhere: ''
                        }
                    })
                    let {
                        count,
                        data,
@@ -474,13 +544,13 @@
            },
            RepairNameChange(elem) {
                let index = this.RepairNameNameList.findIndex(e => e == elem)
                if (index == -1) {
                    this.hform.HRepairName = ''
                    this.hform.HRepairID = 0
                    return
                }
                this.hform.HRepairName = this.RepairNameList[index]['HName']
                this.hform.HRepairID = this.RepairNameList[index]['HItemID']
            },
@@ -752,30 +822,30 @@
                    this.hform.HMainSourceBillType = -1
                    return
                }
            console.log(e.detail.value)
            console.log(e)
                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
            })
                const pages = getCurrentPages()
                // 获取页面栈中的最后一个元素,也就是当前显示的页面
                const currentPage = pages[pages.length - 1]
                // 选择源单类型后 缓存当前页面选择
                uni.setStorageSync(`${currentPage.route.split("/").pop()}_HSourceBillTypeCache`, {
                    HSourceBillTypeName: this.HMainSourceBillType,
                    HSourceBillType: this.hform.HMainSourceBillType
                })
            },
         // 读取缓存
         loadCache() {
             const pages = getCurrentPages()
             // 获取页面栈中的最后一个元素,也就是当前显示的页面
             const currentPage = pages[pages.length - 1]
             let HBillTypeCache = uni.getStorageSync(`${currentPage.route.split("/").pop()}_HSourceBillTypeCache`)
             if (HBillTypeCache) {
                 this.HMainSourceBillType = HBillTypeCache.HSourceBillTypeName
                 this.hform.HMainSourceBillType = HBillTypeCache.HSourceBillType
             }
         },
            // 读取缓存
            loadCache() {
                const pages = getCurrentPages()
                // 获取页面栈中的最后一个元素,也就是当前显示的页面
                const currentPage = pages[pages.length - 1]
                let HBillTypeCache = uni.getStorageSync(`${currentPage.route.split("/").pop()}_HSourceBillTypeCache`)
                if (HBillTypeCache) {
                    this.HMainSourceBillType = HBillTypeCache.HSourceBillTypeName
                    this.hform.HMainSourceBillType = HBillTypeCache.HSourceBillType
                }
            },
            // 扫描模具条码
            async getHBarCodeData(HBarCode) {
                if (!HBarCode) {
@@ -1086,7 +1156,7 @@
                                } else if (res.cancel) {
                                    console.log('用户点击取消');
                                    setTimeout(() => {
                                       uni.navigateBack();
                                        uni.navigateBack();
                                    }, 50)
                                }
                            }