From df888da7f2736a5fa383c3333b5605486eb51136 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 29 一月 2026 14:33:37 +0800
Subject: [PATCH] 进销存升级 1.用印管理查看时,申请编号显示不一致 2.知识库页面页码展示有误 3.新增的销售报价记录点击编辑后,产品规格型号信息不回显

---
 src/views/salesManagement/salesQuotation/index.vue       |   57 ++++++++---
 src/views/collaborativeApproval/knowledgeBase/index.vue  |  105 +++++++++++++++------
 src/views/collaborativeApproval/sealManagement/index.vue |  120 +++++++++++++++++++----
 3 files changed, 215 insertions(+), 67 deletions(-)

diff --git a/src/views/collaborativeApproval/knowledgeBase/index.vue b/src/views/collaborativeApproval/knowledgeBase/index.vue
index aeb1ba4..f7a1ef3 100644
--- a/src/views/collaborativeApproval/knowledgeBase/index.vue
+++ b/src/views/collaborativeApproval/knowledgeBase/index.vue
@@ -46,11 +46,13 @@
     </div>
 
     <!-- 鏂板/缂栬緫鐭ヨ瘑寮圭獥 -->
-    <el-dialog
+    <FormDialog
       v-model="dialogVisible"
       :title="dialogTitle"
-      width="800px"
-      :close-on-click-modal="false"
+      :width="'800px'"
+      @close="closeKnowledgeDialog"
+      @confirm="submitForm"
+      @cancel="closeKnowledgeDialog"
     >
       <el-form ref="formRef" :model="form" :rules="rules" label-width="120px">
         <el-row :gutter="20">
@@ -115,7 +117,14 @@
         <el-row :gutter="20">
           <el-col :span="12">
             <el-form-item label="鍒涘缓浜�" prop="creator">
-              <el-input v-model="form.creator" placeholder="璇疯緭鍏ュ垱寤轰汉" />
+              <el-select v-model="form.creator" placeholder="璇烽�夋嫨鍒涘缓浜�" style="width: 100%" filterable>
+                <el-option
+                  v-for="user in userList"
+                  :key="user.userId"
+                  :label="user.nickName"
+                  :value="user.nickName"
+                />
+              </el-select>
             </el-form-item>
           </el-col>
           <el-col :span="12">
@@ -125,20 +134,16 @@
           </el-col>
         </el-row>
       </el-form>
-      <template #footer>
-        <span class="dialog-footer">
-          <el-button @click="dialogVisible = false">鍙栨秷</el-button>
-          <el-button type="primary" @click="submitForm">纭畾</el-button>
-        </span>
-      </template>
-    </el-dialog>
+    </FormDialog>
 
     <!-- 鏌ョ湅鐭ヨ瘑璇︽儏寮圭獥 -->
-    <el-dialog
+    <FormDialog
       v-model="viewDialogVisible"
       title="鐭ヨ瘑璇︽儏"
-      width="900px"
-      :close-on-click-modal="false"
+      :width="'900px'"
+      @close="closeViewDialog"
+      @confirm="handleViewDialogConfirm"
+      @cancel="closeViewDialog"
     >
       <div class="knowledge-detail">
         <el-descriptions :column="2" border>
@@ -183,7 +188,7 @@
           <h4>鍏抽敭瑕佺偣</h4>
           <div class="key-points">
             <el-tag
-              v-for="(point, index) in currentKnowledge.keyPoints.split(',')"
+              v-for="(point, index) in currentKnowledge.keyPoints?.split(',') || []"
               :key="index"
               type="success"
               style="margin-right: 8px; margin-bottom: 8px;"
@@ -219,24 +224,19 @@
           </div>
         </div>
       </div>
-
-      <template #footer>
-        <span class="dialog-footer">
-          <el-button @click="viewDialogVisible = false">鍏抽棴</el-button>
-          <el-button type="primary" @click="copyKnowledge">澶嶅埗鐭ヨ瘑</el-button>
-          <!-- <el-button type="success" @click="markAsFavorite">鏀惰棌@</el-button> -->
-        </span>
-      </template>
-    </el-dialog>
+    </FormDialog>
   </div>
 </template>
 
 <script setup>
 import { Search } from "@element-plus/icons-vue";
