订单数据源增加订单对比功能

This commit is contained in:
wuweihua
2026-10-20 13:55:55 +08:00
parent 8093cb52e7
commit 45969a4d29
20 changed files with 1865 additions and 96 deletions
@@ -38,6 +38,15 @@
@click="openFilterSync()"
>同步计费</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="Search"
v-hasPermi="['monitor:orderSource:list']"
@click="openOrderCompare()"
>订单比对</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
@@ -77,7 +86,7 @@
<template #col-orderStatus="{ row }">
{{ orderStatusLabel(row.orderStatus) }}
</template>
<template #col-action="{ row }">
<!-- <template #col-action="{ row }">
<el-button
link
type="warning"
@@ -86,7 +95,7 @@
v-hasPermi="['monitor:orderSource:sync']"
@click="handleSyncOne(row)"
>同步计费</el-button>
</template>
</template> -->
</basic-table>
<order-source-sync-dialog
@@ -96,25 +105,30 @@
/>
<order-source-sync-log-drawer ref="logDrawerRef" />
<order-source-product-check-drawer ref="productCheckDrawerRef" />
<order-source-compare-drawer ref="compareDrawerRef" @fill-search="onCompareFillSearch" />
</div>
</template>
<script setup name="OrderSource">
import { ElMessage } from 'element-plus'
import { listOrderSource, syncOrderSourceSelected } from '@/api/monitor/orderSource'
import { listOrderSource, listOrderSourceByTransferNos, syncOrderSourceSelected } from '@/api/monitor/orderSource'
import OrderSourceSyncDialog from './components/OrderSourceSyncDialog.vue'
import OrderSourceSyncLogDrawer from './components/OrderSourceSyncLogDrawer.vue'
import OrderSourceProductCheckDrawer from './components/OrderSourceProductCheckDrawer.vue'
import OrderSourceCompareDrawer from './components/OrderSourceCompareDrawer.vue'
const { proxy } = getCurrentInstance()
const tableRef = ref()
const syncDialogRef = ref()
const logDrawerRef = ref()
const productCheckDrawerRef = ref()
const compareDrawerRef = ref()
const checkLoading = ref(false)
const syncingKey = ref(null)
const batchLoading = ref(false)
const syncFloat = ref(null)
/** 比对回填搜索模式:走专用转单号接口,不影响普通列表 */
const transferFillMode = ref(false)
const searchColumns = [
{
@@ -168,8 +182,8 @@ const columns = [
{ 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 },
{ label: '操作', prop: 'action', align: 'center', width: 120, fixed: 'right', slot: 'action', showInToolbar: false }
{ label: '提货时间', prop: 'pickupDate', align: 'center', width: 170 }
// { label: '操作', prop: 'action', align: 'center', width: 120, fixed: 'right', slot: 'action', showInToolbar: false }
]
const orderStatusMap = {
@@ -183,7 +197,8 @@ const orderStatusMap = {
7: '已上网',
8: '已签收',
9: '已退件',
10: '已删除'
10: '已删除',
11: '已复核'
}
const syncFloatVisible = computed(() => {
@@ -247,12 +262,29 @@ function buildFilterQuery(params) {
}
function queryList(params) {
const src = params || tableRef.value?.getQueryParams?.() || {}
const identifiers = splitLines(src.orderIdentifiers)
if (!identifiers.length) transferFillMode.value = false
// 回填搜索:走专用接口,不走普通 /list
if (transferFillMode.value && identifiers.length) {
if (identifiers.length > MAX_ORDER_IDENTIFIERS) {
ElMessage.warning(`单次最多查询 ${MAX_ORDER_IDENTIFIERS} 个单号,当前 ${identifiers.length} 个,请减少后再查`)
return Promise.resolve({ rows: [], total: 0 })
}
const customers = splitLines(src.customerKeywords)
const fillQuery = { orderIdentifiers: identifiers }
if (customers.length) fillQuery.customerKeywords = customers
fillQuery.pageNum = params.pageNum
fillQuery.pageSize = params.pageSize
return listOrderSourceByTransferNos(fillQuery)
}
const query = buildFilterQuery(params)
const identifierCount = (query.orderIdentifiers || []).length
const hasIdentifier = identifierCount > 0
const hasCustomer = !!(query.customerKeywords && query.customerKeywords.length)
const hasTime = !!query.beginTime && !!query.endTime
// 有任一单号即可查询;无单号时必须客户+提货时间
if (!hasIdentifier && !(hasCustomer && hasTime)) {
ElMessage.warning('请输入单号,或选择客户和提货时间')
return Promise.resolve({ rows: [], total: 0 })
@@ -266,6 +298,52 @@ function queryList(params) {
return listOrderSource(query)
}
function openOrderCompare() {
const q = buildFilterQuery()
const hasCustomer = !!(q.customerKeywords && q.customerKeywords.length)
const hasTime = !!q.beginTime && !!q.endTime
if (!hasCustomer || !hasTime) {
ElMessage.warning('订单比对需先输入客户并选择提货时间')
return
}
proxy.$modal.confirm(
'将按当前客户与提货时间,异步分页比对上游转单号与本地订单库(仅转单号),确认继续?',
'二次确认'
).then(() => {
// 比对只按客户+时间;不带单号框内容(回填后可能有数千转单号,带上会把比对拖死)
const compareQuery = { ...q }
delete compareQuery.orderIdentifiers
delete compareQuery.orderId
delete compareQuery.orgOrderId
delete compareQuery.transferOrderId
compareDrawerRef.value?.open(compareQuery)
}).catch(() => {})
}
/** 比对缺失转单号回填到列表「单号」搜索框并查询 */
function onCompareFillSearch(payload) {
const list = (payload && payload.transferNos) || []
if (!list.length) {
ElMessage.warning('暂无可回填的转单号')
return
}
let nos = list
if (nos.length > MAX_ORDER_IDENTIFIERS) {
nos = nos.slice(0, MAX_ORDER_IDENTIFIERS)
ElMessage.warning(`单次最多查询 ${MAX_ORDER_IDENTIFIERS} 个单号,已截取前 ${MAX_ORDER_IDENTIFIERS} 个`)
} else if (payload && payload.truncated) {
ElMessage.warning(`缺失转单号较多,仅回填样本 ${nos.length} 个`)
} else {
ElMessage.success(`已回填 ${nos.length} 个转单号并开始搜索`)
}
transferFillMode.value = true
tableRef.value?.setQueryParams?.({
orderIdentifiers: nos.join('\n'),
pageNum: 1
})
tableRef.value?.handleQuery?.()
}
function openFilterSync() {
const q = buildFilterQuery()
const identifierCount = (q.orderIdentifiers || []).length