From be235807cc97fbd11a76ebd45c700a606df2c299 Mon Sep 17 00:00:00 2001 From: user Date: Sun, 30 Mar 2025 17:24:23 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=9D=90=E6=96=99=E7=AE=A1=E7=90=86):=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=8A=B6=E6=80=81=E5=AD=97=E6=AE=B5=E5=B9=B6?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=A1=A8=E6=A0=BC=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在材料管理模块中,添加了状态字段,并优化了表格的显示设置。具体包括: 1. 在i18n配置中添加了状态字段的翻译 2. 在材料组件中添加了状态字段的列 3. 在材料编辑组件中添加了状态字段的选择器 4. 优化了表格列的宽度设置和溢出显示 5. 更新了部门数据的状态字段值 --- .../config/liquibase/data/depart.csv | 12 +++--- .../material/material-edit.component.ts | 38 ++++++++++++++++--- .../app/entities/material/material-edit.vue | 8 ++++ .../entities/material/material.component.ts | 12 +++--- .../webapp/app/entities/material/material.vue | 3 +- .../app/entities/stock/stock.component.ts | 8 ++-- src/main/webapp/app/entities/stock/stock.vue | 3 +- src/main/webapp/i18n/zh-cn/material.json | 1 + 8 files changed, 62 insertions(+), 23 deletions(-) diff --git a/src/main/resources/config/liquibase/data/depart.csv b/src/main/resources/config/liquibase/data/depart.csv index 6e32e6f..6572603 100644 --- a/src/main/resources/config/liquibase/data/depart.csv +++ b/src/main/resources/config/liquibase/data/depart.csv @@ -1,7 +1,7 @@ id;number;parent_number;name;property;remark;status;sort_no;region;organization;created_by;created_date;updated_by;updated_date;version -1;d001;;总部;总部;总部;1;1;r001;ORG001;system;2024-03-25 00:00:00;system;2024-03-25 00:00:00;0 -2;d002;d001;人事部;职能部门;人力资源管理;1;2;r001;ORG001;system;2024-03-25 00:00:00;system;2024-03-25 00:00:00;0 -3;d003;d001;财务部;职能部门;财务管理;1;3;r001;ORG001;system;2024-03-25 00:00:00;system;2024-03-25 00:00:00;0 -4;d004;d001;技术部;业务部门;技术研发;1;4;r001;ORG001;system;2024-03-25 00:00:00;system;2024-03-25 00:00:00;0 -5;d005;d004;开发组;技术团队;软件开发;1;5;r001;ORG001;system;2024-03-25 00:00:00;system;2024-03-25 00:00:00;0 -6;d006;d004;测试组;技术团队;质量保证;1;6;r001;ORG001;system;2024-03-25 00:00:00;system;2024-03-25 00:00:00;0 \ No newline at end of file +1;d001;;总部;总部;总部;1;1;REG001;ORG001;system;2024-03-25 00:00:00;system;2024-03-25 00:00:00;0 +2;d002;d001;人事部;职能部门;人力资源管理1;1;2;REG001;ORG001;system;2024-03-25 00:00:00;admin;2025-03-30 11:13:25;3 +3;d003;d001;财务部;职能部门;财务管理;0;3;REG001;ORG001;system;2024-03-25 00:00:00;admin;2025-03-30 11:15:39;1 +4;d004;d001;技术部;业务部门;技术研发;1;4;REG001;ORG001;system;2024-03-25 00:00:00;system;2024-03-25 00:00:00;0 +5;d005;d004;开发组;技术团队;软件开发;1;5;REG001;ORG001;system;2024-03-25 00:00:00;admin;2025-03-30 11:14:05;2 +6;d006;d004;测试组;技术团队;质量保证;1;6;REG001;ORG001;system;2024-03-25 00:00:00;system;2024-03-25 00:00:00;0 diff --git a/src/main/webapp/app/entities/material/material-edit.component.ts b/src/main/webapp/app/entities/material/material-edit.component.ts index 7e1dc9b..5609d9c 100644 --- a/src/main/webapp/app/entities/material/material-edit.component.ts +++ b/src/main/webapp/app/entities/material/material-edit.component.ts @@ -3,7 +3,7 @@ import { useI18n } from 'vue-i18n'; import { useAlertService } from '@/shared/alert/alert.service'; import { useRoute, useRouter } from 'vue-router'; import axios from 'axios'; -import type { VxeFormInstance } from 'vxe-table'; +import type { VxeFormInstance, VxeSelectInstance } from 'vxe-table'; export default defineComponent({ name: 'MaterialUpdate', @@ -16,6 +16,7 @@ export default defineComponent({ const loading = ref(false); const isSaving = ref(false); const materialForm = ref(); + const statusDicts = ref([]); const formRules = { number: [{ required: true, message: $t('entity.validation.required') }], name: [{ required: true, message: $t('entity.validation.required') }], @@ -39,16 +40,42 @@ export default defineComponent({ remark: '', sortNo: 0, version: 0, + status: '', }); const loadData = async () => { loading.value = true; try { - const materialId = route.params?.id; - if (materialId) { - const { data } = await axios.get(`api/materials/${materialId}`); - material.value = data; + const [materialRes, statusDictsRes] = await Promise.all([ + route.params?.id ? axios.get(`api/materials/${route.params.id}`) : Promise.resolve({ data: material.value }), + axios.get('api/dicts', { + params: { + number: { name: '' }, + name: { name: '' }, + property: { name: '' }, + parentNumber: { op: '=', value: 'StatusType' }, + status: { op: '=', value: '1' }, + }, + }), + ]); + + if (route.params?.id) { + material.value = materialRes.data; + } else { + // 设置新建material时的默认状态值 + const defaultStatus = statusDictsRes.data.find(item => { + try { + const propertyObj = JSON.parse(item.property || '{}'); + return propertyObj.default === 1; + } catch { + return false; + } + }); + if (defaultStatus) { + material.value.status = defaultStatus.number; + } } + statusDicts.value = statusDictsRes.data; } catch (e) { alertService.showHttpError(e); } finally { @@ -103,6 +130,7 @@ export default defineComponent({ previousState, save, clearInput, + statusDicts, }; }, }); diff --git a/src/main/webapp/app/entities/material/material-edit.vue b/src/main/webapp/app/entities/material/material-edit.vue index 5a4f773..528d2a3 100644 --- a/src/main/webapp/app/entities/material/material-edit.vue +++ b/src/main/webapp/app/entities/material/material-edit.vue @@ -95,6 +95,14 @@ + + +