From b4c2cbc7825fe4732fb6333447fdada9567bcb97 Mon Sep 17 00:00:00 2001
From: 吴羡 <16976746+Xian-TT3@user.noreply.gitee.com>
Date: 星期一, 12 十月 2026 17:48:36 +0800
Subject: [PATCH] 资源需求(标准物质相关)模块调整;新增统一附件组件并接入供应商管理与客户满意度;客户满意度表单改客户卡片下拉并关联已完成委托单;预览、图表、导航栏等组件调整

---
 src/views/CNAS/systemManagement/customerSatisfaction/components/formDialog.vue |  121 ++++++++++++++++++++++++++++++++++++++--
 1 files changed, 115 insertions(+), 6 deletions(-)

diff --git a/src/views/CNAS/systemManagement/customerSatisfaction/components/formDialog.vue b/src/views/CNAS/systemManagement/customerSatisfaction/components/formDialog.vue
index a0d404a..8ad497f 100644
--- a/src/views/CNAS/systemManagement/customerSatisfaction/components/formDialog.vue
+++ b/src/views/CNAS/systemManagement/customerSatisfaction/components/formDialog.vue
@@ -22,11 +22,19 @@
         </tr>
         <tr>
           <td class="td-title">
-            <p>濮撳悕锛�</p>
+            <p>瀹㈡埛锛�</p>
           </td>
           <td class="td-info">
-            <el-input v-model="form.userName" placeholder="璇疯緭鍏ュ唴瀹�" size="small">
-            </el-input>
+            <el-select v-model="form.orderId" filterable clearable size="small" style="width: 100%"
+              popper-class="customer-select-popper" placeholder="璇烽�夋嫨瀹㈡埛锛堝凡瀹屾垚濮旀墭鍗曪級" @change="onCustomerChange">
+              <el-option v-for="opt in customerOptions" :key="opt.id" :label="opt.company" :value="opt.id">
+                <div class="customer-card">
+                  <div>瀹㈡埛锛歿{ opt.company }}</div>
+                  <div class="customer-card-sub">濮旀墭鍗曠紪鍙凤細{{ opt.entrustCode || '--' }}</div>
+                  <div class="customer-card-sub">鏍峰搧鍚嶇О锛歿{ opt.sampleName || '--' }}</div>
+                </div>
+              </el-option>
+            </el-select>
           </td>
           <td class="td-title">
             <p>閮ㄩ棬锛�</p>
@@ -142,6 +150,7 @@
   addClientSatisfaction,
   updateClientSatisfaction
 } from '@/api/cnas/systemManagement/customerSatisfaction.js'
+import { selectCompletedOrders } from '@/api/business/productOrder'
 export default {
   name: 'formDialog',
   // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
@@ -157,6 +166,7 @@
         department: '',
         contactNumber: '',
         serviceAttitude: '',
+        serviceAttitudeSuggestion: '',
         technicalCompetence: '',
         technicalCompetenceSuggestion: '',
         inspectionWork: '',
@@ -165,7 +175,12 @@
         reasonableFeesSuggestion: '',
         remark: '',
         clientSatisfactionId: '',
+        orderId: '',
+        entrustCode: '',
+        sampleName: ''
       },
+      // 瀹㈡埛涓嬫媺閫夐」锛氬彧鍖呭惈"宸蹭笅杩囧鎵樺崟涓斿凡瀹屾垚"鐨勬暟鎹�
+      customerOptions: [],
       operationType: '',
       editLoad: false,
 
