修改测试

This commit is contained in:
wuweihua
2026-09-10 14:23:58 +08:00
parent 05c8d3f90d
commit 6d718320e6
24 changed files with 475 additions and 210 deletions
+19 -9
View File
@@ -222,16 +222,18 @@
title="套餐创建后处于草稿状态,可暂不绑定客户。一个客户只能绑定一个套餐。"
/>
<el-table :data="form.customers" border empty-text="暂未绑定客户">
<el-table-column label="客户ID" min-width="120">
<el-table-column label="客户" min-width="220">
<template #default="{ row }">
<el-input v-model="row.customerId" placeholder="客户ID" />
</template>
</el-table-column>
<el-table-column label="客户名称" min-width="140">
<template #default="{ row }">
<el-input v-model="row.customerName" placeholder="客户名称" />
<customer-select
v-model="row.customerCode"
value-key="customerCode"
placeholder="请选择客户"
@change="(code, item) => onBindCustomerChange(row, code, item)"
/>
</template>
</el-table-column>
<el-table-column label="客户代码" prop="customerCode" min-width="120" show-overflow-tooltip />
<el-table-column label="客户名称" prop="customerName" min-width="140" show-overflow-tooltip />
<el-table-column label="优先级" width="110">
<template #default="{ row }">
<el-input-number v-model="row.bindPriority" :min="1" controls-position="right" style="width: 100%" />
@@ -448,6 +450,7 @@ function emptyDetail() {
function emptyCustomer() {
return {
customerId: undefined,
customerCode: undefined,
customerName: '',
bindPriority: form.customers.length + 1,
prBegindate: form.effectiveDate,
@@ -463,6 +466,13 @@ function addCustomerRow() {
form.customers.push(emptyCustomer())
}
function onBindCustomerChange(row, code, item) {
console.log('onBindCustomerChange', row, code, item)
row.customerCode = code || undefined
row.customerName = item ? item.customerName : ''
row.customerId = item ? item.customerId : undefined
}
function clearCascadeAfterProduct(row) {
row.countryCode = undefined
row.countryName = undefined
@@ -545,10 +555,10 @@ function buildPayload(submitFlag) {
roundMode: d.roundMode || 'HALF_UP'
}))
const customers = (form.customers || [])
.filter(c => c.customerId)
.filter(c => c.customerCode)
.map(c => ({
...c,
customerId: Number(c.customerId)
customerCode: c.customerCode
}))
console.log('details', details)
+23 -6
View File
@@ -142,6 +142,7 @@
<el-table :data="set.customers || []" border empty-text="暂未绑定客户">
<el-table-column label="绑定ID" prop="customerPricesetId" width="100" />
<el-table-column label="客户ID" prop="customerId" width="110" />
<el-table-column label="客户代码" prop="customerCode" min-width="120" show-overflow-tooltip />
<el-table-column label="客户名称" prop="customerName" min-width="140" />
<el-table-column label="优先级" width="110">
<template #default="{ row }">{{ row.bindPriority }}{{ row.bindPriority === 1 ? '(最高)' : '' }}</template>
@@ -241,11 +242,19 @@
<el-dialog :title="customerTitle" v-model="customerOpen" width="520px" append-to-body>
<el-form ref="customerFormRef" :model="customerForm" :rules="customerRules" label-width="110px">
<el-form-item label="客户ID" prop="customerId">
<el-input v-model="customerForm.customerId" />
<el-form-item label="客户" prop="customerCode">
<customer-select
v-model="customerForm.customerCode"
value-key="customerCode"
placeholder="请选择客户"
@change="onCustomerSelectChange"
/>
</el-form-item>
<el-form-item label="客户名称" prop="customerName">
<el-input v-model="customerForm.customerName" maxlength="100" />
<el-form-item label="客户代码">
<el-input v-model="customerForm.customerCode" disabled />
</el-form-item>
<el-form-item label="客户名称">
<el-input v-model="customerForm.customerName" disabled />
</el-form-item>
<el-form-item label="优先级" prop="bindPriority">
<el-input-number v-model="customerForm.bindPriority" :min="1" controls-position="right" />
@@ -299,7 +308,7 @@ const customerTitle = ref('')
const customerFormRef = ref()
const customerForm = ref({})
const customerRules = {
customerId: [{ required: true, message: '客户ID不能为空', trigger: 'blur' }],
customerCode: [{ required: true, message: '请选择客户', trigger: 'change' }],
prBegindate: [{ required: true, message: '生效日期不能为空', trigger: 'change' }]
}
@@ -605,10 +614,17 @@ function removeDetail(row) {
}).catch(() => {})
}
function onCustomerSelectChange(code, item) {
customerForm.value.customerCode = code || undefined
customerForm.value.customerName = item ? item.customerName : ''
customerForm.value.customerId = undefined
}
function openCustomerDialog(row) {
customerForm.value = row ? { ...row } : {
priceSetId: set.value.priceSetId,
customerId: undefined,
customerCode: undefined,
customerName: '',
bindPriority: 1,
prBegindate: set.value.effectiveDate,
@@ -624,7 +640,8 @@ function submitCustomer() {
const payload = {
...customerForm.value,
priceSetId: set.value.priceSetId,
customerId: Number(customerForm.value.customerId)
customerId: customerForm.value.customerId,
customerCode: customerForm.value.customerCode
}
const req = payload.customerPricesetId ? updateSetCustomer(payload) : addSetCustomer(payload)
req.then(() => {