| | |
| | | VITE_ROUTER_HISTORY = "h5" |
| | | |
| | | # 开发环境后端地址 |
| | | VITE_PROXY_DOMAIN_REAL = "http://localhost:44340/" |
| | | VITE_PROXY_DOMAIN_REAL = "http://localhost:53780/" |
| | | # VITE_PROXY_DOMAIN_REAL = "http://118.178.252.28:8752/" |
| | | |
| | | |
| | |
| | | "config": [ |
| | | { |
| | | "requestLibPath": "import { request } from '@/utils/request'", |
| | | "schemaPath": "https://localhost:44340/swagger/Default/swagger.json", |
| | | "schemaPath": "http://localhost:53780/swagger/Default/swagger.json", |
| | | "serversPath": "./src/services", |
| | | "enumStyle": "enum", |
| | | "enumFilePath": "../../constants/apiEnum.ts" |
| | |
| | | Descending = 1, |
| | | } |
| | | |
| | | /** 角色接口数据权限 */ |
| | | export enum EnumRoleWebApiDataPower { |
| | | /**自定义 */ |
| | | Custom = 1, |
| | | /**查询个人创建数据 */ |
| | | Creator = 10, |
| | | /**查询当前部门数据 */ |
| | | CurrentDepartment = 20, |
| | | /**查询当前及下级部门数据 */ |
| | | NestingDepartment = 21, |
| | | /**查询当前企业所有数据 */ |
| | | CurrentEnterprise = 30, |
| | | /**查询所有 */ |
| | | All = 999, |
| | | } |
| | | |
| | | /** 用户类型 */ |
| | | export enum EnumUserType { |
| | | /**个人 */ |
| | |
| | | export * from './dic'; |
| | | export * from './enterprise'; |
| | | export * from './cPerson'; |
| | | export * from './apiEnum'; |
| | |
| | | import { defineColumns } from '@bole-core/components'; |
| | | |
| | | export enum SubModuleType { |
| | | MenuButton = 1, |
| | | /** |
| | |
| | | [SubModuleType.Column]: FastColumnList, |
| | | }; |
| | | |
| | | export const ModuleColumns: API.CustomModuleColumnDto[] = [ |
| | | export const ModuleColumns = defineColumns([ |
| | | { |
| | | id: '1', |
| | | enCode: 'name', |
| | |
| | | }, |
| | | { |
| | | id: '4', |
| | | enCode: 'path', |
| | | enCode: 'url', |
| | | name: '路由地址', |
| | | }, |
| | | { |
| | |
| | | name: '有效', |
| | | width: 80, |
| | | }, |
| | | ]; |
| | | ]); |
| | |
| | | // @ts-ignore |
| | | import { request } from '@/utils/request'; |
| | | |
| | | /** 密码登录 POST /api/user/auth/passwordLogin */ |
| | | export async function authPasswordLogin( |
| | | body: API.PasswordLoginCommand, |
| | | /** 获取阿里云OSS授权信息 GET /api/user/auth/getAliyunOSSAcs */ |
| | | export async function getAliyunOSSAcs( |
| | | // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) |
| | | params: API.APIgetAliyunOSSAcsParams, |
| | | options?: API.RequestConfig |
| | | ) { |
| | | return request<API.GetAliyunOSSAcsQueryResult>('/api/user/auth/getAliyunOSSAcs', { |
| | | method: 'GET', |
| | | params: { |
| | | ...params, |
| | | query: undefined, |
| | | ...params['query'], |
| | | }, |
| | | ...(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', |
| | | headers: { |
| | |
| | | // @ts-ignore |
| | | import { request } from '@/utils/request'; |
| | | |
| | | /** 获取字典数据分页列表 GET /api/main/dictionary/getDictionaryDatas */ |
| | | export async function dictionaryGetDictionaryDatas( |
| | | /** 获取字典数据分页列表 POST /api/main/dictionary/getDictionaryDatas */ |
| | | export async function getDictionaryDatas( |
| | | body: API.GetDictionaryDatasQuery, |
| | | options?: API.RequestConfig |
| | | ) { |
| | | return request<API.GetDictionaryDatasQueryResult>('/api/main/dictionary/getDictionaryDatas', { |
| | | method: 'GET', |
| | | method: 'POST', |
| | | headers: { |
| | | 'Content-Type': 'application/json-patch+json', |
| | | }, |
| | |
| | | /* eslint-disable */ |
| | | // API 更新时间: |
| | | // API 唯一标识: |
| | | import * as dictionary from './dictionary'; |
| | | import * as auth from './auth'; |
| | | import * as menu from './menu'; |
| | | import * as resource from './resource'; |
| | | import * as dictionary from './dictionary'; |
| | | import * as role from './role'; |
| | | export default { |
| | | dictionary, |
| | | auth, |
| | | menu, |
| | | resource, |
| | | dictionary, |
| | | role, |
| | | }; |
| | |
| | | import { request } from '@/utils/request'; |
| | | |
| | | /** 删除菜单 DELETE /api/user/menu/deleteMenu */ |
| | | export async function menuDeleteMenu(body: API.DeleteMenuCommand, options?: API.RequestConfig) { |
| | | export async function deleteMenu(body: API.DeleteMenuCommand, options?: API.RequestConfig) { |
| | | return request<number>('/api/user/menu/deleteMenu', { |
| | | method: 'DELETE', |
| | | headers: { |
| | |
| | | } |
| | | |
| | | /** 查询菜单详情 GET /api/user/menu/getMenu */ |
| | | export async function menuGetMenu(body: API.GetMenuQuery, options?: API.RequestConfig) { |
| | | export async function getMenu( |
| | | // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) |
| | | params: API.APIgetMenuParams, |
| | | options?: API.RequestConfig |
| | | ) { |
| | | return request<API.GetMenuQueryResult>('/api/user/menu/getMenu', { |
| | | method: 'GET', |
| | | headers: { |
| | | 'Content-Type': 'application/json-patch+json', |
| | | params: { |
| | | ...params, |
| | | }, |
| | | data: body, |
| | | ...(options || {}), |
| | | }); |
| | | } |
| | | |
| | | /** 查询菜单列表 GET /api/user/menu/getMenus */ |
| | | export async function menuGetMenus(body: API.GetMenusQuery, options?: API.RequestConfig) { |
| | | export async function getMenus( |
| | | // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) |
| | | params: API.APIgetMenusParams, |
| | | options?: API.RequestConfig |
| | | ) { |
| | | return request<API.GetMenusQueryResultItem[]>('/api/user/menu/getMenus', { |
| | | method: 'GET', |
| | | headers: { |
| | | 'Content-Type': 'application/json-patch+json', |
| | | params: { |
| | | ...params, |
| | | }, |
| | | data: body, |
| | | ...(options || {}), |
| | | }); |
| | | } |
| | | |
| | | /** 保存菜单 POST /api/user/menu/saveMenu */ |
| | | export async function menuSaveMenu(body: API.SaveMenuCommand, options?: API.RequestConfig) { |
| | | export async function saveMenu(body: API.SaveMenuCommand, options?: API.RequestConfig) { |
| | | return request<string>('/api/user/menu/saveMenu', { |
| | | method: 'POST', |
| | | headers: { |
| | |
| | | import { request } from '@/utils/request'; |
| | | |
| | | /** 获取资源字段 GET /api/user/resource/getResourceFields */ |
| | | export async function resourceGetResourceFields( |
| | | body: API.GetResourceFieldsQuery, |
| | | export async function getResourceFields( |
| | | // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) |
| | | params: API.APIgetResourceFieldsParams, |
| | | options?: API.RequestConfig |
| | | ) { |
| | | return request<API.GetResourceFieldsQueryResultItem[]>('/api/user/resource/getResourceFields', { |
| | | method: 'GET', |
| | | headers: { |
| | | 'Content-Type': 'application/json-patch+json', |
| | | params: { |
| | | ...params, |
| | | }, |
| | | data: body, |
| | | ...(options || {}), |
| | | }); |
| | | } |
| | | |
| | | /** 获取资源列表 GET /api/user/resource/getResources */ |
| | | export async function resourceGetResources( |
| | | body: API.GetResourcesQuery, |
| | | export async function getResources( |
| | | // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) |
| | | params: API.APIgetResourcesParams, |
| | | options?: API.RequestConfig |
| | | ) { |
| | | return request<API.GetResourcesQueryResultItem[]>('/api/user/resource/getResources', { |
| | | method: 'GET', |
| | | headers: { |
| | | 'Content-Type': 'application/json-patch+json', |
| | | params: { |
| | | ...params, |
| | | }, |
| | | data: body, |
| | | ...(options || {}), |
| | | }); |
| | | } |
New file |
| | |
| | | /* eslint-disable */ |
| | | // @ts-ignore |
| | | import { request } from '@/utils/request'; |
| | | |
| | | /** 删除角色 DELETE /api/user/role/deleteRole */ |
| | | export async function deleteRole(body: API.DeleteRoleCommand, options?: API.RequestConfig) { |
| | | return request<number>('/api/user/role/deleteRole', { |
| | | method: 'DELETE', |
| | | headers: { |
| | | 'Content-Type': 'application/json-patch+json', |
| | | }, |
| | | data: body, |
| | | ...(options || {}), |
| | | }); |
| | | } |
| | | |
| | | /** 查询角色详情 GET /api/user/role/getRole */ |
| | | export async function getRole( |
| | | // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) |
| | | params: API.APIgetRoleParams, |
| | | options?: API.RequestConfig |
| | | ) { |
| | | return request<API.GetRoleQueryResult>('/api/user/role/getRole', { |
| | | method: 'GET', |
| | | params: { |
| | | ...params, |
| | | }, |
| | | ...(options || {}), |
| | | }); |
| | | } |
| | | |
| | | /** 查询角色列表 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', |
| | | headers: { |
| | | 'Content-Type': 'application/json-patch+json', |
| | | }, |
| | | data: body, |
| | | ...(options || {}), |
| | | }); |
| | | } |
| | | |
| | | /** 保存角色 POST /api/user/role/saveRole */ |
| | | export async function saveRole(body: API.SaveRoleCommand, options?: API.RequestConfig) { |
| | | return request<string>('/api/user/role/saveRole', { |
| | | method: 'POST', |
| | | headers: { |
| | | 'Content-Type': 'application/json-patch+json', |
| | | }, |
| | | data: body, |
| | | ...(options || {}), |
| | | }); |
| | | } |
| | |
| | | [key: string]: any; |
| | | } |
| | | |
| | | interface APIgetAliyunOSSAcsParams { |
| | | query?: GetAliyunOSSAcsQuery; |
| | | } |
| | | |
| | | interface APIgetMenuParams { |
| | | /** Id */ |
| | | id?: string; |
| | | /** 角色Id */ |
| | | roleId?: string; |
| | | } |
| | | |
| | | interface APIgetMenusParams { |
| | | /** 用户类型 */ |
| | | userType?: EnumUserType; |
| | | /** 客户端类型 */ |
| | | clientType?: EnumClientType; |
| | | /** 角色Id */ |
| | | roleId?: string; |
| | | } |
| | | |
| | | interface APIgetResourceFieldsParams { |
| | | /** Id */ |
| | | id?: string; |
| | | } |
| | | |
| | | interface APIgetResourcesParams { |
| | | /** 微服务 */ |
| | | service?: string; |
| | | /** 请求方式 */ |
| | | method?: EnumWebApiMethod; |
| | | /** 关键字 */ |
| | | keywords?: string; |
| | | /** 角色Id */ |
| | | roleId?: string; |
| | | } |
| | | |
| | | interface APIgetRoleParams { |
| | | /** Id */ |
| | | id?: string; |
| | | } |
| | | |
| | | interface DeleteMenuCommand { |
| | | ids: string[]; |
| | | } |
| | | |
| | | interface DeleteRoleCommand { |
| | | ids: string[]; |
| | | } |
| | | |
| | |
| | | Descending = 1, |
| | | } |
| | | |
| | | enum EnumRoleWebApiDataPower { |
| | | /**自定义 */ |
| | | Custom = 1, |
| | | /**查询个人创建数据 */ |
| | | Creator = 10, |
| | | /**查询当前部门数据 */ |
| | | CurrentDepartment = 20, |
| | | /**查询当前及下级部门数据 */ |
| | | NestingDepartment = 21, |
| | | /**查询当前企业所有数据 */ |
| | | CurrentEnterprise = 30, |
| | | /**查询所有 */ |
| | | All = 999, |
| | | } |
| | | |
| | | enum EnumUserType { |
| | | /**个人 */ |
| | | Personal = 10, |
| | |
| | | Delete = 40, |
| | | } |
| | | |
| | | interface FriendlyResultGetAliyunOSSAcsQueryResult { |
| | | /** 跟踪Id */ |
| | | traceId?: string; |
| | | /** 状态码 */ |
| | | code?: number; |
| | | /** 错误码 */ |
| | | errorCode?: string; |
| | | data?: GetAliyunOSSAcsQueryResult; |
| | | /** 执行成功 */ |
| | | success?: boolean; |
| | | /** 错误信息 */ |
| | | msg?: any; |
| | | /** 附加数据 */ |
| | | extras?: any; |
| | | /** 时间戳 */ |
| | | timestamp?: number; |
| | | } |
| | | |
| | | interface FriendlyResultGetDictionaryDatasQueryResult { |
| | | /** 跟踪Id */ |
| | | traceId?: string; |
| | | /** 状态码 */ |
| | | code?: number; |
| | | /** 错误码 */ |
| | | errorCode?: string; |
| | | data?: GetDictionaryDatasQueryResult; |
| | | /** 执行成功 */ |
| | | success?: boolean; |
| | | /** 错误信息 */ |
| | | errors?: any; |
| | | msg?: any; |
| | | /** 附加数据 */ |
| | | extras?: any; |
| | | /** 时间戳 */ |
| | |
| | | traceId?: string; |
| | | /** 状态码 */ |
| | | code?: number; |
| | | /** 错误码 */ |
| | | errorCode?: string; |
| | | data?: GetMenuQueryResult; |
| | | /** 执行成功 */ |
| | | success?: boolean; |
| | | /** 错误信息 */ |
| | | errors?: any; |
| | | msg?: any; |
| | | /** 附加数据 */ |
| | | extras?: any; |
| | | /** 时间戳 */ |
| | | timestamp?: number; |
| | | } |
| | | |
| | | interface FriendlyResultGetRoleQueryResult { |
| | | /** 跟踪Id */ |
| | | traceId?: string; |
| | | /** 状态码 */ |
| | | code?: number; |
| | | /** 错误码 */ |
| | | errorCode?: string; |
| | | data?: GetRoleQueryResult; |
| | | /** 执行成功 */ |
| | | success?: boolean; |
| | | /** 错误信息 */ |
| | | msg?: any; |
| | | /** 附加数据 */ |
| | | extras?: any; |
| | | /** 时间戳 */ |
| | |
| | | traceId?: string; |
| | | /** 状态码 */ |
| | | code?: number; |
| | | /** 错误码 */ |
| | | errorCode?: string; |
| | | /** 数据 */ |
| | | data?: string; |
| | | /** 执行成功 */ |
| | | success?: boolean; |
| | | /** 错误信息 */ |
| | | errors?: any; |
| | | msg?: any; |
| | | /** 附加数据 */ |
| | | extras?: any; |
| | | /** 时间戳 */ |
| | |
| | | traceId?: string; |
| | | /** 状态码 */ |
| | | code?: number; |
| | | /** 错误码 */ |
| | | errorCode?: string; |
| | | /** 数据 */ |
| | | data?: number; |
| | | /** 执行成功 */ |
| | | success?: boolean; |
| | | /** 错误信息 */ |
| | | errors?: any; |
| | | msg?: any; |
| | | /** 附加数据 */ |
| | | extras?: any; |
| | | /** 时间戳 */ |
| | |
| | | traceId?: string; |
| | | /** 状态码 */ |
| | | code?: number; |
| | | /** 错误码 */ |
| | | errorCode?: string; |
| | | /** 数据 */ |
| | | data?: GetMenusQueryResultItem[]; |
| | | /** 执行成功 */ |
| | | success?: boolean; |
| | | /** 错误信息 */ |
| | | errors?: any; |
| | | msg?: any; |
| | | /** 附加数据 */ |
| | | extras?: any; |
| | | /** 时间戳 */ |
| | |
| | | traceId?: string; |
| | | /** 状态码 */ |
| | | code?: number; |
| | | /** 错误码 */ |
| | | errorCode?: string; |
| | | /** 数据 */ |
| | | data?: GetResourceFieldsQueryResultItem[]; |
| | | /** 执行成功 */ |
| | | success?: boolean; |
| | | /** 错误信息 */ |
| | | errors?: any; |
| | | msg?: any; |
| | | /** 附加数据 */ |
| | | extras?: any; |
| | | /** 时间戳 */ |
| | |
| | | traceId?: string; |
| | | /** 状态码 */ |
| | | code?: number; |
| | | /** 错误码 */ |
| | | errorCode?: string; |
| | | /** 数据 */ |
| | | data?: GetResourcesQueryResultItem[]; |
| | | /** 执行成功 */ |
| | | success?: boolean; |
| | | /** 错误信息 */ |
| | | errors?: any; |
| | | msg?: any; |
| | | /** 附加数据 */ |
| | | extras?: any; |
| | | /** 时间戳 */ |
| | | timestamp?: number; |
| | | } |
| | | |
| | | interface FriendlyResultPagedListQueryResultGetRolesQueryResultItem { |
| | | /** 跟踪Id */ |
| | | traceId?: string; |
| | | /** 状态码 */ |
| | | code?: number; |
| | | /** 错误码 */ |
| | | errorCode?: string; |
| | | data?: PagedListQueryResultGetRolesQueryResultItem; |
| | | /** 执行成功 */ |
| | | success?: boolean; |
| | | /** 错误信息 */ |
| | | msg?: any; |
| | | /** 附加数据 */ |
| | | extras?: any; |
| | | /** 时间戳 */ |
| | |
| | | traceId?: string; |
| | | /** 状态码 */ |
| | | code?: number; |
| | | /** 错误码 */ |
| | | errorCode?: string; |
| | | data?: PasswordLoginCommandCallback; |
| | | /** 执行成功 */ |
| | | success?: boolean; |
| | | /** 错误信息 */ |
| | | errors?: any; |
| | | msg?: any; |
| | | /** 附加数据 */ |
| | | extras?: any; |
| | | /** 时间戳 */ |
| | | timestamp?: number; |
| | | } |
| | | |
| | | type GetAliyunOSSAcsQuery = Record<string, any>; |
| | | |
| | | interface GetAliyunOSSAcsQueryResult { |
| | | expiration?: string; |
| | | ossAccessSecret?: string; |
| | | ossAccessKeyId?: string; |
| | | securityToken?: string; |
| | | requestId?: string; |
| | | } |
| | | |
| | | interface GetDictionaryDatasQuery { |
| | |
| | | data?: GetDictionaryDatasQueryResultItem[]; |
| | | } |
| | | |
| | | type GetDictionaryDatasQueryResultItem = true; |
| | | |
| | | interface GetMenuQuery { |
| | | /** Id */ |
| | | id?: string; |
| | | } |
| | | type GetDictionaryDatasQueryResultItem = Record<string, any>; |
| | | |
| | | interface GetMenuQueryResult { |
| | | /** Id */ |
| | | id?: string; |
| | | /** 是否选择(用户角色授权) */ |
| | | isChecked?: boolean; |
| | | userType?: EnumUserType; |
| | | clientType?: EnumClientType; |
| | | /** 上级Id */ |
| | |
| | | interface GetMenuQueryResultButton { |
| | | /** Id */ |
| | | id?: string; |
| | | /** 是否选择(用户角色授权) */ |
| | | isChecked?: boolean; |
| | | /** 编号 */ |
| | | code?: string; |
| | | /** 名称 */ |
| | |
| | | interface GetMenuQueryResultField { |
| | | /** Id */ |
| | | id?: string; |
| | | /** 是否选择(用户角色授权) */ |
| | | isChecked?: boolean; |
| | | /** 编号 */ |
| | | code?: string; |
| | | /** 名称 */ |
| | |
| | | fields?: GetMenuQueryResultField[]; |
| | | } |
| | | |
| | | interface GetMenusQuery { |
| | | userType?: EnumUserType; |
| | | clientType?: EnumClientType; |
| | | } |
| | | |
| | | interface GetMenusQueryResultItem { |
| | | /** Id */ |
| | | id?: string; |
| | | /** 是否选择(用户角色授权) */ |
| | | isChecked?: boolean; |
| | | /** 上级Id */ |
| | | parentId?: string; |
| | | /** 下级 */ |
| | | childrens?: GetMenusQueryResultItem[]; |
| | | children?: GetMenusQueryResultItem[]; |
| | | /** 编号 */ |
| | | code?: string; |
| | | /** 名称 */ |
| | |
| | | remark?: string; |
| | | } |
| | | |
| | | interface GetResourceFieldsQuery { |
| | | /** Id */ |
| | | id?: string; |
| | | } |
| | | |
| | | interface GetResourceFieldsQueryResultItem { |
| | | /** 编号 */ |
| | | code?: string; |
| | |
| | | name?: string; |
| | | } |
| | | |
| | | interface GetResourcesQuery { |
| | | /** 微服务 */ |
| | | service?: string; |
| | | method?: EnumWebApiMethod; |
| | | /** 关键字 */ |
| | | keywords?: string; |
| | | } |
| | | |
| | | interface GetResourcesQueryResultItem { |
| | | /** Id */ |
| | | id?: string; |
| | | /** 是否选中(用于角色授权) */ |
| | | isChecked?: boolean; |
| | | /** 微服务 */ |
| | | service?: string; |
| | | /** 编号 */ |
| | |
| | | responseTypeName?: string; |
| | | } |
| | | |
| | | interface GetRoleQueryResult { |
| | | /** Id */ |
| | | id?: string; |
| | | /** 名称 */ |
| | | name?: string; |
| | | userType?: EnumUserType; |
| | | clientType?: EnumClientType; |
| | | /** 最低级别 */ |
| | | minLevel?: number; |
| | | /** 菜单Id */ |
| | | menuIds?: string[]; |
| | | /** 资源 */ |
| | | resources?: GetRoleQueryResultResource[]; |
| | | } |
| | | |
| | | interface GetRoleQueryResultResource { |
| | | /** 资源Id */ |
| | | resourceId?: string; |
| | | dataPower?: EnumRoleWebApiDataPower; |
| | | } |
| | | |
| | | interface GetRolesQuery { |
| | | pageModel?: PagedListQueryPageModel; |
| | | userType?: EnumUserType; |
| | | clientType?: EnumClientType; |
| | | } |
| | | |
| | | interface GetRolesQueryResultItem { |
| | | /** Id */ |
| | | id?: string; |
| | | /** 名称 */ |
| | | name?: string; |
| | | userType?: EnumUserType; |
| | | clientType?: EnumClientType; |
| | | /** 最低级别 */ |
| | | minLevel?: number; |
| | | } |
| | | |
| | | interface PagedListQueryPageModel { |
| | | /** 行数 */ |
| | | rows?: number; |
| | |
| | | /** 属性 */ |
| | | property?: string; |
| | | order?: EnumPagedListOrder; |
| | | } |
| | | |
| | | interface PagedListQueryResultGetRolesQueryResultItem { |
| | | pageModel?: PagedListQueryResultPageModel; |
| | | /** 数据 */ |
| | | data?: GetRolesQueryResultItem[]; |
| | | } |
| | | |
| | | interface PagedListQueryResultPageModel { |
| | |
| | | /** 字段 */ |
| | | fields?: SaveMenuCommandField[]; |
| | | } |
| | | |
| | | interface SaveRoleCommand { |
| | | /** Id */ |
| | | id?: string; |
| | | /** 名称 */ |
| | | name?: string; |
| | | userType?: EnumUserType; |
| | | clientType?: EnumClientType; |
| | | /** 最低级别 */ |
| | | minLevel?: number; |
| | | /** 菜单Id */ |
| | | menuIds?: string[]; |
| | | /** 资源 */ |
| | | resources?: GetRoleQueryResultResource[]; |
| | | } |
| | | } |
| | |
| | | // import { RouteConfigs } from "@/layout/types"; |
| | | import { constantRoutes, Route } from '@/router'; |
| | | import { addAsyncRoutes, ascending } from '@/router/utils'; |
| | | import * as menuServices from '@/services/api/menu'; |
| | | |
| | | export interface PermissonState { |
| | | routes: Route[]; |
| | |
| | | getModuleList() { |
| | | return new Promise<Route[]>(async (resolve, reject) => { |
| | | try { |
| | | // const res = await baseModuleServices.getCurrentUserModuleList({ |
| | | // showLoading: false, |
| | | // }); |
| | | const res = []; |
| | | const accessedRoutes = ascending(addAsyncRoutes(formatModuleList(res, null))); // createAccessedRoutes(userMenuList, userInfo) |
| | | const res = await menuServices.getMenus( |
| | | { |
| | | userType: EnumUserType.Operation, |
| | | clientType: EnumClientType.PcWeb, |
| | | }, |
| | | { |
| | | showLoading: false, |
| | | } |
| | | ); |
| | | const accessedRoutes = ascending(addAsyncRoutes(formatModuleList(res))); // createAccessedRoutes(userMenuList, userInfo) |
| | | //@ts-ignore |
| | | accessedRoutes.push({ path: '/:pathMatch(.*)*', redirect: '/404', hidden: true }); |
| | | |
| | |
| | | return usePermissionStore(store); |
| | | } |
| | | |
| | | function formatModuleList(moduleList: API.ModuleDto[], parentId: string | null) { |
| | | const treeModuleList: Route[] = []; |
| | | if (moduleList.length > 0) { |
| | | moduleList.forEach((item) => { |
| | | if (item.parentId === parentId) { |
| | | const isRootModule = !item.parentId && item.isMenu === 1; |
| | | //@ts-ignore |
| | | const asyncRoute: Route = isRootModule |
| | | ? { |
| | | path: formatPath(item.path), |
| | | name: item.enCode, |
| | | redirect: 'noRedirect', |
| | | alwaysShow: true, |
| | | hidden: item.isMenu !== 1, |
| | | meta: { |
| | | title: item.name, |
| | | icon: item.icon, |
| | | moduleId: item.id, |
| | | rank: item?.sortCode, |
| | | rootMenu: true, |
| | | }, |
| | | } |
| | | : { |
| | | path: formatPath(item.path), |
| | | name: item.enCode, |
| | | hidden: item.isMenu !== 1, |
| | | alwaysShow: true, |
| | | meta: { |
| | | title: item.name, |
| | | moduleId: item.id, |
| | | noCache: !item.isCache, |
| | | rank: item?.sortCode, |
| | | }, |
| | | }; |
| | | const children = formatModuleList(moduleList, item.id); |
| | | asyncRoute.children = children; |
| | | treeModuleList.push(asyncRoute); |
| | | } |
| | | }); |
| | | } |
| | | return treeModuleList; |
| | | function formatModuleList(moduleList: API.GetMenusQueryResultItem[]) { |
| | | return moduleList.map((item) => { |
| | | const isRootModule = !item.parentId && item.type == EnumMenuType.Menu; |
| | | //@ts-ignore |
| | | let asyncRoute: Route = isRootModule |
| | | ? { |
| | | path: formatPath(item.url), |
| | | name: item.code, |
| | | redirect: 'noRedirect', |
| | | alwaysShow: true, |
| | | hidden: item.type != EnumMenuType.Menu, |
| | | meta: { |
| | | title: item.name, |
| | | icon: item.icon, |
| | | moduleId: item.id, |
| | | rank: item?.sort, |
| | | rootMenu: true, |
| | | }, |
| | | } |
| | | : { |
| | | path: formatPath(item.url), |
| | | name: item.code, |
| | | hidden: item.type != EnumMenuType.Menu, |
| | | alwaysShow: true, |
| | | meta: { |
| | | title: item.name, |
| | | moduleId: item.id, |
| | | noCache: !item.isCache, |
| | | rank: item?.sort, |
| | | }, |
| | | }; |
| | | const children = formatModuleList(item.children); |
| | | asyncRoute.children = children; |
| | | return asyncRoute; |
| | | }); |
| | | } |
| | | |
| | | function formatPath(path: string) { |
| | |
| | | |
| | | // 用户登入 |
| | | async loginByUsername(params: API.PasswordLoginCommand) { |
| | | let res = await authServices.authPasswordLogin( |
| | | let res = await authServices.passwordLogin( |
| | | { |
| | | ...params, |
| | | password: md5Encrypt(params.password), |
| | |
| | | Object.assign(this, getDefaultState()); |
| | | }, |
| | | |
| | | async refreshToken(params: API.AccessRefreshToken) { |
| | | async refreshToken(params: any) { |
| | | return Promise.resolve({ |
| | | accessToken: '1222', |
| | | expiresIn: 1000 * 60 * 24 * 60, |
| | |
| | | |
| | | export * from './tree'; |
| | | |
| | | export type TreeModuleDtoGroupDto = API.ModuleDto & { |
| | | export type TreeModuleDtoGroupDto = API.GetMenusQueryResultItem & { |
| | | children?: TreeModuleDtoGroupDto[]; |
| | | parentNode?: TreeModuleDtoGroupDto; |
| | | hasCheck?: boolean; |
| | | }; |
| | | |
| | | export class ModuleUtils { |
| | | static convertToModuleGroup(data: API.ModuleDto[]) { |
| | | static convertToModuleGroup(data: API.GetMenusQueryResultItem[]) { |
| | | const moduleTreeStore = new TreeStore<TreeModuleDtoGroupDto>({ |
| | | data: TreeStore.formatListToTree(data, null), |
| | | }); |
| | |
| | | if (module) { |
| | | const moduleTreeNode = moduleTreeStore.getNode(module.id); |
| | | const siblingsNodes = moduleTreeNode.parent.childNodes; |
| | | return siblingsNodes[siblingsNodes.length - 1].data.sortCode; |
| | | return siblingsNodes[siblingsNodes.length - 1].data.sort; |
| | | } else { |
| | | return moduleTreeStore.root.childNodes.length; |
| | | } |
| | |
| | | const moduleTreeNode = moduleTreeStore.getNode(module.id); |
| | | const childNodes = moduleTreeNode.childNodes; |
| | | const lastChildNode = childNodes[childNodes.length - 1]; |
| | | return lastChildNode ? lastChildNode.data.sortCode : 0; |
| | | return lastChildNode ? lastChildNode.data.sort : 0; |
| | | } |
| | | |
| | | static getParentModule( |
| | |
| | | import { BoleOss } from '@bole-core/core'; |
| | | import { loadEnv } from '@build/index'; |
| | | import AliOSS from 'ali-oss'; |
| | | import * as authServices from '@/services/api/auth'; |
| | | |
| | | export class OssManager { |
| | | private static OssInstance: BoleOss; |
| | | |
| | | private static async getOssSTS() { |
| | | return Promise.resolve({}); |
| | | // return await accountServices.getOssSTS({ |
| | | // showLoading: false, |
| | | // }); |
| | | return await authServices.getAliyunOSSAcs( |
| | | {}, |
| | | { |
| | | showLoading: false, |
| | | } |
| | | ); |
| | | } |
| | | |
| | | public static async getOssInstance() { |
| | |
| | | const RefreshTokenUrl = '/GetTokenByRefreshToken'; |
| | | |
| | | /** 请求白名单,放置一些不需要token的接口(通过设置请求白名单,防止token过期后再请求造成的死循环问题) */ |
| | | const whiteList = [RefreshTokenUrl, '/GetToken']; |
| | | const whiteList = [RefreshTokenUrl, '/passwordLogin']; |
| | | |
| | | let loadingInstance: ReturnType<typeof Loading.service>; |
| | | |
| | |
| | | success: boolean; |
| | | data: any; |
| | | /** |
| | | * http状态吗 |
| | | */ |
| | | code?: number; |
| | | /** |
| | | * 错误码 |
| | | */ |
| | | error?: number; |
| | | errorCode?: string; |
| | | /** |
| | | * 错误信息 |
| | | */ |
| | |
| | | } |
| | | |
| | | interface ErrorInfo { |
| | | errorCode?: number; |
| | | errorCode?: string; |
| | | errorMessage?: string; |
| | | showType?: ErrorShowType; |
| | | data: any; |
| | |
| | | |
| | | // 错误抛出 |
| | | errorThrower: (res) => { |
| | | const { success, data, error: errorCode, msg, showType } = res; |
| | | const { success, data, errorCode, msg, showType } = res; |
| | | if (!success) { |
| | | const error: any = new Error(msg); |
| | | error.name = 'BizError'; |
| | |
| | | |
| | | endLoading(); |
| | | |
| | | return getResponse ? response : (response.data as any).result; |
| | | return getResponse ? response : response.data.data; |
| | | }, |
| | | (error) => { |
| | | endLoading(); |
| | |
| | | ProFormImageUpload, |
| | | ProFormRadio, |
| | | ProFormInputNumber, |
| | | defineColumns, |
| | | } from '@bole-core/components'; |
| | | import { OrderInputType } from '@bole-core/core'; |
| | | import _ from 'lodash'; |
| | |
| | | (e: 'onCancel'): void; |
| | | }>(); |
| | | |
| | | const column: API.CustomModuleColumnDto[] = [ |
| | | const column = defineColumns([ |
| | | { |
| | | id: '1', |
| | | enCode: 'enterpirseName', |
| | |
| | | enCode: 'contractUrl', |
| | | name: '电子合同', |
| | | }, |
| | | ]; |
| | | ]); |
| | | |
| | | watch( |
| | | () => visible.value, |
| | |
| | | <div class="query-filter-list-item"> |
| | | <SearchInput |
| | | v-model="state.searchValue" |
| | | placeholder="角色名称" |
| | | placeholder="菜单名称" |
| | | @on-click-search="handleSearch" |
| | | @keyup.enter="handleSearch()" |
| | | > |
| | |
| | | </template> |
| | | <template v-else-if="column.property === 'isMenu'"> |
| | | <el-switch |
| | | v-model="row.isMenu" |
| | | :modelValue="row.type === EnumMenuType.Menu" |
| | | :onUpdate:modelValue="(v: boolean) =>{ |
| | | row.type=v?EnumMenuType.Menu:EnumMenuType.Page |
| | | }" |
| | | inline-prompt |
| | | :active-value="1" |
| | | :inactive-value="0" |
| | | @change="(v: number) => handleChangeStatus(v, row, 'isMenu')" |
| | | ></el-switch> |
| | | </template> |
| | | <template v-else-if="column.property === 'enabledMark'"> |
| | | <el-switch |
| | | v-model="row.enabledMark" |
| | | :active-value="1" |
| | | :inactive-value="0" |
| | | :modelValue="!row.isDisabled" |
| | | :onUpdate:modelValue="(v: boolean) => row.isDisabled =!v" |
| | | @change="(v: number) => handleChangeStatus(v, row, 'enabledMark')" |
| | | ></el-switch> |
| | | </template> |
| | |
| | | OperationBtnType, |
| | | SearchInput, |
| | | } from '@bole-core/components'; |
| | | import { ModuleUtils, TreeModuleDtoGroupDto, Message, TreeStore } from '@/utils'; |
| | | import { ModuleUtils, TreeModuleDtoGroupDto, Message, TreeStore, flattenTree } from '@/utils'; |
| | | import { TableInstance } from 'element-plus'; |
| | | import { SubModuleType, SubModuleTitle, SubModuleKey, FastBtn, ModuleColumns } from '@/constants'; |
| | | import { |
| | | SubModuleType, |
| | | SubModuleTitle, |
| | | SubModuleKey, |
| | | FastBtn, |
| | | ModuleColumns, |
| | | EnumMenuType, |
| | | } from '@/constants'; |
| | | import SubModuleEditDrawer from './components/SubModuleEditDrawer.vue'; |
| | | import AddOrEditModuleDialog from './components/AddOrEditModuleDialog.vue'; |
| | | import { useDebounceFn } from '@vueuse/core'; |
| | | import _ from 'lodash'; |
| | | import { useReset } from '@bole-core/core'; |
| | | import * as menuServices from '@/services/api/menu'; |
| | | |
| | | defineOptions({ |
| | | name: 'ModuleManage', |
| | |
| | | sortCode: 0, |
| | | path: '', |
| | | isCache: true, |
| | | isMenu: 1, |
| | | enabledMark: 1, |
| | | isMenu: true, |
| | | enabledMark: true, |
| | | showCacheSelect: false, |
| | | showIconSelect: false, |
| | | showSubMenuIconSelect: false, |
| | |
| | | title: '', |
| | | }; |
| | | const editForm = reactive({ ...BaseFormData }); |
| | | const currentDialogModule = ref<TreeModuleDtoGroupDto>({}); |
| | | const currentDialogModule = ref<API.GetMenuQueryResult>({}); |
| | | //drawer |
| | | const drawerVisible = ref(false); |
| | | const currentDrawerModule = ref<TreeModuleDtoGroupDto>({}); |
| | | const currentDrawerModule = ref<API.GetMenuQueryResult>({}); |
| | | const drawerState = reactive<{ |
| | | type: SubModuleType; |
| | | tableData: ValueOf<API.AllSubModule>; |
| | |
| | | }); |
| | | async function getAllModule() { |
| | | try { |
| | | let res = await baseModuleServices.getAllModuleList({ |
| | | showLoading: !state.loading, |
| | | }); |
| | | const treeStore = ModuleUtils.convertToModuleGroup(res); |
| | | let res = await menuServices.getMenus( |
| | | { |
| | | userType: EnumUserType.Operation, |
| | | clientType: EnumClientType.PcWeb, |
| | | }, |
| | | { |
| | | showLoading: false, |
| | | } |
| | | ); |
| | | const treeStore = ModuleUtils.convertToModuleGroup(flattenTree(res)); |
| | | moduleTreeStore.value = treeStore; |
| | | originModuleTree.value = [...treeStore.data]; |
| | | } catch (error) {} |
| | |
| | | statusType: T |
| | | ) { |
| | | try { |
| | | let params = { |
| | | ..._.omit(data, ['children', 'parentNode']), |
| | | [statusType]: value, |
| | | }; |
| | | await baseModuleServices.addOrEditModule(params); |
| | | // let params = { |
| | | // ..._.omit(data, ['children', 'parentNode']), |
| | | // [statusType]: value, |
| | | // }; |
| | | // await baseModuleServices.addOrEditModule(params); |
| | | } catch (error) { |
| | | Message.errorMessage('操作失败'); |
| | | } |
| | | } |
| | | function openDialog(options: { |
| | | |
| | | async function getMenu(id: string) { |
| | | return await menuServices.getMenu({ id: id }); |
| | | } |
| | | |
| | | async function openDialog(options: { |
| | | module?: TreeModuleDtoGroupDto; |
| | | showCacheSelect: boolean; |
| | | showIconSelect: boolean; |
| | |
| | | parentId: string; |
| | | baseSortCode?: number; |
| | | }) { |
| | | const { |
| | | module, |
| | | showCacheSelect, |
| | | showIconSelect, |
| | | showSubMenuIconSelect, |
| | | showParentSelect, |
| | | parentId, |
| | | baseSortCode, |
| | | } = options; |
| | | if (module) { |
| | | currentDialogModule.value = module; |
| | | useSetReactive(editForm, { |
| | | title: `${module.name}编辑`, |
| | | enCode: module.enCode, |
| | | name: module.name, |
| | | icon: module.icon, |
| | | sortCode: module.sortCode, |
| | | path: module.path, |
| | | isMenu: module.isMenu, |
| | | enabledMark: module.enabledMark, |
| | | parentId: parentId, |
| | | try { |
| | | const { |
| | | module, |
| | | showCacheSelect, |
| | | showIconSelect, |
| | | showSubMenuIconSelect, |
| | | showParentSelect, |
| | | isCache: module.isCache, |
| | | }); |
| | | } else { |
| | | currentDialogModule.value = {}; |
| | | useSetReactive(editForm, BaseFormData, { |
| | | title: '新增功能模块', |
| | | parentId: parentId, |
| | | showCacheSelect, |
| | | showIconSelect, |
| | | showSubMenuIconSelect, |
| | | showParentSelect, |
| | | sortCode: baseSortCode, |
| | | }); |
| | | } |
| | | editDialogFormVisible.value = true; |
| | | parentId, |
| | | baseSortCode, |
| | | } = options; |
| | | if (module) { |
| | | currentDialogModule.value = await getMenu(module.id); |
| | | useSetReactive(editForm, { |
| | | title: `${module.name}编辑`, |
| | | enCode: module.code, |
| | | name: module.name, |
| | | icon: module.icon, |
| | | sortCode: module.sort, |
| | | path: module.url, |
| | | isMenu: module.type == EnumMenuType.Menu, |
| | | enabledMark: !module.isDisabled, |
| | | parentId: parentId, |
| | | showCacheSelect, |
| | | showIconSelect, |
| | | showSubMenuIconSelect, |
| | | showParentSelect, |
| | | isCache: module.isCache, |
| | | }); |
| | | } else { |
| | | currentDialogModule.value = {}; |
| | | useSetReactive(editForm, BaseFormData, { |
| | | title: '新增功能模块', |
| | | parentId: parentId, |
| | | showCacheSelect, |
| | | showIconSelect, |
| | | showSubMenuIconSelect, |
| | | showParentSelect, |
| | | sortCode: baseSortCode, |
| | | }); |
| | | } |
| | | editDialogFormVisible.value = true; |
| | | } catch (error) {} |
| | | } |
| | | function handleAddOrEditRootModule(module?: TreeModuleDtoGroupDto) { |
| | | const showCacheSelect = false; |
| | |
| | | } |
| | | async function handleAddOrEditModule() { |
| | | try { |
| | | let params: API.ModuleDto = { |
| | | enCode: editForm.enCode, |
| | | let params: API.SaveMenuCommand = { |
| | | userType: EnumUserType.Operation, |
| | | clientType: EnumClientType.PcWeb, |
| | | code: editForm.enCode, |
| | | name: editForm.name, |
| | | sortCode: editForm.sortCode, |
| | | path: editForm.path, |
| | | // isCache: true, |
| | | isMenu: editForm.isMenu, |
| | | enabledMark: editForm.enabledMark, |
| | | type: editForm.isMenu ? EnumMenuType.Menu : EnumMenuType.Page, |
| | | visitLevel: EnumMenuVisitLevel.NeedPower, |
| | | icon: editForm.icon, |
| | | // parentId:, |
| | | url: editForm.path, |
| | | isDisabled: !editForm.enabledMark, |
| | | sort: editForm.sortCode, |
| | | }; |
| | | if (editForm.showCacheSelect) { |
| | | params.isCache = editForm.isCache; |
| | |
| | | } |
| | | if (currentDialogModule.value.id) { |
| | | params.id = currentDialogModule.value.id; |
| | | params.groups = currentDialogModule.value.groups; |
| | | } |
| | | const res = await baseModuleServices.addOrEditModule(params); |
| | | const res = await saveMenu(params); |
| | | if (res) { |
| | | Message.successMessage('保存成功'); |
| | | getAllModule(); |
| | |
| | | } catch (e) {} |
| | | } |
| | | |
| | | async function saveMenu(params: API.SaveMenuCommand) { |
| | | try { |
| | | const res = await menuServices.saveMenu(params); |
| | | if (res) { |
| | | Message.successMessage('保存成功'); |
| | | getAllModule(); |
| | | editDialogFormVisible.value = false; |
| | | return res; |
| | | } |
| | | } catch (error) {} |
| | | } |
| | | |
| | | async function handleDelete(module: TreeModuleDtoGroupDto) { |
| | | try { |
| | | await Message.deleteMessage(); |
| | | const res = await baseModuleServices.deleteModule({ id: module.id }); |
| | | const res = await menuServices.deleteMenu({ ids: [module.id] }); |
| | | if (res) { |
| | | Message.successMessage('删除成功'); |
| | | getAllModule(); |
| | | } |
| | | } catch (error) {} |
| | | } |
| | | function openDrawer(module: TreeModuleDtoGroupDto, type: SubModuleType) { |
| | | drawerState.type = type; |
| | | currentDrawerModule.value = module; |
| | | getBaseModuleGetAllSubModule(module, type); |
| | | async function openDrawer(module: TreeModuleDtoGroupDto, type: SubModuleType) { |
| | | try { |
| | | drawerState.type = type; |
| | | currentDrawerModule.value = await getMenu(module.id); |
| | | await nextTick(); |
| | | getBaseModuleGetAllSubModule(module, type); |
| | | } catch (error) {} |
| | | } |
| | | async function getBaseModuleGetAllSubModule(module: TreeModuleDtoGroupDto, type: SubModuleType) { |
| | | try { |
| | | let params = { |
| | | moduleId: module.id, |
| | | }; |
| | | const res = await baseModuleServices.getAllSubModule(params); |
| | | drawerState.tableData = res[SubModuleKey[type]]; |
| | | const defaultGroup = currentDrawerModule.value.groups.find((g) => g.group === 'default'); |
| | | if (type === SubModuleType.Column) { |
| | | drawerState.tableData = defaultGroup.fields; |
| | | } else { |
| | | drawerState.tableData = defaultGroup.buttonLocations.find( |
| | | (b) => b.location === SubModuleKey[type] |
| | | ); |
| | | } |
| | | drawerVisible.value = true; |
| | | } catch (error) {} |
| | | } |
| | |
| | | } |
| | | function getDefaultSortCode() { |
| | | return drawerState.tableData.length > 0 |
| | | ? drawerState.tableData[drawerState.tableData.length - 1].sortCode + 1 |
| | | ? drawerState.tableData[drawerState.tableData.length - 1].sort + 1 |
| | | : 0; |
| | | } |
| | | function handleBatchAddColumn(keys: string[]) { |
| | |
| | | <el-switch v-model="editForm.isCache" /> |
| | | </el-form-item> |
| | | <el-form-item label="菜单" prop="isMenu"> |
| | | <el-switch :active-value="1" :inactive-value="0" v-model="editForm.isMenu" /> |
| | | <el-switch v-model="editForm.isMenu" /> |
| | | </el-form-item> |
| | | <el-form-item label="有效" prop="enabledMark"> |
| | | <el-switch :active-value="1" :inactive-value="0" v-model="editForm.enabledMark" /> |
| | | <el-switch v-model="editForm.enabledMark" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | |
| | | sortCode: number; |
| | | path: string; |
| | | isCache: boolean; |
| | | isMenu: number; |
| | | enabledMark: number; |
| | | isMenu: boolean; |
| | | enabledMark: boolean; |
| | | showCacheSelect: boolean; |
| | | showIconSelect: boolean; |
| | | showSubMenuIconSelect: boolean; |
| | |
| | | customErrorHandler?: (error: any) => boolean; |
| | | } |
| | | |
| | | interface ModuleButtonDto { |
| | | isEdit?: boolean; |
| | | } |
| | | |
| | | interface ModuleColumnDto { |
| | | isEdit?: boolean; |
| | | fixed?: boolean | 'left' | 'right'; |
| | | needTips?: boolean; |
| | | } |
| | | |
| | | interface CustomModuleColumnDto extends ModuleColumnDto { |
| | | id: string; |
| | | enCode: string; |
| | | name: string; |
| | | } |
| | | |
| | | interface DepartmentTree { |
| | | leaf?: boolean; |
| | | } |
| | | interface StationTree { |
| | | leaf?: boolean; |
| | | } |
| | | |
| | | interface RoleList { |
| | | //是否是客户端 |
| | | isClient?: boolean; |
| | | } |
| | | |
| | | interface AreaTreeNode extends AreaDto { |
| | | children?: AreaTreeNode[]; |
| | | } |
| | | interface GetSearchSettingList { |
| | | children?: GetSearchSettingList[]; |
| | | } |
| | | } |
| | |
| | | // 服务端渲染 |
| | | server: { |
| | | // 是否开启 https |
| | | // https: false, |
| | | // https: { |
| | | |
| | | // }, |
| | | // 端口号 |
| | | port: VITE_PORT, |
| | | host: '0.0.0.0', |