From fe67cd0c17d827b6a858ceff2eedf8b48e2f5f2a Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 28 二月 2025 13:51:52 +0800
Subject: [PATCH] 人员-奖惩记录搬迁

---
 src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions/power-supply-stability.vue |   88 ++++++++++++++++++++-----------------------
 1 files changed, 41 insertions(+), 47 deletions(-)

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 0cd9c6d..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
@@ -191,11 +191,23 @@
 </template>
 
 <script>
+import {
+  getLaboratoryFacilityPowerStablePage,
+  deviceScopeSearch,
+  treeDevice,
+  selectUserCondition,
+  addLaboratoryFacilityPowerStable,
+  deleteFeMeasuredQuantity,
+  getFeMeasuredQuantityService,
+  deleteLaboratoryFacilityPowerStable,
+  exportFePowerStable
+} from '@/api/cnas/resourceDemand/facilitiesEnvironment/facilitiesAndEnvironment'
+
 export default {
   data() {
     return {
       search: {
-        size: 20,
+        size: 10,
         current: 1,
         total: 0
       },
@@ -235,11 +247,14 @@
   methods: {
     // 鍒濆鍖栬皟鐢�
     initData() {
-      this.$axios.get(this.$api.facilitiesAndEnvironment.getLaboratoryFacilityPowerStablePage + '?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;
-      });
+      getLaboratoryFacilityPowerStablePage({
+        ...this.search
+      }).then(res => {
+        if (res.code === 200){
+          this.tableData = res.data.records;
+          this.search.total = res.data.total;
+        }
+      })
     },
     handleSizeChange(val) {
       this.search.size = val;
@@ -256,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()
         })
@@ -269,7 +284,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
         }
@@ -279,9 +294,9 @@
     },
     // 鐢垫簮绋冲畾鎬�-鎵撳紑寮规璋冪敤璁惧鎺ュ彛锛屾煡璇娇鐢ㄧ殑璁惧
     openDialog() {
-      this.$axios.get(this.$api.deviceScope.treeDevice).then(res => {
+      treeDevice().then(res => {
         this.cascaderList = res.data;
-      });
+      })
       this.$nextTick(() => {
         this.$refs['form'].clearValidate()
       })
@@ -299,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('鍒犻櫎鎴愬姛锛�')
@@ -324,11 +339,7 @@
       this.submitLoading = true
       this.$refs.form.validate((valid) => {
         if (valid) {
-          this.$axios.post(this.$api.facilitiesAndEnvironment.addLaboratoryFacilityPowerStable, this.form, {
-            headers: {
-              'Content-Type': 'application/json'
-            }
-          }).then(res => {
+          addLaboratoryFacilityPowerStable(this.form).then(res => {
             this.submitLoading = false
             if (res.code === 200) {
               this.initData()
@@ -342,50 +353,33 @@
     },
     // 瀵煎嚭
     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() {
-      this.$axios.get(this.$api.deviceScope.selectUserList).then(res => {
+      selectUserCondition().then(res => {
         if (res.code == 200) {
-          this.responsibleOptions = res.data
+          let data = []
+          res.data.forEach(a => {
+            data.push({
+              id: a.id,
+              name: a.name
+            })
+          })
+          this.responsibleOptions = data
         }
       })
     },

--
Gitblit v1.9.3