增加查询上游的菜单
This commit is contained in:
@@ -0,0 +1,122 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<basic-table
|
||||
ref="tableRef"
|
||||
:columns="columns"
|
||||
:search-columns="searchColumns"
|
||||
:query="queryList"
|
||||
row-key="orderId"
|
||||
:auto-load="false"
|
||||
search-action-align="center"
|
||||
:search-per-row="4"
|
||||
>
|
||||
<template #search-customerCodes="{ model }">
|
||||
<customer-select
|
||||
v-model="model.customerCodes"
|
||||
type="customer"
|
||||
value-key="customerCode"
|
||||
label-key="customerName"
|
||||
code-key="customerCode"
|
||||
placeholder="请选择客户"
|
||||
multiple
|
||||
/>
|
||||
</template>
|
||||
<template #col-product="{ row }">
|
||||
{{ row.productName || '-' }} ({{ row.productCode || '-' }})
|
||||
</template>
|
||||
<template #col-country="{ row }">
|
||||
{{ row.countryName || '-' }} ({{ row.country || '-' }})
|
||||
</template>
|
||||
<template #col-orderStatus="{ row }">
|
||||
{{ orderStatusLabel(row.orderStatus) }}
|
||||
</template>
|
||||
</basic-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="OrderSource">
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { listOrderSource } from '@/api/monitor/orderSource'
|
||||
|
||||
const tableRef = ref()
|
||||
|
||||
const searchColumns = [
|
||||
{ label: '客户', prop: 'customerCodes', placeholder: '客户代码' },
|
||||
{
|
||||
label: '提货时间',
|
||||
prop: 'dateRange',
|
||||
component: 'datetimerange',
|
||||
colSpan: 2,
|
||||
props: {
|
||||
clearable: true,
|
||||
defaultTime: [new Date(2000, 0, 1, 0, 0, 0), new Date(2000, 0, 1, 23, 59, 59)]
|
||||
}
|
||||
},
|
||||
{ label: '订单号', prop: 'orderId', component: 'input', placeholder: '订单号', width: '180px' },
|
||||
{ label: '运单号', prop: 'orgOrderId', component: 'input', placeholder: '运单号', width: '180px' },
|
||||
{ label: '转单号', prop: 'transferOrderId', component: 'input', placeholder: '转单号', width: '180px' }
|
||||
]
|
||||
|
||||
const columns = [
|
||||
{ label: '客户订单号', prop: 'orderId', minWidth: 160, showOverflowTooltip: true },
|
||||
{ label: '运单号', prop: 'orgOrderId', minWidth: 150, showOverflowTooltip: true },
|
||||
{ label: '转单号', prop: 'transferOrderId', minWidth: 160, showOverflowTooltip: true },
|
||||
{ label: '轨迹ID', prop: 'trackId', minWidth: 140, showOverflowTooltip: true },
|
||||
{ label: '订单状态', prop: 'orderStatus', align: 'center', width: 110, slot: 'orderStatus' },
|
||||
{ label: '客户代码', prop: 'customerCode', minWidth: 110, showOverflowTooltip: true },
|
||||
{ label: '客户名称', prop: 'customerName', minWidth: 140, showOverflowTooltip: true },
|
||||
{ label: '产品', prop: 'product', minWidth: 180, slot: 'product', showOverflowTooltip: true },
|
||||
{ label: '产品底级代码', prop: 'productFloorCode', minWidth: 130, showOverflowTooltip: true },
|
||||
{ label: '国家', prop: 'country', minWidth: 140, slot: 'country', showOverflowTooltip: true },
|
||||
{ label: '收件人邮编', prop: 'consigneePostcode', minWidth: 120, showOverflowTooltip: true },
|
||||
{ label: '计费重', prop: 'dimensionalWeightFactor', align: 'center', width: 100 },
|
||||
{ label: '体积重', prop: 'volumeWeight', align: 'center', width: 100 },
|
||||
{ label: '实重', prop: 'weight', align: 'center', width: 100 },
|
||||
{ label: '提货时间', prop: 'pickupDate', align: 'center', width: 170 }
|
||||
]
|
||||
|
||||
const orderStatusMap = {
|
||||
0: '预报订单',
|
||||
1: '确认订单',
|
||||
2: '已中转',
|
||||
3: '已收货',
|
||||
4: '已装箱',
|
||||
5: '已出库',
|
||||
6: '转运中',
|
||||
7: '已上网',
|
||||
8: '已签收',
|
||||
9: '已退件',
|
||||
10: '已删除'
|
||||
}
|
||||
|
||||
function orderStatusLabel(status) {
|
||||
if (status === null || status === undefined || status === '') return '-'
|
||||
const key = Number(status)
|
||||
if (Object.prototype.hasOwnProperty.call(orderStatusMap, key)) {
|
||||
return orderStatusMap[key]
|
||||
}
|
||||
return String(status)
|
||||
}
|
||||
|
||||
function hasRequiredFilters(params) {
|
||||
const codes = params && params.customerCodes
|
||||
const hasCustomer = Array.isArray(codes) && codes.some(v => v != null && String(v).trim() !== '')
|
||||
const range = params && params.dateRange
|
||||
const hasTime = Array.isArray(range) && !!(range[0] && range[1])
|
||||
return hasCustomer && hasTime
|
||||
}
|
||||
|
||||
function queryList(params) {
|
||||
if (!hasRequiredFilters(params)) {
|
||||
ElMessage.warning('请先选择客户和提货时间')
|
||||
return Promise.resolve({ rows: [], total: 0 })
|
||||
}
|
||||
const { dateRange, ...rest } = params
|
||||
const query = { ...rest }
|
||||
if (Array.isArray(dateRange) && dateRange[0] && dateRange[1]) {
|
||||
query.beginTime = dateRange[0]
|
||||
query.endTime = dateRange[1]
|
||||
}
|
||||
return listOrderSource(query)
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user