From 137bf2c0666b60cfc0d98b1a9ca7ead860ee4e7c Mon Sep 17 00:00:00 2001
From: 吴羡 <16976746+Xian-TT3@user.noreply.gitee.com>
Date: 星期三, 28 十月 2026 17:57:29 +0800
Subject: [PATCH] feat(device,supply,satisfaction): 设备计划改造、耗材采购调整与满意度照片上传

---
 src/views/CNAS/resourceDemand/device/component/equipmentVerificationPlan.vue |   66 +++++++++++++++++----------------
 1 files changed, 34 insertions(+), 32 deletions(-)

diff --git a/src/views/CNAS/resourceDemand/device/component/equipmentVerificationPlan.vue b/src/views/CNAS/resourceDemand/device/component/equipmentVerificationPlan.vue
index 975d0d1..119dd16 100644
--- a/src/views/CNAS/resourceDemand/device/component/equipmentVerificationPlan.vue
+++ b/src/views/CNAS/resourceDemand/device/component/equipmentVerificationPlan.vue
@@ -52,8 +52,11 @@
         <el-table-column label="璁惧缂栧彿" min-width="170" prop="deviceNumber"></el-table-column>
         <el-table-column label="璁惧鍚嶇О" min-width="180" prop="deviceName" show-overflow-tooltip></el-table-column>
         <el-table-column label="璁惧鍨嬪彿" min-width="120" prop="deviceModel" show-overflow-tooltip></el-table-column>
-        <el-table-column label="鏍告煡鏃堕棿" min-width="120" prop="checkTime"
-          :formatter="formatCheckMonth"></el-table-column>
+        <el-table-column label="鏍告煡鏃堕棿" min-width="120">
+          <template #default="scope">
+            {{ scope.row.completeDate || formatCheckMonth(null, null, scope.row.checkTime) }}
+          </template>
+        </el-table-column>
         <el-table-column label="鏍告煡鎸囨爣" min-width="140" prop="checkIndex"> </el-table-column>
         <el-table-column label="鏍告煡鏂规硶" min-width="140" prop="checkMethod" show-overflow-tooltip></el-table-column>
         <el-table-column label="缁撴灉濡備綍鍒ゅ畾" min-width="140" prop="howResults" show-overflow-tooltip></el-table-column>
@@ -90,7 +93,7 @@
               @click="handleRecord(scope.row)">瀹℃牳</el-button>
             <el-button v-if="scope.row.recordStatus === 2 || scope.row.recordStatus === 3"
               size="small" link type="primary" @click="handleDown(scope.row)">瀵煎嚭</el-button>
-            <el-button v-if="scope.row.recordStatus === 0 || scope.row.recordStatus === 1"
+            <el-button v-if="scope.row.recordStatus !== 2"
               size="small" link type="danger" @click="deleteFun1(scope.row.planDetailsId)">鍒犻櫎</el-button>
           </template>
         </el-table-column>
@@ -239,7 +242,7 @@
             <span class="export-panel-label">璁惧鍚嶇О</span>{{ downRow.deviceName || '鈥�' }}
           </div>
           <div class="export-panel-item">
-            <span class="export-panel-label">鏍告煡鏃堕棿</span>{{ formatCheckMonth(null, null, downRow.checkTime) || '鈥�' }}
+            <span class="export-panel-label">鏍告煡鏃堕棿</span>{{ downRow.completeDate || formatCheckMonth(null, null, downRow.checkTime) || '鈥�' }}
           </div>
         </div>
         <div v-if="!canExport" class="export-panel-tip">
