From 7fa37524d9ebd38bb33518ae9fb3bedbe60c32f2 Mon Sep 17 00:00:00 2001
From: buhuazhen <hua100783@gmail.com>
Date: 星期六, 16 五月 2026 15:08:17 +0800
Subject: [PATCH] 合并
---
src/views/salesManagement/salesQuotation/index.vue | 105 ++++++++++++++++++++++++++++------------------------
1 files changed, 57 insertions(+), 48 deletions(-)
diff --git a/src/views/salesManagement/salesQuotation/index.vue b/src/views/salesManagement/salesQuotation/index.vue
index ee93e46..fce764f 100644
--- a/src/views/salesManagement/salesQuotation/index.vue
+++ b/src/views/salesManagement/salesQuotation/index.vue
@@ -16,8 +16,8 @@
</el-input>
</el-col>
<el-col :span="8">
- <el-select v-model="searchForm.customer" placeholder="璇烽�夋嫨瀹㈡埛" clearable>
- <el-option v-for="item in customerOption" :key="item.id" :label="item.customerName" :value="item.customerName">
+ <el-select v-model="searchForm.customerId" placeholder="璇烽�夋嫨瀹㈡埛" clearable>
+ <el-option v-for="item in customerOption" :key="item.id" :label="item.customerName" :value="item.id">
{{
item.customerName + "鈥斺��" + item.taxpayerIdentificationNumber
}}
@@ -102,8 +102,8 @@
<div class="form-content">
<el-row :gutter="24">
<el-col :span="12">
- <el-form-item label="瀹㈡埛鍚嶇О" prop="customer">
- <el-select v-model="form.customer" placeholder="璇烽�夋嫨瀹㈡埛" style="width: 100%" clearable filterable>
+ <el-form-item label="瀹㈡埛鍚嶇О" prop="customerId">
+ <el-select v-model="form.customerId" placeholder="璇烽�夋嫨瀹㈡埛" style="width: 100%" clearable filterable>
<el-option v-for="item in customerOption" :key="item.id" :label="item.customerName" :value="item.id"></el-option>
</el-select>
</el-form-item>
@@ -187,9 +187,9 @@
</el-table-column>
<el-table-column prop="specification" 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,7 +270,7 @@
<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%">
@@ -300,23 +300,22 @@
import Pagination from '@/components/PIMTable/Pagination.vue'
import FormDialog from '@/components/Dialog/FormDialog.vue'
import {getQuotationList,addQuotation,updateQuotation,deleteQuotation} from '@/api/salesManagement/salesQuotation.js'
-import {customerList} from "@/api/salesManagement/salesLedger.js";
import {modelList, productTreeList} from "@/api/basicData/product.js";
-import {listCustomerPrivatePool} from "@/api/basicData/customerFile.js";
+import {listCustomer} from "@/api/basicData/customer.js";
import { userListNoPage } from "@/api/system/user.js";
// 鍝嶅簲寮忔暟鎹�
const loading = ref(false)
const searchForm = reactive({
quotationNo: '',
- customer: '',
+ customerId: '',
status: ''
})
const quotationList = ref([])
const userList = ref([])
const productOptions = ref([]);
-const modelOptions = ref([]);
+const modelOptions = ref([]);
const pagination = reactive({
total: 3,
currentPage: 1,
@@ -328,6 +327,7 @@
const dialogTitle = ref('鏂板鎶ヤ环')
const form = reactive({
quotationNo: '',
+ customerId: undefined,
customer: '',
salesperson: '',
quotationDate: '',
@@ -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
})
@@ -407,7 +407,12 @@
resetForm()
dialogVisible.value = true
getProductOptions();
- listCustomerPrivatePool({current: -1,size:-1}).then((res) => {
+ fetchCustomerOptions()
+}
+
+const fetchCustomerOptions = () => {
+ if (customerOption.value.length > 0) return
+ listCustomer({current: -1,size:-1, type: 0}).then((res) => {
customerOption.value = res.data.records;
});
}
@@ -428,7 +433,7 @@
if (children && children.length > 0) {
newItem.children = convertIdToValue(children);
}
-
+
return newItem;
});
}
@@ -452,7 +457,7 @@
row.productId = '';
row.product = '';
row.modelOptions = [];
- row.specificationId = '';
+ row.productModelId = '';
row.specification = '';
row.unit = '';
return;
@@ -473,13 +478,13 @@
if (!row) return;
// 濡傛灉娓呯┖閫夋嫨锛屽垯娓呯┖鐩稿叧瀛楁
if (!value) {
- row.specificationId = '';
+ row.productModelId = '';
row.specification = '';
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) {
@@ -518,7 +523,7 @@
products: row.products ? row.products.map(product => ({
productId: product.productId || '',
product: product.product || product.productName || '',
- specificationId: product.specificationId || '',
+ productModelId: product.productModelId || '',
specification: product.specification || '',
quantity: product.quantity || 0,
unit: product.unit || '',
@@ -537,10 +542,12 @@
form.id = row.id || form.id || null
// 鍏堝姞杞戒骇鍝佹爲鏁版嵁锛屽惁鍒� el-tree-select 鏃犳硶鍙嶆樉浜у搧鍚嶇О
await getProductOptions()
+ await fetchCustomerOptions()
// 鍙鍒堕渶瑕佺殑瀛楁锛岄伩鍏嶅皢缁勪欢寮曠敤鏀惧叆鍝嶅簲寮忓璞�
form.quotationNo = row.quotationNo || ''
form.customer = row.customer || ''
+ form.customerId = row.customerId || undefined
form.salesperson = row.salesperson || ''
form.quotationDate = row.quotationDate || ''
form.validDate = row.validDate || ''
@@ -553,32 +560,32 @@
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) {
+
+ // 濡傛灉杩斿洖鐨勬暟鎹病鏈� productModelId锛屼絾鏈� specification 鍚嶇О锛屾牴鎹悕绉版煡鎵� ID
+ if (!resolvedProductModelId && product.specification) {
const foundModel = modelOptions.find(item => item.model === product.specification);
if (foundModel) {
- resolvedSpecificationId = foundModel.id;
+ resolvedProductModelId = foundModel.id;
}
}
} catch (error) {
console.error('鍔犺浇瑙勬牸鍨嬪彿澶辫触:', error);
}
}
-
+
return {
productId: resolvedProductId,
product: productName,
- specificationId: resolvedSpecificationId,
+ productModelId: resolvedProductModelId,
specification: product.specification || '',
quantity: product.quantity || 0,
unit: product.unit || '',
@@ -642,8 +649,7 @@
productId: '',
product: '',
productName: '',
- specificationId: '',
- specification: '',
+ productModelId: '',
quantity: 1,
unit: '',
unitPrice: 0,
@@ -686,6 +692,7 @@
return sum + price
}, 0)
+ form.customer = customerOption.value.find(item => item.id === form.customerId)?.customerName || ''
if (isEdit.value) {
// 缂栬緫
const index = quotationList.value.findIndex(item => item.id === editId.value)
@@ -735,6 +742,7 @@
id: item.id,
quotationNo: item.quotationNo || '',
customer: item.customer || '',
+ customerId: item.customerId || undefined,
salesperson: item.salesperson || '',
quotationDate: item.quotationDate || '',
validDate: item.validDate || '',
@@ -746,7 +754,7 @@
products: item.products ? item.products.map(product => ({
productId: product.productId || '',
product: product.product || product.productName || '',
- specificationId: product.specificationId || '',
+ productModelId: product.productModelId || '',
specification: product.specification || '',
quantity: product.quantity || 0,
unit: product.unit || '',
@@ -781,6 +789,7 @@
onMounted(()=>{
getUserList()
handleSearch()
+ fetchCustomerOptions()
})
</script>
@@ -793,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;
}
@@ -819,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;
}
@@ -839,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;
}
@@ -875,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