|
@@ -505,8 +505,29 @@ export default {
|
|
|
this.dialogMode = 'edit'
|
|
|
this.dialogTitle = '编辑订单'
|
|
|
await this.loadOrderDetail(row.id)
|
|
|
+
|
|
|
+ // 先加载客户选项
|
|
|
+ await this.loadCustomerOptions()
|
|
|
+
|
|
|
+ // 如果当前订单有客户ID,确保该客户在选项列表中
|
|
|
+ if (this.orderForm.customerId && this.orderForm.customerCode) {
|
|
|
+ const existingCustomer = this.customerOptions.find(option =>
|
|
|
+ option.value.toString() === this.orderForm.customerId.toString()
|
|
|
+ )
|
|
|
+
|
|
|
+ // 如果当前客户不在选项列表中,添加它
|
|
|
+ if (!existingCustomer) {
|
|
|
+ this.customerOptions.unshift({
|
|
|
+ value: this.orderForm.customerId.toString(),
|
|
|
+ label: `${this.orderForm.customerCode} - ${this.orderForm.customerName}`,
|
|
|
+ customerCode: this.orderForm.customerCode,
|
|
|
+ customerName: this.orderForm.customerName,
|
|
|
+ customerId: this.orderForm.customerId.toString()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
this.dialogVisible = true
|
|
|
- this.loadCustomerOptions()
|
|
|
},
|
|
|
|
|
|
/**
|
|
@@ -708,7 +729,7 @@ export default {
|
|
|
if (response.data && response.data.success) {
|
|
|
const customers = response.data.data.records || []
|
|
|
this.customerOptions = customers.map(customer => ({
|
|
|
- value: customer.Customer_ID.toString(), // 修改这里:统一转换为字符串
|
|
|
+ value: customer.Customer_ID.toString(), // 统一转换为字符串
|
|
|
label: `${customer.Customer_CODE} - ${customer.Customer_NAME}`,
|
|
|
customerCode: customer.Customer_CODE,
|
|
|
customerName: customer.Customer_NAME,
|