From 0a26d58a3906b9e13946c7cb46fae51a0de98920 Mon Sep 17 00:00:00 2001
From: Crunchy <3114200645@qq.com>
Date: 星期一, 17 三月 2025 15:49:08 +0800
Subject: [PATCH] Merge branch 'dev' into dev_tides

---
 src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions/illuminance-recording.vue |  177 ++++++++++++++++++++--------------------------------------
 1 files changed, 62 insertions(+), 115 deletions(-)

diff --git a/src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions/illuminance-recording.vue b/src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions/illuminance-recording.vue
index 165feb1..ce87d88 100644
--- a/src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions/illuminance-recording.vue
+++ b/src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions/illuminance-recording.vue
@@ -6,10 +6,8 @@
         <el-button size="small" type="primary" @click="clickAdd">鏂� 澧�</el-button>
       </div>
     </div>
-    <el-table
-      :data="tableData"
-      height="calc(100vh - 18em)"
-      style="width: 100%">
+    <el-table :data="tableData" height="calc(100vh - 18em)" style="width: 100%"
+              :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border>
       <el-table-column label="搴忓彿" type="index" width="120">
         <template v-slot="scope">
           <span>{{ (search.current - 1) * search.size + scope.$index + 1 }}</span>
@@ -32,44 +30,29 @@
         </template>
       </el-table-column>
     </el-table>
-    <el-pagination :current-page="1" :page-size="search.size" :page-sizes="[10, 20, 30, 50, 100]"
-                   :total="search.total" layout="->,total, sizes, prev, pager, next, jumper"
-                   @size-change="handleSizeChange"
-                   @current-change="handleCurrentChange">
+    <el-pagination :current-page="1" :page-size="search.size" :page-sizes="[10, 20, 30, 50, 100]" :total="search.total"
+      layout="->,total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange" background
+      @current-change="handleCurrentChange">
     </el-pagination>
-    <el-dialog
-      :visible.sync="dialogVisible"
-      title="鏂板"
-      width="50%"
-      @open="openDialog">
+    <el-dialog :visible.sync="dialogVisible" title="鏂板" width="50%" @open="openDialog">
       <div style="height: 50vh; overflow-y: auto">
         <el-form ref="form" :model="form" label-width="120px">
           <el-row>
             <el-col :span="12">
               <el-form-item :rules="[{ required: true, message: '璇疯緭鍏ユ祴璇曞湴鐐�', trigger: 'change' }]" label="娴嬭瘯鏃ユ湡"
-                            prop="testDate">
-                <el-date-picker
-                  v-model="form.testDate"
-                  format="yyyy-MM-dd"
-                  placeholder="閫夋嫨鏃ユ湡"
-                  size="small"
-                  style="width: 100%"
-                  type="date"
-                  value-format="yyyy-MM-dd">
+                prop="testDate">
+                <el-date-picker v-model="form.testDate" format="yyyy-MM-dd" placeholder="閫夋嫨鏃ユ湡" size="small"
+                  style="width: 100%" type="date" value-format="yyyy-MM-dd">
                 </el-date-picker>
               </el-form-item>
             </el-col>
             <el-col :span="12">
               <el-form-item :rules="[{ required: true, message: '璇疯緭鍏ヨ澶囧悕绉�', trigger: 'change' }]" label="璁惧鍚嶇О"
-                            prop="deviceId">
-                <el-select v-model="form.deviceId"
-                           class="table_input"
-                           clearable
-                           filterable
-                           placeholder="璁惧鍚嶇О"
-                           size="small" @change="getCalibrationDateFun">
-                  <el-option v-for="item in equipOptions" :key="item.id"  :label="item.deviceName" :value="item.id">
-                    {{item.deviceName + item.managementNumber}}
+                prop="deviceId">
+                <el-select v-model="form.deviceId" class="table_input" clearable filterable placeholder="璁惧鍚嶇О"
+                  size="small" @change="getCalibrationDateFun">
+                  <el-option v-for="item in equipOptions" :key="item.id" :label="item.deviceName" :value="item.id">
+                    {{ item.deviceName + item.managementNumber }}
                   </el-option>
                 </el-select>
               </el-form-item>
@@ -91,8 +74,8 @@
             </el-col>
             <el-col :span="12">
               <el-form-item label="妫�娴嬭��" prop="recipientUser">
-                <el-select v-model="form.testerId" clearable filterable placeholder="璇烽�夋嫨"
-                           size="small" style="width: 100%;">
+                <el-select v-model="form.testerId" clearable filterable placeholder="璇烽�夋嫨" size="small"
+                  style="width: 100%;">
                   <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.id">
                   </el-option>
                 </el-select>
@@ -100,8 +83,8 @@
             </el-col>
             <el-col :span="12">
               <el-form-item label="鏍告煡浜�" prop="recipientUser">
-                <el-select v-model="form.checkerId" clearable filterable placeholder="璇烽�夋嫨"
-                           size="small" style="width: 100%;" >
+                <el-select v-model="form.checkerId" clearable filterable placeholder="璇烽�夋嫨" size="small"
+                  style="width: 100%;">
                   <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.id">
                   </el-option>
                 </el-select>
