diff --git a/src/api/erp/stock/warehouse/index.ts b/src/api/erp/stock/warehouse/index.ts
index b953eeb2..92b797ac 100644
--- a/src/api/erp/stock/warehouse/index.ts
+++ b/src/api/erp/stock/warehouse/index.ts
@@ -4,6 +4,7 @@ import request from '@/config/axios'
export interface WarehouseVO {
id: number // 仓库编号
name: string // 仓库名称
+ categoryType?: number // 仓库分类
address: string // 仓库地址
sort: number // 排序
remark: string // 备注
@@ -49,8 +50,8 @@ export const WarehouseApi = {
},
// 查询仓库精简列表
- getWarehouseSimpleList: async () => {
- return await request.get({ url: `/erp/warehouse/simple-list` })
+ getWarehouseSimpleList: async (params?: any) => {
+ return await request.get({ url: `/erp/warehouse/simple-list`, params })
},
// 查询仓库详情
diff --git a/src/locales/en.ts b/src/locales/en.ts
index 7e6b3705..a2fa7281 100644
--- a/src/locales/en.ts
+++ b/src/locales/en.ts
@@ -267,6 +267,7 @@
ErpStock: {
Warehouse: {
name: 'Warehouse Name',
+ categoryType: 'Warehouse Category',
status: 'Warehouse Status',
address: 'Warehouse Address',
warehousePrice: 'Storage Fee',
@@ -277,6 +278,7 @@
defaultStatus: 'Default Status',
createTime: 'Create Time',
placeholderName: 'Please enter warehouse name',
+ placeholderCategoryType: 'Please select warehouse category',
placeholderStatus: 'Please select warehouse status',
placeholderAddress: 'Please enter warehouse address',
placeholderPrincipal: 'Please enter principal',
diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts
index 8553a215..bd3c1ca6 100644
--- a/src/locales/zh-CN.ts
+++ b/src/locales/zh-CN.ts
@@ -267,6 +267,7 @@
ErpStock: {
Warehouse: {
name: '仓库名称',
+ categoryType: '仓库分类',
status: '仓库状态',
address: '仓库地址',
warehousePrice: '仓储费',
@@ -277,6 +278,7 @@
defaultStatus: '是否默认',
createTime: '创建时间',
placeholderName: '请输入仓库名称',
+ placeholderCategoryType: '请选择仓库分类',
placeholderStatus: '请选择仓库状态',
placeholderAddress: '请输入仓库地址',
placeholderPrincipal: '请输入负责人',
diff --git a/src/views/erp/stock/in/components/StockInItemForm.vue b/src/views/erp/stock/in/components/StockInItemForm.vue
index 1bdb41c3..b2574a5e 100644
--- a/src/views/erp/stock/in/components/StockInItemForm.vue
+++ b/src/views/erp/stock/in/components/StockInItemForm.vue
@@ -301,6 +301,27 @@ const productCascaderOptions = computed(() => {
return Array.from(map.values())
})
+const loadWarehouseList = async () => {
+ const categoryType = activeCategoryType.value
+ warehouseList.value = await WarehouseApi.getWarehouseSimpleList(categoryType ? { categoryType } : undefined)
+ const firstWarehouse = warehouseList.value[0]
+ defaultWarehouse.value = firstWarehouse
+ const warehouseIds = new Set((warehouseList.value || []).map((item) => item.id))
+ formData.value.forEach((row) => {
+ if (row.warehouseId && !warehouseIds.has(row.warehouseId)) {
+ row.warehouseId = undefined
+ row.areaId = undefined
+ row.stockCount = 0
+ }
+ if (!row.warehouseId && firstWarehouse?.id) {
+ row.warehouseId = firstWarehouse.id
+ row.areaId = undefined
+ row.stockCount = 0
+ }
+ })
+ warehouseAreaMap.value = {}
+}
+
/** 初始化设置入库项 */
watch(
() => props.items,
@@ -317,6 +338,7 @@ watch(
watch(
() => props.inType,
async () => {
+ await loadWarehouseList()
if (isProductMaterialStockIn.value) {
formData.value.forEach((row) => {
row.inputCount = row.inputCount ?? row.count ?? 1
@@ -601,8 +623,7 @@ defineExpose({ validate, resetItems })
/** 初始化 */
onMounted(async () => {
productList.value = await ProductApi.getProductSimpleList()
- warehouseList.value = await WarehouseApi.getWarehouseSimpleList()
- defaultWarehouse.value = warehouseList.value.find((item) => item.defaultStatus)
+ await loadWarehouseList()
fillProductNames(formData.value)
if (isProductMaterialStockIn.value) {
await loadRowsWarehouseAreas(formData.value)
diff --git a/src/views/erp/stock/out/components/StockOutItemForm.vue b/src/views/erp/stock/out/components/StockOutItemForm.vue
index 85c3470d..7aa7e97a 100644
--- a/src/views/erp/stock/out/components/StockOutItemForm.vue
+++ b/src/views/erp/stock/out/components/StockOutItemForm.vue
@@ -498,6 +498,27 @@ const productCascaderOptions = computed(() => {
return Array.from(map.values())
})
+const loadWarehouseList = async () => {
+ const categoryType = activeCategoryType.value
+ warehouseList.value = await WarehouseApi.getWarehouseSimpleList(categoryType ? { categoryType } : undefined)
+ const firstWarehouse = warehouseList.value[0]
+ defaultWarehouse.value = firstWarehouse
+ const warehouseIds = new Set((warehouseList.value || []).map((item) => item.id))
+ formData.value.forEach((row) => {
+ if (row.warehouseId && !warehouseIds.has(row.warehouseId)) {
+ row.warehouseId = undefined
+ row.areaId = undefined
+ row.stockCount = 0
+ }
+ if (!row.warehouseId && firstWarehouse?.id) {
+ row.warehouseId = firstWarehouse.id
+ row.areaId = undefined
+ row.stockCount = 0
+ }
+ })
+ warehouseAreaMap.value = {}
+}
+
/** 初始化设置入库项 */
watch(
() => props.items,
@@ -516,6 +537,7 @@ watch(
watch(
() => props.outType,
async () => {
+ await loadWarehouseList()
if (isProductMaterialStockOut.value) {
formData.value.forEach((row) => {
normalizeRow(row)
@@ -986,8 +1008,7 @@ defineExpose({ validate, resetItems })
/** 初始化 */
onMounted(async () => {
productList.value = await ProductApi.getProductSimpleList()
- warehouseList.value = await WarehouseApi.getWarehouseSimpleList()
- defaultWarehouse.value = warehouseList.value.find((item) => item.defaultStatus)
+ await loadWarehouseList()
fillProductNames(formData.value)
if (isProductMaterialStockOut.value) {
await loadRowsWarehouseAreas(formData.value)
diff --git a/src/views/erp/stock/warehouse/WarehouseForm.vue b/src/views/erp/stock/warehouse/WarehouseForm.vue
index 51254d9c..a3242d7e 100644
--- a/src/views/erp/stock/warehouse/WarehouseForm.vue
+++ b/src/views/erp/stock/warehouse/WarehouseForm.vue
@@ -14,6 +14,17 @@
+
+
+
+ {{ dict.label }}
+
+
+
{
formData.value = {
id: undefined,
name: undefined,
+ categoryType: undefined,
address: undefined,
sort: undefined,
remark: undefined,
diff --git a/src/views/erp/stock/warehouse/index.vue b/src/views/erp/stock/warehouse/index.vue
index fe505046..9e524ff8 100644
--- a/src/views/erp/stock/warehouse/index.vue
+++ b/src/views/erp/stock/warehouse/index.vue
@@ -18,6 +18,21 @@
class="!w-240px"
/>
+
+
+
+
+
+
+
+
+
+