From 9710750b5f7668de0383ffdd54cdff5e044d9b9e Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 18 四月 2025 09:33:45 +0800
Subject: [PATCH] 1.设备使用授权页面开发、联调

---
 src/views/CNAS/resourceDemand/device/component/quantityValueTraceabilityPlan.vue |   26 ++++----
 src/views/CNAS/resourceDemand/device/component/usageAuthorization.vue            |   74 ++++++++++++++++++------
 src/views/CNAS/resourceDemand/device/component/equipmentMaintenancePlan.vue      |   22 +++---
 3 files changed, 79 insertions(+), 43 deletions(-)

diff --git a/src/views/CNAS/resourceDemand/device/component/equipmentMaintenancePlan.vue b/src/views/CNAS/resourceDemand/device/component/equipmentMaintenancePlan.vue
index e6ceeff..11b857b 100644
--- a/src/views/CNAS/resourceDemand/device/component/equipmentMaintenancePlan.vue
+++ b/src/views/CNAS/resourceDemand/device/component/equipmentMaintenancePlan.vue
@@ -48,10 +48,10 @@
     <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="applicationForm"
       title="璁惧淇濆吇璁″垝琛�" width="80%" @close="closeDialog">
       <div style="display: flex;align-items: center;">
-        <el-button v-if="operationType === 'edit'" size="small" type="primary" @click="addTableRow">娣诲姞</el-button>
+        <el-button v-if="operationType === 'edit' || operationType === 'add'" size="small" type="primary" @click="addTableRow">娣诲姞</el-button>
         <span style="width: 60px;margin-left: 10px">骞翠唤锛�</span>
         <el-date-picker v-model="form.planYear" type="year" value-format="yyyy" clearable size="small" format="yyyy"
-          placeholder="閫夋嫨骞�" :disabled="operationType !== 'edit'">
+          placeholder="閫夋嫨骞�" :disabled="operationType !== 'edit' && operationType !== 'add'">
         </el-date-picker>
       </div>
       <div style="margin: 10px 0">
@@ -61,41 +61,41 @@
           <el-table-column align="center" header-align="center" label="搴忓彿" type="index" width="60"></el-table-column>
           <el-table-column label="璁惧鍚嶇О" min-width="170" prop="deviceName">
             <template slot-scope="scope">
-              <el-input v-model="scope.row.deviceName" :disabled="operationType !== 'edit'" clearable
+              <el-input v-model="scope.row.deviceName" :disabled="operationType !== 'edit' && operationType !== 'add'" clearable
                 size="small"></el-input>
             </template>
           </el-table-column>
           <el-table-column label="璁惧缂栧彿" min-width="140" prop="deviceNumber">
             <template slot-scope="scope">
-              <el-input v-model="scope.row.deviceNumber" :disabled="operationType !== 'edit'" clearable
+              <el-input v-model="scope.row.deviceNumber" :disabled="operationType !== 'edit' && operationType !== 'add'" clearable
                 size="small"></el-input>
             </template>
           </el-table-column>
           <el-table-column label="褰掑睘瀹為獙瀹�" min-width="120" prop="storagePoint">
             <template slot-scope="scope">
-              <el-input v-model="scope.row.storagePoint" :disabled="operationType !== 'edit'" clearable
+              <el-input v-model="scope.row.storagePoint" :disabled="operationType !== 'edit' && operationType !== 'add'" clearable
                 size="small"></el-input>
             </template>
           </el-table-column>
           <el-table-column label="淇濆吇鍏抽敭閮ㄤ綅" min-width="120" prop="maintenanceSite">
             <template slot-scope="scope">
-              <el-input v-model="scope.row.maintenanceSite" :disabled="operationType !== 'edit'" clearable size="small"
+              <el-input v-model="scope.row.maintenanceSite" :disabled="operationType !== 'edit' && operationType !== 'add'" clearable size="small"
                 type="textarea"></el-input>
             </template>
           </el-table-column>
           <el-table-column label="淇濆吇鍐呭" min-width="120" prop="maintenanceContent">
             <template slot-scope="scope">
-              <el-input v-model="scope.row.maintenanceContent" :disabled="operationType !== 'edit'" clearable
+              <el-input v-model="scope.row.maintenanceContent" :disabled="operationType !== 'edit' && operationType !== 'add'" clearable
                 size="small" type="textarea"></el-input>
             </template>
           </el-table-column>
           <el-table-column label="淇濆吇鍛ㄦ湡" min-width="90" prop="maintenanceIntervals">
             <template slot-scope="scope">
