feat(材料管理): 添加状态字段并优化表格显示
在材料管理模块中,添加了状态字段,并优化了表格的显示设置。具体包括: 1. 在i18n配置中添加了状态字段的翻译 2. 在材料组件中添加了状态字段的列 3. 在材料编辑组件中添加了状态字段的选择器 4. 优化了表格列的宽度设置和溢出显示 5. 更新了部门数据的状态字段值
This commit is contained in:
parent
df2d89a103
commit
be235807cc
@ -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
|
||||
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
|
||||
|
||||
|
@ -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<VxeFormInstance>();
|
||||
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,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
@ -95,6 +95,14 @@
|
||||
<vxe-input v-model="data.property" type="text" clearable data-cy="property" />
|
||||
</template>
|
||||
</vxe-form-item>
|
||||
<vxe-form-item field="status" :title="$t('jewpmsApp.material.status')" :item-render="{}">
|
||||
<template #default="{ data }">
|
||||
<vxe-select v-model="data.status" clearable data-cy="status">
|
||||
<vxe-option :value="null" :label="$t('entity.action.select')"></vxe-option>
|
||||
<vxe-option v-for="dict in statusDicts" :key="dict.number" :value="dict.number" :label="dict.name"></vxe-option>
|
||||
</vxe-select>
|
||||
</template>
|
||||
</vxe-form-item>
|
||||
<vxe-form-item field="sortNo" :title="$t('jewpmsApp.material.sortNo')" :item-render="{}">
|
||||
<template #default="{ data }">
|
||||
<vxe-input v-model="data.sortNo" type="number" min="0" exponential clearable data-cy="sortNo" />
|
||||
|
||||
@ -93,6 +93,11 @@ export default defineComponent({
|
||||
field: 'property',
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
title: $t('jewpmsApp.material.status'),
|
||||
field: 'status',
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
title: $t('jewpmsApp.material.remark'),
|
||||
field: 'remark',
|
||||
@ -103,15 +108,9 @@ export default defineComponent({
|
||||
field: 'sortNo',
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
title: $t('jewpmsApp.material.status'),
|
||||
field: 'status',
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
title: $t('entity.action.actions'),
|
||||
sortable: false,
|
||||
slots: { default: 'active' },
|
||||
width: 100,
|
||||
},
|
||||
];
|
||||
@ -248,6 +247,7 @@ export default defineComponent({
|
||||
removeRow,
|
||||
operatorSelect,
|
||||
changeOrder,
|
||||
statusDicts,
|
||||
tableRef,
|
||||
toolbarRef,
|
||||
pageChange,
|
||||
|
||||
@ -96,6 +96,7 @@
|
||||
:data="materials"
|
||||
:loading="isFetching"
|
||||
:sort-config="{ trigger: 'cell', remote: true }"
|
||||
:show-overflow="true"
|
||||
@sort-change="changeOrder"
|
||||
>
|
||||
<vxe-column
|
||||
@ -104,7 +105,7 @@
|
||||
:field="column.field"
|
||||
:title="$t(column.title)"
|
||||
:sortable="column.sortable"
|
||||
:min-width="column.minWidth"
|
||||
:width="column.width"
|
||||
>
|
||||
<template #default="{ row }" v-if="column.field === 'status'">
|
||||
{{ statusDicts.find(s => s.number === String(row.status))?.name || row.status }}
|
||||
|
||||
@ -73,13 +73,13 @@ export default defineComponent({
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
title: $t('jewpmsApp.stock.remark'),
|
||||
field: 'remark',
|
||||
title: $t('jewpmsApp.stock.status'),
|
||||
field: 'status',
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
title: $t('jewpmsApp.stock.status'),
|
||||
field: 'status',
|
||||
title: $t('jewpmsApp.stock.remark'),
|
||||
field: 'remark',
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
|
||||
@ -81,6 +81,7 @@
|
||||
:data="stocks"
|
||||
:loading="isFetching"
|
||||
:sort-config="{ trigger: 'cell', remote: true }"
|
||||
:show-overflow="true"
|
||||
@sort-change="changeOrder"
|
||||
>
|
||||
<vxe-column
|
||||
@ -89,7 +90,7 @@
|
||||
:field="column.field"
|
||||
:title="$t(column.title)"
|
||||
:sortable="column.sortable"
|
||||
:min-width="column.minWidth"
|
||||
:width="column.width"
|
||||
>
|
||||
<template #default="{ row }" v-if="column.field === 'status'">
|
||||
{{ statusDicts.find(s => s.number === String(row.status))?.name || row.status }}
|
||||
|
||||
@ -33,6 +33,7 @@
|
||||
"group5": "组别5",
|
||||
"property": "属性",
|
||||
"remark": "备注",
|
||||
"status": "状态",
|
||||
"sortNo": "排序号"
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user