| | |
| | | <script setup> |
| | | import { computed, onMounted, ref } from 'vue' |
| | | import { useRoute } from 'vue-router' |
| | | import { useI18n } from 'vue-i18n' |
| | | import { ElMessage } from 'element-plus' |
| | | import { useTable } from '@/hooks/core/useTable' |
| | | import { guardRequestWithMessage } from '@/utils/sys/requestGuard' |
| | |
| | | } from './locItemPage.helpers' |
| | | |
| | | defineOptions({ name: 'LocItem' }) |
| | | const { t } = useI18n() |
| | | |
| | | const route = useRoute() |
| | | const searchForm = ref(createLocItemSearchState()) |
| | |
| | | |
| | | const searchItems = computed(() => [ |
| | | { |
| | | label: '关键字', |
| | | label: t('pages.manager.locItem.search.condition'), |
| | | key: 'condition', |
| | | type: 'input', |
| | | props: { clearable: true, placeholder: '请输入库位编码/物料编码/追踪码' } |
| | | props: { clearable: true, placeholder: t('pages.manager.locItem.search.conditionPlaceholder') } |
| | | }, |
| | | { |
| | | label: '开始日期', |
| | | label: t('pages.manager.locItem.search.timeStart'), |
| | | key: 'timeStart', |
| | | type: 'date', |
| | | props: { clearable: true, valueFormat: 'YYYY-MM-DD', type: 'date' } |
| | | }, |
| | | { |
| | | label: '结束日期', |
| | | label: t('pages.manager.locItem.search.timeEnd'), |
| | | key: 'timeEnd', |
| | | type: 'date', |
| | | props: { clearable: true, valueFormat: 'YYYY-MM-DD', type: 'date' } |
| | | }, |
| | | { |
| | | label: '库位ID', |
| | | label: t('pages.manager.locItem.search.locId'), |
| | | key: 'locId', |
| | | type: 'inputNumber', |
| | | props: { min: 0, controlsPosition: 'right', placeholder: '请输入库位ID' } |
| | | props: { min: 0, controlsPosition: 'right', placeholder: t('pages.manager.locItem.search.locIdPlaceholder') } |
| | | }, |
| | | { |
| | | label: '单据ID', |
| | | label: t('pages.manager.locItem.search.orderId'), |
| | | key: 'orderId', |
| | | type: 'inputNumber', |
| | | props: { min: 0, controlsPosition: 'right', placeholder: '请输入单据ID' } |
| | | props: { min: 0, controlsPosition: 'right', placeholder: t('pages.manager.locItem.search.orderIdPlaceholder') } |
| | | }, |
| | | { |
| | | label: '业务类型', |
| | | label: t('pages.manager.locItem.search.type'), |
| | | key: 'type', |
| | | type: 'input', |
| | | props: { clearable: true, placeholder: '请输入业务类型' } |
| | | props: { clearable: true, placeholder: t('pages.manager.locItem.search.typePlaceholder') } |
| | | }, |
| | | { |
| | | label: '工位类型', |
| | | label: t('pages.manager.locItem.search.wkType'), |
| | | key: 'wkType', |
| | | type: 'inputNumber', |
| | | props: { min: 0, controlsPosition: 'right', placeholder: '请输入工位类型' } |
| | | props: { min: 0, controlsPosition: 'right', placeholder: t('pages.manager.locItem.search.wkTypePlaceholder') } |
| | | }, |
| | | { |
| | | label: '物料编码', |
| | | label: t('pages.manager.locItem.search.matnrCode'), |
| | | key: 'matnrCode', |
| | | type: 'input', |
| | | props: { clearable: true, placeholder: '请输入物料编码' } |
| | | props: { clearable: true, placeholder: t('pages.manager.locItem.search.matnrCodePlaceholder') } |
| | | }, |
| | | { |
| | | label: '物料名称', |
| | | label: t('pages.manager.locItem.search.maktx'), |
| | | key: 'maktx', |
| | | type: 'input', |
| | | props: { clearable: true, placeholder: '请输入物料名称' } |
| | | props: { clearable: true, placeholder: t('pages.manager.locItem.search.maktxPlaceholder') } |
| | | }, |
| | | { |
| | | label: '追踪码', |
| | | label: t('pages.manager.locItem.search.trackCode'), |
| | | key: 'trackCode', |
| | | type: 'input', |
| | | props: { clearable: true, placeholder: '请输入追踪码' } |
| | | props: { clearable: true, placeholder: t('pages.manager.locItem.search.trackCodePlaceholder') } |
| | | }, |
| | | { |
| | | label: '批次', |
| | | label: t('pages.manager.locItem.search.batch'), |
| | | key: 'batch', |
| | | type: 'input', |
| | | props: { clearable: true, placeholder: '请输入批次' } |
| | | props: { clearable: true, placeholder: t('pages.manager.locItem.search.batchPlaceholder') } |
| | | }, |
| | | { |
| | | label: '供应商批次', |
| | | label: t('pages.manager.locItem.search.splrBatch'), |
| | | key: 'splrBatch', |
| | | type: 'input', |
| | | props: { clearable: true, placeholder: '请输入供应商批次' } |
| | | props: { clearable: true, placeholder: t('pages.manager.locItem.search.splrBatchPlaceholder') } |
| | | }, |
| | | { |
| | | label: '状态', |
| | | label: t('table.status'), |
| | | key: 'status', |
| | | type: 'select', |
| | | props: { clearable: true, options: getLocItemStatusOptions() } |
| | |
| | | current: params.current || 1, |
| | | pageSize: params.pageSize || params.size || 20 |
| | | }, |
| | | { timeoutMessage: '库存明细加载超时,已停止等待' } |
| | | { timeoutMessage: t('pages.manager.locItem.messages.pageTimeout') } |
| | | ), |
| | | apiParams: buildLocItemPageQueryParams(searchForm.value), |
| | | paginationKey: getLocItemPaginationKey() |
| | |
| | | } catch (error) { |
| | | detailDrawerVisible.value = false |
| | | detailData.value = {} |
| | | ElMessage.error(error?.message || '获取库存明细详情失败') |
| | | ElMessage.error(error?.message || t('pages.manager.locItem.messages.detailFailed')) |
| | | } |
| | | } |
| | | |
| | | async function loadEnabledFieldDefinitions() { |
| | | const fields = await guardRequestWithMessage(fetchEnabledFields(), [], { |
| | | timeoutMessage: '扩展字段加载超时,已停止等待' |
| | | timeoutMessage: t('pages.manager.locItem.messages.fieldsTimeout') |
| | | }) |
| | | enabledFields.value = normalizeLocItemEnabledFields(fields) |
| | | resetColumns() |