From 00e6928c50d58ed93fef75454d4f2ef0110d89e9 Mon Sep 17 00:00:00 2001
From: 吴羡 <16976746+Xian-TT3@user.noreply.gitee.com>
Date: 星期五, 30 十月 2026 16:32:17 +0800
Subject: [PATCH] feat(cnas,business): 客户满意度模板化表单与年度汇总导出、费用统计增强、路由加载自愈

---
 src/views/CNAS/systemManagement/customerSatisfaction/index.vue |  112 +++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 91 insertions(+), 21 deletions(-)

diff --git a/src/views/CNAS/systemManagement/customerSatisfaction/index.vue b/src/views/CNAS/systemManagement/customerSatisfaction/index.vue
index f891e46..200c674 100644
--- a/src/views/CNAS/systemManagement/customerSatisfaction/index.vue
+++ b/src/views/CNAS/systemManagement/customerSatisfaction/index.vue
@@ -4,7 +4,7 @@
       <div class="search">
         <div>
           <el-form :model="searchForm" ref="searchForm" size="small" :inline="true">
-            <el-form-item label="鍗曚綅鍚嶇О" prop="unitName" v-if="tabIndex === '0'">
+            <el-form-item label="瀹㈡埛鍚嶇О" prop="unitName" v-if="tabIndex === '0'">
               <el-input v-model="searchForm.unitName" clearable size="small"></el-input>
             </el-form-item>
             <el-form-item label="鏂囦欢鍚嶇О" prop="fileName" v-if="tabIndex === '1'">
@@ -18,6 +18,7 @@
         </div>
         <div>
           <el-button v-if="tabIndex === '0'" size="small" type="primary" @click="openFormDia('add')">鏂� 澧�</el-button>
+          <el-button v-if="tabIndex === '0'" size="small" type="primary" @click="openExportDialog">瀵� 鍑�</el-button>
           <el-upload v-if="tabIndex === '1'" ref='upload' :action="action" :before-upload="beforeUpload"
                      :headers="uploadHeader" :on-error="onError" :on-success="handleSuccessUp" :show-file-list="false"
                      accept='.jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar'>
@@ -49,6 +50,18 @@
       <filePreview v-if="lookDialogVisible" :currentFile="{}" :fileUrl="javaApi + '/word/' + currentInfo.fileUrl"
         style="height: 90vh;overflow-y: auto;" />
     </el-dialog>
+    <el-dialog v-model="exportDialogVisible" title="瀵煎嚭骞村害姹囨��" width="360px" :close-on-click-modal="false">
+      <el-form label-width="80px">
+        <el-form-item label="姹囨�诲勾搴�">
+          <el-date-picker v-model="exportYear" type="year" format="YYYY骞�" value-format="YYYY" placeholder="閫夋嫨骞村害"
+            style="width: 100%"></el-date-picker>
+        </el-form-item>
+      </el-form>
+      <template #footer>
+        <el-button @click="exportDialogVisible = false">鍙� 娑�</el-button>
+        <el-button type="primary" :loading="exportLoading" @click="handleExport">瀵� 鍑�</el-button>
+      </template>
+    </el-dialog>
     <FormDialog v-if="formDialog" ref="formDialog" @closeFormDia="closeFormDia"></FormDialog>
     <lims-attachment ref="attachmentDialog" title="婊℃剰搴﹂檮浠�" name-field="unitName" id-param="clientSatisfactionId"
       upload-url="/clientSatisfaction/uploadAttachment" select-url="/clientSatisfaction/selectAttachments"
@@ -66,6 +79,7 @@
   pageAnalyseFile,
   delClientSatisfaction,
   delAnalyseFile,
