From 89ff11e1b73c7720c819bdced5d19d0674b68f8e Mon Sep 17 00:00:00 2001 From: bunny <1319900154@qq.com> Date: Thu, 10 Oct 2024 10:32:17 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=9A=80=20=E6=89=B9=E9=87=8F?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9D=83=E9=99=90=E7=88=B6=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .prettierrc.js | 69 +- mock/data.js | 1929 ----------------- src/api/v1/power.ts | 37 +- .../src => Table}/TableIsDefaultTag.vue | 0 src/components/TableBar/src/bar.tsx | 4 +- src/store/system/power.ts | 11 +- src/views/i18n/i18n-type-setting/index.vue | 2 +- src/views/system/adminUser/utils/types.ts | 2 +- src/views/system/files/utils/columns.ts | 9 +- src/views/system/files/utils/hooks.ts | 2 +- .../system/menuIcon/menu-icon-dialog.vue | 2 + src/views/system/power/index.vue | 16 +- src/views/system/power/power-dialog.vue | 2 - .../power/utils/{hooks.ts => hooks.tsx} | 50 +- 14 files changed, 127 insertions(+), 2008 deletions(-) delete mode 100644 mock/data.js rename src/components/{TableBar/src => Table}/TableIsDefaultTag.vue (100%) rename src/views/system/power/utils/{hooks.ts => hooks.tsx} (65%) diff --git a/.prettierrc.js b/.prettierrc.js index ff6d01d..dff4997 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -1,39 +1,38 @@ // @see: https://www.prettier.cn export default { - // 超过最大值换行 - printWidth: 200, - // 缩进字节数 - tabWidth: 1, - // 使用制表符而不是空格缩进行 - useTabs: true, - // 结尾不用分号(true有,false没有) - semi: true, - // 使用单引号(true单引号,false双引号) - singleQuote: true, - // 更改引用对象属性的时间 可选值"" - quoteProps: "as-needed", - // 在对象,数组括号与文字之间加空格 "{ foo: bar }" - bracketSpacing: true, - // 多行时尽可能打印尾随逗号。(例如,单行数组永远不会出现逗号结尾。) 可选值"",默认none - trailingComma: "all", - // 在JSX中使用单引号而不是双引号 - jsxSingleQuote: true, - // (x) => {} 箭头函数参数只有一个时是否要有小括号。avoid:省略括号 ,always:不省略括号 - arrowParens: "avoid", - // 如果文件顶部已经有一个 doclock,这个选项将新建一行注释,并打上@format标记。 - insertPragma: false, - // 指定要使用的解析器,不需要写文件开头的 @prettier - requirePragma: false, - // 默认值。因为使用了一些折行敏感型的渲染器(如GitHub comment)而按照markdown文本样式进行折行 - proseWrap: "preserve", - // 在html中空格是否是敏感的 "css" - 遵守CSS显示属性的默认值, "strict" - 空格被认为是敏感的 ,"ignore" - 空格被认为是不敏感的 - htmlWhitespaceSensitivity: "css", - // 换行符使用 lf 结尾是 可选值"" - endOfLine: "auto", - // 这两个选项可用于格式化以给定字符偏移量(分别包括和不包括)开始和结束的代码 - rangeStart: 0, - rangeEnd: Infinity, - - vueIndentScriptAndStyle: false // Vue文件脚本和样式标签缩进 + // 超过最大值换行 + printWidth: 200, + // 缩进字节数 + tabWidth: 1, + // 使用制表符而不是空格缩进行 + useTabs: true, + // 结尾不用分号(true有,false没有) + semi: true, + // 使用单引号(true单引号,false双引号) + singleQuote: true, + // 更改引用对象属性的时间 可选值"" + quoteProps: 'as-needed', + // 在对象,数组括号与文字之间加空格 "{ foo: bar }" + bracketSpacing: true, + // 多行时尽可能打印尾随逗号。(例如,单行数组永远不会出现逗号结尾。) 可选值"",默认none + trailingComma: 'all', + // 在JSX中使用单引号而不是双引号 + jsxSingleQuote: true, + // (x) => {} 箭头函数参数只有一个时是否要有小括号。avoid:省略括号 ,always:不省略括号 + arrowParens: 'avoid', + // 如果文件顶部已经有一个 doclock,这个选项将新建一行注释,并打上@format标记。 + insertPragma: false, + // 指定要使用的解析器,不需要写文件开头的 @prettier + requirePragma: false, + // 默认值。因为使用了一些折行敏感型的渲染器(如GitHub comment)而按照markdown文本样式进行折行 + proseWrap: 'preserve', + // 在html中空格是否是敏感的 "css" - 遵守CSS显示属性的默认值, "strict" - 空格被认为是敏感的 ,"ignore" - 空格被认为是不敏感的 + htmlWhitespaceSensitivity: 'css', + // 换行符使用 lf 结尾是 可选值"" + endOfLine: 'auto', + // 这两个选项可用于格式化以给定字符偏移量(分别包括和不包括)开始和结束的代码 + rangeStart: 0, + rangeEnd: Infinity, + vueIndentScriptAndStyle: false, // Vue文件脚本和样式标签缩进 }; diff --git a/mock/data.js b/mock/data.js deleted file mode 100644 index 80a4be8..0000000 --- a/mock/data.js +++ /dev/null @@ -1,1929 +0,0 @@ -const data = { - paths: { - '/admin/user/uploadAvatarByAdmin': { - put: { - tags: ['用户信息'], - summary: '修改用户头像', - description: '管理员修改用户头像', - operationId: 'uploadAvatarByAdmin', - requestBody: { - content: { - 'application/json': { - schema: { - $ref: '#/components/schemas/UserUpdateWithAvatarDto对象', - }, - }, - }, - }, - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultString', - }, - }, - }, - }, - }, - }, - }, - '/admin/user/updateUserStatusByAdmin': { - put: { - tags: ['用户信息'], - summary: '修改用户状态', - description: '管理员修改用户状态', - operationId: 'updateUserStatusByAdmin', - requestBody: { - content: { - 'application/json': { - schema: { - $ref: '#/components/schemas/UserUpdateWithPasswordDto对象', - }, - }, - }, - required: true, - }, - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultString', - }, - }, - }, - }, - }, - }, - }, - '/admin/user/updateUserPasswordByAdmin': { - put: { - tags: ['用户信息'], - summary: '修改管理员用户密码', - description: '管理员修改管理员用户密码', - operationId: 'updateUserPasswordByAdmin', - requestBody: { - content: { - 'application/json': { - schema: { - $ref: '#/components/schemas/UserUpdateWithPasswordDto对象', - }, - }, - }, - required: true, - }, - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultString', - }, - }, - }, - }, - }, - }, - }, - '/admin/user/updateAdminUser': { - put: { - tags: ['用户信息'], - summary: '更新用户信息', - description: '更新用户信息', - operationId: 'updateAdminUser', - requestBody: { - content: { - 'application/json': { - schema: { - $ref: '#/components/schemas/AdminUserUpdateDto对象', - }, - }, - }, - required: true, - }, - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultString', - }, - }, - }, - }, - }, - }, - }, - '/admin/user/forcedOffline': { - put: { - tags: ['用户信息'], - summary: '强制退出', - description: '强制退出', - operationId: 'forcedOffline', - requestBody: { - content: { - 'application/json': { - schema: { - type: 'integer', - format: 'int64', - }, - }, - }, - required: true, - }, - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultString', - }, - }, - }, - }, - }, - }, - }, - '/admin/router/updateMenu': { - put: { - tags: ['系统路由'], - summary: '更新路由菜单', - description: '更新路由菜单', - operationId: 'updateMenu', - requestBody: { - content: { - 'application/json': { - schema: { - $ref: '#/components/schemas/RouterManageDto对象', - }, - }, - }, - required: true, - }, - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultString', - }, - }, - }, - }, - }, - }, - }, - '/admin/role/updateRole': { - put: { - tags: ['角色'], - summary: '更新角色', - description: '更新角色', - operationId: 'updateRole', - requestBody: { - content: { - 'application/json': { - schema: { - $ref: '#/components/schemas/RoleUpdateDto对象', - }, - }, - }, - required: true, - }, - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultString', - }, - }, - }, - }, - }, - }, - }, - '/admin/power/updatePower': { - put: { - tags: ['权限'], - summary: '更新权限', - description: '更新权限', - operationId: 'updatePower', - requestBody: { - content: { - 'application/json': { - schema: { - $ref: '#/components/schemas/PowerUpdateDto对象', - }, - }, - }, - required: true, - }, - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultString', - }, - }, - }, - }, - }, - }, - }, - '/admin/menuIcon/updateMenuIcon': { - put: { - tags: ['系统菜单图标'], - summary: '更新系统菜单图标', - description: '更新系统菜单图标', - operationId: 'updateMenuIcon', - requestBody: { - content: { - 'application/json': { - schema: { - $ref: '#/components/schemas/MenuIconUpdateDto对象', - }, - }, - }, - required: true, - }, - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultString', - }, - }, - }, - }, - }, - }, - }, - '/admin/i18nType/updateI18nType': { - put: { - tags: ['多语言类型'], - summary: '更新多语言类型', - description: '更新多语言类型', - operationId: 'updateI18nType', - requestBody: { - content: { - 'application/json': { - schema: { - $ref: '#/components/schemas/I18nTypeUpdateDto对象', - }, - }, - }, - required: true, - }, - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultString', - }, - }, - }, - }, - }, - }, - }, - '/admin/i18n/updateI18n': { - put: { - tags: ['多语言'], - summary: '更新多语言', - description: '更新多语言', - operationId: 'updateI18n', - requestBody: { - content: { - 'application/json': { - schema: { - $ref: '#/components/schemas/I18nUpdateDto对象', - }, - }, - }, - required: true, - }, - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultString', - }, - }, - }, - }, - }, - }, - }, - '/admin/files/updateFiles': { - put: { - tags: ['系统文件表'], - summary: '更新系统文件表', - description: '更新系统文件表', - operationId: 'updateFiles', - requestBody: { - content: { - 'application/json': { - schema: { - $ref: '#/components/schemas/FilesUpdateDto对象', - }, - }, - }, - required: true, - }, - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultString', - }, - }, - }, - }, - }, - }, - }, - '/admin/dept/updateDept': { - put: { - tags: ['部门'], - summary: '更新部门', - description: '更新部门', - operationId: 'updateDept', - requestBody: { - content: { - 'application/json': { - schema: { - $ref: '#/components/schemas/DeptUpdateDto对象', - }, - }, - }, - required: true, - }, - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultString', - }, - }, - }, - }, - }, - }, - }, - '/admin/userRole/assignRolesToUsers': { - post: { - tags: ['用户和角色'], - summary: '为用户分配角色', - description: '为用户分配角色', - operationId: 'assignRolesToUsers', - requestBody: { - content: { - 'application/json': { - schema: { - $ref: '#/components/schemas/AssignRolesToUsersDto对象', - }, - }, - }, - required: true, - }, - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultString', - }, - }, - }, - }, - }, - }, - }, - '/admin/user/noAuth/sendLoginEmail': { - post: { - tags: ['用户信息'], - summary: '登录发送邮件验证码', - description: '登录发送邮件验证码', - operationId: 'sendLoginEmail', - parameters: [ - { - name: 'email', - in: 'query', - required: true, - schema: { - type: 'string', - }, - }, - ], - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultString', - }, - }, - }, - }, - }, - }, - }, - '/admin/user/noAuth/refreshToken': { - post: { - tags: ['用户信息'], - summary: '刷新token', - description: '刷新用户token', - operationId: 'refreshToken', - requestBody: { - content: { - 'application/json': { - schema: { - $ref: '#/components/schemas/RefreshTokenDto对象', - }, - }, - }, - required: true, - }, - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultRefreshTokenVo 对象', - }, - }, - }, - }, - }, - }, - }, - '/admin/user/logout': { - post: { - tags: ['用户信息'], - summary: '退出登录', - description: '退出登录', - operationId: 'logout', - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultString', - }, - }, - }, - }, - }, - }, - }, - '/admin/user/addAdminUser': { - post: { - tags: ['用户信息'], - summary: '添加用户信息', - description: '添加用户信息', - operationId: 'addAdminUser', - requestBody: { - content: { - 'application/json': { - schema: { - $ref: '#/components/schemas/AdminUserAddDto对象', - }, - }, - }, - required: true, - }, - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultObject', - }, - }, - }, - }, - }, - }, - }, - '/admin/routerRole/assignRolesToRouter': { - post: { - tags: ['路由和角色'], - summary: '为菜单分配角色', - description: '为菜单分配角色', - operationId: 'assignRolesToRouter', - requestBody: { - content: { - 'application/json': { - schema: { - $ref: '#/components/schemas/AssignRolesToRoutersDto对象', - }, - }, - }, - required: true, - }, - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultString', - }, - }, - }, - }, - }, - }, - }, - '/admin/router/addMenu': { - post: { - tags: ['系统路由'], - summary: '添加路由菜单', - description: '添加路由菜单', - operationId: 'addMenu', - requestBody: { - content: { - 'application/json': { - schema: { - $ref: '#/components/schemas/RouterManageDto对象', - }, - }, - }, - required: true, - }, - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultString', - }, - }, - }, - }, - }, - }, - }, - '/admin/rolePower/assignPowersToRole': { - post: { - tags: ['角色和权限'], - summary: '为角色分配权限', - description: '为角色分配权限', - operationId: 'assignPowersToRole', - requestBody: { - content: { - 'application/json': { - schema: { - $ref: '#/components/schemas/AssignPowersToRoleDto对象', - }, - }, - }, - required: true, - }, - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultString', - }, - }, - }, - }, - }, - }, - }, - '/admin/role/addRole': { - post: { - tags: ['角色'], - summary: '添加角色', - description: '添加角色', - operationId: 'addRole', - requestBody: { - content: { - 'application/json': { - schema: { - $ref: '#/components/schemas/RoleAddDto对象', - }, - }, - }, - required: true, - }, - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultString', - }, - }, - }, - }, - }, - }, - }, - '/admin/power/addPower': { - post: { - tags: ['权限'], - summary: '添加权限', - description: '添加权限', - operationId: 'addPower', - requestBody: { - content: { - 'application/json': { - schema: { - $ref: '#/components/schemas/PowerAddDto对象', - }, - }, - }, - required: true, - }, - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultString', - }, - }, - }, - }, - }, - }, - }, - '/admin/menuIcon/addMenuIcon': { - post: { - tags: ['系统菜单图标'], - summary: '添加系统菜单图标', - description: '添加系统菜单图标', - operationId: 'addMenuIcon', - requestBody: { - content: { - 'application/json': { - schema: { - $ref: '#/components/schemas/MenuIconAddDto对象', - }, - }, - }, - required: true, - }, - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultString', - }, - }, - }, - }, - }, - }, - }, - '/admin/i18nType/addI18nType': { - post: { - tags: ['多语言类型'], - summary: '添加多语言类型', - description: '添加多语言类型', - operationId: 'addI18nType', - requestBody: { - content: { - 'application/json': { - schema: { - $ref: '#/components/schemas/I18nTypeAddDto对象', - }, - }, - }, - required: true, - }, - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultString', - }, - }, - }, - }, - }, - }, - }, - '/admin/i18n/addI18n': { - post: { - tags: ['多语言'], - summary: '添加多语言', - description: '添加多语言', - operationId: 'addI18n', - requestBody: { - content: { - 'application/json': { - schema: { - $ref: '#/components/schemas/I18nAddDto对象', - }, - }, - }, - required: true, - }, - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultString', - }, - }, - }, - }, - }, - }, - }, - '/admin/files/upload': { - post: { - tags: ['系统文件表'], - summary: '上传文件', - description: '上传文件', - operationId: 'upload', - parameters: [ - { - name: 'dto', - in: 'query', - required: true, - schema: { - $ref: '#/components/schemas/FileUploadDto对象', - }, - }, - ], - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultFileInfoVo对象', - }, - }, - }, - }, - }, - }, - }, - '/admin/files/addFiles': { - post: { - tags: ['系统文件表'], - summary: '添加系统文件表', - description: '添加系统文件表', - operationId: 'addFiles', - requestBody: { - content: { - 'application/json': { - schema: { - $ref: '#/components/schemas/FilesAddDto对象', - }, - }, - }, - required: true, - }, - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultString', - }, - }, - }, - }, - }, - }, - }, - '/admin/dept/addDept': { - post: { - tags: ['部门'], - summary: '添加部门', - description: '添加部门', - operationId: 'addDept', - requestBody: { - content: { - 'application/json': { - schema: { - $ref: '#/components/schemas/DeptAddDto对象', - }, - }, - }, - required: true, - }, - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultString', - }, - }, - }, - }, - }, - }, - }, - '/admin/userRole/getRoleListByUserId': { - get: { - tags: ['用户和角色'], - summary: '根据用户id获取角色列表', - description: '根据用户id获取角色列表', - operationId: 'getRoleListByUserId', - parameters: [ - { - name: 'userId', - in: 'query', - required: true, - schema: { - type: 'integer', - format: 'int64', - }, - }, - ], - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultListString', - }, - }, - }, - }, - }, - }, - }, - '/admin/user/queryUser': { - get: { - tags: ['用户信息'], - summary: '多条件查询用户', - description: '多条件查询用户', - operationId: 'queryUser', - parameters: [ - { - name: 'keyword', - in: 'query', - required: true, - schema: { - type: 'string', - }, - }, - ], - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultListAdminUserVo对象', - }, - }, - }, - }, - }, - }, - }, - '/admin/user/getUserinfoById': { - get: { - tags: ['用户信息'], - summary: '获取用户信息', - description: '获取用户信息', - operationId: 'getUserinfoById', - parameters: [ - { - name: 'id', - in: 'query', - required: true, - schema: { - type: 'integer', - format: 'int64', - }, - }, - ], - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultLoginVo对象', - }, - }, - }, - }, - }, - }, - }, - '/admin/user/getAdminUserList/{page}/{limit}': { - get: { - tags: ['用户信息'], - summary: '分页查询用户信息', - description: '分页查询用户信息', - operationId: 'getAdminUserList', - parameters: [ - { - name: 'page', - in: 'path', - description: '当前页', - required: true, - schema: { - type: 'integer', - format: 'int32', - }, - }, - { - name: 'limit', - in: 'path', - description: '每页记录数', - required: true, - schema: { - type: 'integer', - format: 'int32', - }, - }, - { - name: 'dto', - in: 'query', - required: true, - schema: { - $ref: '#/components/schemas/AdminUserAddDto对象', - }, - }, - ], - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultPageResult 对象AdminUserVo对象', - }, - }, - }, - }, - }, - }, - }, - '/admin/routerRole/getRoleListByRouterId': { - get: { - tags: ['路由和角色'], - summary: '根据路由id获取所有角色', - description: '根据路由id获取所有角色', - operationId: 'getRoleListByRouterId', - parameters: [ - { - name: 'routerId', - in: 'query', - required: true, - schema: { - type: 'integer', - format: 'int64', - }, - }, - ], - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultListString', - }, - }, - }, - }, - }, - }, - }, - '/admin/router/getRouterAsync': { - get: { - tags: ['系统路由'], - summary: '获取用户菜单', - description: '获取用户菜单', - operationId: 'getRouterAsync', - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultListUserRouterVo', - }, - }, - }, - }, - }, - }, - }, - '/admin/router/getMenusList': { - get: { - tags: ['系统路由'], - summary: '管理菜单列表', - description: '管理菜单列表', - operationId: 'getMenusList', - parameters: [ - { - name: 'dto', - in: 'query', - required: true, - schema: { - $ref: '#/components/schemas/RouterManageDto对象', - }, - }, - ], - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultListRouterManageVo', - }, - }, - }, - }, - }, - }, - }, - '/admin/router/getMenusList/{page}/{limit}': { - get: { - tags: ['系统路由'], - summary: '分页管理菜单列表', - description: '分页管理菜单列表', - operationId: 'getMenusByPage', - parameters: [ - { - name: 'page', - in: 'path', - description: '当前页', - required: true, - schema: { - type: 'integer', - format: 'int32', - }, - }, - { - name: 'limit', - in: 'path', - description: '每页记录数', - required: true, - schema: { - type: 'integer', - format: 'int32', - }, - }, - { - name: 'dto', - in: 'query', - required: true, - schema: { - $ref: '#/components/schemas/RouterManageDto对象', - }, - }, - ], - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultPageResult 对象RouterManageVo', - }, - }, - }, - }, - }, - }, - }, - '/admin/rolePower/getPowerListByRoleId': { - get: { - tags: ['角色和权限'], - summary: '根据角色id获取权限内容', - description: '角色列表获取已选择的权限', - operationId: 'getPowerListByRoleId', - parameters: [ - { - name: 'id', - in: 'query', - required: true, - schema: { - type: 'integer', - format: 'int64', - }, - }, - ], - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultListString', - }, - }, - }, - }, - }, - }, - }, - '/admin/role/getRoleList/{page}/{limit}': { - get: { - tags: ['角色'], - summary: '分页查询角色', - description: '分页查询角色', - operationId: 'getRoleList', - parameters: [ - { - name: 'page', - in: 'path', - description: '当前页', - required: true, - schema: { - type: 'integer', - format: 'int32', - }, - }, - { - name: 'limit', - in: 'path', - description: '每页记录数', - required: true, - schema: { - type: 'integer', - format: 'int32', - }, - }, - { - name: 'dto', - in: 'query', - required: true, - schema: { - $ref: '#/components/schemas/RoleDto对象', - }, - }, - ], - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultPageResult 对象RoleVo对象', - }, - }, - }, - }, - }, - }, - }, - '/admin/role/getAllRoles': { - get: { - tags: ['角色'], - summary: '获取所有角色', - description: '获取所有角色', - operationId: 'getAllRoles', - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultListRoleVo对象', - }, - }, - }, - }, - }, - }, - }, - '/admin/power/getPowerList/{page}/{limit}': { - get: { - tags: ['权限'], - summary: '分页查询权限', - description: '分页查询权限', - operationId: 'getPowerList', - parameters: [ - { - name: 'page', - in: 'path', - description: '当前页', - required: true, - schema: { - type: 'integer', - format: 'int32', - }, - }, - { - name: 'limit', - in: 'path', - description: '每页记录数', - required: true, - schema: { - type: 'integer', - format: 'int32', - }, - }, - { - name: 'dto', - in: 'query', - required: true, - schema: { - $ref: '#/components/schemas/PowerDto对象', - }, - }, - ], - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultPageResult 对象PowerVo对象', - }, - }, - }, - }, - }, - }, - }, - '/admin/power/getAllPowers': { - get: { - tags: ['权限'], - summary: '获取所有权限', - description: '获取所有权限', - operationId: 'getAllPowers', - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultListPowerVo对象', - }, - }, - }, - }, - }, - }, - }, - '/admin/menuIcon/getMenuIconList/{page}/{limit}': { - get: { - tags: ['系统菜单图标'], - summary: '分页查询系统菜单图标', - description: '分页查询系统菜单图标', - operationId: 'getMenuIconList', - parameters: [ - { - name: 'page', - in: 'path', - description: '当前页', - required: true, - schema: { - type: 'integer', - format: 'int32', - }, - }, - { - name: 'limit', - in: 'path', - description: '每页记录数', - required: true, - schema: { - type: 'integer', - format: 'int32', - }, - }, - { - name: 'dto', - in: 'query', - required: true, - schema: { - $ref: '#/components/schemas/MenuIconDto对象', - }, - }, - ], - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultPageResult 对象MenuIconVo对象', - }, - }, - }, - }, - }, - }, - }, - '/admin/menuIcon/getIconNameList': { - get: { - tags: ['系统菜单图标'], - summary: '获取查询图标名称列表', - description: '获取查询图标名称列表', - operationId: 'getIconNameList', - parameters: [ - { - name: 'iconName', - in: 'query', - required: true, - schema: { - type: 'string', - }, - }, - ], - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultListMenuIconVo对象', - }, - }, - }, - }, - }, - }, - }, - '/admin/i18nType/getI18nTypeList': { - get: { - tags: ['多语言类型'], - summary: '获取多语言类型', - description: '获取多语言类型', - operationId: 'getI18nTypeList', - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultListI18nVo对象', - }, - }, - }, - }, - }, - }, - }, - '/admin/i18n/getI18n': { - get: { - tags: ['多语言'], - summary: '获取多语言内容', - description: '获取多语言内容', - operationId: 'getI18n', - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultMapStringObject', - }, - }, - }, - }, - }, - }, - }, - '/admin/i18n/getI18nList/{page}/{limit}': { - get: { - tags: ['多语言'], - summary: '获取管理多语言列表', - description: '获取管理多语言列表', - operationId: 'getI18nList', - parameters: [ - { - name: 'page', - in: 'path', - description: '当前页', - required: true, - schema: { - type: 'integer', - format: 'int32', - }, - }, - { - name: 'limit', - in: 'path', - description: '每页记录数', - required: true, - schema: { - type: 'integer', - format: 'int32', - }, - }, - { - name: 'dto', - in: 'query', - required: true, - schema: { - $ref: '#/components/schemas/I18nDto对象', - }, - }, - ], - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultPageResult 对象I18nVo对象', - }, - }, - }, - }, - }, - }, - }, - '/admin/files/getFilesList/{page}/{limit}': { - get: { - tags: ['系统文件表'], - summary: '分页查询系统文件表', - description: '分页查询系统文件表', - operationId: 'getFilesList', - parameters: [ - { - name: 'page', - in: 'path', - description: '当前页', - required: true, - schema: { - type: 'integer', - format: 'int32', - }, - }, - { - name: 'limit', - in: 'path', - description: '每页记录数', - required: true, - schema: { - type: 'integer', - format: 'int32', - }, - }, - { - name: 'dto', - in: 'query', - required: true, - schema: { - $ref: '#/components/schemas/FilesDto对象', - }, - }, - ], - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultPageResult 对象FilesVo对象', - }, - }, - }, - }, - }, - }, - }, - '/admin/dept/getDeptList/{page}/{limit}': { - get: { - tags: ['部门'], - summary: '分页查询部门', - description: '分页查询部门', - operationId: 'getDeptList', - parameters: [ - { - name: 'page', - in: 'path', - description: '当前页', - required: true, - schema: { - type: 'integer', - format: 'int32', - }, - }, - { - name: 'limit', - in: 'path', - description: '每页记录数', - required: true, - schema: { - type: 'integer', - format: 'int32', - }, - }, - { - name: 'dto', - in: 'query', - required: true, - schema: { - $ref: '#/components/schemas/DeptDto对象', - }, - }, - ], - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultPageResult 对象DeptVo对象', - }, - }, - }, - }, - }, - }, - }, - '/admin/dept/getAllDeptList': { - get: { - tags: ['部门'], - summary: '获取所有部门', - description: '获取所有部门', - operationId: 'getAllDeptList', - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultListDeptVo对象', - }, - }, - }, - }, - }, - }, - }, - '/admin/user/deleteAdminUser': { - delete: { - tags: ['用户信息'], - summary: '删除用户信息', - description: '删除用户信息', - operationId: 'deleteAdminUser', - requestBody: { - content: { - 'application/json': { - schema: { - type: 'array', - items: { - type: 'integer', - format: 'int64', - }, - }, - }, - }, - required: true, - }, - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultString', - }, - }, - }, - }, - }, - }, - }, - '/admin/router/deletedMenuByIds': { - delete: { - tags: ['系统路由'], - summary: '删除路由菜单', - description: '删除路由菜单', - operationId: 'deletedMenuByIds', - requestBody: { - content: { - 'application/json': { - schema: { - type: 'array', - items: { - type: 'integer', - format: 'int64', - }, - }, - }, - }, - required: true, - }, - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultString', - }, - }, - }, - }, - }, - }, - }, - '/admin/role/deleteRole': { - delete: { - tags: ['角色'], - summary: '删除角色', - description: '删除角色', - operationId: 'deleteRole', - requestBody: { - content: { - 'application/json': { - schema: { - type: 'array', - items: { - type: 'integer', - format: 'int64', - }, - }, - }, - }, - required: true, - }, - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultString', - }, - }, - }, - }, - }, - }, - }, - '/admin/power/deletePower': { - delete: { - tags: ['权限'], - summary: '删除权限', - description: '删除权限', - operationId: 'deletePower', - requestBody: { - content: { - 'application/json': { - schema: { - type: 'array', - items: { - type: 'integer', - format: 'int64', - }, - }, - }, - }, - required: true, - }, - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultString', - }, - }, - }, - }, - }, - }, - }, - '/admin/menuIcon/deleteMenuIcon': { - delete: { - tags: ['系统菜单图标'], - summary: '删除系统菜单图标', - description: '删除系统菜单图标', - operationId: 'deleteMenuIcon', - requestBody: { - content: { - 'application/json': { - schema: { - type: 'array', - items: { - type: 'integer', - format: 'int64', - }, - }, - }, - }, - required: true, - }, - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultString', - }, - }, - }, - }, - }, - }, - }, - '/admin/i18nType/deleteI18nType': { - delete: { - tags: ['多语言类型'], - summary: '删除多语言类型', - description: '删除多语言类型', - operationId: 'deleteI18nType', - requestBody: { - content: { - 'application/json': { - schema: { - type: 'array', - items: { - type: 'integer', - format: 'int64', - }, - }, - }, - }, - required: true, - }, - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultString', - }, - }, - }, - }, - }, - }, - }, - '/admin/i18n/deleteI18n': { - delete: { - tags: ['多语言'], - summary: '删除多语言类型', - description: '删除多语言类型', - operationId: 'deleteI18n', - requestBody: { - content: { - 'application/json': { - schema: { - type: 'array', - items: { - type: 'integer', - format: 'int64', - }, - }, - }, - }, - required: true, - }, - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultString', - }, - }, - }, - }, - }, - }, - }, - '/admin/files/deleteFiles': { - delete: { - tags: ['系统文件表'], - summary: '删除系统文件表', - description: '删除系统文件表', - operationId: 'deleteFiles', - requestBody: { - content: { - 'application/json': { - schema: { - type: 'array', - items: { - type: 'integer', - format: 'int64', - }, - }, - }, - }, - required: true, - }, - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultString', - }, - }, - }, - }, - }, - }, - }, - '/admin/dept/deleteDept': { - delete: { - tags: ['部门'], - summary: '删除部门', - description: '删除部门', - operationId: 'deleteDept', - requestBody: { - content: { - 'application/json': { - schema: { - type: 'array', - items: { - type: 'integer', - format: 'int64', - }, - }, - }, - }, - required: true, - }, - responses: { - 200: { - description: 'OK', - content: { - '*/*': { - schema: { - $ref: '#/components/schemas/ResultString', - }, - }, - }, - }, - }, - }, - }, - }, -}; - -// 获取所有键 -Object.keys(data.paths) - .filter(item => !item.includes('noAuth')) - .forEach(key => { - Object.entries(data.paths[key]).forEach(async ([_, { summary }]) => { - const item = { - parentId: 0, - powerCode: key.replace('/{page}/{limit}', '').replace('/{id}', '').replace('/', '').replaceAll('/', '::'), - powerName: summary, - requestUrl: key.replace('{page}', '\\d+').replace('{limit}', '\\d+').replace('/{id}', '\\d+'), - }; - const response = await fetch('http://localhost:7070/admin/power/addPower', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - token: - 'eyJhbGciOiJIUzI1NiIsInppcCI6IkdaSVAifQ.H4sIAAAAAAAA_yWLQQrCMBBF7zLrRjLTxDhdSXduvIOpf0Ch1bYGKuLdDbj7vPf-h9aSqaO-TNObGsL2pI6THDSKV2morFhO18r-83wZUXNuWdV7juE4z7vhMdbr_XWrJpmXAcZOg-5dAMxlRLg2IRtMIpjp-wPL7wZTdwAAAA.rNvGDARzXUVHTosLybe9L-pOF6w4p6VsUt-kRCw8ijk', - }, - body: JSON.stringify(item), - }); - const json = await response.json(); - console.log(json); - }); - }); diff --git a/src/api/v1/power.ts b/src/api/v1/power.ts index a2252fd..9684042 100644 --- a/src/api/v1/power.ts +++ b/src/api/v1/power.ts @@ -1,44 +1,37 @@ import { http } from '@/api/service/request'; import type { BaseResult, ResultTable } from '@/api/service/types'; -/** - * 权限---获取权限列表 - */ +/** 权限---获取权限列表 */ export const fetchGetPowerList = (data: any) => { return http.request>('get', `power/getPowerList/${data.currentPage}/${data.pageSize}`, { params: data }); }; -/** - * 权限---根据角色id获取权限内容 - */ +/** 权限---根据角色id获取权限内容 */ export const fetchGetPowerListByRoleId = (data: any) => { return http.request>('get', 'rolePower/getPowerListByRoleId', { params: data }); }; -/** - * 权限---添加权限 - */ +/** 获取所有权限 */ +export const fetchGetAllPowers = () => { + return http.request>('get', `power/getAllPowers`); +}; + +/** 权限---添加权限 */ export const fetchAddPower = (data: any) => { return http.request>('post', 'power/addPower', { data }); }; -/** - * 权限---更新权限 - */ +/** 权限---更新权限 */ export const fetchUpdatePower = (data: any) => { return http.request>('put', 'power/updatePower', { data }); }; -/** - * 权限---删除权限 - */ +/** 权限---更新权限 */ +export const fetchUpdateBatchByPowerWithParentId = (data: any) => { + return http.request>('put', 'power/updateBatchByPowerWithParentId', { data }); +}; + +/** 权限---删除权限 */ export const fetchDeletePower = (data: any) => { return http.request>('delete', 'power/deletePower', { data }); }; - -/** - * 获取所有权限 - */ -export const fetchGetAllPowers = () => { - return http.request>('get', `power/getAllPowers`); -}; diff --git a/src/components/TableBar/src/TableIsDefaultTag.vue b/src/components/Table/TableIsDefaultTag.vue similarity index 100% rename from src/components/TableBar/src/TableIsDefaultTag.vue rename to src/components/Table/TableIsDefaultTag.vue diff --git a/src/components/TableBar/src/bar.tsx b/src/components/TableBar/src/bar.tsx index 2be140f..7b54280 100644 --- a/src/components/TableBar/src/bar.tsx +++ b/src/components/TableBar/src/bar.tsx @@ -113,12 +113,12 @@ export default defineComponent({ dynamicColumns.value.filter(item => $t(item.label) === $t(label))[0].hide = !val; } - async function onReset() { + function onReset() { checkAll.value = true; isIndeterminate.value = false; dynamicColumns.value = cloneDeep(props?.columns); checkColumnList = []; - checkColumnList = await getKeyList(cloneDeep(props?.columns), 'label'); + checkColumnList = getKeyList(cloneDeep(props?.columns), 'label'); checkedColumns.value = getKeyList(cloneDeep(filterColumns), 'label'); } diff --git a/src/store/system/power.ts b/src/store/system/power.ts index 9bdce6a..f70439c 100644 --- a/src/store/system/power.ts +++ b/src/store/system/power.ts @@ -1,5 +1,5 @@ import { defineStore } from 'pinia'; -import { fetchAddPower, fetchDeletePower, fetchGetAllPowers, fetchGetPowerList, fetchUpdatePower } from '@/api/v1/power'; +import { fetchAddPower, fetchDeletePower, fetchGetAllPowers, fetchGetPowerList, fetchUpdateBatchByPowerWithParentId, fetchUpdatePower } from '@/api/v1/power'; import { pageSizes } from '@/enums/baseConstant'; import { storeMessage } from '@/utils/message'; import { storePagination } from '@/store/useStorePagination'; @@ -70,6 +70,15 @@ export const usePowerStore = defineStore('powerStore', { return storeMessage(result); }, + /** + * 批量修改权限父级 + * @param data + */ + async updateBatchByPowerWithParentId(data: any) { + const result = await fetchUpdateBatchByPowerWithParentId(data); + return storeMessage(result); + }, + /** * * 删除权限 */ diff --git a/src/views/i18n/i18n-type-setting/index.vue b/src/views/i18n/i18n-type-setting/index.vue index 18d1b43..73ebbe8 100644 --- a/src/views/i18n/i18n-type-setting/index.vue +++ b/src/views/i18n/i18n-type-setting/index.vue @@ -9,7 +9,7 @@ import { userI18nTypeStore } from '@/store/i18n/i18nType'; import { onAdd, onDelete, onSearch, onUpdate } from '@/views/i18n/i18n-type-setting/utils/hooks'; import Delete from '@iconify-icons/ep/delete'; import EditPen from '@iconify-icons/ep/edit-pen'; -import TableIsDefaultTag from '@/components/TableBar/src/TableIsDefaultTag.vue'; +import TableIsDefaultTag from '@/components/Table/TableIsDefaultTag.vue'; import Refresh from '@iconify-icons/ep/refresh'; import { selectUserinfo } from '@/components/Table/Userinfo/columns'; import { $t } from '@/plugins/i18n'; diff --git a/src/views/system/adminUser/utils/types.ts b/src/views/system/adminUser/utils/types.ts index d25d725..f5d3ae7 100644 --- a/src/views/system/adminUser/utils/types.ts +++ b/src/views/system/adminUser/utils/types.ts @@ -19,7 +19,7 @@ export interface FormItemProps { // 状态 status: boolean; // 部门 - deptId: string; + deptIds: string[]; } // 添加或修改表单Props diff --git a/src/views/system/files/utils/columns.ts b/src/views/system/files/utils/columns.ts index 955054f..06d9cb8 100644 --- a/src/views/system/files/utils/columns.ts +++ b/src/views/system/files/utils/columns.ts @@ -4,16 +4,15 @@ import { $t } from '@/plugins/i18n'; // 表格列 export const columns: TableColumnList = [ { type: 'index', index: (index: number) => index + 1 }, - // { type: 'selection', align: 'left' }, - { label: $t('id'), prop: 'id' }, + { type: 'selection', align: 'left' }, // 文件的名称 - { label: $t('files_filename'), prop: 'filename' }, + { label: $t('files_filename'), prop: 'filename', width: 400 }, // 文件在服务器上的存储路径 { label: $t('files_filepath'), prop: 'filepath' }, // 文件的MIME类型 - { label: $t('files_fileType'), prop: 'fileType' }, + { label: $t('files_fileType'), prop: 'fileType', width: 100 }, // 下载数量 - { label: $t('files_downloadCount'), prop: 'downloadCount' }, + { label: $t('files_downloadCount'), prop: 'downloadCount', width: 90 }, { label: $t('table.updateTime'), prop: 'updateTime', sortable: true, width: 160 }, { label: $t('table.createTime'), prop: 'createTime', sortable: true, width: 160 }, { label: $t('table.createUser'), prop: 'createUser', slot: 'createUser', width: 90 }, diff --git a/src/views/system/files/utils/hooks.ts b/src/views/system/files/utils/hooks.ts index 058c6ac..9ff8114 100644 --- a/src/views/system/files/utils/hooks.ts +++ b/src/views/system/files/utils/hooks.ts @@ -1,6 +1,6 @@ import { addDialog } from '@/components/BaseDialog/index'; import FilesDialog from '@/views/system/files/files-dialog.vue'; -import { useFilesStore } from '@/store/system/files.ts'; +import { useFilesStore } from '@/store/system/files'; import { h, ref } from 'vue'; import { messageBox } from '@/utils/message'; import type { FormItemProps } from '@/views/system/files/utils/types'; diff --git a/src/views/system/menuIcon/menu-icon-dialog.vue b/src/views/system/menuIcon/menu-icon-dialog.vue index 45532ed..be7c747 100644 --- a/src/views/system/menuIcon/menu-icon-dialog.vue +++ b/src/views/system/menuIcon/menu-icon-dialog.vue @@ -9,6 +9,8 @@ import MenuIconSelectIconName from '@/views/system/menuIcon/menu-icon-select-ico const props = withDefaults(defineProps(), { formInline: () => ({ + // icon类名 + iconCode: undefined, // icon 名称 iconName: undefined, }), diff --git a/src/views/system/power/index.vue b/src/views/system/power/index.vue index ae8590c..7b5af77 100644 --- a/src/views/system/power/index.vue +++ b/src/views/system/power/index.vue @@ -4,15 +4,16 @@ import { columns } from '@/views/system/power/utils/columns'; import PureTableBar from '@/components/TableBar/src/bar'; import AddFill from '@iconify-icons/ri/add-circle-line'; import PureTable from '@pureadmin/table'; -import { deleteIds, onAdd, onDelete, onDeleteBatch, onSearch, onUpdate } from '@/views/system/power/utils/hooks'; +import { onAdd, onDelete, onDeleteBatch, onSearch, onUpdate, onUpdateBatchParent, powerIds } from '@/views/system/power/utils/hooks'; import Delete from '@iconify-icons/ep/delete'; import EditPen from '@iconify-icons/ep/edit-pen'; import Refresh from '@iconify-icons/ep/refresh'; import { selectUserinfo } from '@/components/Table/Userinfo/columns'; import { $t } from '@/plugins/i18n'; -import { usePowerStore } from '@/store/system/power.ts'; +import { usePowerStore } from '@/store/system/power'; import { useRenderIcon } from '@/components/CommonIcon/src/hooks'; import { handleTree } from '@pureadmin/utils'; +import { FormInstance } from 'element-plus'; const tableRef = ref(); const formRef = ref(); @@ -41,14 +42,14 @@ const onPageSizeChange = async (value: number) => { * @param rows */ const onSelectionChange = (rows: Array) => { - deleteIds.value = rows.map((row: any) => row.id); + powerIds.value = rows.map((row: any) => row.id); }; /** * 重置表单 * @param formEl */ -const resetForm = async formEl => { +const resetForm = async (formEl: FormInstance) => { if (!formEl) return; formEl.resetFields(); await onSearch(); @@ -87,8 +88,13 @@ onMounted(() => { {{ $t('add_new') }} + + + {{ $t('update_batches_parent') }} + + - + {{ $t('delete_batches') }} diff --git a/src/views/system/power/power-dialog.vue b/src/views/system/power/power-dialog.vue index 79a43eb..71bfc24 100644 --- a/src/views/system/power/power-dialog.vue +++ b/src/views/system/power/power-dialog.vue @@ -35,9 +35,7 @@ defineExpose({ formRef });