From c7aebff7f6184b2d8da2669d2db5656e2bc09ec4 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 21 四月 2026 15:49:45 +0800
Subject: [PATCH] 湟水峡 1.反馈登记删减字段 2.售后服务字段匹配错误问题

---
 src/views/customerService/feedbackRegistration/components/formDia.vue |  176 ++++++++++++++++++++++++++++------------------------------
 1 files changed, 84 insertions(+), 92 deletions(-)

diff --git a/src/views/customerService/feedbackRegistration/components/formDia.vue b/src/views/customerService/feedbackRegistration/components/formDia.vue
index 2af71da..57e6c36 100644
--- a/src/views/customerService/feedbackRegistration/components/formDia.vue
+++ b/src/views/customerService/feedbackRegistration/components/formDia.vue
@@ -32,56 +32,26 @@
                 </el-select>
               </el-form-item>
             </el-col>
+						<el-col :span="4">
+							<el-form-item label="鍏宠仈閿�鍞崟鍙凤細" prop="salesContractNo">
+								<el-select
+									v-model="form.salesContractNo"
+				          @change="associatedSalesOrderNumberChange"
+				          filterable
+								>
+									<el-option
+										v-for="item in associatedSalesOrderNumberOptions"
+					          :key="item.value"
+					          :label="item.label"
+					          :value="item.value"
+									/>
+								</el-select>
+							</el-form-item>
+						</el-col>
             <el-col :span="4">
-              <el-form-item label="鍞悗绫诲瀷锛�" prop="serviceType">
-                <el-select
-                    v-model="form.serviceType"
-                    filterable
-                >
-                  <el-option
-                      v-for="dict in serviceTypeOptions"
-                      :key="dict.value"
-                      :label="dict.label"
-                      :value="dict.value"
-                  />
-                </el-select>
-              </el-form-item>
-            </el-col>
-            <el-col :span="4">
-              <el-form-item label="鍏宠仈閿�鍞崟鍙凤細" prop="salesContractNo">
-                <el-select
-                    v-model="form.salesContractNo"
-                    @change="associatedSalesOrderNumberChange"
-                    filterable
-                >
-                  <el-option
-                      v-for="item in associatedSalesOrderNumberOptions"
-                      :key="item.value"
-                      :label="item.label"
-                      :value="item.value"
-                  />
-                </el-select>
-              </el-form-item>
-            </el-col>
-            <el-col :span="4">
-              <el-form-item label="绱ф�ョ▼搴︼細" prop="urgency">
-                <el-select
-                    v-model="form.urgency"
-                    filterable
-                >
-                  <el-option
-                      v-for="dict in urgencyOptions"
-                      :key="dict.value"
-                      :label="dict.label"
-                      :value="dict.value"
-                  />
-                </el-select>
-              </el-form-item>
-            </el-col>
-            <el-col :span="4">
-              <el-form-item label="闂鎻忚堪锛�" prop="disRes">
+              <el-form-item label="闂鎻忚堪锛�" prop="proDesc">
                 <el-input
-                    v-model="form.disRes"
+                    v-model="form.proDesc"
                     placeholder="璇疯緭鍏ラ棶棰樻弿杩�"
                 />
               </el-form-item>
@@ -106,6 +76,11 @@
                 :column="tableColumn"
                 :tableData="tableData"
             >
+              <template #approveStatus="{ row }">
+                <el-tag :type="getApproveStatusType(row)" size="small">
+                  {{ getApproveStatusText(row) }}
+                </el-tag>
+              </template>
               <template #shippingStatus="{ row }">
                 <el-tag :type="getShippingStatusType(row)" size="small">
                   {{ getShippingStatusText(row) }}
@@ -149,19 +124,11 @@
 const data = reactive({
 	form: {
     topic: "",
-    serviceType: "",
-    urgency: "",
-    salesLedgerId: null,
-    productModelIds: "",
-    customerId: null,
-    salesContractNo: "",
-    disRes: "",
+    proDesc: "",
     customerName: ""
 	},
 	rules: {
     customerName: [{required: true, message: "璇烽�夋嫨瀹㈡埛鍚嶇О", trigger: "change"}],
-    serviceType: [{required: true, message: "璇烽�夋嫨鍞悗绫诲瀷", trigger: "change"}],
-    urgency: [{required: true, message: "璇烽�夋嫨绱ф�ョ▼搴�", trigger: "change"}],
 		feedbackDate: [{required: true, message: "璇烽�夋嫨", trigger: "change"}],
 	}
 })
@@ -177,13 +144,30 @@
   return Number.isFinite(num) ? num.toFixed(2) : '-'
 }
 
-const { post_sale_waiting_list, degree_of_urgency } = proxy.useDict(
-  "post_sale_waiting_list",
-  "degree_of_urgency"
-);
+const getProductRowId = (row) => {
+  return row?.id ?? row?.productModelId ?? row?.modelId ?? `${row?.productCategory || row?.productName || ""}-${row?.specificationModel || row?.model || ""}-${row?.unit || ""}`
+}
 
