feat:仓库信息/出入库单据-添加仓库分类

main
黄伟杰 6 days ago
parent 0f1bb51d5e
commit 124083fe5e

@ -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 })
},
// 查询仓库详情

@ -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',

@ -267,6 +267,7 @@
ErpStock: {
Warehouse: {
name: '仓库名称',
categoryType: '仓库分类',
status: '仓库状态',
address: '仓库地址',
warehousePrice: '仓储费',
@ -277,6 +278,7 @@
defaultStatus: '是否默认',
createTime: '创建时间',
placeholderName: '请输入仓库名称',
placeholderCategoryType: '请选择仓库分类',
placeholderStatus: '请选择仓库状态',
placeholderAddress: '请输入仓库地址',
placeholderPrincipal: '请输入负责人',

@ -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)

@ -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)

@ -14,6 +14,17 @@
<el-form-item :label="t('ErpStock.Warehouse.address')" prop="address">
<el-input v-model="formData.address" :placeholder="t('ErpStock.Warehouse.placeholderAddress')" />
</el-form-item>
<el-form-item :label="t('ErpStock.Warehouse.categoryType')" prop="categoryType">
<el-radio-group v-model="formData.categoryType">
<el-radio
v-for="dict in getIntDictOptions(DICT_TYPE.MATERIAL_CLASSIFICATION_TYPE)"
:key="dict.value"
:label="dict.value"
>
{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item :label="t('ErpStock.Warehouse.status')" prop="status">
<el-radio-group v-model="formData.status">
<el-radio
@ -82,6 +93,7 @@ const formType = ref('') // 表单的类型create - 新增update - 修改
const formData = ref({
id: undefined,
name: undefined,
categoryType: undefined,
address: undefined,
sort: undefined,
remark: undefined,
@ -144,6 +156,7 @@ const resetForm = () => {
formData.value = {
id: undefined,
name: undefined,
categoryType: undefined,
address: undefined,
sort: undefined,
remark: undefined,

@ -18,6 +18,21 @@
class="!w-240px"
/>
</el-form-item>
<el-form-item :label="t('ErpStock.Warehouse.categoryType')" prop="categoryType">
<el-select
v-model="queryParams.categoryType"
:placeholder="t('ErpStock.Warehouse.placeholderCategoryType')"
clearable
class="!w-240px"
>
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.MATERIAL_CLASSIFICATION_TYPE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('ErpStock.Warehouse.status')" prop="status">
<el-select
v-model="queryParams.status"
@ -76,6 +91,11 @@
>
<!-- <el-table-column width="30" :label="t('action.select')" type="selection" /> -->
<el-table-column :label="t('ErpStock.Warehouse.name')" align="center" prop="name" sortable />
<el-table-column :label="t('ErpStock.Warehouse.categoryType')" align="center" prop="categoryType">
<template #default="scope">
<dict-tag :type="DICT_TYPE.MATERIAL_CLASSIFICATION_TYPE" :value="scope.row.categoryType" />
</template>
</el-table-column>
<el-table-column :label="t('ErpStock.Warehouse.address')" align="center" prop="address" />
<!-- <el-table-column
label="仓储费"
@ -159,6 +179,9 @@
<div v-if="detailData">
<el-descriptions :column="2" border>
<el-descriptions-item :label="t('ErpStock.Warehouse.name')">{{ detailData.name }}</el-descriptions-item>
<el-descriptions-item :label="t('ErpStock.Warehouse.categoryType')">
<dict-tag :type="DICT_TYPE.MATERIAL_CLASSIFICATION_TYPE" :value="detailData.categoryType" />
</el-descriptions-item>
<el-descriptions-item :label="t('ErpStock.Warehouse.address')">{{ detailData.address }}</el-descriptions-item>
<el-descriptions-item :label="t('ErpStock.Warehouse.principal')">{{ detailData.principal }}</el-descriptions-item>
<el-descriptions-item :label="t('ErpStock.Warehouse.remark')">{{ detailData.remark || '-' }}</el-descriptions-item>
@ -248,6 +271,7 @@ const queryParams = reactive({
pageNo: 1,
pageSize: 10,
name: undefined,
categoryType: undefined,
status: undefined
})
const queryFormRef = ref() //

Loading…
Cancel
Save