716 lines
22 KiB
Vue
716 lines
22 KiB
Vue
<template>
|
||
<div class="order-sub-container" :style="{ height: containerHeight }">
|
||
<scan-box
|
||
ref="scanBox"
|
||
cache-key="storage-entry-owner"
|
||
width="220px"
|
||
:tree-props="{ children: 'children', label: 'label' }"
|
||
:auto-submit="false"
|
||
:initial-conditions="initialConditions"
|
||
:preset-tree="presetTree"
|
||
:available-fields="availableFieldsRef"
|
||
@condition-change="handleConditionChange"
|
||
@reset="handleConditionReset"
|
||
@condition-clear="handleConditionClear"
|
||
/>
|
||
|
||
<div class="main-content">
|
||
<div class="toolbar">
|
||
<div class="toolbar-left">
|
||
<order-toolbar-button-group
|
||
:buttons="toolbarButtons"
|
||
:resolve-disabled="resolveButtonDisabled"
|
||
:resolve-loading="resolveButtonLoading"
|
||
:resolve-label="resolveButtonLabel"
|
||
:layout-key="toolbarLayoutKey"
|
||
@action="handleToolbarButtonClick"
|
||
/>
|
||
<el-divider direction="vertical" />
|
||
<WarehouseSelect
|
||
v-model="warehouseFilterId"
|
||
@change="handleWarehouseChange"
|
||
/>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="split-stack" ref="splitStackRef">
|
||
<div class="upper-wrapper" :style="detailVisible ? upperPaneStyle : upperPaneFullStyle">
|
||
<upper-table
|
||
ref="upperTable"
|
||
title="入库单列表"
|
||
default-align="center"
|
||
table-id="storage-entry-owner-list"
|
||
:enable-column-config="true"
|
||
:column-config-schema-version="2"
|
||
:data="list"
|
||
:columns="columns"
|
||
:table-size="tableSize"
|
||
:pagination="pagination"
|
||
:show-index="true"
|
||
:show-selection="true"
|
||
:loading="loading"
|
||
:queryTime="queryTime"
|
||
@current-change="handleRowClick"
|
||
@sort-change="handleSortChange"
|
||
@page-change="handlePageChange"
|
||
@page-size-change="handlePageSizeChange"
|
||
@selection-change="handleSelectionChange"
|
||
@refresh="loadData"
|
||
>
|
||
<template #column-order_status="{ row }">
|
||
<el-tag :type="getEntryOrderStatusTagType(row.order_status)" size="small">
|
||
{{ formatEntryOrderStatus(row.order_status) }}
|
||
</el-tag>
|
||
</template>
|
||
<template #column-hasReceiving="{ row }">
|
||
<el-tag size="small" :type="row.hasReceiving ? 'success' : 'info'">
|
||
{{ row.hasReceiving ? '已绑定' : '未绑定' }}
|
||
</el-tag>
|
||
</template>
|
||
|
||
<template #column-sync_status="{ row }">
|
||
<el-tag :type="getSyncStatusType(row.sync_status)" size="small">
|
||
{{ translateEntryField('sync_status', row.sync_status) }}
|
||
</el-tag>
|
||
</template>
|
||
|
||
<template #column-sync_message="{ row }">
|
||
<el-tooltip
|
||
:content="syncMessageFullText(row)"
|
||
placement="top"
|
||
:disabled="!syncMessageFullText(row)"
|
||
:show-after="400"
|
||
>
|
||
<span
|
||
class="sync-message-cell"
|
||
:class="syncMessageCellClass(row)"
|
||
role="button"
|
||
tabindex="0"
|
||
@click.stop="copySyncMessage(row)"
|
||
@keydown.enter.prevent="copySyncMessage(row)"
|
||
>
|
||
{{ syncMessageCellText(row) }}
|
||
</span>
|
||
</el-tooltip>
|
||
</template>
|
||
<template #column-order_type="{ row }">
|
||
<span>{{ translateEntryField('order_type', row.order_type) }}</span>
|
||
</template>
|
||
|
||
<template #column-source_type="{ row }">
|
||
<el-tag size="small" :type="row.source_type === 'WMS' ? '' : row.source_type === 'QM' ? 'warning' : 'success'">
|
||
{{ translateEntryField('source_type', row.source_type) }}
|
||
</el-tag>
|
||
</template>
|
||
|
||
<template #column-order_create_time="{ row }">
|
||
{{ formatTime(row.order_create_time) }}
|
||
</template>
|
||
|
||
<template #column-expect_start_time="{ row }">
|
||
{{ formatTime(row.expect_start_time) }}
|
||
</template>
|
||
|
||
<template #column-expect_end_time="{ row }">
|
||
{{ formatTime(row.expect_end_time) }}
|
||
</template>
|
||
|
||
<template #empty>
|
||
<div class="empty-tip">暂无入库单</div>
|
||
</template>
|
||
</upper-table>
|
||
</div>
|
||
|
||
<template v-if="detailVisible">
|
||
<div
|
||
class="pane-resizer"
|
||
title="拖动调整列表与详情区域高度"
|
||
@mousedown="beginSplitDrag"
|
||
/>
|
||
<div v-if="selectedEntryId" class="lower-level" :class="tableSize" :style="lowerPaneStyle">
|
||
<div class="detail-header">
|
||
<el-tabs v-model="activeTab" class="detail-tab">
|
||
<el-tab-pane label="入库明细" name="details" />
|
||
<el-tab-pane label="绑定关系" name="bindingRelations" />
|
||
<el-tab-pane label="入库记录" name="directInboundLogs" />
|
||
<el-tab-pane label="操作日志" name="logs" />
|
||
</el-tabs>
|
||
</div>
|
||
|
||
<div class="detail-container">
|
||
<KeepAlive>
|
||
<component
|
||
:is="activeComponent"
|
||
ref="detailComponentRef"
|
||
:id="selectedEntryId"
|
||
:row="selectedRow"
|
||
:entry-detail-refresh-tick="entryDetailRefreshTick"
|
||
:store-mode="true"
|
||
@refresh="handleDetailRefresh"
|
||
/>
|
||
</KeepAlive>
|
||
</div>
|
||
</div>
|
||
|
||
<div v-else class="no-selection" :style="lowerPaneStyle">
|
||
<div class="empty-tip">
|
||
<p>请从上方列表中选择一项查看详情</p>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- 导出进度弹窗 -->
|
||
<AsyncExportProgressDialog
|
||
v-model:visible="exportDialogVisible"
|
||
title="入库单导出进度"
|
||
:loading="exportLoading"
|
||
:progress-percent="exportProgressPercent"
|
||
:progress-status="exportProgressStatus"
|
||
:status-label="exportStatusLabel"
|
||
:task-id="exportTaskProgress.taskId"
|
||
:message="exportTaskProgress.message"
|
||
:error="exportTaskProgress.error"
|
||
:update-time="exportTaskProgress.updateTime"
|
||
/>
|
||
</div>
|
||
</template>
|
||
|
||
<script setup lang="ts">
|
||
import { ref, reactive, onMounted, computed } from 'vue'
|
||
import { useRoute } from 'vue-router'
|
||
import { ElMessage } from 'element-plus'
|
||
import ScanBox from '@/components/ScanBox/index.vue'
|
||
import UpperTable from '@/components/UpperTable/index.vue'
|
||
import WarehouseSelect from '@/components/WarehouseSelect.vue'
|
||
import AsyncExportProgressDialog from '@/components/AsyncExportProgressDialog.vue'
|
||
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
||
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
|
||
import { useAsyncExportTask } from '@/composables/useAsyncExportTask'
|
||
import * as indexApi from '@/api/index/index'
|
||
import * as entryApi from '@/api/storage.entry/entry'
|
||
import type { StorageEntryListParams } from '@/api/storage.entry/entry'
|
||
|
||
import {
|
||
availableFields,
|
||
entryStoreColums,
|
||
formatEntryOrderStatus,
|
||
getEntryOrderStatusTagType,
|
||
translateEntryField,
|
||
} from '@/views/storage/entry/entry-config'
|
||
|
||
import entrydetail from '@/views/storage/entry/component/entrydetail.vue'
|
||
import log from '@/views/storage/entry/component/log.vue'
|
||
import DirectInboundLogs from '@/views/storage/entry/component/DirectInboundLogs.vue'
|
||
import EntryBindingRelations from '@/views/storage/entry/component/EntryBindingRelations.vue'
|
||
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
|
||
import { useSettingsStore } from '@/stores/modules/settings'
|
||
|
||
const settingsStore = useSettingsStore()
|
||
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
|
||
const containerHeight = computed(() =>
|
||
shortcutExpanded.value ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)'
|
||
)
|
||
|
||
const scanBox = ref<any>(null)
|
||
const upperTable = ref<any>(null)
|
||
const detailComponentRef = ref<{ openBatchImportDialog?: () => void; reloadAll?: () => Promise<void> } | null>(null)
|
||
const entryDetailRefreshTick = ref(0)
|
||
|
||
const {
|
||
splitStackRef,
|
||
beginSplitDrag,
|
||
lowerPaneStyle,
|
||
upperPaneStyle
|
||
} = useVerticalSplitPane({ defaultLowerPercent: 40 })
|
||
|
||
const upperPaneFullStyle = computed(() => ({
|
||
flex: '1 1 auto',
|
||
minHeight: '0',
|
||
overflow: 'hidden'
|
||
}))
|
||
|
||
const detailVisible = ref(true)
|
||
|
||
function toggleDetailVisible() {
|
||
detailVisible.value = !detailVisible.value
|
||
}
|
||
|
||
function openColumnConfigPanel() {
|
||
upperTable.value?.openColumnConfig?.()
|
||
}
|
||
|
||
// ─── 工具栏按钮配置 ────────────────────────────────────────────────────────
|
||
const toolbarButtons = computed<ToolbarButtonConfig[]>(() => [
|
||
{
|
||
key: 'refresh',
|
||
label: '刷新',
|
||
type: 'primary',
|
||
size: 'small',
|
||
action: 'handleRefresh'
|
||
},
|
||
{
|
||
key: 'export',
|
||
label: '导出',
|
||
size: 'small',
|
||
plain: true,
|
||
loadingKey: 'exportLoading',
|
||
action: 'handleExportAll',
|
||
buttonType: 'dropdown',
|
||
dropdownOptions: [
|
||
{ label: '导出选中', action: 'handleExportSelected' },
|
||
{ label: '导出全部', action: 'handleExportAll', divided: true }
|
||
]
|
||
},
|
||
{
|
||
key: 'columnConfig',
|
||
label: '字段设置',
|
||
size: 'small',
|
||
action: 'openColumnConfigPanel'
|
||
},
|
||
{
|
||
key: 'toggleDetail',
|
||
label: '显示详情',
|
||
dynamicLabelKey: 'detailToggleLabel',
|
||
size: 'small',
|
||
action: 'toggleDetailVisible'
|
||
}
|
||
])
|
||
|
||
const buttonLoadingMap = computed(() => ({
|
||
exportLoading: exportLoading.value
|
||
}))
|
||
|
||
const buttonLabelMap = computed(() => ({
|
||
detailToggleLabel: detailVisible.value ? '隐藏详情' : '显示详情'
|
||
}))
|
||
|
||
const toolbarLayoutKey = computed(() =>
|
||
JSON.stringify({
|
||
loading: buttonLoadingMap.value,
|
||
labels: buttonLabelMap.value
|
||
})
|
||
)
|
||
|
||
function resolveButtonLoading(loadingKey?: string) {
|
||
if (!loadingKey) return false
|
||
return Boolean((buttonLoadingMap.value as Record<string, boolean>)[loadingKey])
|
||
}
|
||
|
||
function resolveButtonDisabled(_disabledKey?: string) {
|
||
return false
|
||
}
|
||
|
||
function resolveButtonLabel(defaultLabel: string, dynamicLabelKey?: string) {
|
||
if (!dynamicLabelKey) return defaultLabel
|
||
return (buttonLabelMap.value as Record<string, string>)[dynamicLabelKey] || defaultLabel
|
||
}
|
||
|
||
const toolbarActionMap: Record<string, () => void> = {
|
||
handleRefresh: () => loadData(),
|
||
handleExportAll: () => handleExportAll(),
|
||
handleExportSelected: () => handleExportSelected(),
|
||
openColumnConfigPanel: () => openColumnConfigPanel(),
|
||
toggleDetailVisible: () => toggleDetailVisible()
|
||
}
|
||
|
||
function handleToolbarButtonClick(action: ToolbarButtonConfig['action']) {
|
||
const handler = toolbarActionMap[action]
|
||
if (!handler) return
|
||
handler()
|
||
}
|
||
|
||
const route = useRoute()
|
||
|
||
const initialConditions = ref<any>(null)
|
||
const currentCondition = ref<any>(null)
|
||
const currentConditionRaw = ref<any>(null)
|
||
/** toolbar 全部仓库筛选值(独立于 scan-box 条件,空值=全部仓库) */
|
||
const warehouseFilterId = ref<number | string | null>(null)
|
||
|
||
const presetTree = ref<any[]>([])
|
||
// 货主侧:移除货主筛选项(全部仓库已移出 scan-box,作为 toolbar 特殊选项)
|
||
const availableFieldsRef = reactive(
|
||
JSON.parse(JSON.stringify(availableFields)).filter((f: any) => f.value !== 'store_id')
|
||
)
|
||
|
||
const activeTab = ref('details')
|
||
|
||
const list = ref<any[]>([])
|
||
const loading = ref(false)
|
||
const queryTime = ref(0)
|
||
|
||
// ─── 多选 & 导出 ──────────────────────────────────────────────────────────
|
||
const selectionIds = ref<any[]>([])
|
||
const hasSelection = computed(() => selectionIds.value.length > 0)
|
||
|
||
function handleSelectionChange(selection: any[]) {
|
||
selectionIds.value = selection
|
||
}
|
||
|
||
const {
|
||
exportLoading,
|
||
exportDialogVisible,
|
||
exportTaskProgress,
|
||
exportProgressPercent,
|
||
exportProgressStatus,
|
||
exportStatusLabel,
|
||
submitExportTask
|
||
} = useAsyncExportTask({
|
||
storageKey: 'storage:entry:exportTaskId',
|
||
submitExport: (payload) => entryApi.entryStoreExport(payload as any),
|
||
queryProgress: (params) => entryApi.entryStoreExportTaskProgress(params)
|
||
})
|
||
|
||
const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
|
||
const tableSize = ref('small')
|
||
const columns = ref(entryStoreColums)
|
||
|
||
const selectedEntryId = ref<number | string | null>(null)
|
||
const currentSort = reactive({ prop: '', order: '' })
|
||
|
||
const componentMap: Record<string, any> = {
|
||
details: entrydetail,
|
||
bindingRelations: EntryBindingRelations,
|
||
directInboundLogs: DirectInboundLogs,
|
||
logs: log,
|
||
}
|
||
|
||
const activeComponent = computed(() => componentMap[activeTab.value] || componentMap.details)
|
||
|
||
const selectedRow = computed(() => {
|
||
return list.value.find((i: any) => i.id === selectedEntryId.value) || null
|
||
})
|
||
|
||
function getSyncStatusType(status: string) {
|
||
const map: Record<string, string> = {
|
||
PENDING: 'info',
|
||
SYNCING: 'primary',
|
||
SUCCESS: 'success',
|
||
FAIL: 'danger',
|
||
FAILED: 'danger',
|
||
}
|
||
return map[status] || undefined
|
||
}
|
||
|
||
function syncMessageFullText(row: any): string {
|
||
const v = row?.sync_message
|
||
if (v == null) return ''
|
||
return String(v).trim()
|
||
}
|
||
|
||
function syncMessageCellText(row: any): string {
|
||
const t = syncMessageFullText(row)
|
||
if (!t) return '--'
|
||
const max = 48
|
||
return t.length > max ? `${t.slice(0, max)}...` : t
|
||
}
|
||
|
||
function syncMessageCellClass(row: any): string {
|
||
const status = row?.sync_status
|
||
if (!status) return ''
|
||
const upper = String(status).trim().toUpperCase()
|
||
if (upper === 'FAIL' || upper === 'FAILED') return 'sync-message--fail'
|
||
if (upper === 'SUCCESS') return 'sync-message--success'
|
||
return ''
|
||
}
|
||
|
||
async function copySyncMessage(row: any) {
|
||
const text = syncMessageFullText(row)
|
||
if (!text) {
|
||
ElMessage.warning('当前行无同步信息可复制')
|
||
return
|
||
}
|
||
try {
|
||
if (navigator.clipboard?.writeText) {
|
||
await navigator.clipboard.writeText(text)
|
||
} else {
|
||
throw new Error('no clipboard api')
|
||
}
|
||
ElMessage.success('同步信息已复制到剪贴板')
|
||
} catch {
|
||
try {
|
||
const ta = document.createElement('textarea')
|
||
ta.value = text
|
||
ta.style.position = 'fixed'
|
||
ta.style.opacity = '0'
|
||
document.body.appendChild(ta)
|
||
ta.select()
|
||
document.execCommand('copy')
|
||
document.body.removeChild(ta)
|
||
ElMessage.success('同步信息已复制到剪贴板')
|
||
} catch {
|
||
ElMessage.error('复制失败,请手动选择文本复制')
|
||
}
|
||
}
|
||
}
|
||
|
||
function translateField(fieldValue: string, value: any) {
|
||
return translateEntryField(fieldValue, value)
|
||
}
|
||
|
||
function pad(n: number) {
|
||
return n < 10 ? '0' + n : String(n)
|
||
}
|
||
|
||
function formatTime(val: any) {
|
||
if (!val && val !== 0) return ''
|
||
const d = new Date(val)
|
||
if (isNaN(d.getTime())) return String(val)
|
||
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`
|
||
}
|
||
|
||
function normalizeToWhere(condition: any) {
|
||
if (!condition) return {}
|
||
|
||
if (typeof condition === 'string' || typeof condition === 'number') {
|
||
return { entry_order_code: { operator: 'like', value: condition, type: 'text' } }
|
||
}
|
||
|
||
const getFieldConfig = (key: string) => {
|
||
return availableFields.find((f: any) => f.value === key)
|
||
}
|
||
|
||
const mapType = (type: string, value: any) => {
|
||
if (type === 'datetimerange') return 'datetimerange'
|
||
if (type === 'daterange' || Array.isArray(value)) return 'daterange'
|
||
if (type === 'number' || typeof value === 'number') return 'number'
|
||
if (type === 'boolean' || typeof value === 'boolean') return 'boolean'
|
||
return 'text'
|
||
}
|
||
|
||
const processConditionValue = (k: string, c: any) => {
|
||
const config = getFieldConfig(k)
|
||
const fieldType = config?.type || 'text'
|
||
|
||
if (c && typeof c === 'object' && !Array.isArray(c)) {
|
||
if ('operator' in c || 'value' in c || 'type' in c) {
|
||
return {
|
||
operator: c.operator || (Array.isArray(c.value) ? 'in' : (fieldType === 'daterange' || fieldType === 'datetimerange' ? 'between' : 'eq')),
|
||
value: c.value,
|
||
type: c.type || mapType(fieldType, c.value)
|
||
}
|
||
}
|
||
}
|
||
|
||
if (c === null || c === undefined || c === '' || (Array.isArray(c) && c.length === 0)) return null
|
||
|
||
const simpleOp = (fieldType === 'daterange' || fieldType === 'datetimerange') ? 'between' : 'eq'
|
||
const simpleType = mapType(fieldType, c)
|
||
return { operator: simpleOp, value: c, type: simpleType }
|
||
}
|
||
|
||
if (condition.conditions && typeof condition.conditions === 'object') {
|
||
const where: any = {}
|
||
Object.keys(condition.conditions).forEach(k => {
|
||
const result = processConditionValue(k, condition.conditions[k])
|
||
if (result) where[k] = result
|
||
})
|
||
return where
|
||
}
|
||
|
||
if (typeof condition === 'object') {
|
||
const where: any = {}
|
||
Object.keys(condition).forEach(k => {
|
||
const result = processConditionValue(k, condition[k])
|
||
if (result) where[k] = result
|
||
})
|
||
return where
|
||
}
|
||
|
||
return {}
|
||
}
|
||
|
||
onMounted(() => {
|
||
loadFilterData()
|
||
|
||
const idParam = route.query.id || route.query.entry_order_code || route.query.q
|
||
const id = Array.isArray(idParam) ? idParam[0] : idParam
|
||
if (id) {
|
||
initialConditions.value = { conditions: { entry_order_code: { operator: 'like', value: id, type: 'text' } } }
|
||
handleConditionChange(initialConditions.value)
|
||
} else {
|
||
loadData()
|
||
}
|
||
})
|
||
|
||
/** toolbar 全部仓库过滤:与 scan-box 仓库条件等价的 eq 条件并入 where */
|
||
function applyWarehouseToWhere(where: Record<string, any>) {
|
||
const v = warehouseFilterId.value
|
||
if (v === null || v === undefined || v === '') return
|
||
where.warehouse_id = { operator: 'eq', value: v, type: 'number' }
|
||
}
|
||
|
||
/** toolbar 全部仓库切换:重置到第一页并刷新 */
|
||
function handleWarehouseChange() {
|
||
pagination.currentPage = 1
|
||
loadData()
|
||
}
|
||
|
||
async function loadData() {
|
||
if (loading.value) return
|
||
loading.value = true
|
||
const start = Date.now()
|
||
try {
|
||
const where = currentCondition.value || normalizeToWhere(scanBox.value?.getConditions?.() || {})
|
||
applyWarehouseToWhere(where)
|
||
|
||
const params: StorageEntryListParams = {
|
||
pagination: {
|
||
page: pagination.currentPage,
|
||
pageSize: pagination.pageSize
|
||
},
|
||
sort: currentSort.prop ? {
|
||
sortField: currentSort.prop,
|
||
sortOrder: currentSort.order === 'ascending' ? 'ASC' : 'DESC'
|
||
} : undefined,
|
||
where: where
|
||
}
|
||
|
||
const res = await entryApi.getEntryListStore(params)
|
||
if (res && res.code === 200 && res.data?.list) {
|
||
list.value = res.data.list
|
||
pagination.total = res.data.pagination?.total || 0
|
||
} else if (res && res.list) {
|
||
list.value = res.list
|
||
pagination.total = res.pagination?.total || 0
|
||
} else {
|
||
list.value = []
|
||
pagination.total = 0
|
||
}
|
||
} catch (e) {
|
||
console.error('加载入库单失败', e)
|
||
ElMessage.error('加载入库单失败')
|
||
list.value = []
|
||
pagination.total = 0
|
||
} finally {
|
||
loading.value = false
|
||
queryTime.value = Date.now() - start
|
||
}
|
||
}
|
||
|
||
async function handleDetailRefresh() {
|
||
await loadData()
|
||
entryDetailRefreshTick.value += 1
|
||
}
|
||
|
||
async function loadFilterData() {
|
||
try {
|
||
const presetRes: any = await indexApi.fastWhereTree('entry')
|
||
if (presetRes && presetRes.code === 200) {
|
||
presetTree.value = presetRes.presetTree || []
|
||
}
|
||
} catch (e) {
|
||
console.error('加载筛选配置失败', e)
|
||
}
|
||
}
|
||
|
||
function handleConditionChange(condition: any) {
|
||
currentConditionRaw.value = condition
|
||
currentCondition.value = normalizeToWhere(condition)
|
||
pagination.currentPage = 1
|
||
loadData()
|
||
}
|
||
|
||
function handleSortChange({ prop, order }: any) {
|
||
currentSort.prop = prop
|
||
currentSort.order = order
|
||
pagination.currentPage = 1
|
||
loadData()
|
||
}
|
||
|
||
const handleConditionClear = () => {
|
||
currentCondition.value = null
|
||
pagination.currentPage = 1
|
||
loadData()
|
||
}
|
||
|
||
function handleConditionReset() {
|
||
currentCondition.value = null
|
||
pagination.currentPage = 1
|
||
if (scanBox.value?.reset) {
|
||
scanBox.value.reset()
|
||
} else if (scanBox.value?.clear) {
|
||
scanBox.value.clear()
|
||
}
|
||
loadData()
|
||
}
|
||
|
||
function handleRowClick(row: any) {
|
||
selectedEntryId.value = row?.id || null
|
||
}
|
||
|
||
function handlePageChange(page: number) {
|
||
pagination.currentPage = page
|
||
loadData()
|
||
}
|
||
|
||
function handlePageSizeChange(size: number) {
|
||
pagination.pageSize = size
|
||
pagination.currentPage = 1
|
||
loadData()
|
||
}
|
||
|
||
function buildExportPayload() {
|
||
const where = currentCondition.value || normalizeToWhere(scanBox.value?.getConditions?.() || {})
|
||
applyWarehouseToWhere(where)
|
||
const payload: any = { where }
|
||
if (currentSort.prop) {
|
||
payload.sort = {
|
||
sortField: currentSort.prop,
|
||
sortOrder: currentSort.order === 'ascending' ? 'ASC' : 'DESC'
|
||
}
|
||
}
|
||
return payload
|
||
}
|
||
|
||
function buildExportSelectedPayload() {
|
||
const ids = selectionIds.value.map((item: any) => item.id)
|
||
const payload: any = {
|
||
where: {
|
||
id: { operator: 'in', value: ids }
|
||
}
|
||
}
|
||
return payload
|
||
}
|
||
|
||
async function handleExportAll() {
|
||
await submitExportTask(buildExportPayload())
|
||
}
|
||
|
||
async function handleExportSelected() {
|
||
if (!hasSelection.value) {
|
||
ElMessage.warning('请先勾选需要导出的入库单')
|
||
return
|
||
}
|
||
await submitExportTask(buildExportSelectedPayload())
|
||
}
|
||
|
||
</script>
|
||
|
||
<style scoped lang="scss">
|
||
@use "@/views/order/orderManagement/styles/order-sub.scss";
|
||
|
||
.order-sub-container .main-content .lower-level .detail-container {
|
||
padding: 10px;
|
||
overflow: auto;
|
||
}
|
||
|
||
.empty-tip {
|
||
text-align: center;
|
||
font-size: 14px;
|
||
}
|
||
|
||
.sync-message-cell {
|
||
cursor: pointer;
|
||
color: var(--el-color-primary);
|
||
}
|
||
.sync-message--fail {
|
||
color: var(--el-color-danger);
|
||
}
|
||
.sync-message--success {
|
||
color: var(--el-color-success);
|
||
}
|
||
</style>
|