From c5742b6e6eadda91a0cd99ebcc51d27d0f344c73 Mon Sep 17 00:00:00 2001 From: wupengfei <834520024@qq.com> Date: 星期三, 06 八月 2025 17:04:08 +0800 Subject: [PATCH] Merge branch 'master' of http://120.26.58.240:8888/r/flexJobAdmin --- src/views/Permission/RoleManage.vue | 26 ++-- src/services/api/index.ts | 4 src/store/modules/permission.ts | 4 .eslintrc-auto-import.json | 30 +++++ build/plugins.ts | 11 - src/services/api/typings.d.ts | 84 +--------------- src/store/modules/user.ts | 11 +- auto-imports.d.ts | 65 +++++++++++- src/constants/app.ts | 5 + src/utils/request/index.ts | 1 10 files changed, 122 insertions(+), 119 deletions(-) diff --git a/.eslintrc-auto-import.json b/.eslintrc-auto-import.json index edae8cc..b865fdf 100644 --- a/.eslintrc-auto-import.json +++ b/.eslintrc-auto-import.json @@ -1,9 +1,11 @@ { "globals": { + "AppLocalConfig": true, "AppType": true, "AreaType": true, "AuthorizeType": true, "BooleanOptions": true, + "CategoryCode": true, "ChargeTypeEnum": true, "ChargeTypeEnumText": true, "Component": true, @@ -50,6 +52,9 @@ "FlexWorkerEleSignEnumText": true, "Gender": true, "GenderText": true, + "GlobalEvent": true, + "GlobalEventContext": true, + "GlobalEventListener": true, "InjectionKey": true, "MaybeRef": true, "MaybeRefOrGetter": true, @@ -74,8 +79,6 @@ "PropType": true, "Ref": true, "RoleClientType": true, - "SearchType": true, - "SearchTypeText": true, "SignChannelEnum": true, "SignChannelEnumText": true, "Slot": true, @@ -94,6 +97,7 @@ "WritableComputedRef": true, "acceptHMRUpdate": true, "computed": true, + "copyTextToClipboard": true, "createApp": true, "createPinia": true, "customRef": true, @@ -101,9 +105,11 @@ "defineComponent": true, "defineStore": true, "effectScope": true, + "eventKey": true, "getActivePinia": true, "getCurrentInstance": true, "getCurrentScope": true, + "globalEventContextKey": true, "h": true, "inject": true, "isProxy": true, @@ -151,18 +157,38 @@ "toValue": true, "triggerRef": true, "unref": true, + "useAccess": true, + "useAllRoleList": true, "useAttrs": true, + "useClearSubModule": true, + "useCopyToClipboard": true, "useCssModule": true, "useCssVars": true, + "useDictionaryDataSelect": true, + "useGetDictionaryCategorySelect": true, + "useGlobalEventContext": true, + "useGlobalEventProvide": true, + "useGroupColumns": true, + "useGroupOperationBtns": true, "useId": true, + "useIsSystemAdmin": true, "useLink": true, "useLoading": true, + "useMenu": true, + "useMenus": true, "useModel": true, + "useOmit": true, + "useOmitProps": true, + "useResizeHander": true, "useRoute": true, + "useRouteView": true, "useRouter": true, "useSetReactive": true, "useSlots": true, "useTemplateRef": true, + "useUser": true, + "useVModel": true, + "useVModels": true, "watch": true, "watchEffect": true, "watchPostEffect": true, diff --git a/auto-imports.d.ts b/auto-imports.d.ts index b150c9f..6998adc 100644 --- a/auto-imports.d.ts +++ b/auto-imports.d.ts @@ -6,10 +6,12 @@ // biome-ignore lint: disable export {} declare global { + const AppLocalConfig: typeof import('./src/constants/app')['AppLocalConfig'] const AppType: typeof import('./src/constants/app')['AppType'] const AreaType: typeof import('./src/constants/enum')['AreaType'] const AuthorizeType: typeof import('./src/constants/enum')['AuthorizeType'] const BooleanOptions: typeof import('./src/constants/enum')['BooleanOptions'] + const CategoryCode: typeof import('./src/constants/dic')['CategoryCode'] const ChargeTypeEnum: typeof import('./src/constants/enterprise')['ChargeTypeEnum'] const ChargeTypeEnumText: typeof import('./src/constants/enterprise')['ChargeTypeEnumText'] const CommonAnnexTableColumns: typeof import('@/constants')['CommonAnnexTableColumns'] @@ -85,6 +87,7 @@ const VerifyStatusText: typeof import('./src/constants/enterprise')['VerifyStatusText'] const acceptHMRUpdate: typeof import('pinia')['acceptHMRUpdate'] const computed: typeof import('vue')['computed'] + const copyTextToClipboard: typeof import('./src/hooks/useCopyToClipboard')['copyTextToClipboard'] const createApp: typeof import('vue')['createApp'] const createPinia: typeof import('pinia')['createPinia'] const customRef: typeof import('vue')['customRef'] @@ -92,9 +95,11 @@ const defineComponent: typeof import('vue')['defineComponent'] const defineStore: typeof import('pinia')['defineStore'] const effectScope: typeof import('vue')['effectScope'] + const eventKey: typeof import('./src/hooks/useEvent')['eventKey'] const getActivePinia: typeof import('pinia')['getActivePinia'] const getCurrentInstance: typeof import('vue')['getCurrentInstance'] const getCurrentScope: typeof import('vue')['getCurrentScope'] + const globalEventContextKey: typeof import('./src/hooks/useEvent')['globalEventContextKey'] const h: typeof import('vue')['h'] const inject: typeof import('vue')['inject'] const isProxy: typeof import('vue')['isProxy'] @@ -142,18 +147,38 @@ const toValue: typeof import('vue')['toValue'] const triggerRef: typeof import('vue')['triggerRef'] const unref: typeof import('vue')['unref'] + const useAccess: typeof import('./src/hooks/useAccess')['useAccess'] + const useAllRoleList: typeof import('./src/hooks/useUser')['useAllRoleList'] const useAttrs: typeof import('vue')['useAttrs'] + const useClearSubModule: typeof import('./src/hooks/useAccess')['useClearSubModule'] + const useCopyToClipboard: typeof import('./src/hooks/useCopyToClipboard')['useCopyToClipboard'] const useCssModule: typeof import('vue')['useCssModule'] const useCssVars: typeof import('vue')['useCssVars'] + const useDictionaryDataSelect: typeof import('./src/hooks/dic')['useDictionaryDataSelect'] + const useGetDictionaryCategorySelect: typeof import('./src/hooks/dic')['useGetDictionaryCategorySelect'] + const useGlobalEventContext: typeof import('./src/hooks/useEvent')['useGlobalEventContext'] + const useGlobalEventProvide: typeof import('./src/hooks/useEvent')['useGlobalEventProvide'] + const useGroupColumns: typeof import('./src/hooks/useAccess')['useGroupColumns'] + const useGroupOperationBtns: typeof import('./src/hooks/useAccess')['useGroupOperationBtns'] const useId: typeof import('vue')['useId'] + const useIsSystemAdmin: typeof import('./src/hooks/useUser')['useIsSystemAdmin'] const useLink: typeof import('vue-router')['useLink'] - const useLoading: typeof import('@/hooks/global')['useLoading'] + const useLoading: typeof import('./src/hooks/global/useLoading')['useLoading'] + const useMenu: typeof import('./src/hooks/menu')['useMenu'] + const useMenus: typeof import('./src/hooks/menu')['useMenus'] const useModel: typeof import('vue')['useModel'] + const useOmit: typeof import('./src/hooks/help')['useOmit'] + const useOmitProps: typeof import('./src/hooks/help')['useOmitProps'] + const useResizeHander: typeof import('./src/hooks/useResizeHander')['useResizeHander'] const useRoute: typeof import('vue-router')['useRoute'] + const useRouteView: typeof import('./src/hooks/useRouteView')['useRouteView'] const useRouter: typeof import('vue-router')['useRouter'] - const useSetReactive: typeof import('@/hooks/global')['useSetReactive'] + const useSetReactive: typeof import('./src/hooks/global/helper')['useSetReactive'] const useSlots: typeof import('vue')['useSlots'] const useTemplateRef: typeof import('vue')['useTemplateRef'] + const useUser: typeof import('./src/hooks/useUser')['useUser'] + const useVModel: typeof import('./src/hooks/help')['useVModel'] + const useVModels: typeof import('./src/hooks/help')['useVModels'] const watch: typeof import('vue')['watch'] const watchEffect: typeof import('vue')['watchEffect'] const watchPostEffect: typeof import('vue')['watchPostEffect'] @@ -171,7 +196,7 @@ export type { FlexWorkerEleSignEnum, FlexTaskWorkerHireEnum, FlexWorkerEleSignEnum, FlexTaskWorkerHireEnum } from './src/constants/cPerson' import('./src/constants/cPerson') // @ts-ignore - export type { SearchType, SearchType } from './src/constants/dic' + export type { CategoryCode, CategoryCode } from './src/constants/dic' import('./src/constants/dic') // @ts-ignore export type { EditorType, EditorType } from './src/constants/editor' @@ -194,6 +219,9 @@ // @ts-ignore export type { RoleClientType, RoleClientType } from './src/constants/role' import('./src/constants/role') + // @ts-ignore + export type { GlobalEvent, GlobalEventListener, GlobalEventContext } from './src/hooks/useEvent' + import('./src/hooks/useEvent') } // for vue template auto import @@ -201,10 +229,12 @@ declare module 'vue' { interface GlobalComponents {} interface ComponentCustomProperties { + readonly AppLocalConfig: UnwrapRef<typeof import('./src/constants/app')['AppLocalConfig']> readonly AppType: UnwrapRef<typeof import('./src/constants/app')['AppType']> readonly AreaType: UnwrapRef<typeof import('./src/constants/enum')['AreaType']> readonly AuthorizeType: UnwrapRef<typeof import('./src/constants/enum')['AuthorizeType']> readonly BooleanOptions: UnwrapRef<typeof import('./src/constants/enum')['BooleanOptions']> + readonly CategoryCode: UnwrapRef<typeof import('./src/constants/dic')['CategoryCode']> readonly ChargeTypeEnum: UnwrapRef<typeof import('./src/constants/enterprise')['ChargeTypeEnum']> readonly ChargeTypeEnumText: UnwrapRef<typeof import('./src/constants/enterprise')['ChargeTypeEnumText']> readonly EditorType: UnwrapRef<typeof import('./src/constants/editor')['EditorType']> @@ -262,8 +292,6 @@ readonly OssUser: UnwrapRef<typeof import('./src/constants/oss')['OssUser']> readonly OssUserSign: UnwrapRef<typeof import('./src/constants/oss')['OssUserSign']> readonly RoleClientType: UnwrapRef<typeof import('./src/constants/role')['RoleClientType']> - readonly SearchType: UnwrapRef<typeof import('./src/constants/dic')['SearchType']> - readonly SearchTypeText: UnwrapRef<typeof import('./src/constants/dic')['SearchTypeText']> readonly SignChannelEnum: UnwrapRef<typeof import('./src/constants/enterprise')['SignChannelEnum']> readonly SignChannelEnumText: UnwrapRef<typeof import('./src/constants/enterprise')['SignChannelEnumText']> readonly SubModuleKey: UnwrapRef<typeof import('./src/constants/module')['SubModuleKey']> @@ -275,6 +303,7 @@ readonly VerifyStatusText: UnwrapRef<typeof import('./src/constants/enterprise')['VerifyStatusText']> readonly acceptHMRUpdate: UnwrapRef<typeof import('pinia')['acceptHMRUpdate']> readonly computed: UnwrapRef<typeof import('vue')['computed']> + readonly copyTextToClipboard: UnwrapRef<typeof import('./src/hooks/useCopyToClipboard')['copyTextToClipboard']> readonly createApp: UnwrapRef<typeof import('vue')['createApp']> readonly createPinia: UnwrapRef<typeof import('pinia')['createPinia']> readonly customRef: UnwrapRef<typeof import('vue')['customRef']> @@ -282,9 +311,11 @@ readonly defineComponent: UnwrapRef<typeof import('vue')['defineComponent']> readonly defineStore: UnwrapRef<typeof import('pinia')['defineStore']> readonly effectScope: UnwrapRef<typeof import('vue')['effectScope']> + readonly eventKey: UnwrapRef<typeof import('./src/hooks/useEvent')['eventKey']> readonly getActivePinia: UnwrapRef<typeof import('pinia')['getActivePinia']> readonly getCurrentInstance: UnwrapRef<typeof import('vue')['getCurrentInstance']> readonly getCurrentScope: UnwrapRef<typeof import('vue')['getCurrentScope']> + readonly globalEventContextKey: UnwrapRef<typeof import('./src/hooks/useEvent')['globalEventContextKey']> readonly h: UnwrapRef<typeof import('vue')['h']> readonly inject: UnwrapRef<typeof import('vue')['inject']> readonly isProxy: UnwrapRef<typeof import('vue')['isProxy']> @@ -332,18 +363,38 @@ readonly toValue: UnwrapRef<typeof import('vue')['toValue']> readonly triggerRef: UnwrapRef<typeof import('vue')['triggerRef']> readonly unref: UnwrapRef<typeof import('vue')['unref']> + readonly useAccess: UnwrapRef<typeof import('./src/hooks/useAccess')['useAccess']> + readonly useAllRoleList: UnwrapRef<typeof import('./src/hooks/useUser')['useAllRoleList']> readonly useAttrs: UnwrapRef<typeof import('vue')['useAttrs']> + readonly useClearSubModule: UnwrapRef<typeof import('./src/hooks/useAccess')['useClearSubModule']> + readonly useCopyToClipboard: UnwrapRef<typeof import('./src/hooks/useCopyToClipboard')['useCopyToClipboard']> readonly useCssModule: UnwrapRef<typeof import('vue')['useCssModule']> readonly useCssVars: UnwrapRef<typeof import('vue')['useCssVars']> + readonly useDictionaryDataSelect: UnwrapRef<typeof import('./src/hooks/dic')['useDictionaryDataSelect']> + readonly useGetDictionaryCategorySelect: UnwrapRef<typeof import('./src/hooks/dic')['useGetDictionaryCategorySelect']> + readonly useGlobalEventContext: UnwrapRef<typeof import('./src/hooks/useEvent')['useGlobalEventContext']> + readonly useGlobalEventProvide: UnwrapRef<typeof import('./src/hooks/useEvent')['useGlobalEventProvide']> + readonly useGroupColumns: UnwrapRef<typeof import('./src/hooks/useAccess')['useGroupColumns']> + readonly useGroupOperationBtns: UnwrapRef<typeof import('./src/hooks/useAccess')['useGroupOperationBtns']> readonly useId: UnwrapRef<typeof import('vue')['useId']> + readonly useIsSystemAdmin: UnwrapRef<typeof import('./src/hooks/useUser')['useIsSystemAdmin']> readonly useLink: UnwrapRef<typeof import('vue-router')['useLink']> - readonly useLoading: UnwrapRef<typeof import('@/hooks/global')['useLoading']> + readonly useLoading: UnwrapRef<typeof import('./src/hooks/global/useLoading')['useLoading']> + readonly useMenu: UnwrapRef<typeof import('./src/hooks/menu')['useMenu']> + readonly useMenus: UnwrapRef<typeof import('./src/hooks/menu')['useMenus']> readonly useModel: UnwrapRef<typeof import('vue')['useModel']> + readonly useOmit: UnwrapRef<typeof import('./src/hooks/help')['useOmit']> + readonly useOmitProps: UnwrapRef<typeof import('./src/hooks/help')['useOmitProps']> + readonly useResizeHander: UnwrapRef<typeof import('./src/hooks/useResizeHander')['useResizeHander']> readonly useRoute: UnwrapRef<typeof import('vue-router')['useRoute']> + readonly useRouteView: UnwrapRef<typeof import('./src/hooks/useRouteView')['useRouteView']> readonly useRouter: UnwrapRef<typeof import('vue-router')['useRouter']> - readonly useSetReactive: UnwrapRef<typeof import('@/hooks/global')['useSetReactive']> + readonly useSetReactive: UnwrapRef<typeof import('./src/hooks/global/helper')['useSetReactive']> readonly useSlots: UnwrapRef<typeof import('vue')['useSlots']> readonly useTemplateRef: UnwrapRef<typeof import('vue')['useTemplateRef']> + readonly useUser: UnwrapRef<typeof import('./src/hooks/useUser')['useUser']> + readonly useVModel: UnwrapRef<typeof import('./src/hooks/help')['useVModel']> + readonly useVModels: UnwrapRef<typeof import('./src/hooks/help')['useVModels']> readonly watch: UnwrapRef<typeof import('vue')['watch']> readonly watchEffect: UnwrapRef<typeof import('vue')['watchEffect']> readonly watchPostEffect: UnwrapRef<typeof import('vue')['watchPostEffect']> diff --git a/build/plugins.ts b/build/plugins.ts index d08ed3e..af398da 100644 --- a/build/plugins.ts +++ b/build/plugins.ts @@ -75,20 +75,13 @@ AutoImport({ resolvers: [ElementPlusResolver()], - dirs: ['./src/constants'], + dirs: ['./src/constants/**', './src/hooks/**'], // dirsScanOptions: { // fileFilter: (file) => file.endsWith('.ts'), // Filter files // types: true, // }, vueTemplate: true, - imports: [ - 'vue', - 'pinia', - 'vue-router', - { - '@/hooks/global': Object.keys(hooks), - }, - ], + imports: ['vue', 'pinia', 'vue-router'], eslintrc: { enabled: true, // Default `false` filepath: './.eslintrc-auto-import.json', // Default `./.eslintrc-auto-import.json` diff --git a/src/constants/app.ts b/src/constants/app.ts index 22b3f14..46dbc29 100644 --- a/src/constants/app.ts +++ b/src/constants/app.ts @@ -1 +1,6 @@ export const AppType = import.meta.env.VITE_AppType || 'one'; + +export const AppLocalConfig = { + userType: EnumUserType.Operation, + clientType: EnumClientType.PcWeb, +}; diff --git a/src/services/api/index.ts b/src/services/api/index.ts index 1f801d3..c3af7d2 100644 --- a/src/services/api/index.ts +++ b/src/services/api/index.ts @@ -3,18 +3,18 @@ // API 鏇存柊鏃堕棿锛� // API 鍞竴鏍囪瘑锛� import * as auth from './auth'; +import * as enterprise from './enterprise'; import * as menu from './menu'; import * as dictionary from './dictionary'; import * as resource from './resource'; import * as role from './role'; import * as userInfo from './userInfo'; -import * as enterprise from './enterprise'; export default { auth, + enterprise, menu, dictionary, resource, role, userInfo, - enterprise, }; diff --git a/src/services/api/typings.d.ts b/src/services/api/typings.d.ts index 960421a..e1074e7 100644 --- a/src/services/api/typings.d.ts +++ b/src/services/api/typings.d.ts @@ -368,44 +368,6 @@ timestamp?: number; } - interface FriendlyResultListSelectQueryResultOptionGuidGetDictionaryCategorySelectQueryOption { - /** 璺熻釜Id */ - traceId?: string; - /** 鐘舵�佺爜 */ - code?: number; - /** 閿欒鐮� */ - errorCode?: string; - /** 鏁版嵁 */ - data?: SelectQueryResultOptionGuidGetDictionaryCategorySelectQueryOption[]; - /** 鎵ц鎴愬姛 */ - success?: boolean; - /** 閿欒淇℃伅 */ - msg?: any; - /** 闄勫姞鏁版嵁 */ - extras?: any; - /** 鏃堕棿鎴� */ - timestamp?: number; - } - - interface FriendlyResultListSelectQueryResultOptionGuidGetDictionaryDataSelectQueryResultOption { - /** 璺熻釜Id */ - traceId?: string; - /** 鐘舵�佺爜 */ - code?: number; - /** 閿欒鐮� */ - errorCode?: string; - /** 鏁版嵁 */ - data?: SelectQueryResultOptionGuidGetDictionaryDataSelectQueryResultOption[]; - /** 鎵ц鎴愬姛 */ - success?: boolean; - /** 閿欒淇℃伅 */ - msg?: any; - /** 闄勫姞鏁版嵁 */ - extras?: any; - /** 鏃堕棿鎴� */ - timestamp?: number; - } - interface FriendlyResultPagedListQueryResultGetDictionaryCategoriesQueryResultItem { /** 璺熻釜Id */ traceId?: string; @@ -545,14 +507,10 @@ sort?: number; } - type GetDictionaryCategorySelectQuery = Record<string, any>; - interface GetDictionaryDatasQuery { pageModel?: PagedListQueryPageModel; - /** 绫诲埆Id锛圛d/缂栧彿浜岄�変竴锛� */ + /** 绫诲埆Id */ categoryId?: string; - /** 绫诲埆缂栧彿锛圛d/缂栧彿浜岄�変竴锛� */ - categoryCode?: string; /** 鍏抽敭瀛� */ keywords?: string; } @@ -562,11 +520,6 @@ id?: string; /** 绫诲埆Id */ categoryId?: string; - /** 绫诲埆缂栧彿 */ - categoryCode?: string; - /** 绫诲埆鍚嶇О */ - categoryName?: string; - category?: GetDictionaryDatasQueryResultItemCategory; /** 涓婄骇Id */ parentId?: string; /** 缂栧彿 */ @@ -587,13 +540,6 @@ sort?: number; /** 鏄惁绂佺敤 */ isDisabled?: boolean; - } - - interface GetDictionaryDatasQueryResultItemCategory { - /** 绫诲埆缂栧彿 */ - code?: string; - /** 鍚嶇О */ - name?: string; } interface GetEnterprisesQuery { @@ -945,7 +891,6 @@ } interface SaveDictionaryCategoryCommand { - /** Id */ id?: string; /** 缂栧彿 */ code: string; @@ -958,7 +903,6 @@ } interface SaveDictionaryDataCommand { - /** Id */ id?: string; /** 绫诲埆Id */ categoryId?: string; @@ -1125,27 +1069,10 @@ resources?: GetRoleQueryResultResource[]; } - interface SelectQueryResultOptionGuidGetDictionaryCategorySelectQueryOption { - /** 鍊� */ - value?: string; - /** 鏍囩 */ - label?: string; - /** 鏁版嵁 */ - data?: any; - } - - interface SelectQueryResultOptionGuidGetDictionaryDataSelectQueryResultOption { - /** 鍊� */ - value?: string; - /** 鏍囩 */ - label?: string; - /** 鏁版嵁 */ - data?: any; - } - interface SetDictionaryDataIsDisabledCommand { + /** Id */ ids?: string[]; - /** 鏄惁宸茬鐢� */ + /** 鏄惁绂佺敤 */ isDisabled?: boolean; } @@ -1160,8 +1087,9 @@ } interface SetRoleIsDisabledCommand { - ids?: string[]; - /** 鏄惁宸茬鐢� */ + /** Id */ + ids: string[]; + /** 鏄惁绂佺敤 */ isDisabled?: boolean; } diff --git a/src/store/modules/permission.ts b/src/store/modules/permission.ts index 5416c3d..734facd 100644 --- a/src/store/modules/permission.ts +++ b/src/store/modules/permission.ts @@ -29,8 +29,8 @@ return new Promise<Route[]>(async (resolve, reject) => { try { const params: API.APIgetMenusParams = { - userType: EnumUserType.Operation, - clientType: EnumClientType.PcWeb, + userType: AppLocalConfig.userType, + clientType: AppLocalConfig.clientType, }; const res = await myClient.fetchQuery({ queryKey: ['menuServices/getMenus', params], diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index 85c8aae..a0f709d 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -42,9 +42,10 @@ return state.userInfo; }, - // userId(state) { - // return state.accountInfo.sub; - // }, + userId(state) { + //TODO + return ''; + }, }, actions: { setToken(token: string) { @@ -62,8 +63,8 @@ { ...params, password: md5Encrypt(params.password), - type: EnumUserType.Operation, - clientType: EnumClientType.PcWeb, + type: AppLocalConfig.userType, + clientType: AppLocalConfig.clientType, }, { showLoading: false, diff --git a/src/utils/request/index.ts b/src/utils/request/index.ts index b48c7ce..eaabecb 100644 --- a/src/utils/request/index.ts +++ b/src/utils/request/index.ts @@ -231,7 +231,6 @@ 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'], diff --git a/src/views/Permission/RoleManage.vue b/src/views/Permission/RoleManage.vue index 4f57eb0..ba103bb 100644 --- a/src/views/Permission/RoleManage.vue +++ b/src/views/Permission/RoleManage.vue @@ -80,14 +80,15 @@ // member: { emits: { onClick: (role) => openMemberDialog(role) } }, disabledBtn: { emits: { onClick: (role) => roleEnableOrForbid(role) }, + props: { type: 'danger' }, extraProps: { - hide: (row) => row.isLocked, + hide: (row) => row.isDisabled, }, }, enableBtn: { emits: { onClick: (role) => roleEnableOrForbid(role) }, extraProps: { - hide: (row) => !row.isLocked, + hide: (row) => !row.isDisabled, }, }, }; @@ -217,17 +218,16 @@ async function roleEnableOrForbid(row: API.GetRolesQueryResultItem) { try { - // await Message.tipMessage(`鏄惁${!row.isEnable ? '鍚敤' : '绂佺敤'}瑙掕壊`); - // let res = await userServices.roleEnableOrForbid({ - // id: row.id, - // isEnable: !row.isEnable, - // }); - // if (res) { - // Message.successMessage('鎿嶄綔鎴愬姛'); - // getList(paginationState.pageIndex); - // refetch({ type: 'inactive' }); - // return !!res; - // } + await Message.tipMessage(`鏄惁${row.isDisabled ? '鍚敤' : '绂佺敤'}瑙掕壊`); + let res = await roleServices.setRoleIsDisabled({ + ids: [row.id], + isDisabled: !row.isDisabled, + }); + if (res) { + Message.successMessage('鎿嶄綔鎴愬姛'); + getList(paginationState.pageIndex); + return !!res; + } } catch (error) {} } -- Gitblit v1.9.1