-              <el-input v-model="scope.row.maintenanceIntervals" :disabled="operationType !== 'edit'" clearable
+              <el-input v-model="scope.row.maintenanceIntervals" :disabled="operationType !== 'edit' && operationType !== 'add'" clearable
                 size="small"></el-input>
             </template>
           </el-table-column>
-          <el-table-column fixed="right" label="鎿嶄綔" width="80" align="center" v-if="operationType === 'edit'">
+          <el-table-column label="鎿嶄綔" width="80" align="center" v-if="operationType === 'edit' || operationType === 'add'">
             <template slot-scope="scope">
               <el-button style="color: #f56c6c" type="text" @click="deleteRow(scope.$index)">鍒犻櫎</el-button>
             </template>
@@ -104,7 +104,7 @@
       </div>
       <span slot="footer" class="dialog-footer">
         <el-button @click="closeDialog">鍙� 娑�</el-button>
-        <el-button v-if="operationType === 'edit'" :loading="submitFormLoading" type="primary" @click="submitForm">纭�
+        <el-button v-if="operationType === 'edit' || operationType === 'add'" :loading="submitFormLoading" type="primary" @click="submitForm">纭�
           璁�</el-button>
         <el-button v-if="operationType === 'check'" :loading="submitFormLoading" type="primary"
           @click="checkStatus(0)">涓嶉�氳繃</el-button>
@@ -125,7 +125,7 @@
       </el-table>
       <span slot="footer" class="dialog-footer">
         <el-button @click="addEquipDia = false">鍙� 娑�</el-button>
-        <el-button v-if="operationType === 'edit'" :loading="submitFormLoading" type="primary"
+        <el-button v-if="operationType === 'edit' || operationType === 'add'" :loading="submitFormLoading" type="primary"
           @click="changeMachineName">纭�
           璁�</el-button>
       </span>
diff --git a/src/views/CNAS/resourceDemand/device/component/quantityValueTraceabilityPlan.vue b/src/views/CNAS/resourceDemand/device/component/quantityValueTraceabilityPlan.vue
index 54d0c87..c91deac 100644
--- a/src/views/CNAS/resourceDemand/device/component/quantityValueTraceabilityPlan.vue
+++ b/src/views/CNAS/resourceDemand/device/component/quantityValueTraceabilityPlan.vue
@@ -50,10 +50,10 @@
     <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="applicationForm"
       title="浠櫒璁惧閲忓�兼函婧愮鐞嗘�讳綋璁″垝" width="80%" @close="closeDialog">
       <div style="display: flex;align-items: center;">
-        <el-button v-if="operationType === 'edit'" size="small" type="primary" @click="addTableRow">娣诲姞</el-button>
+        <el-button v-if="operationType === 'edit' || operationType === 'add'" size="small" type="primary" @click="addTableRow">娣诲姞</el-button>
         <span style="width: 60px;margin-left: 10px">骞翠唤锛�</span>
         <el-date-picker v-model="form.planYear" type="year" value-format="yyyy" clearable size="small" format="yyyy"
-          placeholder="閫夋嫨骞�" :disabled="operationType !== 'edit'">
+          placeholder="閫夋嫨骞�" :disabled="operationType !== 'edit' && operationType !== 'add'">
         </el-date-picker>
       </div>
       <div style="margin: 10px 0">
@@ -63,53 +63,53 @@
           <el-table-column align="center" header-align="center" label="搴忓彿" type="index" width="60"></el-table-column>
           <el-table-column label="璁惧鍚嶇О" min-width="170" prop="deviceId">
             <template slot-scope="scope">
-              <el-input v-model="scope.row.deviceName" :disabled="operationType !== 'edit'" clearable
+              <el-input v-model="scope.row.deviceName" :disabled="operationType !== 'edit' && operationType !== 'add'" clearable
                 size="small"></el-input>
             </template>
           </el-table-column>
           <el-table-column label="鍨嬪彿" min-width="140" prop="specificationModel">
             <template slot-scope="scope">