-import { onMounted, ref, reactive, toRefs, getCurrentInstance, computed } from "vue";
+import { onMounted, ref, reactive, toRefs, getCurrentInstance, computed, watch } from "vue";
 import { ElMessage, ElMessageBox } from "element-plus";
 import PIMTable from "@/components/PIMTable/PIMTable.vue";
+import FormDialog from '@/components/Dialog/FormDialog.vue';
 import { listKnowledgeBase, delKnowledgeBase,addKnowledgeBase,updateKnowledgeBase } from "@/api/collaborativeApproval/knowledgeBase.js";
+import useUserStore from '@/store/modules/user';
+import { userListNoPageByTenantId } from '@/api/system/user.js';
 
 // 琛ㄥ崟楠岃瘉瑙勫垯
 const rules = {
@@ -302,6 +302,9 @@
 
 // 琛ㄥ崟寮曠敤
 const formRef = ref();
+// 鐢ㄦ埛鐩稿叧
+const userStore = useUserStore();
+const userList = ref([]);
 
 // 琛ㄦ牸鍒楅厤缃�
 const tableColumn = ref([
@@ -389,6 +392,15 @@
   }
 ]);
 
+// 鐩戝惉瀵硅瘽妗嗘墦寮�锛岃幏鍙栫敤鎴峰垪琛�
+watch(dialogVisible, (newVal) => {
+  if (newVal) {
+    userListNoPageByTenantId().then((res) => {
+      userList.value = res.data || [];
+    });
+  }
+});
+
 // 鐢熷懡鍛ㄦ湡
 onMounted(() => {
   getList();
@@ -414,7 +426,7 @@
   .then(res => {
     tableLoading.value = false;
     tableData.value = res.data.records
-    page.total = res.data.total;
+    page.value.total = res.data.total;
   }).catch(err => {
     tableLoading.value = false;
   })
@@ -437,7 +449,7 @@
   dialogType.value = type;
   if (type === "add") {
     dialogTitle.value = "鏂板鐭ヨ瘑";
-    // 閲嶇疆琛ㄥ崟
+    // 閲嶇疆琛ㄥ崟锛岄粯璁ゅ垱寤轰汉涓哄綋鍓嶇敤鎴�
     Object.assign(form.value, {
       title: "",
       type: "",
@@ -446,7 +458,7 @@
       problem: "",
       solution: "",
       keyPoints: "",
-      creator: "",
+      creator: userStore.nickName || "",
       usageCount: 0
     });
   } else if (type === "edit" && row) {
@@ -550,6 +562,39 @@
   });
 };
 
