From f59c04387a96108f09c6fac8e3bc2e1d2ffb7f02 Mon Sep 17 00:00:00 2001 From: hwj Date: Tue, 16 Jun 2026 15:11:27 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E5=87=BA=E5=85=A5=E5=BA=93?= =?UTF-8?q?=E6=98=8E=E7=BB=86-=E5=88=97=E8=A1=A8tabs=E5=8E=BB=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/locales/en.ts | 2 + src/locales/zh-CN.ts | 2 + src/views/erp/stock/record/index.vue | 55 +++++++++++++++------------- 3 files changed, 33 insertions(+), 26 deletions(-) diff --git a/src/locales/en.ts b/src/locales/en.ts index b9aab6af..56019626 100644 --- a/src/locales/en.ts +++ b/src/locales/en.ts @@ -564,6 +564,7 @@ bizNo: 'Business No', bizDirection: 'Direction', categoryType: 'Business Type', + materialCategory: 'Material Category', productId: 'Product ID', warehouseId: 'Warehouse ID', areaId: 'Area ID', @@ -587,6 +588,7 @@ createTime: 'Create Date', creatorName: 'Operator', placeholderProduct: 'Please select product', + placeholderMaterialCategory: 'Please select material category', placeholderWarehouse: 'Please select warehouse', placeholderBizType: 'Please select type', placeholderBizNo: 'Please input business no', diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts index 67d887ec..de456268 100644 --- a/src/locales/zh-CN.ts +++ b/src/locales/zh-CN.ts @@ -564,6 +564,7 @@ bizNo: '业务单号', bizDirection: '方向', categoryType: '业务类型', + materialCategory: '物料大类', productId: '产品编号', warehouseId: '仓库编号', areaId: '库区编号', @@ -587,6 +588,7 @@ createTime: '创建日期', creatorName: '操作人', placeholderProduct: '请选择产品', + placeholderMaterialCategory: '请选择物料大类', placeholderWarehouse: '请选择仓库', placeholderBizType: '请选择类型', placeholderBizNo: '请输入业务单号', diff --git a/src/views/erp/stock/record/index.vue b/src/views/erp/stock/record/index.vue index 6055d1c0..68578c98 100644 --- a/src/views/erp/stock/record/index.vue +++ b/src/views/erp/stock/record/index.vue @@ -42,6 +42,21 @@ /> + + + + + - - - - + + + @@ -234,7 +245,7 @@ const toggleFilters = () => { } const productList = ref([]) // 产品列表 const warehouseList = ref([]) // 仓库列表 -const categoryTabs = computed(() => getIntDictOptions(DICT_TYPE.MATERIAL_CLASSIFICATION_TYPE)) +const categoryTypeOptions = computed(() => getIntDictOptions(DICT_TYPE.MATERIAL_CLASSIFICATION_TYPE)) const isStockIn = (direction?: string) => direction === '入库' const isStockOut = (direction?: string) => direction === '出库' @@ -271,11 +282,17 @@ const formatCountWithUnit = (row: StockRecordVO, withDirectionSign = false) => { return `${formatNumber(value)}${unit}` } +const buildQueryParams = () => { + return Object.fromEntries( + Object.entries(queryParams).filter(([, value]) => value !== undefined && value !== null && value !== '') + ) +} + /** 查询列表 */ const getList = async () => { loading.value = true try { - const data = await StockRecordApi.getStockRecordPage(queryParams) + const data = await StockRecordApi.getStockRecordPage(buildQueryParams()) list.value = data.list total.value = data.total } finally { @@ -323,7 +340,7 @@ const handleExport = async () => { exportLoading.value = true const ids = selectionList.value.map((item) => item.id).filter((v) => v != null) const params = { - ...queryParams, + ...buildQueryParams(), ids: ids.length ? ids.join(',') : undefined } const data = await StockRecordApi.exportStockRecord(params) @@ -347,25 +364,11 @@ onActivated(() => { onMounted(async () => { await dictStore.setDictMap() - await loadCategoryTabs() await getList() // 加载产品、仓库列表 productList.value = await ProductApi.getProductSimpleList() warehouseList.value = await WarehouseApi.getWarehouseSimpleList() }) - -/** tab 切换 */ -const activeName = ref('') -const handleTabClick = (tab: TabsPaneContext) => { - queryParams.categoryType = tab.paneName ? Number(tab.paneName) : undefined - handleQuery() -} - -const loadCategoryTabs = async () => { - const defaultValue = categoryTabs.value[0]?.value - queryParams.categoryType = defaultValue !== undefined && defaultValue !== null ? Number(defaultValue) : undefined - activeName.value = defaultValue !== undefined && defaultValue !== null ? String(defaultValue) : '' -}