-const serviceTypeOptions = computed(() => post_sale_waiting_list?.value || []);
-const urgencyOptions = computed(() => degree_of_urgency?.value || []);
+const normalizeProductRow = (row) => {
+  return {
+    ...row,
+    id: getProductRowId(row),
+    productCategory: row?.productCategory ?? row?.productName ?? '',
+    specificationModel: row?.specificationModel ?? row?.model ?? '',
+    unit: row?.unit ?? '',
+    approveStatus: row?.approveStatus ?? null,
+    shippingStatus: row?.shippingStatus ?? '',
+    expressCompany: row?.expressCompany ?? '',
+    expressNumber: row?.expressNumber ?? '',
+    shippingCarNumber: row?.shippingCarNumber ?? '',
+    shippingDate: row?.shippingDate ?? '',
+    quantity: row?.quantity ?? 0,
+    taxRate: row?.taxRate ?? 0,
+    taxInclusiveUnitPrice: row?.taxInclusiveUnitPrice ?? 0,
+    taxInclusiveTotalPrice: row?.taxInclusiveTotalPrice ?? 0,
+    taxExclusiveTotalPrice: row?.taxExclusiveTotalPrice ?? 0,
+  }
+}
 
 const tableColumn = ref([
   { label: "浜у搧澶х被", prop: "productCategory" },
@@ -194,9 +178,8 @@
     prop: "approveStatus",
     width: 100,
     align: "center",
-    dataType: "tag",
-    formatData: (v) => (v === 1 ? "鍏呰冻" : "涓嶈冻"),
-    formatType: (v) => (v === 1 ? "success" : "danger"),
+    dataType: "slot",
+    slot: "approveStatus",
   },
   {
     label: "鍙戣揣鐘舵��",
@@ -239,7 +222,7 @@
         name: "鍒犻櫎",
         type: "text",
         clickFun: (row) => {
-          tableData.value = tableData.value.filter(i => i.id !== row.id)
+          tableData.value = tableData.value.filter(i => getProductRowId(i) !== getProductRowId(row))
         },
 
       },
@@ -251,37 +234,21 @@
 const isShowProductSelectDialog = ref(false)
 const handleSelectProducts = (rows) => {
   if (!Array.isArray(rows)) return
-  const existingIds = new Set(tableData.value.map(i => i.id))
+  const existingIds = new Set(tableData.value.map(i => String(getProductRowId(i))))
   const mapped = rows
-    .filter(r => !existingIds.has(r.id))
-    .map(r => ({
-      id: r.id,
-      productCategory: r.productName,
-      specificationModel: r.model,
-      unit: r.unit || '',
-      approveStatus: null,
-      shippingStatus: '',
-      expressCompany: '',
-      expressNumber: '',
-      shippingCarNumber: '',
-      shippingDate: '',
-      quantity: 0,
-      taxRate: 0,
-      taxInclusiveUnitPrice: 0,
-      taxInclusiveTotalPrice: 0,
-      taxExclusiveTotalPrice: 0,
-    }))
+    .map(normalizeProductRow)
+    .filter(r => !existingIds.has(String(getProductRowId(r))))
   tableData.value = tableData.value.concat(mapped)
 }
 const currentSelectedProductIds = computed(() => {
-  return tableData.value.map(item => item.id)
+  return tableData.value.map(item => getProductRowId(item)).filter(item => item !== undefined && item !== null && item !== '')
 })
 
 const associatedSalesOrderNumberChange = () => {
   const opt = associatedSalesOrderNumberOptions.value.find(
     (item) => item.value === form.value.salesContractNo
   )
-  tableData.value = opt?.productData || []
+  tableData.value = (opt?.productData || []).map(normalizeProductRow)
   form.value.salesLedgerId = opt?.id || null
 }
 
@@ -291,13 +258,19 @@
   const opt = associatedSalesOrderNumberOptions.value.find(
     (item) => item.value === form.value.salesContractNo
   )
-  return opt?.productData || []
+  return (opt?.productData || []).map(normalizeProductRow)
 })
 
 const customerNameChange = (val) => {
+  form.value.salesContractNo = "";
+  form.value.salesLedgerId = null;
+  tableData.value = [];
+  associatedSalesOrderNumberOptions.value = [];
   const opt = customerNameOptions.value.find(item => item.value === val);
   if (opt) {
     form.value.customerId = opt.id;
+  } else {
+    form.value.customerId = null;
   }
   getSalesLedger({
     customerName: form.value.customerName
@@ -311,6 +284,22 @@
       }))
     }
   })
+}
+
+const getApproveStatusText = (row) => {
+  if (!row) return '涓嶈冻'
+  if (row.approveStatus === 1 && (!row.shippingDate || !row.shippingCarNumber)) {
+    return '鍏呰冻'
+  }
+  if (row.approveStatus === 0 && (row.shippingDate || row.shippingCarNumber)) {
+    return '宸插嚭搴�'
+  }
+  return '涓嶈冻'
+}
+
+const getApproveStatusType = (row) => {
+  const statusText = getApproveStatusText(row)
+  return statusText === '涓嶈冻' ? 'danger' : 'success'
 }
 
 const getShippingStatusText = (row) => {
@@ -356,9 +345,12 @@
 // 鎵撳紑寮规
 const openDialog =async (type, row) => {
   // 璇锋眰澶氫釜鎺ュ彛锛岃幏鍙栨暟鎹�
-  let res = await getAllCustomerList();
-  if(res.records){
-    customerNameOptions.value = res.records.map(item => ({
+  let res = await getAllCustomerList({
+    current: -1,
+  size: -1,
+  });
+  if(res.data.records){
+    customerNameOptions.value = res.data.records.map(item => ({
       label: item.customerName,
       value: item.customerName,
       id: item.id

--
Gitblit v1.9.3