Houjie
2025-07-07 0a48655d2162b709ecb80d249a4085971add6140
pages/ToDoList/ToDoSpareParts/ToDoSpareParts.vue
@@ -11,19 +11,36 @@
            <uni-group top="1">
               <view class="divider"><text>报修基本信息</text></view>
               <!-- <view class="text-gray margin-bottom-lg">—————————报修基本信息—————————</view> -->
               <uni-forms-item :label-width="100" name="num" label="工单号:">
               <uni-forms-item :label-width="100" name="repairCode" label="工单号:">
                  <uni-easyinput v-model="formData.repairCode" :disabled="true" />
               </uni-forms-item>
               <uni-forms-item :label-width="100" required name="num" label="设备编号:">
               <uni-forms-item :label-width="100" name="repairStatus_dictText" label="工单状态:">
                  <uni-easyinput v-model="formData.repairStatus_dictText" :disabled="true" />
               </uni-forms-item>
               <uni-forms-item :label-width="100" name="num" label="设备编号:">
                  <uni-data-select v-model="formData.num" :localdata="equipmentList" @change="changeEquipmentList"
                     placeholder="请选择" :disabled="true" />
               </uni-forms-item>
               <uni-forms-item :label-width="100" name="installationPosition_dictText" label="安装位置:">
                  <uni-easyinput v-model="formData.installationPosition_dictText" :disabled="true" />
               </uni-forms-item>
               <uni-forms-item :label-width="100" name="faultName" label="故障简称:">
                  <uni-easyinput v-model="formData.faultName" :disabled="true" />
               </uni-forms-item>
               <uni-forms-item :label-width="100" name="remark" label="故障开始时间:">
                  <uni-easyinput v-model="formData.faultStartTime" :disabled="true" />
               </uni-forms-item>
               <uni-forms-item :label-width="100" name="outNum" label="维修负责人:">
                  <uni-easyinput v-model="formData.repairer" :disabled="true" />
               <uni-forms-item :label-width="100" name="reporter_dictText" label="报修人:">
                  <uni-easyinput v-model="formData.reporter_dictText" :disabled="true" />
               </uni-forms-item>
               <uni-forms-item :label-width="100" name="reporterPhone_dictText" label="报修人电话:">
                  <uni-easyinput v-model="formData.reporterPhone_dictText" :disabled="true" />
               </uni-forms-item>
               <uni-forms-item :label-width="100" name="repairer_dictText" label="维修人:">
                  <uni-easyinput v-model="formData.repairer_dictText" :disabled="true" />
               </uni-forms-item>
               <uni-forms-item :label-width="100" name="repairerPhone_dictText" label="维修人电话:">
                  <uni-easyinput v-model="formData.repairerPhone_dictText" :disabled="true" />
               </uni-forms-item>
               <uni-forms-item :label-width="100" name="remark" label="备注:">
                  <uni-easyinput v-model="formData.remark" :disabled="true" />
@@ -31,8 +48,8 @@
               <uni-forms-item :label-width="100" name="outNum" label="报修图片:">
                  <uni-file-picker limit="9" :value="fileList" :image-styles="imageStyles" @select="select"
                  :sourceType="sourceType" @progress="progress" @success="success" @fail="fail" @delete="deletea"
                     :readonly="readonly" />
                     :sourceType="sourceType" @progress="progress" @success="success" @fail="fail"
                     @delete="deletea" :readonly="readonly" />
               </uni-forms-item>
               <view class="divider"><text>是否需要领用备件</text></view>
@@ -51,8 +68,8 @@
               </uni-forms-item>
               <uni-forms-item v-show="isShow" :label-width="100" name="outNum" label="维修图片:">
                  <uni-file-picker limit="9" :value="fileLists" :image-styles="imageStyles" @select="select"
                  :sourceType="sourceType"   @progress="progress" @success="success" @fail="fail" @delete="deletea"
                     :readonly="readonlyRepaier" />
                     :sourceType="sourceType" @progress="progress" @success="success" @fail="fail"
                     @delete="deletea" :readonly="readonlyRepaier" />
               </uni-forms-item>
            </uni-group>
         </uni-forms>
