From 95b97314a291b8f9125ccacb92a163d765407a7f Mon Sep 17 00:00:00 2001 From: WUSIJIAN <13825895+wsj0228@user.noreply.gitee.com> Date: Fri, 27 Feb 2026 18:00:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8=E5=BA=93=E4=BD=8D=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E4=B8=AD=E6=96=B0=E5=A2=9E=E5=AE=B9=E9=87=8F=E5=8D=95=E4=BD=8D?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E5=92=8C=E5=AE=B9=E9=87=8F=E5=8D=95=E4=BD=8D?= =?UTF-8?q?=E5=AD=97=E6=AE=B5,=E8=B0=83=E6=95=B4=E5=BA=93=E4=BD=8D?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E9=80=89=E9=A1=B9,=E5=9C=A8=E4=BB=93?= =?UTF-8?q?=E5=BA=93=E5=92=8C=E5=BA=93=E5=8C=BA=E7=AE=A1=E7=90=86=E4=B8=AD?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=BF=85=E5=A1=AB=E5=AD=97=E6=AE=B5=E9=AA=8C?= =?UTF-8?q?=E8=AF=81,=E7=A7=BB=E9=99=A4=E5=BA=93=E5=8C=BA=E5=AE=B9?= =?UTF-8?q?=E9=87=8F=E5=88=97=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/assets/location/index.ts | 11 ++++ .../location/component/editLocation.vue | 50 +++++++++++++++++-- src/views/assets/location/index.vue | 16 +++--- .../warehouse/component/editWarehouse.vue | 1 + src/views/assets/zone/component/editZone.vue | 2 + src/views/assets/zone/index.vue | 5 +- 6 files changed, 71 insertions(+), 14 deletions(-) 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 @@ -