diff --git a/src/api/warehouse.ts b/src/api/warehouse.ts index b7b75f8e..293ca00a 100644 --- a/src/api/warehouse.ts +++ b/src/api/warehouse.ts @@ -30,6 +30,7 @@ export function getWarehouseTree(warehouseId:any) { } as any) } +// 获取子区域,未使用 export function getChildren(zoneId:any) { return request({ url: '/system', @@ -100,6 +101,7 @@ export function detail(id:any) { } as any) } +// 切换激活状态,未使用 export function toggleActive(id:any, isActive:any) { return request({ url: '/system', @@ -114,6 +116,7 @@ export function toggleActive(id:any, isActive:any) { } as any) } +// 切换激活状态,未使用 export function getPath(id:any) { return request({ url: '/system', diff --git a/src/views/storage/entry/component/entrydetail.vue b/src/views/storage/entry/component/entrydetail.vue index 7728f44d..2c426e28 100644 --- a/src/views/storage/entry/component/entrydetail.vue +++ b/src/views/storage/entry/component/entrydetail.vue @@ -45,6 +45,7 @@ import { ref, reactive, watch, onMounted } from 'vue' import { ElMessage } from 'element-plus' import UpperTable from '@/components/UpperTable/index.vue' +import * as entryApi from '@/api/storage/entry' import {entrydetail} from '../entry-config' @@ -81,28 +82,49 @@ async function loadEntryDetail() { loading.value = true try { console.log('加载入库单详情, ID:', props.id) - // 模拟数据源 - const allMockDetails: Record = { - 90: [ - { id: 91, order_id: 90, out_biz_code: '', order_line_no: 1, owner_code: 'khgj2025100901', item_code: '6977520597331', item_id: 0, count: 5000, inventory_type: 'ZP', stock_id: 101845, received_quantity: 5000, confirm_quantity: 5000 } - ], - 93: [ - { id: 94, order_id: 93, out_biz_code: '', order_line_no: 1, owner_code: 'khgj2025100901', item_code: '6977520597331', item_id: 1000689, count: 1000, inventory_type: 'ZP', stock_id: 101845, received_quantity: 1000, confirm_quantity: 1000 } - ], - 95: [ - { id: 95, order_id: 95, out_biz_code: '', order_line_no: 2786714391389667366, owner_code: 'wdt02060120001', item_code: '三层钢蒸锅+屉26cm', item_id: 1000690, count: 1000, inventory_type: 'ZP', stock_id: 101874, received_quantity: 1000, confirm_quantity: 1000 } - ], - 96: [ - { id: 96, order_id: 96, out_biz_code: '', order_line_no: 2786720123363262666, owner_code: 'wdt02060120001', item_code: 'rrxm202502', item_id: 1000691, count: 1000, inventory_type: 'ZP', stock_id: 101875, received_quantity: 1000, confirm_quantity: 1000 } - ], - 97: [ - { id: 97, order_id: 97, out_biz_code: '', order_line_no: 1, owner_code: 'khgj2025100901', item_code: '20251023-18', item_id: 1000686, count: 1000, inventory_type: 'ZP', stock_id: 101842, received_quantity: 0, confirm_quantity: 0 } - ] + + let useMock = false + try { + const res = await entryApi.getEntryDetail({ + id: props.id, + page: pagination.currentPage, + page_size: pagination.pageSize + }) + if (res && res.code === 200 && res.data) { + tableData.value = Array.isArray(res.data) ? res.data : [res.data] + pagination.total = res.total || tableData.value.length + } else { + useMock = true + } + } catch (apiError) { + console.warn('详情API调用失败,改用模拟数据', apiError) + useMock = true } - const mockDetails = allMockDetails[props.id] || [] - tableData.value = mockDetails - pagination.total = mockDetails.length + if (useMock) { + // 模拟数据源 + const allMockDetails: Record = { + 90: [ + { id: 91, order_id: 90, out_biz_code: '', order_line_no: 1, owner_code: 'khgj2025100901', item_code: '6977520597331', item_id: 0, count: 5000, inventory_type: 'ZP', stock_id: 101845, received_quantity: 5000, confirm_quantity: 5000 } + ], + 93: [ + { id: 94, order_id: 93, out_biz_code: '', order_line_no: 1, owner_code: 'khgj2025100901', item_code: '6977520597331', item_id: 1000689, count: 1000, inventory_type: 'ZP', stock_id: 101845, received_quantity: 1000, confirm_quantity: 1000 } + ], + 95: [ + { id: 95, order_id: 95, out_biz_code: '', order_line_no: 2786714391389667366, owner_code: 'wdt02060120001', item_code: '三层钢蒸锅+屉26cm', item_id: 1000690, count: 1000, inventory_type: 'ZP', stock_id: 101874, received_quantity: 1000, confirm_quantity: 1000 } + ], + 96: [ + { id: 96, order_id: 96, out_biz_code: '', order_line_no: 2786720123363262666, owner_code: 'wdt02060120001', item_code: 'rrxm202502', item_id: 1000691, count: 1000, inventory_type: 'ZP', stock_id: 101875, received_quantity: 1000, confirm_quantity: 1000 } + ], + 97: [ + { id: 97, order_id: 97, out_biz_code: '', order_line_no: 1, owner_code: 'khgj2025100901', item_code: '20251023-18', item_id: 1000686, count: 1000, inventory_type: 'ZP', stock_id: 101842, received_quantity: 0, confirm_quantity: 0 } + ] + } + + const mockDetails = allMockDetails[props.id] || [] + tableData.value = mockDetails + pagination.total = mockDetails.length + } } catch (error) { ElMessage.error('获取明细失败') } finally { diff --git a/src/views/storage/entry/entry-config.ts b/src/views/storage/entry/entry-config.ts index 79609a5c..8e0041c2 100644 --- a/src/views/storage/entry/entry-config.ts +++ b/src/views/storage/entry/entry-config.ts @@ -1,39 +1,24 @@ export const availableFields = [ { label:'', value: '', type: 'input' }, { label: '货主', value: 'store_id', type: 'select', options: [] }, - { label: '状态', value: 'status', type: 'select', options: [ - { label: '待入库', value: 'pending' }, - { label: '入库中', value: 'partial' }, - { label: '已完成', value: 'confirmed' }, - { label: '随机入库中',value: ''}, - { label: '随机入库完成',value: ''}, - { label: '',value: ''}, - { label: '',value: ''}, - { label: '已取消', value: 'cancelled' }, - { label: '',value: ''}, - { label: '',value: ''}, - { label: '',value: ''}, - { label: '',value: ''}, - { label: '',value: ''}, - { label: '',value: ''}, + { label: '状态', value: 'order_status', type: 'select', options: [ + { label: '已创建', value: 'CREATED' }, + { label: '待入库', value: 'PENDING' }, + { label: '入库中', value: 'PARTIAL' }, + { label: '已完成', value: 'COMPLETED' }, + { label: '已取消', value: 'CANCELLED' }, ]}, - { label: '入库单类型', value: 'type', type: 'select', options: [ - { label: '采购入库单', value: 'purchase' }, - { label: '退货入库单', value: '' }, - { label: '其他入库单', value: 'other' }, - { label: '盘点入库单', value: '' }, - { label: '', value: '' }, - { label: '', value: '' }, - { label: '', value: '' }, - { label: '', value: '' }, - { label: '', value: '' }, - { label: '', value: '' }, - { label: '', value: '' }, - { label: '', value: '' }, + { label: '入库单类型', value: 'order_type', type: 'select', options: [ + { label: '采购入库', value: 'CGRK' }, + { label: '退货入库', value: 'THRK' }, + { label: '其他入库', value: 'QTRK' }, + { label: '盘点入库', value: 'PDRK' }, ]}, - { label: '是否同步', value: 'is_synced', type: 'select', options: [ - { label: '是', value: true }, - { label: '否', value: false }, + { label: '同步状态', value: 'sync_status', type: 'select', options: [ + { label: '待推送', value: 'PENDING' }, + { label: '推送中', value: 'SYNCING' }, + { label: '成功', value: 'SUCCESS' }, + { label: '失败', value: 'FAIL' }, ]}, { label: '费用是否记录',value: 'expense_record', type: 'select', options: [ { label: '是', value: true }, diff --git a/src/views/storage/entry/index.vue b/src/views/storage/entry/index.vue index 4859e5b5..c09eebe6 100644 --- a/src/views/storage/entry/index.vue +++ b/src/views/storage/entry/index.vue @@ -46,9 +46,19 @@ @refresh="loadData" @selection-change="onSelectionChange" > -