-              <el-input v-model="scope.row.specificationModel" :disabled="operationType !== 'edit'" clearable
+              <el-input v-model="scope.row.specificationModel" :disabled="operationType !== 'edit' && operationType !== 'add'" clearable
                 size="small"></el-input>
             </template>
           </el-table-column>
           <el-table-column label="璁惧缂栧彿" min-width="140" prop="managementNumber">
             <template slot-scope="scope">
-              <el-input v-model="scope.row.managementNumber" :disabled="operationType !== 'edit'" clearable
+              <el-input v-model="scope.row.managementNumber" :disabled="operationType !== 'edit' && operationType !== 'add'" clearable
                 size="small"></el-input>
             </template>
           </el-table-column>
           <el-table-column label="鎶�鏈寚鏍囧弬鏁�" min-width="150" prop="technicalIndexParameters">
             <template slot-scope="scope">
-              <el-input v-model="scope.row.technicalIndexParameters" :disabled="operationType !== 'edit'" clearable
+              <el-input v-model="scope.row.technicalIndexParameters" :disabled="operationType !== 'edit' && operationType !== 'add'" clearable
                 size="small" type="textarea"></el-input>
             </template>
           </el-table-column>
           <el-table-column label="鎶�鏈寚鏍囪姹�" min-width="150" prop="technicalRequirements">
             <template slot-scope="scope">
-              <el-input v-model="scope.row.technicalRequirements" :disabled="operationType !== 'edit'" clearable
+              <el-input v-model="scope.row.technicalRequirements" :disabled="operationType !== 'edit' && operationType !== 'add'" clearable
                 size="small" type="textarea"></el-input>
             </template>
           </el-table-column>
           <el-table-column label="妫�瀹氬懆鏈�" min-width="120" prop="verificationCycle">
             <template slot-scope="scope">
-              <el-input v-model="scope.row.verificationCycle" :disabled="operationType !== 'edit'" clearable
+              <el-input v-model="scope.row.verificationCycle" :disabled="operationType !== 'edit' && operationType !== 'add'" clearable
                 size="small" type="textarea"></el-input>
             </template>
           </el-table-column>
           <el-table-column label="妫�瀹氬崟浣�" min-width="90" prop="verificationUnit">
             <template slot-scope="scope">
-              <el-input v-model="scope.row.verificationUnit" :disabled="operationType !== 'edit'" clearable
+              <el-input v-model="scope.row.verificationUnit" :disabled="operationType !== 'edit' && operationType !== 'add'" clearable
                 size="small" type="textarea"></el-input>
             </template>
           </el-table-column>
           <el-table-column label="澶囨敞" min-width="90" prop="remark">
             <template slot-scope="scope">
-              <el-input v-model="scope.row.remark" :disabled="operationType !== 'edit'" clearable size="small"
+              <el-input v-model="scope.row.remark" :disabled="operationType !== 'edit' && operationType !== 'add'" clearable size="small"
                 type="textarea"></el-input>
             </template>
           </el-table-column>
-          <el-table-column fixed="right" label="鎿嶄綔" width="80" align="center" v-if="operationType === 'edit'">
+          <el-table-column label="鎿嶄綔" width="80" align="center" v-if="operationType === 'edit' || operationType === 'add'">
             <template slot-scope="scope">
               <el-button style="color: #f56c6c" type="text" @click="deleteRow(scope.$index)">鍒犻櫎</el-button>
             </template>
@@ -118,7 +118,7 @@
       </div>
       <span slot="footer" class="dialog-footer">
         <el-button @click="closeDialog">鍙� 娑�</el-button>
-        <el-button v-if="operationType === 'edit'" :loading="submitFormLoading" type="primary" @click="submitForm">纭�
+        <el-button v-if="operationType === 'edit' || operationType === 'add'" :loading="submitFormLoading" type="primary" @click="submitForm">纭�
           璁�</el-button>
         <el-button v-if="operationType === 'check'" :loading="submitFormLoading" type="primary"
           @click="checkStatus(0)">涓嶉�氳繃</el-button>
@@ -138,7 +138,7 @@
       </el-table>
       <span slot="footer" class="dialog-footer">
         <el-button @click="addEquipDia = false">鍙� 娑�</el-button>
-        <el-button v-if="operationType === 'edit'" :loading="submitFormLoading" type="primary"
+        <el-button v-if="operationType === 'edit' || operationType === 'add'" :loading="submitFormLoading" type="primary"
           @click="changeMachineName">纭�
           璁�</el-button>
       </span>
