|
@@ -247,7 +247,7 @@ export default {
|
|
|
this.form.customerCode = selectedCustomer.customerCode
|
|
|
this.form.customerName = selectedCustomer.customerName
|
|
|
// Load customer addresses
|
|
|
- this.loadCustomerAddresses(value)
|
|
|
+ this.loadCustomerAddresses(selectedCustomer.customerCode)
|
|
|
} else {
|
|
|
this.clearCustomerData()
|
|
|
}
|
|
@@ -503,19 +503,6 @@ export default {
|
|
|
]
|
|
|
},
|
|
|
{
|
|
|
- label: '客户ID',
|
|
|
- prop: 'customerId',
|
|
|
- type: 'number',
|
|
|
- hide: true,
|
|
|
- rules: [
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: '请输入客户ID',
|
|
|
- trigger: 'blur'
|
|
|
- }
|
|
|
- ]
|
|
|
- },
|
|
|
- {
|
|
|
label: '创建时间',
|
|
|
prop: 'createTime',
|
|
|
type: 'datetime',
|
|
@@ -742,19 +729,37 @@ export default {
|
|
|
* @returns {Promise<void>}
|
|
|
*/
|
|
|
async beforeOpen(done, type) {
|
|
|
-
|
|
|
// 确保客户选项已加载
|
|
|
if (this.customerOptions.length === 0) {
|
|
|
- this.loadCustomerOptions()
|
|
|
+ await this.loadCustomerOptions()
|
|
|
}
|
|
|
|
|
|
+ // 更新客户选项到表格配置中
|
|
|
+ this.updateCustomerOptionsInColumn()
|
|
|
+
|
|
|
if (['edit', 'view'].includes(type)) {
|
|
|
try {
|
|
|
const res = await getDetail(this.form.id)
|
|
|
- this.form = res.data.data
|
|
|
- // 如果是编辑模式,加载对应客户的地址列表
|
|
|
+ const orderData = res.data.data
|
|
|
+
|
|
|
+ // 先设置基本数据
|
|
|
+ this.form = { ...orderData }
|
|
|
+
|
|
|
+ // 如果有客户编码,加载对应的地址列表
|
|
|
if (this.form.customerCode) {
|
|
|
await this.loadCustomerAddresses(this.form.customerCode)
|
|
|
+
|
|
|
+ // 确保客户字段正确回显
|
|
|
+ // 查找匹配的客户选项
|
|
|
+ const matchedCustomer = this.customerOptions.find(option =>
|
|
|
+ option.customerCode === this.form.customerCode ||
|
|
|
+ option.value === this.form.customerId
|
|
|
+ )
|
|
|
+
|
|
|
+ if (matchedCustomer) {
|
|
|
+ // 确保客户ID字段正确设置
|
|
|
+ this.form.customerId = matchedCustomer.value
|
|
|
+ }
|
|
|
}
|
|
|
} catch (error) {
|
|
|
window.console.log(error)
|