@@ -82,8 +99,8 @@
               </uni-forms-item>
               <uni-forms-item :label-width="100" name="outNum" label="维修图片:">
                  <uni-file-picker limit="9" :value="fileLists" :image-styles="imageStyles" @select="select"
                  :sourceType="sourceType"   @progress="progress" @success="success" @fail="fail" @delete="deletea"
                     :readonly="readonlyRepaier" />
                     :sourceType="sourceType" @progress="progress" @success="success" @fail="fail"
                     @delete="deletea" :readonly="readonlyRepaier" />
               </uni-forms-item>
            </uni-group>
         </uni-forms>
@@ -192,7 +209,9 @@
            procInstId: '',
            values: '',
            isShow: true,
            flag: ''
            flag: '',
            from: '',
            todoName: ''
         }
      },
@@ -210,12 +229,22 @@
      onLoad(options) {
         const annItem = JSON.parse(decodeURIComponent(options.item));
         this.flag = options.flag
         console.log(this.flag)
         this.id = annItem.dataId,
            this.taskId = annItem.id,
            this.procInstId = annItem.procInstId,
            this.values = annItem.values,
            this.assignee = annItem.assignee
         this.from = options.from
         if (this.flag == 'task') {
            this.todoName = annItem.taskName
         } else {
            this.todoName = annItem.name
         }
         if (this.from === 'detils') {
            this.id = annItem.id;
            console.log(annItem.id);
         } else {
            this.id = annItem.dataId;
         }
         this.taskId = annItem.id
         this.procInstId = annItem.procInstId
         this.values = annItem.values
         this.assignee = annItem.assignee
      },
      created() {
         this.getEquipment();
@@ -277,89 +306,6 @@
            console.log('删除图片', e);
         },
         ProductionTask() {
            console.log(this.formData.isSpare)
            if (this.formData.reportStatus == 'WAIT_SPARES' && this.formData.isSpare == 1 && this.flag !== 'task') {
               if (this.ScanData.sparePartDescription == undefined || this.ScanData.sparePartDescription == null ||
                  this
                  .ScanData.sparePartDescription ==
                  '') {
                  uni.showToast({
                     icon: 'none',
                     title: '备件描述不能为空'
                  });
                  return false;
               }
            }
            // if (this.formData.reportStatus == 'UNDER_REPAIR' && this.formData.isSpare == 0 && this.flag !== 'task') {
            //    if (this.formData.faultReason == undefined || this.formData.faultReason == null ||
            //       this
            //       .formData.faultReason ==
            //       '') {
            //       uni.showToast({
            //          icon: 'none',
            //          title: '故障原因不能为空'
            //       });
            //       return false;
            //    }
            //    if (this.formData.repairDescription == undefined || this.formData.repairDescription == null ||
            //       this
            //       .formData.repairDescription ==
            //       '') {
            //       uni.showToast({
            //          icon: 'none',
            //          title: '维修结果不能为空'
            //       });
            //       return false;
            //    }
            // }
            // if (this.formData.reportStatus == 'UNDER_REPAIR' && this.formData.isSpare == 1 && this.flag !== 'task') {
            //    if (this.formData.faultReason == undefined || this.formData.faultReason == null ||
            //       this
            //       .formData.faultReason ==
            //       '') {
            //       uni.showToast({
            //          icon: 'none',
            //          title: '故障原因不能为空'
            //       });
            //       return false;
            //    }
            //    if (this.formData.repairDescription == undefined || this.formData.repairDescription == null ||
            //       this
            //       .formData.repairDescription ==
            //       '') {
            //       uni.showToast({
            //          icon: 'none',
            //          title: '维修结果不能为空'
            //       });
            //       return false;
            //    }
            // }
            if (this.formData.reportStatus == 'UNDER_REPAIR' && this.flag !== 'task') {
                if (this.formData.faultReason == undefined || this.formData.faultReason == null || this.formData.faultReason == '') {
                    uni.showToast({
                        icon: 'none',
                        title: '故障原因不能为空'
                    });
                    return false;
                }
                if (this.formData.repairDescription == undefined || this.formData.repairDescription == null || this.formData.repairDescription == '') {
                    uni.showToast({
                        icon: 'none',
                        title: '维修结果不能为空'
                    });
                    return false;
                }
            }
            if (this.formData.reportStatus == 'UNDER_REPAIR' && this.formData.isSpare == 1) {
               if (this.formData.isSpare == undefined || this.formData.isSpare == null ||
@@ -374,6 +320,49 @@
                  return false;
               }
            }
            console.log(this.formData.isSpare)
            if (this.formData.reportStatus === 'WAIT_SPARES' && this.formData.isSpare == 1 && this.flag !== 'task') {
               if (this.ScanData.sparePartDescription == undefined || this.ScanData.sparePartDescription == null ||
                  this
                  .ScanData.sparePartDescription ==
                  '') {
                  uni.showToast({
                     icon: 'none',
                     title: '备件描述不能为空'
                  });
                  return false;
               }
            }
            if (
               this.formData.reportStatus === 'UNDER_REPAIR' &&
               this.flag !== 'task' &&
               (this.formData.isSpare === 0 || this.ScanData.sparePartDescription?.trim())
            ) {
               if (this.formData.faultReason == undefined || this.formData.faultReason == null || this.formData
                  .faultReason == '') {
                  uni.showToast({
                     icon: 'none',
                     title: '故障原因不能为空'
                  });
                  return false;
               }
               if (this.formData.repairDescription == undefined || this.formData.repairDescription == null || this
                  .formData.repairDescription == '') {
                  uni.showToast({
                     icon: 'none',
                     title: '维修结果不能为空'
                  });
                  return false;
               }
            }
            uni.showLoading({
               mask: true,
               title: "加载中....",
@@ -399,6 +388,14 @@
                  });
                  this.$Router.replaceAll({
                     name: 'ToDoList'
                  })
               } else {
                  uni.showModal({
                     title: "提示",
                     content: res.data.message,
                     confirmText: '确定',
                     showCancel: false,
                  })
               }
            }).catch(() => {
@@ -465,36 +462,36 @@
               //设置列表数据
               if (res.data.success) {
                  this.formData.reportStatus = this.announcement1.reportStatus
                  this.title = this.todoName ?? '详情';
                  if (this.announcement1.reportStatus === 'WAIT_CONFIRM') {
                     if (this.flag == 'task') {
                        this.title = '维修执行';
                        // this.title = '维修执行';
                        this.isUNDERREPAIR = true
                        this.readonly = true
                        this.isRuning = true
                        this.isSHowBtn=false
                        this.readonlyRepaier=true
                        this.isSHowBtn = false
                        this.readonlyRepaier = true
                        this.isShowRepari = false
                     } else if (this.flag !== 'task') {
                        this.title = '操作工确认';
                        // this.title = '操作工确认';
                        this.isUNDERREPAIR = true
                        this.readonly = true
                        this.isRuning = true
                        this.isSHowBtn=true
                        this.readonlyRepaier=true
                        this.isSHowBtn = true
                        this.readonlyRepaier = true
                        this.isShowRepari = false
                     }
                  } else if (this.announcement1.reportStatus === 'WAIT_SPARES') {
                     if (this.flag == 'task' && this.announcement1.isUseSpare == 1) {
                        this.title = '是否需要领用备件';
                        // this.title = '是否需要领用备件';
                        this.isShowUNDEREPAIR = false;
                        this.isUNDERREPAIR = true;
                        this.readonly = true
                        this.isSHowBtn = false;
                     } else {
                        this.title = '管理员领用备件';
                        // this.title = '管理员领用备件';
                        this.readonly = true
                        this.isUNDERREPAIR = true;
                        this.isShowUNDEREPAIR = true;
@@ -503,7 +500,7 @@
                  } else if (this.announcement1.reportStatus === 'UNDER_REPAIR') {
                     if (this.announcement1.isUseSpare == 1 && this.flag == 'task') {
                        this.title = '管理员领用备件';
                        // this.title = '管理员领用备件';
                        this.isShowRepari = true;
                        this.readonlyRepaier = true
                        this.isShowUNDEREPAIR = true;
@@ -514,21 +511,29 @@
                        this.isSHowBtn = false;
                     } else if (this.announcement1.isUseSpare == 1 && this.flag !== 'task') {
                        this.title = '维修执行'
                        // this.title = '维修执行'
                        this.isUNDERREPAIR = true
                        this.readonly = true
                        this.isShowUNDEREPAIR = true
                        this.isRuning = true
                        this.isShowRepari = true
                     } else if (this.announcement1.isUseSpare == 0 && this.flag == 'task') {
                        this.readonlyRepaier = true
                        this.isUNDERREPAIR = true;
                        this.isRuning = true;
                        this.isRepari = true;
                        this.readonly = true
                        this.isSHowBtn = false;
                     } else {
                        this.title = '是否需要领用备件'
                        // this.title = '是否需要领用备件'
                        this.isSHowBtn = true
                        this.readonly = true
                     }
                  } else if (this.announcement1.reportStatus === 'COMPLETE') {
                     if (this.flag == 'task' && this.announcement1.isUseSpare == 0) {
                        this.title = '操作工确认'
                        // this.title = '操作工确认'
                        this.isUNDERREPAIR = true
                        this.isShowUNDEREPAIR = false
                        this.readonly = true
@@ -538,22 +543,22 @@
                        this.isRepari = false
                        this.isSHowBtn = false
                     } else if (this.flag == 'task' && this.announcement1.isUseSpare == 1) {
                        this.title = '操作工确认'
                        // this.title = '操作工确认'
                        this.isUNDERREPAIR = true
                        this.isShowUNDEREPAIR = true
                        this.isRuning = true
                        this.readonlyRepaier=true
                        this.readonlyRepaier = true
                        this.isShowRepari = true
                        this.isRepari = true
                        this.readonly = true
                        this.isSHowBtn = false;
                     }else if (this.flag !== 'task' && this.announcement1.isUseSpare == 0){
                        this.title = '维修执行'
                     } else if (this.flag !== 'task' && this.announcement1.isUseSpare == 0) {
                        // this.title = '维修执行'
                        this.isUNDERREPAIR = true
                        this.readonlyRepaier=true
                        this.readonlyRepaier = true
                        this.readonly = true
                        this.isRuning = true
                     }
                  }
@@ -580,8 +585,15 @@
                  }
                  console.log(this.fileLists)
                  this.formData.num = this.announcement1.equipmentId
                  this.formData.repairStatus_dictText = this.announcement1.repairStatus_dictText
                  this.formData.repairCode = this.announcement1.repairCode
                  this.formData.repairer = this.announcement1.repairer
                  this.formData.installationPosition_dictText = this.announcement1
                     .installationPosition_dictText
                  this.formData.faultName = this.announcement1.faultName
                  this.formData.repairer_dictText = this.announcement1.repairer_dictText
                  this.formData.repairerPhone_dictText = this.announcement1.repairerPhone_dictText
                  this.formData.reporter_dictText = this.announcement1.reporter_dictText
                  this.formData.reporterPhone_dictText = this.announcement1.reporterPhone_dictText
                  this.formData.faultStartTime = this.announcement1.faultStartTime
                  this.formData.remark = this.announcement1.remark
                  this.formData.repairDescription = this.announcement1.repairDescription