diff --git a/src/views/CNAS/resourceDemand/device/component/usageAuthorization.vue b/src/views/CNAS/resourceDemand/device/component/usageAuthorization.vue
index 78d4681..c6c5913 100644
--- a/src/views/CNAS/resourceDemand/device/component/usageAuthorization.vue
+++ b/src/views/CNAS/resourceDemand/device/component/usageAuthorization.vue
@@ -13,14 +13,14 @@
     <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="usageTableDia"
                title="璁惧淇濆吇璁″垝琛�" width="80%" @close="closeDialog">
       <div style="display: flex;align-items: center;">
-        <el-button size="small" type="primary" @click="addTableRow">娣诲姞</el-button>
+        <el-button size="small" type="primary" @click="addTableRow" v-if="operationType !== 'check'">娣诲姞</el-button>
         <span style="width: 60px;margin-left: 10px">骞翠唤锛�</span>
         <el-date-picker v-model="form.impowerYear" type="year" value-format="yyyy" clearable size="small" format="yyyy"
-                        placeholder="閫夋嫨骞�">
+                        placeholder="閫夋嫨骞�" :disabled="operationType === 'check'">
         </el-date-picker>
       </div>
       <div style="margin: 10px 0">
-        <el-table ref="usageTableData" :data="usageTableData" id="templateParamTable" row-key="deviceId"
+        <el-table ref="deviceImpowerDetails" :data="deviceImpowerDetails" id="templateParamTable" row-key="deviceId"
                   :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border
                   height="560px" style="width: 100% ;">
           <el-table-column align="center" header-align="center" label="搴忓彿" type="index" width="60"></el-table-column>
@@ -30,15 +30,15 @@
                         size="small" :disabled="operationType === 'check'"></el-input>
             </template>
           </el-table-column>
-          <el-table-column label="璁惧缂栧彿" min-width="140" prop="deviceNumber">
+          <el-table-column label="璁惧缂栧彿" min-width="140" prop="managementNumber">
             <template slot-scope="scope">
-              <el-input v-model="scope.row.deviceNumber" clearable
+              <el-input v-model="scope.row.managementNumber" clearable
                         size="small" :disabled="operationType === 'check'"></el-input>
             </template>
           </el-table-column>
-          <el-table-column label="瑙勬牸鍨嬪彿" min-width="120" prop="model">
+          <el-table-column label="瑙勬牸鍨嬪彿" min-width="120" prop="specificationModel">
             <template slot-scope="scope">
-              <el-input v-model="scope.row.model" clearable
+              <el-input v-model="scope.row.specificationModel" clearable
                         size="small" :disabled="operationType === 'check'"></el-input>
             </template>
           </el-table-column>
@@ -48,7 +48,7 @@
                        :disabled="operationType === 'check'"></el-input>
             </template>
           </el-table-column>
-          <el-table-column label="琚巿鏉冧汉" min-width="120" prop="delegatee">
+          <el-table-column label="琚巿鏉冧汉" min-width="160" prop="delegatee">
             <template slot-scope="scope">
               <el-select v-model="scope.row.delegatedUserArr"
                          clearable filterable multiple
@@ -59,7 +59,7 @@
               </el-select>
             </template>
           </el-table-column>
-          <el-table-column fixed="right" label="鎿嶄綔" width="80" align="center">
+          <el-table-column label="鎿嶄綔" width="80" align="center" v-if="operationType !== 'check'">
             <template slot-scope="scope">
               <el-button style="color: #f56c6c" type="text" @click="deleteRow(scope.$index)">鍒犻櫎</el-button>
             </template>
@@ -91,7 +91,7 @@
         <el-table-column type="selection" width="55"></el-table-column>
         <el-table-column label="璁惧鍚嶇О" prop="label" width="190"></el-table-column>
         <el-table-column prop="value" label="璁惧缂栧彿" width="130"></el-table-column>
-        <el-table-column prop="managementNumber" label="褰掑睘瀹為獙瀹�"></el-table-column>
+        <el-table-column prop="storagePoint" label="褰掑睘瀹為獙瀹�"></el-table-column>
       </el-table>
       <span slot="footer" class="dialog-footer">
         <el-button @click="addEquipDia = false">鍙� 娑�</el-button>
