zhengyiming
9 天以前 cf727afa850496f3a239907fab342b4bd3ff77fc
fix: 修改功能模块
1个文件已添加
1个文件已删除
21个文件已修改
878 ■■■■■ 已修改文件
.env.development 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
config/openapi.json 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/Dialog/OperateHistoryLogByTypeDialog.vue 86 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/constants/apiEnum.ts 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/constants/index.ts 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/constants/module.ts 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/services/api/auth.ts 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/services/api/dictionary.ts 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/services/api/index.ts 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/services/api/menu.ts 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/services/api/resource.ts 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/services/api/role.ts 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/services/api/typings.d.ts 252 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/modules/permission.ts 92 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/modules/user.ts 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/module/index.ts 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/oss/index.ts 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/request/index.ts 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/CPersonManage/components/CPersonDetailDialog.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/System/ModuleManage.vue 199 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/System/components/AddOrEditModuleDialog.vue 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
types/api.d.ts 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
vite.config.ts 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
.env.development
@@ -11,7 +11,7 @@
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/openapi.json
@@ -2,7 +2,7 @@
  "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"
src/components/Dialog/OperateHistoryLogByTypeDialog.vue
File was deleted
src/constants/apiEnum.ts
@@ -41,6 +41,22 @@
  Descending = 1,
}
/** 角色接口数据权限 */
export enum EnumRoleWebApiDataPower {
  /**自定义 */
  Custom = 1,
  /**查询个人创建数据 */
  Creator = 10,
  /**查询当前部门数据 */
  CurrentDepartment = 20,
  /**查询当前及下级部门数据 */
  NestingDepartment = 21,
  /**查询当前企业所有数据 */
  CurrentEnterprise = 30,
  /**查询所有 */
  All = 999,
}
/** 用户类型 */
export enum EnumUserType {
  /**个人 */
src/constants/index.ts
@@ -12,3 +12,4 @@
export * from './dic';
export * from './enterprise';
export * from './cPerson';
export * from './apiEnum';
src/constants/module.ts
@@ -1,3 +1,5 @@
import { defineColumns } from '@bole-core/components';
export enum SubModuleType {
  MenuButton = 1,
  /**
@@ -90,7 +92,7 @@
  [SubModuleType.Column]: FastColumnList,
};
export const ModuleColumns: API.CustomModuleColumnDto[] = [
export const ModuleColumns = defineColumns([
  {
    id: '1',
    enCode: 'name',
@@ -110,7 +112,7 @@
  },
  {
    id: '4',
    enCode: 'path',
    enCode: 'url',
    name: '路由地址',
  },
  {
@@ -131,4 +133,4 @@
    name: '有效',
    width: 80,
  },
];
]);
src/services/api/auth.ts
@@ -2,11 +2,25 @@
// @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: {
src/services/api/dictionary.ts
@@ -2,13 +2,13 @@
// @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',
    },
src/services/api/index.ts
@@ -2,13 +2,15 @@
/* 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,
};
src/services/api/menu.ts
@@ -3,7 +3,7 @@
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: {
@@ -15,31 +15,37 @@
}
/** 查询菜单详情 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: {
src/services/api/resource.ts
@@ -3,31 +3,31 @@
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 || {}),
  });
}
src/services/api/role.ts
New file
@@ -0,0 +1,54 @@
/* 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 || {}),
  });
}
src/services/api/typings.d.ts
@@ -3,7 +3,52 @@
    [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[];
  }
@@ -43,6 +88,21 @@
    Descending = 1,
  }
  enum EnumRoleWebApiDataPower {
    /**自定义 */
    Custom = 1,
    /**查询个人创建数据 */
    Creator = 10,
    /**查询当前部门数据 */
    CurrentDepartment = 20,
    /**查询当前及下级部门数据 */
    NestingDepartment = 21,
    /**查询当前企业所有数据 */
    CurrentEnterprise = 30,
    /**查询所有 */
    All = 999,
  }
  enum EnumUserType {
    /**个人 */
    Personal = 10,
@@ -63,16 +123,36 @@
    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;
    /** 时间戳 */
@@ -84,11 +164,31 @@
    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;
    /** 时间戳 */
@@ -100,12 +200,14 @@
    traceId?: string;
    /** 状态码 */
    code?: number;
    /** 错误码 */
    errorCode?: string;
    /** 数据 */
    data?: string;
    /** 执行成功 */
    success?: boolean;
    /** 错误信息 */
    errors?: any;
    msg?: any;
    /** 附加数据 */
    extras?: any;
    /** 时间戳 */
@@ -117,12 +219,14 @@
    traceId?: string;
    /** 状态码 */
    code?: number;
    /** 错误码 */
    errorCode?: string;
    /** 数据 */
    data?: number;
    /** 执行成功 */
    success?: boolean;
    /** 错误信息 */
    errors?: any;
    msg?: any;
    /** 附加数据 */
    extras?: any;
    /** 时间戳 */
@@ -134,12 +238,14 @@
    traceId?: string;
    /** 状态码 */
    code?: number;
    /** 错误码 */
    errorCode?: string;
    /** 数据 */
    data?: GetMenusQueryResultItem[];
    /** 执行成功 */
    success?: boolean;
    /** 错误信息 */
    errors?: any;
    msg?: any;
    /** 附加数据 */
    extras?: any;
    /** 时间戳 */
@@ -151,12 +257,14 @@
    traceId?: string;
    /** 状态码 */
    code?: number;
    /** 错误码 */
    errorCode?: string;
    /** 数据 */
    data?: GetResourceFieldsQueryResultItem[];
    /** 执行成功 */
    success?: boolean;
    /** 错误信息 */
    errors?: any;
    msg?: any;
    /** 附加数据 */
    extras?: any;
    /** 时间戳 */
@@ -168,12 +276,32 @@
    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;
    /** 时间戳 */
@@ -185,15 +313,27 @@
    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 {
@@ -206,16 +346,13 @@
    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 */
@@ -247,6 +384,8 @@
  interface GetMenuQueryResultButton {
    /** Id */
    id?: string;
    /** 是否选择(用户角色授权) */
    isChecked?: boolean;
    /** 编号 */
    code?: string;
    /** 名称 */
@@ -271,6 +410,8 @@
  interface GetMenuQueryResultField {
    /** Id */
    id?: string;
    /** 是否选择(用户角色授权) */
    isChecked?: boolean;
    /** 编号 */
    code?: string;
    /** 名称 */
@@ -292,18 +433,15 @@
    fields?: GetMenuQueryResultField[];
  }
  interface GetMenusQuery {
    userType?: EnumUserType;
    clientType?: EnumClientType;
  }
  interface GetMenusQueryResultItem {
    /** Id */
    id?: string;
    /** 是否选择(用户角色授权) */
    isChecked?: boolean;
    /** 上级Id */
    parentId?: string;
    /** 下级 */
    childrens?: GetMenusQueryResultItem[];
    children?: GetMenusQueryResultItem[];
    /** 编号 */
    code?: string;
    /** 名称 */
@@ -326,11 +464,6 @@
    remark?: string;
  }
  interface GetResourceFieldsQuery {
    /** Id */
    id?: string;
  }
  interface GetResourceFieldsQueryResultItem {
    /** 编号 */
    code?: string;
@@ -338,17 +471,11 @@
    name?: string;
  }
  interface GetResourcesQuery {
    /** 微服务 */
    service?: string;
    method?: EnumWebApiMethod;
    /** 关键字 */
    keywords?: string;
  }
  interface GetResourcesQueryResultItem {
    /** Id */
    id?: string;
    /** 是否选中(用于角色授权) */
    isChecked?: boolean;
    /** 微服务 */
    service?: string;
    /** 编号 */
@@ -364,6 +491,44 @@
    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;
@@ -377,6 +542,12 @@
    /** 属性 */
    property?: string;
    order?: EnumPagedListOrder;
  }
  interface PagedListQueryResultGetRolesQueryResultItem {
    pageModel?: PagedListQueryResultPageModel;
    /** 数据 */
    data?: GetRolesQueryResultItem[];
  }
  interface PagedListQueryResultPageModel {
@@ -484,4 +655,19 @@
    /** 字段 */
    fields?: SaveMenuCommandField[];
  }
  interface SaveRoleCommand {
    /** Id */
    id?: string;
    /** 名称 */
    name?: string;
    userType?: EnumUserType;
    clientType?: EnumClientType;
    /** 最低级别 */
    minLevel?: number;
    /** 菜单Id */
    menuIds?: string[];
    /** 资源 */
    resources?: GetRoleQueryResultResource[];
  }
}
src/store/modules/permission.ts
@@ -3,6 +3,7 @@
// 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[];
@@ -26,11 +27,16 @@
    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 });
@@ -55,47 +61,41 @@
  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) {
src/store/modules/user.ts
@@ -58,7 +58,7 @@
    // 用户登入
    async loginByUsername(params: API.PasswordLoginCommand) {
      let res = await authServices.authPasswordLogin(
      let res = await authServices.passwordLogin(
        {
          ...params,
          password: md5Encrypt(params.password),
@@ -107,7 +107,7 @@
      Object.assign(this, getDefaultState());
    },
    async refreshToken(params: API.AccessRefreshToken) {
    async refreshToken(params: any) {
      return Promise.resolve({
        accessToken: '1222',
        expiresIn: 1000 * 60 * 24 * 60,
src/utils/module/index.ts
@@ -3,13 +3,14 @@
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),
    });
@@ -59,7 +60,7 @@
    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;
    }
@@ -72,7 +73,7 @@
    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(
src/utils/oss/index.ts
@@ -1,15 +1,18 @@
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() {
src/utils/request/index.ts
@@ -14,7 +14,7 @@
const RefreshTokenUrl = '/GetTokenByRefreshToken';
/** 请求白名单,放置一些不需要token的接口(通过设置请求白名单,防止token过期后再请求造成的死循环问题) */
const whiteList = [RefreshTokenUrl, '/GetToken'];
const whiteList = [RefreshTokenUrl, '/passwordLogin'];
let loadingInstance: ReturnType<typeof Loading.service>;
@@ -55,9 +55,13 @@
  success: boolean;
  data: any;
  /**
   * http状态吗
   */
  code?: number;
  /**
   * 错误码
   */
  error?: number;
  errorCode?: string;
  /**
   * 错误信息
   */
@@ -74,7 +78,7 @@
}
interface ErrorInfo {
  errorCode?: number;
  errorCode?: string;
  errorMessage?: string;
  showType?: ErrorShowType;
  data: any;
@@ -156,7 +160,7 @@
    // 错误抛出
    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';
@@ -236,7 +240,7 @@
        endLoading();
        return getResponse ? response : (response.data as any).result;
        return getResponse ? response : response.data.data;
      },
      (error) => {
        endLoading();
src/views/CPersonManage/components/CPersonDetailDialog.vue
@@ -56,6 +56,7 @@
  ProFormImageUpload,
  ProFormRadio,
  ProFormInputNumber,
  defineColumns,
} from '@bole-core/components';
import { OrderInputType } from '@bole-core/core';
import _ from 'lodash';
@@ -90,7 +91,7 @@
  (e: 'onCancel'): void;
}>();
const column: API.CustomModuleColumnDto[] = [
const column = defineColumns([
  {
    id: '1',
    enCode: 'enterpirseName',
@@ -131,7 +132,7 @@
    enCode: 'contractUrl',
    name: '电子合同',
  },
];
]);
watch(
  () => visible.value,
src/views/System/ModuleManage.vue
@@ -6,7 +6,7 @@
          <div class="query-filter-list-item">
            <SearchInput
              v-model="state.searchValue"
              placeholder="角色名称"
              placeholder="菜单名称"
              @on-click-search="handleSearch"
              @keyup.enter="handleSearch()"
            >
@@ -45,18 +45,18 @@
          </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>
@@ -95,14 +95,22 @@
  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',
@@ -189,8 +197,8 @@
  sortCode: 0,
  path: '',
  isCache: true,
  isMenu: 1,
  enabledMark: 1,
  isMenu: true,
  enabledMark: true,
  showCacheSelect: false,
  showIconSelect: false,
  showSubMenuIconSelect: false,
@@ -198,10 +206,10 @@
  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>;
@@ -215,10 +223,16 @@
});
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) {}
@@ -234,16 +248,21 @@
  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;
@@ -252,46 +271,48 @@
  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;
@@ -341,16 +362,17 @@
}
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;
@@ -360,8 +382,9 @@
    }
    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();
@@ -370,28 +393,46 @@
  } 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) {}
}
@@ -411,7 +452,7 @@
}
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[]) {
src/views/System/components/AddOrEditModuleDialog.vue
@@ -57,10 +57,10 @@
        <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>
@@ -93,8 +93,8 @@
    sortCode: number;
    path: string;
    isCache: boolean;
    isMenu: number;
    enabledMark: number;
    isMenu: boolean;
    enabledMark: boolean;
    showCacheSelect: boolean;
    showIconSelect: boolean;
    showSubMenuIconSelect: boolean;
types/api.d.ts
@@ -14,38 +14,5 @@
    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[];
  }
}
vite.config.ts
@@ -56,7 +56,9 @@
    // 服务端渲染
    server: {
      // 是否开启 https
      // https: false,
      // https: {
      // },
      // 端口号
      port: VITE_PORT,
      host: '0.0.0.0',