From 6404e15051c35af4a6a5d54a9e9cc8e6580b268d Mon Sep 17 00:00:00 2001
From: chenrui <1187576398@qq.com>
Date: 星期三, 26 二月 2025 13:52:07 +0800
Subject: [PATCH] 设施和环境条件代码迁移

---
 src/api/cnas/resourceDemand/facilitiesEnvironment/facilitiesAndEnvironment.js                                                        |  121 ++++++++++++++++++++
 src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions/lightning-protection-detection.vue |   72 ++++-------
 src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions/power-supply-stability.vue         |   43 +-----
 src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions/illuminance-recording.vue          |   78 +++++-------
 4 files changed, 190 insertions(+), 124 deletions(-)

diff --git a/src/api/cnas/resourceDemand/facilitiesEnvironment/facilitiesAndEnvironment.js b/src/api/cnas/resourceDemand/facilitiesEnvironment/facilitiesAndEnvironment.js
index 2d0d1ee..3e48735 100644
--- a/src/api/cnas/resourceDemand/facilitiesEnvironment/facilitiesAndEnvironment.js
+++ b/src/api/cnas/resourceDemand/facilitiesEnvironment/facilitiesAndEnvironment.js
@@ -54,4 +54,125 @@
   })
 }
 
+// 璁炬柦鍜岀幆澧冩潯浠惰姹�-鐢垫簮绋冲畾鎬у垹闄�
+export function deleteLaboratoryFacilityPowerStable(query) {
+  return request({
+    url: '/fePowerStable/deleteLaboratoryFacilityPowerStable',
+    method: 'delete',
+    params: query
+  })
+}
 
+// 鐢垫簮绋冲畾鎬�-娴嬪畾閲� 鏍规嵁鐢垫簮绋冲畾鎬ф煡璇�
+export function getFeMeasuredQuantityService(query) {
+  return request({
+    url: "/fePowerStable/getFeMeasuredQuantityService",
+    method: "get",
+    params: query,
+  });
+}
+
+// 鐢垫簮绋冲畾鎬�-娴嬪畾閲� 瀵煎嚭
+export function exportFePowerStable(query) {
+  return request({
+    url: "/fePowerStable/exportFePowerStable",
+    method: "get",
+    responseType: "blob",
+    params: query,
+  });
+}
+
+// 璁炬柦鍜岀幆澧冩潯浠惰姹�-闃查浄妫�娴嬫煡璇�
+export function getLightningProtectionDetection(query) {
+  return request({
+    url: '/feLightningProtection/getLightningProtectionDetection',
+    method: 'get',
+    params: query
+  })
+}
+
+// 璁炬柦鍜岀幆澧冩潯浠惰姹�-闃查浄妫�娴嬫柊澧�/淇敼
+export function addLightningProtectionDetection(query) {
+  return request({
+    url: '/feLightningProtection/addLightningProtectionDetection',
+    method: 'post',
+    data: query,
+    headers: {
+      'Content-Type': 'multipart/form-data' // 蹇呴』璁剧疆涓� multipart
+    }
+  })
+}
+
+// 璁炬柦鍜岀幆澧冩潯浠惰姹�-闃查浄妫�娴嬪垹闄�
+export function deleteLightningProtectionDetection(query) {
+  return request({
+    url: '/feLightningProtection/deleteLightningProtectionDetection',
+    method: 'delete',
+    params: query
+  })
+}
+
+// 璁炬柦鍜岀幆澧冩潯浠惰姹�-闃查浄妫�娴嬪鍑�
+export function exportOfLightningProtectionDetection(query) {
+  return request({
+    url: "/feLightningProtection/exportOfLightningProtectionDetection",
+    method: "get",
+    responseType: "blob",
+    params: query,
+  });
+}
+
+// 璁炬柦鍜岀幆澧冩潯浠惰姹�-鐓у害璁板綍琛�-妫�娴嬪尯鍩� 鏌ヨ
+export function getFeLightningProtection(query) {
+  return request({
+    url: '/feIllumination/getFeLightningProtection',
+    method: 'get',
+    params: query
+  })
+}
+
+// 璁炬柦鍜岀幆澧冩潯浠惰姹�-鐓у害璁板綍琛�-妫�娴嬪尯鍩� 鏂板/淇敼
+export function addFeLightningProtection(query) {
+  return request({
+    url: '/feIllumination/addFeLightningProtection',
+    method: 'post',
+    data: query,
+  })
+}
+
+// 璁炬柦鍜岀幆澧冩潯浠惰姹�-鐓у害璁板綍琛�-妫�娴嬪尯鍩� 鍒犻櫎
+export function deleteFeLightningProtection(query) {
+  return request({
+    url: '/feIllumination/deleteFeLightningProtection',
+    method: 'delete',
+    params: query
+  })
+}
+
+// 鐓у害璁板綍琛�-妫�娴嬪尯鍩� 鏍规嵁鐓у害璁板綍鏌ヨ
+export function getFeIlluminationDetectionArea(query) {
+  return request({
+    url: '/feIllumination/getFeIlluminationDetectionArea',
+    method: 'get',
+    params: query
+  })
+}
+
+// 鐓у害璁板綍琛�-妫�娴嬪尯鍩� 鍒犻櫎
+export function deleteFeIlluminationDetectionArea(query) {
+  return request({
+    url: '/feIllumination/deleteFeIlluminationDetectionArea',
+    method: 'delete',
+    params: query
+  })
+}
+
+// 鐓у害璁板綍琛�-妫�娴嬪尯鍩� 瀵煎嚭
+export function exportFeIllumination(query) {
+  return request({
+    url: "/feIllumination/exportFeIllumination",
+    method: "get",
+    responseType: "blob",
+    params: query,
+  });
+}
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..a9c7baa 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
@@ -198,11 +198,23 @@
 </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
       },
