index.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <template>
  2. <fs-page>
  3. <fs-crud ref="crudRef" v-bind="crudBinding"> </fs-crud>
  4. <PermissionDrawerCom />
  5. <BatchTagsDialog ref="batchTagsDialogRef" :crudExpose="crudExpose" />
  6. </fs-page>
  7. </template>
  8. <script lang="ts" setup name="role">
  9. import { defineAsyncComponent, onMounted, ref } from 'vue';
  10. import { useFs } from '@fast-crud/fast-crud';
  11. import { createCrudOptions } from './crud';
  12. import { RoleDrawerStores } from './stores/RoleDrawerStores';
  13. import { RoleMenuBtnStores } from './stores/RoleMenuBtnStores';
  14. import { RoleMenuFieldStores } from './stores/RoleMenuFieldStores';
  15. import { RoleUsersStores } from './stores/RoleUsersStores';
  16. import { successMessage } from '../../../utils/message';
  17. const PermissionDrawerCom = defineAsyncComponent(() => import('./components/RoleDrawer.vue'));
  18. const BatchTagsDialog = defineAsyncComponent(() => import('./components/BatchTagsDialog.vue'));
  19. const batchTagsDialogRef = ref();
  20. const RoleDrawer = RoleDrawerStores(); // 角色-抽屉
  21. const RoleMenuBtn = RoleMenuBtnStores(); // 角色-菜单
  22. const RoleMenuField = RoleMenuFieldStores();// 角色-菜单-字段
  23. const RoleUsers = RoleUsersStores();// 角色-用户
  24. const { crudBinding, crudRef, crudExpose } = useFs({
  25. createCrudOptions,
  26. context: {
  27. RoleDrawer,
  28. RoleMenuBtn,
  29. RoleMenuField,
  30. $message: {
  31. warning: (msg: string) => successMessage(msg)
  32. },
  33. openBatchTagsDialog: (selection) => {
  34. batchTagsDialogRef.value.open(selection);
  35. }
  36. },
  37. });
  38. // 页面打开后获取列表数据
  39. onMounted(async () => {
  40. // 刷新
  41. crudExpose.doRefresh();
  42. // 获取全部用户
  43. RoleUsers.get_all_users();
  44. });
  45. </script>