From e5454b769d44a34af423bf87ac8a740bf8c20341 Mon Sep 17 00:00:00 2001
From: Crunchy <3114200645@qq.com>
Date: 星期二, 29 四月 2025 13:25:29 +0800
Subject: [PATCH] Merge branch 'dev' into dev_tides

---
 src/views/CNAS/resourceDemand/device/component/usageAuthorization.vue |  154 ++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 128 insertions(+), 26 deletions(-)

diff --git a/src/views/CNAS/resourceDemand/device/component/usageAuthorization.vue b/src/views/CNAS/resourceDemand/device/component/usageAuthorization.vue
index 78d4681..d316543 100644
--- a/src/views/CNAS/resourceDemand/device/component/usageAuthorization.vue
+++ b/src/views/CNAS/resourceDemand/device/component/usageAuthorization.vue
@@ -3,7 +3,6 @@
     <div class="search">
       <el-button size="small" type="primary" @click="refreshTableList">鍒� 鏂�</el-button>
       <el-button size="small" type="primary" @click="openDia('add')">鏂� 澧�</el-button>
-      <el-button :loading="outLoading" size="small" type="primary" @click="openHandleOut">瀵� 鍑�</el-button>
     </div>
     <div>
       <lims-table :tableData="tableData" :column="column"
@@ -13,14 +12,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 +29,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 +47,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 +58,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,11 +90,24 @@
         <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>
         <el-button :loading="submitFormLoading" type="primary" @click="changeMachineName">纭</el-button>
+      </span>
+    </el-dialog>
+    <el-dialog :visible.sync="notificationDia" title="鎻愪氦瀹℃牳" width="30%" @close="closeNotificationDia">
+      <span style="margin-top: 10px;display: inline-block">
+        璇烽�夋嫨瀹℃牳浜猴細
+        <el-select v-model="auditId" clearable filterable size="small" style="width: 90%;">
+          <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.id">
+          </el-option>
+        </el-select>
+      </span>
+      <span slot="footer" class="dialog-footer">
+        <el-button :loading="notificationLoading" @click="closeNotificationDia">鍙� 娑�</el-button>
+        <el-button :loading="notificationLoading" type="primary" @click="notification">鎻� 浜�</el-button>
       </span>
     </el-dialog>
   </div>
@@ -106,10 +118,10 @@
 import {
   addImpower,
   deleteImpower, deviceScopeSearch, getImpowerDetail, reviewImpowerStatus,
-  selectDeviceImpowerByPage, updateImpower
+  selectDeviceImpowerByPage, submitReviewImpowerStatus, updateImpower, exportDeviceImpower
 } from "@/api/cnas/resourceDemand/device";
-import {exportQualityMonitorDetail} from "@/api/cnas/process/ensureResults/qualityMonitor";
 import {selectUserCondition} from "@/api/system/user";
+import {mapGetters} from "vuex";
 
 export default {
   name: '',
@@ -140,6 +152,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,19 +184,45 @@
               clickFun: (row) => {
                 this.openDia('edit', row);
               },
+              disabled: (row) => {
+                return row.status === 1;
+              },
             },
             {
-              name: '鎺堟潈',
+              name: '瀹℃牳閫氱煡',
+              type: 'text',
+              clickFun: (row) => {
+                this.tellApprove(row.impowerId);
+              },
+              disabled: (row) => {
+                return row.status === 1;
+              },
+            },
+            {
+              name: '瀹℃牳',
               type: 'text',
               clickFun: (row) => {
                 this.openDia('check', row);
               },
+              disabled: (row) => {
+                return row.status === 1 || this.userId !== row.auditId;
+              },
+            },
+            {
+              name: '瀵煎嚭',
+              type: 'text',
+              clickFun: (row) => {
+                this.openHandleOut(row);
+              }
             },
             {
               name: '鍒犻櫎',
               type: 'text',
               clickFun: (row) => {
                 this.handleDeleteClick(row);
+              },
+              disabled: (row) => {
+                return row.status === 1;
               },
             },
           ]
@@ -170,7 +231,7 @@
       responsibleOptions: [],
       operationType: '',
       usageTableDia: false,
-      usageTableData: [],
+      deviceImpowerDetails: [],
       submitFormLoading: false,
       addEquipDia: false,
       equipOptions: [],
@@ -179,7 +240,10 @@
         impowerYear: ''
       },
       delegatedUser: [],
-      impowerId: ''
+      impowerId: '',
+      notificationDia: false,
+      auditId: '',
+      notificationLoading: false,
     };
   },
   mounted() {
@@ -209,21 +273,55 @@
         this.tableLoading = false
       })
     },
+    // 鎵撳紑鎻愪氦鎵瑰噯寮规
+    tellApprove(impowerId) {
+      this.getUserList()
+      this.notificationDia = true
+      this.impowerId = impowerId
+    },
+    // 鎻愪氦鎵瑰噯閫氱煡
+    notification() {
+      if (!this.auditId) {
+        this.$message.warning('璇烽�夋嫨瀹℃牳浜�')
+        return
+      }
+      this.notificationLoading = true
+      submitReviewImpowerStatus({
+        auditId: this.auditId,
+        impowerId: this.impowerId,
+      }).then(res => {
+        this.notificationLoading = false
+        if (res.code == 200) {
+          this.closeNotificationDia()
+          this.refreshTableList()
+        }
+      }).catch(err => {
+        this.notificationLoading = false
+      })
+    },
+    // 鍏抽棴鎻愪氦鎵瑰噯寮规
+    closeNotificationDia() {
+      this.notificationDia = false
+      this.auditId = ''
+    },
     // 鎵撳紑鎿嶄綔寮规
     openDia (type, row) {
       this.operationType = type
       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 +342,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 +399,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 +411,7 @@
           this.equipOptions = res.data.map(m => {
             m.value = m.managementNumber
             m.label = m.deviceName
+            m.storagePoint = m.storagePoint
             return m
           })
         }
@@ -321,10 +420,10 @@
       })
     },
     openHandleOut (row) {
-      exportQualityMonitorDetail({ impowerId: row.impowerId }).then(res => {
+      exportDeviceImpower({ impowerId: row.impowerId }).then(res => {
         this.outLoading = false
         const blob = new Blob([res], { type: 'application/msword' });
-        this.$download.saveAs(blob, row.monitorName + '.docx')
+        this.$download.saveAs(blob, '璁惧浣跨敤鎺堟潈琛�' + '.docx')
       })
     },
     handleDeleteClick(row) {
@@ -333,7 +432,7 @@
         cancelButtonText: '鍙栨秷',
         type: 'warning'
       }).then(() => {
-        deleteImpower({ id: row.impowerId }).then(res => {
+        deleteImpower({ impowerId: row.impowerId }).then(res => {
           this.$message({
             type: 'success',
             message: '鍒犻櫎鎴愬姛!'
@@ -364,6 +463,9 @@
       }
     },
   },
+  computed: {
+    ...mapGetters(["userId"]),
+  },
 };
 </script>
 

--
Gitblit v1.9.3