diff --git a/src/api/assets/location/index.ts b/src/api/assets/location/index.ts index 1906259..4cae51d 100644 --- a/src/api/assets/location/index.ts +++ b/src/api/assets/location/index.ts @@ -20,6 +20,9 @@ export interface LocationData { warehouseId?: string; zoneId: string; maxCapacity?: number; + capacityUnit?: string; + capacityUnitType: string; + status?: string; remark?: string; } @@ -76,3 +79,11 @@ export function updateLocationStatus(data: { id: string; status: string }) { data, }); } + +// 获取容量单位类型 +export function getCapacityUnitType() { + return newService({ + url: '/assets/location/getCapacityUnitType', + method: 'get', + }); +} diff --git a/src/views/assets/location/component/editLocation.vue b/src/views/assets/location/component/editLocation.vue index 4b30456..f6610a8 100644 --- a/src/views/assets/location/component/editLocation.vue +++ b/src/views/assets/location/component/editLocation.vue @@ -51,12 +51,26 @@ - - + + + + + + + + + + + + + + + + @@ -91,7 +105,7 @@ export default { import { ref, reactive, computed } from 'vue'; import { ElMessage } from 'element-plus'; import type { FormInstance, FormRules } from 'element-plus'; -import { createLocation, updateLocation, getLocation } from '/@/api/assets/location'; +import { createLocation, updateLocation, getLocation, getCapacityUnitType } from '/@/api/assets/location'; // 定义props const props = defineProps<{ @@ -110,6 +124,9 @@ const isShowDialog = ref(false); const isEdit = ref(false); const submitLoading = ref(false); +// 容量单位类型选项 +const capacityUnitTypeOptions = ref<{ label: string; value: string }[]>([]); + // 表单数据 const ruleForm = reactive({ id: '', @@ -119,6 +136,8 @@ const ruleForm = reactive({ warehouseId: '', zoneId: '', status: 'idle', + capacityUnitType: '', + capacityUnit: '', maxCapacity: 0, remark: '', }); @@ -140,6 +159,7 @@ const onWarehouseChange = () => { const rules = reactive({ locationName: [{ required: true, message: '请输入库位名称', trigger: 'blur' }], zoneId: [{ required: true, message: '请选择所属库区', trigger: 'change' }], + capacityUnitType: [{ required: true, message: '请选择容量单位类型', trigger: 'change' }], }); // 重置表单 @@ -151,15 +171,35 @@ const resetForm = () => { ruleForm.warehouseId = ''; ruleForm.zoneId = ''; ruleForm.status = 'idle'; + ruleForm.capacityUnitType = ''; + ruleForm.capacityUnit = ''; ruleForm.maxCapacity = 0; ruleForm.remark = ''; }; +// 加载容量单位类型选项 +const loadCapacityUnitTypeOptions = async () => { + try { + const res: any = await getCapacityUnitType(); + if (res.data?.options && Array.isArray(res.data.options)) { + capacityUnitTypeOptions.value = res.data.options.map((item: any) => ({ + label: item.value, + value: item.key, + })); + } + } catch (error) { + console.error('获取容量单位类型失败:', error); + } +}; + // 打开弹窗 const openDialog = async (row?: any) => { resetForm(); isEdit.value = !!row; + // 加载容量单位类型选项 + await loadCapacityUnitTypeOptions(); + if (row) { try { const res: any = await getLocation(row.id); @@ -171,6 +211,8 @@ const openDialog = async (row?: any) => { ruleForm.warehouseId = data.warehouseId || ''; ruleForm.zoneId = data.zoneId || ''; ruleForm.status = data.status || 'idle'; + ruleForm.capacityUnitType = data.capacityUnitType || ''; + ruleForm.capacityUnit = data.capacityUnit || ''; ruleForm.maxCapacity = data.maxCapacity || 0; ruleForm.remark = data.remark || ''; } catch (error) { @@ -204,6 +246,8 @@ const onSubmit = async () => { warehouseId: ruleForm.warehouseId, zoneId: ruleForm.zoneId, status: ruleForm.status, + capacityUnitType: ruleForm.capacityUnitType, + capacityUnit: ruleForm.capacityUnit, maxCapacity: ruleForm.maxCapacity, remark: ruleForm.remark, }; diff --git a/src/views/assets/location/index.vue b/src/views/assets/location/index.vue index 1aebabf..3f5bc01 100644 --- a/src/views/assets/location/index.vue +++ b/src/views/assets/location/index.vue @@ -21,8 +21,8 @@ - - + + @@ -205,9 +205,9 @@ const getStatusTagType = (status: string) => { return 'success'; case 'occupied': return 'warning'; - case 'locked': + case 'disable': return 'danger'; - case 'maintenance': + case 'reserved': return 'info'; default: return 'info'; @@ -221,10 +221,10 @@ const getStatusText = (status: string) => { return '空闲'; case 'occupied': return '占用'; - case 'locked': - return '锁定'; - case 'maintenance': - return '维护'; + case 'disable': + return '禁用'; + case 'reserved': + return '预留'; default: return status; } diff --git a/src/views/assets/warehouse/component/editWarehouse.vue b/src/views/assets/warehouse/component/editWarehouse.vue index c633132..4c3b95c 100644 --- a/src/views/assets/warehouse/component/editWarehouse.vue +++ b/src/views/assets/warehouse/component/editWarehouse.vue @@ -107,6 +107,7 @@ const validatePhone = (rule: any, value: string, callback: any) => { // 表单验证规则 const rules = reactive({ warehouseName: [{ required: true, message: '请输入仓库名称', trigger: 'blur' }], + warehouseCode: [{ required: true, message: '请输入仓库编码', trigger: 'blur' }], contactPhone: [{ validator: validatePhone, trigger: 'blur' }], }); diff --git a/src/views/assets/zone/component/editZone.vue b/src/views/assets/zone/component/editZone.vue index c6232e3..c74bb42 100644 --- a/src/views/assets/zone/component/editZone.vue +++ b/src/views/assets/zone/component/editZone.vue @@ -98,6 +98,8 @@ const ruleForm = reactive({ const rules = reactive({ zoneName: [{ required: true, message: '请输入库区名称', trigger: 'blur' }], warehouseId: [{ required: true, message: '请选择所属仓库', trigger: 'change' }], + zoneCode: [{ required: true, message: '库区编码', trigger: 'blur' }], + zoneType: [{ required: true, message: '库区类型', trigger: 'change' }], }); // 重置表单 diff --git a/src/views/assets/zone/index.vue b/src/views/assets/zone/index.vue index a1432db..ed13d52 100644 --- a/src/views/assets/zone/index.vue +++ b/src/views/assets/zone/index.vue @@ -40,7 +40,6 @@ -