Files
xk-admin/apps/web-antd/src/views/system/role/components/sync-admin-menu-modal.vue
李琦 02672b16bd
Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CI / CI OK (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Deploy Website on push / Rerun on failure (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
feat: 公账周期账单与合并明细优化,退款弹窗与开方成功页按钮换行
周期账单生成与变动记录抽屉;查看合并按账单日 Tabs;退款原因必填;开方成功页操作按钮自动换行。
2026-08-26 15:09:57 +08:00

85 lines
2.6 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script lang="ts" setup>
/**
* 同步管理员管理菜单为预设管理员角色补全「管理员」菜单组73 + 对应子页)
*/
import { ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { Alert, message } from 'ant-design-vue';
import { countMissingAdminMenus, syncAdminManagementMenus } from '../api';
const missingCount = ref(0);
const missingRoleIds = ref<number[]>([]);
const gridApi = ref();
const [Modal, modalApi] = useVbenModal({
fullscreenButton: false,
draggable: true,
onCancel() {
modalApi.close();
},
onConfirm: async () => {
modalApi.setState({ loading: true, confirmLoading: true });
try {
const res = await syncAdminManagementMenus();
const synced = res?.synced_count ?? 0;
if (synced > 0) {
message.success(`已为 ${synced} 个角色补全管理员管理菜单(含父级菜单链)`);
} else {
message.info('未发现需要补全的管理员菜单');
}
gridApi.value?.reload?.();
modalApi.close();
} catch (err) {
console.error(err);
} finally {
modalApi.setState({ loading: false, confirmLoading: false });
}
},
onOpenChange: async (isOpen) => {
if (!isOpen) {
return;
}
gridApi.value = modalApi.getData()?.gridApi;
modalApi.setState({ loading: true });
try {
const res = await countMissingAdminMenus();
missingCount.value = res?.count ?? 0;
missingRoleIds.value = res?.role_ids ?? [];
} catch (err) {
console.error(err);
} finally {
modalApi.setState({ loading: false });
}
},
});
defineExpose(modalApi);
</script>
<template>
<Modal class="w-[80%] md:w-[50%]" title="同步管理员管理菜单">
<Alert
class="mb-4"
show-icon
type="info"
:message="
missingCount > 0
? `${missingCount} 个预设管理员角色缺少「管理员」菜单组`
: '各预设管理员角色的「管理员」菜单已齐全'
"
:description="
missingCount > 0
? `待补全角色 ID${missingRoleIds.join('、')}(将追加菜单 4→21→73 及对应子页)`
: '可点击确定执行一次幂等检查;若侧栏仍无「管理员」菜单,请让对应账号重新登录'
"
/>
<div class="text-sm text-[hsl(var(--muted-foreground))]">
自动为可识别的管理员角色补全基础管理 RBAC管理 管理员 子页整条菜单链
预设角色按 ID 匹配自定义角色按角色代码value与菜单路径匹配仅追加缺失项
</div>
</Modal>
</template>