From e9c43dc96a830932373c68ad129e8ac6a0ac7640 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期二, 20 十月 2026 11:26:35 +0800
Subject: [PATCH] fix(productOrder): 修正打印对话框中送样单位字段为样品外观

---
 src/views/CNAS/resourceDemand/device/component/failureForm.vue |   32 ++++++++++++++++++++++----------
 1 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/src/views/CNAS/resourceDemand/device/component/failureForm.vue b/src/views/CNAS/resourceDemand/device/component/failureForm.vue
index c218cb7..9a7b007 100644
--- a/src/views/CNAS/resourceDemand/device/component/failureForm.vue
+++ b/src/views/CNAS/resourceDemand/device/component/failureForm.vue
@@ -7,7 +7,7 @@
         <el-step title="鐢宠閮ㄩ棬璐熻矗浜烘剰瑙�" @click="setStep(1)"></el-step>
         <el-step title="缁翠慨璁板綍" @click="setStep(2)"></el-step>
       </el-steps>
-      <el-form ref="modelForm" :model="form" :rules="rules" label-width="160px">
+      <el-form ref="modelForm" :model="form" :rules="rules" label-width="160px" :disabled="!canOperate">
         <el-col v-if="showStep === 0" :span="12">
           <el-form-item label="瀹夎鍦扮偣锛�" prop="location">
             <el-input v-model="form.location" :disabled="currentStep !== 0" clearable size="small"></el-input>
@@ -59,7 +59,7 @@
       </el-form>
       <template #footer><span  class="dialog-footer">
         <el-button @click="resetForm">鍙� 娑�</el-button>
-        <el-button v-if="currentStep !== 3" :loading="submitFormLoading" type="primary" @click="submitForm">纭�
+        <el-button v-if="currentStep !== 3 && canOperate" :loading="submitFormLoading" type="primary" @click="submitForm">纭�
           璁�</el-button>
       </span></template>
     </el-dialog>
@@ -72,17 +72,17 @@
   addDeviceBreakdownMaintenance,
 } from '@/api/cnas/resourceDemand/device.js'
 import { selectUserCondition } from "@/api/business/inspectionTask";
-import draftSave from '@/mixins/draftSave'
+import { mapGetters } from "@/utils/store-compat";
 export default {
   name: "failure-form",
   // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
   components: {},
-  mixins: [draftSave],
   data() {
     // 杩欓噷瀛樻斁鏁版嵁
     return {
       dialogVisible: false,
       submitFormLoading: false,
+      canOperate: true,
       form: {
         location: '',
         damageOrMalfunction: '',
@@ -113,13 +113,12 @@
     // 鎵撳紑寮规
     openDialog(id, deviceId) {
       this.dialogVisible = true
+      this.canOperate = true
       this.form.maintenanceId = id
       this.form.deviceId = deviceId
       this.getUserList()
       if (this.form.maintenanceId) {
         this.searchInfo()
-      } else {
-        this.draftRestore('failureForm', 'form', this.form.deviceId, 'dialogVisible')
       }
     },
     // 鏌ヨ璇︽儏
@@ -128,9 +127,7 @@
         maintenanceId: this.form.maintenanceId
       }).then(res => {
         if (res.code === 200) {
-          const id = this.form.maintenanceId
           this.form = { ...res.data }
-          this.draftRestore('failureForm', 'form', id, 'dialogVisible')
           if (this.form.isFinish === 0) {
             if (this.form.departmentHeadUserId) {
               this.currentStep = 1
@@ -144,10 +141,23 @@
             this.currentStep = 3
             this.showStep = 2
           }
+          this.applyPermission()
         }
       }).catch(error => {
         console.error(error)
       })
+    },
+    // 闈炲綋鍓嶇幆鑺傝矗浠讳汉鍙厑璁告煡鐪�
+    applyPermission() {
+      if (this.form.isFinish === 1) {
+        this.canOperate = false
+        return
+      }
+      const responsible = this.currentStep === 1 ? this.form.departmentHeadUser : this.form.applicantUser
+      this.canOperate = !responsible || responsible === this.nickName
+      if (!this.canOperate) {
+        this.$message.warning('褰撳墠鐜妭璐d换浜轰负锛�' + responsible + '锛屾偍鍙兘鏌ョ湅')
+      }
     },
     setStep(step) {
       this.showStep = step
@@ -157,10 +167,10 @@
       this.form.flowType = this.currentStep
       this.$refs.modelForm.validate((valid) => {
         if (valid) {
+          this.submitFormLoading = true
           addDeviceBreakdownMaintenance(this.form).then(res => {
             if (res.code == 200) {
               this.$message.success('鏂板鎴愬姛')
-              this.draftClear('failureForm')
               this.resetForm()
             }
             this.submitFormLoading = false
@@ -172,7 +182,6 @@
     },
     // 鍏抽棴寮规
     resetForm() {
-      this.draftStop('failureForm')
       this.dialogVisible = false
       this.$emit('closeDialog')
     },
@@ -182,6 +191,9 @@
       })
     },
   },
+  computed: {
+    ...mapGetters(["nickName"]),
+  },
 }
 </script>
 

--
Gitblit v1.9.3