diff --git a/src/locales/en.ts b/src/locales/en.ts
index 1da7ebe7..e343c371 100644
--- a/src/locales/en.ts
+++ b/src/locales/en.ts
@@ -694,6 +694,7 @@ export default {
placeholderProduct: 'Please select product',
placeholderCategory: 'Please select material category',
placeholderWarehouse: 'Please select warehouse',
+ placeholderArea: 'Please select area',
exportName: 'Product Stock.xls'
},
In: {
diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts
index c71062e8..7fa1f6c8 100644
--- a/src/locales/zh-CN.ts
+++ b/src/locales/zh-CN.ts
@@ -694,6 +694,7 @@ export default {
placeholderProduct: '请选择产品',
placeholderCategory: '请选择物料大类',
placeholderWarehouse: '请选择仓库',
+ placeholderArea: '\u8bf7\u9009\u62e9\u5e93\u533a',
exportName: '产品库存.xls'
},
In: {
diff --git a/src/views/erp/stock/stock/index.vue b/src/views/erp/stock/stock/index.vue
index 4b8191aa..22d2e0fc 100644
--- a/src/views/erp/stock/stock/index.vue
+++ b/src/views/erp/stock/stock/index.vue
@@ -35,6 +35,7 @@
filterable
:placeholder="t('ErpStock.Stock.placeholderWarehouse')"
class="!w-240px"
+ @change="handleWarehouseChange"
>
+
+
+
+
+
{{ t('common.query') }}
{{ t('common.reset') }}
@@ -135,11 +153,11 @@
-
-
+
{{ formatStockCount(row.totalBaseCount) }}
@@ -182,6 +200,7 @@ import { DICT_TYPE, getDictObj, getIntDictOptions } from '@/utils/dict'
import { StockApi, StockVO } from '@/api/erp/stock/stock'
import { ProductApi, ProductVO } from '@/api/erp/product/product'
import { WarehouseApi, WarehouseVO } from '@/api/erp/stock/warehouse'
+import { WarehouseAreaApi, WarehouseAreaVO } from '@/api/erp/stock/warehousearea'
import { useDictStoreWithOut } from '@/store/modules/dict'
import { formatDate } from '@/utils/formatTime'
import { isHexColor } from '@/utils/color'
@@ -212,12 +231,14 @@ const queryParams = reactive<{
pageSize: number
productId?: number
warehouseId?: number
+ areaId?: string
categoryType?: number
}>({
pageNo: 1,
pageSize: 10,
productId: undefined,
warehouseId: undefined,
+ areaId: undefined,
categoryType: undefined
})
const queryFormRef = ref() // 搜索的表单
@@ -225,6 +246,7 @@ const exportLoading = ref(false) // 导出的加载中
const activeName = ref('')
const productList = ref([]) // 产品列表
const warehouseList = ref([]) // 仓库列表
+const areaList = ref([])
const categoryTypeOptions = computed(() => getIntDictOptions(DICT_TYPE.MATERIAL_CLASSIFICATION_TYPE))
const formatStockCount = (value: number | string | undefined) => {
@@ -286,6 +308,26 @@ const getProductList = async () => {
}
}
+const getAreaLabel = (area: WarehouseAreaVO) => {
+ return area.areaName || area.areaCode || String(area.id)
+}
+
+const getAreaList = async () => {
+ if (!queryParams.warehouseId) {
+ areaList.value = []
+ return
+ }
+ const data = await WarehouseAreaApi.getWarehouseAreaPage({
+ pageNo: 1,
+ pageSize: 100,
+ warehouseId: queryParams.warehouseId
+ })
+ areaList.value = data?.list ?? []
+ if (queryParams.areaId && !areaList.value.some((item) => String(item.id) === String(queryParams.areaId))) {
+ queryParams.areaId = undefined
+ }
+}
+
/** 查询列表 */
const getList = async () => {
loading.value = true
@@ -310,10 +352,16 @@ const resetQuery = async () => {
queryFormRef.value.resetFields()
activeName.value = ''
queryParams.categoryType = undefined
+ areaList.value = []
await getProductList()
handleQuery()
}
+const handleWarehouseChange = async () => {
+ queryParams.areaId = undefined
+ await getAreaList()
+}
+
const handleTabClick = async (tab: any) => {
const value = String(tab.paneName || '')
activeName.value = value
@@ -376,6 +424,7 @@ onMounted(async () => {
// 加载产品、仓库列表
await getProductList()
warehouseList.value = await WarehouseApi.getWarehouseSimpleList()
+ await getAreaList()
})
onBeforeUnmount(() => {