diff --git a/apps/web-antd/src/components/global/index.ts b/apps/web-antd/src/components/global/index.ts
index cd5aa428..a5eee63e 100644
--- a/apps/web-antd/src/components/global/index.ts
+++ b/apps/web-antd/src/components/global/index.ts
@@ -12,3 +12,5 @@ export function setupGlobalComponent(app: App) {
// 表格操作列专用按钮
app.component('GhostButton', GhostButton);
}
+
+export { default as ApiSwitch } from './api-switch.vue';
diff --git a/apps/web-antd/src/views/system/role/data.tsx b/apps/web-antd/src/views/system/role/data.tsx
index 43184da3..f84391ea 100644
--- a/apps/web-antd/src/views/system/role/data.tsx
+++ b/apps/web-antd/src/views/system/role/data.tsx
@@ -131,7 +131,7 @@ export const drawerSchema: FormSchemaGetter = () => [
fieldName: 'roleSort',
label: '角色排序',
rules: 'required',
- defaultValue: 0,
+ defaultValue: 1,
},
{
component: 'Select',
diff --git a/apps/web-antd/src/views/system/role/index.vue b/apps/web-antd/src/views/system/role/index.vue
index 1aff61f1..4b961ff4 100644
--- a/apps/web-antd/src/views/system/role/index.vue
+++ b/apps/web-antd/src/views/system/role/index.vue
@@ -9,6 +9,12 @@ import { useRouter } from 'vue-router';
import { useAccess } from '@vben/access';
import { Page, useVbenDrawer, useVbenModal } from '@vben/common-ui';
+import {
+ ADMIN_ROLE_KEY,
+ EnableStatus,
+ SUPERADMIN_ROLE_ID,
+ SUPERADMIN_ROLE_KEY,
+} from '@vben/constants';
import { getVxePopupContainer } from '@vben/utils';
import { Modal, Popconfirm, Space } from 'antdv-next';
@@ -20,7 +26,7 @@ import {
roleList,
roleRemove,
} from '#/api/system/role';
-import { TableSwitch } from '#/components/table';
+import { ApiSwitch } from '#/components/global';
import { commonDownloadExcel } from '#/utils/file/download';
import { columns, querySchema } from './data';
@@ -122,7 +128,7 @@ function handleDownloadExcel() {
const { hasAccessByCodes, hasAccessByRoles } = useAccess();
-const isSuperAdmin = computed(() => hasAccessByRoles(['superadmin']));
+const isSuperAdmin = computed(() => hasAccessByRoles([SUPERADMIN_ROLE_KEY]));
const [RoleAuthModal, authModalApi] = useVbenModal({
connectedComponent: roleAuthModal,
@@ -137,6 +143,13 @@ const router = useRouter();
function handleAssignRole(record: Role) {
router.push(`/system/role-auth/user/${record.roleId}`);
}
+
+async function handleChangeStatus(checked: boolean, row: Role) {
+ await roleChangeStatus({
+ roleId: row.roleId,
+ status: checked ? EnableStatus.Enable : EnableStatus.Disable,
+ });
+}
@@ -169,12 +182,12 @@ function handleAssignRole(record: Role) {
-