From cb795c5827f6e7c0e4d2c1358f27d0862f502b5b Mon Sep 17 00:00:00 2001 From: zhengyiming <540361168@qq.com> Date: 星期三, 06 八月 2025 11:22:55 +0800 Subject: [PATCH] fix: 修改功能模块 --- src/views/Permission/RoleManage.vue | 26 +- src/views/DictionaryManage/SearchSetting2.vue | 2 .eslintrc-auto-import.json | 26 ++ src/services/api/typings.d.ts | 343 ++++++++++++++++++++++++++++ src/services/api/dictionary.ts | 78 ++++++ src/store/modules/user.ts | 11 src/services/api/enterprise.ts | 18 + src/services/api/index.ts | 4 src/services/api/role.ts | 45 +++ src/store/modules/permission.ts | 4 build/plugins.ts | 11 src/services/api/userInfo.ts | 66 +++++ auto-imports.d.ts | 59 ++++ src/constants/apiEnum.ts | 12 + src/constants/app.ts | 5 15 files changed, 672 insertions(+), 38 deletions(-) diff --git a/.eslintrc-auto-import.json b/.eslintrc-auto-import.json index 9e9f385..7957bc8 100644 --- a/.eslintrc-auto-import.json +++ b/.eslintrc-auto-import.json @@ -1,5 +1,6 @@ { "globals": { + "AppLocalConfig": true, "AppType": true, "AreaType": true, "AuthorizeType": true, @@ -26,6 +27,7 @@ "EnumRoleWebApiDataPower": true, "EnumRoleWebApiDataPowerText": true, "EnumRoleWebApiDataPowerTextForFilter": true, + "EnumUserInfoStatus": true, "EnumUserType": true, "EnumUserTypeText": true, "ExtractDefaultPropTypes": true, @@ -48,6 +50,9 @@ "FlexWorkerEleSignEnumText": true, "Gender": true, "GenderText": true, + "GlobalEvent": true, + "GlobalEventContext": true, + "GlobalEventListener": true, "InjectionKey": true, "MaybeRef": true, "MaybeRefOrGetter": true, @@ -92,6 +97,7 @@ "WritableComputedRef": true, "acceptHMRUpdate": true, "computed": true, + "copyTextToClipboard": true, "createApp": true, "createPinia": true, "customRef": true, @@ -99,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, @@ -149,18 +157,36 @@ "toValue": true, "triggerRef": true, "unref": true, + "useAccess": true, + "useAllRoleList": true, "useAttrs": true, + "useClearSubModule": true, + "useCopyToClipboard": true, "useCssModule": true, "useCssVars": 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 92e91a2..a5c8e60 100644 --- a/auto-imports.d.ts +++ b/auto-imports.d.ts @@ -6,6 +6,7 @@ // 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'] @@ -32,6 +33,7 @@ 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 EnumUserInfoStatus: typeof import('./src/constants/apiEnum')['EnumUserInfoStatus'] const EnumUserType: typeof import('./src/constants/apiEnum')['EnumUserType'] const EnumUserTypeText: typeof import('./src/constants/apiEnumText')['EnumUserTypeText'] const EnumWebApiMethod: typeof import('./src/constants/apiEnum')['EnumWebApiMethod'] @@ -83,6 +85,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'] @@ -90,9 +93,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'] @@ -140,18 +145,36 @@ 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 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'] @@ -163,7 +186,7 @@ export type { Component, Slot, Slots, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue' import('vue') // @ts-ignore - export type { EnumClientType, EnumMenuType, EnumMenuVisitLevel, EnumPagedListOrder, EnumResourceController, EnumResourceMethod, EnumRoleWebApiDataPower, EnumUserType, EnumClientType, EnumMenuType, EnumMenuVisitLevel, EnumPagedListOrder, EnumResourceController, EnumResourceMethod, EnumRoleWebApiDataPower, EnumUserType } from './src/constants/apiEnum' + export type { EnumClientType, EnumMenuType, EnumMenuVisitLevel, EnumPagedListOrder, EnumResourceController, EnumResourceMethod, EnumRoleWebApiDataPower, EnumUserInfoStatus, EnumUserType, EnumClientType, EnumMenuType, EnumMenuVisitLevel, EnumPagedListOrder, EnumResourceController, EnumResourceMethod, EnumRoleWebApiDataPower, EnumUserInfoStatus, EnumUserType } from './src/constants/apiEnum' import('./src/constants/apiEnum') // @ts-ignore export type { FlexWorkerEleSignEnum, FlexTaskWorkerHireEnum, FlexWorkerEleSignEnum, FlexTaskWorkerHireEnum } from './src/constants/cPerson' @@ -192,6 +215,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 @@ -199,6 +225,7 @@ 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']> @@ -221,6 +248,7 @@ 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 EnumUserInfoStatus: UnwrapRef<typeof import('./src/constants/apiEnum')['EnumUserInfoStatus']> 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']> @@ -271,6 +299,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']> @@ -278,9 +307,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']> @@ -328,18 +359,36 @@ 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 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/apiEnum.ts b/src/constants/apiEnum.ts index 87b2651..8069622 100644 --- a/src/constants/apiEnum.ts +++ b/src/constants/apiEnum.ts @@ -53,6 +53,10 @@ Resource = 3, /**鐢ㄦ埛瑙掕壊 */ Role = 4, + /**鐢ㄦ埛淇℃伅 */ + UserInfo = 5, + /**浼佷笟淇℃伅 */ + Enterprise = 6, } /** 璧勬簮璇锋眰鏂瑰紡 */ @@ -83,6 +87,14 @@ All = 999, } +/** 鐢ㄦ埛淇℃伅鐘舵�� */ +export enum EnumUserInfoStatus { + /**姝e父 */ + Normal = 10, + /**绂佺敤 */ + Disabled = 100, +} + /** 鐢ㄦ埛绫诲瀷 */ export enum EnumUserType { /**涓汉 */ 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/dictionary.ts b/src/services/api/dictionary.ts index 961750b..26f00b9 100644 --- a/src/services/api/dictionary.ts +++ b/src/services/api/dictionary.ts @@ -2,6 +2,39 @@ // @ts-ignore import { request } from '@/utils/request'; +/** 鍒犻櫎瀛楀吀绫诲埆 DELETE /api/main/dictionary/deleteDictionaryCategory */ +export async function deleteDictionaryCategory( + body: API.DeleteDictionaryCategoryCommand, + options?: API.RequestConfig +) { + return request<number>('/api/main/dictionary/deleteDictionaryCategory', { + method: 'DELETE', + headers: { + 'Content-Type': 'application/json-patch+json', + }, + data: body, + ...(options || {}), + }); +} + +/** 鏌ヨ瀛楀吀绫诲埆鍒嗛〉鍒楄〃鏁版嵁 POST /api/main/dictionary/getDictionaryCategories */ +export async function getDictionaryCategories( + body: API.GetDictionaryCategoriesQuery, + options?: API.RequestConfig +) { + return request<API.PagedListQueryResultGetDictionaryCategoriesQueryResultItem>( + '/api/main/dictionary/getDictionaryCategories', + { + method: 'POST', + headers: { + 'Content-Type': 'application/json-patch+json', + }, + data: body, + ...(options || {}), + } + ); +} + /** 鑾峰彇瀛楀吀鏁版嵁鍒嗛〉鍒楄〃 POST /api/main/dictionary/getDictionaryDatas */ export async function getDictionaryDatas( body: API.GetDictionaryDatasQuery, @@ -19,3 +52,48 @@ } ); } + +/** 淇濆瓨瀛楀吀绫诲埆 POST /api/main/dictionary/saveDictionaryCategory */ +export async function saveDictionaryCategory( + body: API.SaveDictionaryCategoryCommand, + options?: API.RequestConfig +) { + return request<string>('/api/main/dictionary/saveDictionaryCategory', { + method: 'POST', + headers: { + 'Content-Type': 'application/json-patch+json', + }, + data: body, + ...(options || {}), + }); +} + +/** 淇濆瓨瀛楀吀鏁版嵁 POST /api/main/dictionary/saveDictionaryData */ +export async function saveDictionaryData( + body: API.SaveDictionaryDataCommand, + options?: API.RequestConfig +) { + return request<string>('/api/main/dictionary/saveDictionaryData', { + method: 'POST', + headers: { + 'Content-Type': 'application/json-patch+json', + }, + data: body, + ...(options || {}), + }); +} + +/** 璁剧疆瀛楀吀鏁版嵁鏄惁绂佺敤 PUT /api/main/dictionary/setDictionaryDataIsDisabled */ +export async function setDictionaryDataIsDisabled( + body: API.SetDictionaryDataIsDisabledCommand, + options?: API.RequestConfig +) { + return request<number>('/api/main/dictionary/setDictionaryDataIsDisabled', { + method: 'PUT', + headers: { + 'Content-Type': 'application/json-patch+json', + }, + data: body, + ...(options || {}), + }); +} diff --git a/src/services/api/enterprise.ts b/src/services/api/enterprise.ts new file mode 100644 index 0000000..820738d --- /dev/null +++ b/src/services/api/enterprise.ts @@ -0,0 +1,18 @@ +/* eslint-disable */ +// @ts-ignore +import { request } from '@/utils/request'; + +/** 鏌ヨ浼佷笟淇℃伅鍒嗛〉鍒楄〃鏁版嵁 POST /api/user/enterprise/getEnterprises */ +export async function getEnterprises(body: API.GetEnterprisesQuery, options?: API.RequestConfig) { + return request<API.PagedListQueryResultGetEnterprisesQueryResultItem>( + '/api/user/enterprise/getEnterprises', + { + method: 'POST', + headers: { + 'Content-Type': 'application/json-patch+json', + }, + data: body, + ...(options || {}), + } + ); +} diff --git a/src/services/api/index.ts b/src/services/api/index.ts index e96a264..7edc9e1 100644 --- a/src/services/api/index.ts +++ b/src/services/api/index.ts @@ -4,13 +4,17 @@ // API 鍞竴鏍囪瘑锛� import * as dictionary from './dictionary'; import * as auth from './auth'; +import * as enterprise from './enterprise'; import * as menu from './menu'; import * as resource from './resource'; import * as role from './role'; +import * as userInfo from './userInfo'; export default { dictionary, auth, + enterprise, menu, resource, role, + userInfo, }; diff --git a/src/services/api/role.ts b/src/services/api/role.ts index 36ede2e..1ed081d 100644 --- a/src/services/api/role.ts +++ b/src/services/api/role.ts @@ -41,6 +41,21 @@ }); } +/** 鏌ヨ瑙掕壊鐢ㄦ埛鍒楄〃 GET /api/user/role/getRoleUserInfos */ +export async function getRoleUserInfos( + // 鍙犲姞鐢熸垚鐨凱aram绫诲瀷 (闈瀊ody鍙傛暟swagger榛樿娌℃湁鐢熸垚瀵硅薄) + params: API.APIgetRoleUserInfosParams, + options?: API.RequestConfig +) { + return request<API.GetRoleUserInfosQueryResultItem[]>('/api/user/role/getRoleUserInfos', { + method: 'GET', + params: { + ...params, + }, + ...(options || {}), + }); +} + /** 淇濆瓨瑙掕壊 POST /api/user/role/saveRole */ export async function saveRole(body: API.SaveRoleCommand, options?: API.RequestConfig) { return request<string>('/api/user/role/saveRole', { @@ -52,3 +67,33 @@ ...(options || {}), }); } + +/** 璁剧疆瑙掕壊鏄惁绂佺敤 PUT /api/user/role/setRoleIsDisabled */ +export async function setRoleIsDisabled( + body: API.SetRoleIsDisabledCommand, + options?: API.RequestConfig +) { + return request<number>('/api/user/role/setRoleIsDisabled', { + method: 'PUT', + headers: { + 'Content-Type': 'application/json-patch+json', + }, + data: body, + ...(options || {}), + }); +} + +/** 璁剧疆瑙掕壊鐢ㄦ埛 PUT /api/user/role/setRoleUserInfos */ +export async function setRoleUserInfos( + body: API.SetRoleUserInfosCommand, + options?: API.RequestConfig +) { + return request<number>('/api/user/role/setRoleUserInfos', { + method: 'PUT', + headers: { + 'Content-Type': 'application/json-patch+json', + }, + data: body, + ...(options || {}), + }); +} diff --git a/src/services/api/typings.d.ts b/src/services/api/typings.d.ts index 5773566..52f8a9d 100644 --- a/src/services/api/typings.d.ts +++ b/src/services/api/typings.d.ts @@ -48,6 +48,22 @@ id?: string; } + interface APIgetRoleUserInfosParams { + /** 瑙掕壊Id */ + roleId?: string; + } + + interface APIgetUserInfoRolesParams { + /** 鐢ㄦ埛Id */ + userInfoId?: string; + /** 瀹㈡埛绔被鍨� */ + clientType?: EnumClientType; + } + + interface DeleteDictionaryCategoryCommand { + ids: string[]; + } + interface DeleteMenuCommand { ids: string[]; } @@ -103,6 +119,10 @@ Resource = 3, /**鐢ㄦ埛瑙掕壊 */ Role = 4, + /**鐢ㄦ埛淇℃伅 */ + UserInfo = 5, + /**浼佷笟淇℃伅 */ + Enterprise = 6, } enum EnumResourceMethod { @@ -129,6 +149,13 @@ CurrentEnterprise = 30, /**鏌ヨ鎵�鏈� */ All = 999, + } + + enum EnumUserInfoStatus { + /**姝e父 */ + Normal = 10, + /**绂佺敤 */ + Disabled = 100, } enum EnumUserType { @@ -289,6 +316,62 @@ timestamp?: number; } + interface FriendlyResultListGetRoleUserInfosQueryResultItem { + /** 璺熻釜Id */ + traceId?: string; + /** 鐘舵�佺爜 */ + code?: number; + /** 閿欒鐮� */ + errorCode?: string; + /** 鏁版嵁 */ + data?: GetRoleUserInfosQueryResultItem[]; + /** 鎵ц鎴愬姛 */ + success?: boolean; + /** 閿欒淇℃伅 */ + msg?: any; + /** 闄勫姞鏁版嵁 */ + extras?: any; + /** 鏃堕棿鎴� */ + timestamp?: number; + } + + interface FriendlyResultListGetUserInfoRolesQueryResultItem { + /** 璺熻釜Id */ + traceId?: string; + /** 鐘舵�佺爜 */ + code?: number; + /** 閿欒鐮� */ + errorCode?: string; + /** 鏁版嵁 */ + data?: GetUserInfoRolesQueryResultItem[]; + /** 鎵ц鎴愬姛 */ + success?: boolean; + /** 閿欒淇℃伅 */ + msg?: any; + /** 闄勫姞鏁版嵁 */ + extras?: any; + /** 鏃堕棿鎴� */ + timestamp?: number; + } + + interface FriendlyResultPagedListQueryResultGetDictionaryCategoriesQueryResultItem { + /** 璺熻釜Id */ + traceId?: string; + /** 鐘舵�佺爜 */ + code?: number; + /** 閿欒鐮� */ + errorCode?: string; + data?: PagedListQueryResultGetDictionaryCategoriesQueryResultItem; + /** 鎵ц鎴愬姛 */ + success?: boolean; + /** 閿欒淇℃伅 */ + msg?: any; + /** 闄勫姞鏁版嵁 */ + extras?: any; + /** 鏃堕棿鎴� */ + timestamp?: number; + } + interface FriendlyResultPagedListQueryResultGetDictionaryDatasQueryResultItem { /** 璺熻釜Id */ traceId?: string; @@ -297,6 +380,42 @@ /** 閿欒鐮� */ errorCode?: string; data?: PagedListQueryResultGetDictionaryDatasQueryResultItem; + /** 鎵ц鎴愬姛 */ + success?: boolean; + /** 閿欒淇℃伅 */ + msg?: any; + /** 闄勫姞鏁版嵁 */ + extras?: any; + /** 鏃堕棿鎴� */ + timestamp?: number; + } + + interface FriendlyResultPagedListQueryResultGetEnterprisesQueryResultItem { + /** 璺熻釜Id */ + traceId?: string; + /** 鐘舵�佺爜 */ + code?: number; + /** 閿欒鐮� */ + errorCode?: string; + data?: PagedListQueryResultGetEnterprisesQueryResultItem; + /** 鎵ц鎴愬姛 */ + success?: boolean; + /** 閿欒淇℃伅 */ + msg?: any; + /** 闄勫姞鏁版嵁 */ + extras?: any; + /** 鏃堕棿鎴� */ + timestamp?: number; + } + + interface FriendlyResultPagedListQueryResultGetOperationUserInfosQueryResultItem { + /** 璺熻釜Id */ + traceId?: string; + /** 鐘舵�佺爜 */ + code?: number; + /** 閿欒鐮� */ + errorCode?: string; + data?: PagedListQueryResultGetOperationUserInfosQueryResultItem; /** 鎵ц鎴愬姛 */ success?: boolean; /** 閿欒淇℃伅 */ @@ -355,11 +474,82 @@ type GetCurrentLogierMenusQuery = Record<string, any>; - interface GetDictionaryDatasQuery { + interface GetDictionaryCategoriesQuery { pageModel?: PagedListQueryPageModel; + /** 鍏抽敭瀛� */ + keywords?: string; } - type GetDictionaryDatasQueryResultItem = Record<string, any>; + interface GetDictionaryCategoriesQueryResultItem { + /** Id */ + id?: string; + /** 缂栧彿 */ + code?: string; + /** 鍚嶇О */ + name?: string; + /** 瀛楁鍚嶏紙閫楀彿闅斿紑锛� */ + fieldNames?: string; + /** 鎺掑簭 */ + sort?: number; + } + + interface GetDictionaryDatasQuery { + pageModel?: PagedListQueryPageModel; + /** 绫诲埆Id */ + categoryId?: string; + /** 鍏抽敭瀛� */ + keywords?: string; + } + + interface GetDictionaryDatasQueryResultItem { + /** Id */ + id?: string; + /** 绫诲埆Id */ + categoryId?: string; + /** 涓婄骇Id */ + parentId?: string; + /** 缂栧彿 */ + code?: string; + /** 鏄剧ず鍐呭 */ + content: string; + /** 瀛楁1 */ + field1?: string; + /** 瀛楁2 */ + field2?: string; + /** 瀛楁3 */ + field3?: string; + /** 瀛楁4 */ + field4?: string; + /** 瀛楁5 */ + field5?: string; + /** 鎺掑簭 */ + sort?: number; + /** 鏄惁绂佺敤 */ + isDisabled?: boolean; + } + + interface GetEnterprisesQuery { + pageModel?: PagedListQueryPageModel; + /** 鍏抽敭瀛� */ + keywords?: string; + /** 鏄惁宸查厤缃� */ + isConfigured?: boolean; + } + + interface GetEnterprisesQueryResultItem { + /** Id */ + id?: string; + /** 浼佷笟鍏ㄧО */ + enterpriseName?: string; + /** 娉曚汉濮撳悕 */ + legalPerson?: string; + /** 缁熶竴绀句細淇$敤浠g爜 */ + societyCreditCode?: string; + /** 鑱旂郴浜� */ + contacts?: string; + /** 鑱旂郴鐢佃瘽 */ + contactNumber?: string; + } interface GetMenuQueryResult { /** Id */ @@ -477,6 +667,37 @@ remark?: string; } + interface GetOperationUserInfosQuery { + pageModel?: PagedListQueryPageModel; + /** 鍏抽敭瀛� */ + keywords?: string; + } + + interface GetOperationUserInfosQueryResultItem { + /** Id */ + id?: string; + /** 濮撳悕 */ + name?: string; + /** 鐢ㄦ埛鍚� */ + userName?: string; + /** 鎵嬫満鍙� */ + phoneNumber?: string; + /** 澶囨敞 */ + remark?: string; + /** 瑙掕壊 */ + roles?: GetOperationUserInfosQueryResultItemRole[]; + status?: EnumUserInfoStatus; + } + + interface GetOperationUserInfosQueryResultItemRole { + /** 鐢ㄦ埛Id */ + userInfoId?: string; + /** 瑙掕壊Id */ + id?: string; + /** 鍚嶇О */ + name?: string; + } + interface GetResourceFieldsQueryResultItem { /** 缂栧彿 */ code?: string; @@ -537,6 +758,8 @@ pageModel?: PagedListQueryPageModel; userType?: EnumUserType; clientType?: EnumClientType; + /** 鍏抽敭瀛� */ + keywords?: string; } interface GetRolesQueryResultItem { @@ -551,6 +774,32 @@ dataPower?: EnumRoleWebApiDataPower; /** 澶囨敞 */ remark?: string; + /** 鏄惁绂佺敤 */ + isDisabled?: boolean; + /** 鐢ㄦ埛鏁伴噺 */ + userCount?: number; + } + + interface GetRoleUserInfosQueryResultItem { + /** 鐢ㄦ埛Id */ + id?: string; + /** 濮撳悕 */ + name?: string; + /** 鐢ㄦ埛鍚� */ + userName?: string; + /** 鏄惁閫変腑 */ + isChecked?: boolean; + } + + interface GetUserInfoRolesQueryResultItem { + /** 瑙掕壊Id */ + id?: string; + /** 鍚嶇О */ + name?: string; + /** 澶囨敞 */ + remark?: string; + /** 鏄惁閫変腑 */ + isChecked?: boolean; } interface PagedListQueryPageModel { @@ -568,10 +817,28 @@ order?: EnumPagedListOrder; } + interface PagedListQueryResultGetDictionaryCategoriesQueryResultItem { + pageModel?: PagedListQueryResultPageModel; + /** 鏁版嵁 */ + data?: GetDictionaryCategoriesQueryResultItem[]; + } + interface PagedListQueryResultGetDictionaryDatasQueryResultItem { pageModel?: PagedListQueryResultPageModel; /** 鏁版嵁 */ data?: GetDictionaryDatasQueryResultItem[]; + } + + interface PagedListQueryResultGetEnterprisesQueryResultItem { + pageModel?: PagedListQueryResultPageModel; + /** 鏁版嵁 */ + data?: GetEnterprisesQueryResultItem[]; + } + + interface PagedListQueryResultGetOperationUserInfosQueryResultItem { + pageModel?: PagedListQueryResultPageModel; + /** 鏁版嵁 */ + data?: GetOperationUserInfosQueryResultItem[]; } interface PagedListQueryResultGetRolesQueryResultItem { @@ -607,6 +874,44 @@ accessToken?: string; /** 鍒锋柊浠ょ墝 */ refreshToken?: string; + } + + interface SaveDictionaryCategoryCommand { + id?: string; + /** 缂栧彿 */ + code: string; + /** 鍚嶇О */ + name: string; + /** 瀛楁鍚嶏紙閫楀彿闅斿紑锛� */ + fieldNames?: string; + /** 鎺掑簭 */ + sort?: number; + } + + interface SaveDictionaryDataCommand { + id?: string; + /** 绫诲埆Id */ + categoryId?: string; + /** 涓婄骇Id */ + parentId?: string; + /** 缂栧彿 */ + code?: string; + /** 鏄剧ず鍐呭 */ + content: string; + /** 瀛楁1 */ + field1?: string; + /** 瀛楁2 */ + field2?: string; + /** 瀛楁3 */ + field3?: string; + /** 瀛楁4 */ + field4?: string; + /** 瀛楁5 */ + field5?: string; + /** 鎺掑簭 */ + sort?: number; + /** 鏄惁绂佺敤 */ + isDisabled?: boolean; } interface SaveMenuButtonCommand { @@ -750,6 +1055,13 @@ resources?: GetRoleQueryResultResource[]; } + interface SetDictionaryDataIsDisabledCommand { + /** Id */ + ids?: string[]; + /** 鏄惁绂佺敤 */ + isDisabled?: boolean; + } + interface SetMenuSwitchCommand { /** Id */ ids?: string[]; @@ -759,4 +1071,31 @@ /** 鏄惁缂撳瓨锛坣ull鏃朵笉鏇存柊锛� */ isCache?: boolean; } + + interface SetRoleIsDisabledCommand { + /** Id */ + ids: string[]; + /** 鏄惁绂佺敤 */ + isDisabled?: boolean; + } + + interface SetRoleUserInfosCommand { + /** 瑙掕壊Id */ + roleId?: string; + /** 鐢ㄦ埛Id */ + userInfoIds?: string[]; + } + + interface SetUserInfoRolesCommand { + /** 鐢ㄦ埛Id */ + userInfoId?: string; + /** 瑙掕壊Id */ + roleIds?: string[]; + } + + interface SetUserInfoStatusCommand { + /** Id */ + ids?: string[]; + status?: EnumUserInfoStatus; + } } diff --git a/src/services/api/userInfo.ts b/src/services/api/userInfo.ts new file mode 100644 index 0000000..4367d18 --- /dev/null +++ b/src/services/api/userInfo.ts @@ -0,0 +1,66 @@ +/* eslint-disable */ +// @ts-ignore +import { request } from '@/utils/request'; + +/** 鏌ヨ杩愯惀绔敤鎴峰垎椤靛垪琛ㄦ暟鎹� POST /api/user/userInfo/getOperationUserInfos */ +export async function getOperationUserInfos( + body: API.GetOperationUserInfosQuery, + options?: API.RequestConfig +) { + return request<API.PagedListQueryResultGetOperationUserInfosQueryResultItem>( + '/api/user/userInfo/getOperationUserInfos', + { + method: 'POST', + headers: { + 'Content-Type': 'application/json-patch+json', + }, + data: body, + ...(options || {}), + } + ); +} + +/** 鏌ヨ鐢ㄦ埛瑙掕壊鍒楄〃 GET /api/user/userInfo/getUserInfoRoles */ +export async function getUserInfoRoles( + // 鍙犲姞鐢熸垚鐨凱aram绫诲瀷 (闈瀊ody鍙傛暟swagger榛樿娌℃湁鐢熸垚瀵硅薄) + params: API.APIgetUserInfoRolesParams, + options?: API.RequestConfig +) { + return request<API.GetUserInfoRolesQueryResultItem[]>('/api/user/userInfo/getUserInfoRoles', { + method: 'GET', + params: { + ...params, + }, + ...(options || {}), + }); +} + +/** 璁剧疆鐢ㄦ埛淇℃伅瑙掕壊 PUT /api/user/userInfo/setUserInfoRoles */ +export async function setUserInfoRoles( + body: API.SetUserInfoRolesCommand, + options?: API.RequestConfig +) { + return request<number>('/api/user/userInfo/setUserInfoRoles', { + method: 'PUT', + headers: { + 'Content-Type': 'application/json-patch+json', + }, + data: body, + ...(options || {}), + }); +} + +/** 璁剧疆鐢ㄦ埛淇℃伅鐘舵�� PUT /api/user/userInfo/setUserInfoStatus */ +export async function setUserInfoStatus( + body: API.SetUserInfoStatusCommand, + options?: API.RequestConfig +) { + return request<number>('/api/user/userInfo/setUserInfoStatus', { + method: 'PUT', + headers: { + 'Content-Type': 'application/json-patch+json', + }, + data: body, + ...(options || {}), + }); +} 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/views/DictionaryManage/SearchSetting2.vue b/src/views/DictionaryManage/SearchSetting2.vue index 6be79f0..4b68af9 100644 --- a/src/views/DictionaryManage/SearchSetting2.vue +++ b/src/views/DictionaryManage/SearchSetting2.vue @@ -3,7 +3,5 @@ </template> <script lang="ts" setup> -import { useAccess } from '@/hooks'; - const { checkSubModuleItemShow, column, operationBtns } = useAccess({}); </script> 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