订单界面优化

This commit is contained in:
liufumingren 2026-05-20 08:55:58 +08:00
parent 3531a7893d
commit 0c3b83fb54
6 changed files with 131 additions and 6 deletions

View File

@ -420,6 +420,7 @@ const props = defineProps({
{ value: 'eq', label: '等于' },
{ value: 'ne', label: '不等于' },
{ value: 'like', label: '模糊匹配' },
{ value: 'notlike', label: '模糊排除' },
{ value: 'contains', label: '包含' },
{ value: 'startswith', label: '开头为' },
{ value: 'endswith', label: '结尾为' },

View File

@ -181,7 +181,7 @@
</el-upload>
<el-button size="small" type="danger" plain @click="handleRepairColumnConfig">故障修复</el-button>
</div>
<div class="column-config-list">
<div class="column-config-list" ref="columnConfigListRef">
<template v-for="section in columnConfigDialogSections" :key="section.key">
<div class="column-config-section">
<div class="column-config-section-title">{{ section.title }}</div>
@ -196,7 +196,7 @@
}"
:draggable="section.key === 'scroll'"
@dragstart="onColumnDragStart($event, item)"
@dragover.prevent="onColumnDragOver(item)"
@dragover.prevent="onColumnDragOver($event, item)"
@drop.prevent="onColumnDrop(item)"
@dragend="onColumnDragEnd"
>
@ -464,10 +464,13 @@ const draggingProp = ref<string>('')
const dragOverProp = ref<string>('')
const tableContainer = ref<HTMLElement | null>(null)
const bodyScrollEl = ref<HTMLElement | null>(null)
const columnConfigListRef = ref<HTMLElement | null>(null)
const virtualScrollTop = ref(0)
const virtualViewportHeight = ref(0)
const virtualBufferRows = 12
const virtualThreshold = 80
const dragAutoScrollStep = ref(0)
let dragAutoScrollRaf: number | null = null
type VirtualSpacerRow = {
__virtualSpacer: true
@ -713,6 +716,7 @@ onMounted(() => {
onBeforeUnmount(() => {
unbindBodyScroll()
stopColumnConfigAutoScroll()
})
// Methods
@ -901,12 +905,59 @@ function onColumnDragStart(e: DragEvent, item: ColumnConfigItem) {
draggingProp.value = item.prop
}
function onColumnDragOver(item: ColumnConfigItem) {
function runColumnConfigAutoScroll() {
const listEl = columnConfigListRef.value
if (!listEl || dragAutoScrollStep.value === 0) {
dragAutoScrollRaf = null
return
}
listEl.scrollTop += dragAutoScrollStep.value
dragAutoScrollRaf = requestAnimationFrame(runColumnConfigAutoScroll)
}
function startColumnConfigAutoScroll(step: number) {
dragAutoScrollStep.value = step
if (dragAutoScrollStep.value === 0) {
stopColumnConfigAutoScroll()
return
}
if (dragAutoScrollRaf === null) {
dragAutoScrollRaf = requestAnimationFrame(runColumnConfigAutoScroll)
}
}
function stopColumnConfigAutoScroll() {
dragAutoScrollStep.value = 0
if (dragAutoScrollRaf !== null) {
cancelAnimationFrame(dragAutoScrollRaf)
dragAutoScrollRaf = null
}
}
function onColumnDragOver(e: DragEvent, item: ColumnConfigItem) {
if (!draggingProp.value) return
if (draggingProp.value === item.prop) return
const sourceCfg = editableColumnConfigs.value.find((c) => c.prop === draggingProp.value)
if (!sourceCfg || isColumnOrderLocked(sourceCfg) || isColumnOrderLocked(item)) return
dragOverProp.value = item.prop
const listEl = columnConfigListRef.value
if (!listEl) return
const rect = listEl.getBoundingClientRect()
const threshold = 56
const maxStep = 8
let step = 0
if (e.clientY < rect.top + threshold) {
const ratio = (rect.top + threshold - e.clientY) / threshold
step = -Math.max(2, Math.min(maxStep, Math.round(ratio * maxStep)))
} else if (e.clientY > rect.bottom - threshold) {
const ratio = (e.clientY - (rect.bottom - threshold)) / threshold
step = Math.max(2, Math.min(maxStep, Math.round(ratio * maxStep)))
}
startColumnConfigAutoScroll(step)
}
function onColumnDrop(target: ColumnConfigItem) {
@ -948,6 +999,7 @@ function onColumnDrop(target: ColumnConfigItem) {
function onColumnDragEnd() {
draggingProp.value = ''
dragOverProp.value = ''
stopColumnConfigAutoScroll()
}
function resetColumnConfig() {

View File

@ -505,6 +505,7 @@ export function fillExpressCompanyScanFieldOptions(availableFields: any[], expre
export const deliveryAvailableFields = [
{ label: '货主', value: 'store_id', type: 'select', multiple: true, options: [] },
{ label: '订单号', value: 'delivery_order_code', type: 'text' },
{ label: '订单标记', value: 'order_flag', type: 'text', operators: ['like', 'notlike'], defaultOperator: 'like' },
waveAssignmentScanField,
{ label: '波次号', value: 'wave_no', type: 'text' },
{ label: '店铺名称', value: 'shop_nick', type: 'text' },
@ -528,6 +529,10 @@ export const deliveryAvailableFields = [
{ label: '待出库', value: 'padding' },
{ label: '已出库', value: 'fin' }
]},
{ label: '打印状态', value: 'print_status', type: 'select', options: [
{ label: '未打印', value: 'none' },
{ label: '已完成', value: 'fin' }
]},
{ label: '创建时间', value: 'create_at', type: 'daterange' },
{ label: '支付时间', value: 'pay_time', type: 'daterange' },
]
@ -742,6 +747,7 @@ export const outboundToolbarButtons = pickToolbarButtons(outboundToolbarButtonKe
export const pendingAvailableFields = [
{ label: '货主', value: 'store_id', type: 'select', multiple: true, options: [] },
{ label: '订单号', value: 'order_code', type: 'text' },
{ label: '订单标记', value: 'order_flag', type: 'text', operators: ['like', 'notlike'], defaultOperator: 'like' },
waveAssignmentScanField,
{ label: '波次号', value: 'wave_no', type: 'text' },
{ label: '店铺名称', value: 'shop_nick', type: 'text' },
@ -765,6 +771,10 @@ export const pendingAvailableFields = [
{ label: '已完成', value: 'fin' },
{ label: '错误', value: 'error' },
] },
{ label:'打印状态', value: 'print_status', type: 'select', options: [
{ label: '未打印', value: 'none' },
{ label: '已完成', value: 'fin' }
] },
{ label: '储位', value: 'storage_status', type: 'select', options: [
{ label: '未分配', value: 'none' },
{ label: '分配中', value: 'padding' },
@ -1019,6 +1029,7 @@ export const expectionOrderAvailableFields = [
{ label: '货主', value: 'store_id', type: 'select', multiple: true, options: [] },
{ label: '订单号', value: 'order_code', type: 'text' },
{ label: '发货单号', value: 'delivery_order_code', type: 'text' },
{ label: '订单标记', value: 'order_flag', type: 'text', operators: ['like', 'notlike'], defaultOperator: 'like' },
waveAssignmentScanField,
{ label: '波次号', value: 'wave_no', type: 'text' },
{ label: '物流公司', value: 'logistics_name', type: 'select', options: [] },
@ -1057,6 +1068,10 @@ export const expectionOrderAvailableFields = [
{ label: '错误', value: 'error' },
{ label: '超时', value: 'timeout' }
]},
{label:'打印状态', value: 'print_status', type: 'select', options: [
{ label: '未打印', value: 'none' },
{ label: '已完成', value: 'fin' }
]},
{label:'拣货状态', value: 'pick_status', type: 'select', options: [
{ label: '未拣货', value: 'none' },
{ label: '拣货中', value: 'padding' },

View File

@ -199,7 +199,24 @@ const queryTime = ref(0)
const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
const tableSize = ref('small')
const columns = ref(deliveryColumns)
const buildDeliveryColumns = () => {
const source = Array.isArray(deliveryColumns) ? [...deliveryColumns] : []
if (source.some((col: any) => String(col?.prop || '') === 'print_status')) {
return source
}
const printColumn = { prop: 'print_status', label: '打印状态', width: '100' }
const insertAfterIndex = source.findIndex((col: any) => String(col?.prop || '') === 'post_status')
if (insertAfterIndex >= 0) {
source.splice(insertAfterIndex + 1, 0, printColumn)
} else {
source.push(printColumn)
}
return source
}
const columns = ref(buildDeliveryColumns())
const selectionRows = ref<any[]>([])
const selectedOrderId = ref<number | string | null>(null)
const detailVisible = ref(true)

View File

@ -136,6 +136,12 @@
</el-tag>
</template>
<template #column-print_status="{ row }">
<el-tag :type="getTagType('print_status', row.print_status)" size="small">
{{ translateOrderField('print_status', row.print_status) }}
</el-tag>
</template>
<template #column-pick_status="{ row }">
<el-tag :type="getTagType('pick_status', row.pick_status)" size="small">
{{ translateOrderField('pick_status', row.pick_status) }}
@ -394,7 +400,24 @@ const platformCodeOptions = ref<Array<{ label: string; value: string }>>([])
const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
const tableSize = ref('small')
const columns = ref(expectionColumns)
const buildExceptionColumns = () => {
const source = Array.isArray(expectionColumns) ? [...expectionColumns] : []
if (source.some((col: any) => String(col?.prop || '') === 'print_status')) {
return source
}
const printColumn = { prop: 'print_status', label: '打印状态', width: '100' }
const insertAfterIndex = source.findIndex((col: any) => String(col?.prop || '') === 'post_status')
if (insertAfterIndex >= 0) {
source.splice(insertAfterIndex + 1, 0, printColumn)
} else {
source.push(printColumn)
}
return source
}
const columns = ref(buildExceptionColumns())
const selectionRows = ref<any[]>([])

View File

@ -310,7 +310,24 @@ const queryTime = ref(0)
const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
const tableSize = ref('small')
const columns = ref(pendingCloums)
const buildPendingColumns = () => {
const source = Array.isArray(pendingCloums) ? [...pendingCloums] : []
if (source.some((col: any) => String(col?.prop || '') === 'print_status')) {
return source
}
const printColumn = { prop: 'print_status', label: '打印状态', width: '100' }
const insertAfterIndex = source.findIndex((col: any) => String(col?.prop || '') === 'post_status')
if (insertAfterIndex >= 0) {
source.splice(insertAfterIndex + 1, 0, printColumn)
} else {
source.push(printColumn)
}
return source
}
const columns = ref(buildPendingColumns())
const selectionRows = ref<any[]>([])