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