+// 鍏抽棴鐭ヨ瘑琛ㄥ崟瀵硅瘽妗�
+const closeKnowledgeDialog = () => {
+  // 娓呯┖琛ㄥ崟鏁版嵁锛岄粯璁ゅ垱寤轰汉涓哄綋鍓嶇敤鎴�
+  Object.assign(form.value, {
+    id: undefined,
+    title: "",
+    type: "",
+    scenario: "",
+    efficiency: "",
+    problem: "",
+    solution: "",
+    keyPoints: "",
+    creator: userStore.nickName || "",
+    usageCount: 0
+  });
+  // 娓呴櫎琛ㄥ崟楠岃瘉鐘舵��
+  if (formRef.value) {
+    formRef.value.clearValidate();
+  }
+  dialogVisible.value = false;
+};
+
+// 鍏抽棴鏌ョ湅璇︽儏瀵硅瘽妗�
+const closeViewDialog = () => {
+  viewDialogVisible.value = false;
+};
+
+// 澶勭悊鏌ョ湅璇︽儏瀵硅瘽妗嗙‘璁わ紙鎵ц澶嶅埗鎿嶄綔锛�
+const handleViewDialogConfirm = () => {
+  copyKnowledge();
+  closeViewDialog();
+};
+
 // 鎻愪氦鐭ヨ瘑琛ㄥ崟
 const submitForm = async () => {
   try {
@@ -559,7 +604,7 @@
       addKnowledgeBase({...form.value}).then(res => {
         if(res.code == 200){
           ElMessage.success("娣诲姞鎴愬姛");
-          dialogVisible.value = false;
+          closeKnowledgeDialog();
           getList();
         }
       }).catch(err => {
@@ -569,7 +614,7 @@
       updateKnowledgeBase({...form.value}).then(res => {
         if(res.code == 200){
           ElMessage.success("鏇存柊鎴愬姛");
-          dialogVisible.value = false;
+          closeKnowledgeDialog();
           getList();
         }
       }).catch(err => {
diff --git a/src/views/collaborativeApproval/sealManagement/index.vue b/src/views/collaborativeApproval/sealManagement/index.vue
index 04ecfc4..5193aa9 100644
--- a/src/views/collaborativeApproval/sealManagement/index.vue
+++ b/src/views/collaborativeApproval/sealManagement/index.vue
@@ -82,7 +82,14 @@
     </el-card>
 
     <!-- 鐢ㄥ嵃鐢宠瀵硅瘽妗� -->
-    <el-dialog v-model="showSealApplyDialog" title="鐢宠鐢ㄥ嵃" width="600px">
+    <FormDialog
+      v-model="showSealApplyDialog"
+      title="鐢宠鐢ㄥ嵃"
+      :width="'600px'"
+      @close="closeSealApplyDialog"
+      @confirm="submitSealApplication"
+      @cancel="closeSealApplyDialog"
+    >
       <el-form :model="sealForm" :rules="sealRules" ref="sealFormRef" label-width="100px">
         <el-form-item label="鐢宠缂栧彿" prop="applicationNum">
           <el-input v-model="sealForm.applicationNum" placeholder="璇疯緭鍏ョ敵璇风紪鍙�" />
@@ -119,13 +126,7 @@
           </el-radio-group>
         </el-form-item>
       </el-form>
-      <template #footer>
-        <span class="dialog-footer">
-          <el-button @click="showSealApplyDialog = false">鍙栨秷</el-button>
-          <el-button type="primary" @click="submitSealApplication">鎻愪氦鐢宠</el-button>
-        </span>
-      </template>
-    </el-dialog>
+    </FormDialog>
 
     <!-- 瑙勭珷鍒跺害鍙戝竷瀵硅瘽妗� -->
     <!-- <el-dialog v-model="showRegulationDialog" :title="operationType === 'add' ? '鍙戝竷鍒跺害' : '缂栬緫鍒跺害'" width="800px">
@@ -177,10 +178,17 @@
     </el-dialog> -->
 
     <!-- 鐢ㄥ嵃璇︽儏瀵硅瘽妗� -->
-    <el-dialog v-model="showSealDetailDialog" title="鐢ㄥ嵃鐢宠璇︽儏" width="700px">
+    <FormDialog
+      v-model="showSealDetailDialog"
+      title="鐢ㄥ嵃鐢宠璇︽儏"
+      :width="'700px'"
+      @close="closeSealDetailDialog"
+      @confirm="closeSealDetailDialog"
+      @cancel="closeSealDetailDialog"
+    >
       <div v-if="currentSealDetail" class="mb10">
         <el-descriptions :column="2" border>
-          <el-descriptions-item label="鐢宠缂栧彿">{{ currentSealDetail.id }}</el-descriptions-item>
+          <el-descriptions-item label="鐢宠缂栧彿">{{ currentSealDetail.applicationNum }}</el-descriptions-item>
           <el-descriptions-item label="鐢宠鏍囬">{{ currentSealDetail.title }}</el-descriptions-item>
           <el-descriptions-item label="鐢宠浜�">{{ currentSealDetail.createUserName }}</el-descriptions-item>
           <el-descriptions-item label="鎵�灞為儴闂�">{{ currentSealDetail.department }}</el-descriptions-item>
@@ -194,10 +202,17 @@
           <el-descriptions-item label="鐢宠鍘熷洜" :span="2">{{ currentSealDetail.reason }}</el-descriptions-item>
         </el-descriptions>
       </div>
-    </el-dialog>
+    </FormDialog>
 
     <!-- 瑙勭珷鍒跺害璇︽儏瀵硅瘽妗� -->
-    <el-dialog v-model="showRegulationDetailDialog" title="瑙勭珷鍒跺害璇︽儏" width="800px">
+    <FormDialog
+      v-model="showRegulationDetailDialog"
+      title="瑙勭珷鍒跺害璇︽儏"
+      :width="'800px'"
+      @close="closeRegulationDetailDialog"
+      @confirm="handleRegulationDetailConfirm"
+      @cancel="closeRegulationDetailDialog"
+    >
       <div v-if="currentRegulationDetail">
         <el-descriptions :column="2" border>
           <el-descriptions-item label="鍒跺害缂栧彿">{{ currentRegulationDetail.id }}</el-descriptions-item>
@@ -216,10 +231,17 @@
           <el-button type="success" @click="resetForm(currentRegulationDetail)">纭鏌ョ湅</el-button>
         </div>
       </div>
-    </el-dialog>
+    </FormDialog>
 
     <!-- 鐗堟湰鍘嗗彶瀵硅瘽妗� -->
-    <el-dialog v-model="showVersionHistoryDialog" title="鐗堟湰鍘嗗彶" width="800px">
+    <FormDialog
+      v-model="showVersionHistoryDialog"
+      title="鐗堟湰鍘嗗彶"
+      :width="'800px'"
+      @close="closeVersionHistoryDialog"
+      @confirm="closeVersionHistoryDialog"
+      @cancel="closeVersionHistoryDialog"
+    >
       <el-table :data="versionHistory" style="width: 100%;margin-bottom: 10px">
         <el-table-column prop="version" label="鐗堟湰鍙�" width="100" />
         <el-table-column prop="updateTime" label="鏇存柊鏃堕棿" width="180" />
@@ -232,10 +254,17 @@
           </template>
         </el-table-column>
       </el-table>
-    </el-dialog>
+    </FormDialog>
 
     <!-- 闃呰鐘舵�佸璇濇 -->
-    <el-dialog v-model="showReadStatusDialog" title="闃呰鐘舵��" width="800px">
+    <FormDialog
+      v-model="showReadStatusDialog"
+      title="闃呰鐘舵��"
+      :width="'800px'"
+      @close="closeReadStatusDialog"
+      @confirm="closeReadStatusDialog"
+      @cancel="closeReadStatusDialog"
+    >
       <el-table :data="readStatusList" style="width: 100%;margin-bottom: 10px">
         <el-table-column prop="employee" label="鍛樺伐濮撳悕" width="120" />
         <el-table-column prop="department" label="鎵�灞為儴闂�" width="150" />
@@ -249,7 +278,7 @@
           </template>
         </el-table-column>
       </el-table>
-    </el-dialog>
+    </FormDialog>
   </div>
 </template>
 
@@ -263,7 +292,8 @@
 import { getUserProfile, userListNoPageByTenantId } from '@/api/system/user.js'
 import useUserStore from '@/store/modules/user'
 import { userLoginFacotryList } from "@/api/system/user.js"
-import {staffOnJobListPage} from "@/api/personnelManagement/staffOnJob.js";
+import {staffOnJobListPage} from "@/api/personnelManagement/staffOnJob.js"
+import FormDialog from '@/components/Dialog/FormDialog.vue'
 
 // 鍝嶅簲寮忔暟鎹�
 const currentUser = ref(null)
@@ -434,7 +464,7 @@
     addSealApplication(sealForm).then(res => {
       if(res.code == 200){
         ElMessage.success('鐢宠鎻愪氦鎴愬姛')
-        showSealApplyDialog.value = false
+        closeSealApplyDialog()
         getSealApplicationList()
         Object.assign(sealForm, {
         applicationNum: '',
@@ -447,12 +477,53 @@
       })
       }
     }).catch(err => {
-      ElMessage.error(err.msg)
+      console.log(err.msg)
     })
   
   } catch (error) {
-    ElMessage.error('璇峰畬鍠勭敵璇蜂俊鎭�')
   }
+}
+// 鍏抽棴鐢ㄥ嵃鐢宠瀵硅瘽妗�
+const closeSealApplyDialog = () => {
+  // 娓呯┖琛ㄥ崟鏁版嵁
+  Object.assign(sealForm, {
+    applicationNum: '',
+    title: '',
+    sealType: '',
+    reason: '',
+    approveUserId: '',
+    urgency: 'normal',
+    status: 'pending'
+  })
+  // 娓呴櫎琛ㄥ崟楠岃瘉鐘舵��
+  if (sealFormRef.value) {
+    sealFormRef.value.clearValidate()
+  }
+  showSealApplyDialog.value = false
+}
+// 鍏抽棴鐢ㄥ嵃璇︽儏瀵硅瘽妗�
+const closeSealDetailDialog = () => {
+  showSealDetailDialog.value = false
+}
+// 鍏抽棴瑙勭珷鍒跺害璇︽儏瀵硅瘽妗�
+const closeRegulationDetailDialog = () => {
+  showRegulationDetailDialog.value = false
+}
+// 澶勭悊瑙勭珷鍒跺害璇︽儏纭
+const handleRegulationDetailConfirm = () => {
+  // 濡傛灉tableData>0锛屾墽琛岀‘璁ゆ煡鐪嬫搷浣�
+  if (currentRegulationDetail.value && tableData.value && tableData.value.length > 0) {
+    resetForm(currentRegulationDetail.value)
+  }
+  closeRegulationDetailDialog()
+}
+// 鍏抽棴鐗堟湰鍘嗗彶瀵硅瘽妗�
+const closeVersionHistoryDialog = () => {
+  showVersionHistoryDialog.value = false
+}
+// 鍏抽棴闃呰鐘舵�佸璇濇
+const closeReadStatusDialog = () => {
+  showReadStatusDialog.value = false
 }
 // 鏂板
 const handleAdd = () => {
@@ -735,6 +806,13 @@
   })
 }
 
+// 鍒嗛〉鍙樺寲澶勭悊
+const paginationChange = (obj) => {
+  page.current = obj.page;
+  page.size = obj.limit;
+  getSealApplicationList();
+};
+
 // 鐩戝惉瀵硅瘽妗嗘墦寮�锛岃幏鍙栫敤鎴峰垪琛�
 watch(showSealApplyDialog, (newVal) => {
   if (newVal) {
diff --git a/src/views/salesManagement/salesQuotation/index.vue b/src/views/salesManagement/salesQuotation/index.vue
index cbbc4f8..d6f6c80 100644
--- a/src/views/salesManagement/salesQuotation/index.vue
+++ b/src/views/salesManagement/salesQuotation/index.vue
@@ -51,7 +51,7 @@
         height="calc(100vh - 22em)"
       >
 				<el-table-column align="center" label="搴忓彿" type="index" width="60" />
-        <el-table-column prop="quotationNo" label="鎶ヤ环鍗曞彿" width="150" />
+        <el-table-column prop="quotationNo" label="鎶ヤ环鍗曞彿" />
         <el-table-column prop="customer" label="瀹㈡埛鍚嶇О" />
         <el-table-column prop="salesperson" label="涓氬姟鍛�" width="100" />
         <el-table-column prop="quotationDate" label="鎶ヤ环鏃ユ湡" width="120" />
@@ -252,7 +252,7 @@
 									@change="getProductModel($event, scope.row)"
 								>
 									<el-option
-										v-for="item in modelOptions"
+										v-for="item in scope.row.modelOptions || []"
 										:key="item.id"
 										:label="item.model"
 										:value="item.id"
@@ -322,7 +322,7 @@
         </el-descriptions-item>
       </el-descriptions>
       
-      <div style="margin-top: 20px;">
+      <div style="margin: 20px 0;">
         <h4>浜у搧鏄庣粏</h4>
         <el-table :data="currentQuotation.products" border style="width: 100%">
           <el-table-column prop="product" label="浜у搧鍚嶇О" />
@@ -521,7 +521,7 @@
 	if (!value) {
 		row.productId = '';
 		row.product = '';
-		modelOptions.value = [];
+		row.modelOptions = [];
 		row.specificationId = '';
 		row.specification = '';
 		row.unit = '';
@@ -534,9 +534,9 @@
 	if (label) {
 		row.product = label;
 	}
-	// 鑾峰彇瑙勬牸鍨嬪彿鍒楄〃
+	// 鑾峰彇瑙勬牸鍨嬪彿鍒楄〃锛岃缃埌褰撳墠琛岀殑 modelOptions
 	modelList({ id: value }).then((res) => {
-		modelOptions.value = res || [];
+		row.modelOptions = res || [];
 	});
 };
 const getProductModel = (value, row) => {
@@ -550,10 +550,11 @@
 	}
 	// 鏇存柊 specificationId锛坴-model 宸茬粡鑷姩鏇存柊锛岃繖閲岀‘淇濅竴鑷存�э級
 	row.specificationId = value;
-	const index = modelOptions.value.findIndex((item) => item.id === value);
+	const modelOptions = row.modelOptions || [];
+	const index = modelOptions.findIndex((item) => item.id === value);
 	if (index !== -1) {
-		row.specification = modelOptions.value[index].model;
-		row.unit = modelOptions.value[index].unit;
+		row.specification = modelOptions[index].model;
+		row.unit = modelOptions[index].unit;
 	} else {
 		row.specification = '';
 		row.unit = '';
@@ -616,23 +617,46 @@
   form.paymentMethod = row.paymentMethod || ''
   form.status = row.status || '鑽夌'
   form.remark = row.remark || ''
-  form.products = row.products ? row.products.map(product => {
+  form.products = row.products ? await Promise.all(row.products.map(async (product) => {
     const productName = product.product || product.productName || ''
     // 浼樺厛鐢� productId锛涘鏋滃彧鏈夊悕绉帮紝灏濊瘯鍙嶆煡 id 浠ヤ究鏍戦�夋嫨鍣ㄥ弽鏄�
-    const resolvedId = product.productId
+    const resolvedProductId = product.productId
       ? Number(product.productId)
       : findNodeIdByLabel(productOptions.value, productName) || ''
+    
+    // 濡傛灉鏈変骇鍝両D锛屽姞杞藉搴旂殑瑙勬牸鍨嬪彿鍒楄〃
+    let modelOptions = [];
+    let resolvedSpecificationId = product.specificationId || '';
+    
+    if (resolvedProductId) {
+      try {
+        const res = await modelList({ id: resolvedProductId });
+        modelOptions = res || [];
+        
+        // 濡傛灉杩斿洖鐨勬暟鎹病鏈� specificationId锛屼絾鏈� specification 鍚嶇О锛屾牴鎹悕绉版煡鎵� ID
+        if (!resolvedSpecificationId && product.specification) {
+          const foundModel = modelOptions.find(item => item.model === product.specification);
+          if (foundModel) {
+            resolvedSpecificationId = foundModel.id;
+          }
+        }
+      } catch (error) {
+        console.error('鍔犺浇瑙勬牸鍨嬪彿澶辫触:', error);
+      }
+    }
+    
     return {
-      productId: resolvedId,
+      productId: resolvedProductId,
       product: productName,
-      specificationId: product.specificationId || '',
+      specificationId: resolvedSpecificationId,
       specification: product.specification || '',
       quantity: product.quantity || 0,
       unit: product.unit || '',
       unitPrice: product.unitPrice || 0,
-      amount: product.amount || 0
+      amount: product.amount || 0,
+      modelOptions: modelOptions // 涓烘瘡琛屾坊鍔犵嫭绔嬬殑瑙勬牸鍨嬪彿鍒楄〃
     }
-  }) : []
+  })) : []
   form.subtotal = row.subtotal || 0
   form.freight = row.freight || 0
   form.otherFee = row.otherFee || 0
@@ -714,7 +738,8 @@
     quantity: 1,
     unit: '',
     unitPrice: 0,
-    amount: 0
+    amount: 0,
+    modelOptions: [] // 涓烘瘡琛屾坊鍔犵嫭绔嬬殑瑙勬牸鍨嬪彿鍒楄〃
   })
 }
 

--
Gitblit v1.9.3