|
|
|
@ -100,27 +100,37 @@ |
|
|
|
<i slot="suffix" class="el-icon-search" style="cursor: pointer" @click.stop="openPartNoSelect(scope.row)"></i> |
|
|
|
</el-input> |
|
|
|
</template> |
|
|
|
<template v-else-if="editMode && item.columnProp==='departure' && canEditCell(scope.row, item)"> |
|
|
|
<el-input |
|
|
|
<template v-else-if="editMode && item.columnProp==='departure' && canEditCell(scope.row, item)"> |
|
|
|
<el-select |
|
|
|
v-model="scope.row.departure" |
|
|
|
size="mini" |
|
|
|
style="width: 100%; cursor: pointer" |
|
|
|
readonly |
|
|
|
style="width: 100%" |
|
|
|
filterable |
|
|
|
clearable |
|
|
|
placeholder="请选择始发港" |
|
|
|
@click.native="openDepartureSelect(scope.row)"> |
|
|
|
<i slot="suffix" class="el-icon-search" style="cursor: pointer" @click.stop="openDepartureSelect(scope.row)"></i> |
|
|
|
</el-input> |
|
|
|
@change="onCellChange(scope.row)"> |
|
|
|
<el-option |
|
|
|
v-for="option in poDepartureOptions" |
|
|
|
:key="option.value" |
|
|
|
:label="option.label" |
|
|
|
:value="option.value" /> |
|
|
|
</el-select> |
|
|
|
</template> |
|
|
|
<template v-else-if="editMode && item.columnProp==='destination' && canEditCell(scope.row, item)"> |
|
|
|
<el-input |
|
|
|
<template v-else-if="editMode && item.columnProp==='destination' && canEditCell(scope.row, item)"> |
|
|
|
<el-select |
|
|
|
v-model="scope.row.destination" |
|
|
|
size="mini" |
|
|
|
style="width: 100%; cursor: pointer" |
|
|
|
readonly |
|
|
|
style="width: 100%" |
|
|
|
filterable |
|
|
|
clearable |
|
|
|
placeholder="请选择目的港" |
|
|
|
@click.native="openDestinationSelect(scope.row)"> |
|
|
|
<i slot="suffix" class="el-icon-search" style="cursor: pointer" @click.stop="openDestinationSelect(scope.row)"></i> |
|
|
|
</el-input> |
|
|
|
@change="onCellChange(scope.row)"> |
|
|
|
<el-option |
|
|
|
v-for="option in poDestinationOptions" |
|
|
|
:key="option.value" |
|
|
|
:label="option.label" |
|
|
|
:value="option.value" /> |
|
|
|
</el-select> |
|
|
|
</template> |
|
|
|
<template v-else-if="editMode && item.columnProp==='shipVia' && canEditCell(scope.row, item)"> |
|
|
|
<el-input |
|
|
|
@ -713,18 +723,19 @@ import { |
|
|
|
resolveSupplierShortFieldsFromDetail |
|
|
|
} from '@/utils/supplierChooselistHelper.js' |
|
|
|
import { searchTransportOptions } from '@/api/port/portTransit.js' |
|
|
|
import { searchPortList } from '@/api/port/portInfo.js' |
|
|
|
import ComPoOrderSearchBar from './com_poOrderSearchBar.vue' |
|
|
|
import ChooselistEam from '@/views/modules/common/Chooselist_eam.vue' |
|
|
|
import PoOrderAdvancedQuery from './com_poOrderAdvancedQuery.vue' |
|
|
|
import ComPoOrderCustomerPicker from './com_poOrder_CustomerPicker.vue' |
|
|
|
import ComPoOrderDynamicFieldRenderer from './com_poOrder_DynamicFieldRenderer.vue' |
|
|
|
|
|
|
|
const ADD_CHOOSER_FIELD_CODES = new Set(['buyer', 'supplier_name', 'part_no', 'departure', 'destination', 'ship_via']) |
|
|
|
const ADD_CHOOSER_FIELD_CODES = new Set(['buyer', 'supplier_name', 'part_no', '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_TEXTAREA_FIELD_CODES = new Set(['remark']) |
|
|
|
const ADD_FULL_ROW_FIELD_CODES = new Set(['remark']) |
|
|
|
const ADD_NUMBER_FIELD_CODES = new Set(['price', 'qty', 'ship_qty', 'sum_price']) |
|
|
|
const ADD_FILTERABLE_SELECT_FIELD_CODES = new Set(['customer', 'buyer']) |
|
|
|
const ADD_FILTERABLE_SELECT_FIELD_CODES = new Set(['customer', 'buyer', 'departure', 'destination']) |
|
|
|
const ADD_FORCE_DETAIL_FIELD_CODES = new Set(['part_no', 'price', 'qty']) |
|
|
|
const ADD_READONLY_DEFAULT_TODAY_FIELD_CODES = new Set(['create_date']) |
|
|
|
const ADD_EDITABLE_DEFAULT_TODAY_FIELD_CODES = new Set(['po_place_date']) |
|
|
|
@ -732,6 +743,8 @@ const ADD_SELECT_OPTIONS_FIELD_CODE_MAP = { |
|
|
|
order_type: 'poOrderTypeOptions', |
|
|
|
customer: 'poCustomerOptions', |
|
|
|
buyer: 'poBuyerOptions', |
|
|
|
departure: 'poDepartureOptions', |
|
|
|
destination: 'poDestinationOptions', |
|
|
|
status: 'poOrderStatusValueOptions', // rqrq - 新增状态显示英文,值保留中文 |
|
|
|
doc_sent: 'yesNoOptions', |
|
|
|
telex_release: 'yesNoOptions', |
|
|
|
@ -874,6 +887,7 @@ export default { |
|
|
|
supplierOptions: [], |
|
|
|
poDepartureOptions: [], |
|
|
|
poDestinationOptions: [], |
|
|
|
portNameByCode: {}, |
|
|
|
poCustomerOptions: [], |
|
|
|
poBuyerOptions: [], |
|
|
|
/** Chooselist 弹窗选择列(editAble 可为 false,如供应商/物料) */ |
|
|
|
@ -2090,6 +2104,7 @@ export default { |
|
|
|
}, |
|
|
|
created () { |
|
|
|
this.baseColumnList = JSON.parse(JSON.stringify(this.columnList)) |
|
|
|
this.getPortOptions() |
|
|
|
this.getPartNoOptions() |
|
|
|
this.getSupplierOptions() |
|
|
|
this.getCustomerOptions() |
|
|
|
@ -2194,8 +2209,14 @@ export default { |
|
|
|
if (prop === 'basePrice') { |
|
|
|
return this.formatNumberDisplay(value) |
|
|
|
} |
|
|
|
if (prop === 'departure' || prop === 'destination') { |
|
|
|
return this.formatPortName(value) |
|
|
|
} |
|
|
|
return value |
|
|
|
}, |
|
|
|
formatPortName (code) { |
|
|
|
return this.portNameByCode[String(code)] || code |
|
|
|
}, |
|
|
|
/** |
|
|
|
* 数值展示去尾零。空值返回空字符串,避免把 null 显示成 0。 |
|
|
|
*/ |
|
|
|
@ -2346,6 +2367,9 @@ export default { |
|
|
|
if (value === null || value === undefined || value === '') { |
|
|
|
return '' |
|
|
|
} |
|
|
|
if (code === 'departure' || code === 'destination') { |
|
|
|
return this.formatPortName(value) |
|
|
|
} |
|
|
|
if (this.isAddDateField(field)) { |
|
|
|
if (value instanceof Date) { |
|
|
|
const pad = (num) => String(num).padStart(2, '0') |
|
|
|
@ -2422,7 +2446,9 @@ export default { |
|
|
|
return editorType === 'dict-select' || editorType === 'dict_select' |
|
|
|
}, |
|
|
|
isAddSelectField (field) { |
|
|
|
return this.isAddDictSelectField(field) || this.getAddFieldSelectOptions(field).length > 0 |
|
|
|
const code = this.getAddFieldCode(field) |
|
|
|
return code === 'departure' || code === 'destination' || |
|
|
|
this.isAddDictSelectField(field) || this.getAddFieldSelectOptions(field).length > 0 |
|
|
|
}, |
|
|
|
isAddFilterableSelectField (field) { |
|
|
|
return ADD_FILTERABLE_SELECT_FIELD_CODES.has(this.getAddFieldCode(field)) |
|
|
|
@ -3481,30 +3507,28 @@ export default { |
|
|
|
this.$message.error('操作失败: ' + error.message) |
|
|
|
}) |
|
|
|
}, |
|
|
|
getPortOptions(){ |
|
|
|
console.log('获取港口选项') |
|
|
|
searchTransportOptions( |
|
|
|
{ |
|
|
|
site: this.$store.state.user.site |
|
|
|
} |
|
|
|
).then(({data}) => { |
|
|
|
if (data && data.code === 0) { |
|
|
|
console.log('接口返回的rows:', data.rows) // 查看返回数据 |
|
|
|
|
|
|
|
this.transportOptions = (data.rows || []).map(item => ({ |
|
|
|
label: item.supplierName, |
|
|
|
value: item.supplierNo, |
|
|
|
destination: item.destination, |
|
|
|
departure: item.departure, |
|
|
|
shipVia: item.shipVia, |
|
|
|
etc: item.eta |
|
|
|
})) |
|
|
|
|
|
|
|
} else { |
|
|
|
this.$message.error(data.msg || '操作失败') |
|
|
|
getPortOptions () { |
|
|
|
return searchPortList({}).then(({ data }) => { |
|
|
|
if (!data || data.code !== 0) { |
|
|
|
throw new Error((data && data.msg) || '加载港口失败') |
|
|
|
} |
|
|
|
const rows = Array.isArray(data.rows) ? data.rows : [] |
|
|
|
const names = {} |
|
|
|
rows.forEach(port => { |
|
|
|
if (port.portCode && port.portName) { |
|
|
|
names[port.portCode] = port.portName |
|
|
|
} |
|
|
|
}) |
|
|
|
this.portNameByCode = names |
|
|
|
const activePorts = rows.filter(port => port.active === 'Y' && port.portCode && port.portName) |
|
|
|
this.poDepartureOptions = activePorts |
|
|
|
.filter(port => port.isDeparturePort === 'Y') |
|
|
|
.map(port => ({ value: port.portCode, label: port.portName })) |
|
|
|
this.poDestinationOptions = activePorts |
|
|
|
.filter(port => port.isDestinationPort === 'Y') |
|
|
|
.map(port => ({ value: port.portCode, label: port.portName })) |
|
|
|
}).catch(error => { |
|
|
|
this.$message.error('操作失败: ' + error.message) |
|
|
|
this.$message.error((error && error.message) || '加载港口失败') |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 保存订单信息 |
|
|
|
|