From 3b62191f20a09535fece6141495e9e27db5edc91 Mon Sep 17 00:00:00 2001
From: buhuazhen <hua100783@gmail.com>
Date: 星期五, 15 五月 2026 17:23:28 +0800
Subject: [PATCH] feat: 更新销售报价和销售账本中的产品型号字段
---
src/views/salesManagement/salesQuotation/index.vue | 97 ++++++++++++++++++++++++------------------------
1 files changed, 48 insertions(+), 49 deletions(-)
diff --git a/src/views/salesManagement/salesQuotation/index.vue b/src/views/salesManagement/salesQuotation/index.vue
index 2237b72..441f633 100644
--- a/src/views/salesManagement/salesQuotation/index.vue
+++ b/src/views/salesManagement/salesQuotation/index.vue
@@ -185,11 +185,11 @@
</el-form-item>
</template>
</el-table-column>
- <el-table-column prop="specification" label="瑙勬牸鍨嬪彿" width="200">
+ <el-table-column prop="ProductModel" label="瑙勬牸鍨嬪彿" width="200">
<template #default="scope">
- <el-form-item :prop="`products.${scope.$index}.specificationId`" class="product-table-form-item">
+ <el-form-item :prop="`products.${scope.$index}.productModelId`" class="product-table-form-item">
<el-select
- v-model="scope.row.specificationId"
+ v-model="scope.row.productModelId"
placeholder="璇烽�夋嫨"
clearable
@change="getProductModel($event, scope.row)"
@@ -239,10 +239,10 @@
</template>
<div class="form-content">
<el-form-item label="澶囨敞" prop="remark">
- <el-input
- type="textarea"
- v-model="form.remark"
- placeholder="璇疯緭鍏ュ娉ㄤ俊鎭紙閫夊~锛�"
+ <el-input
+ type="textarea"
+ v-model="form.remark"
+ placeholder="璇疯緭鍏ュ娉ㄤ俊鎭紙閫夊~锛�"
:rows="4"
maxlength="500"
show-word-limit
@@ -270,12 +270,12 @@
<span style="font-size: 18px; color: #e6a23c; font-weight: bold;">楼{{ currentQuotation.totalAmount?.toFixed(2) }}</span>
</el-descriptions-item>
</el-descriptions>
-
+
<div style="margin: 20px 0;">
<h4>浜у搧鏄庣粏</h4>
<el-table :data="currentQuotation.products" border style="width: 100%">
<el-table-column prop="product" label="浜у搧鍚嶇О" />
- <el-table-column prop="specification" label="瑙勬牸鍨嬪彿" />
+ <el-table-column prop="ProductModel" label="瑙勬牸鍨嬪彿" />
<el-table-column prop="unit" label="鍗曚綅" />
<el-table-column prop="unitPrice" label="鍗曚环">
<template #default="scope">
@@ -354,7 +354,7 @@
const productRowRules = {
productId: [{ required: true, message: '璇烽�夋嫨浜у搧鍚嶇О', trigger: 'change' }],
- specificationId: [{ required: true, message: '璇烽�夋嫨瑙勬牸鍨嬪彿', trigger: 'change' }],
+ productModelId: [{ required: true, message: '璇烽�夋嫨瑙勬牸鍨嬪彿', trigger: 'change' }],
unit: [{ required: true, message: '璇峰~鍐欏崟浣�', trigger: 'blur' }],
unitPrice: [{ required: true, message: '璇峰~鍐欏崟浠�', trigger: 'change' }]
}
@@ -362,7 +362,7 @@
const r = { ...baseRules }
;(form.products || []).forEach((_, i) => {
r[`products.${i}.productId`] = productRowRules.productId
- r[`products.${i}.specificationId`] = productRowRules.specificationId
+ r[`products.${i}.productModelId`] = productRowRules.productModelId
r[`products.${i}.unit`] = productRowRules.unit
r[`products.${i}.unitPrice`] = productRowRules.unitPrice
})
@@ -433,7 +433,7 @@
if (children && children.length > 0) {
newItem.children = convertIdToValue(children);
}
-
+
return newItem;
});
}
@@ -457,8 +457,8 @@
row.productId = '';
row.product = '';
row.modelOptions = [];
- row.specificationId = '';
- row.specification = '';
+ row.productModelId = '';
+ row.ProductModel = '';
row.unit = '';
return;
}
@@ -478,20 +478,20 @@
if (!row) return;
// 濡傛灉娓呯┖閫夋嫨锛屽垯娓呯┖鐩稿叧瀛楁
if (!value) {
- row.specificationId = '';
- row.specification = '';
+ row.productModelId = '';
+ row.ProductModel = '';
row.unit = '';
return;
}
- // 鏇存柊 specificationId锛坴-model 宸茬粡鑷姩鏇存柊锛岃繖閲岀‘淇濅竴鑷存�э級
- row.specificationId = value;
+ // 鏇存柊 productModelId锛坴-model 宸茬粡鑷姩鏇存柊锛岃繖閲岀‘淇濅竴鑷存�э級
+ row.productModelId = value;
const modelOptions = row.modelOptions || [];
const index = modelOptions.findIndex((item) => item.id === value);
if (index !== -1) {
- row.specification = modelOptions[index].model;
+ row.ProductModel = modelOptions[index].model;
row.unit = modelOptions[index].unit;
} else {
- row.specification = '';
+ row.ProductModel = '';
row.unit = '';
}
};
@@ -523,8 +523,8 @@
products: row.products ? row.products.map(product => ({
productId: product.productId || '',
product: product.product || product.productName || '',
- specificationId: product.specificationId || '',
- specification: product.specification || '',
+ productModelId: product.productModelId || '',
+ ProductModel: product.ProductModel || '',
quantity: product.quantity || 0,
unit: product.unit || '',
unitPrice: product.unitPrice || 0,
@@ -560,33 +560,33 @@
const resolvedProductId = product.productId
? Number(product.productId)
: findNodeIdByLabel(productOptions.value, productName) || ''
-
+
// 濡傛灉鏈変骇鍝両D锛屽姞杞藉搴旂殑瑙勬牸鍨嬪彿鍒楄〃
let modelOptions = [];
- let resolvedSpecificationId = product.specificationId || '';
-
+ let resolvedProductModelId = product.productModelId || '';
+
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);
+
+ // 濡傛灉杩斿洖鐨勬暟鎹病鏈� productModelId锛屼絾鏈� ProductModel 鍚嶇О锛屾牴鎹悕绉版煡鎵� ID
+ if (!resolvedProductModelId && product.ProductModel) {
+ const foundModel = modelOptions.find(item => item.model === product.ProductModel);
if (foundModel) {
- resolvedSpecificationId = foundModel.id;
+ resolvedProductModelId = foundModel.id;
}
}
} catch (error) {
console.error('鍔犺浇瑙勬牸鍨嬪彿澶辫触:', error);
}
}
-
+
return {
productId: resolvedProductId,
product: productName,
- specificationId: resolvedSpecificationId,
- specification: product.specification || '',
+ productModelId: resolvedProductModelId,
+ ProductModel: product.ProductModel || '',
quantity: product.quantity || 0,
unit: product.unit || '',
unitPrice: product.unitPrice || 0,
@@ -649,8 +649,7 @@
productId: '',
product: '',
productName: '',
- specificationId: '',
- specification: '',
+ productModelId: '',
quantity: 1,
unit: '',
unitPrice: 0,
@@ -755,8 +754,8 @@
products: item.products ? item.products.map(product => ({
productId: product.productId || '',
product: product.product || product.productName || '',
- specificationId: product.specificationId || '',
- specification: product.specification || '',
+ productModelId: product.productModelId || '',
+ ProductModel: product.ProductModel || '',
quantity: product.quantity || 0,
unit: product.unit || '',
unitPrice: product.unitPrice || 0,
@@ -803,16 +802,16 @@
padding: 10px 0;
max-height: calc(100vh - 200px);
overflow-y: auto;
-
+
&::-webkit-scrollbar {
width: 6px;
height: 6px;
}
-
+
&::-webkit-scrollbar-thumb {
background: #c1c1c1;
border-radius: 3px;
-
+
&:hover {
background: #a8a8a8;
}
@@ -829,17 +828,17 @@
margin-bottom: 24px;
border-radius: 8px;
transition: all 0.3s ease;
-
+
&:hover {
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
}
-
+
:deep(.el-card__header) {
padding: 16px 20px;
background: linear-gradient(135deg, #f5f7fa 0%, #ffffff 100%);
border-bottom: 1px solid #ebeef5;
}
-
+
:deep(.el-card__body) {
padding: 20px;
}
@@ -849,19 +848,19 @@
display: flex;
align-items: center;
gap: 8px;
-
+
.card-icon {
font-size: 18px;
color: #409eff;
}
-
+
.card-title {
font-weight: 600;
font-size: 16px;
color: #303133;
flex: 1;
}
-
+
.header-btn {
margin-left: auto;
}
@@ -885,20 +884,20 @@
.product-table {
:deep(.el-table__header) {
background-color: #f5f7fa;
-
+
th {
background-color: #f5f7fa !important;
color: #606266;
font-weight: 600;
}
}
-
+
:deep(.el-table__row) {
&:hover {
background-color: #f5f7fa;
}
}
-
+
:deep(.el-table__cell) {
padding: 12px 0;
}
--
Gitblit v1.9.3