wtt
2026-01-23 920675a9f1ccf311d32e6466ebde737dff765645
pages/MJGL/Sc_MouldRepairSendWork/Sc_MouldRepairSendWorkBill.vue
@@ -1,887 +1,951 @@
<template>
    <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">
            <view class="form" :style="{
   <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">
         <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="date" :clear-icon="false" v-model="hform.HRepairBeginDate">
                            <input :value="hform.HRepairBeginDate" />
                        </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.HRepairEndDate">
                            <input :value="hform.HRepairEndDate" />
                        </uni-datetime-picker>
                    </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">时间单位:</view>
                    <zxz-uni-data-select class="right" :localdata="[
                        {key: '小时', value: '小时'},
                        {key: '天', value: '天'},
                        {key: '月', value: '月'},
                    ]" dataKey="key" dataValue="value" v-model="hform.HCycleUnit">
                    </zxz-uni-data-select>
                </view>
                <view class="form-item">
                    <view class="title required">计划维修工时:</view>
                    <view class="right">
                        <input type="number" v-model="hform.HPlanTimes" />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title required">实际维修工时:</view>
                    <view class="right">
                        <input type="number" v-model="hform.HTimes" />
                    </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">
            <!-- 原内容保持不变 -->
            <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="date" :clear-icon="false" v-model="hform.HRepairBeginDate">
                     <input :value="hform.HRepairBeginDate" />
                  </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.HRepairEndDate">
                     <input :value="hform.HRepairEndDate" />
                  </uni-datetime-picker>
               </view>
            </view>
            <!-- 新增源单类型和故障登记单选择 -->
            <view class="form-item">
               <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="请选择部门" /> -->
                </view>
                <view class="form-item">
                    <view class="title required">维修项目:</view>
                    <zxz-uni-data-select required class="right" :localdata="HRepairList" dataKey="维修项目"
                        dataValue="hitemid" v-model="hform.HRepairID">
                     <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 required">故障登记单</view>
               <view class="right" v-show="hform.HMainSourceBillType != 1">
                  <input type="text" name="HBarCode" v-model="hform.HMainSourceBillNo" />
               </view>
               <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">
               <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>
                    </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">
            <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">器具名称:</view>
                    <view class="righton">
                        <input v-model="hform.HMouldName" disabled />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">器具规格:</view>
                    <view class="righton">
                        <input v-model="hform.HMouldModel" disabled />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">器具型号:</view>
                    <view class="righton">
                        <input v-model="hform.HMouldSpec" disabled />
                    </view>
                </view>
            </view>
        </template>
        <!-- 其他信息(非重要信息) -->
        <template v-if="tabs == 1">
            <view class="form" :style="{
               </zxz-uni-data-select>
            </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>
            </view>
            <view class="form-item">
               <view class="title required">维修项目:</view>
               <zxz-uni-data-select required class="right" :localdata="HRepairList" dataKey="维修项目"
                  dataValue="hitemid" v-model="hform.HRepairID">
               </zxz-uni-data-select>
            </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>
            </view>
            <view class="form-item">
               <view class="title">器具名称:</view>
               <view class="righton">
                  <input v-model="hform.HMouldName" disabled />
               </view>
            </view>
            <view class="form-item">
               <view class="title">器具规格:</view>
               <view class="righton">
                  <input v-model="hform.HMouldModel" disabled />
               </view>
            </view>
            <view class="form-item">
               <view class="title">器具型号:</view>
               <view class="righton">
                  <input v-model="hform.HMouldSpec" disabled />
               </view>
            </view>
         </view>
      </template>
      <!-- 其他信息(非重要信息) -->
      <template v-if="tabs == 1">
         <view class="form" :style="{
                height: containerHeight + 'px',
                overflow: 'auto'
            }">
                <view class="form-item">
                    <view class="title">供应商:</view>
                    <view class="right">
                        <input v-model="hform.HSupID" placeholder="" />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">维修类型:</view>
                    <zxz-uni-data-select class="right" :localdata="[
                        {key: '内部维修', value: '内部维修'},
                        {key: '外部维修', value: '外部维修'},
                    ]" dataKey="key" dataValue="value" v-model="hform.HRepairType">
                    </zxz-uni-data-select>
                </view>
                <view class="form-item">
                    <view class="title">维修后新规格:</view>
                    <view class="right">
                        <input type="number" v-model="hform.HNewModel" placeholder="" />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">新设计寿命:</view>
                    <view class="right">
                        <input type="number" v-model="hform.HNewDesignLife" placeholder="" />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">设备:</view>
                    <view class="right">
                        <input v-model="hform.HEquipID" placeholder="" />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">维修费用:</view>
                    <view class="right">
                        <input type="number" v-model="HDetailList[0].HMoney" placeholder="" />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">维修内容:</view>
                    <view class="right">
                        <textarea v-model="hform.HRepairContent" placeholder="请输入维修内容" />
                    </view>
                </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="right">
                        <textarea v-model="hform.HRemark" placeholder="请输入备注" />
                    </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>
            <view class="form-item">
               <view class="title">时间单位:</view>
               <zxz-uni-data-select class="right" :localdata="[
                                {key: '小时', value: '小时'},
                                {key: '天', value: '天'},
                                {key: '月', value: '月'},
                            ]" dataKey="key" dataValue="value" v-model="hform.HCycleUnit">
               </zxz-uni-data-select>
            </view>
            <view class="form-item">
               <view class="title">计划维修工时:</view>
               <view class="right">
                  <input type="number" v-model="hform.HPlanTimes" />
               </view>
            </view>
            <view class="form-item">
               <view class="title">实际维修工时:</view>
               <view class="right">
                  <input type="number" v-model="hform.HTimes" />
               </view>
            </view>
            <view class="form-item">
               <view class="title">供应商:</view>
               <view class="right">
                  <input v-model="hform.HSupID" placeholder="" />
               </view>
            </view>
            <view class="form-item">
               <view class="title">维修类型:</view>
               <zxz-uni-data-select class="right" :localdata="[
                                       {key: '内部维修', value: '内部维修'},
                                       {key: '外部维修', value: '外部维修'},
                                   ]" dataKey="key" dataValue="value" v-model="hform.HRepairType">
               </zxz-uni-data-select>
            </view>
            <view class="form-item">
               <view class="title">维修后新规格:</view>
               <view class="right">
                  <input type="number" v-model="hform.HNewModel" placeholder="" />
               </view>
            </view>
            <view class="form-item">
               <view class="title">新设计寿命:</view>
               <view class="right">
                  <input type="number" v-model="hform.HNewDesignLife" placeholder="" />
               </view>
            </view>
            <view class="form-item">
               <view class="title">设备:</view>
               <view class="right">
                  <input v-model="hform.HEquipID" placeholder="" />
               </view>
            </view>
            <view class="form-item">
               <view class="title">维修费用:</view>
               <view class="right">
                  <input type="number" v-model="HDetailList[0].HMoney" placeholder="" />
               </view>
            </view>
            <view class="form-item">
               <view class="title">维修内容:</view>
               <view class="right">
                  <textarea v-model="hform.HRepairContent" placeholder="请输入维修内容" />
               </view>
            </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="right">
                  <textarea v-model="hform.HRemark" placeholder="请输入备注" />
               </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>
        </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>
      <!-- 操作按钮 -->
      <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>
      <!-- 新增弹窗组件 -->
      <BillListPopupMouldConkBookBillVue ref="billList" :HBillType="hform.HBillType"
         :HSourceBillType="hform.HMainSourceBillType" :HStockOrgID="hform.HStockOrgID">
      </BillListPopupMouldConkBookBillVue>
   </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: 'Sc_MouldRepairSendWorkBill',
        data() {
            return {
                tabs: 0,
                HMainSourceBillType: "",
                btnTop: 0,
                tabsBottom: 0,
                HModName: "Sc_MouldRepairSendWorkBill",
                HBillType: '3843',
                operationType: 1,
                uploadOptions: {},
                enableEdit: true,
   import dayjs from "dayjs";
   import {
      CommonUtils
   } from "@/utils/common";
   import {
      MpaasScan
   } from "@/utils/mpaasScan.js"
   import {
      getUserInfo
   } from "../../../utils/auth";
   // 新增引入组件
   import BillListPopupMouldConkBookBillVue from '../../../components/BillListPopup/BillListPopupMouldConkBookBill.vue';
                HDeptList: [],
                HRepairCheckList: [],
                HEmpList: [],
                HRepairList: [],
   export default {
      // 器具维修派工单
      name: 'Sc_MouldRepairSendWorkBill',
      components: {
         BillListPopupMouldConkBookBillVue,
      },
      data() {
         return {
            tabs: 0,
            HMainSourceBillType: '模具故障登记单', // 新增
            showHMainSourceBillType: true, // 新增
            arrayHMainSourceBillType: ['模具故障登记单'], // 新增
            arrayHMainSourceBillTypeID: ['3815'], // 新增
            btnTop: 0,
            tabsBottom: 0,
            HModName: "Sc_MouldRepairSendWorkBill",
            HBillType: '3843',
            operationType: 1,
            uploadOptions: {},
            enableEdit: true,
                hform: {
                    "HBarCode": "",
                    "HBillNo": "",
                    "HInterID": "0",
                    "HDate": dayjs(new Date()).format('YYYY-MM-DD'),
                    "HInnerBillNo": "",
                    "MouldHNumber": "",
                    "HMouldID": "0",
                    "HRepairIDName": "",
                    "HRepairID": "0",
                    "HCycleUnit": "小时",
                    "MouldHName": "",
                    "MouldHModel": "",
                    "HDeptIDName": "",
                    "HDeptID": "0",
                    "HManagerIDName": "",
                    "HManagerID": "0",
                    "HEmpIDName": "",
                    "HEmpID": "0",
                    "HRepairBeginDate": dayjs(new Date()).format('YYYY-MM-DD'),
                    "HMainSourceBillType": "",
                    "HMainSourceInterID": "0",
                    "HMainSourceEntryID": "0",
                    "HPlanTimes": "0",
                    "HTimes": "0",
                    "HRepairEndDate": dayjs(new Date()).format('YYYY-MM-DD'),
                    "HMainSourceBillNo": "",
                    "HSupIDName": "",
                    "HSupID": "0",
                    "HRepairType": "内部维修",
                    "HNewModel": "0",
                    "HOrgID": "",
                    "HNewDesignLife": "0",
                    "HEquipIDName": "",
                    "HEquipID": "0",
                    "HRepairContent": "",
                    "HExplanation": "",
                    "HRemark": "",
                    "HMaker": getUserInfo()["Czymc"],
                    "HChecker": "",
                    "HCloseMan": "",
                    "HUpDater": "",
                    "HMakeDate": dayjs(new Date()).format('YYYY-MM-DD'),
                    "HCheckDate": "",
                    "HCloseDate": "",
                    "HUpDateDate": "",
                    "HDeleteMan": "",
                    "HDeleteDate": "",
                    HMouldName: "",
                    HMouldSpec: "",
                    HMouldModel: "",
                },
                HDetailList: [{ // 后端接口提交需要 明细信息
                    "子维修项目": "",
                    "HRepairID": 0,
                    "子维修项目代码": "",
                    "HRepairExplanation": "",
                    "子负责人代码": "",
                    "HManagerID": "",
                    "子负责人": "",
                    "HMoney": 0,
                    "HRemark": ""
                }]
            };
        },
        computed: {
            containerHeight: {
                get() {
                    return this.btnTop - this.tabsBottom - 5
                }
            },
        },
        methods: {
            // 维修项目
            async getRepairList() {
                try {
                    let res = await CommonUtils.doRequest2Async({
                        url: '/Gy_Repair/GetRepairList',
                        data: {
                            sWhere: '',
                            user: getUserInfo()["Czymc"]
                        }
                    })
            HDeptList: [],
            HRepairCheckList: [],
            HEmpList: [],
            HRepairList: [],
                    let {
                        data,
                        count,
                        Message
                    } = res.data
                    if (count == 1) {
                        this.HRepairList = data
                    } else {
                        CommonUtils.showTips({
                            title: '温馨提示',
                            message: `获取检验项目失败: ${Message}`
                        })
                    }
                } catch (err) {
                    CommonUtils.showTips({
                        title: '温馨提示',
                        message: `获取检验项目失败: ${err}`
                    })
                }
            },
            // 删除明细
            delDetail(item) {
            hform: {
               "HBarCode": "",
               "HBillNo": "",
               "HInterID": "0",
               "HDate": dayjs(new Date()).format('YYYY-MM-DD'),
               "HInnerBillNo": "",
               "MouldHNumber": "",
               "HMouldID": "0",
               "HRepairIDName": "",
               "HRepairID": "0",
               "HCycleUnit": "小时",
               "MouldHName": "",
               "MouldHModel": "",
               "HDeptName": getUserInfo()["HDeptName"],
               "HDeptID": getUserInfo()["HDeptID"],
               "HEmpName": getUserInfo().HEmpName,
               "HEmpID": getUserInfo().HEmpID,
               "HManagerName": getUserInfo().HSecManager,
               "HManagerID": getUserInfo().HSecManagerID,
               "HRepairBeginDate": dayjs(new Date()).format('YYYY-MM-DD'),
               "HMainSourceBillType": 3815, // 新增:默认模具故障登记单
               "HMainSourceInterID": "0", // 新增
               "HMainSourceEntryID": "0", // 新增
               "HPlanTimes": "0",
               "HTimes": "0",
               "HRepairEndDate": dayjs(new Date()).format('YYYY-MM-DD'),
               "HMainSourceBillNo": "", // 新增
               "HSupIDName": "",
               "HSupID": "0",
               "HRepairType": "内部维修",
               "HNewModel": "0",
               "HOrgID": "",
               "HNewDesignLife": "0",
               "HEquipIDName": "",
               "HEquipID": "0",
               "HRepairContent": "",
               "HExplanation": "",
               "HRemark": "",
               "HMaker": getUserInfo()["Czymc"],
               "HChecker": "",
               "HCloseMan": "",
               "HUpDater": "",
               "HMakeDate": dayjs(new Date()).format('YYYY-MM-DD'),
               "HCheckDate": "",
               "HCloseDate": "",
               "HUpDateDate": "",
               "HDeleteMan": "",
               "HDeleteDate": "",
               HMouldName: "",
               HMouldSpec: "",
               HMouldModel: "",
               "HStockOrgID": uni.getStorageSync("OrganizationID") || "0" // 新增
            },
            HDetailList: [{ // 后端接口提交需要 明细信息
               "子维修项目": "",
               "HRepairID": 0,
               "子维修项目代码": "",
               "HRepairExplanation": "",
               "子负责人代码": "",
               "HManagerID": "",
               "子负责人": "",
               "HMoney": 0,
               "HRemark": ""
            }]
         };
      },
      computed: {
         containerHeight: {
            get() {
               return this.btnTop - this.tabsBottom - 5
            }
         },
      },
      methods: {
         // 新增:选择源单类型
         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]
            },
            // 提交数据有效性校验
            ValidCheck() {
                if (this.hform.HMouldID == 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.HRepairCheckMainID == 0) {
                    return {
                        Message: "验证项目不得为空!",
                        state: false
                    }
                }
                if (this.hform.HManagerID == 0) {
                    return {
                        Message: "负责人不得为空!",
                        state: false
                    }
                }
                if (this.hform.HPlanTimes == '') {
                    return {
                        Message: "计划维修工时不得为空!",
                        state: false
                    }
                }
                if (this.hform.HTimes == '') {
                    return {
                        Message: "实际维修工时不得为空!",
                        state: false
                    }
                }
            // 缓存当前页面选择
            const pages = getCurrentPages()
            const currentPage = pages[pages.length - 1]
            uni.setStorageSync(`${currentPage.route.split("/").pop()}_HSourceBillTypeCache`, {
               HSourceBillTypeName: this.HMainSourceBillType,
               HSourceBillType: this.hform.HMainSourceBillType
            })
         },
         // 新增:显示单据列表弹窗
         showBillList() {
            this.$refs.billList.showPopup()
         },
                return {
                    Message: "",
                    state: true
                }
            },
            addNew() {
                uni.redirectTo({
                    url: './Sb_EquipRepairSendWorkBill?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)
                        }
                    },
                })
         // 新增:读取缓存
         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
            }
         },
            },
            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: "",
                        }
                    })
         // 维修项目
         async getRepairList() {
            try {
               let res = await CommonUtils.doRequest2Async({
                  url: '/Gy_Repair/GetRepairList',
                  data: {
                     sWhere: '',
                     user: getUserInfo()["Czymc"]
                  }
               })
                    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.HRepairList = data
               } else {
                  CommonUtils.showTips({
                     title: '温馨提示',
                     message: `获取检验项目失败: ${Message}`
                  })
               }
            } catch (err) {
               CommonUtils.showTips({
                  title: '温馨提示',
                  message: `获取检验项目失败: ${err}`
               })
            }
         },
         // 删除明细
         delDetail(item) {
                    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",
                        }
                    })
         },
         // 提交数据有效性校验
         ValidCheck() {
            // 新增:检查故障登记单
            if (this.hform.HMainSourceBillType != 1 && !this.hform.HMainSourceBillNo) {
               return {
                  Message: "故障登记单不得为空!",
                  state: false
               }
            }
                    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
                    })
                }
            },
            // 获取验证项目数据
            async getCheckProjList() {
                try {
                    let res = await CommonUtils.doRequest2Async({
                        url: '/Gy_RepairCheck/GetRepairCheckList',
                        data: {
                            sWhere: "",
                            user: uni.getStorageSync('HUserName'),
                        }
                    })
            if (this.hform.HMouldID == 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.HRepairID == 0) {
               return {
                  Message: "维修项目不得为空!",
                  state: false
               }
            }
            if (this.hform.HManagerID == 0) {
               return {
                  Message: "主管不得为空!",
                  state: false
               }
            }
            if (this.hform.HPlanTimes == '') {
               return {
                  Message: "计划维修工时不得为空!",
                  state: false
               }
            }
            if (this.hform.HTimes == '') {
               return {
                  Message: "实际维修工时不得为空!",
                  state: false
               }
            }
                    let {
                        data,
                        count,
                        Message
                    } = res.data
                    if (count == 1) {
                        this.HRepairCheckList = 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: "/Sc_PDA_MouldRepairCheckBill/txtHBarCode_KeyDown_List",
                        data: {
                            HBarCode: HBarCode,
                        },
                    })
            return {
               Message: "",
               state: true
            }
         },
         addNew() {
            uni.redirectTo({
               url: './Sc_MouldRepairSendWorkBill?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
            }
         },
         //获取使用部门数据
         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",
                  }
               })
                    if (!res) {
                        return
                    }
               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
               })
            }
         },
         // 获取验证项目数据
         async getCheckProjList() {
            try {
               let res = await CommonUtils.doRequest2Async({
                  url: '/Gy_RepairCheck/GetRepairCheckList',
                  data: {
                     sWhere: "",
                     user: uni.getStorageSync('HUserName'),
                  }
               })
                    let {
                        data,
                        count,
                        Message
                    } = res.data
               let {
                  data,
                  count,
                  Message
               } = res.data
               if (count == 1) {
                  this.HRepairCheckList = data
               } else {
                  CommonUtils.showTips({
                     title: '温馨提示',
                     message: Message
                  })
               }
            } catch (err) {
               CommonUtils.showTips({
                  title: '温馨提示',
                  message: err
               })
            }
         },
         toScanCode() {
            MpaasScan.scanCode(cb => {
               this.hform.HBarCode = cb
               this.GetMessageByBarCode(cb)
            })
         },
         async GetMessageByBarCode(HBarCode) {
            try {
               let res = await CommonUtils.doRequest2Sync({
                  url: "/Sc_PDA_MouldRepairCheckBill/txtHBarCode_KeyDown_List",
                  data: {
                     HBarCode: HBarCode,
                  },
               })
                    if (count == 1) {
                        console.log('data: ', data);
                        this.hform.HMouldID = data[0].hmainid
                        this.hform.HMouldName = data[0].模具名称
                        this.hform.HMouldSpec = data[0].模具品类
                        this.hform.HMouldModel = data[0].模具型号
                        this.hform.HQty = 1
               if (!res) {
                  return
               }
                        this.enableEdit = false
                    } else {
                        CommonUtils.showTips({
                            title: "温馨提示",
                            message: Message
                        })
                    }
               let {
                  data,
                  count,
                  Message
               } = res.data
                } 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
                        }
                    })
               if (count == 1) {
                  console.log('data: ', data);
                  this.hform.HMouldID = data[0].hmainid
                  this.hform.HMouldName = data[0].模具名称
                  this.hform.HMouldSpec = data[0].模具品类
                  this.hform.HMouldModel = data[0].模具型号
                  this.hform.HQty = 1
                    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.enableEdit = false
               } else {
                  CommonUtils.showTips({
                     title: "温馨提示",
                     message: Message
                  })
               }
                        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
                            }
                        })
            } 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
                  }
               })
                    } 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 {
                  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
                    let {
                        count,
                        data,
                        Message
                    } = res.data
                    console.log('data: ', data);
                    this.hform.HInterID = data[0]["HInterID"]
                    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
                }
                  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
                     }
                  })
                try {
                    let oMain = JSON.stringify(this.hform);
                    this.HDetailList[0].HManagerID = this.hform.HManagerID
                    this.HDetailList[0].HRepairID = this.hform.HRepairID
                    let sSubStr = JSON.stringify(this.HDetailList);
                    let sMainSub = oMain + ';' + sSubStr + `;${this.operationType}` + ';' + getUserInfo()[
                        'Czymc'];
                    let res = await CommonUtils.doRequest2Sync({
                        url: "/Sc_MouldRepairSendWorkBill/AddBill",
                        data: {
                            "sMainSub": sMainSub
                        },
                        method: "POST"
                    })
               } 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
                  }
               })
                    if (!res) {
                        return
                    }
               let {
                  count,
                  data,
                  Message
               } = res.data
               console.log('data: ', data);
               this.hform.HInterID = data[0]["HInterID"]
               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
            }
                    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_EquipRepairSendWorkBill?operationType=1'
                                    })
                                } else if (res.cancel) {
                                    console.log('用户点击取消');
                                    setTimeout(() => {
                                        uni.navigateBack();
                                    }, 50)
                                }
                            }
                        });
                    } else {
                        CommonUtils.showTips({
                            title: "温馨提示",
                            message: "提交单据失败: " + Message
                        })
                    }
            try {
               let oMain = JSON.stringify(this.hform);
               this.HDetailList[0].HManagerID = this.hform.HManagerID
               this.HDetailList[0].HRepairID = this.hform.HRepairID
               let sSubStr = JSON.stringify(this.HDetailList);
               let sMainSub = oMain + ';' + sSubStr + `;${this.operationType}` + ';' + getUserInfo()[
                  'Czymc'];
               let res = await CommonUtils.doRequest2Sync({
                  url: "/Sc_MouldRepairSendWorkBill/AddBill",
                  data: {
                     "sMainSub": sMainSub
                  },
                  method: "POST"
               })
               if (!res) {
                  return
               }
                } catch (err) {
                    CommonUtils.showTips({
                        title: "温馨提示",
                        message: "提交单据失败: " + err
                    })
                }
            }
        },
        onLoad(e) {
            console.log('e: ', e);
            if (!e.operationType) {
                this.operationType = 1
            } else {
                this.operationType = e.operationType
            }
               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: './Sc_MouldRepairSendWorkBill?operationType=1'
                           })
                        } else if (res.cancel) {
                           console.log('用户点击取消');
                           setTimeout(() => {
                              uni.navigateBack();
                           }, 50)
                        }
                     }
                  });
               } else {
                  CommonUtils.showTips({
                     title: "温馨提示",
                     message: "提交单据失败: " + Message
                  })
               }
            if (this.operationType == 1) {
                // 新增
                this.getMaxNum()
            } else if (this.operationType == 2) {
                // 复制
            } else if (this.operationType == 3) {
                // 编辑
            } catch (err) {
               CommonUtils.showTips({
                  title: "温馨提示",
                  message: "提交单据失败: " + err
               })
            }
         }
      },
      onLoad(e) {
         console.log('e: ', e);
         if (!e.operationType) {
            this.operationType = 1
         } else {
            this.operationType = e.operationType
         }
            } else if (this.operationType == 4) {
                // 浏览
         if (this.operationType == 1) {
            // 新增
            this.getMaxNum()
         } else if (this.operationType == 2) {
            // 复制
         } else if (this.operationType == 3) {
            // 编辑
            }
         } else if (this.operationType == 4) {
            // 浏览
            this.getHDeptList()
            this.getEmpList()
            this.getCheckProjList()
            this.getRepairList()
        },
        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)
                })
        }
    }
         }
         this.getHDeptList()
         this.getEmpList()
         this.getCheckProjList()
         this.getRepairList()
         this.loadCache() // 新增:加载缓存
         // 新增:监听单据选择完成事件
         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
            // 如果选择单据时带了条码,也设置条码
            if (e.HBarCode) {
               this.hform.HBarCode = e.HBarCode
            }
            this.$refs.billList.exit()
         })
      },
      onUnload() {
         uni.$off('BillSelectComplete') // 新增:移除事件监听
      },
      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"
   @import "@/pages/MJGL/style/MJBillStyle.scss";
   .picker-overlay {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      z-index: 1;
   }
   .icon-wrapper {
      background-color: #3A78FF;
      width: 52rpx;
      height: 52rpx;
      border-radius: 100%;
      display: flex;
      justify-content: center;
      align-items: center;
      .uni-icons {
         color: #fff !important;
      }
   }
   .icon-wrapper[disabled] {
      background-color: rgba(228, 228, 228, 1);
      pointer-events: none;
      touch-action: none;
   }
   .required {
      position: relative;
   }
   .required::after {
      content: "*";
      position: relative;
      color: red;
      left: 0;
      top: 0;
      font-size: inherit;
   }
</style>