|
|
|
@ -832,7 +832,7 @@ const ADD_SELECT_OPTIONS_FIELD_CODE_MAP = { |
|
|
|
* K. 供应商可供物料联动 |
|
|
|
* - openSupplierPartDialog, handleSupplierPartRowDblClick, resetSupplierPartDialog |
|
|
|
* - applySelectedPartToTarget, fillPartCategorySku |
|
|
|
* - applySupplierSelection, fillSupplierShortFields |
|
|
|
* - applySupplierSelection, fillSupplierShortFields, autoFillDepartureBySupplier |
|
|
|
* |
|
|
|
* L. 新增弹窗内快捷选择入口 |
|
|
|
* - openAddSupplierSelect, openAddPartNoSelect, openAddDepartureSelect, openAddDestinationSelect, openAddShipViaSelect |
|
|
|
@ -894,6 +894,8 @@ export default { |
|
|
|
addFormSaving: false, |
|
|
|
addDialogSchemaLoading: false, |
|
|
|
addFormSchemaFields: [], |
|
|
|
/** 新增弹窗中「始发港」最近一次自动带出的值,切换供应商时只覆盖自动值,不冲掉用户手选 */ |
|
|
|
addDepartureAutoValues: { add: '', addDetail: '' }, |
|
|
|
addDictSelectOptionsMap: {}, |
|
|
|
pickContext: '', |
|
|
|
eamTagNo: '', |
|
|
|
@ -3121,11 +3123,11 @@ export default { |
|
|
|
if (tag === SUPPLIER_CHOOSELIST_TAG || tag === 520) { |
|
|
|
const { supplierNo, supplierName } = parseSupplierChooselistRow(data) |
|
|
|
if (ctx === 'add') { |
|
|
|
this.fillSupplierShortFields(this.addForm, supplierNo, supplierName, false).then(() => { |
|
|
|
this.fillSupplierShortFields(this.addForm, supplierNo, supplierName, false, 'add').then(() => { |
|
|
|
this.scheduleAutoFillAddPriceByTierPrice('master') |
|
|
|
}) |
|
|
|
} else if (ctx === 'addDetail') { |
|
|
|
this.fillSupplierShortFields(this.addDetailForm, supplierNo, supplierName, false).then(() => { |
|
|
|
this.fillSupplierShortFields(this.addDetailForm, supplierNo, supplierName, false, 'addDetail').then(() => { |
|
|
|
this.scheduleAutoFillAddPriceByTierPrice('detail') |
|
|
|
}) |
|
|
|
} else if (this.currentSelectRow) { |
|
|
|
@ -3804,7 +3806,7 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
fillSupplierShortFields (target, supplierNo, supplierName, markChanged) { |
|
|
|
fillSupplierShortFields (target, supplierNo, supplierName, markChanged, departureAutoKey = '') { |
|
|
|
if (!target || !supplierNo) { |
|
|
|
return Promise.resolve() |
|
|
|
} |
|
|
|
@ -3818,11 +3820,35 @@ export default { |
|
|
|
markChanged |
|
|
|
) |
|
|
|
return fetchSupplierDetail(supplierNo, this.$store.state.user.site).then(detail => { |
|
|
|
const { shortOffice, shortNpc, planner } = resolveSupplierShortFieldsFromDetail(detail) |
|
|
|
const { shortOffice, shortNpc, planner, defaultOriginPort } = resolveSupplierShortFieldsFromDetail(detail) |
|
|
|
this.applySupplierSelection(target, supplierNo, supplierName, shortOffice, shortNpc, planner, markChanged) |
|
|
|
if (departureAutoKey) { |
|
|
|
this.autoFillDepartureBySupplier(target, defaultOriginPort, departureAutoKey) |
|
|
|
} |
|
|
|
}).catch(() => {}) |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* 选完供应商后按供应商主数据的默认始发港预填「始发港」(存港口编码,与手工选择同口径)。 |
|
|
|
* 边界:用户手选的港口(不等于上次自动值)不覆盖; |
|
|
|
* 当前值仍是自动带出的值时,跟随新供应商更新,新供应商未维护则清空避免残留旧港口。 |
|
|
|
*/ |
|
|
|
autoFillDepartureBySupplier (target, defaultOriginPort, autoKey) { |
|
|
|
if (!target || !autoKey) { |
|
|
|
return |
|
|
|
} |
|
|
|
const current = String(target.departure || '').trim() |
|
|
|
const lastAuto = String(this.addDepartureAutoValues[autoKey] || '').trim() |
|
|
|
if (current && current !== lastAuto) { |
|
|
|
return |
|
|
|
} |
|
|
|
const port = String(defaultOriginPort || '').trim() |
|
|
|
this.$set(this.addDepartureAutoValues, autoKey, port) |
|
|
|
if (current !== port) { |
|
|
|
this.$set(target, 'departure', port) |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
fillPartCategorySku (partNo, target) { |
|
|
|
if (!partNo || !target) return |
|
|
|
const targetSite = String(target.site || this.$store.state.user.site || '').trim() |
|
|
|
@ -3955,6 +3981,7 @@ export default { |
|
|
|
} |
|
|
|
this.addPriceLookupSeq += 1 |
|
|
|
this.addForm = this.createEmptyAddForm(this.resolveAddOrderTypeByCustomer()) |
|
|
|
this.addDepartureAutoValues = { add: '', addDetail: '' } |
|
|
|
this.addForm.customer = this.searchData.customer |
|
|
|
this.addFormSchemaFields = [] |
|
|
|
this.addDictSelectOptionsMap = {} |
|
|
|
@ -4206,6 +4233,7 @@ export default { |
|
|
|
openAddDetailDialog () { |
|
|
|
this.addDetailDialogMode = 'create' |
|
|
|
this.addDetailEditingDraftId = '' |
|
|
|
this.addDepartureAutoValues.addDetail = '' |
|
|
|
this.addDetailForm = this.createEmptyAddDetailForm() |
|
|
|
this.addDetailDialogVisible = true |
|
|
|
}, |
|
|
|
@ -4218,6 +4246,7 @@ export default { |
|
|
|
} |
|
|
|
this.addDetailDialogMode = 'edit' |
|
|
|
this.addDetailEditingDraftId = selected._draftId |
|
|
|
this.addDepartureAutoValues.addDetail = '' |
|
|
|
this.addDetailForm = this.cloneAddDraftRow(selected) |
|
|
|
this.addDetailDialogVisible = true |
|
|
|
}, |
|
|
|
@ -4233,6 +4262,7 @@ export default { |
|
|
|
copied.partNo = '' |
|
|
|
this.addDetailDialogMode = 'copy' |
|
|
|
this.addDetailEditingDraftId = '' |
|
|
|
this.addDepartureAutoValues.addDetail = '' |
|
|
|
this.addDetailForm = copied |
|
|
|
this.addDetailDialogVisible = true |
|
|
|
}, |
|
|
|
|