@@ -109,11 +92,7 @@
             </el-col>
             <el-col :span="24">
               <el-form-item label="缁撹">
-                <el-input
-                  v-model="form.conclusion"
-                  :rows="2"
-                  placeholder="璇疯緭鍏ュ唴瀹�"
-                  type="textarea">
+                <el-input v-model="form.conclusion" :rows="2" placeholder="璇疯緭鍏ュ唴瀹�" type="textarea">
                 </el-input>
               </el-form-item>
             </el-col>
@@ -123,25 +102,15 @@
               <el-button size="small" type="primary" @click="feMeasuredQuantityListAdd">鏂板</el-button>
             </div>
             <div>
-              <el-table
-                :data="form.illuminationDetectionAreaList"
-                height="40vh"
-                style="width: 100%; margin: auto">
+              <el-table :data="form.illuminationDetectionAreaList" height="40vh" style="width: 100%; margin: auto"
+                        :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border>
                 <el-table-column label="搴忓彿" type="index" width="80"></el-table-column>
-                <el-table-column
-                  align="center"
-                  label="妫�娴嬪尯鍩熷悕绉�"
-                  min-width="180"
-                  prop="detectionAreaLabel">
+                <el-table-column align="center" label="妫�娴嬪尯鍩熷悕绉�" min-width="180" prop="detectionAreaLabel">
                   <template #default="{ row }">
                     <el-input v-model="row.detectionAreaLabel" :rows="1" type="textarea"></el-input>
                   </template>
                 </el-table-column>
-                <el-table-column
-                  align="center"
-                  label="妫�娴嬪��"
-                  min-width="300"
-                  prop="name">
+                <el-table-column align="center" label="妫�娴嬪��" min-width="300" prop="name">
                   <template>
                     <el-table-column align="center" label="绗竴娆�" min-width="100" prop="valueOne">
                       <template #default="{ row }">
@@ -165,19 +134,12 @@
                     </el-table-column>
                   </template>
                 </el-table-column>
-                <el-table-column
-                  align="center"
-                  label="澶囨敞"
-                  min-width="180"
-                  prop="detectionAreaLabel">
+                <el-table-column align="center" label="澶囨敞" min-width="180" prop="detectionAreaLabel">
                   <template #default="{ row }">
                     <el-input v-model="row.remark" :rows="1" type="textarea"></el-input>
                   </template>
                 </el-table-column>
-                <el-table-column
-                  fixed="right"
-                  label="鎿嶄綔"
-                  width="100">
+                <el-table-column fixed="right" label="鎿嶄綔" width="100">
                   <template slot-scope="scope">
                     <el-button size="small" type="text" @click="feMeasuredQuantityListDelete(scope.row, scope.$index)">
                       鍒犻櫎
@@ -190,19 +152,31 @@
         </el-form>
       </div>
       <span slot="footer" class="dialog-footer">
-    <el-button @click="dialogVisible = false">鍙� 娑�</el-button>
-    <el-button type="primary" :loading="submitLoading" @click="addPowerSupplyStability">纭� 瀹�</el-button>
-  </span>
+        <el-button @click="dialogVisible = false">鍙� 娑�</el-button>
+        <el-button type="primary" :loading="submitLoading" @click="addPowerSupplyStability">纭� 瀹�</el-button>
+      </span>
     </el-dialog>
   </div>
 </template>
 
 <script>
