Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 完成前端react页面【菜单管理】 #3463

Merged
merged 1 commit into from
Feb 1, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion ui/src/pages/Sys/Permission/menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {TableRowSelection} from "antd/es/table/interface";
import {Button, message, Modal} from 'antd';
import { DeleteOutlined, PlusOutlined } from '@ant-design/icons';
import {v7 as uuidV7} from 'uuid';
import {clearToken} from "@/access";

export default () => {

Expand Down Expand Up @@ -179,6 +178,25 @@ export default () => {
}}
>
修改
</a>,
<a key="remove" onClick={() => {
Modal.confirm({
title: '确认删除?',
content: '您确定要删除吗?',
okText: '确认',
cancelText: '取消',
onOk: () => {
removeV3([record?.id]).then(res => {
if (res.code === 'OK') {
message.success("删除成功").then()
// @ts-ignore
actionRef?.current?.reload();
}
})
Comment on lines +189 to +195
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

建议 (bug_risk): 为 removeV3 调用添加错误处理,并从 message.success 中删除不必要的 .then()

考虑为删除操作失败的情况添加错误处理。如果在显示消息后不需要进一步操作,message.success().then() 是不必要的。

Suggested change
removeV3([record?.id]).then(res => {
if (res.code === 'OK') {
message.success("删除成功").then()
// @ts-ignore
actionRef?.current?.reload();
}
})
removeV3([record?.id])
.then(res => {
if (res.code === 'OK') {
message.success("删除成功");
// @ts-ignore
actionRef?.current?.reload();
} else {
message.error("删除失败:" + res.message);
}
})
.catch(error => {
message.error("删除操作失败:" + error.message);
});
Original comment in English

suggestion (bug_risk): Add error handling for the removeV3 call and remove unnecessary .then() from message.success

Consider adding error handling for failed removal operations. Also, message.success().then() is unnecessary if no further actions are needed after showing the message.

Suggested change
removeV3([record?.id]).then(res => {
if (res.code === 'OK') {
message.success("删除成功").then()
// @ts-ignore
actionRef?.current?.reload();
}
})
removeV3([record?.id])
.then(res => {
if (res.code === 'OK') {
message.success("删除成功");
// @ts-ignore
actionRef?.current?.reload();
} else {
message.error("删除失败:" + res.message);
}
})
.catch(error => {
message.error("删除操作失败:" + error.message);
});

}
})
}}>
删除
</a>
],
},
Expand Down
Loading