@@ -140,6 +140,29 @@
         { label: '鎺堟潈浜�', prop: 'audit' },
         { label: '鎺堟潈鏃ユ湡', prop: 'auditDate' },
         {
+          dataType: 'tag',
+          label: '鎺堟潈鐘舵��',
+          prop: 'status',
+          formatData: (params) => {
+            if (params === 1) {
+              return '宸叉巿鏉�'
+            } else if (params == 0) {
+              return '鏈巿鏉�'
+            } else {
+              return null
+            }
+          },
+          formatType: (params) => {
+            if (params == 1) {
+              return 'success'
+            } else if (params === 0) {
+              return 'danger'
+            } else {
+              return null
+            }
+          }
+        },
+        {
           dataType: 'action',
           label: '鎿嶄綔',
           operation: [
@@ -149,12 +172,18 @@
               clickFun: (row) => {
                 this.openDia('edit', row);
               },
+              disabled: (row) => {
+                return row.status === 1;
+              },
             },
             {
               name: '鎺堟潈',
               type: 'text',
               clickFun: (row) => {
                 this.openDia('check', row);
+              },
+              disabled: (row) => {
+                return row.status === 1;
               },
             },
             {
@@ -163,6 +192,9 @@
               clickFun: (row) => {
                 this.handleDeleteClick(row);
               },
+              disabled: (row) => {
+                return row.status === 1;
+              },
             },
           ]
         }
@@ -170,7 +202,7 @@
       responsibleOptions: [],
       operationType: '',
       usageTableDia: false,
-      usageTableData: [],
+      deviceImpowerDetails: [],
       submitFormLoading: false,
       addEquipDia: false,
       equipOptions: [],
@@ -215,15 +247,18 @@
       this.usageTableDia = true
       this.form = {
         impowerYear: '',
-        usageTableData: [],
+        deviceImpowerDetails: [],
       }
-      this.usageTableData = []
+      this.deviceImpowerDetails = []
       if (row) {
         this.impowerId = row.impowerId
         getImpowerDetail({ impowerId: this.impowerId }).then(res => {
           if (res.code === 200) {
             this.form = res.data
-            this.usageTableData = this.form.usageTableData
+            this.deviceImpowerDetails = this.form.deviceImpowerDetails
+            this.deviceImpowerDetails.forEach(item => {
+              this.$set(item, 'delegatedUserArr', item.delegatedUser.split(','))
+            })
           }
         }).catch(error => {
           console.error(error)
@@ -244,12 +279,12 @@
     },
     // 鍒犻櫎琛ㄦ牸琛�
     deleteRow(index) {
-      this.usageTableData.splice(index, 1)
+      this.deviceImpowerDetails.splice(index, 1)
     },
     // 鎻愪氦鏂板鍜屼慨鏀�
     submitForm() {
-      this.form.usageTableData = this.HaveJson(this.usageTableData)
-      this.form.usageTableData.forEach((item) => {
+      this.form.deviceImpowerDetails = this.HaveJson(this.deviceImpowerDetails)
+      this.form.deviceImpowerDetails.forEach((item) => {
         item.delegatedUser = item.delegatedUserArr.join(',')
       })
       this.submitFormLoading = true
@@ -301,7 +336,7 @@
     changeMachineName() {
       this.deviceMaintenancePlanDetails = []
       this.selectionRows.map(val => {
-        this.usageTableData.push({ deviceId: val.id, deviceName: val.label, deviceNumber: val.value, model: val.specificationModel, delegatedUserArr: this.delegatedUser })
+        this.deviceImpowerDetails.push({ deviceId: val.id, deviceName: val.label, managementNumber: val.value, specificationModel: val.specificationModel, delegatedUserArr: this.delegatedUser })
       })
       this.addEquipDia = false
     },
@@ -313,6 +348,7 @@
           this.equipOptions = res.data.map(m => {
             m.value = m.managementNumber
             m.label = m.deviceName
+            m.storagePoint = m.storagePoint
             return m
           })
         }
@@ -333,7 +369,7 @@
         cancelButtonText: '鍙栨秷',
         type: 'warning'
       }).then(() => {
-        deleteImpower({ id: row.impowerId }).then(res => {
+        deleteImpower({ impowerId: row.impowerId }).then(res => {
           this.$message({
             type: 'success',
             message: '鍒犻櫎鎴愬姛!'

--
Gitblit v1.9.3