|
|
@ -563,7 +563,46 @@ |
|
|
</el-dialog> |
|
|
</el-dialog> |
|
|
|
|
|
|
|
|
<!-- |
|
|
<!-- |
|
|
模态框 #4:供应商可供物料弹窗 |
|
|
|
|
|
|
|
|
模态框 #4:Buyer 选择弹窗 |
|
|
|
|
|
Buyer 数据按当前 Site + Customer 从 po_buyer 主数据获取,回填 buyer_code。 |
|
|
|
|
|
--> |
|
|
|
|
|
<el-dialog |
|
|
|
|
|
title="选择 Buyer" |
|
|
|
|
|
v-drag |
|
|
|
|
|
:visible.sync="buyerDialogVisible" |
|
|
|
|
|
width="640px" |
|
|
|
|
|
top="10vh" |
|
|
|
|
|
append-to-body |
|
|
|
|
|
:close-on-click-modal="false" |
|
|
|
|
|
@closed="resetBuyerDialog"> |
|
|
|
|
|
<div style="margin-bottom: 10px; color: #606266;"> |
|
|
|
|
|
<span>Customer:{{ searchData.customer }}</span> |
|
|
|
|
|
</div> |
|
|
|
|
|
<el-table |
|
|
|
|
|
ref="buyerSelectTable" |
|
|
|
|
|
:data="buyerDialogRows" |
|
|
|
|
|
:height="360" |
|
|
|
|
|
border |
|
|
|
|
|
stripe |
|
|
|
|
|
highlight-current-row |
|
|
|
|
|
v-loading="buyerDialogLoading" |
|
|
|
|
|
empty-text="当前 Customer 未维护可用 Buyer" |
|
|
|
|
|
@current-change="onBuyerDialogCurrentChange" |
|
|
|
|
|
@row-dblclick="applyBuyerDialogSelection"> |
|
|
|
|
|
<el-table-column prop="code" label="Buyer 编码" min-width="180" header-align="center" align="center" /> |
|
|
|
|
|
<el-table-column prop="name" label="Buyer 名称" min-width="280" header-align="center" show-overflow-tooltip /> |
|
|
|
|
|
</el-table> |
|
|
|
|
|
<div slot="footer" class="dialog-footer"> |
|
|
|
|
|
<el-button |
|
|
|
|
|
type="primary" |
|
|
|
|
|
:disabled="!buyerDialogSelectedRow" |
|
|
|
|
|
@click="applyBuyerDialogSelection(buyerDialogSelectedRow)">确定</el-button> |
|
|
|
|
|
<el-button @click="buyerDialogVisible = false">取消</el-button> |
|
|
|
|
|
</div> |
|
|
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
|
|
|
|
<!-- |
|
|
|
|
|
模态框 #5:供应商可供物料弹窗 |
|
|
用途: |
|
|
用途: |
|
|
1) 按供应商加载可供物料; |
|
|
1) 按供应商加载可供物料; |
|
|
2) 双击选中后回填 Part No / Item / SKU / Category。 |
|
|
2) 双击选中后回填 Part No / Item / SKU / Category。 |
|
|
@ -658,7 +697,7 @@ import PoOrderAdvancedQuery from './com_poOrderAdvancedQuery.vue' |
|
|
import ComPoOrderCustomerPicker from './com_poOrder_CustomerPicker.vue' |
|
|
import ComPoOrderCustomerPicker from './com_poOrder_CustomerPicker.vue' |
|
|
import ComPoOrderDynamicFieldRenderer from './com_poOrder_DynamicFieldRenderer.vue' |
|
|
import ComPoOrderDynamicFieldRenderer from './com_poOrder_DynamicFieldRenderer.vue' |
|
|
|
|
|
|
|
|
const ADD_CHOOSER_FIELD_CODES = new Set(['supplier_name', 'part_no', 'departure', 'destination', 'ship_via']) |
|
|
|
|
|
|
|
|
const ADD_CHOOSER_FIELD_CODES = new Set(['buyer', 'supplier_name', 'part_no', 'departure', 'destination', 'ship_via']) |
|
|
const ADD_DISPLAY_ONLY_FIELD_CODES = new Set(['short_office', 'short_npc', 'item', 'category_name', 'sku', 'value', 'status', 'planner', 'crd_ori', 'base_price']) |
|
|
const ADD_DISPLAY_ONLY_FIELD_CODES = new Set(['short_office', 'short_npc', 'item', 'category_name', 'sku', 'value', 'status', 'planner', 'crd_ori', 'base_price']) |
|
|
const ADD_TEXTAREA_FIELD_CODES = new Set(['remark']) |
|
|
const ADD_TEXTAREA_FIELD_CODES = new Set(['remark']) |
|
|
const ADD_FULL_ROW_FIELD_CODES = new Set(['remark']) |
|
|
const ADD_FULL_ROW_FIELD_CODES = new Set(['remark']) |
|
|
@ -843,6 +882,11 @@ export default { |
|
|
addDetailCurrentDraftId: '', |
|
|
addDetailCurrentDraftId: '', |
|
|
addDetailEditingDraftId: '', |
|
|
addDetailEditingDraftId: '', |
|
|
addDetailDraftSeq: 0, |
|
|
addDetailDraftSeq: 0, |
|
|
|
|
|
buyerDialogVisible: false, |
|
|
|
|
|
buyerDialogLoading: false, |
|
|
|
|
|
buyerDialogRows: [], |
|
|
|
|
|
buyerDialogSelectedRow: null, |
|
|
|
|
|
buyerDialogTarget: 'master', |
|
|
supplierPartDialogVisible: false, |
|
|
supplierPartDialogVisible: false, |
|
|
supplierPartDialogLoading: false, |
|
|
supplierPartDialogLoading: false, |
|
|
supplierPartDialogRows: [], |
|
|
supplierPartDialogRows: [], |
|
|
@ -2301,7 +2345,9 @@ export default { |
|
|
}, |
|
|
}, |
|
|
openAddChooserByField (field, target = 'master') { |
|
|
openAddChooserByField (field, target = 'master') { |
|
|
const code = this.getAddFieldCode(field) |
|
|
const code = this.getAddFieldCode(field) |
|
|
if (code === 'supplier_name') { |
|
|
|
|
|
|
|
|
if (code === 'buyer') { |
|
|
|
|
|
this.openAddBuyerSelect(target) |
|
|
|
|
|
} else if (code === 'supplier_name') { |
|
|
this.openAddSupplierSelect(target) |
|
|
this.openAddSupplierSelect(target) |
|
|
} else if (code === 'part_no') { |
|
|
} else if (code === 'part_no') { |
|
|
this.openAddPartNoSelect(target) |
|
|
this.openAddPartNoSelect(target) |
|
|
@ -2315,6 +2361,7 @@ export default { |
|
|
}, |
|
|
}, |
|
|
getAddChooserPlaceholder (field) { |
|
|
getAddChooserPlaceholder (field) { |
|
|
const code = this.getAddFieldCode(field) |
|
|
const code = this.getAddFieldCode(field) |
|
|
|
|
|
if (code === 'buyer') return '请选择 Buyer' |
|
|
if (code === 'supplier_name') return '请选择供应商' |
|
|
if (code === 'supplier_name') return '请选择供应商' |
|
|
if (code === 'part_no') return '请选择物料' |
|
|
if (code === 'part_no') return '请选择物料' |
|
|
if (code === 'departure') return '请选择始发港' |
|
|
if (code === 'departure') return '请选择始发港' |
|
|
@ -3261,14 +3308,19 @@ export default { |
|
|
if (data && data.code === 0) { |
|
|
if (data && data.code === 0) { |
|
|
this.poBuyerOptions = (data.rows || []).map(item => ({ |
|
|
this.poBuyerOptions = (data.rows || []).map(item => ({ |
|
|
label: this.formatCodeOptionLabel(item.code, item.name), |
|
|
label: this.formatCodeOptionLabel(item.code, item.name), |
|
|
value: item.code |
|
|
|
|
|
|
|
|
value: item.code, |
|
|
|
|
|
code: item.code, |
|
|
|
|
|
name: item.name || '' |
|
|
})) |
|
|
})) |
|
|
this.columnSelectOptions.poBuyerOptions = this.poBuyerOptions |
|
|
this.columnSelectOptions.poBuyerOptions = this.poBuyerOptions |
|
|
|
|
|
return this.poBuyerOptions |
|
|
} else { |
|
|
} else { |
|
|
this.$message.error(data.msg || '操作失败') |
|
|
|
|
|
|
|
|
this.$message.error((data && data.msg) || '操作失败') |
|
|
|
|
|
return [] |
|
|
} |
|
|
} |
|
|
}).catch(error => { |
|
|
}).catch(error => { |
|
|
this.$message.error('操作失败: ' + error.message) |
|
|
this.$message.error('操作失败: ' + error.message) |
|
|
|
|
|
return [] |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
@ -4154,6 +4206,63 @@ export default { |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 打开 Buyer 选择弹窗。接口按当前 Site + Customer 查询 po_buyer, |
|
|
|
|
|
* 因此弹窗不会混入其他 Customer 的 Buyer。 |
|
|
|
|
|
*/ |
|
|
|
|
|
openAddBuyerSelect (target = 'master') { |
|
|
|
|
|
const customer = String(this.searchData.customer || '').trim() |
|
|
|
|
|
if (!customer) { |
|
|
|
|
|
this.$message.warning('请先选择 Customer') |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
this.buyerDialogTarget = target === 'detail' ? 'detail' : 'master' |
|
|
|
|
|
this.buyerDialogRows = [] |
|
|
|
|
|
this.buyerDialogSelectedRow = null |
|
|
|
|
|
this.buyerDialogVisible = true |
|
|
|
|
|
this.buyerDialogLoading = true |
|
|
|
|
|
this.getBuyerOptions(customer).then(options => { |
|
|
|
|
|
if (!this.buyerDialogVisible) { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
this.buyerDialogRows = Array.isArray(options) ? options : [] |
|
|
|
|
|
const targetForm = this.getAddTargetForm(this.buyerDialogTarget) |
|
|
|
|
|
const currentBuyer = String((targetForm && targetForm.buyer) || '').trim() |
|
|
|
|
|
const selected = this.buyerDialogRows.find(row => row && row.code === currentBuyer) || null |
|
|
|
|
|
this.buyerDialogSelectedRow = selected |
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
|
if (this.$refs.buyerSelectTable && this.$refs.buyerSelectTable.setCurrentRow) { |
|
|
|
|
|
this.$refs.buyerSelectTable.setCurrentRow(selected) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}).finally(() => { |
|
|
|
|
|
this.buyerDialogLoading = false |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
onBuyerDialogCurrentChange (row) { |
|
|
|
|
|
this.buyerDialogSelectedRow = row || null |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** Buyer 实际落库字段为 POHeader.buyer,因此回填主数据编码 buyer_code。 */ |
|
|
|
|
|
applyBuyerDialogSelection (row) { |
|
|
|
|
|
if (!row || !row.code) { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
const targetForm = this.getAddTargetForm(this.buyerDialogTarget) |
|
|
|
|
|
if (targetForm) { |
|
|
|
|
|
this.$set(targetForm, 'buyer', row.code) |
|
|
|
|
|
} |
|
|
|
|
|
this.buyerDialogVisible = false |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
resetBuyerDialog () { |
|
|
|
|
|
this.buyerDialogLoading = false |
|
|
|
|
|
this.buyerDialogRows = [] |
|
|
|
|
|
this.buyerDialogSelectedRow = null |
|
|
|
|
|
this.buyerDialogTarget = 'master' |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
openAddSupplierSelect (target = 'master') { |
|
|
openAddSupplierSelect (target = 'master') { |
|
|
const conSql = " and site = '" + this.$store.state.user.site + "'" |
|
|
const conSql = " and site = '" + this.$store.state.user.site + "'" |
|
|
const context = target === 'detail' ? 'addDetail' : 'add' |
|
|
const context = target === 'detail' ? 'addDetail' : 'add' |
|
|
|