@@ -251,17 +263,18 @@
       }
     },
     edit(row) {
-      this.$axios.get(this.$api.facilitiesAndEnvironment.getFeIlluminationDetectionArea + "?intensityIlluminationId=" + row.intensityIlluminationId).then(res => {
+      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 +291,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 +299,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 +311,7 @@
       }
     },
     openDialog() {
-      this.$axios.get(this.$api.deviceScope.treeDevice).then(res => {
+      treeDevice().then(res => {
         this.cascaderList = res.data;
       });
       this.$nextTick(() => {
@@ -312,7 +326,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 +349,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 +363,7 @@
     },
     // 鑾峰彇璐熻矗浜轰俊鎭帴鍙�
     getUserList() {
-      this.$axios.get(this.$api.deviceScope.selectUserList).then(res => {
+      selectUserCondition().then(res => {
         if (res.code == 200) {
           this.responsibleOptions = res.data
         }
@@ -369,35 +379,11 @@
     },
     // 瀵煎嚭
     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('瀵煎嚭鎴愬姛')
-          }
-        }
+        this.$download.saveAs(blob, '鐓у害璁板綍.docx')
+        this.$message.success('瀵煎嚭鎴愬姛')
       })
     },
   }
diff --git a/src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions/lightning-protection-detection.vue b/src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions/lightning-protection-detection.vue
index 57a7704..48e5b68 100644
--- a/src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions/lightning-protection-detection.vue
+++ b/src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions/lightning-protection-detection.vue
@@ -120,11 +120,20 @@
 
 <script>
 
+import {
+  getLightningProtectionDetection,
+  addLightningProtectionDetection,
+  deleteLightningProtectionDetection,
+  exportOfLightningProtectionDetection
+} from '@/api/cnas/resourceDemand/facilitiesEnvironment/facilitiesAndEnvironment'
+
+import axios from 'axios';
+
 export default {
   data() {
     return {
       search: {
-        size: 20,
+        size: 10,
         current: 1,
         total: 0
       },
@@ -152,42 +161,20 @@
   methods: {
     // 瀵煎嚭
     downLoadPost() {
-      this.$axios.get(this.$api.facilitiesAndEnvironment.exportOfLightningProtectionDetection,{responseType: "blob"}).then(res => {
+      exportOfLightningProtectionDetection().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 = '闃查浄妫�娴嬪鍑�' + '.xlsx';
-              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 = '闃查浄妫�娴嬪鍑�' + '.xlsx';
-            link.click();
-            this.$message.success('瀵煎嚭鎴愬姛')
-          }
-        }
+        this.$download.saveAs(blob,'闃查浄妫�娴嬪鍑�.xlsx')
       })
     },
     initData() {
-      this.$axios.get(this.$api.facilitiesAndEnvironment.getLightningProtectionDetection + '?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;
+      getLightningProtectionDetection({...this.search}).then(res => {
+        if (res.code === 200){
+          this.tableData = res.data.records;
+          this.search.total = res.data.total;
+        }
+
       });
     },
     handleSizeChange(val) {
@@ -223,13 +210,11 @@
           if (this.form.fileData.length > 0) {
             params.append("file", this.form.fileData[0].file)
           }
-          this.$axios.post(this.$api.facilitiesAndEnvironment.addLightningProtectionDetection, params, {
-            headers: {'Content-Type': 'multipart/form-data;'},
-            noQs: true
-          }).then(res => {
-            if (res.code === 201) return;
-            this.dialogVisible = false
-            this.initData()
+          addLightningProtectionDetection(params).then(res => {
+            if (res.code === 200){
+              this.dialogVisible = false
+              this.initData()
+            }
           });
         }
       });
@@ -248,7 +233,7 @@
         cancelButtonText: '鍙栨秷',
         type: 'warning'
       }).then(() => {
-        this.$axios.delete(this.$api.facilitiesAndEnvironment.deleteLightningProtectionDetection + '?lightningProtectionId=' + row.lightningProtectionId).then(res => {
+        deleteLightningProtectionDetection({lightningProtectionId:row.lightningProtectionId}).then(res => {
           this.$message.success('鍒犻櫎鎴愬姛锛�')
           this.initData()
         })
@@ -266,13 +251,8 @@
     },
     download(row) {
       let url = '';
-
-      // fileDownload.downloadIamge(url, row.fileName)
-      url = this.javaApi + 'img/' + row.systemFileName
-      const link = document.createElement('a');
-      link.href = url;
-      link.download = row.fileName;
-      link.click();
+      url = this.javaApi + '/img/' + row.systemFileName
+      this.$download.saveAs(url, row.fileName)
     }
   }
 }
diff --git a/src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions/power-supply-stability.vue b/src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions/power-supply-stability.vue
index b17f95d..9e290ea 100644
--- a/src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions/power-supply-stability.vue
+++ b/src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions/power-supply-stability.vue
@@ -197,7 +197,10 @@
   treeDevice,
   selectUserCondition,
   addLaboratoryFacilityPowerStable,
-  deleteFeMeasuredQuantity
+  deleteFeMeasuredQuantity,
+  getFeMeasuredQuantityService,
+  deleteLaboratoryFacilityPowerStable,
+  exportFePowerStable
 } from '@/api/cnas/resourceDemand/facilitiesEnvironment/facilitiesAndEnvironment'
 
 export default {
@@ -268,7 +271,7 @@
         cancelButtonText: '鍙栨秷',
         type: 'warning'
       }).then(() => {
-        this.$axios.delete(this.$api.facilitiesAndEnvironment.deleteLaboratoryFacilityPowerStable + '?powerStableId=' + row.powerStableId).then(res => {
+        deleteLaboratoryFacilityPowerStable({powerStableId:row.powerStableId}).then(res => {
           this.$message.success('鍒犻櫎鎴愬姛锛�')
           this.initData()
         })
@@ -311,7 +314,7 @@
     // 鐢垫簮绋冲畾鎬�-娴嬪畾閲忓脊妗嗕腑琛ㄦ牸鐨勫垹闄よ
     feMeasuredQuantityListDelete(row, index) {
       if (row.measuredQuantityId) {
-        this.$axios.delete(this.$api.facilitiesAndEnvironment.deleteFeMeasuredQuantity + '?measuredQuantityId=' + row.measuredQuantityId).then(res => {
+        deleteFeMeasuredQuantity({measuredQuantityId:row.measuredQuantityId}).then(res => {
           if (res.code === 201) return
           this.form.feMeasuredQuantityList.splice(index, 1)
           this.$message.success('鍒犻櫎鎴愬姛锛�')
@@ -350,44 +353,20 @@
     },
     // 瀵煎嚭
     downLoadPost(row) {
-      this.$axios.get(this.$api.facilitiesAndEnvironment.exportFePowerStable + '?powerStableId=' + row.powerStableId,{responseType: "blob"}).then(res => {
+      exportFePowerStable({powerStableId: row.powerStableId}).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('瀵煎嚭鎴愬姛')
-          }
-        }
+        this.$download.saveAs(blob, '鐢垫簮绋冲畾鎬�.docx')
+        this.$message.success('瀵煎嚭鎴愬姛')
       })
     },
     // 鐢垫簮绋冲畾鎬� 鐐瑰嚮琛岀紪杈戣Е鍙�
     edit(row) {
-      this.$axios.get(this.$api.facilitiesAndEnvironment.getFeMeasuredQuantityService + "?powerStableId=" + row.powerStableId).then(res => {
+      getFeMeasuredQuantityService({powerStableId: row.powerStableId}).then((res => {
         this.form = {...row}
         this.form.feMeasuredQuantityList = res.data;
         this.dialogVisible = true
-      });
+      }))
     },
     // 鑾峰彇璐熻矗浜轰俊鎭帴鍙�
     getUserList() {

--
Gitblit v1.9.3