修复权限界面添加成员到角色时的反馈提示错误

This commit is contained in:
jingrow 2025-11-18 05:11:54 +08:00
parent 0f3d164c6c
commit 2fd23b06ca

View File

@ -133,7 +133,6 @@
import { Switch, Tabs, TabList, TabPanel } from 'jingrow-ui';
import { toast } from 'vue-sonner';
import UserWithAvatarCell from '../UserWithAvatarCell.vue';
import { getToastErrorMessage } from '../../utils/toast';
export default {
props: {
@ -288,21 +287,31 @@ export default {
},
methods: {
addUser(user) {
return toast.promise(this.$resources.role.addUser.submit({ user }), {
loading: `正在将 ${user} 添加到 ${this.role.title}`,
success: () => {
this.member = {};
return `${user} 已添加到 ${this.role.title}`;
},
error: (e) => getToastErrorMessage(e),
});
if (!user) return;
if (this.$resources.role.addUser.loading) return;
toast.success(`已添加 ${user}${this.role.title}`, { duration: 2000 });
this.member = {};
this.$resources.role.addUser.submit({ user });
//
setTimeout(() => {
if (this.$resources.role) {
this.$resources.role.reload();
}
}, 500);
},
removeUser(user) {
return toast.promise(this.$resources.role.removeUser.submit({ user }), {
loading: `正在将 ${user}${this.role.title} 中移除`,
success: () => `${user} 已从 ${this.role.title} 中移除`,
error: (e) => getToastErrorMessage(e),
});
if (!user) return;
if (this.$resources.role.removeUser.loading) return;
toast.success(`已从 ${this.role.title} 中移除 ${user}`, { duration: 2000 });
this.$resources.role.removeUser.submit({ user });
//
setTimeout(() => {
if (this.$resources.role) {
this.$resources.role.reload();
}
}, 500);
},
},
};