| | |
| | | default-expand-all |
| | | show-checkbox |
| | | ref="moduleTree" |
| | | :default-checked-keys="checkedModules" |
| | | :default-checked-keys="initModeluChecked()" |
| | | > |
| | | <template #default="{ node }"> |
| | | <div class="custom-tree-node"> |
| | |
| | | <script setup lang="ts"> |
| | | import { computed, reactive, watch } from 'vue'; |
| | | import * as baseModuleServices from '@/services/api/BaseModule'; |
| | | import * as baseModuleNewServices from '@/services/api/BaseModuleNew'; |
| | | import { Message } from '@bole-core/core'; |
| | | import { AuthorizeType, SubModuleType, SubModuleTitle } from '@/constants'; |
| | | import { |
| | | AuthorizeType, |
| | | SubModuleType, |
| | | SubModuleTitle, |
| | | EnumMenuSceneText, |
| | | EnumMenuScene, |
| | | } from '@/constants'; |
| | | import { getTree } from '@/utils'; |
| | | import { templateRef } from '@vueuse/core'; |
| | | import { PropType } from 'vue'; |
| | | |
| | | const TypeTip = defineComponent({ |
| | | name: 'TypeTip', |
| | |
| | | render() { |
| | | const { typeTip, isMenu } = this; |
| | | const tipText = isMenu ? `菜单` : '页面'; |
| | | console.log(typeTip); |
| | | return h( |
| | | 'span', |
| | | { |
| | |
| | | authorizeType: { |
| | | type: String, |
| | | default: 'Role', |
| | | }, |
| | | menuScene: { |
| | | type: Number as PropType<EnumMenuScene>, |
| | | default: EnumMenuScene.Back, |
| | | }, |
| | | }); |
| | | const emit = defineEmits<{ |
| | |
| | | props.authorizeType === 'Role' ? '角色功能授权' : '账号功能授权' |
| | | ); |
| | | const checkedModules = computed(() => initModeluChecked()); |
| | | console.log('checkedModules: ', checkedModules); |
| | | const checkedPageButton = computed(() => initChecked(2)); |
| | | const checkedDataButton = computed(() => initChecked(3)); |
| | | const checkedDataColumn = computed(() => initChecked(4)); |
| | |
| | | async function getModulesByUserOrRoleId(id) { |
| | | const { authorizeType } = props; |
| | | |
| | | const data = { |
| | | const data: API.APIgetUserOrRoleModuleListParams = { |
| | | objectType: AuthorizeType[authorizeType], |
| | | id, |
| | | menuScene: props.menuScene, |
| | | }; |
| | | |
| | | const result = await baseModuleServices.getUserOrRoleModuleList(data); |
| | | const result = await baseModuleNewServices.getUserOrRoleModuleList(data); |
| | | |
| | | state.sysModules = getTree(result, null); |
| | | elModuleTree.value.setCheckedKeys(result.filter((x) => x.hasCheck).map((x) => x.id)); |
| | |
| | | }); |
| | | } |
| | | }); |
| | | console.log('state.checkedInfo: ', state.checkedInfo); |
| | | } |
| | | |
| | | async function getExtendsByRoleOrUser(data) { |