From b64d6db597d332c699f84e4928f6d3e5551851f1 Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期二, 04 三月 2025 16:43:16 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev

---
 src/views/CNAS/resourceDemand/device/component/inspectionOfEquipment.vue |   56 +++++++++++++-------------------------------------------
 1 files changed, 13 insertions(+), 43 deletions(-)

diff --git a/src/views/CNAS/resourceDemand/device/component/inspectionOfEquipment.vue b/src/views/CNAS/resourceDemand/device/component/inspectionOfEquipment.vue
index 78709ed..83af6ff 100644
--- a/src/views/CNAS/resourceDemand/device/component/inspectionOfEquipment.vue
+++ b/src/views/CNAS/resourceDemand/device/component/inspectionOfEquipment.vue
@@ -48,7 +48,11 @@
 
 <script>
 import InspectionForm from "./inspectionForm.vue";
-
+import {
+  getDeviceInspectionRecordByPage,
+  exportDeviceInspectionRecord,
+  deleteDeviceInspectionRecord,
+} from '@/api/cnas/resourceDemand/device.js'
 export default {
   name: "inspection-of-equipment",
   // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
@@ -81,19 +85,10 @@
     // 鏌ヨ
     getYearTableDetailData(deviceId) {
       this.yearTableDetailDataLoading = true
-      this.$axios.post(this.$api.deviceInspectionRecord.getDeviceInspectionRecordByPage, {
-        page: {
-          current: this.pagination1.current,
-          size: this.pagination1.size,
-        },
-        entity: {
-          deviceId: deviceId,
-        }
-      }, {
-        headers: {
-          'Content-Type': 'application/json'
-        },
-        noQs: true
+      getDeviceInspectionRecordByPage({
+        current: this.pagination1.current,
+        size: this.pagination1.size,
+        deviceId: deviceId,
       }).then(res => {
         if (res.code == 200) {
           this.yearTableDetailData = res.data.records
@@ -127,37 +122,12 @@
     // 瀵煎嚭
     handleDownOne(id) {
       this.outLoading = true
-      this.$axios.get(this.$api.deviceInspectionRecord.exportDeviceInspectionRecord + '?inspectionRecordId=' + id, {
-        responseType: "blob"
+      exportDeviceInspectionRecord({
+        inspectionRecordId: id
       }).then(res => {
         this.outLoading = false
         const blob = new Blob([res], { type: 'application/octet-stream' });
-        //灏咮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 = '璁惧鐐规璁板綍琛�.doc';
-              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 = '璁惧鐐规璁板綍琛�.doc';
-            link.click();
-            this.$message.success('瀵煎嚭鎴愬姛')
-          }
-        }
+        this.$download.saveAs(blob, '璁惧鐐规璁板綍琛�.doc')
       })
     },
     // 鍒犻櫎
@@ -167,7 +137,7 @@
         cancelButtonText: '鍙栨秷',
         type: 'warning'
       }).then(() => {
-        this.$axios.get(this.$api.deviceInspectionRecord.deleteDeviceInspectionRecord + '?inspectionRecordId=' + id).then(res => {
+        deleteDeviceInspectionRecord({ inspectionRecordId: id }).then(res => {
           this.$message.success('鍒犻櫎鎴愬姛锛�');
           this.getYearTableDetailData(this.clickNodeVal.value);
         });

--
Gitblit v1.9.3