+import {
+  getFeLightningProtection,
+  deviceScopeSearch,
+  selectUserCondition,
+  treeDevice,
+  addFeLightningProtection,
+  deleteFeLightningProtection,
+  getFeIlluminationDetectionArea,
+  deleteFeIlluminationDetectionArea,
+  exportFeIllumination
+} from '@/api/cnas/resourceDemand/facilitiesEnvironment/facilitiesAndEnvironment'
+
 export default {
   data() {
     return {
       search: {
-        size: 20,
+        size: 10,
         current: 1,
         total: 0
       },
@@ -244,24 +218,25 @@
         if (!isNaN(row.valueOne) && !isNaN(row.valueTwo) && !isNaN(row.valueThree)) {
           const avg = Number(row.valueOne) + Number(row.valueTwo) + Number(row.valueThree)
           console.log(avg)
-          row.average = Math.round(avg/3);
+          row.average = Math.round(avg / 3);
         } else {
           this.$message.warning("蹇呴』涓烘暟瀛楋紒")
         }
       }
     },
     edit(row) {
-      this.$axios.get(this.$api.facilitiesAndEnvironment.getFeIlluminationDetectionArea + "?intensityIlluminationId=" + row.intensityIlluminationId).then(res => {
-        this.form = {...row}
+      getFeIlluminationDetectionArea({ intensityIlluminationId: row.intensityIlluminationId }).then(res => {
+        this.form = { ...row }
         this.form.illuminationDetectionAreaList = res.data;
         this.dialogVisible = true
       });
     },
     initData() {
-      this.$axios.get(this.$api.facilitiesAndEnvironment.getFeLightningProtection + '?size=' + this.search.size + '&current=' + this.search.current).then(res => {
-        if (res.code === 201) return;
-        this.tableData = res.data.records;
-        this.search.total = res.data.total;
+      getFeLightningProtection({ ...this.search }).then(res => {
+        if (res.code === 200) {
+          this.tableData = res.data.records;
+          this.search.total = res.data.total;
+        }
       });
     },
     handleSizeChange(val) {
@@ -278,7 +253,7 @@
         cancelButtonText: '鍙栨秷',
         type: 'warning'
       }).then(() => {
-        this.$axios.delete(this.$api.facilitiesAndEnvironment.deleteFeLightningProtection + '?intensityIlluminationId=' + row.intensityIlluminationId).then(res => {
+        deleteFeLightningProtection({ intensityIlluminationId: row.intensityIlluminationId }).then(res => {
           this.$message.success('鍒犻櫎鎴愬姛锛�')
           this.initData()
         })
@@ -286,10 +261,11 @@
     },
     feMeasuredQuantityListDelete(row, index) {
       if (row.detectionAreaId) {
-        this.$axios.delete(this.$api.facilitiesAndEnvironment.deleteFeIlluminationDetectionArea + '?detectionAreaId=' + row.detectionAreaId).then(res => {
-          if (res.code === 201) return
-          this.form.illuminationDetectionAreaList.splice(index, 1)
-          this.$message.success('鍒犻櫎鎴愬姛锛�')
+        deleteFeIlluminationDetectionArea({ detectionAreaId: row.detectionAreaId }).then(res => {
+          if (res.code === 200) {
+            this.form.illuminationDetectionAreaList.splice(index, 1)
+            this.$message.success('鍒犻櫎鎴愬姛锛�')
+          }
         })
       } else {
         this.form.illuminationDetectionAreaList.splice(index, 1)
@@ -297,7 +273,7 @@
       }
     },
     openDialog() {
-      this.$axios.get(this.$api.deviceScope.treeDevice).then(res => {
+      treeDevice().then(res => {
         this.cascaderList = res.data;
       });
       this.$nextTick(() => {
@@ -312,7 +288,7 @@
     // 鑾峰彇鎵�鏈夎澶�
     getEquipOptions() {
       this.equipOptions = []
-      this.$axios.get(this.$api.deviceScope.deviceScopeSearch+'?status=0').then(res => {
+      deviceScopeSearch({ status: '0' }).then(res => {
         if (res.code === 200 && res.data) {
           this.equipOptions = res.data
         }
@@ -335,11 +311,7 @@
       this.submitLoading = true
       this.$refs.form.validate((valid) => {
         if (valid) {
-          this.$axios.post(this.$api.facilitiesAndEnvironment.addFeLightningProtection, this.form, {
-            headers: {
-              'Content-Type': 'application/json'
-            }
-          }).then(res => {
+          addFeLightningProtection(this.form).then(res => {
             this.submitLoading = false
             if (res.code === 200) {
               this.initData()
@@ -353,7 +325,7 @@
     },
     // 鑾峰彇璐熻矗浜轰俊鎭帴鍙�
     getUserList() {
-      this.$axios.get(this.$api.deviceScope.selectUserList).then(res => {
+      selectUserCondition().then(res => {
         if (res.code == 200) {
           this.responsibleOptions = res.data
         }
@@ -369,35 +341,10 @@
     },
     // 瀵煎嚭
     downLoadPost(row) {
-      this.$axios.get(this.$api.facilitiesAndEnvironment.exportFeIllumination + '?intensityIlluminationId=' + row.intensityIlluminationId,{responseType: "blob"}).then(res => {
+      exportFeIllumination({ intensityIlluminationId: row.intensityIlluminationId }).then(res => {
         this.outLoading = false
-        const blob = new Blob([res],{ type: 'application/msword' });
-        //灏咮lob 瀵硅薄杞崲鎴愬瓧绗︿覆
-        let reader = new FileReader();
-        reader.readAsText(blob, 'utf-8');
-        reader.onload = () => {
-          try {
-            let result = JSON.parse(reader.result);
-            if (result.message) {
-              this.$message.error(result.message);
-            } else {
-              const url = URL.createObjectURL(blob);
-              const link = document.createElement('a');
-              link.href = url;
-              link.download = '鐓у害璁板綍' + '.docx';
-              link.click();
-              this.$message.success('瀵煎嚭鎴愬姛')
-            }
-          } catch (err) {
-            console.log(err);
-            const url = URL.createObjectURL(blob);
-            const link = document.createElement('a');
-            link.href = url;
-            link.download = '鐓у害璁板綍' + '.docx';
-            link.click();
-            this.$message.success('瀵煎嚭鎴愬姛')
-          }
-        }
+        const blob = new Blob([res], { type: 'application/msword' });
+        this.$download.saveAs(blob, '鐓у害璁板綍.docx')
       })
     },
   }

--
Gitblit v1.9.3