mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-10-07 10:21:41 +00:00
fix(system): 优化部门、菜单、公告、岗位、角色和用户管理功能
- 增加创建、更新和删除操作的异常处理 - 优化错误提示信息 - 重置表单状态以解决数据残留问题 - 统一错误处理方式,使用 message 组件替代 notification
This commit is contained in:
@@ -435,11 +435,30 @@ const handleMoreClick: MenuProps['onClick'] = e => {
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
// 弹窗关键字处理
|
||||
const modalHandle = (modalType: string, record?: tableDataType) => {
|
||||
modalTitle.value = modalType;
|
||||
openModal.value = true;
|
||||
|
||||
// 重新创建 createState 和 updateState 以重置为初始状态
|
||||
Object.assign(createState, {
|
||||
name: '',
|
||||
order: 1,
|
||||
available: true,
|
||||
parent_id: undefined,
|
||||
description: ''
|
||||
});
|
||||
|
||||
Object.assign(updateState, {
|
||||
id: undefined,
|
||||
name: '',
|
||||
order: 1,
|
||||
available: true,
|
||||
parent_id: undefined,
|
||||
description: ''
|
||||
});
|
||||
|
||||
if (modalType === 'view' && record !== undefined) {
|
||||
detailStateLoading.value = true;
|
||||
detailState.value = record
|
||||
@@ -478,6 +497,7 @@ const handleModalSumbit = () => {
|
||||
loadingData();
|
||||
}).catch(error => {
|
||||
console.error(error);
|
||||
modalSubmitLoading.value = false;
|
||||
});
|
||||
}).catch(error => {
|
||||
modalSubmitLoading.value = false;
|
||||
|
||||
@@ -550,6 +550,42 @@ const modalHandle = (modalType: string, record?: tableDataType) => {
|
||||
modalTitle.value = modalType;
|
||||
openModal.value = true;
|
||||
|
||||
// 重新创建 createState 和 updateState 以重置为初始状态
|
||||
Object.assign(createState, {
|
||||
name: '',
|
||||
type: 1,
|
||||
icon: '',
|
||||
order: 1,
|
||||
permission: '',
|
||||
route_name: '',
|
||||
route_path: '',
|
||||
component_path: '',
|
||||
redirect: '',
|
||||
parent_id: undefined,
|
||||
cache: true,
|
||||
hidden: false,
|
||||
available: true,
|
||||
description: ''
|
||||
});
|
||||
|
||||
Object.assign(updateState, {
|
||||
id: undefined,
|
||||
name: '',
|
||||
type: 1,
|
||||
icon: '',
|
||||
order: 1,
|
||||
permission: '',
|
||||
route_name: '',
|
||||
route_path: '',
|
||||
component_path: '',
|
||||
redirect: '',
|
||||
parent_id: undefined,
|
||||
cache: true,
|
||||
hidden: false,
|
||||
available: true,
|
||||
description: ''
|
||||
});
|
||||
|
||||
if (modalType === 'view' && record !== undefined) {
|
||||
detailStateLoading.value = true;
|
||||
detailState.value = record;
|
||||
|
||||
@@ -380,6 +380,24 @@ const modalHandle = (modalType: string, index?: number) => {
|
||||
modalTitle.value = modalType;
|
||||
openModal.value = true;
|
||||
|
||||
// 重新创建 createState 和 updateState 以重置为初始状态
|
||||
Object.assign(createState, {
|
||||
notice_title: '',
|
||||
notice_type: 1,
|
||||
notice_content: '',
|
||||
available: true,
|
||||
description: ''
|
||||
});
|
||||
|
||||
Object.assign(updateState, {
|
||||
id: undefined,
|
||||
notice_title: '',
|
||||
notice_type: 1,
|
||||
notice_content: '',
|
||||
available: true,
|
||||
description: ''
|
||||
});
|
||||
|
||||
if (modalType === 'view' && index !== undefined) {
|
||||
detailStateLoading.value = true;
|
||||
|
||||
|
||||
@@ -348,6 +348,22 @@ const modalHandle = (modalType: string, index?: number) => {
|
||||
modalTitle.value = modalType;
|
||||
openModal.value = true;
|
||||
|
||||
// 重新创建 createState 和 updateState 以重置为初始状态
|
||||
Object.assign(createState, {
|
||||
name: '',
|
||||
order: 1,
|
||||
available: true,
|
||||
description: ''
|
||||
});
|
||||
|
||||
Object.assign(updateState, {
|
||||
id: undefined,
|
||||
name: '',
|
||||
order: 1,
|
||||
available: true,
|
||||
description: ''
|
||||
});
|
||||
|
||||
if (modalType === 'view' && index !== undefined) {
|
||||
detailStateLoading.value = true;
|
||||
|
||||
|
||||
@@ -408,6 +408,22 @@ const modalHandle = (modalType: string, index?: number) => {
|
||||
modalTitle.value = modalType;
|
||||
openModal.value = true;
|
||||
|
||||
// 重新创建 createState 和 updateState 以重置为初始状态
|
||||
Object.assign(createState, {
|
||||
name: '',
|
||||
order: 1,
|
||||
available: true,
|
||||
description: ''
|
||||
});
|
||||
|
||||
Object.assign(updateState, {
|
||||
id: undefined,
|
||||
name: '',
|
||||
order: 1,
|
||||
available: true,
|
||||
description: ''
|
||||
});
|
||||
|
||||
if (modalType === 'view' && index !== undefined) {
|
||||
detailStateLoading.value = true;
|
||||
|
||||
|
||||
@@ -639,6 +639,44 @@ const modalHandle = (modalType: string, index?: number) => {
|
||||
modalTitle.value = modalType;
|
||||
openModal.value = true;
|
||||
|
||||
// 重新创建 createState 和 updateState 以重置为初始状态
|
||||
Object.assign(createState, {
|
||||
username: '',
|
||||
name: '',
|
||||
dept_id: undefined,
|
||||
dept_name: '',
|
||||
role_ids: undefined,
|
||||
roleNames: undefined,
|
||||
position_ids: undefined,
|
||||
positionNames: undefined,
|
||||
password: '',
|
||||
gender: undefined,
|
||||
email: '',
|
||||
mobile: '',
|
||||
is_superuser: false,
|
||||
available: true,
|
||||
description: ''
|
||||
});
|
||||
|
||||
Object.assign(updateState, {
|
||||
id: undefined,
|
||||
username: '',
|
||||
name: '',
|
||||
dept_id: undefined,
|
||||
dept_name: '',
|
||||
role_ids: [],
|
||||
roleNames: undefined,
|
||||
position_ids: [],
|
||||
positionNames: undefined,
|
||||
password: '',
|
||||
gender: undefined,
|
||||
email: '',
|
||||
mobile: '',
|
||||
is_superuser: false,
|
||||
available: true,
|
||||
description: '',
|
||||
});
|
||||
|
||||
if (modalType === 'view' && index !== undefined) {
|
||||
detailStateLoading.value = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user