8 changed files with 513 additions and 282 deletions
-
2src/api/port/portTransit.js
-
226src/views/modules/order/com_poOrderSearchBar.vue
-
40src/views/modules/order/com_poOrder_CustomerPicker.vue
-
82src/views/modules/order/poOrder.vue
-
102src/views/modules/order/poOrderAdvancedQueryHelper.js
-
89src/views/modules/order/poOrderSearchOptionsMixin.js
-
127src/views/modules/order/poOrder_search.vue
-
127src/views/modules/order/poOrder_search_en.vue
@ -0,0 +1,226 @@ |
|||
<template> |
|||
<!-- 三个 PO 页面共用顶部筛选。leading 插槽放 Customer,与条件同一行。框宽统一 100px。 --> |
|||
<el-form class="po-order-search-form" :inline="true" label-position="top" :model="searchData" @submit.native.prevent> |
|||
<slot name="leading"></slot> |
|||
<el-form-item label="Planner"> |
|||
<el-input v-model="searchData.plannerAccount" clearable style="width: 130px" @keyup.enter.native="emitSearch"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="Buyer"> |
|||
<el-input v-model="searchData.buyer" clearable style="width: 130px" @keyup.enter.native="emitSearch"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="Supplier"> |
|||
<el-input v-model="searchData.supplierName" clearable style="width: 130px" @keyup.enter.native="emitSearch"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="PO"> |
|||
<el-input v-model="searchData.poNo" clearable style="width: 130px" @keyup.enter.native="emitSearch"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="ITEM"> |
|||
<el-input v-model="searchData.item" clearable style="width: 130px" @keyup.enter.native="emitSearch"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="LOGISTICS ID"> |
|||
<el-input v-model="searchData.flexid" clearable style="width: 130px" @keyup.enter.native="emitSearch"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="Ship Method"> |
|||
<el-select |
|||
v-model="searchData.shipViaList" |
|||
multiple |
|||
collapse-tags |
|||
clearable |
|||
filterable |
|||
placeholder="Please select" |
|||
style="width: 130px"> |
|||
<el-option |
|||
v-for="item in shipMethodOptions" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value" /> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="Status"> |
|||
<el-select |
|||
v-model="searchData.statusDisplayList" |
|||
multiple |
|||
collapse-tags |
|||
clearable |
|||
filterable |
|||
placeholder="Please select" |
|||
style="width: 130px" |
|||
@visible-change="onStatusVisible"> |
|||
<el-option |
|||
v-for="item in statusOptions" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value" /> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="Destination"> |
|||
<el-select |
|||
v-model="searchData.destinationList" |
|||
multiple |
|||
collapse-tags |
|||
clearable |
|||
filterable |
|||
placeholder="Please select" |
|||
style="width: 130px"> |
|||
<el-option |
|||
v-for="item in destinationOptions" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value" /> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="Telex Release"> |
|||
<el-select v-model="searchData.telexRelease" clearable placeholder="Please select" style="width: 130px"> |
|||
<el-option label="Yes" value="Yes"></el-option> |
|||
<el-option label="No" value="No"></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
<!-- 日期仍是起止两个单日框。每个框 100px,短横线垂直居中。只填一端时另一端不参与过滤。 --> |
|||
<el-form-item label="PO Enquiry Date"> |
|||
<span class="po-date-pair"> |
|||
<el-date-picker v-model="searchData.enquiryDateStart" type="date" placeholder="Start Date" |
|||
value-format="yyyy-MM-dd" |
|||
style="width:130px" /> |
|||
<span class="po-date-sep">-</span> |
|||
<el-date-picker v-model="searchData.enquiryDateEnd" type="date" placeholder="End Date" |
|||
value-format="yyyy-MM-dd" |
|||
style="width:130px" /> |
|||
</span> |
|||
</el-form-item> |
|||
<el-form-item label="PO Issue Date"> |
|||
<span class="po-date-pair"> |
|||
<el-date-picker v-model="searchData.issueDateStart" type="date" placeholder="Start Date" |
|||
value-format="yyyy-MM-dd" |
|||
style="width:130px" /> |
|||
<span class="po-date-sep">-</span> |
|||
<el-date-picker v-model="searchData.issueDateEnd" type="date" placeholder="End Date" |
|||
value-format="yyyy-MM-dd" |
|||
style="width:130px" /> |
|||
</span> |
|||
</el-form-item> |
|||
<el-form-item label="ETA"> |
|||
<span class="po-date-pair"> |
|||
<el-date-picker v-model="searchData.etaDateStart" type="date" placeholder="Start Date" |
|||
value-format="yyyy-MM-dd" |
|||
style="width:130px" /> |
|||
<span class="po-date-sep">-</span> |
|||
<el-date-picker v-model="searchData.etaDateEnd" type="date" placeholder="End Date" |
|||
value-format="yyyy-MM-dd" |
|||
style="width:130px" /> |
|||
</span> |
|||
</el-form-item> |
|||
<el-form-item label="OBD"> |
|||
<span class="po-date-pair"> |
|||
<el-date-picker v-model="searchData.obdDateStart" type="date" placeholder="Start Date" |
|||
value-format="yyyy-MM-dd" |
|||
style="width:130px" /> |
|||
<span class="po-date-sep">-</span> |
|||
<el-date-picker v-model="searchData.obdDateEnd" type="date" placeholder="End Date" |
|||
value-format="yyyy-MM-dd" |
|||
style="width:130px" /> |
|||
</span> |
|||
</el-form-item> |
|||
<el-form-item label="CRD"> |
|||
<span class="po-date-pair"> |
|||
<el-date-picker v-model="searchData.crdDateStart" type="date" placeholder="Start Date" |
|||
value-format="yyyy-MM-dd" |
|||
style="width:130px" /> |
|||
<span class="po-date-sep">-</span> |
|||
<el-date-picker v-model="searchData.crdDateEnd" type="date" placeholder="End Date" |
|||
value-format="yyyy-MM-dd" |
|||
style="width:130px" /> |
|||
</span> |
|||
</el-form-item> |
|||
</el-form> |
|||
</template> |
|||
|
|||
<script> |
|||
/** |
|||
* PO 顶部筛选条。 |
|||
* searchData 由父页面持有,本组件直接改同一对象。 |
|||
* 回车只负责通知父页面查询,不在这里发请求。 |
|||
*/ |
|||
export default { |
|||
name: 'ComPoOrderSearchBar', |
|||
props: { |
|||
searchData: { |
|||
type: Object, |
|||
required: true |
|||
}, |
|||
shipMethodOptions: { |
|||
type: Array, |
|||
default () { |
|||
return [] |
|||
} |
|||
}, |
|||
destinationOptions: { |
|||
type: Array, |
|||
default () { |
|||
return [] |
|||
} |
|||
}, |
|||
statusOptions: { |
|||
type: Array, |
|||
default () { |
|||
return [] |
|||
} |
|||
} |
|||
}, |
|||
methods: { |
|||
/** 输入框回车:交给父页面执行查询。父页面负责校验 Customer。 */ |
|||
emitSearch () { |
|||
this.$emit('search') |
|||
}, |
|||
/** |
|||
* 状态下拉展开时通知父页面刷新映射。 |
|||
* 选项本身来自父页面已加载的显示状态。 |
|||
*/ |
|||
onStatusVisible (visible) { |
|||
this.$emit('status-visible', visible) |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped> |
|||
/* |
|||
标签固定两行高度,短标题和长标题的输入框落在同一水平线。 |
|||
控件间距只用 --po-field-gap。日期中间的横线放在同一段间距里,居中,不再额外加宽。 |
|||
*/ |
|||
.po-order-search-form { |
|||
--po-field-width: 130px; |
|||
--po-field-gap: 12px; |
|||
} |
|||
.po-order-search-form /deep/ .el-form-item { |
|||
vertical-align: top; |
|||
margin-right: var(--po-field-gap); |
|||
margin-bottom: var(--po-field-gap); |
|||
} |
|||
.po-order-search-form /deep/ .el-form-item__label { |
|||
height: 32px; |
|||
line-height: 16px; |
|||
padding: 0 0 4px; |
|||
white-space: normal; |
|||
} |
|||
.po-order-search-form /deep/ .el-form-item__content { |
|||
line-height: 32px; |
|||
} |
|||
.po-order-search-form /deep/ .el-input, |
|||
.po-order-search-form /deep/ .el-select, |
|||
.po-order-search-form /deep/ .el-date-editor.el-input { |
|||
width: var(--po-field-width); |
|||
} |
|||
.po-date-pair { |
|||
display: inline-flex; |
|||
align-items: center; |
|||
} |
|||
.po-date-pair /deep/ .el-date-editor { |
|||
margin: 0; |
|||
} |
|||
.po-date-sep { |
|||
flex: 0 0 var(--po-field-gap); |
|||
width: var(--po-field-gap); |
|||
text-align: center; |
|||
line-height: 1; |
|||
} |
|||
</style> |
|||
@ -0,0 +1,89 @@ |
|||
import { searchPortList } from '@/api/port/portInfo.js' |
|||
import { listActiveShipMethods } from '@/api/port/portTransit.js' |
|||
|
|||
/** |
|||
* PO 顶部筛选的运输方式、目的港选项。 |
|||
* 运输方式取 ship_method.method_desc,与新增时写入的 ship_via 一致。 |
|||
* 目的港取 is_destination_port = Y 的港口,查询值用港口编码。 |
|||
*/ |
|||
export default { |
|||
data () { |
|||
return { |
|||
shipMethodOptions: [], |
|||
destinationOptions: [], |
|||
shipMethodOptionsLoading: false, |
|||
destinationOptionsLoading: false |
|||
} |
|||
}, |
|||
created () { |
|||
this.loadShipMethodOptions() |
|||
this.loadDestinationOptions() |
|||
}, |
|||
methods: { |
|||
/** |
|||
* 加载运输方式下拉。 |
|||
* 走启用运输方式接口,只查 active = Y,不再执行快捷查询里 where 1=1 的动态 SQL。 |
|||
* 选项值和显示都用 methodDesc,与订单头 ship_via 一致。失败时清空选项并提示。 |
|||
*/ |
|||
loadShipMethodOptions () { |
|||
if (this.shipMethodOptionsLoading) { |
|||
return |
|||
} |
|||
this.shipMethodOptionsLoading = true |
|||
listActiveShipMethods({}).then(({ data }) => { |
|||
if (!data || data.code !== 0) { |
|||
throw new Error((data && data.msg) || '加载运输方式失败') |
|||
} |
|||
const rows = Array.isArray(data.rows) ? data.rows : [] |
|||
const seen = new Set() |
|||
this.shipMethodOptions = rows.reduce((options, row) => { |
|||
const label = String((row && row.methodDesc) || '').trim() |
|||
if (!label || seen.has(label)) { |
|||
return options |
|||
} |
|||
seen.add(label) |
|||
options.push({ label, value: label }) |
|||
return options |
|||
}, []) |
|||
}).catch(error => { |
|||
this.shipMethodOptions = [] |
|||
this.$message.error(error.message || '加载运输方式失败') |
|||
}).finally(() => { |
|||
this.shipMethodOptionsLoading = false |
|||
}) |
|||
}, |
|||
|
|||
/** |
|||
* 加载目的港下拉。 |
|||
* 只取目的港主数据,选项值是港口编码,显示为编码加名称。 |
|||
* 查询按编码精确匹配 c_destination。加载失败时清空选项并提示。 |
|||
*/ |
|||
loadDestinationOptions () { |
|||
if (this.destinationOptionsLoading) { |
|||
return |
|||
} |
|||
this.destinationOptionsLoading = true |
|||
searchPortList({ isDestinationPort: 'Y' }).then(({ data }) => { |
|||
if (!data || data.code !== 0) { |
|||
throw new Error((data && data.msg) || '加载目的港失败') |
|||
} |
|||
const rows = Array.isArray(data.rows) ? data.rows : [] |
|||
this.destinationOptions = rows |
|||
.filter(row => row && String(row.portCode || '').trim()) |
|||
.map(row => { |
|||
const portCode = String(row.portCode).trim() |
|||
const portName = String(row.portName || '').trim() |
|||
return { |
|||
label: portName && portName !== portCode ? `${portCode} ${portName}` : portCode, |
|||
value: portCode |
|||
} |
|||
}) |
|||
}).catch(error => { |
|||
this.destinationOptions = [] |
|||
this.$message.error(error.message || '加载目的港失败') |
|||
}).finally(() => { |
|||
this.destinationOptionsLoading = false |
|||
}) |
|||
} |
|||
} |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue