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/equipmentScrap.vue |   89 +++++++++++++++-----------------------------
 1 files changed, 31 insertions(+), 58 deletions(-)

diff --git a/src/views/CNAS/resourceDemand/device/component/equipmentScrap.vue b/src/views/CNAS/resourceDemand/device/component/equipmentScrap.vue
index 4a85d99..ec8b334 100644
--- a/src/views/CNAS/resourceDemand/device/component/equipmentScrap.vue
+++ b/src/views/CNAS/resourceDemand/device/component/equipmentScrap.vue
@@ -7,41 +7,49 @@
       </div>
       <div>
         <el-table ref="yearTable" v-loading="yearTableDetailDataLoading" :data="yearTableDetailData"
-                  height="calc(100vh - 18em)"
-                  style="width: 100% ;">
+                  :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border
+          height="calc(100vh - 18em)" style="width: 100% ;">
           <!-- 琛ㄦ牸鍒� -->
-          <el-table-column align="center" header-align="center" label="搴忓彿" prop="prop" type="index" width="70"></el-table-column>
-<!--          <el-table-column label="浠櫒鍚嶇О" min-width="150" prop="unitName"></el-table-column>-->
-<!--          <el-table-column label="鍨嬪彿" min-width="100" prop="address"></el-table-column>-->
+          <el-table-column align="center" header-align="center" label="搴忓彿" prop="prop" type="index"
+            width="70"></el-table-column>
+          <!--          <el-table-column label="浠櫒鍚嶇О" min-width="150" prop="unitName"></el-table-column>-->
+          <!--          <el-table-column label="鍨嬪彿" min-width="100" prop="address"></el-table-column>-->
           <el-table-column label="閰嶄欢" min-width="150" prop="parts"></el-table-column>
           <el-table-column label="缂栧彿" min-width="100" prop="number"></el-table-column>
           <el-table-column label="鎶ュ簾鐞嗙敱" min-width="150" prop="reasonsForScrap"></el-table-column>
           <!-- 鎿嶄綔鎸夐挳 -->
           <el-table-column align="center" fixed="right" label="鎿嶄綔" min-width="120">
             <template slot-scope="scope">
-              <el-button :disabled="scope.row.ratifyStatus === 1" size="small" type="text" @click="handleForm(scope.row.scrappedId)">鎿嶄綔</el-button>
+              <el-button :disabled="scope.row.ratifyStatus === 1" size="small" type="text"
+                @click="handleForm(scope.row.scrappedId)">鎿嶄綔</el-button>
               <el-button size="small" type="text" @click="handleDownOne(scope.row.scrappedId)">瀵煎嚭</el-button>
-              <el-button size="small" style="color: #f56c6c" type="text" @click="deleteFun(scope.row.scrappedId)">鍒犻櫎</el-button>
+              <el-button size="small" style="color: #f56c6c" type="text"
+                @click="deleteFun(scope.row.scrappedId)">鍒犻櫎</el-button>
             </template>
           </el-table-column>
         </el-table>
         <el-pagination :current-page="1" :page-size="pagination1.size" :page-sizes="[10, 20, 30, 50, 100]"
-                       :total="pagination1.total" layout="->,total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange1"
-                       @current-change="handleCurrentChange1">
+          :total="pagination1.total" layout="->,total, sizes, prev, pager, next, jumper"
+          @size-change="handleSizeChange1" @current-change="handleCurrentChange1" background>
         </el-pagination>
       </div>
     </div>
-    <scrap-application-form v-if="applicationForm" ref="applicationForm" @closeDialog="closeDialog"></scrap-application-form>
+    <scrap-application-form v-if="applicationForm" ref="applicationForm"
+      @closeDialog="closeDialog"></scrap-application-form>
   </div>
 </template>
 
 <script>
 import scrapApplicationForm from "./scrapApplicationForm.vue";
-
+import {
+  pageDeviceScrapped,
+  exportDeviceScrapped,
+  delDeviceScrapped,
+} from '@/api/cnas/resourceDemand/device.js'
 export default {
   name: "equipment-scrap",
   // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
-  components: {scrapApplicationForm},
+  components: { scrapApplicationForm },
   props: {
     clickNodeVal: {
       type: Object,
@@ -68,21 +76,12 @@
   // 鏂规硶闆嗗悎
   methods: {
     // 鏌ヨ
-    getYearTableDetailData (deviceId) {
+    getYearTableDetailData(deviceId) {
       this.yearTableDetailDataLoading = true
-      this.$axios.post(this.$api.deviceScrapped.pageDeviceScrapped,{
-        page: {
-          current: this.pagination1.current,
-          size: this.pagination1.size,
-        },
-        entity: {
-          deviceId: deviceId,
-        }
-      }, {
-        headers: {
-          'Content-Type': 'application/json'
-        },
-        noQs: true
+      pageDeviceScrapped({
+        current: this.pagination1.current,
+        size: this.pagination1.size,
+        deviceId: deviceId,
       }).then(res => {
         if (res.code == 200) {
           this.yearTableDetailData = res.data.records
@@ -93,13 +92,13 @@
         this.yearTableDetailDataLoading = false
       })
     },
-    handleForm (id) {
+    handleForm(id) {
       this.applicationForm = true
       this.$nextTick(() => {
         this.$refs.applicationForm.openDialog(id, this.clickNodeVal.value)
       })
     },
-    closeDialog () {
+    closeDialog() {
       this.applicationForm = false
       this.getYearTableDetailData(this.clickNodeVal.value)
     },
@@ -116,37 +115,10 @@
     // 瀵煎嚭
     handleDownOne(id) {
       this.outLoading = true
-      this.$axios.get(this.$api.deviceScrapped.exportDeviceScrapped + '?scrappedId=' + id, {
-        responseType: "blob"
-      }).then(res => {
+      exportDeviceScrapped({ scrappedId: 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')
       })
     },
     // 鍒犻櫎
@@ -156,7 +128,7 @@
         cancelButtonText: '鍙栨秷',
         type: 'warning'
       }).then(() => {
-        this.$axios.get(this.$api.deviceScrapped.delDeviceScrapped + '?scrappedId=' + id).then(res => {
+        delDeviceScrapped({ scrappedId: id }).then(res => {
           this.$message.success('鍒犻櫎鎴愬姛锛�');
           this.getYearTableDetailData(this.clickNodeVal.value);
         });
@@ -185,6 +157,7 @@
   justify-content: space-between;
   align-items: center;
 }
+
 .title-search {
   display: flex;
   align-items: center;

--
Gitblit v1.9.3