+  exportAnnualSummary,
 } from '@/api/cnas/systemManagement/customerSatisfaction.js'
 
 export default {
@@ -84,48 +98,66 @@
       tabIndex: '0',
       tableColumn: [
         {
-          label: '鍗曚綅鍚嶇О',
+          label: '瀹㈡埛鍚嶇О',
           prop: 'unitName',
+          minWidth: '140'
+        },
+        {
+          label: '鍦板潃',
+          prop: 'address',
+          minWidth: '150'
+        },
+        {
+          label: '鑱旂郴浜�',
+          prop: 'contactPerson',
           minWidth: '100'
         },
         {
-          label: '鏃ユ湡',
+          label: '濉〃鏃ユ湡',
           prop: 'fillDate',
           minWidth: '100'
         },
         {
-          label: '瀹㈡埛',
-          prop: 'userName',
-          minWidth: '100'
+          label: '鎬诲垎',
+          prop: 'totalScore',
+          minWidth: '80',
+          formatData: (val) => (val === null || val === undefined || val === '') ? '--' : val
+        },
+        {
+          label: '婊℃剰搴﹁瘎瀹�',
+          prop: 'satisfactionResult',
+          minWidth: '110',
+          dataType: 'tag',
+          formatData: (val) => {
+            if (val === null || val === undefined || val === '') {
+              return '--'
+            }
+            return Number(val) === 0 ? '婊℃剰' : '涓嶆弧鎰�'
+          },
+          formatType: (val) => {
+            if (val === null || val === undefined || val === '') {
+              return 'info'
+            }
+            return Number(val) === 0 ? 'success' : 'danger'
+          }
         },
         {
           label: '濮旀墭鍗曠紪鍙�',
           prop: 'entrustCode',
-          minWidth: '100'
+          minWidth: '110'
         },
         {
           label: '鏍峰搧鍚嶇О',
           prop: 'sampleName',
-          minWidth: '100'
-        },
-        {
-          label: '閮ㄩ棬',
-          prop: 'department',
-          minWidth: '100'
-        },
-        {
-          label: '鑱旂郴鐢佃瘽',
-          prop: 'contactNumber',
-          minWidth: '100'
+          minWidth: '120'
         },
         {
           label: '鍒涘缓鏃ユ湡',
           prop: 'createTime',
-          minWidth: '100',
+          minWidth: '160',
         },
         {
           dataType: 'action',
-          minWidth: '80',
           label: '鎿嶄綔',
           operation: [
             {
@@ -178,7 +210,6 @@
         },
         {
           dataType: 'action',
-          minWidth: '50',
           label: '鎿嶄綔',
           operation: [
             {
@@ -217,6 +248,9 @@
       upLoading: false,
       currentInfo: {},
       lookDialogVisible: false,
+      exportDialogVisible: false,
+      exportYear: String(new Date().getFullYear()),
+      exportLoading: false,
     };
   },
   mounted() {
@@ -260,6 +294,42 @@
       this.formDialog = false
       this.searchList()
     },
+    // 鎵撳紑骞村害姹囨�诲鍑哄脊绐�
+    openExportDialog() {
+      this.exportYear = String(new Date().getFullYear())
+      this.exportDialogVisible = true
+    },
+    // 瀵煎嚭骞村害姹囨�� Word
+    handleExport() {
+      if (!this.exportYear) {
+        this.$message.warning('璇烽�夋嫨姹囨�诲勾搴�')
+        return
+      }
+      this.exportLoading = true
+      exportAnnualSummary({ year: this.exportYear }).then(async data => {
+        // 鍚庣鏃犳暟鎹椂杩斿洖鐨勬槸 JSON锛岄渶杞垚鏂囨湰鎻愮ず锛岄伩鍏嶅瓨鎴愬潖鏂囦欢
+        if (data && data.type && data.type.indexOf('json') !== -1) {
+          let msg = '瀵煎嚭澶辫触'
+          try {
+            const resText = await data.text()
+            const rspObj = JSON.parse(resText)
+            msg = rspObj.msg || msg
+          } catch (e) {
+            console.log('err---', e)
+          }
+          this.exportLoading = false
+          this.$message.error(msg)
+          return
+        }
+        const blob = new Blob([data], { type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' })
+        this.$download.saveAs(blob, '瀹㈡埛婊℃剰搴﹀勾搴︽眹鎬昏〃_' + this.exportYear + '骞�.docx')
+        this.exportLoading = false
+        this.exportDialogVisible = false
+      }).catch(err => {
+        console.log('err---', err)
+        this.exportLoading = false
+      })
+    },
     // 閲嶇疆鏌ヨ鏉′欢
     resetSearchForm() {
       this.searchForm.unitName = '';

--
Gitblit v1.9.3