| | |
| | | "Component": true, |
| | | "ComponentPublicInstance": true, |
| | | "ComputedRef": true, |
| | | "DataRangeEnum": true, |
| | | "DataRangeEnumText": true, |
| | | "DirectiveBinding": true, |
| | | "EditorType": true, |
| | | "EditorTypeText": true, |
| | |
| | | "EnumResourceController": true, |
| | | "EnumResourceMethod": true, |
| | | "EnumRoleWebApiDataPower": true, |
| | | "EnumRoleWebApiDataPowerText": true, |
| | | "EnumRoleWebApiDataPowerTextForFilter": true, |
| | | "EnumUserType": true, |
| | | "EnumUserTypeText": true, |
| | | "ExtractDefaultPropTypes": true, |
| | |
| | | const EnumResourceController: typeof import('./src/constants/apiEnum')['EnumResourceController'] |
| | | const EnumResourceMethod: typeof import('./src/constants/apiEnum')['EnumResourceMethod'] |
| | | const EnumRoleWebApiDataPower: typeof import('./src/constants/apiEnum')['EnumRoleWebApiDataPower'] |
| | | const EnumRoleWebApiDataPowerText: typeof import('./src/constants/apiEnumText')['EnumRoleWebApiDataPowerText'] |
| | | const EnumRoleWebApiDataPowerTextForFilter: typeof import('./src/constants/apiEnumText')['EnumRoleWebApiDataPowerTextForFilter'] |
| | | const EnumUserType: typeof import('./src/constants/apiEnum')['EnumUserType'] |
| | | const EnumUserTypeText: typeof import('./src/constants/apiEnumText')['EnumUserTypeText'] |
| | | const EnumWebApiMethod: typeof import('./src/constants/apiEnum')['EnumWebApiMethod'] |
| | |
| | | export type { EnterpriseConfigureType, FlexEnterpriseSettingStatus, FlexEnterpriseStatus, VerifyStatus, FlexEnterpriseCertificationStatus, MessageChannelEnum, SignChannelEnum, ChargeTypeEnum, EnterpriseConfigureType, FlexEnterpriseSettingStatus, FlexEnterpriseStatus, VerifyStatus, FlexEnterpriseCertificationStatus, MessageChannelEnum, SignChannelEnum, ChargeTypeEnum } from './src/constants/enterprise' |
| | | import('./src/constants/enterprise') |
| | | // @ts-ignore |
| | | export type { AreaType, DataRangeEnum, AuthorizeType, Gender, AreaType, DataRangeEnum, AuthorizeType, Gender } from './src/constants/enum' |
| | | export type { AreaType, AuthorizeType, Gender, AreaType, AuthorizeType, Gender } from './src/constants/enum' |
| | | import('./src/constants/enum') |
| | | // @ts-ignore |
| | | export type { SubModuleType, FastBtn, SubModuleType } from './src/constants/module' |
| | |
| | | readonly BooleanOptions: UnwrapRef<typeof import('./src/constants/enum')['BooleanOptions']> |
| | | readonly ChargeTypeEnum: UnwrapRef<typeof import('./src/constants/enterprise')['ChargeTypeEnum']> |
| | | readonly ChargeTypeEnumText: UnwrapRef<typeof import('./src/constants/enterprise')['ChargeTypeEnumText']> |
| | | readonly DataRangeEnum: UnwrapRef<typeof import('./src/constants/enum')['DataRangeEnum']> |
| | | readonly DataRangeEnumText: UnwrapRef<typeof import('./src/constants/enum')['DataRangeEnumText']> |
| | | readonly EditorType: UnwrapRef<typeof import('./src/constants/editor')['EditorType']> |
| | | readonly EditorTypeText: UnwrapRef<typeof import('./src/constants/editor')['EditorTypeText']> |
| | | readonly EffectScope: UnwrapRef<typeof import('vue')['EffectScope']> |
| | |
| | | readonly EnumResourceController: UnwrapRef<typeof import('./src/constants/apiEnum')['EnumResourceController']> |
| | | readonly EnumResourceMethod: UnwrapRef<typeof import('./src/constants/apiEnum')['EnumResourceMethod']> |
| | | readonly EnumRoleWebApiDataPower: UnwrapRef<typeof import('./src/constants/apiEnum')['EnumRoleWebApiDataPower']> |
| | | readonly EnumRoleWebApiDataPowerText: UnwrapRef<typeof import('./src/constants/apiEnumText')['EnumRoleWebApiDataPowerText']> |
| | | readonly EnumRoleWebApiDataPowerTextForFilter: UnwrapRef<typeof import('./src/constants/apiEnumText')['EnumRoleWebApiDataPowerTextForFilter']> |
| | | readonly EnumUserType: UnwrapRef<typeof import('./src/constants/apiEnum')['EnumUserType']> |
| | | readonly EnumUserTypeText: UnwrapRef<typeof import('./src/constants/apiEnumText')['EnumUserTypeText']> |
| | | readonly FastButtonMap: UnwrapRef<typeof import('./src/constants/module')['FastButtonMap']> |
| | |
| | | "dependencies": { |
| | | "@bole-12333/chat-kit": "latest", |
| | | "@bole-12333/customer-chat": "latest", |
| | | "@bole-core/components": "^1.3.12", |
| | | "@bole-core/components": "^1.3.13", |
| | | "@bole-core/core": "latest", |
| | | "@bole-core/pretty-layout": "latest", |
| | | "@bole-core/sass-utils": "latest", |
| | |
| | | specifier: latest |
| | | version: 1.0.3(@bole-12333/chat-kit@1.0.1)(@tiptap/core@2.1.13)(@tiptap/extension-document@2.1.13)(@tiptap/extension-image@2.1.13)(@tiptap/extension-mention@2.1.13)(@tiptap/extension-paragraph@2.1.13)(@tiptap/extension-placeholder@2.1.13)(@tiptap/extension-text@2.1.13)(@tiptap/pm@2.1.13)(@tiptap/suggestion@2.1.13)(dayjs@1.11.6)(vue@3.5.11) |
| | | '@bole-core/components': |
| | | specifier: ^1.3.12 |
| | | version: 1.3.12(@bole-core/core@1.0.2)(@bole-core/sass-utils@0.0.1)(@element-plus/icons-vue@2.3.1)(@tanstack/vue-query@4.37.1)(@videojs-player/vue@1.0.0)(@vueuse/core@11.1.0)(@vueuse/shared@11.1.0)(dayjs@1.11.6)(element-plus@2.8.4)(lodash@4.17.21)(mitt@3.0.0)(senin-help@1.0.5)(senin-vue@1.0.4)(video.js@7.20.3)(vue-component-type-helpers@2.1.6)(vue@3.5.11) |
| | | specifier: ^1.3.13 |
| | | version: 1.3.13(@bole-core/core@1.0.2)(@bole-core/sass-utils@0.0.1)(@element-plus/icons-vue@2.3.1)(@tanstack/vue-query@4.37.1)(@videojs-player/vue@1.0.0)(@vueuse/core@11.1.0)(@vueuse/shared@11.1.0)(dayjs@1.11.6)(element-plus@2.8.4)(lodash@4.17.21)(mitt@3.0.0)(senin-help@1.0.5)(senin-vue@1.0.4)(video.js@7.20.3)(vue-component-type-helpers@2.1.6)(vue@3.5.11) |
| | | '@bole-core/core': |
| | | specifier: latest |
| | | version: 1.0.2(@ywwlmm/openapi@0.0.3)(ali-oss@6.21.0)(axios@1.7.7)(dayjs@1.11.6)(element-plus@2.8.4)(file-saver@2.0.5)(jszip@3.10.1)(lodash@4.17.21)(senior-request@1.0.1)(vue-router@4.4.5)(vue@3.5.11)(xlsx-style@0.8.13)(xlsx@0.18.5) |
| | |
| | | vue: 3.5.11(typescript@4.8.4) |
| | | dev: false |
| | | |
| | | /@bole-core/components@1.3.12(@bole-core/core@1.0.2)(@bole-core/sass-utils@0.0.1)(@element-plus/icons-vue@2.3.1)(@tanstack/vue-query@4.37.1)(@videojs-player/vue@1.0.0)(@vueuse/core@11.1.0)(@vueuse/shared@11.1.0)(dayjs@1.11.6)(element-plus@2.8.4)(lodash@4.17.21)(mitt@3.0.0)(senin-help@1.0.5)(senin-vue@1.0.4)(video.js@7.20.3)(vue-component-type-helpers@2.1.6)(vue@3.5.11): |
| | | resolution: {integrity: sha512-TBWzg41B+1CTyVUhPNnULx3xQNhgnON8j8s+3uB8pRWHBHE2m+jSCSkE7IsmaSW3jSteTVeNdVCN2XKOIJ2PYQ==} |
| | | /@bole-core/components@1.3.13(@bole-core/core@1.0.2)(@bole-core/sass-utils@0.0.1)(@element-plus/icons-vue@2.3.1)(@tanstack/vue-query@4.37.1)(@videojs-player/vue@1.0.0)(@vueuse/core@11.1.0)(@vueuse/shared@11.1.0)(dayjs@1.11.6)(element-plus@2.8.4)(lodash@4.17.21)(mitt@3.0.0)(senin-help@1.0.5)(senin-vue@1.0.4)(video.js@7.20.3)(vue-component-type-helpers@2.1.6)(vue@3.5.11): |
| | | resolution: {integrity: sha512-14vVgnE0syul+Zdn1IRdRQYjfbP0WdyTW4QQPN8+5eoWZ/b9AL/0lWt15otFFdfUcOf7/uTtkPm8bsw4dOgphg==} |
| | | peerDependencies: |
| | | '@bole-core/core': '*' |
| | | '@bole-core/sass-utils': '*' |
| | |
| | | /** 分页列表排序 */ |
| | | export enum EnumPagedListOrder { |
| | | /**升序 */ |
| | | Ascending = 0, |
| | | Asc = 0, |
| | | /**降序 */ |
| | | Descending = 1, |
| | | Desc = 1, |
| | | } |
| | | |
| | | /** 资源控制器 */ |
| | |
| | | import { EnumClientType, EnumUserType } from './apiEnum'; |
| | | import { EnumClientType, EnumUserType, EnumRoleWebApiDataPower } from './apiEnum'; |
| | | |
| | | export const EnumClientTypeText = { |
| | | [EnumClientType.PcWeb]: '电脑网页', |
| | |
| | | [EnumUserType.Enterprise]: '企业', |
| | | [EnumUserType.Operation]: '运营', |
| | | }; |
| | | |
| | | export const EnumRoleWebApiDataPowerText = { |
| | | [EnumRoleWebApiDataPower.Custom]: '自定义', |
| | | [EnumRoleWebApiDataPower.Creator]: '个人数据', |
| | | [EnumRoleWebApiDataPower.CurrentDepartment]: '当前部门数据', |
| | | [EnumRoleWebApiDataPower.NestingDepartment]: '当前及下级部门数据', |
| | | [EnumRoleWebApiDataPower.CurrentEnterprise]: '当前企业所有数据', |
| | | [EnumRoleWebApiDataPower.All]: '全部数据', |
| | | }; |
| | | |
| | | export const EnumRoleWebApiDataPowerTextForFilter = { |
| | | [EnumRoleWebApiDataPower.Creator]: '个人数据', |
| | | [EnumRoleWebApiDataPower.All]: '全部数据', |
| | | }; |
| | |
| | | Town, |
| | | } |
| | | |
| | | // 数据可见范围 |
| | | export enum DataRangeEnum { |
| | | /** |
| | | * 全部数据 |
| | | */ |
| | | All = 100, |
| | | /** |
| | | * 个人数据 |
| | | */ |
| | | Person = 10, |
| | | } |
| | | |
| | | export const DataRangeEnumText = { |
| | | [DataRangeEnum.All]: '全部数据', |
| | | [DataRangeEnum.Person]: '个人数据', |
| | | }; |
| | | |
| | | export enum AuthorizeType { |
| | | Role = 1, |
| | | User, |
| | |
| | | }, |
| | | { |
| | | id: '2', |
| | | enCode: 'enCode', |
| | | enCode: 'code', |
| | | name: '编号', |
| | | }, |
| | | { |
| | | id: '3', |
| | | enCode: 'sortCode', |
| | | enCode: 'sort', |
| | | name: '排序', |
| | | width: 80, |
| | | }, |
| | |
| | | import { useQuery } from '@tanstack/vue-query'; |
| | | import { useQueryClient } from '@tanstack/vue-query'; |
| | | import { useQuery, useQueryClient } from '@tanstack/vue-query'; |
| | | import { SearchType } from '@/constants'; |
| | | |
| | | type UseSearchSettingTypeOptions = { |
| | |
| | | export * from './useUser'; |
| | | export * from './help'; |
| | | export * from './dic'; |
| | | export * from './menu'; |
New file |
| | |
| | | import * as menuServices from '@/services/api/menu'; |
| | | import { flattenTree } from '@/utils'; |
| | | import { DaPengAccessAdapter } from '@bole-core/components'; |
| | | import { useQuery, useQueryClient } from '@tanstack/vue-query'; |
| | | |
| | | type UseMenusOptions = { |
| | | params: MaybeRef<API.APIgetMenusParams>; |
| | | enabled?: MaybeRef<boolean>; |
| | | }; |
| | | |
| | | export function useMenus({ params, enabled = true }: UseMenusOptions) { |
| | | const queryClient = useQueryClient(); |
| | | |
| | | const { data, refetch } = useQuery({ |
| | | queryKey: ['menuServices/getMenus', params], |
| | | queryFn: async () => { |
| | | return await menuServices.getMenus(unref(params), { |
| | | showLoading: false, |
| | | }); |
| | | }, |
| | | placeholderData: () => [] as API.GetMenusQueryResultItem[], |
| | | staleTime: Infinity, |
| | | enabled: enabled, |
| | | }); |
| | | |
| | | const flattenMenus = computed(() => flattenTree(data.value)); |
| | | |
| | | function getMenuById(id: string) { |
| | | return flattenMenus.value.find((item) => item.id === id); |
| | | } |
| | | |
| | | return { |
| | | menusTree: data, |
| | | refetch, |
| | | getMenuById, |
| | | }; |
| | | } |
| | | |
| | | type UseMenuOptions = { |
| | | params: MaybeRef<API.APIgetMenuParams>; |
| | | enabled?: MaybeRef<boolean>; |
| | | }; |
| | | |
| | | export function useMenu({ params, enabled = true }: UseMenuOptions) { |
| | | const queryClient = useQueryClient(); |
| | | |
| | | const { data, refetch } = useQuery({ |
| | | queryKey: ['menuServices/getMenu', params], |
| | | queryFn: async () => { |
| | | return await menuServices.getMenu(unref(params), { |
| | | showLoading: false, |
| | | }); |
| | | }, |
| | | placeholderData: () => ({} as API.GetMenuQueryResult), |
| | | enabled: enabled, |
| | | }); |
| | | |
| | | const menuDefaultGroup = computed( |
| | | () => DaPengAccessAdapter.getMenuGroupAdapter(data.value?.groups ?? []) ?? {} |
| | | ); |
| | | |
| | | const menuFields = computed(() => { |
| | | return menuDefaultGroup.value.fields ?? []; |
| | | }); |
| | | |
| | | const menuPageButtons = computed(() => { |
| | | const pageButtonLocation = DaPengAccessAdapter.getButtonLocationAdapter( |
| | | menuDefaultGroup.value, |
| | | SubModuleKey[SubModuleType.PageButton] |
| | | ); |
| | | return pageButtonLocation?.buttons ?? []; |
| | | }); |
| | | |
| | | const menuDataButtons = computed(() => { |
| | | const pageButtonLocation = DaPengAccessAdapter.getButtonLocationAdapter( |
| | | menuDefaultGroup.value, |
| | | SubModuleKey[SubModuleType.DataButton] |
| | | ); |
| | | return pageButtonLocation?.buttons ?? []; |
| | | }); |
| | | |
| | | return { |
| | | menu: data, |
| | | refetch, |
| | | menuFields, |
| | | menuPageButtons, |
| | | menuDataButtons, |
| | | }; |
| | | } |
| | |
| | | return useBoleAccess({ |
| | | queryKey: ['baseModuleServices/getCurrentSubModuleList', { moduleId }], |
| | | service: async () => { |
| | | const res = await menuServices.getMenu({ id: moduleId }); |
| | | const res = await menuServices.getMenu( |
| | | { id: moduleId }, |
| | | { |
| | | showLoading: false, |
| | | } |
| | | ); |
| | | return DaPengAccessAdapter.menuAdapter({ groups: res.groups, moduleId }); |
| | | }, |
| | | ...options, |
| | |
| | | // @ts-ignore |
| | | import { request } from '@/utils/request'; |
| | | |
| | | /** 此处后端没有提供注释 GET /api/user/auth/getAliyunOSSAcs */ |
| | | /** 获取阿里云OSS授权信息 GET /api/user/auth/getAliyunOSSAcs */ |
| | | export async function getAliyunOSSAcs( |
| | | // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) |
| | | params: API.APIgetAliyunOSSAcsParams, |
| | |
| | | }); |
| | | } |
| | | |
| | | /** 此处后端没有提供注释 POST /api/user/auth/passwordLogin */ |
| | | /** 获取当前登录用户菜单 GET /api/user/auth/getCurrentLogierMenus */ |
| | | export async function getCurrentLogierMenus( |
| | | // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) |
| | | params: API.APIgetCurrentLogierMenusParams, |
| | | options?: API.RequestConfig |
| | | ) { |
| | | return request<API.GetMenusQueryResultItem[]>('/api/user/auth/getCurrentLogierMenus', { |
| | | method: 'GET', |
| | | params: { |
| | | ...params, |
| | | request: undefined, |
| | | ...params['request'], |
| | | }, |
| | | ...(options || {}), |
| | | }); |
| | | } |
| | | |
| | | /** 密码登录 POST /api/user/auth/passwordLogin */ |
| | | export async function passwordLogin(body: API.PasswordLoginCommand, options?: API.RequestConfig) { |
| | | return request<API.PasswordLoginCommandCallback>('/api/user/auth/passwordLogin', { |
| | | method: 'POST', |
| | |
| | | // @ts-ignore |
| | | import { request } from '@/utils/request'; |
| | | |
| | | /** 此处后端没有提供注释 POST /api/main/dictionary/getDictionaryDatas */ |
| | | /** 获取字典数据分页列表 POST /api/main/dictionary/getDictionaryDatas */ |
| | | export async function getDictionaryDatas( |
| | | body: API.GetDictionaryDatasQuery, |
| | | options?: API.RequestConfig |
| | |
| | | // @ts-ignore |
| | | import { request } from '@/utils/request'; |
| | | |
| | | /** 此处后端没有提供注释 DELETE /api/user/menu/deleteMenu */ |
| | | /** 删除菜单 DELETE /api/user/menu/deleteMenu */ |
| | | export async function deleteMenu(body: API.DeleteMenuCommand, options?: API.RequestConfig) { |
| | | return request<number>('/api/user/menu/deleteMenu', { |
| | | method: 'DELETE', |
| | |
| | | }); |
| | | } |
| | | |
| | | /** 此处后端没有提供注释 GET /api/user/menu/getMenu */ |
| | | /** 查询菜单详情 GET /api/user/menu/getMenu */ |
| | | export async function getMenu( |
| | | // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) |
| | | params: API.APIgetMenuParams, |
| | |
| | | }); |
| | | } |
| | | |
| | | /** 此处后端没有提供注释 GET /api/user/menu/getMenus */ |
| | | /** 查询菜单列表 GET /api/user/menu/getMenus */ |
| | | export async function getMenus( |
| | | // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) |
| | | params: API.APIgetMenusParams, |
| | |
| | | }); |
| | | } |
| | | |
| | | /** 此处后端没有提供注释 POST /api/user/menu/saveMenu */ |
| | | /** 保存菜单 POST /api/user/menu/saveMenu */ |
| | | export async function saveMenu(body: API.SaveMenuCommand, options?: API.RequestConfig) { |
| | | return request<string>('/api/user/menu/saveMenu', { |
| | | method: 'POST', |
| | |
| | | }); |
| | | } |
| | | |
| | | /** 此处后端没有提供注释 POST /api/user/menu/saveMenuButton */ |
| | | /** 保存菜单按钮 POST /api/user/menu/saveMenuButton */ |
| | | export async function saveMenuButton(body: API.SaveMenuButtonCommand, options?: API.RequestConfig) { |
| | | return request<string>('/api/user/menu/saveMenuButton', { |
| | | method: 'POST', |
| | |
| | | }); |
| | | } |
| | | |
| | | /** 此处后端没有提供注释 POST /api/user/menu/saveMenuField */ |
| | | /** 保存菜单字段 POST /api/user/menu/saveMenuField */ |
| | | export async function saveMenuField(body: API.SaveMenuFieldCommand, options?: API.RequestConfig) { |
| | | return request<string>('/api/user/menu/saveMenuField', { |
| | | method: 'POST', |
| | |
| | | }); |
| | | } |
| | | |
| | | /** 此处后端没有提供注释 PUT /api/user/menu/setMenuSwitch */ |
| | | /** 设置菜单切换信息 PUT /api/user/menu/setMenuSwitch */ |
| | | export async function setMenuSwitch(body: API.SetMenuSwitchCommand, options?: API.RequestConfig) { |
| | | return request<number>('/api/user/menu/setMenuSwitch', { |
| | | method: 'PUT', |
| | |
| | | // @ts-ignore |
| | | import { request } from '@/utils/request'; |
| | | |
| | | /** 此处后端没有提供注释 GET /api/user/resource/getResourceFields */ |
| | | /** 获取资源字段 GET /api/user/resource/getResourceFields */ |
| | | export async function getResourceFields( |
| | | // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) |
| | | params: API.APIgetResourceFieldsParams, |
| | |
| | | }); |
| | | } |
| | | |
| | | /** 此处后端没有提供注释 GET /api/user/resource/getResources */ |
| | | /** 获取资源列表 GET /api/user/resource/getResources */ |
| | | export async function getResources( |
| | | // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) |
| | | params: API.APIgetResourcesParams, |
| | |
| | | // @ts-ignore |
| | | import { request } from '@/utils/request'; |
| | | |
| | | /** 此处后端没有提供注释 DELETE /api/user/role/deleteRole */ |
| | | /** 删除角色 DELETE /api/user/role/deleteRole */ |
| | | export async function deleteRole(body: API.DeleteRoleCommand, options?: API.RequestConfig) { |
| | | return request<number>('/api/user/role/deleteRole', { |
| | | method: 'DELETE', |
| | |
| | | }); |
| | | } |
| | | |
| | | /** 此处后端没有提供注释 GET /api/user/role/getRole */ |
| | | /** 查询角色详情 GET /api/user/role/getRole */ |
| | | export async function getRole( |
| | | // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) |
| | | params: API.APIgetRoleParams, |
| | |
| | | }); |
| | | } |
| | | |
| | | /** 此处后端没有提供注释 POST /api/user/role/getRoles */ |
| | | /** 查询角色分页列表 POST /api/user/role/getRoles */ |
| | | export async function getRoles(body: API.GetRolesQuery, options?: API.RequestConfig) { |
| | | return request<API.PagedListQueryResultGetRolesQueryResultItem>('/api/user/role/getRoles', { |
| | | method: 'POST', |
| | |
| | | }); |
| | | } |
| | | |
| | | /** 此处后端没有提供注释 POST /api/user/role/saveRole */ |
| | | /** 保存角色 POST /api/user/role/saveRole */ |
| | | export async function saveRole(body: API.SaveRoleCommand, options?: API.RequestConfig) { |
| | | return request<string>('/api/user/role/saveRole', { |
| | | method: 'POST', |
| | |
| | | request?: GetAliyunOSSAcsQuery; |
| | | } |
| | | |
| | | interface APIgetCurrentLogierMenusParams { |
| | | /** 获取当前登录用户菜单 */ |
| | | request?: GetCurrentLogierMenusQuery; |
| | | } |
| | | |
| | | interface APIgetMenuParams { |
| | | /** Id */ |
| | | id?: string; |
| | |
| | | |
| | | enum EnumPagedListOrder { |
| | | /**升序 */ |
| | | Ascending = 0, |
| | | Asc = 0, |
| | | /**降序 */ |
| | | Descending = 1, |
| | | Desc = 1, |
| | | } |
| | | |
| | | enum EnumResourceController { |
| | |
| | | requestId?: string; |
| | | } |
| | | |
| | | type GetCurrentLogierMenusQuery = Record<string, any>; |
| | | |
| | | interface GetDictionaryDatasQuery { |
| | | pageModel?: PagedListQueryPageModel; |
| | | } |
| | |
| | | clientType?: EnumClientType; |
| | | /** 最低级别 */ |
| | | minLevel?: number; |
| | | dataPower?: EnumRoleWebApiDataPower; |
| | | /** 备注 */ |
| | | remark?: string; |
| | | /** 菜单Id */ |
| | | menuIds?: string[]; |
| | | /** 资源 */ |
| | |
| | | clientType?: EnumClientType; |
| | | /** 最低级别 */ |
| | | minLevel?: number; |
| | | dataPower?: EnumRoleWebApiDataPower; |
| | | /** 备注 */ |
| | | remark?: string; |
| | | } |
| | | |
| | | interface PagedListQueryPageModel { |
| | |
| | | clientType?: EnumClientType; |
| | | /** 最低级别 */ |
| | | minLevel?: number; |
| | | dataPower?: EnumRoleWebApiDataPower; |
| | | /** 备注 */ |
| | | remark?: string; |
| | | /** 菜单Id */ |
| | | menuIds?: string[]; |
| | | /** 资源 */ |
| | |
| | | return new Promise((resolve) => { |
| | | if (userInfo.accessToken && $config.withCredentials) { |
| | | $config.headers['Authorization'] = 'Bearer ' + userInfo.accessToken; |
| | | $config.headers['X-Authorizatio'] = 'Bearer ' + userInfo.refreshToken; |
| | | $config.headers['X-Authorization'] = 'Bearer ' + userInfo.refreshToken; |
| | | resolve($config); |
| | | } else { |
| | | resolve($config); |
| | |
| | | const userStore = useUserStoreHook(); |
| | | |
| | | if (response.headers['x-access-token']) { |
| | | console.log('response: ', response); |
| | | userStore.setToken(response.headers['access-token']); |
| | | userStore.setUserInfo({ |
| | | accessToken: response.headers['access-token'], |
| | |
| | | <ProTableQueryFilterBar @on-reset="reset"> |
| | | <template #query> |
| | | <QueryFilterItem> |
| | | <FieldRadio |
| | | v-model="extraParamState.clientType" |
| | | :value-enum="EnumClientTypeText" |
| | | buttonStyle |
| | | @change="getList()" |
| | | /> |
| | | </QueryFilterItem> |
| | | <QueryFilterItem> |
| | | <FieldRadio |
| | | v-model="extraParamState.userType" |
| | | :value-enum="EnumUserTypeText" |
| | | buttonStyle |
| | | @change="getList()" |
| | | /> |
| | | </QueryFilterItem> |
| | | <QueryFilterItem> |
| | | <SearchInput |
| | | v-model="extraParamState.queryCondition" |
| | | style="width: 200px" |
| | |
| | | </ProTableV2> |
| | | </AppContainer> |
| | | <AddOrEditRoleDialog v-bind="dialogProps" /> |
| | | <DialogAuthorize v-model:authorizeId="rowState.authorizeId" authorizeType="Role" /> |
| | | <DialogAuthorizeV2 v-bind="dialogAuthorizeProps" authorizeType="Role" /> |
| | | <!-- <DialogMember v-model:visibleId="rowState.setMemberRoleId" /> --> |
| | | </LoadingLayout> |
| | | </template> |
| | |
| | | QueryFilterItem, |
| | | useTable, |
| | | useFormDialog, |
| | | FieldRadio, |
| | | } from '@bole-core/components'; |
| | | import { useAccess, useAllRoleList } from '@/hooks'; |
| | | import { Message, OrderInputType } from '@bole-core/core'; |
| | | import { Message } from '@bole-core/core'; |
| | | import AddOrEditRoleDialog from './components/AddOrEditRoleDialog.vue'; |
| | | import { DataRangeEnum, DataRangeEnumText } from '@/constants'; |
| | | import DialogAuthorize from './components/dialogAuthorize.vue'; |
| | | import { EnumClientTypeText, EnumUserTypeText } from '@/constants'; |
| | | import DialogAuthorizeV2 from './components/dialogAuthorizeV2.vue'; |
| | | import * as roleServices from '@/services/api/role'; |
| | | |
| | | defineOptions({ |
| | | name: 'RoleManage', |
| | |
| | | operationBtnMap, |
| | | }); |
| | | |
| | | const { refetch } = useAllRoleList(); |
| | | |
| | | const BaseState = { |
| | | loading: true, |
| | | }; |
| | |
| | | } = useTable( |
| | | async ({ pageIndex, pageSize }, extraParamState) => { |
| | | try { |
| | | // let params: API.GetRolesInput = { |
| | | // pageModel: { |
| | | // rows: pageSize, |
| | | // page: pageIndex, |
| | | // orderInput: [{ property: 'sequence', order: OrderInputType.Asc }], |
| | | // }, |
| | | // queryCondition: extraParamState.queryCondition, |
| | | // }; |
| | | // let res = await userServices.getRoles(params, { |
| | | // showLoading: !state.loading, |
| | | // }); |
| | | // return { |
| | | // data: res.data, |
| | | // pageModel: { |
| | | // rows: pageSize, |
| | | // page: pageIndex, |
| | | // totalCount: res.pageModel.totalCount, |
| | | // }, |
| | | // }; |
| | | return {}; |
| | | let params: API.GetRolesQuery = { |
| | | pageModel: { |
| | | rows: pageSize, |
| | | page: pageIndex, |
| | | orderInput: extraParamState.orderInput, |
| | | }, |
| | | userType: extraParamState.userType, |
| | | clientType: extraParamState.clientType, |
| | | }; |
| | | let res = await roleServices.getRoles(params, { |
| | | showLoading: !state.loading, |
| | | }); |
| | | return res; |
| | | } catch (error) {} |
| | | }, |
| | | { |
| | | defaultExtraParams: { |
| | | queryCondition: '', |
| | | orderInput: [{ property: 'id', order: EnumPagedListOrder.Desc }], |
| | | userType: EnumUserType.Operation, |
| | | clientType: EnumClientType.PcWeb, |
| | | }, |
| | | queryKey: ['userRoleServices/getRoles'], |
| | | queryKey: ['roleServices/getRoles'], |
| | | columnsRenderProps: { |
| | | dataPower: { type: 'enum', valueEnum: EnumRoleWebApiDataPowerText }, |
| | | }, |
| | | } |
| | | ); |
| | | |
| | | function openDialog(row?: API.RoleInfo) { |
| | | if (row) { |
| | | handleEdit({ |
| | | id: row.id, |
| | | name: row.name, |
| | | remark: row.remark, |
| | | dataRange: row.dataRange, |
| | | }); |
| | | } else { |
| | | handleAdd(); |
| | | } |
| | | async function openDialog(row?: API.GetRolesQueryResultItem) { |
| | | try { |
| | | if (row) { |
| | | const detail = await roleServices.getRole({ id: row.id }); |
| | | handleEdit({ |
| | | id: row.id, |
| | | name: row.name, |
| | | remark: row.remark, |
| | | userType: row.userType, |
| | | clientType: row.clientType, |
| | | dataRange: row.dataPower, |
| | | detail: detail, |
| | | }); |
| | | } else { |
| | | handleAdd(); |
| | | } |
| | | } catch (error) {} |
| | | } |
| | | |
| | | const { dialogProps, handleAdd, handleEdit, editForm, dialogState } = useFormDialog({ |
| | |
| | | id: '', |
| | | name: '', |
| | | remark: '', |
| | | dataRange: DataRangeEnum.All, |
| | | userType: EnumUserType.Operation, |
| | | clientType: EnumClientType.PcWeb, |
| | | dataRange: EnumRoleWebApiDataPower.All, |
| | | detail: null as API.GetRoleQueryResult, |
| | | }, |
| | | }); |
| | | |
| | | async function handleAddOrEdit() { |
| | | try { |
| | | const isEdit = editForm.id; |
| | | // let params: API.CreateOrUpdateRoleInput = { |
| | | // name: editForm.name, |
| | | // remark: editForm.remark, |
| | | // dataRange: editForm.dataRange, |
| | | // }; |
| | | // let res; |
| | | // if (isEdit) { |
| | | // params.id = editForm.id; |
| | | // res = await userServices.updateRole(params); |
| | | // } else { |
| | | // res = await userServices.createRole(params); |
| | | // } |
| | | // if (res) { |
| | | // Message.successMessage('操作成功'); |
| | | // getList(isEdit ? paginationState.pageIndex : 1); |
| | | // refetch({ type: 'inactive' }); |
| | | // } |
| | | let params: API.SaveRoleCommand = { |
| | | name: editForm.name, |
| | | remark: editForm.remark, |
| | | dataPower: editForm.dataRange, |
| | | userType: editForm.userType, |
| | | clientType: editForm.clientType, |
| | | }; |
| | | if (isEdit) { |
| | | params = { |
| | | ...editForm.detail, |
| | | ...params, |
| | | }; |
| | | } |
| | | let res = await roleServices.saveRole(params); |
| | | if (res) { |
| | | Message.successMessage('操作成功'); |
| | | getList(isEdit ? paginationState.pageIndex : 1); |
| | | } |
| | | } catch (error) {} |
| | | } |
| | | |
| | | async function handleDeleteRole(row: API.RoleInfo) { |
| | | async function handleDeleteRole(row: API.GetRolesQueryResultItem) { |
| | | try { |
| | | // await Message.deleteMessage(); |
| | | // let params = { |
| | | // id: row.id, |
| | | // }; |
| | | // let res = await userServices.deleteRole(params); |
| | | // if (res) { |
| | | // Message.successMessage('操作成功'); |
| | | // getList(paginationState.pageIndex); |
| | | // refetch({ type: 'inactive' }); |
| | | // } |
| | | await Message.deleteMessage(); |
| | | let params: API.DeleteRoleCommand = { |
| | | ids: [row.id], |
| | | }; |
| | | let res = await roleServices.deleteRole(params); |
| | | if (res) { |
| | | Message.successMessage('操作成功'); |
| | | getList(paginationState.pageIndex); |
| | | } |
| | | } catch (error) {} |
| | | } |
| | | |
| | | async function roleEnableOrForbid(row: API.RoleInfo) { |
| | | async function roleEnableOrForbid(row: API.GetRolesQueryResultItem) { |
| | | try { |
| | | // await Message.tipMessage(`是否${!row.isEnable ? '启用' : '禁用'}角色`); |
| | | // let res = await userServices.roleEnableOrForbid({ |
| | |
| | | setMemberRoleId: '', |
| | | }); |
| | | |
| | | function openAuthorizeDialog(row: API.IdentityRoleDto) { |
| | | rowState.authorizeId = row.id; |
| | | const { |
| | | dialogProps: dialogAuthorizeProps, |
| | | handleAdd: handleAuthorizeAdd, |
| | | editForm: authorizeForm, |
| | | } = useFormDialog({ |
| | | onConfirm: handleAuthorize, |
| | | defaultFormParams: { |
| | | detail: null as API.GetRoleQueryResult, |
| | | }, |
| | | }); |
| | | |
| | | async function openAuthorizeDialog(row: API.GetRolesQueryResultItem) { |
| | | try { |
| | | const detail = await roleServices.getRole({ id: row.id }); |
| | | handleAuthorizeAdd({ |
| | | detail: detail, |
| | | }); |
| | | } catch (error) {} |
| | | } |
| | | |
| | | async function handleAuthorize(selectedMenuIds: string[], resourceIds: string[]) { |
| | | try { |
| | | // let params: API.SaveRoleCommand = { |
| | | // ...authorizeForm.detail, |
| | | // menuIds: selectedMenuIds, |
| | | // resources: resourceIds.map((x) => ({ |
| | | // resourceId: x, |
| | | // dataPower: EnumRoleWebApiDataPower.All, |
| | | // })), |
| | | // }; |
| | | // let res = await roleServices.saveRole(params); |
| | | // if (res) { |
| | | // Message.successMessage('操作成功'); |
| | | // getList(paginationState.pageIndex); |
| | | // } |
| | | } catch (error) {} |
| | | } |
| | | |
| | | // function openMemberDialog(row: API.IdentityRoleDto) { |
| | |
| | | <ProFormItemV2 label="数据可见范围" prop="dataRange"> |
| | | <ProFormRadio |
| | | v-model="form.dataRange" |
| | | :value-enum="DataRangeEnumText" |
| | | :value-enum="EnumRoleWebApiDataPowerTextForFilter" |
| | | :buttonStyle="false" |
| | | ></ProFormRadio> |
| | | </ProFormItemV2> |
| | |
| | | ProFormRadio, |
| | | ProFormTextArea, |
| | | } from '@bole-core/components'; |
| | | import { DataRangeEnumText, DataRangeEnum } from '@/constants'; |
| | | import { EnumRoleWebApiDataPowerTextForFilter } from '@/constants'; |
| | | |
| | | defineOptions({ |
| | | name: 'AddOrEditRoleDialog', |
| | |
| | | title?: string; |
| | | name: string; |
| | | remark: string; |
| | | dataRange: DataRangeEnum; |
| | | dataRange: EnumRoleWebApiDataPower; |
| | | }; |
| | | }; |
| | | |
| | |
| | | render() { |
| | | const { typeTip, isMenu } = this; |
| | | const tipText = isMenu ? `菜单` : '页面'; |
| | | console.log(typeTip); |
| | | return h( |
| | | 'span', |
| | | { |
| | |
| | | }), |
| | | }; |
| | | |
| | | const result = await baseModuleServices.addAuthorizeModule(data); |
| | | if (result) { |
| | | Message.successMessage('授权成功!'); |
| | | } else { |
| | | Message.errorMessage('授权失败!'); |
| | | } |
| | | // const result = await baseModuleServices.addAuthorizeModule(data); |
| | | // if (result) { |
| | | // Message.successMessage('授权成功!'); |
| | | // } else { |
| | | // Message.errorMessage('授权失败!'); |
| | | // } |
| | | handleClose(); |
| | | } catch (error) {} |
| | | } |
| | |
| | | id, |
| | | }; |
| | | |
| | | const result = await baseModuleServices.getUserOrRoleModuleList(data); |
| | | // const result = await baseModuleServices.getUserOrRoleModuleList(data); |
| | | |
| | | state.sysModules = getTree(result, null); |
| | | elModuleTree.value.setCheckedKeys(result.filter((x) => x.hasCheck).map((x) => x.id)); |
| | | // state.sysModules = getTree(result, null); |
| | | // elModuleTree.value.setCheckedKeys(result.filter((x) => x.hasCheck).map((x) => x.id)); |
| | | |
| | | initAuthorizeInfo(result, 1); |
| | | // initAuthorizeInfo(result, 1); |
| | | |
| | | getExtendsByRoleOrUser(data); |
| | | } |
| | |
| | | |
| | | async function getExtendsByRoleOrUser(data) { |
| | | try { |
| | | let result = await baseModuleServices.getUserOrRoleSubModuleList(data); |
| | | const { pageButton, dataButton, column } = result; |
| | | initAuthorizeInfo(pageButton, 2, 'pageButton'); |
| | | initAuthorizeInfo(dataButton, 3, 'dataButton'); |
| | | initAuthorizeInfo(column, 4, 'dataColumn'); |
| | | // let result = await baseModuleServices.getUserOrRoleSubModuleList(data); |
| | | // const { pageButton, dataButton, column } = result; |
| | | // initAuthorizeInfo(pageButton, 2, 'pageButton'); |
| | | // initAuthorizeInfo(dataButton, 3, 'dataButton'); |
| | | // initAuthorizeInfo(column, 4, 'dataColumn'); |
| | | } catch (error) { |
| | | console.log(error); |
| | | } |
New file |
| | |
| | | <template> |
| | | <ProDialog |
| | | class="custom-dialog" |
| | | width="55%" |
| | | :title="dialogTitle" |
| | | v-model="visible" |
| | | :top="'10vh'" |
| | | :close-on-click-modal="false" |
| | | :close-on-press-escape="false" |
| | | > |
| | | <div class="authorize-wrapper"> |
| | | <div class="container-wrapper left-wrapper"> |
| | | <el-scrollbar> |
| | | <el-tree |
| | | class="companyTree" |
| | | :data="menusTree" |
| | | :props="{ |
| | | children: 'children', |
| | | label: 'name', |
| | | }" |
| | | node-key="id" |
| | | :expand-on-click-node="false" |
| | | :highlight-current="true" |
| | | default-expand-all |
| | | show-checkbox |
| | | ref="moduleTree" |
| | | :default-checked-keys="checkedModules" |
| | | > |
| | | <template #default="{ node }"> |
| | | <div class="custom-tree-node"> |
| | | <type-tip :isMenu="node.data.type === EnumMenuType.Menu" /> |
| | | <div class="node-text" @click="handleSelectModule(node.data)"> |
| | | {{ node.label }} |
| | | </div> |
| | | </div> |
| | | </template> |
| | | </el-tree> |
| | | </el-scrollbar> |
| | | </div> |
| | | |
| | | <div class="container-wrapper"> |
| | | <div class="type-wrapper"> |
| | | {{ SubModuleTitle[SubModuleType.PageButton] }} |
| | | </div> |
| | | <el-scrollbar> |
| | | <el-tree |
| | | v-show="!!state.currentMenuId" |
| | | :data="[ |
| | | { |
| | | name: '全选', |
| | | id: 'pageButtonAll', |
| | | children: menuPageButtons, |
| | | }, |
| | | ]" |
| | | :props="{ |
| | | children: 'children', |
| | | label: 'name', |
| | | }" |
| | | node-key="id" |
| | | :expand-on-click-node="false" |
| | | :highlight-current="true" |
| | | default-expand-all |
| | | show-checkbox |
| | | ref="pageButtonTree" |
| | | :default-checked-keys="checkedPageButton" |
| | | > |
| | | <template #default="{ node }"> |
| | | <div class="custom-tree-node"> |
| | | <span>{{ node.label }}</span> |
| | | </div> |
| | | </template> |
| | | </el-tree> |
| | | </el-scrollbar> |
| | | </div> |
| | | |
| | | <div class="container-wrapper"> |
| | | <div class="type-wrapper"> |
| | | {{ SubModuleTitle[SubModuleType.DataButton] }} |
| | | </div> |
| | | <el-scrollbar> |
| | | <el-tree |
| | | v-show="!!state.currentMenuId" |
| | | :data="[ |
| | | { |
| | | name: '全选', |
| | | id: 'dataButtonAll', |
| | | children: menuDataButtons, |
| | | }, |
| | | ]" |
| | | :props="{ |
| | | children: 'children', |
| | | label: 'name', |
| | | }" |
| | | node-key="id" |
| | | :expand-on-click-node="false" |
| | | :highlight-current="true" |
| | | default-expand-all |
| | | show-checkbox |
| | | ref="dataButtonTree" |
| | | :default-checked-keys="checkedDataButton" |
| | | > |
| | | <template #default="{ node }"> |
| | | <div class="custom-tree-node"> |
| | | <span>{{ node.label }}</span> |
| | | </div> |
| | | </template> |
| | | </el-tree> |
| | | </el-scrollbar> |
| | | </div> |
| | | |
| | | <div class="container-wrapper"> |
| | | <div class="type-wrapper"> |
| | | {{ SubModuleTitle[SubModuleType.Column] }} |
| | | </div> |
| | | <el-scrollbar> |
| | | <el-tree |
| | | v-show="!!state.currentMenuId" |
| | | :data="[ |
| | | { |
| | | name: '全选', |
| | | id: 'dataColumnAll', |
| | | children: menuFields, |
| | | }, |
| | | ]" |
| | | :props="{ |
| | | children: 'children', |
| | | label: 'name', |
| | | }" |
| | | node-key="id" |
| | | :expand-on-click-node="false" |
| | | :highlight-current="true" |
| | | default-expand-all |
| | | show-checkbox |
| | | ref="dataColumnTree" |
| | | :default-checked-keys="checkedDataColumn" |
| | | > |
| | | <template #default="{ node }"> |
| | | <div class="custom-tree-node"> |
| | | <span>{{ node.label }}</span> |
| | | </div> |
| | | </template> |
| | | </el-tree> |
| | | </el-scrollbar> |
| | | </div> |
| | | </div> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button @click="visible = false">取消</el-button> |
| | | <el-button type="primary" @click="handleConfirm" class="btn-submit"> 确定 </el-button> |
| | | </span> |
| | | </template> |
| | | </ProDialog> |
| | | </template> |
| | | |
| | | <script setup lang="ts"> |
| | | import { Message } from '@bole-core/core'; |
| | | import { AuthorizeType, SubModuleType, SubModuleTitle, EnumMenuType } from '@/constants'; |
| | | import { getTree } from '@/utils'; |
| | | import { TreeInstance } from 'element-plus'; |
| | | import { ProDialog } from '@bole-core/components'; |
| | | import { useMenus, useMenu } from '@/hooks'; |
| | | |
| | | const TypeTip = defineComponent({ |
| | | name: 'TypeTip', |
| | | props: ['isMenu'], |
| | | render() { |
| | | const { isMenu } = this; |
| | | const tipText = isMenu ? `菜单` : '页面'; |
| | | return h( |
| | | 'span', |
| | | { |
| | | class: 'tip-text', |
| | | style: { |
| | | color: '#EB6100', |
| | | }, |
| | | }, |
| | | '[' + tipText + ']' |
| | | ); |
| | | }, |
| | | }); |
| | | |
| | | type Props = { |
| | | authorizeType: 'Role' | 'User'; |
| | | }; |
| | | |
| | | const props = withDefaults(defineProps<Props>(), {}); |
| | | |
| | | const visible = defineModel({ type: Boolean }); |
| | | |
| | | type Form = { |
| | | title?: string; |
| | | detail: API.GetRoleQueryResult; |
| | | }; |
| | | |
| | | const form = defineModel<Form>('form'); |
| | | |
| | | const emit = defineEmits<{ |
| | | (e: 'onConfirm', selectedMenuIds: string[], resourceIds: string[]): void; |
| | | (e: 'onCancel'): void; |
| | | }>(); |
| | | |
| | | type CheckedResourceItem = { |
| | | resourceId: string; |
| | | menuId: string; |
| | | resourceType: SubModuleType; |
| | | }; |
| | | |
| | | const state = reactive({ |
| | | currentMenuId: '', |
| | | checkedInfo: [] as CheckedResourceItem[], |
| | | }); |
| | | |
| | | watch(visible, (newVal) => { |
| | | if (newVal) { |
| | | state.currentMenuId = ''; |
| | | state.checkedInfo = []; |
| | | } |
| | | }); |
| | | |
| | | const dialogTitle = computed(() => |
| | | props.authorizeType === 'Role' ? '角色功能授权' : '账号功能授权' |
| | | ); |
| | | |
| | | const moduleTree = useTemplateRef<TreeInstance>('moduleTree'); |
| | | const pageButtonTree = useTemplateRef<TreeInstance>('pageButtonTree'); |
| | | const dataButtonTree = useTemplateRef<TreeInstance>('dataButtonTree'); |
| | | const dataColumnTree = useTemplateRef<TreeInstance>('dataColumnTree'); |
| | | |
| | | const { menusTree, getMenuById } = useMenus({ |
| | | params: computed(() => ({ |
| | | userType: form.value.detail?.userType, |
| | | clientType: form.value.detail?.clientType, |
| | | roleId: form.value.detail?.id, |
| | | })), |
| | | enabled: computed(() => !!form.value.detail?.id), |
| | | }); |
| | | |
| | | const { menuFields, menuPageButtons, menuDataButtons } = useMenu({ |
| | | params: computed(() => ({ |
| | | id: state.currentMenuId, |
| | | roleId: form.value.detail?.id, |
| | | })), |
| | | enabled: computed(() => !!state.currentMenuId), |
| | | }); |
| | | |
| | | const checkedModules = computed(() => { |
| | | if (form.value.detail) { |
| | | return form.value.detail.menuIds; |
| | | } |
| | | return []; |
| | | }); |
| | | |
| | | const checkedPageButton = computed(() => initChecked(SubModuleType.PageButton)); |
| | | const checkedDataButton = computed(() => initChecked(SubModuleType.DataButton)); |
| | | const checkedDataColumn = computed(() => initChecked(SubModuleType.Column)); |
| | | |
| | | function initChecked(type: SubModuleType) { |
| | | return state.checkedInfo.filter((x) => x.resourceType === type).map((x) => x.resourceId); |
| | | } |
| | | |
| | | function handleSelectModule(menu: API.GetMenusQueryResultItem) { |
| | | const modules1 = |
| | | dataButtonTree && |
| | | dataButtonTree.value.getCheckedKeys(true).map((x) => { |
| | | return { |
| | | resourceType: SubModuleType.DataButton, |
| | | resourceId: x, |
| | | menuId: menu.id, |
| | | } as CheckedResourceItem; |
| | | }); |
| | | |
| | | const modules2 = |
| | | pageButtonTree && |
| | | pageButtonTree.value.getCheckedKeys(true).map((x) => { |
| | | return { |
| | | resourceType: SubModuleType.PageButton, |
| | | resourceId: x, |
| | | menuId: menu.id, |
| | | } as CheckedResourceItem; |
| | | }); |
| | | |
| | | const modules3 = |
| | | dataColumnTree && |
| | | dataColumnTree.value.getCheckedKeys(true).map((x) => { |
| | | return { |
| | | resourceType: SubModuleType.Column, |
| | | resourceId: x, |
| | | menuId: menu.id, |
| | | } as CheckedResourceItem; |
| | | }); |
| | | |
| | | const checkExtends = state.checkedInfo.filter( |
| | | (x) => x.menuId !== menu.id && x.menuId !== undefined |
| | | ); |
| | | |
| | | if (modules1 && modules1.length) { |
| | | checkExtends.push(...modules1); |
| | | } |
| | | if (modules2 && modules2.length) { |
| | | checkExtends.push(...modules2); |
| | | } |
| | | if (modules3 && modules3.length) { |
| | | checkExtends.push(...modules3); |
| | | } |
| | | |
| | | state.checkedInfo = checkExtends; |
| | | state.currentMenuId = menu.id; |
| | | } |
| | | |
| | | function handleConfirm() { |
| | | const selectedMenuIds = moduleTree.value.getCheckedNodes(false, true).map((x) => x.id); |
| | | console.log('selectedMenuIds: ', selectedMenuIds); |
| | | handleSelectModule(getMenuById(state.currentMenuId)); |
| | | const resourceIds = state.checkedInfo.map((x) => x.resourceId); |
| | | console.log('resourceIds: ', resourceIds); |
| | | emit('onConfirm', selectedMenuIds, resourceIds); |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | :deep(.custom-dialog) { |
| | | min-width: 900px; |
| | | } |
| | | |
| | | .authorize-wrapper { |
| | | display: flex; |
| | | |
| | | height: 500px; |
| | | border-bottom: 2px solid #f5f5f5; |
| | | background: #dddddd; |
| | | |
| | | .container-wrapper { |
| | | width: calc(25%); |
| | | border-right: 2px solid #f5f5f5; |
| | | // margin-right: 7px; |
| | | background: #ffffff; |
| | | |
| | | .type-wrapper { |
| | | display: flex; |
| | | justify-content: flex-start; |
| | | align-items: center; |
| | | padding: 10px 16px; |
| | | border-bottom: 2px solid #f5f5f5; |
| | | color: #333333; |
| | | } |
| | | |
| | | &:last-of-type { |
| | | margin-right: 0px; |
| | | } |
| | | |
| | | &.left-wrapper { |
| | | margin-right: 7px; |
| | | padding-top: 10px; |
| | | width: calc(35% - 7px); |
| | | |
| | | :deep(.el-scrollbar) { |
| | | width: 100%; |
| | | height: 98%; |
| | | } |
| | | } |
| | | |
| | | :deep(.el-scrollbar) { |
| | | width: 100%; |
| | | height: calc(98% - 43px); |
| | | |
| | | .el-scrollbar__wrap { |
| | | overflow: auto; |
| | | |
| | | .custom-tree-node { |
| | | display: flex; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </style> |
| | |
| | | <AppContainer> |
| | | <ProTableQueryFilterBar @on-reset="handleReset"> |
| | | <template #query> |
| | | <QueryFilterItem> |
| | | <FieldRadio |
| | | v-model="state.clientType" |
| | | :value-enum="EnumClientTypeText" |
| | | buttonStyle |
| | | @change="getAllModule()" |
| | | /> |
| | | </QueryFilterItem> |
| | | <QueryFilterItem> |
| | | <FieldRadio |
| | | v-model="state.userType" |
| | | :value-enum="EnumUserTypeText" |
| | | buttonStyle |
| | | @change="getAllModule()" |
| | | /> |
| | | </QueryFilterItem> |
| | | <div class="query-filter-list-item"> |
| | | <SearchInput |
| | | v-model="state.searchValue" |
| | |
| | | row.type=v?EnumMenuType.Menu:EnumMenuType.Page |
| | | }" |
| | | inline-prompt |
| | | @change="(v: number) => handleChangeStatus(v, row, 'isMenu')" |
| | | @change="(v: boolean) => handleChangeStatus(v, row, 'isMenu')" |
| | | ></el-switch> |
| | | </template> |
| | | <template v-else-if="column.property === 'enabledMark'"> |
| | | <el-switch |
| | | :modelValue="!row.isDisabled" |
| | | :onUpdate:modelValue="(v: boolean) => row.isDisabled =!v" |
| | | @change="(v: number) => handleChangeStatus(v, row, 'enabledMark')" |
| | | @change="(v: boolean) => handleChangeStatus(v, row, 'enabledMark')" |
| | | ></el-switch> |
| | | </template> |
| | | </template> |
| | |
| | | LoadingLayout, |
| | | OperationBtnType, |
| | | SearchInput, |
| | | QueryFilterItem, |
| | | FieldRadio, |
| | | } from '@bole-core/components'; |
| | | import { ModuleUtils, TreeModuleDtoGroupDto, Message, TreeStore, flattenTree } from '@/utils'; |
| | | import { TableInstance } from 'element-plus'; |
| | |
| | | } |
| | | type StatusEventType = { |
| | | isCache: boolean; |
| | | isMenu: number; |
| | | enabledMark: number; |
| | | isMenu: boolean; |
| | | enabledMark: boolean; |
| | | }; |
| | | async function handleChangeStatus<T extends keyof StatusEventType>( |
| | | value: StatusEventType[T], |
| | | value: boolean, |
| | | data: TreeModuleDtoGroupDto, |
| | | statusType: T |
| | | ) { |
| | | try { |
| | | // let params = { |
| | | // ..._.omit(data, ['children', 'parentNode']), |
| | | // [statusType]: value, |
| | | // }; |
| | | // await baseModuleServices.addOrEditModule(params); |
| | | } catch (error) { |
| | | Message.errorMessage('操作失败'); |
| | | } |
| | | let params: API.SetMenuSwitchCommand = { |
| | | ids: [data.id], |
| | | type: data.type, |
| | | isDisabled: data.isDisabled, |
| | | isCache: data.isCache, |
| | | }; |
| | | if (statusType === 'isMenu') { |
| | | params.type = value ? EnumMenuType.Menu : EnumMenuType.Page; |
| | | } else if (statusType === 'isCache') { |
| | | params.isCache = value; |
| | | } else { |
| | | params.isDisabled = !value; |
| | | } |
| | | await menuServices.setMenuSwitch(params); |
| | | } catch (error) {} |
| | | } |
| | | |
| | | async function getMenu(id: string) { |