@@ -264,8 +267,8 @@
 import CheckRecord from "./checkRecord.vue";
 import LimsAttachment from '@/components/Attachment/lims-attachment.vue'
 import {
-  pageDeviceExaminePlan,
   getExaminePlanByYear,
+  getExaminePlanYears,
   exportDeviceExaminePlanDetail,
   delDeviceExaminePlanDetail,
   pageDeviceExaminePlanDetail,
@@ -345,30 +348,24 @@
   },
   // 鏂规硶闆嗗悎
   methods: {
-    // 骞翠唤涓嬫媺鍙繚鐣欐湁璁″垝鏄庣粏鐨勫勾浠斤紝绌哄勾浠借嚜鍔ㄦ秷澶�
+    // 骞翠唤涓嬫媺鍙繚鐣欐湁璁″垝鏄庣粏鐨勫勾浠斤紝绌哄勾浠借鍒掕嚜鍔ㄥ垹闄わ紝榛樿鏄剧ず鏈勾搴︼紙鏈勾搴︽棤璁″垝鏃堕��鍥炴渶鏂板勾浠斤級
     loadYearOptions() {
-      pageDeviceExaminePlan({
-        current: 1,
-        size: 99,
-      }).then(res => {
-        let years = []
-        if (res.code == 200) {
-          years = (res.data.records || []).map(r => r.planYear).filter(Boolean)
-        }
-        const options = [...new Set(years)].sort((a, b) => b.localeCompare(a))
-        this.yearOptions = options
+      const currentYear = String(new Date().getFullYear())
+      const finish = (years) => {
+        let options = [...new Set((years || []).map(y => String(y)).filter(Boolean))]
+        options.sort((a, b) => b.localeCompare(a))
         if (options.length === 0) {
-          this.planYear = ''
-          this.planInfo = {}
-          this.yearTableDetailData = []
-          this.pagination1.total = 0
-          return
+          options = [currentYear]
         }
-        if (options.indexOf(this.planYear) === -1) {
-          const currentYear = String(new Date().getFullYear())
-          this.planYear = options.indexOf(currentYear) > -1 ? currentYear : options[0]
-        }
+        this.yearOptions = options
+        const keep = options.indexOf(String(this.planYear)) > -1
+        this.planYear = keep ? String(this.planYear) : (options.includes(currentYear) ? currentYear : options[0])
         this.loadPlan()
+      }
+      getExaminePlanYears().then(res => {
+        finish(res.code == 200 ? (res.data || []) : [])
+      }).catch(() => {
+        finish([])
       })
     },
     // 鍒囨崲骞翠唤
@@ -504,7 +501,7 @@
     },
     // 鏄庣粏-鍒犻櫎
     deleteFun1(id) {
-      this.$confirm('鍒犻櫎鍚庯紝璇ヨ鏈鏍哥殑鏍告煡璁板綍鍙婇檮浠朵細涓�骞跺垹闄わ紱鑻ヨ璁惧杩樻湁瀹℃牳閫氳繃鐨勬牳鏌ヨ褰曪紝妗f鐨勬渶杩戞牳鏌ユ棩鏈熷皢鍥為��鍒版渶杩戜竴娆″畬鎴愯褰曪紱鑻ユ病鏈夛紝鍒欐竻绌烘。妗堢殑鏍告煡鏃ユ湡鍜屾牳鏌ュ懆鏈熴�傛槸鍚︾户缁�?', '鎻愮ず', {
+      this.$confirm('鍒犻櫎鍚庯紝璇ヨ鐨勬牳鏌ヨ褰曪紙鏈鏍告垨瀹℃牳涓嶉�氳繃锛夊強闄勪欢浼氫竴骞跺垹闄わ紱鑻ヨ璁惧杩樻湁瀹℃牳閫氳繃鐨勬牳鏌ヨ褰曪紝妗f鐨勬渶杩戞牳鏌ユ棩鏈熷皢鍥為��鍒版渶杩戜竴娆″畬鎴愯褰曪紱鑻ユ病鏈夛紝鍒欐竻绌烘。妗堢殑鏍告煡鏃ユ湡鍜屾牳鏌ュ懆鏈熴�傛槸鍚︾户缁�?', '鎻愮ず', {
         confirmButtonText: '纭畾',
         cancelButtonText: '鍙栨秷',
         type: 'warning'
@@ -520,10 +517,15 @@
         });
       });
     },
-    // 瀵煎嚭骞村害璁″垝琛�
+    // 瀵煎嚭骞村害璁″垝琛紙Excel锛夛細鏈夌瓫閫夋潯浠跺鍑虹瓫閫夌粨鏋滐紝娌℃湁绛涢�夊鍑鸿骞翠唤鍏ㄩ儴
     downLoadPost() {
-      exportDeviceExaminePlanDetail({ planId: this.planInfo.planId }).then(res => {
-        this.saveDocx(res, '浠櫒璁惧鏈熼棿鏍告煡璁″垝琛�.docx')
+      exportDeviceExaminePlanDetail({
+        planId: this.planInfo.planId,
+        deviceName: this.searchForm.deviceName,
+        deviceNumber: this.searchForm.deviceNumber,
+      }).then(res => {
+        const planName = this.planInfo.planName || (this.planYear ? this.planYear + '骞村害璁惧鏍告煡璁″垝' : '璁惧鏍告煡璁″垝')
+        this.saveDocx(res, planName + '.xlsx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
       }).catch(() => { })
     },
     // 鏈鏄惁鏈夋敼鍔紙鍚墦寮�鏃舵仮澶嶇殑鑽夌锛�
@@ -586,7 +588,7 @@
       this.downloadDialog = true
     },
     // 瀵煎嚭缁撴灉鎷︽埅: 鍚庣杩斿洖閿欒 JSON 鏃舵彁绀洪敊璇�, 涓嶅瓨鎴愬潖鏂囦欢
-    saveDocx(res, filename) {
+    saveDocx(res, filename, mime = 'application/msword') {
       const reader = new FileReader();
       reader.readAsText(res, 'utf-8');
       reader.onload = () => {
@@ -596,11 +598,11 @@
           try { msg = JSON.parse(text).msg || msg; } catch (e) { }
           this.$message.error(msg);
         } else {
-          this.$download.saveAs(new Blob([res], { type: 'application/msword' }), filename);
+          this.$download.saveAs(new Blob([res], { type: mime }), filename);
         }
       };
       reader.onerror = () => {
-        this.$download.saveAs(new Blob([res], { type: 'application/msword' }), filename);
+        this.$download.saveAs(new Blob([res], { type: mime }), filename);
       };
     },
     // 鏍告煡璁板綍瀵煎嚭

--
Gitblit v1.9.3