@@ -173,14 +188,89 @@
   },
   // 鏂规硶闆嗗悎
   methods: {
-    openDia(type, row) {
+    async openDia(type, row) {
       this.formDia = true;
       this.operationType = type
+      await this.loadCustomerOptions()
       if (this.operationType === 'edit') {
         this.form = { ...row }
+        // 鑰佹暟鎹病鏈夊叧鑱斿鎵樺崟锛氬悎鎴愪竴涓�夐」鎶婂師鏉ョ殑鍊煎洖鏄惧嚭鏉ワ紝涓嶅己鍒堕噸閫�
+        if (row.orderId == null && row.userName) {
+          this.customerOptions.unshift({
+            id: 0,
+            company: row.userName,
+            entrustCode: row.entrustCode || '--',
+            sampleName: row.sampleName || '--'
+          })
+          this.form.orderId = 0
+        } else if (row.orderId && !this.customerOptions.some(o => o.id === row.orderId)) {
+          // 鍏宠仈鐨勫鎵樺崟宸蹭笉鏄�"宸插畬鎴�"鐘舵�侊紝鐢ㄨ褰曢噷鐨勪俊鎭厹搴曞洖鏄�
+          this.customerOptions.unshift({
+            id: row.orderId,
+            company: row.userName || '鏈煡瀹㈡埛',
+            entrustCode: row.entrustCode || '--',
+            sampleName: row.sampleName || '--'
+          })
+        }
+      } else {
+        this.resetForm()
       }
     },
+    resetForm() {
+      this.form = {
+        unitName: '',
+        fillDate: '',
+        userName: '',
+        department: '',
+        contactNumber: '',
+        serviceAttitude: '',
+        serviceAttitudeSuggestion: '',
+        technicalCompetence: '',
+        technicalCompetenceSuggestion: '',
+        inspectionWork: '',
+        inspectionWorkSuggestion: '',
+        reasonableFees: '',
+        reasonableFeesSuggestion: '',
+        remark: '',
+        clientSatisfactionId: '',
+        orderId: '',
+        entrustCode: '',
+        sampleName: ''
+      }
+    },
+    // 涓嬫媺鏁版嵁锛氬悗绔彧杩斿洖"宸叉楠�"鐨勫鎵樺崟锛坰tate=4锛�
+    loadCustomerOptions() {
+      this.customerOptions = []
+      return selectCompletedOrders().then(res => {
+        if (res.code === 200 && res.data) {
+          this.customerOptions = res.data.map(o => ({
+            id: o.id,
+            company: o.company,
+            entrustCode: o.entrustCode,
+            sampleName: o.sampleView
+          }))
+        }
+      }).catch(err => {
+        console.log('err---', err)
+      })
+    },
+    // 閫変腑瀹㈡埛鍚庯細鍥炲~瀹㈡埛鍚嶅苟鑷姩甯﹀嚭鍗曚綅鍚嶇О銆佸鎵樺崟缂栧彿銆佹牱鍝佸悕绉�
+    onCustomerChange(val) {
+      const opt = this.customerOptions.find(o => o.id === val)
+      if (!opt || opt.id === 0) {
+        return
+      }
+      this.form.userName = opt.company
+      this.form.entrustCode = opt.entrustCode
+      this.form.sampleName = opt.sampleName
+      this.form.unitName = opt.company
+    },
     handleEdit() {
+      const orderIdEmpty = this.form.orderId === '' || this.form.orderId === null || this.form.orderId === undefined
+      if (orderIdEmpty) {
+        this.$message.warning('璇烽�夋嫨瀹㈡埛')
+        return
+      }
       if (!this.form.unitName) {
         this.$message.warning('璇峰~鍐欏崟浣嶅悕绉�')
         return
@@ -190,8 +280,13 @@
         return
       }
       this.editLoad = true
+      const payload = { ...this.form }
+      // 鑰佹暟鎹悎鎴愮殑鍥炴樉閫夐」锛坕d=0锛変笉绠楃湡瀹炲叧鑱旓紝淇濆瓨鏃朵粛淇濇寔鏈叧鑱�
+      if (payload.orderId === 0) {
+        payload.orderId = null
+      }
       if (this.operationType === 'add') {
-        addClientSatisfaction(this.form).then(res => {
+        addClientSatisfaction(payload).then(res => {
           this.editLoad = false
           this.$message.success('鎻愪氦鎴愬姛')
           this.closeFormDia()
@@ -200,7 +295,7 @@
           this.editLoad = false
         })
       } else {
-        updateClientSatisfaction(this.form).then(res => {
+        updateClientSatisfaction(payload).then(res => {
           this.editLoad = false
           this.$message.success('鎻愪氦鎴愬姛')
           this.closeFormDia()
@@ -251,4 +346,18 @@
   word-wrap: break-word;
   white-space: normal;
 }
+
+.customer-card-sub {
+  color: #909399;
+  font-size: 12px;
+}
+</style>
+
+<style>
+/* 涓嬫媺鍗$墖涓夎闇�瑕佽嚜閫傚簲楂樺害锛屽脊灞� teleport 鍒� body锛岀敤鑷畾涔� popper-class 鍛戒腑 */
+.customer-select-popper .el-select-dropdown__item {
+  height: auto;
+  line-height: 1.7;
+  padding: 6px 12px;
+}
 </style>

--
Gitblit v1.9.3