diff --git a/README_SIMPLEADMIN_API.md b/README_SIMPLEADMIN_API.md deleted file mode 100644 index ebb30a9..0000000 --- a/README_SIMPLEADMIN_API.md +++ /dev/null @@ -1,50 +0,0 @@ -# SimpleAdmin API 接口导入说明 - -## 当前状态 -已准备好 SimpleAdmin API 的配置,但需要确认正确的 swagger.json 路径。 - -## 如何找到正确的 swagger.json 路径 - -1. **访问 Swagger UI 页面** - - 打开浏览器访问:`http://43.139.210.35:5566/index.html` - -2. **查找 swagger.json 路径的方法:** - - **方法一:查看页面源代码** - - 在 Swagger UI 页面按 `F12` 打开开发者工具 - - 查看 `Network` 标签页 - - 刷新页面,查找以 `swagger.json` 结尾的请求 - - 记录完整的 URL 路径 - - **方法二:查看 Swagger UI 配置** - - 在页面源代码中搜索 `url:` 或 `swagger.json` - - 找到类似这样的配置: - ```javascript - url: "/swagger/v1/swagger.json" - ``` - - **方法三:尝试常见路径** - - 直接访问以下路径,看哪个能返回 JSON: - - `http://43.139.210.35:5566/swagger/v1/swagger.json` - - `http://43.139.210.35:5566/swagger.json` - - `http://43.139.210.35:5566/api/swagger.json` - -3. **更新配置** - - 找到正确的路径后,编辑 `openapi2ts.config.ts` 文件 - - 取消注释 SimpleAdmin 配置部分 - - 将 `schemaPath` 更新为正确的路径 - -4. **生成接口文件** - ```bash - npm run openapi2ts - ``` - -## 生成的接口文件位置 -接口文件将生成在:`src/api/SimpleAdmin/` 目录下 - -## 后续步骤 -接口导入成功后,可以: -1. 参考 SimpleAdmin 项目的代码结构实现登录功能 -2. 实现权限管理页面 -3. 实现组织架构管理页面 - diff --git a/entry_config.json b/entry_config.json new file mode 100644 index 0000000..abc5e8e --- /dev/null +++ b/entry_config.json @@ -0,0 +1,6 @@ +{ + "rule_path": "C:/Users/samk/Desktop/清关软件调试数据/规则表(4).xlsx", + "order_min": 1, + "order_max": 998, + "channel": "美国专线小包带电,美国专线小包特货A" +} \ No newline at end of file diff --git a/nginx-default.conf b/nginx-default.conf index 2dec8de..522d486 100644 --- a/nginx-default.conf +++ b/nginx-default.conf @@ -1,7 +1,7 @@ server { listen 80; - server_name 10.1.20.6; - + server_name 10.1.20.6; + # 启用gzip压缩 gzip on; gzip_vary on; @@ -9,122 +9,102 @@ server { gzip_types text/plain text/css text/xml text/javascript application/javascript application/xml+rss application/json application/xml image/svg+xml; gzip_comp_level 6; gzip_disable "msie6"; - - # 启用brotli压缩(如果nginx支持) - # brotli on; - # brotli_comp_level 6; - # brotli_types text/plain text/css text/xml text/javascript application/javascript application/xml+rss application/json application/xml image/svg+xml; - - # HTML文件 - 不缓存,确保用户总是获取最新版本 - location ~* \.(html|htm)$ { - root /usr/share/nginx/html; - index index.html index.htm; - try_files $uri $uri/ /index.html =404; - add_header Cache-Control "no-cache, no-store, must-revalidate"; - add_header Pragma "no-cache"; - add_header Expires "0"; + + # 静态文件根目录 + root /usr/share/nginx/html; + + # ============ API 代理配置(放在最前面,使用 ^~ 提高优先级)============ + + # RBAC 权限管理服务代理 + location ^~ /rbac { + proxy_pass http://43.139.210.35:5281; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Host $host; + proxy_connect_timeout 30s; + proxy_send_timeout 30s; + proxy_read_timeout 30s; + proxy_buffering off; } - - # 前端静态文件根路径 - 用于SPA路由 - location / { - root /usr/share/nginx/html; - index index.html index.htm; - try_files $uri $uri/ /index.html =404; - add_header Cache-Control "no-cache, no-store, must-revalidate"; - add_header Pragma "no-cache"; - add_header Expires "0"; + + # trackApi 服务代理 + location ^~ /api/trackApi { + rewrite ^/api/trackApi(.*)$ $1 break; + proxy_pass http://43.139.210.35:8889; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_connect_timeout 30s; + proxy_send_timeout 30s; + proxy_read_timeout 30s; } - - # 带hash的JS/CSS文件 - 长期缓存(1年),因为hash变化时文件名会变化 - location ~* \.(js|css)$ { - root /usr/share/nginx/html; + + # 其他 API 请求代理 + location ^~ /api { + rewrite ^/api(.*)$ $1 break; + proxy_pass http://43.139.210.35:8888; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_connect_timeout 30s; + proxy_send_timeout 30s; + proxy_read_timeout 30s; + } + + # ============ 静态资源缓存配置 ============ + + # 带hash的JS/CSS文件 - 长期缓存 + location ~* \.(?:js|css)$ { expires 1y; add_header Cache-Control "public, immutable"; access_log off; } - - # 图片资源 - 长期缓存(1年) - location ~* \.(jpg|jpeg|png|gif|ico|svg|webp|avif)$ { - root /usr/share/nginx/html; + + # 图片资源 - 长期缓存 + location ~* \.(?:jpg|jpeg|png|gif|ico|svg|webp|avif)$ { expires 1y; add_header Cache-Control "public, immutable"; access_log off; } - - # 字体文件 - 长期缓存(1年) - location ~* \.(woff|woff2|ttf|eot|otf)$ { - root /usr/share/nginx/html; + + # 字体文件 - 长期缓存 + location ~* \.(?:woff2?|ttf|eot|otf)$ { expires 1y; add_header Cache-Control "public, immutable"; access_log off; } - - # 其他静态资源 - 缓存1个月 - location ~* \.(pdf|zip|tar|gz)$ { - root /usr/share/nginx/html; + + # 其他静态资源 + location ~* \.(?:pdf|zip|tar|gz)$ { expires 1M; add_header Cache-Control "public"; access_log off; } - # 代理配置 - 按优先级顺序,更具体的路径放在前面 - - # trackApi 服务代理 - http://43.139.210.35:8889 - location /api/trackApi { - rewrite ^/api/trackApi(.*)$ $1 break; - proxy_pass http://43.139.210.35:8889; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_connect_timeout 30s; - proxy_send_timeout 30s; - proxy_read_timeout 30s; - } + # ============ SPA 前端路由(放在最后)============ - # SimpleAdmin 服务 - userCenter - http://43.139.210.35:5566 - location /api/userCenter { - rewrite ^/api(.*)$ $1 break; - proxy_pass http://43.139.210.35:5566; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_connect_timeout 30s; - proxy_send_timeout 30s; - proxy_read_timeout 30s; - } - - # SimpleAdmin 服务 - sys - http://43.139.210.35:5566 - location /api/sys { - rewrite ^/api(.*)$ $1 break; - proxy_pass http://43.139.210.35:5566; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_connect_timeout 30s; - proxy_send_timeout 30s; - proxy_read_timeout 30s; - } - - # 其他 API 请求代理到 8888 端口 - http://43.139.210.35:8888 - location /api { - rewrite ^/api(.*)$ $1 break; - proxy_pass http://43.139.210.35:8888; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_connect_timeout 30s; - proxy_send_timeout 30s; - proxy_read_timeout 30s; + location / { + index index.html; + try_files $uri $uri/ /index.html; + + # HTML 不缓存 + location ~* \.html?$ { + add_header Cache-Control "no-cache, no-store, must-revalidate"; + add_header Pragma "no-cache"; + add_header Expires "0"; + } } # 错误页面 - error_page 500 502 503 504 /50x.html; + error_page 500 502 503 504 /50x.html; location = /50x.html { - root html; + root html; } -} - +} \ No newline at end of file diff --git a/openapi2ts.config.ts b/openapi2ts.config.ts index a668e8d..15aa5fd 100644 --- a/openapi2ts.config.ts +++ b/openapi2ts.config.ts @@ -162,12 +162,4 @@ export default [ projectName: 'interface-serviceProvider', apiPrefix: "'api'", }, - // 系统管理接口 (SimpleAdmin API) - { - schemaPath: 'http://43.139.210.35:5566/swagger/Default/swagger.json', - serversPath: './src/api', - requestLibPath: '@/utils/request', - projectName: 'SimpleAdmin', - apiPrefix: "'api'", - }, ]; diff --git a/package.json b/package.json index 4f00f57..f5d062d 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,7 @@ "diff": "^8.0.2", "echarts": "^5.4.0", "font-awesome": "^4.7.0", + "form-data": "^4.0.5", "handsontable": "^16.2.0", "lodash": "^4.17.21", "lodash-es": "^4.17.21", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9c90bd8..34a51b8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -45,6 +45,9 @@ importers: font-awesome: specifier: ^4.7.0 version: 4.7.0 + form-data: + specifier: ^4.0.5 + version: 4.0.5 handsontable: specifier: ^16.2.0 version: 16.2.0 @@ -1853,6 +1856,9 @@ packages: resolution: {integrity: sha512-hsU18Ae8CDTR6Kgu9DYf0EbCr/a5iGL0rytQDobUcdpYOKokk8LEjVphnXkDkgpi0wYVsqrXuP0bZxJaTqdgoA==} engines: {node: '>= 0.4'} + asynckit@0.4.0: + resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} + atob@2.1.2: resolution: {integrity: sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==} engines: {node: '>= 4.5.0'} @@ -2158,6 +2164,10 @@ packages: colorjs.io@0.5.2: resolution: {integrity: sha512-twmVoizEW7ylZSN32OgKdXRmo1qg+wT5/6C3xu5b9QsWzSFAhHLn2xd8ro0diCsKfCj1RdaTP/nrcW+vAoQPIw==} + combined-stream@1.0.8: + resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} + engines: {node: '>= 0.8'} + commander@11.0.0: resolution: {integrity: sha512-9HMlXtt/BNoYr8ooyjjNRdIilOTkVJXB+GhxMTtOKwk0R4j4lS4NpjuqmRxroBfnfTSHQIHQB7wryHhXarNjmQ==} engines: {node: '>=16'} @@ -2512,6 +2522,10 @@ packages: defu@6.1.4: resolution: {integrity: sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==} + delayed-stream@1.0.0: + resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} + engines: {node: '>=0.4.0'} + destr@2.0.5: resolution: {integrity: sha512-ugFTXCtDZunbzasqBxrK93Ik/DRYsO6S/fedkWEMKqt04xZ4csmnmwGDBAb07QWNaGMAmnTIemsYZCksjATwsA==} @@ -3242,6 +3256,10 @@ packages: resolution: {integrity: sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==} engines: {node: '>=14'} + form-data@4.0.5: + resolution: {integrity: sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w==} + engines: {node: '>= 6'} + fragment-cache@0.2.1: resolution: {integrity: sha512-GMBAbW9antB8iZRHLoGw0b3HANt57diZYFO/HL1JGIC1MjKrdmhxvrJbupnVvpys0zsz7yBApXdQyfepKly2kA==} engines: {node: '>=0.10.0'} @@ -4374,10 +4392,18 @@ packages: resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==} engines: {node: '>=8.6'} + mime-db@1.52.0: + resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} + engines: {node: '>= 0.6'} + mime-db@1.54.0: resolution: {integrity: sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==} engines: {node: '>= 0.6'} + mime-types@2.1.35: + resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} + engines: {node: '>= 0.6'} + mime@1.6.0: resolution: {integrity: sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==} engines: {node: '>=4'} @@ -8422,6 +8448,8 @@ snapshots: async-function@1.0.0: {} + asynckit@0.4.0: {} + atob@2.1.2: {} autoprefixer@9.8.8: @@ -8792,6 +8820,10 @@ snapshots: colorjs.io@0.5.2: {} + combined-stream@1.0.8: + dependencies: + delayed-stream: 1.0.0 + commander@11.0.0: {} commander@14.0.0: {} @@ -9132,6 +9164,8 @@ snapshots: defu@6.1.4: {} + delayed-stream@1.0.0: {} + destr@2.0.5: {} detect-browser@5.3.0: {} @@ -10047,6 +10081,14 @@ snapshots: cross-spawn: 7.0.6 signal-exit: 4.1.0 + form-data@4.0.5: + dependencies: + asynckit: 0.4.0 + combined-stream: 1.0.8 + es-set-tostringtag: 2.1.0 + hasown: 2.0.2 + mime-types: 2.1.35 + fragment-cache@0.2.1: dependencies: map-cache: 0.2.2 @@ -11246,8 +11288,14 @@ snapshots: braces: 3.0.3 picomatch: 2.3.1 + mime-db@1.52.0: {} + mime-db@1.54.0: {} + mime-types@2.1.35: + dependencies: + mime-db: 1.52.0 + mime@1.6.0: optional: true diff --git a/src/api/SimpleAdmin/accessLog.ts b/src/api/SimpleAdmin/accessLog.ts deleted file mode 100644 index 0a631be..0000000 --- a/src/api/SimpleAdmin/accessLog.ts +++ /dev/null @@ -1,59 +0,0 @@ -// @ts-ignore -/* eslint-disable */ -import request from '@/utils/request'; - -/** 清空日志 POST /sys/audit/logVisit/delete */ -export async function sysAuditLogVisitDeletePost( - body: API.VisitLogDeleteInput, - options?: { [key: string]: any } -) { - return request(`api/sys/audit/logVisit/delete`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 访问日志周统计折线图 GET /sys/audit/logVisit/lineChartData */ -export async function sysAuditLogVisitLineChartDataGet(options?: { - [key: string]: any; -}) { - return request( - `api/sys/audit/logVisit/lineChartData`, - { - method: 'GET', - ...(options || {}), - } - ); -} - -/** 访问日志分页查询 GET /sys/audit/logVisit/page */ -export async function sysAuditLogVisitPageGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysAuditLogVisitPageGetParams, - options?: { [key: string]: any } -) { - return request(`api/sys/audit/logVisit/page`, { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - }); -} - -/** 访问日志总览饼图 GET /sys/audit/logVisit/pieChartData */ -export async function sysAuditLogVisitPieChartDataGet(options?: { - [key: string]: any; -}) { - return request( - `api/sys/audit/logVisit/pieChartData`, - { - method: 'GET', - ...(options || {}), - } - ); -} diff --git a/src/api/SimpleAdmin/bEndPermissionVerify.ts b/src/api/SimpleAdmin/bEndPermissionVerify.ts deleted file mode 100644 index 52fc12e..0000000 --- a/src/api/SimpleAdmin/bEndPermissionVerify.ts +++ /dev/null @@ -1,86 +0,0 @@ -// @ts-ignore -/* eslint-disable */ -import request from '@/utils/request'; - -/** 获取用户信息 GET /sys/auth/b/getLoginUser */ -export async function sysAuthBGetLoginUserGet(options?: { - [key: string]: any; -}) { - return request(`api/sys/auth/b/getLoginUser`, { - method: 'GET', - ...(options || {}), - }); -} - -/** B端获取手机验证码 GET /sys/auth/b/getPhoneValidCode */ -export async function sysAuthBGetPhoneValidCodeGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysAuthBGetPhoneValidCodeGetParams, - options?: { [key: string]: any } -) { - return request( - `api/sys/auth/b/getPhoneValidCode`, - { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - } - ); -} - -/** B端获取图片验证码 GET /sys/auth/b/getPicCaptcha */ -export async function sysAuthBGetPicCaptchaGet(options?: { - [key: string]: any; -}) { - return request(`api/sys/auth/b/getPicCaptcha`, { - method: 'GET', - ...(options || {}), - }); -} - -/** B端登录 POST /sys/auth/b/login */ -export async function sysAuthBLoginPost( - body: API.LoginInput, - options?: { [key: string]: any } -) { - return request(`api/sys/auth/b/login`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** B端手机号登录 POST /sys/auth/b/loginByPhone */ -export async function sysAuthBLoginByPhonePost( - body: API.LoginByPhoneInput, - options?: { [key: string]: any } -) { - return request(`api/sys/auth/b/loginByPhone`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 登出 POST /sys/auth/b/logout */ -export async function sysAuthBLogoutPost( - body: API.LoginOutInput, - options?: { [key: string]: any } -) { - return request(`api/sys/auth/b/logout`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} diff --git a/src/api/SimpleAdmin/batchUpdate.ts b/src/api/SimpleAdmin/batchUpdate.ts deleted file mode 100644 index f3e4875..0000000 --- a/src/api/SimpleAdmin/batchUpdate.ts +++ /dev/null @@ -1,116 +0,0 @@ -// @ts-ignore -/* eslint-disable */ -import request from '@/utils/request'; - -/** 添加批量 POST /sys/batch/add */ -export async function sysBatchAddPost( - body: API.BatchEditAddInput, - options?: { [key: string]: any } -) { - return request(`api/sys/batch/add`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 获取批量配置信息 GET /sys/batch/columns */ -export async function sysBatchColumnsGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysBatchColumnsGetParams, - options?: { [key: string]: any } -) { - return request(`api/sys/batch/columns`, { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - }); -} - -/** 配置修改批量 POST /sys/batch/config */ -export async function sysBatchConfigPost( - body: API.BatchEditConfigInput[], - options?: { [key: string]: any } -) { - return request(`api/sys/batch/config`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 获取批量配置信息 GET /sys/batch/configs */ -export async function sysBatchConfigsGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysBatchConfigsGetParams, - options?: { [key: string]: any } -) { - return request(`api/sys/batch/configs`, { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - }); -} - -/** 删除批量 POST /sys/batch/delete */ -export async function sysBatchDeletePost( - body: API.BaseIdListInput, - options?: { [key: string]: any } -) { - return request(`api/sys/batch/delete`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 批量分页查询 GET /sys/batch/page */ -export async function sysBatchPageGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysBatchPageGetParams, - options?: { [key: string]: any } -) { - return request(`api/sys/batch/page`, { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - }); -} - -/** 批量更新同步 POST /sys/batch/sync */ -export async function sysBatchSyncPost( - body: API.BaseIdInput, - options?: { [key: string]: any } -) { - return request(`api/sys/batch/sync`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 获取表信息 GET /sys/batch/tables */ -export async function sysBatchTablesGet(options?: { [key: string]: any }) { - return request(`api/sys/batch/tables`, { - method: 'GET', - ...(options || {}), - }); -} diff --git a/src/api/SimpleAdmin/codeGenBasic.ts b/src/api/SimpleAdmin/codeGenBasic.ts deleted file mode 100644 index 99457ff..0000000 --- a/src/api/SimpleAdmin/codeGenBasic.ts +++ /dev/null @@ -1,142 +0,0 @@ -// @ts-ignore -/* eslint-disable */ -import request from '@/utils/request'; - -/** 添加代码生成器 POST /sys/curd/gen/basic/add */ -export async function sysCurdGenBasicAddPost( - body: API.GenBasicAddInput, - options?: { [key: string]: any } -) { - return request(`api/sys/curd/gen/basic/add`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 获取项目所有程序集 GET /sys/curd/gen/basic/assemblies */ -export async function sysCurdGenBasicAssembliesGet(options?: { - [key: string]: any; -}) { - return request( - `api/sys/curd/gen/basic/assemblies`, - { - method: 'GET', - ...(options || {}), - } - ); -} - -/** 删除代码生成配置 POST /sys/curd/gen/basic/delete */ -export async function sysCurdGenBasicDeletePost( - body: API.BaseIdListInput, - options?: { [key: string]: any } -) { - return request(`api/sys/curd/gen/basic/delete`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 编辑代码生成器 POST /sys/curd/gen/basic/edit */ -export async function sysCurdGenBasicEditPost( - body: API.GenBasicEditInput, - options?: { [key: string]: any } -) { - return request(`api/sys/curd/gen/basic/edit`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 执行代码生成(本地)" POST /sys/curd/gen/basic/execGenPro */ -export async function sysCurdGenBasicExecGenProPost( - body: API.ExecGenInput, - options?: { [key: string]: any } -) { - return request(`api/sys/curd/gen/basic/execGenPro`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 执行代码生成(压缩包) GET /sys/curd/gen/basic/execGenZip */ -export async function sysCurdGenBasicExecGenZipGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysCurdGenBasicExecGenZipGetParams, - options?: { [key: string]: any } -) { - return request( - `api/sys/curd/gen/basic/execGenZip`, - { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - } - ); -} - -/** 代码生成基础分页 GET /sys/curd/gen/basic/page */ -export async function sysCurdGenBasicPageGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysCurdGenBasicPageGetParams, - options?: { [key: string]: any } -) { - return request(`api/sys/curd/gen/basic/page`, { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - }); -} - -/** 代码生成预览 GET /sys/curd/gen/basic/previewGen */ -export async function sysCurdGenBasicPreviewGenGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysCurdGenBasicPreviewGenGetParams, - options?: { [key: string]: any } -) { - return request( - `api/sys/curd/gen/basic/previewGen`, - { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - } - ); -} - -/** 获取所有表信息 GET /sys/curd/gen/basic/tables */ -export async function sysCurdGenBasicTablesGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysCurdGenBasicTablesGetParams, - options?: { [key: string]: any } -) { - return request(`api/sys/curd/gen/basic/tables`, { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - }); -} diff --git a/src/api/SimpleAdmin/codeGenConfig.ts b/src/api/SimpleAdmin/codeGenConfig.ts deleted file mode 100644 index 02fc1e2..0000000 --- a/src/api/SimpleAdmin/codeGenConfig.ts +++ /dev/null @@ -1,33 +0,0 @@ -// @ts-ignore -/* eslint-disable */ -import request from '@/utils/request'; - -/** 编辑代码生成详细 POST /sys/curd/gen/config/editBatch */ -export async function sysCurdGenConfigEditBatchPost( - body: API.GenConfig[], - options?: { [key: string]: any } -) { - return request(`api/sys/curd/gen/config/editBatch`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 查询代码生成详细配置列表 GET /sys/curd/gen/config/list */ -export async function sysCurdGenConfigListGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysCurdGenConfigListGetParams, - options?: { [key: string]: any } -) { - return request(`api/sys/curd/gen/config/list`, { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - }); -} diff --git a/src/api/SimpleAdmin/common.ts b/src/api/SimpleAdmin/common.ts deleted file mode 100644 index 6edb3ed..0000000 --- a/src/api/SimpleAdmin/common.ts +++ /dev/null @@ -1,35 +0,0 @@ -// @ts-ignore -/* eslint-disable */ -import request from '@/utils/request'; - -/** 获取系统基础配置 GET /sys/ico */ -export async function sysIcoGet(options?: { [key: string]: any }) { - return request(`api/sys/ico`, { - method: 'GET', - ...(options || {}), - }); -} - -/** 获取系统基础配置 GET /sys/loginPolicy */ -export async function sysLoginPolicyGet(options?: { [key: string]: any }) { - return request(`api/sys/loginPolicy`, { - method: 'GET', - ...(options || {}), - }); -} - -/** 获取系统基础配置 GET /sys/sysInfo */ -export async function sysSysInfoGet(options?: { [key: string]: any }) { - return request(`api/sys/sysInfo`, { - method: 'GET', - ...(options || {}), - }); -} - -/** 获取租户列表 GET /sys/tenantList */ -export async function sysTenantListGet(options?: { [key: string]: any }) { - return request(`api/sys/tenantList`, { - method: 'GET', - ...(options || {}), - }); -} diff --git a/src/api/SimpleAdmin/fileManagement.ts b/src/api/SimpleAdmin/fileManagement.ts deleted file mode 100644 index a2d959e..0000000 --- a/src/api/SimpleAdmin/fileManagement.ts +++ /dev/null @@ -1,123 +0,0 @@ -// @ts-ignore -/* eslint-disable */ -import request from '@/utils/request'; - -/** 删除文件 POST /sys/dev/file/delete */ -export async function sysDevFileDeletePost( - body: API.BaseIdListInput, - options?: { [key: string]: any } -) { - return request(`api/sys/dev/file/delete`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 下载文件 GET /sys/dev/file/download */ -export async function sysDevFileDownloadGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysDevFileDownloadGetParams, - options?: { [key: string]: any } -) { - return request( - `api/sys/dev/file/download`, - { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - } - ); -} - -/** 文件查询分页 GET /sys/dev/file/page */ -export async function sysDevFilePageGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysDevFilePageGetParams, - options?: { [key: string]: any } -) { - return request(`api/sys/dev/file/page`, { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - }); -} - -/** 上传本地文件 POST /sys/dev/file/uploadLocal */ -export async function sysDevFileUploadLocalPost( - body: {}, - file?: File, - options?: { [key: string]: any } -) { - const formData = new FormData(); - - if (file) { - formData.append('file', file); - } - - Object.keys(body).forEach((ele) => { - const item = (body as any)[ele]; - - if (item !== undefined && item !== null) { - if (typeof item === 'object' && !(item instanceof File)) { - if (item instanceof Array) { - item.forEach((f) => formData.append(ele, f || '')); - } else { - formData.append(ele, JSON.stringify(item)); - } - } else { - formData.append(ele, item); - } - } - }); - - return request(`api/sys/dev/file/uploadLocal`, { - method: 'POST', - data: formData, - requestType: 'form', - ...(options || {}), - }); -} - -/** 上传MINIO文件 POST /sys/dev/file/uploadMinio */ -export async function sysDevFileUploadMinioPost( - body: {}, - file?: File, - options?: { [key: string]: any } -) { - const formData = new FormData(); - - if (file) { - formData.append('file', file); - } - - Object.keys(body).forEach((ele) => { - const item = (body as any)[ele]; - - if (item !== undefined && item !== null) { - if (typeof item === 'object' && !(item instanceof File)) { - if (item instanceof Array) { - item.forEach((f) => formData.append(ele, f || '')); - } else { - formData.append(ele, JSON.stringify(item)); - } - } else { - formData.append(ele, item); - } - } - }); - - return request(`api/sys/dev/file/uploadMinio`, { - method: 'POST', - data: formData, - requestType: 'form', - ...(options || {}), - }); -} diff --git a/src/api/SimpleAdmin/fileUploadController.ts b/src/api/SimpleAdmin/fileUploadController.ts deleted file mode 100644 index f84cf68..0000000 --- a/src/api/SimpleAdmin/fileUploadController.ts +++ /dev/null @@ -1,40 +0,0 @@ -// @ts-ignore -/* eslint-disable */ -import request from '@/utils/request'; - -/** 1 - 上传图片 POST /sys/upload/uploadImg */ -export async function sysUploadUploadImgPost( - body: {}, - file?: File, - options?: { [key: string]: any } -) { - const formData = new FormData(); - - if (file) { - formData.append('file', file); - } - - Object.keys(body).forEach((ele) => { - const item = (body as any)[ele]; - - if (item !== undefined && item !== null) { - if (typeof item === 'object' && !(item instanceof File)) { - if (item instanceof Array) { - item.forEach((f) => formData.append(ele, f || '')); - } else { - formData.append(ele, JSON.stringify(item)); - } - } else { - formData.append(ele, item); - } - } - }); - - return request(`api/sys/upload/uploadImg`, { - method: 'POST', - data: formData, - requestType: 'form', - ...(options || {}), - }); -} diff --git a/src/api/SimpleAdmin/index.ts b/src/api/SimpleAdmin/index.ts deleted file mode 100644 index 94c5729..0000000 --- a/src/api/SimpleAdmin/index.ts +++ /dev/null @@ -1,54 +0,0 @@ -// @ts-ignore -/* eslint-disable */ -// API 更新时间: -// API 唯一标识: -import * as roleManagement from './roleManagement'; -import * as bEndPermissionVerify from './bEndPermissionVerify'; -import * as sessionManagement from './sessionManagement'; -import * as batchUpdate from './batchUpdate'; -import * as common from './common'; -import * as fileManagement from './fileManagement'; -import * as internalMessage from './internalMessage'; -import * as codeGenBasic from './codeGenBasic'; -import * as codeGenConfig from './codeGenConfig'; -import * as systemHome from './systemHome'; -import * as permissionButton from './permissionButton'; -import * as menuManagement from './menuManagement'; -import * as moduleManagement from './moduleManagement'; -import * as spaManagement from './spaManagement'; -import * as operationLog from './operationLog'; -import * as accessLog from './accessLog'; -import * as mqttService from './mqttService'; -import * as systemConfig from './systemConfig'; -import * as systemDict from './systemDict'; -import * as organizationManagement from './organizationManagement'; -import * as positionManagement from './positionManagement'; -import * as userManagement from './userManagement'; -import * as fileUploadController from './fileUploadController'; -import * as userCenter from './userCenter'; -export default { - roleManagement, - bEndPermissionVerify, - sessionManagement, - batchUpdate, - common, - fileManagement, - internalMessage, - codeGenBasic, - codeGenConfig, - systemHome, - permissionButton, - menuManagement, - moduleManagement, - spaManagement, - operationLog, - accessLog, - mqttService, - systemConfig, - systemDict, - organizationManagement, - positionManagement, - userManagement, - fileUploadController, - userCenter, -}; diff --git a/src/api/SimpleAdmin/internalMessage.ts b/src/api/SimpleAdmin/internalMessage.ts deleted file mode 100644 index 295b6a7..0000000 --- a/src/api/SimpleAdmin/internalMessage.ts +++ /dev/null @@ -1,78 +0,0 @@ -// @ts-ignore -/* eslint-disable */ -import request from '@/utils/request'; - -/** 添加站内信 POST /sys/dev/message/add */ -export async function sysDevMessageAddPost( - body: API.MessageSendInput, - options?: { [key: string]: any } -) { - return request(`api/sys/dev/message/add`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 删除站内信 POST /sys/dev/message/delete */ -export async function sysDevMessageDeletePost( - body: API.BaseIdListInput, - options?: { [key: string]: any } -) { - return request(`api/sys/dev/message/delete`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 消息详情 GET /sys/dev/message/detail */ -export async function sysDevMessageDetailGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysDevMessageDetailGetParams, - options?: { [key: string]: any } -) { - return request(`api/sys/dev/message/detail`, { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - }); -} - -/** 编辑站内信 POST /sys/dev/message/edit */ -export async function sysDevMessageEditPost( - body: API.MessageSendUpdateInput, - options?: { [key: string]: any } -) { - return request(`api/sys/dev/message/edit`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 分页查询 GET /sys/dev/message/page */ -export async function sysDevMessagePageGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysDevMessagePageGetParams, - options?: { [key: string]: any } -) { - return request(`api/sys/dev/message/page`, { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - }); -} diff --git a/src/api/SimpleAdmin/menuManagement.ts b/src/api/SimpleAdmin/menuManagement.ts deleted file mode 100644 index 3d68a9c..0000000 --- a/src/api/SimpleAdmin/menuManagement.ts +++ /dev/null @@ -1,131 +0,0 @@ -// @ts-ignore -/* eslint-disable */ -import request from '@/utils/request'; - -/** 添加菜单 POST /sys/limit/menu/add */ -export async function sysLimitMenuAddPost( - body: API.MenuAddInput, - options?: { [key: string]: any } -) { - // 确保 name 字段被包含在请求中(即使类型定义中是可选的) - const requestBody: any = { - ...body, - // 如果 body 中没有 name 字段,使用 code 或 title 作为 name - name: (body as any).name || (body as any).code || body.title || '', - }; - - return request(`api/sys/limit/menu/add`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: requestBody, - ...(options || {}), - }); -} - -/** 更改模块 POST /sys/limit/menu/changeModule */ -export async function sysLimitMenuChangeModulePost( - body: API.MenuChangeModuleInput, - options?: { [key: string]: any } -) { - return request(`api/sys/limit/menu/changeModule`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 删除菜单 POST /sys/limit/menu/delete */ -export async function sysLimitMenuDeletePost( - body: API.BaseIdListInput, - options?: { [key: string]: any } -) { - return request(`api/sys/limit/menu/delete`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 获取菜单详情 GET /sys/limit/menu/detail */ -export async function sysLimitMenuDetailGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysLimitMenuDetailGetParams, - options?: { [key: string]: any } -) { - return request(`api/sys/limit/menu/detail`, { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - }); -} - -/** 编辑菜单 POST /sys/limit/menu/edit */ -export async function sysLimitMenuEditPost( - body: API.MenuEditInput, - options?: { [key: string]: any } -) { - return request(`api/sys/limit/menu/edit`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 获取菜单树选择器 GET /sys/limit/menu/menuTreeSelector */ -export async function sysLimitMenuMenuTreeSelectorGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysLimitMenuMenuTreeSelectorGetParams, - options?: { [key: string]: any } -) { - return request( - `api/sys/limit/menu/menuTreeSelector`, - { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - } - ); -} - -/** 模块选择 GET /sys/limit/menu/moduleSelector */ -export async function sysLimitMenuModuleSelectorGet(options?: { - [key: string]: any; -}) { - return request( - `api/sys/limit/menu/moduleSelector`, - { - method: 'GET', - ...(options || {}), - } - ); -} - -/** 获取菜单树 GET /sys/limit/menu/tree */ -export async function sysLimitMenuTreeGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysLimitMenuTreeGetParams, - options?: { [key: string]: any } -) { - return request(`api/sys/limit/menu/tree`, { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - }); -} diff --git a/src/api/SimpleAdmin/moduleManagement.ts b/src/api/SimpleAdmin/moduleManagement.ts deleted file mode 100644 index a5dab37..0000000 --- a/src/api/SimpleAdmin/moduleManagement.ts +++ /dev/null @@ -1,86 +0,0 @@ -// @ts-ignore -/* eslint-disable */ -import request from '@/utils/request'; - -/** 添加模块 POST /sys/limit/module/add */ -export async function sysLimitModuleAddPost( - body: API.ModuleAddInput, - options?: { [key: string]: any } -) { - return request(`api/sys/limit/module/add`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 删除模块 POST /sys/limit/module/delete */ -export async function sysLimitModuleDeletePost( - body: API.BaseIdListInput, - options?: { [key: string]: any } -) { - return request(`api/sys/limit/module/delete`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 获取模块详情 GET /sys/limit/module/detail */ -export async function sysLimitModuleDetailGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysLimitModuleDetailGetParams, - options?: { [key: string]: any } -) { - return request(`api/sys/limit/module/detail`, { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - }); -} - -/** 修改模块 POST /sys/limit/module/edit */ -export async function sysLimitModuleEditPost( - body: API.ModuleEditInput, - options?: { [key: string]: any } -) { - return request(`api/sys/limit/module/edit`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 模块列表 GET /sys/limit/module/list */ -export async function sysLimitModuleListGet(options?: { [key: string]: any }) { - return request(`api/sys/limit/module/list`, { - method: 'GET', - ...(options || {}), - }); -} - -/** 模块分页查询 GET /sys/limit/module/page */ -export async function sysLimitModulePageGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysLimitModulePageGetParams, - options?: { [key: string]: any } -) { - return request(`api/sys/limit/module/page`, { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - }); -} diff --git a/src/api/SimpleAdmin/mqttService.ts b/src/api/SimpleAdmin/mqttService.ts deleted file mode 100644 index ff0c701..0000000 --- a/src/api/SimpleAdmin/mqttService.ts +++ /dev/null @@ -1,26 +0,0 @@ -// @ts-ignore -/* eslint-disable */ -import request from '@/utils/request'; - -/** mqtt认证 POST /mqtt/auth */ -export async function mqttAuthPost( - body: API.MqttAuthInput, - options?: { [key: string]: any } -) { - return request(`api/mqtt/auth`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 获取mqtt登录参数 GET /mqtt/getParameter */ -export async function mqttGetParameterGet(options?: { [key: string]: any }) { - return request(`api/mqtt/getParameter`, { - method: 'GET', - ...(options || {}), - }); -} diff --git a/src/api/SimpleAdmin/operationLog.ts b/src/api/SimpleAdmin/operationLog.ts deleted file mode 100644 index 7f178e8..0000000 --- a/src/api/SimpleAdmin/operationLog.ts +++ /dev/null @@ -1,77 +0,0 @@ -// @ts-ignore -/* eslint-disable */ -import request from '@/utils/request'; - -/** 操作日志周统计柱状图图 GET /sys/audit/logOperate/columnChartData */ -export async function sysAuditLogOperateColumnChartDataGet(options?: { - [key: string]: any; -}) { - return request( - `api/sys/audit/logOperate/columnChartData`, - { - method: 'GET', - ...(options || {}), - } - ); -} - -/** 清空日志 POST /sys/audit/logOperate/delete */ -export async function sysAuditLogOperateDeletePost( - body: API.OperateLogDeleteInput, - options?: { [key: string]: any } -) { - return request(`api/sys/audit/logOperate/delete`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 日志详情 GET /sys/audit/logOperate/detail */ -export async function sysAuditLogOperateDetailGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysAuditLogOperateDetailGetParams, - options?: { [key: string]: any } -) { - return request( - `api/sys/audit/logOperate/detail`, - { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - } - ); -} - -/** 操作日志分页查询 GET /sys/audit/logOperate/page */ -export async function sysAuditLogOperatePageGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysAuditLogOperatePageGetParams, - options?: { [key: string]: any } -) { - return request(`api/sys/audit/logOperate/page`, { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - }); -} - -/** 操作日志数量总览饼图 GET /sys/audit/logOperate/pieChartData */ -export async function sysAuditLogOperatePieChartDataGet(options?: { - [key: string]: any; -}) { - return request( - `api/sys/audit/logOperate/pieChartData`, - { - method: 'GET', - ...(options || {}), - } - ); -} diff --git a/src/api/SimpleAdmin/organizationManagement.ts b/src/api/SimpleAdmin/organizationManagement.ts deleted file mode 100644 index e7d40b8..0000000 --- a/src/api/SimpleAdmin/organizationManagement.ts +++ /dev/null @@ -1,137 +0,0 @@ -// @ts-ignore -/* eslint-disable */ -import request from '@/utils/request'; - -/** 添加组织 POST /sys/organization/org/add */ -export async function sysOrganizationOrgAddPost( - body: API.SysOrgAddInput, - options?: { [key: string]: any } -) { - return request(`api/sys/organization/org/add`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 复制组织 POST /sys/organization/org/copy */ -export async function sysOrganizationOrgCopyPost( - body: API.SysOrgCopyInput, - options?: { [key: string]: any } -) { - return request(`api/sys/organization/org/copy`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 删除组织 POST /sys/organization/org/delete */ -export async function sysOrganizationOrgDeletePost( - body: API.BaseIdListInput, - options?: { [key: string]: any } -) { - return request(`api/sys/organization/org/delete`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 获取组织详情 GET /sys/organization/org/detail */ -export async function sysOrganizationOrgDetailGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysOrganizationOrgDetailGetParams, - options?: { [key: string]: any } -) { - return request( - `api/sys/organization/org/detail`, - { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - } - ); -} - -/** 修改组织 POST /sys/organization/org/edit */ -export async function sysOrganizationOrgEditPost( - body: API.SysOrgEditInput, - options?: { [key: string]: any } -) { - return request(`api/sys/organization/org/edit`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 获取组织树选择器 GET /sys/organization/org/orgTreeSelector */ -export async function sysOrganizationOrgOrgTreeSelectorGet(options?: { - [key: string]: any; -}) { - return request( - `api/sys/organization/org/orgTreeSelector`, - { - method: 'GET', - ...(options || {}), - } - ); -} - -/** 组织分页查询 GET /sys/organization/org/page */ -export async function sysOrganizationOrgPageGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysOrganizationOrgPageGetParams, - options?: { [key: string]: any } -) { - return request(`api/sys/organization/org/page`, { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - }); -} - -/** 获取用户选择器 GET /sys/organization/org/selector */ -export async function sysOrganizationOrgSelectorGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysOrganizationOrgSelectorGetParams, - options?: { [key: string]: any } -) { - return request( - `api/sys/organization/org/selector`, - { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - } - ); -} - -/** 获取组织树 GET /sys/organization/org/tree */ -export async function sysOrganizationOrgTreeGet(options?: { - [key: string]: any; -}) { - return request(`api/sys/organization/org/tree`, { - method: 'GET', - ...(options || {}), - }); -} diff --git a/src/api/SimpleAdmin/permissionButton.ts b/src/api/SimpleAdmin/permissionButton.ts deleted file mode 100644 index 72c2ad9..0000000 --- a/src/api/SimpleAdmin/permissionButton.ts +++ /dev/null @@ -1,93 +0,0 @@ -// @ts-ignore -/* eslint-disable */ -import request from '@/utils/request'; - -/** 添加按钮 POST /sys/limit/button/add */ -export async function sysLimitButtonAddPost( - body: API.ButtonAddInput, - options?: { [key: string]: any } -) { - return request(`api/sys/limit/button/add`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 批量新增 POST /sys/limit/button/batch */ -export async function sysLimitButtonBatchPost( - body: API.ButtonAddInput, - options?: { [key: string]: any } -) { - return request(`api/sys/limit/button/batch`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 删除按钮 POST /sys/limit/button/delete */ -export async function sysLimitButtonDeletePost( - body: API.BaseIdListInput, - options?: { [key: string]: any } -) { - return request(`api/sys/limit/button/delete`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 获取按钮详情 GET /sys/limit/button/detail */ -export async function sysLimitButtonDetailGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysLimitButtonDetailGetParams, - options?: { [key: string]: any } -) { - return request(`api/sys/limit/button/detail`, { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - }); -} - -/** 修改按钮 POST /sys/limit/button/edit */ -export async function sysLimitButtonEditPost( - body: API.ButtonEditInput, - options?: { [key: string]: any } -) { - return request(`api/sys/limit/button/edit`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 按钮分页查询 GET /sys/limit/button/page */ -export async function sysLimitButtonPageGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysLimitButtonPageGetParams, - options?: { [key: string]: any } -) { - return request(`api/sys/limit/button/page`, { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - }); -} diff --git a/src/api/SimpleAdmin/positionManagement.ts b/src/api/SimpleAdmin/positionManagement.ts deleted file mode 100644 index 4f05098..0000000 --- a/src/api/SimpleAdmin/positionManagement.ts +++ /dev/null @@ -1,120 +0,0 @@ -// @ts-ignore -/* eslint-disable */ -import request from '@/utils/request'; - -/** 添加职位 POST /sys/organization/position/add */ -export async function sysOrganizationPositionAddPost( - body: API.PositionAddInput, - options?: { [key: string]: any } -) { - return request(`api/sys/organization/position/add`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 删除职位 POST /sys/organization/position/delete */ -export async function sysOrganizationPositionDeletePost( - body: API.BaseIdListInput, - options?: { [key: string]: any } -) { - return request(`api/sys/organization/position/delete`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 获取职位详情 GET /sys/organization/position/detail */ -export async function sysOrganizationPositionDetailGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysOrganizationPositionDetailGetParams, - options?: { [key: string]: any } -) { - return request( - `api/sys/organization/position/detail`, - { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - } - ); -} - -/** 修改职位 POST /sys/organization/position/edit */ -export async function sysOrganizationPositionEditPost( - body: API.PositionEditInput, - options?: { [key: string]: any } -) { - return request(`api/sys/organization/position/edit`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 职位分页查询 GET /sys/organization/position/page */ -export async function sysOrganizationPositionPageGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysOrganizationPositionPageGetParams, - options?: { [key: string]: any } -) { - return request( - `api/sys/organization/position/page`, - { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - } - ); -} - -/** 职位选择器 GET /sys/organization/position/selector */ -export async function sysOrganizationPositionSelectorGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysOrganizationPositionSelectorGetParams, - options?: { [key: string]: any } -) { - return request( - `api/sys/organization/position/selector`, - { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - } - ); -} - -/** 获取职位树 GET /sys/organization/position/tree */ -export async function sysOrganizationPositionTreeGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysOrganizationPositionTreeGetParams, - options?: { [key: string]: any } -) { - return request( - `api/sys/organization/position/tree`, - { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - } - ); -} diff --git a/src/api/SimpleAdmin/roleManagement.ts b/src/api/SimpleAdmin/roleManagement.ts deleted file mode 100644 index da36372..0000000 --- a/src/api/SimpleAdmin/roleManagement.ts +++ /dev/null @@ -1,434 +0,0 @@ -// @ts-ignore -/* eslint-disable */ -import request from '@/utils/request'; - -/** 添加角色 POST /biz/organization/role/add */ -export async function bizOrganizationRoleAddPost( - body: API.RoleAddInput, - options?: { [key: string]: any } -) { - return request(`api/biz/organization/role/add`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 删除角色 POST /biz/organization/role/delete */ -export async function bizOrganizationRoleDeletePost( - body: API.BaseIdListInput, - options?: { [key: string]: any } -) { - return request(`api/biz/organization/role/delete`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 获取角色详情 GET /biz/organization/role/detail */ -export async function bizOrganizationRoleDetailGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.bizOrganizationRoleDetailGetParams, - options?: { [key: string]: any } -) { - return request( - `api/biz/organization/role/detail`, - { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - } - ); -} - -/** 修改角色 POST /biz/organization/role/edit */ -export async function bizOrganizationRoleEditPost( - body: API.RoleEditInput, - options?: { [key: string]: any } -) { - return request(`api/biz/organization/role/edit`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 给角色授权资源 POST /biz/organization/role/grantResource */ -export async function bizOrganizationRoleGrantResourcePost( - body: API.GrantResourceInput, - options?: { [key: string]: any } -) { - return request(`api/biz/organization/role/grantResource`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 给角色授权用户 POST /biz/organization/role/grantUser */ -export async function bizOrganizationRoleGrantUserPost( - body: API.GrantUserInput, - options?: { [key: string]: any } -) { - return request(`api/biz/organization/role/grantUser`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 获取角色拥有资源 GET /biz/organization/role/ownResource */ -export async function bizOrganizationRoleOwnResourceGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.bizOrganizationRoleOwnResourceGetParams, - options?: { [key: string]: any } -) { - return request( - `api/biz/organization/role/ownResource`, - { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - } - ); -} - -/** 获取角色下的用户 GET /biz/organization/role/ownUser */ -export async function bizOrganizationRoleOwnUserGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.bizOrganizationRoleOwnUserGetParams, - options?: { [key: string]: any } -) { - return request( - `api/biz/organization/role/ownUser`, - { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - } - ); -} - -/** 角色分页查询 GET /biz/organization/role/page */ -export async function bizOrganizationRolePageGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.bizOrganizationRolePageGetParams, - options?: { [key: string]: any } -) { - return request( - `api/biz/organization/role/page`, - { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - } - ); -} - -/** 获取角色授权资源树 GET /biz/organization/role/resourceTreeSelector */ -export async function bizOrganizationRoleResourceTreeSelectorGet(options?: { - [key: string]: any; -}) { - return request( - `api/biz/organization/role/resourceTreeSelector`, - { - method: 'GET', - ...(options || {}), - } - ); -} - -/** 获取角色选择器 GET /biz/organization/role/roleSelector */ -export async function bizOrganizationRoleRoleSelectorGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.bizOrganizationRoleRoleSelectorGetParams, - options?: { [key: string]: any } -) { - return request( - `api/biz/organization/role/roleSelector`, - { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - } - ); -} - -/** 获取角色树 GET /biz/organization/role/tree */ -export async function bizOrganizationRoleTreeGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.bizOrganizationRoleTreeGetParams, - options?: { [key: string]: any } -) { - return request( - `api/biz/organization/role/tree`, - { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - } - ); -} - -/** 添加角色 POST /sys/limit/role/add */ -export async function sysLimitRoleAddPost( - body: API.RoleAddInput, - options?: { [key: string]: any } -) { - return request(`api/sys/limit/role/add`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 删除角色 POST /sys/limit/role/delete */ -export async function sysLimitRoleDeletePost( - body: API.BaseIdListInput, - options?: { [key: string]: any } -) { - return request(`api/sys/limit/role/delete`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 获取角色详情 GET /sys/limit/role/detail */ -export async function sysLimitRoleDetailGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysLimitRoleDetailGetParams, - options?: { [key: string]: any } -) { - return request(`api/sys/limit/role/detail`, { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - }); -} - -/** 修改角色 POST /sys/limit/role/edit */ -export async function sysLimitRoleEditPost( - body: API.RoleEditInput, - options?: { [key: string]: any } -) { - return request(`api/sys/limit/role/edit`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 给角色授权权限 POST /sys/limit/role/grantPermission */ -export async function sysLimitRoleGrantPermissionPost( - body: API.GrantPermissionInput, - options?: { [key: string]: any } -) { - return request(`api/sys/limit/role/grantPermission`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 给角色授权资源 POST /sys/limit/role/grantResource */ -export async function sysLimitRoleGrantResourcePost( - body: API.GrantResourceInput, - options?: { [key: string]: any } -) { - return request(`api/sys/limit/role/grantResource`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 给角色授权用户 POST /sys/limit/role/grantUser */ -export async function sysLimitRoleGrantUserPost( - body: API.GrantUserInput, - options?: { [key: string]: any } -) { - return request(`api/sys/limit/role/grantUser`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 获取角色拥有权限 GET /sys/limit/role/ownPermission */ -export async function sysLimitRoleOwnPermissionGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysLimitRoleOwnPermissionGetParams, - options?: { [key: string]: any } -) { - return request( - `api/sys/limit/role/ownPermission`, - { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - } - ); -} - -/** 获取角色拥有资源 GET /sys/limit/role/ownResource */ -export async function sysLimitRoleOwnResourceGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysLimitRoleOwnResourceGetParams, - options?: { [key: string]: any } -) { - return request( - `api/sys/limit/role/ownResource`, - { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - } - ); -} - -/** 获取角色下的用户 GET /sys/limit/role/ownUser */ -export async function sysLimitRoleOwnUserGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysLimitRoleOwnUserGetParams, - options?: { [key: string]: any } -) { - return request(`api/sys/limit/role/ownUser`, { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - }); -} - -/** 角色分页查询 GET /sys/limit/role/page */ -export async function sysLimitRolePageGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysLimitRolePageGetParams, - options?: { [key: string]: any } -) { - return request(`api/sys/limit/role/page`, { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - }); -} - -/** 获取权限授权树 GET /sys/limit/role/permissionTreeSelector */ -export async function sysLimitRolePermissionTreeSelectorGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysLimitRolePermissionTreeSelectorGetParams, - options?: { [key: string]: any } -) { - return request( - `api/sys/limit/role/permissionTreeSelector`, - { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - } - ); -} - -/** 获取角色授权资源树 GET /sys/limit/role/resourceTreeSelector */ -export async function sysLimitRoleResourceTreeSelectorGet(options?: { - [key: string]: any; -}) { - return request( - `api/sys/limit/role/resourceTreeSelector`, - { - method: 'GET', - ...(options || {}), - } - ); -} - -/** 获取角色选择器 GET /sys/limit/role/roleSelector */ -export async function sysLimitRoleRoleSelectorGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysLimitRoleRoleSelectorGetParams, - options?: { [key: string]: any } -) { - return request( - `api/sys/limit/role/roleSelector`, - { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - } - ); -} - -/** 获取角色树 GET /sys/limit/role/tree */ -export async function sysLimitRoleTreeGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysLimitRoleTreeGetParams, - options?: { [key: string]: any } -) { - return request(`api/sys/limit/role/tree`, { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - }); -} diff --git a/src/api/SimpleAdmin/sessionManagement.ts b/src/api/SimpleAdmin/sessionManagement.ts deleted file mode 100644 index 42173a7..0000000 --- a/src/api/SimpleAdmin/sessionManagement.ts +++ /dev/null @@ -1,103 +0,0 @@ -// @ts-ignore -/* eslint-disable */ -import request from '@/utils/request'; - -/** 会话统计 GET /sys/auth/session/analysis */ -export async function sysAuthSessionAnalysisGet(options?: { - [key: string]: any; -}) { - return request(`api/sys/auth/session/analysis`, { - method: 'GET', - ...(options || {}), - }); -} - -/** 强退B端会话 POST /sys/auth/session/b/exitSession */ -export async function sysAuthSessionBExitSessionPost( - body: API.BaseIdInput, - options?: { [key: string]: any } -) { - return request(`api/sys/auth/session/b/exitSession`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 强退B端Token POST /sys/auth/session/b/ExitToken */ -export async function sysAuthSessionBExitTokenPost( - body: API.ExitTokenInput, - options?: { [key: string]: any } -) { - return request(`api/sys/auth/session/b/ExitToken`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** B端会话分页 GET /sys/auth/session/b/page */ -export async function sysAuthSessionBPageGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysAuthSessionBPageGetParams, - options?: { [key: string]: any } -) { - return request(`api/sys/auth/session/b/page`, { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - }); -} - -/** 强退C端会话 POST /sys/auth/session/c/exitSession */ -export async function sysAuthSessionCExitSessionPost( - body: API.BaseIdInput, - options?: { [key: string]: any } -) { - return request(`api/sys/auth/session/c/exitSession`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 强退C端Token POST /sys/auth/session/c/ExitToken */ -export async function sysAuthSessionCExitTokenPost( - body: API.ExitTokenInput, - options?: { [key: string]: any } -) { - return request(`api/sys/auth/session/c/ExitToken`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** C端会话分页 GET /sys/auth/session/c/page */ -export async function sysAuthSessionCPageGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysAuthSessionCPageGetParams, - options?: { [key: string]: any } -) { - return request(`api/sys/auth/session/c/page`, { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - }); -} diff --git a/src/api/SimpleAdmin/spaManagement.ts b/src/api/SimpleAdmin/spaManagement.ts deleted file mode 100644 index bd5e4c4..0000000 --- a/src/api/SimpleAdmin/spaManagement.ts +++ /dev/null @@ -1,78 +0,0 @@ -// @ts-ignore -/* eslint-disable */ -import request from '@/utils/request'; - -/** 添加单页 POST /sys/limit/spa/add */ -export async function sysLimitSpaAddPost( - body: API.SpaAddInput, - options?: { [key: string]: any } -) { - return request(`api/sys/limit/spa/add`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 删除单页 POST /sys/limit/spa/delete */ -export async function sysLimitSpaDeletePost( - body: API.BaseIdListInput, - options?: { [key: string]: any } -) { - return request(`api/sys/limit/spa/delete`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 获取单页详情 GET /sys/limit/spa/detail */ -export async function sysLimitSpaDetailGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysLimitSpaDetailGetParams, - options?: { [key: string]: any } -) { - return request(`api/sys/limit/spa/detail`, { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - }); -} - -/** 修改单页 POST /sys/limit/spa/edit */ -export async function sysLimitSpaEditPost( - body: API.SpaEditInput, - options?: { [key: string]: any } -) { - return request(`api/sys/limit/spa/edit`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 单页分页查询 GET /sys/limit/spa/page */ -export async function sysLimitSpaPageGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysLimitSpaPageGetParams, - options?: { [key: string]: any } -) { - return request(`api/sys/limit/spa/page`, { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - }); -} diff --git a/src/api/SimpleAdmin/systemConfig.ts b/src/api/SimpleAdmin/systemConfig.ts deleted file mode 100644 index 1fe4c17..0000000 --- a/src/api/SimpleAdmin/systemConfig.ts +++ /dev/null @@ -1,99 +0,0 @@ -// @ts-ignore -/* eslint-disable */ -import request from '@/utils/request'; - -/** 添加配置 POST /sys/ops/config/add */ -export async function sysOpsConfigAddPost( - body: API.ConfigAddInput, - options?: { [key: string]: any } -) { - return request(`api/sys/ops/config/add`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 删除配置 POST /sys/ops/config/delete */ -export async function sysOpsConfigDeletePost( - body: API.ConfigDeleteInput, - options?: { [key: string]: any } -) { - return request(`api/sys/ops/config/delete`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 修改配置 POST /sys/ops/config/edit */ -export async function sysOpsConfigEditPost( - body: API.ConfigEditInput, - options?: { [key: string]: any } -) { - return request(`api/sys/ops/config/edit`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 配置批量更新 POST /sys/ops/config/editBatch */ -export async function sysOpsConfigEditBatchPost( - body: API.SysConfig[], - options?: { [key: string]: any } -) { - return request(`api/sys/ops/config/editBatch`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 获取系统配置列表 GET /sys/ops/config/list */ -export async function sysOpsConfigListGet(options?: { [key: string]: any }) { - return request(`api/sys/ops/config/list`, { - method: 'GET', - ...(options || {}), - }); -} - -/** 配置分页 GET /sys/ops/config/page */ -export async function sysOpsConfigPageGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysOpsConfigPageGetParams, - options?: { [key: string]: any } -) { - return request(`api/sys/ops/config/page`, { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - }); -} - -/** 获取系统基础配置 GET /sys/ops/config/sysBaseList */ -export async function sysOpsConfigSysBaseListGet(options?: { - [key: string]: any; -}) { - return request( - `api/sys/ops/config/sysBaseList`, - { - method: 'GET', - ...(options || {}), - } - ); -} diff --git a/src/api/SimpleAdmin/systemDict.ts b/src/api/SimpleAdmin/systemDict.ts deleted file mode 100644 index 910bef1..0000000 --- a/src/api/SimpleAdmin/systemDict.ts +++ /dev/null @@ -1,78 +0,0 @@ -// @ts-ignore -/* eslint-disable */ -import request from '@/utils/request'; - -/** 添加字典 POST /sys/ops/dict/add */ -export async function sysOpsDictAddPost( - body: API.DictAddInput, - options?: { [key: string]: any } -) { - return request(`api/sys/ops/dict/add`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 删除字典 POST /sys/ops/dict/delete */ -export async function sysOpsDictDeletePost( - body: API.DictDeleteInput, - options?: { [key: string]: any } -) { - return request(`api/sys/ops/dict/delete`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 修改字典 POST /sys/ops/dict/edit */ -export async function sysOpsDictEditPost( - body: API.DictEditInput, - options?: { [key: string]: any } -) { - return request(`api/sys/ops/dict/edit`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 字典分页查询 GET /sys/ops/dict/page */ -export async function sysOpsDictPageGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysOpsDictPageGetParams, - options?: { [key: string]: any } -) { - return request(`api/sys/ops/dict/page`, { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - }); -} - -/** 获取字典树 GET /sys/ops/dict/tree */ -export async function sysOpsDictTreeGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysOpsDictTreeGetParams, - options?: { [key: string]: any } -) { - return request(`api/sys/ops/dict/tree`, { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - }); -} diff --git a/src/api/SimpleAdmin/systemHome.ts b/src/api/SimpleAdmin/systemHome.ts deleted file mode 100644 index 78f348a..0000000 --- a/src/api/SimpleAdmin/systemHome.ts +++ /dev/null @@ -1,74 +0,0 @@ -// @ts-ignore -/* eslint-disable */ -import request from '@/utils/request'; - -/** 获取当前用户站内信列表 GET /home/index/message/list */ -export async function homeIndexMessageListGet(options?: { - [key: string]: any; -}) { - return request(`api/home/index/message/list`, { - method: 'GET', - ...(options || {}), - }); -} - -/** 获取当前用户操作日志列表 GET /home/index/opLog/list */ -export async function homeIndexOpLogListGet(options?: { [key: string]: any }) { - return request(`api/home/index/opLog/list`, { - method: 'GET', - ...(options || {}), - }); -} - -/** 添加日程 POST /home/index/schedule/add */ -export async function homeIndexScheduleAddPost( - body: API.ScheduleAddInput, - options?: { [key: string]: any } -) { - return request(`api/home/index/schedule/add`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 删除日程 POST /home/index/schedule/deleteSchedule */ -export async function homeIndexScheduleDeleteSchedulePost( - body: API.BaseIdListInput, - options?: { [key: string]: any } -) { - return request(`api/home/index/schedule/deleteSchedule`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 获取当前用户日程列表 GET /home/index/schedule/list */ -export async function homeIndexScheduleListGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.homeIndexScheduleListGetParams, - options?: { [key: string]: any } -) { - return request(`api/home/index/schedule/list`, { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - }); -} - -/** 获取当前用户访问日志列表 GET /home/index/visLog/list */ -export async function homeIndexVisLogListGet(options?: { [key: string]: any }) { - return request(`api/home/index/visLog/list`, { - method: 'GET', - ...(options || {}), - }); -} diff --git a/src/api/SimpleAdmin/typings.d.ts b/src/api/SimpleAdmin/typings.d.ts deleted file mode 100644 index 410cf0f..0000000 --- a/src/api/SimpleAdmin/typings.d.ts +++ /dev/null @@ -1,2900 +0,0 @@ -declare namespace API { - type AuthDeviceTypeEnum = 'PC' | 'APP' | 'MINI'; - - type BaseIdInput = { - /** 主键Id */ - id?: number; - }; - - type BaseIdListInput = { - /** 主键Id列表 */ - ids?: number[]; - }; - - type BatchEditAddInput = { - /** 唯一编码 */ - code: string; - /** 所属库 */ - configId: string; - /** 实体名 */ - entityName: string; - /** 表名 */ - tableName: string; - /** 表描述 */ - tableDescription?: string; - }; - - type BatchEditColumn = { - tableColumn: string; - columnValue: any; - }; - - type BatchEditConfigInput = { - /** 拓展信息 */ - extJson?: string; - /** 批量配置Id */ - uId?: number; - /** 字段名 */ - columnName?: string; - /** 字段描述 */ - columnComment?: string; - /** 作用类型 */ - dataType?: string; - /** 字典值 */ - dictTypeCode?: string; - /** 数据库类型 */ - netType?: string; - /** 接口名称 */ - requestUrl?: string; - /** 接口类型 */ - requestType?: string; - /** 接口结果标签 */ - requestLabel?: string; - /** 接口结果值 */ - requestValue?: string; - /** 启用状态 */ - status?: string; - /** Id */ - id?: number; - }; - - type BatchEditInput = { - /** 批量编辑Code */ - code: string; - /** Id列表 */ - ids: number[]; - /** 字段列表 */ - columns: BatchEditColumn[]; - }; - - type bizOrganizationRoleDetailGetParams = { - /** 主键Id */ - Id?: number; - }; - - type bizOrganizationRoleOwnResourceGetParams = { - /** 主键Id */ - Id?: number; - }; - - type bizOrganizationRoleOwnUserGetParams = { - /** 主键Id */ - Id?: number; - }; - - type bizOrganizationRolePageGetParams = { - /** 组织ID */ - OrgId?: number; - /** 职位列表 */ - OrgIds?: number[]; - /** 分类 */ - Category?: string; - /** 状态 */ - Status?: string; - /** 当前页码 */ - PageNum?: number; - /** 每页条数 */ - PageSize?: number; - /** 排序字段 */ - SortField?: string; - /** 排序方式,升序:ascend;降序:descend" */ - SortOrder?: string; - /** 关键字 */ - SearchKey?: string; - }; - - type bizOrganizationRoleRoleSelectorGetParams = { - /** 组织ID */ - OrgId?: number; - /** 机构ID列表 */ - OrgIds?: number[]; - /** 角色名称 */ - Name?: string; - /** 当前页码 */ - PageNum?: number; - /** 每页条数 */ - PageSize?: number; - /** 排序字段 */ - SortField?: string; - /** 排序方式,升序:ascend;降序:descend" */ - SortOrder?: string; - /** 关键字 */ - SearchKey?: string; - }; - - type bizOrganizationRoleTreeGetParams = { - /** 机构ID列表 */ - OrgIds?: number[]; - }; - - type ButtonAddInput = { - /** 主键Id */ - id?: number; - /** 拓展信息 */ - extJson?: string; - status?: string; - /** 创建时间 */ - createTime?: string; - /** 更新时间 */ - updateTime?: string; - /** 创建者Id */ - createUserId?: number; - /** 修改者Id */ - updateUserId?: number; - /** 创建人 */ - createUser?: string; - /** 更新人 */ - updateUser?: string; - /** 软删除 */ - isDelete?: boolean; - /** 别名 */ - name?: string; - /** 描述 */ - description?: string; - /** 分类 */ - category?: string; - /** 模块 */ - module?: number; - /** 菜单类型 */ - menuType?: string; - /** 路径 */ - path?: string; - /** 组件 */ - component?: string; - /** 图标 */ - icon?: string; - /** 是否在菜单中隐藏, 需要高亮的 path (通常用作详情页高亮父级菜单) */ - activeMenu?: string; - /** 是否在菜单中隐藏 (通常列表详情页需要隐藏) */ - isHide?: boolean; - /** 是否在菜单中隐藏 (通常列表详情页需要隐藏) */ - isFull?: boolean; - /** 菜单是否固定在标签页中 (首页通常是固定项) */ - isAffix?: boolean; - /** 菜单是否固定在标签页中 (首页通常是固定项) */ - isKeepAlive?: boolean; - /** 是否为首页 */ - isHome?: boolean; - /** 排序码 */ - sortCode?: number; - /** 外链地址 */ - isLink?: string; - meta?: Meta; - /** 子节点 */ - children?: SysResource[]; - /** 父ID */ - parentId: number; - /** 标题 */ - title: string; - /** 编码 */ - code: string; - }; - - type ButtonEditInput = { - /** 拓展信息 */ - extJson?: string; - status?: string; - /** 创建时间 */ - createTime?: string; - /** 更新时间 */ - updateTime?: string; - /** 创建者Id */ - createUserId?: number; - /** 修改者Id */ - updateUserId?: number; - /** 创建人 */ - createUser?: string; - /** 更新人 */ - updateUser?: string; - /** 软删除 */ - isDelete?: boolean; - /** 别名 */ - name?: string; - /** 描述 */ - description?: string; - /** 分类 */ - category?: string; - /** 模块 */ - module?: number; - /** 菜单类型 */ - menuType?: string; - /** 路径 */ - path?: string; - /** 组件 */ - component?: string; - /** 图标 */ - icon?: string; - /** 是否在菜单中隐藏, 需要高亮的 path (通常用作详情页高亮父级菜单) */ - activeMenu?: string; - /** 是否在菜单中隐藏 (通常列表详情页需要隐藏) */ - isHide?: boolean; - /** 是否在菜单中隐藏 (通常列表详情页需要隐藏) */ - isFull?: boolean; - /** 菜单是否固定在标签页中 (首页通常是固定项) */ - isAffix?: boolean; - /** 菜单是否固定在标签页中 (首页通常是固定项) */ - isKeepAlive?: boolean; - /** 是否为首页 */ - isHome?: boolean; - /** 排序码 */ - sortCode?: number; - /** 外链地址 */ - isLink?: string; - meta?: Meta; - /** 子节点 */ - children?: SysResource[]; - /** 父ID */ - parentId: number; - /** 标题 */ - title: string; - /** 编码 */ - code: string; - /** ID */ - id?: number; - }; - - type ConfigAddInput = { - /** 主键Id */ - id?: number; - /** 拓展信息 */ - extJson?: string; - status?: string; - /** 创建时间 */ - createTime?: string; - /** 更新时间 */ - updateTime?: string; - /** 创建者Id */ - createUserId?: number; - /** 修改者Id */ - updateUserId?: number; - /** 创建人 */ - createUser?: string; - /** 更新人 */ - updateUser?: string; - /** 软删除 */ - isDelete?: boolean; - /** 分类 */ - category?: string; - /** 备注 */ - remark?: string; - /** 排序码 */ - sortCode?: number; - /** 配置键 */ - configKey: string; - /** 配置值 */ - configValue: string; - }; - - type ConfigDeleteInput = { - /** 主键Id */ - id?: number; - }; - - type ConfigEditInput = { - /** 拓展信息 */ - extJson?: string; - status?: string; - /** 创建时间 */ - createTime?: string; - /** 更新时间 */ - updateTime?: string; - /** 创建者Id */ - createUserId?: number; - /** 修改者Id */ - updateUserId?: number; - /** 创建人 */ - createUser?: string; - /** 更新人 */ - updateUser?: string; - /** 软删除 */ - isDelete?: boolean; - /** 分类 */ - category?: string; - /** 备注 */ - remark?: string; - /** 排序码 */ - sortCode?: number; - /** 配置键 */ - configKey: string; - /** 配置值 */ - configValue: string; - /** ID */ - id?: number; - }; - - type DataScope = { - /** API接口 */ - apiUrl?: string; - /** 数据范围分类 */ - scopeCategory?: string; - /** 数据范围的机构ID列表 */ - dataScopes?: number[]; - }; - - type DefaultDataScope = { - /** 数据范围等级 */ - level?: number; - /** 数据范围 */ - scopeCategory?: string; - /** 自定义机构范围列表 */ - scopeDefineOrgIdList?: number[]; - }; - - type DictAddInput = { - /** 主键Id */ - id?: number; - /** 拓展信息 */ - extJson?: string; - status?: string; - /** 创建时间 */ - createTime?: string; - /** 更新时间 */ - updateTime?: string; - /** 创建者Id */ - createUserId?: number; - /** 修改者Id */ - updateUserId?: number; - /** 创建人 */ - createUser?: string; - /** 更新人 */ - updateUser?: string; - /** 软删除 */ - isDelete?: boolean; - /** 分类 */ - category?: string; - /** 排序码 */ - sortCode?: number; - /** 子节点 */ - children?: SysDict[]; - /** 父ID */ - parentId?: number; - /** 字典名称 */ - dictLabel: string; - /** 字典值 */ - dictValue: string; - }; - - type DictDeleteInput = { - /** 主键Id列表 */ - ids?: number[]; - }; - - type DictEditInput = { - /** 拓展信息 */ - extJson?: string; - status?: string; - /** 创建时间 */ - createTime?: string; - /** 更新时间 */ - updateTime?: string; - /** 创建者Id */ - createUserId?: number; - /** 修改者Id */ - updateUserId?: number; - /** 创建人 */ - createUser?: string; - /** 更新人 */ - updateUser?: string; - /** 软删除 */ - isDelete?: boolean; - /** 分类 */ - category?: string; - /** 排序码 */ - sortCode?: number; - /** 子节点 */ - children?: SysDict[]; - /** 父ID */ - parentId?: number; - /** 字典名称 */ - dictLabel: string; - /** 字典值 */ - dictValue: string; - /** ID */ - id?: number; - }; - - type ExecGenInput = { - /** 主键Id */ - id?: number; - /** 生成类型 */ - execType?: string; - }; - - type ExitTokenInput = { - /** 主键Id */ - id?: number; - /** token */ - tokens: string[]; - }; - - type ExpressionableSysUser = true; - - type GenBasicAddInput = { - /** 主键Id */ - id?: number; - /** 拓展信息 */ - extJson?: string; - status?: string; - /** 创建时间 */ - createTime?: string; - /** 更新时间 */ - updateTime?: string; - /** 创建者Id */ - createUserId?: number; - /** 修改者Id */ - updateUserId?: number; - /** 创建人 */ - createUser?: string; - /** 更新人 */ - updateUser?: string; - /** 软删除 */ - isDelete?: boolean; - /** 功能列表 */ - functions?: string; - /** 树Id字段 */ - treeId?: string; - /** 树父Id字段 */ - treePid?: string; - /** 树名称字段 */ - treeName?: string; - /** 关联子表名 */ - childTable?: string; - /** 关联子表外键 */ - childFk?: string; - /** 上级目录 */ - menuPid?: number; - /** 功能名后缀 */ - functionNameSuffix?: string; - /** 服务代码存放文件夹 */ - serviceDictionary?: string; - /** 控制器代码存放文件夹 */ - controllerDictionary?: string; - /** 所属库名称 */ - configId: string; - /** 主表名称 */ - dbTable: string; - /** 功能列表 */ - funcList: string[]; - /** 生成模版 */ - moduleType: string; - /** 数据权限 */ - dataPermission: string; - /** 实体名称 */ - entityName: string; - /** 表前缀移除 */ - tablePrefix: string; - /** 生成方式 */ - generateType: string; - /** 所属模块 */ - module?: number; - /** 路由名 */ - routeName: string; - /** 图标 */ - icon: string; - /** 功能名 */ - functionName: string; - /** 业务名 */ - busName: string; - /** 类名 */ - className: string; - /** 表单布局 */ - formLayout: string; - /** 使用栅格 */ - gridWhether: string; - /** 左侧树 */ - leftTree: string; - /** 前端路径 */ - frontedPath: string; - /** 服务层 */ - servicePosition: string; - /** 控制器层 */ - controllerPosition: string; - /** 排序 */ - sortCode: number; - /** 作者名 */ - authorName: string; - }; - - type GenBasicEditInput = { - /** 拓展信息 */ - extJson?: string; - status?: string; - /** 创建时间 */ - createTime?: string; - /** 更新时间 */ - updateTime?: string; - /** 创建者Id */ - createUserId?: number; - /** 修改者Id */ - updateUserId?: number; - /** 创建人 */ - createUser?: string; - /** 更新人 */ - updateUser?: string; - /** 软删除 */ - isDelete?: boolean; - /** 功能列表 */ - functions?: string; - /** 树Id字段 */ - treeId?: string; - /** 树父Id字段 */ - treePid?: string; - /** 树名称字段 */ - treeName?: string; - /** 关联子表名 */ - childTable?: string; - /** 关联子表外键 */ - childFk?: string; - /** 上级目录 */ - menuPid?: number; - /** 功能名后缀 */ - functionNameSuffix?: string; - /** 服务代码存放文件夹 */ - serviceDictionary?: string; - /** 控制器代码存放文件夹 */ - controllerDictionary?: string; - /** 所属库名称 */ - configId: string; - /** 主表名称 */ - dbTable: string; - /** 功能列表 */ - funcList: string[]; - /** 生成模版 */ - moduleType: string; - /** 数据权限 */ - dataPermission: string; - /** 实体名称 */ - entityName: string; - /** 表前缀移除 */ - tablePrefix: string; - /** 生成方式 */ - generateType: string; - /** 所属模块 */ - module?: number; - /** 路由名 */ - routeName: string; - /** 图标 */ - icon: string; - /** 功能名 */ - functionName: string; - /** 业务名 */ - busName: string; - /** 类名 */ - className: string; - /** 表单布局 */ - formLayout: string; - /** 使用栅格 */ - gridWhether: string; - /** 左侧树 */ - leftTree: string; - /** 前端路径 */ - frontedPath: string; - /** 服务层 */ - servicePosition: string; - /** 控制器层 */ - controllerPosition: string; - /** 排序 */ - sortCode: number; - /** 作者名 */ - authorName: string; - id?: number; - }; - - type GenConfig = { - /** 主键Id */ - id?: number; - /** 拓展信息 */ - extJson?: string; - status?: string; - /** 创建时间 */ - createTime?: string; - /** 更新时间 */ - updateTime?: string; - /** 创建者Id */ - createUserId?: number; - /** 修改者Id */ - updateUserId?: number; - /** 创建人 */ - createUser?: string; - /** 更新人 */ - updateUser?: string; - /** 软删除 */ - isDelete?: boolean; - /** 基础ID */ - basicId?: number; - /** 字段排序 */ - fieldIndex?: number; - /** 是否主键 */ - isPrimaryKey?: string; - /** 字段 */ - fieldName?: string; - /** 名称 */ - fieldRemark?: string; - /** 类型 */ - fieldType?: string; - /** 实体类型 */ - fieldNetType?: string; - /** 作用类型 */ - effectType?: string; - /** 外键显示字段 */ - fkEntityName?: string; - /** 外键ID */ - fkColumnId?: string; - /** 外键显示字段 */ - fkColumnName?: string; - /** 字典 */ - dictTypeCode?: string; - /** 列宽度 */ - width?: number; - /** 列表显示 */ - whetherTable?: string; - /** 列省略 */ - whetherRetract?: string; - /** 可伸缩列 */ - whetherResizable?: string; - /** 是否增改 */ - whetherAddUpdate?: string; - /** 是否导入导出 */ - whetherImportExport?: string; - /** 必填 */ - whetherRequired?: string; - /** 查询 */ - queryWhether?: string; - /** 查询方式 */ - queryType?: string; - /** 排序 */ - sortCode?: number; - /** 字段名首字母小写 */ - fieldNameFirstLower?: string; - /** 字段名首字母大写 */ - fieldNameFirstUpper?: string; - }; - - type GrantPermissionInput = { - /** 角色Id */ - id?: number; - /** 授权权限信息 */ - grantInfoList: RelationRolePermission[]; - }; - - type GrantResourceInput = { - /** 角色Id */ - id?: number; - /** 授权资源信息 */ - grantInfoList: RelationRoleResource[]; - /** 是否代码生成 */ - isCodeGen?: boolean; - }; - - type GrantUserInput = { - /** Id */ - id?: number; - /** 授权权限信息 */ - grantInfoList: number[]; - }; - - type homeIndexScheduleListGetParams = { - /** 日程日期 */ - ScheduleDate: string; - }; - - type IActionResult = true; - - type ImportResultInputSysUserImportInput = { - /** 数据 */ - data?: SysUserImportInput[]; - }; - - type LoginByPhoneInput = { - /** 验证码 */ - validCode?: string; - /** 请求号 */ - validCodeReqNo?: string; - /** 手机号 */ - phone: string; - device?: AuthDeviceTypeEnum; - /** 租户ID */ - tenantId?: number; - }; - - type LoginInput = { - /** 验证码 */ - validCode?: string; - /** 请求号 */ - validCodeReqNo?: string; - /** 账号 */ - account: string; - /** 密码 */ - password: string; - device?: AuthDeviceTypeEnum; - /** 租户ID */ - tenantId?: number; - }; - - type LoginOutInput = { - /** token */ - token?: string; - }; - - type MenuAddInput = { - /** 主键Id */ - id?: number; - /** 拓展信息 */ - extJson?: string; - status?: string; - /** 创建时间 */ - createTime?: string; - /** 更新时间 */ - updateTime?: string; - /** 创建者Id */ - createUserId?: number; - /** 修改者Id */ - updateUserId?: number; - /** 创建人 */ - createUser?: string; - /** 更新人 */ - updateUser?: string; - /** 软删除 */ - isDelete?: boolean; - /** 别名 */ - name?: string; - /** 描述 */ - description?: string; - /** 编码 */ - code?: string; - /** 分类 */ - category?: string; - /** 组件 */ - component?: string; - /** 是否在菜单中隐藏, 需要高亮的 path (通常用作详情页高亮父级菜单) */ - activeMenu?: string; - /** 是否在菜单中隐藏 (通常列表详情页需要隐藏) */ - isHide?: boolean; - /** 是否在菜单中隐藏 (通常列表详情页需要隐藏) */ - isFull?: boolean; - /** 菜单是否固定在标签页中 (首页通常是固定项) */ - isAffix?: boolean; - /** 菜单是否固定在标签页中 (首页通常是固定项) */ - isKeepAlive?: boolean; - /** 是否为首页 */ - isHome?: boolean; - /** 排序码 */ - sortCode?: number; - /** 外链地址 */ - isLink?: string; - meta?: Meta; - /** 子节点 */ - children?: SysResource[]; - /** 父ID */ - parentId: number; - /** 标题 */ - title: string; - /** 菜单类型 */ - menuType?: string; - /** 模块 */ - module: number; - /** 路径 */ - path: string; - /** 图标 */ - icon: string; - }; - - type MenuChangeModuleInput = { - /** 主键Id */ - id?: number; - /** 模块ID */ - module: number; - }; - - type MenuEditInput = { - /** 拓展信息 */ - extJson?: string; - status?: string; - /** 创建时间 */ - createTime?: string; - /** 更新时间 */ - updateTime?: string; - /** 创建者Id */ - createUserId?: number; - /** 修改者Id */ - updateUserId?: number; - /** 创建人 */ - createUser?: string; - /** 更新人 */ - updateUser?: string; - /** 软删除 */ - isDelete?: boolean; - /** 别名 */ - name?: string; - /** 描述 */ - description?: string; - /** 编码 */ - code?: string; - /** 分类 */ - category?: string; - /** 组件 */ - component?: string; - /** 是否在菜单中隐藏, 需要高亮的 path (通常用作详情页高亮父级菜单) */ - activeMenu?: string; - /** 是否在菜单中隐藏 (通常列表详情页需要隐藏) */ - isHide?: boolean; - /** 是否在菜单中隐藏 (通常列表详情页需要隐藏) */ - isFull?: boolean; - /** 菜单是否固定在标签页中 (首页通常是固定项) */ - isAffix?: boolean; - /** 菜单是否固定在标签页中 (首页通常是固定项) */ - isKeepAlive?: boolean; - /** 是否为首页 */ - isHome?: boolean; - /** 排序码 */ - sortCode?: number; - /** 外链地址 */ - isLink?: string; - meta?: Meta; - /** 子节点 */ - children?: SysResource[]; - /** 父ID */ - parentId: number; - /** 标题 */ - title: string; - /** 菜单类型 */ - menuType?: string; - /** 模块 */ - module: number; - /** 路径 */ - path: string; - /** 图标 */ - icon: string; - /** ID */ - id?: number; - }; - - type MessageReadInput = { - /** 分类 */ - category?: string; - /** 用户Id */ - id?: number; - /** 消息Id */ - ids?: number[]; - }; - - type MessageSendInput = { - /** 主键Id */ - id?: number; - /** 拓展信息 */ - extJson?: string; - /** 创建时间 */ - createTime?: string; - /** 更新时间 */ - updateTime?: string; - /** 创建者Id */ - createUserId?: number; - /** 修改者Id */ - updateUserId?: number; - /** 创建人 */ - createUser?: string; - /** 更新人 */ - updateUser?: string; - /** 软删除 */ - isDelete?: boolean; - /** 接收人类型 */ - receiverType?: string; - /** 接收人列表 */ - receiverInfo?: ReceiverInfo[]; - /** 发送方式 */ - sendWay?: string; - /** 发送时间 */ - sendTime?: string; - /** 正文 */ - content?: string; - /** 延迟时间(秒) */ - delayTime?: number; - /** 已读情况 */ - receiverDetail?: ReceiverDetail[]; - /** 发送时间格式化 */ - sendTimeFormat?: string; - /** 分组查询用 */ - index2?: number; - /** 是否已读 */ - read?: boolean; - /** 主题 */ - subject: string; - /** 分类 */ - category: string; - /** 接收人Id */ - receiverIdList?: number[]; - status?: string; - }; - - type MessageSendUpdateInput = { - /** 拓展信息 */ - extJson?: string; - /** 创建时间 */ - createTime?: string; - /** 更新时间 */ - updateTime?: string; - /** 创建者Id */ - createUserId?: number; - /** 修改者Id */ - updateUserId?: number; - /** 创建人 */ - createUser?: string; - /** 更新人 */ - updateUser?: string; - /** 软删除 */ - isDelete?: boolean; - /** 接收人类型 */ - receiverType?: string; - /** 接收人列表 */ - receiverInfo?: ReceiverInfo[]; - /** 发送方式 */ - sendWay?: string; - /** 发送时间 */ - sendTime?: string; - /** 正文 */ - content?: string; - /** 延迟时间(秒) */ - delayTime?: number; - /** 已读情况 */ - receiverDetail?: ReceiverDetail[]; - /** 发送时间格式化 */ - sendTimeFormat?: string; - /** 分组查询用 */ - index2?: number; - /** 是否已读 */ - read?: boolean; - /** 主题 */ - subject: string; - /** 分类 */ - category: string; - /** 接收人Id */ - receiverIdList?: number[]; - status?: string; - /** 消息Id */ - id: number; - }; - - type Meta = { - /** 图标 */ - icon?: string; - /** 标题 */ - title?: string; - /** 是否在菜单中隐藏, 需要高亮的 path (通常用作详情页高亮父级菜单) */ - activeMenu?: string; - /** 是否在菜单中隐藏 (通常列表详情页需要隐藏) */ - isHide?: boolean; - /** 路由外链时填写的访问地址 */ - isLink?: string; - /** 是否在菜单中隐藏 (通常列表详情页需要隐藏) */ - isFull?: boolean; - /** 菜单是否固定在标签页中 (首页通常是固定项) */ - isAffix?: boolean; - /** 菜单是否固定在标签页中 (首页通常是固定项) */ - isKeepAlive?: boolean; - }; - - type ModuleAddInput = { - /** 主键Id */ - id?: number; - /** 拓展信息 */ - extJson?: string; - status?: string; - /** 创建时间 */ - createTime?: string; - /** 更新时间 */ - updateTime?: string; - /** 创建者Id */ - createUserId?: number; - /** 修改者Id */ - updateUserId?: number; - /** 创建人 */ - createUser?: string; - /** 更新人 */ - updateUser?: string; - /** 软删除 */ - isDelete?: boolean; - /** 父id */ - parentId?: number; - /** 标题 */ - title?: string; - /** 别名 */ - name?: string; - /** 描述 */ - description?: string; - /** 编码 */ - code?: string; - /** 分类 */ - category?: string; - /** 模块 */ - module?: number; - /** 菜单类型 */ - menuType?: string; - /** 路径 */ - path?: string; - /** 组件 */ - component?: string; - /** 图标 */ - icon?: string; - /** 是否在菜单中隐藏, 需要高亮的 path (通常用作详情页高亮父级菜单) */ - activeMenu?: string; - /** 是否在菜单中隐藏 (通常列表详情页需要隐藏) */ - isHide?: boolean; - /** 是否在菜单中隐藏 (通常列表详情页需要隐藏) */ - isFull?: boolean; - /** 菜单是否固定在标签页中 (首页通常是固定项) */ - isAffix?: boolean; - /** 菜单是否固定在标签页中 (首页通常是固定项) */ - isKeepAlive?: boolean; - /** 是否为首页 */ - isHome?: boolean; - /** 排序码 */ - sortCode?: number; - /** 外链地址 */ - isLink?: string; - meta?: Meta; - /** 子节点 */ - children?: SysResource[]; - }; - - type ModuleEditInput = { - /** 拓展信息 */ - extJson?: string; - status?: string; - /** 创建时间 */ - createTime?: string; - /** 更新时间 */ - updateTime?: string; - /** 创建者Id */ - createUserId?: number; - /** 修改者Id */ - updateUserId?: number; - /** 创建人 */ - createUser?: string; - /** 更新人 */ - updateUser?: string; - /** 软删除 */ - isDelete?: boolean; - /** 父id */ - parentId?: number; - /** 标题 */ - title?: string; - /** 别名 */ - name?: string; - /** 描述 */ - description?: string; - /** 编码 */ - code?: string; - /** 分类 */ - category?: string; - /** 模块 */ - module?: number; - /** 菜单类型 */ - menuType?: string; - /** 路径 */ - path?: string; - /** 组件 */ - component?: string; - /** 图标 */ - icon?: string; - /** 是否在菜单中隐藏, 需要高亮的 path (通常用作详情页高亮父级菜单) */ - activeMenu?: string; - /** 是否在菜单中隐藏 (通常列表详情页需要隐藏) */ - isHide?: boolean; - /** 是否在菜单中隐藏 (通常列表详情页需要隐藏) */ - isFull?: boolean; - /** 菜单是否固定在标签页中 (首页通常是固定项) */ - isAffix?: boolean; - /** 菜单是否固定在标签页中 (首页通常是固定项) */ - isKeepAlive?: boolean; - /** 是否为首页 */ - isHome?: boolean; - /** 排序码 */ - sortCode?: number; - /** 外链地址 */ - isLink?: string; - meta?: Meta; - /** 子节点 */ - children?: SysResource[]; - /** ID */ - id?: number; - }; - - type MqttAuthInput = { - /** 用户ID */ - userId?: string; - /** 账号 */ - username?: string; - /** 密码 */ - password?: string; - /** 客户端ID */ - clientId?: string; - }; - - type OperateLogDeleteInput = { - /** 分类 */ - category?: string; - }; - - type PositionAddInput = { - /** 主键Id */ - id?: number; - /** 拓展信息 */ - extJson?: string; - status?: string; - /** 创建时间 */ - createTime?: string; - /** 更新时间 */ - updateTime?: string; - /** 创建者Id */ - createUserId?: number; - /** 修改者Id */ - updateUserId?: number; - /** 创建人 */ - createUser?: string; - /** 更新人 */ - updateUser?: string; - /** 软删除 */ - isDelete?: boolean; - /** 创建者部门Id */ - createOrgId?: number; - /** 编码 */ - code?: string; - /** 排序码 */ - sortCode?: number; - /** 组织ID */ - orgId?: number; - /** 名称 */ - name: string; - /** 分类 */ - category: string; - }; - - type PositionEditInput = { - /** 拓展信息 */ - extJson?: string; - status?: string; - /** 创建时间 */ - createTime?: string; - /** 更新时间 */ - updateTime?: string; - /** 创建者Id */ - createUserId?: number; - /** 修改者Id */ - updateUserId?: number; - /** 创建人 */ - createUser?: string; - /** 更新人 */ - updateUser?: string; - /** 软删除 */ - isDelete?: boolean; - /** 创建者部门Id */ - createOrgId?: number; - /** 编码 */ - code?: string; - /** 排序码 */ - sortCode?: number; - /** 组织ID */ - orgId?: number; - /** 名称 */ - name: string; - /** 分类 */ - category: string; - /** Id */ - id?: number; - }; - - type ReceiverDetail = { - /** ID */ - id?: number; - /** 名称 */ - name?: string; - /** 是否已读 */ - read?: boolean; - }; - - type ReceiverInfo = { - /** ID */ - id?: number; - /** 名称 */ - name?: string; - }; - - type RelationRolePermission = { - /** 数据范围 */ - scopeCategory?: string; - /** 自定义机构范围列表 */ - scopeDefineOrgIdList?: number[]; - /** 接口Url */ - apiUrl?: string; - }; - - type RelationRoleResource = { - /** 菜单ID */ - menuId?: number; - /** 按钮信息 */ - buttonInfo?: number[]; - }; - - type RoleAddInput = { - /** 主键Id */ - id?: number; - /** 拓展信息 */ - extJson?: string; - status?: string; - /** 创建时间 */ - createTime?: string; - /** 更新时间 */ - updateTime?: string; - /** 创建者Id */ - createUserId?: number; - /** 修改者Id */ - updateUserId?: number; - /** 创建人 */ - createUser?: string; - /** 更新人 */ - updateUser?: string; - /** 软删除 */ - isDelete?: boolean; - /** 创建者部门Id */ - createOrgId?: number; - /** 组织id */ - orgId?: number; - /** 编码 */ - code?: string; - /** 分类 */ - category?: string; - defaultDataScope?: DefaultDataScope; - /** 排序码 */ - sortCode?: number; - /** 用户列表 */ - userList?: UserSelectorOutPut[]; - /** 名称 */ - name: string; - }; - - type RoleEditInput = { - /** 拓展信息 */ - extJson?: string; - status?: string; - /** 创建时间 */ - createTime?: string; - /** 更新时间 */ - updateTime?: string; - /** 创建者Id */ - createUserId?: number; - /** 修改者Id */ - updateUserId?: number; - /** 创建人 */ - createUser?: string; - /** 更新人 */ - updateUser?: string; - /** 软删除 */ - isDelete?: boolean; - /** 创建者部门Id */ - createOrgId?: number; - /** 组织id */ - orgId?: number; - /** 编码 */ - code?: string; - /** 分类 */ - category?: string; - defaultDataScope?: DefaultDataScope; - /** 排序码 */ - sortCode?: number; - /** 用户列表 */ - userList?: UserSelectorOutPut[]; - /** 名称 */ - name: string; - /** Id */ - id?: number; - }; - - type ScheduleAddInput = { - /** 用户id */ - scheduleUserId?: number; - /** 用户姓名 */ - scheduleUserName?: string; - /** 日程日期 */ - scheduleDate: string; - /** 日程内容 */ - scheduleContent: string; - /** 日程时间 */ - scheduleTime: string; - }; - - type SetDefaultModuleInput = { - /** 模块Id */ - id: number; - /** 是否默认 */ - ifDefault: boolean; - }; - - type SimpleAdminResultIActionResult = { - /** 状态码 */ - code?: number; - /** 错误信息 */ - msg?: any; - data?: IActionResult; - /** 附加数据 */ - extras?: any; - /** 时间 */ - time?: string; - }; - - type SimpleAdminResultInt32 = { - /** 状态码 */ - code?: number; - /** 错误信息 */ - msg?: any; - /** 数据 */ - data?: number; - /** 附加数据 */ - extras?: any; - /** 时间 */ - time?: string; - }; - - type SimpleAdminResultInt64 = { - /** 状态码 */ - code?: number; - /** 错误信息 */ - msg?: any; - /** 数据 */ - data?: number; - /** 附加数据 */ - extras?: any; - /** 时间 */ - time?: string; - }; - - type SimpleAdminResultObject = { - /** 状态码 */ - code?: number; - /** 错误信息 */ - msg?: any; - /** 数据 */ - data?: any; - /** 附加数据 */ - extras?: any; - /** 时间 */ - time?: string; - }; - - type SpaAddInput = { - /** 主键Id */ - id?: number; - /** 拓展信息 */ - extJson?: string; - status?: string; - /** 创建时间 */ - createTime?: string; - /** 更新时间 */ - updateTime?: string; - /** 创建者Id */ - createUserId?: number; - /** 修改者Id */ - updateUserId?: number; - /** 创建人 */ - createUser?: string; - /** 更新人 */ - updateUser?: string; - /** 软删除 */ - isDelete?: boolean; - /** 父id */ - parentId?: number; - /** 别名 */ - name?: string; - /** 描述 */ - description?: string; - /** 编码 */ - code?: string; - /** 分类 */ - category?: string; - /** 模块 */ - module?: number; - /** 组件 */ - component?: string; - /** 是否在菜单中隐藏, 需要高亮的 path (通常用作详情页高亮父级菜单) */ - activeMenu?: string; - /** 是否在菜单中隐藏 (通常列表详情页需要隐藏) */ - isHide?: boolean; - /** 是否在菜单中隐藏 (通常列表详情页需要隐藏) */ - isFull?: boolean; - /** 菜单是否固定在标签页中 (首页通常是固定项) */ - isAffix?: boolean; - /** 菜单是否固定在标签页中 (首页通常是固定项) */ - isKeepAlive?: boolean; - /** 是否为首页 */ - isHome?: boolean; - /** 排序码 */ - sortCode?: number; - /** 外链地址 */ - isLink?: string; - meta?: Meta; - /** 子节点 */ - children?: SysResource[]; - /** 标题 */ - title: string; - /** 菜单类型 */ - menuType: string; - /** 路径 */ - path: string; - /** 图标 */ - icon: string; - }; - - type SpaEditInput = { - /** 拓展信息 */ - extJson?: string; - status?: string; - /** 创建时间 */ - createTime?: string; - /** 更新时间 */ - updateTime?: string; - /** 创建者Id */ - createUserId?: number; - /** 修改者Id */ - updateUserId?: number; - /** 创建人 */ - createUser?: string; - /** 更新人 */ - updateUser?: string; - /** 软删除 */ - isDelete?: boolean; - /** 父id */ - parentId?: number; - /** 别名 */ - name?: string; - /** 描述 */ - description?: string; - /** 编码 */ - code?: string; - /** 分类 */ - category?: string; - /** 模块 */ - module?: number; - /** 组件 */ - component?: string; - /** 是否在菜单中隐藏, 需要高亮的 path (通常用作详情页高亮父级菜单) */ - activeMenu?: string; - /** 是否在菜单中隐藏 (通常列表详情页需要隐藏) */ - isHide?: boolean; - /** 是否在菜单中隐藏 (通常列表详情页需要隐藏) */ - isFull?: boolean; - /** 菜单是否固定在标签页中 (首页通常是固定项) */ - isAffix?: boolean; - /** 菜单是否固定在标签页中 (首页通常是固定项) */ - isKeepAlive?: boolean; - /** 是否为首页 */ - isHome?: boolean; - /** 排序码 */ - sortCode?: number; - /** 外链地址 */ - isLink?: string; - meta?: Meta; - /** 子节点 */ - children?: SysResource[]; - /** 标题 */ - title: string; - /** 菜单类型 */ - menuType: string; - /** 路径 */ - path: string; - /** 图标 */ - icon: string; - /** ID */ - id?: number; - }; - - type sysAuditLogOperateDetailGetParams = { - /** 主键Id */ - Id?: number; - }; - - type sysAuditLogOperatePageGetParams = { - /** 分类 */ - Category?: string; - /** 账号 */ - Account?: string; - /** 当前页码 */ - PageNum?: number; - /** 每页条数 */ - PageSize?: number; - /** 排序字段 */ - SortField?: string; - /** 排序方式,升序:ascend;降序:descend" */ - SortOrder?: string; - /** 关键字 */ - SearchKey?: string; - }; - - type sysAuditLogVisitPageGetParams = { - /** 分类 */ - Category?: string; - /** 账号 */ - Account?: string; - /** 当前页码 */ - PageNum?: number; - /** 每页条数 */ - PageSize?: number; - /** 排序字段 */ - SortField?: string; - /** 排序方式,升序:ascend;降序:descend" */ - SortOrder?: string; - /** 关键字 */ - SearchKey?: string; - }; - - type sysAuthBGetPhoneValidCodeGetParams = { - /** 手机号 */ - Phone: string; - /** 验证码 */ - ValidCode?: string; - /** 请求号 */ - ValidCodeReqNo?: string; - }; - - type sysAuthSessionBPageGetParams = { - /** 账号 */ - Account?: string; - /** 姓名 */ - Name?: string; - /** 最新登录ip */ - LatestLoginIp?: string; - /** 当前页码 */ - PageNum?: number; - /** 每页条数 */ - PageSize?: number; - /** 排序字段 */ - SortField?: string; - /** 排序方式,升序:ascend;降序:descend" */ - SortOrder?: string; - /** 关键字 */ - SearchKey?: string; - }; - - type sysAuthSessionCPageGetParams = { - /** 账号 */ - Account?: string; - /** 姓名 */ - Name?: string; - /** 最新登录ip */ - LatestLoginIp?: string; - /** 当前页码 */ - PageNum?: number; - /** 每页条数 */ - PageSize?: number; - /** 排序字段 */ - SortField?: string; - /** 排序方式,升序:ascend;降序:descend" */ - SortOrder?: string; - /** 关键字 */ - SearchKey?: string; - }; - - type sysBatchColumnsGetParams = { - code?: string; - }; - - type sysBatchConfigsGetParams = { - /** 主键Id */ - Id?: number; - }; - - type sysBatchPageGetParams = { - /** 唯一编码 */ - Code?: string; - /** 所属库 */ - ConfigId?: string; - /** 实体名 */ - EntityName?: string; - /** 表名 */ - TableName?: string; - /** 当前页码 */ - PageNum?: number; - /** 每页条数 */ - PageSize?: number; - /** 排序字段 */ - SortField?: string; - /** 排序方式,升序:ascend;降序:descend" */ - SortOrder?: string; - /** 关键字 */ - SearchKey?: string; - }; - - type SysConfig = { - /** 主键Id */ - id?: number; - /** 拓展信息 */ - extJson?: string; - status?: string; - /** 创建时间 */ - createTime?: string; - /** 更新时间 */ - updateTime?: string; - /** 创建者Id */ - createUserId?: number; - /** 修改者Id */ - updateUserId?: number; - /** 创建人 */ - createUser?: string; - /** 更新人 */ - updateUser?: string; - /** 软删除 */ - isDelete?: boolean; - /** 配置键 */ - configKey?: string; - /** 配置值 */ - configValue?: string; - /** 分类 */ - category?: string; - /** 备注 */ - remark?: string; - /** 排序码 */ - sortCode?: number; - }; - - type sysCurdGenBasicExecGenZipGetParams = { - /** 生成类型 */ - ExecType?: string; - /** 主键Id */ - Id?: number; - }; - - type sysCurdGenBasicPageGetParams = { - /** 当前页码 */ - PageNum?: number; - /** 每页条数 */ - PageSize?: number; - /** 排序字段 */ - SortField?: string; - /** 排序方式,升序:ascend;降序:descend" */ - SortOrder?: string; - /** 关键字 */ - SearchKey?: string; - }; - - type sysCurdGenBasicPreviewGenGetParams = { - /** 主键Id */ - Id?: number; - }; - - type sysCurdGenBasicTablesGetParams = { - isAll?: boolean; - }; - - type sysCurdGenConfigListGetParams = { - basicId?: string; - }; - - type sysDevFileDownloadGetParams = { - /** 主键Id */ - Id?: number; - }; - - type sysDevFilePageGetParams = { - /** 文件引擎 */ - Engine?: string; - /** 当前页码 */ - PageNum?: number; - /** 每页条数 */ - PageSize?: number; - /** 排序字段 */ - SortField?: string; - /** 排序方式,升序:ascend;降序:descend" */ - SortOrder?: string; - /** 关键字 */ - SearchKey?: string; - }; - - type sysDevMessageDetailGetParams = { - /** 是否显示接收信息 */ - ShowReceiveInfo?: boolean; - /** 是否已读 */ - Read?: boolean; - /** 主键Id */ - Id?: number; - }; - - type sysDevMessagePageGetParams = { - /** 站内信分类 */ - Category?: string; - /** 当前页码 */ - PageNum?: number; - /** 每页条数 */ - PageSize?: number; - /** 排序字段 */ - SortField?: string; - /** 排序方式,升序:ascend;降序:descend" */ - SortOrder?: string; - /** 关键字 */ - SearchKey?: string; - }; - - type SysDict = { - /** 主键Id */ - id?: number; - /** 拓展信息 */ - extJson?: string; - status?: string; - /** 创建时间 */ - createTime?: string; - /** 更新时间 */ - updateTime?: string; - /** 创建者Id */ - createUserId?: number; - /** 修改者Id */ - updateUserId?: number; - /** 创建人 */ - createUser?: string; - /** 更新人 */ - updateUser?: string; - /** 软删除 */ - isDelete?: boolean; - /** 父id */ - parentId?: number; - /** 字典文字 */ - dictLabel?: string; - /** 字典值 */ - dictValue?: string; - /** 分类 */ - category?: string; - /** 排序码 */ - sortCode?: number; - /** 子节点 */ - children?: SysDict[]; - }; - - type sysLimitButtonDetailGetParams = { - /** 主键Id */ - Id?: number; - }; - - type sysLimitButtonPageGetParams = { - /** 父ID */ - ParentId: number; - /** 当前页码 */ - PageNum?: number; - /** 每页条数 */ - PageSize?: number; - /** 排序字段 */ - SortField?: string; - /** 排序方式,升序:ascend;降序:descend" */ - SortOrder?: string; - /** 关键字 */ - SearchKey?: string; - }; - - type sysLimitMenuDetailGetParams = { - /** 主键Id */ - Id?: number; - }; - - type sysLimitMenuMenuTreeSelectorGetParams = { - /** 模块 */ - Module?: number; - /** 关键字 */ - SearchKey?: string; - }; - - type sysLimitMenuTreeGetParams = { - /** 模块 */ - Module?: number; - /** 关键字 */ - SearchKey?: string; - }; - - type sysLimitModuleDetailGetParams = { - /** 主键Id */ - Id?: number; - }; - - type sysLimitModulePageGetParams = { - /** 当前页码 */ - PageNum?: number; - /** 每页条数 */ - PageSize?: number; - /** 排序字段 */ - SortField?: string; - /** 排序方式,升序:ascend;降序:descend" */ - SortOrder?: string; - /** 关键字 */ - SearchKey?: string; - }; - - type sysLimitRoleDetailGetParams = { - /** 主键Id */ - Id?: number; - }; - - type sysLimitRoleOwnPermissionGetParams = { - /** 主键Id */ - Id?: number; - }; - - type sysLimitRoleOwnResourceGetParams = { - /** 主键Id */ - Id?: number; - }; - - type sysLimitRoleOwnUserGetParams = { - /** 主键Id */ - Id?: number; - }; - - type sysLimitRolePageGetParams = { - /** 组织ID */ - OrgId?: number; - /** 职位列表 */ - OrgIds?: number[]; - /** 分类 */ - Category?: string; - /** 状态 */ - Status?: string; - /** 当前页码 */ - PageNum?: number; - /** 每页条数 */ - PageSize?: number; - /** 排序字段 */ - SortField?: string; - /** 排序方式,升序:ascend;降序:descend" */ - SortOrder?: string; - /** 关键字 */ - SearchKey?: string; - }; - - type sysLimitRolePermissionTreeSelectorGetParams = { - /** 主键Id */ - Id?: number; - }; - - type sysLimitRoleRoleSelectorGetParams = { - /** 组织ID */ - OrgId?: number; - /** 机构ID列表 */ - OrgIds?: number[]; - /** 角色名称 */ - Name?: string; - /** 当前页码 */ - PageNum?: number; - /** 每页条数 */ - PageSize?: number; - /** 排序字段 */ - SortField?: string; - /** 排序方式,升序:ascend;降序:descend" */ - SortOrder?: string; - /** 关键字 */ - SearchKey?: string; - }; - - type sysLimitRoleTreeGetParams = { - /** 机构ID列表 */ - OrgIds?: number[]; - }; - - type sysLimitSpaDetailGetParams = { - /** 主键Id */ - Id?: number; - }; - - type sysLimitSpaPageGetParams = { - /** 菜单类型 */ - MenuType?: string; - /** 当前页码 */ - PageNum?: number; - /** 每页条数 */ - PageSize?: number; - /** 排序字段 */ - SortField?: string; - /** 排序方式,升序:ascend;降序:descend" */ - SortOrder?: string; - /** 关键字 */ - SearchKey?: string; - }; - - type sysOpsConfigPageGetParams = { - /** 当前页码 */ - PageNum?: number; - /** 每页条数 */ - PageSize?: number; - /** 排序字段 */ - SortField?: string; - /** 排序方式,升序:ascend;降序:descend" */ - SortOrder?: string; - /** 关键字 */ - SearchKey?: string; - }; - - type sysOpsDictPageGetParams = { - /** 父id */ - ParentId?: number; - /** 分类 */ - Category?: string; - /** 当前页码 */ - PageNum?: number; - /** 每页条数 */ - PageSize?: number; - /** 排序字段 */ - SortField?: string; - /** 排序方式,升序:ascend;降序:descend" */ - SortOrder?: string; - /** 关键字 */ - SearchKey?: string; - }; - - type sysOpsDictTreeGetParams = { - /** 字典分类 */ - Category?: string; - }; - - type SysOrg = { - /** 主键Id */ - id?: number; - /** 拓展信息 */ - extJson?: string; - status?: string; - /** 创建时间 */ - createTime?: string; - /** 更新时间 */ - updateTime?: string; - /** 创建者Id */ - createUserId?: number; - /** 修改者Id */ - updateUserId?: number; - /** 创建人 */ - createUser?: string; - /** 更新人 */ - updateUser?: string; - /** 软删除 */ - isDelete?: boolean; - /** 父id */ - parentId?: number; - parentIdList?: number[]; - /** 主管ID */ - directorId?: number; - /** 名称 */ - name?: string; - /** 全称 */ - names?: string; - /** 编码 */ - code?: string; - /** 分类 */ - category?: string; - /** 排序码 */ - sortCode?: number; - directorInfo?: UserSelectorOutPut; - /** 子节点 */ - children?: SysOrg[]; - /** 设置为叶子节点(设置了loadData时有效) */ - leaf?: boolean; - }; - - type SysOrgAddInput = { - /** 主键Id */ - id?: number; - /** 拓展信息 */ - extJson?: string; - status?: string; - /** 创建时间 */ - createTime?: string; - /** 更新时间 */ - updateTime?: string; - /** 创建者Id */ - createUserId?: number; - /** 修改者Id */ - updateUserId?: number; - /** 创建人 */ - createUser?: string; - /** 更新人 */ - updateUser?: string; - /** 软删除 */ - isDelete?: boolean; - /** 父id */ - parentId?: number; - parentIdList?: number[]; - /** 主管ID */ - directorId?: number; - /** 名称 */ - name?: string; - /** 全称 */ - names?: string; - /** 编码 */ - code?: string; - /** 分类 */ - category?: string; - /** 排序码 */ - sortCode?: number; - directorInfo?: UserSelectorOutPut; - /** 子节点 */ - children?: SysOrg[]; - /** 设置为叶子节点(设置了loadData时有效) */ - leaf?: boolean; - }; - - type sysOrganizationOrgDetailGetParams = { - /** 主键Id */ - Id?: number; - }; - - type sysOrganizationOrgPageGetParams = { - /** 父ID */ - ParentId?: number; - /** 名称 */ - Name?: string; - /** 编码 */ - Code?: string; - /** 分类 */ - Category?: string; - /** 状态 */ - Status?: string; - /** 当前页码 */ - PageNum?: number; - /** 每页条数 */ - PageSize?: number; - /** 排序字段 */ - SortField?: string; - /** 排序方式,升序:ascend;降序:descend" */ - SortOrder?: string; - /** 关键字 */ - SearchKey?: string; - }; - - type sysOrganizationOrgSelectorGetParams = { - /** 组织ID */ - OrgId?: number; - /** 机构ID列表 */ - OrgIds?: number[]; - /** 机构ID */ - PositionId?: number; - /** 角色ID */ - RoleId?: number; - /** 关键字 */ - Account?: string; - /** 当前页码 */ - PageNum?: number; - /** 每页条数 */ - PageSize?: number; - /** 排序字段 */ - SortField?: string; - /** 排序方式,升序:ascend;降序:descend" */ - SortOrder?: string; - /** 关键字 */ - SearchKey?: string; - }; - - type sysOrganizationPositionDetailGetParams = { - /** 主键Id */ - Id?: number; - }; - - type sysOrganizationPositionPageGetParams = { - /** 组织ID */ - OrgId?: number; - /** 职位列表 */ - OrgIds?: number[]; - /** 分类 */ - Category?: string; - /** 状态 */ - Status?: string; - /** 当前页码 */ - PageNum?: number; - /** 每页条数 */ - PageSize?: number; - /** 排序字段 */ - SortField?: string; - /** 排序方式,升序:ascend;降序:descend" */ - SortOrder?: string; - /** 关键字 */ - SearchKey?: string; - }; - - type sysOrganizationPositionSelectorGetParams = { - /** 组织ID */ - OrgId?: number; - /** 机构ID列表 */ - OrgIds?: number[]; - /** 机构ID */ - PositionId?: number; - /** 角色ID */ - RoleId?: number; - /** 关键字 */ - Account?: string; - /** 当前页码 */ - PageNum?: number; - /** 每页条数 */ - PageSize?: number; - /** 排序字段 */ - SortField?: string; - /** 排序方式,升序:ascend;降序:descend" */ - SortOrder?: string; - /** 关键字 */ - SearchKey?: string; - }; - - type sysOrganizationPositionTreeGetParams = { - /** 机构ID列表 */ - OrgIds?: number[]; - }; - - type sysOrganizationUserDetailGetParams = { - /** 主键Id */ - Id?: number; - }; - - type sysOrganizationUserOwnPermissionGetParams = { - /** 主键Id */ - Id?: number; - }; - - type sysOrganizationUserOwnResourceGetParams = { - /** 主键Id */ - Id?: number; - }; - - type sysOrganizationUserOwnRoleGetParams = { - /** 主键Id */ - Id?: number; - }; - - type sysOrganizationUserPageGetParams = { - /** 所属组织 */ - OrgId?: number; - /** 动态查询条件 */ - Expression?: ExpressionableSysUser; - /** 用户状态 */ - Status?: string; - /** 当前页码 */ - PageNum?: number; - /** 每页条数 */ - PageSize?: number; - /** 排序字段 */ - SortField?: string; - /** 排序方式,升序:ascend;降序:descend" */ - SortOrder?: string; - /** 关键字 */ - SearchKey?: string; - }; - - type sysOrganizationUserPermissionTreeSelectorGetParams = { - /** 主键Id */ - Id?: number; - }; - - type sysOrganizationUserSelectorGetParams = { - /** 组织ID */ - OrgId?: number; - /** 机构ID列表 */ - OrgIds?: number[]; - /** 机构ID */ - PositionId?: number; - /** 角色ID */ - RoleId?: number; - /** 关键字 */ - Account?: string; - /** 当前页码 */ - PageNum?: number; - /** 每页条数 */ - PageSize?: number; - /** 排序字段 */ - SortField?: string; - /** 排序方式,升序:ascend;降序:descend" */ - SortOrder?: string; - /** 关键字 */ - SearchKey?: string; - }; - - type SysOrgCopyInput = { - /** 目标ID */ - targetId?: number; - /** 组织Id列表 */ - ids: number[]; - /** 是否包含下级 */ - containsChild?: boolean; - /** 是否包含职位 */ - containsPosition?: boolean; - }; - - type SysOrgEditInput = { - /** 拓展信息 */ - extJson?: string; - status?: string; - /** 创建时间 */ - createTime?: string; - /** 更新时间 */ - updateTime?: string; - /** 创建者Id */ - createUserId?: number; - /** 修改者Id */ - updateUserId?: number; - /** 创建人 */ - createUser?: string; - /** 更新人 */ - updateUser?: string; - /** 软删除 */ - isDelete?: boolean; - /** 父id */ - parentId?: number; - parentIdList?: number[]; - /** 主管ID */ - directorId?: number; - /** 名称 */ - name?: string; - /** 全称 */ - names?: string; - /** 编码 */ - code?: string; - /** 分类 */ - category?: string; - /** 排序码 */ - sortCode?: number; - directorInfo?: UserSelectorOutPut; - /** 子节点 */ - children?: SysOrg[]; - /** 设置为叶子节点(设置了loadData时有效) */ - leaf?: boolean; - /** Id */ - id?: number; - }; - - type SysResource = { - /** 主键Id */ - id?: number; - /** 拓展信息 */ - extJson?: string; - status?: string; - /** 创建时间 */ - createTime?: string; - /** 更新时间 */ - updateTime?: string; - /** 创建者Id */ - createUserId?: number; - /** 修改者Id */ - updateUserId?: number; - /** 创建人 */ - createUser?: string; - /** 更新人 */ - updateUser?: string; - /** 软删除 */ - isDelete?: boolean; - /** 父id */ - parentId?: number; - /** 标题 */ - title?: string; - /** 别名 */ - name?: string; - /** 描述 */ - description?: string; - /** 编码 */ - code?: string; - /** 分类 */ - category?: string; - /** 模块 */ - module?: number; - /** 菜单类型 */ - menuType?: string; - /** 路径 */ - path?: string; - /** 组件 */ - component?: string; - /** 图标 */ - icon?: string; - /** 是否在菜单中隐藏, 需要高亮的 path (通常用作详情页高亮父级菜单) */ - activeMenu?: string; - /** 是否在菜单中隐藏 (通常列表详情页需要隐藏) */ - isHide?: boolean; - /** 是否在菜单中隐藏 (通常列表详情页需要隐藏) */ - isFull?: boolean; - /** 菜单是否固定在标签页中 (首页通常是固定项) */ - isAffix?: boolean; - /** 菜单是否固定在标签页中 (首页通常是固定项) */ - isKeepAlive?: boolean; - /** 是否为首页 */ - isHome?: boolean; - /** 排序码 */ - sortCode?: number; - /** 外链地址 */ - isLink?: string; - meta?: Meta; - /** 子节点 */ - children?: SysResource[]; - }; - - type SysUserImportInput = { - /** Id */ - id?: number; - /** 是否有错误 */ - hasError?: boolean; - /** 错误详情 */ - errorInfo?: Record; - /** 账号 */ - account: string; - /** 姓名 */ - name: string; - /** 性别 */ - gender: string; - /** 昵称 */ - nickname?: string; - /** 手机 -这里使用了SM4自动加密解密 */ - phone?: string; - /** 邮箱 */ - email?: string; - /** 所属机构 */ - orgName: string; - /** 职位 */ - positionName: string; - /** 出生日期 */ - birthday?: string; - /** 民族 */ - nation?: string; - /** 籍贯 */ - nativePlace?: string; - /** 家庭住址 */ - homeAddress?: string; - /** 通信地址 */ - mailingAddress?: string; - /** 证件类型 */ - idCardType?: string; - /** 证件号码 */ - idCardNumber?: string; - /** 文化程度 */ - cultureLevel?: string; - /** 政治面貌 */ - politicalOutlook?: string; - /** 毕业院校 */ - college?: string; - /** 学历 */ - education?: string; - /** 学制 */ - eduLength?: string; - /** 学位 */ - degree?: string; - /** 家庭电话 */ - homeTel?: string; - /** 办公电话 */ - officeTel?: string; - /** 紧急联系人 */ - emergencyContact?: string; - /** 紧急联系人电话 */ - emergencyPhone?: string; - /** 紧急联系人地址 */ - emergencyAddress?: string; - /** 员工编号 */ - empNo?: string; - /** 入职日期 */ - entryDate?: string; - /** 部门Id */ - orgId?: number; - /** 职位Id */ - positionId?: number; - }; - - type UpdateInfoInput = { - /** 主键Id */ - id?: number; - /** 拓展信息 */ - extJson?: string; - status?: string; - /** 创建时间 */ - createTime?: string; - /** 更新时间 */ - updateTime?: string; - /** 创建者Id */ - createUserId?: number; - /** 修改者Id */ - updateUserId?: number; - /** 创建人 */ - createUser?: string; - /** 更新人 */ - updateUser?: string; - /** 软删除 */ - isDelete?: boolean; - userId?: number; - /** 头像 */ - avatar?: string; - /** 签名 */ - signature?: string; - /** 账号 */ - account?: string; - /** 密码 */ - password?: string; - /** 昵称 */ - nickname?: string; - /** 性别 */ - gender?: string; - /** 出生日期 */ - birthday?: string; - /** 民族 */ - nation?: string; - /** 籍贯 */ - nativePlace?: string; - /** 家庭住址 */ - homeAddress?: string; - /** 通信地址 */ - mailingAddress?: string; - /** 证件类型 */ - idCardType?: string; - /** 证件号码 */ - idCardNumber?: string; - /** 文化程度 */ - cultureLevel?: string; - /** 政治面貌 */ - politicalOutlook?: string; - /** 毕业院校 */ - college?: string; - /** 学历 */ - education?: string; - /** 学制 */ - eduLength?: string; - /** 学位 */ - degree?: string; - /** 手机 -这里使用了SM4自动加密解密 */ - phone?: string; - /** 邮箱 */ - email?: string; - /** 家庭电话 */ - homeTel?: string; - /** 办公电话 */ - officeTel?: string; - /** 紧急联系人 */ - emergencyContact?: string; - /** 紧急联系人电话 */ - emergencyPhone?: string; - /** 紧急联系人地址 */ - emergencyAddress?: string; - /** 员工编号 */ - empNo?: string; - /** 入职日期 */ - entryDate?: string; - /** 机构id */ - orgId?: number; - /** 职位id */ - positionId?: number; - /** 职级 */ - positionLevel?: string; - /** 主管id */ - directorId?: number; - /** 上次修改密码时间 */ - pwdRemindUpdateTime?: string; - /** 上次登录ip */ - lastLoginIp?: string; - /** 上次登录地点 */ - lastLoginAddress?: string; - /** 上次登录时间 */ - lastLoginTime?: string; - /** 上次登录设备 */ - lastLoginDevice?: string; - /** 最新登录ip */ - latestLoginIp?: string; - /** 最新登录地点 */ - latestLoginAddress?: string; - /** 最新登录时间 */ - latestLoginTime?: string; - /** 最新登录设备 */ - latestLoginDevice?: string; - /** 排序码 */ - sortCode?: number; - /** 默认模块 */ - defaultModule?: number; - /** 机构信息 */ - orgName?: string; - /** 机构信息全称 */ - orgNames?: string; - /** 职位信息 */ - positionName?: string; - /** 组织和机构ID列表,组织ID从上到下最后是职位 */ - orgAndPosIdList?: number[]; - directorInfo?: UserSelectorOutPut; - /** 按钮码集合 */ - buttonCodeList?: string[]; - /** 权限码集合 */ - permissionCodeList?: string[]; - /** 角色码集合 */ - roleCodeList?: string[]; - /** 角色ID集合 */ - roleIdList?: number[]; - /** 数据范围集合 */ - dataScopeList?: DataScope[]; - defaultDataScope?: DefaultDataScope; - /** 机构及以下机构ID集合 */ - scopeOrgChildList?: number[]; - /** 机构及以下机构ID集合 */ - moduleList?: SysResource[]; - /** 租户Id */ - tenantId?: number; - /** 姓名 */ - name: string; - }; - - type UpdatePasswordInput = { - /** 密码 */ - password: string; - /** 新密码 */ - newPassword: string; - }; - - type UpdateSignatureInput = { - /** 签名图片 */ - signature: string; - }; - - type UpdateWorkbenchInput = { - /** 工作台数据 */ - workbenchData: string; - }; - - type UserAddInput = { - /** 主键Id */ - id?: number; - /** 拓展信息 */ - extJson?: string; - status?: string; - /** 创建时间 */ - createTime?: string; - /** 更新时间 */ - updateTime?: string; - /** 创建者Id */ - createUserId?: number; - /** 修改者Id */ - updateUserId?: number; - /** 创建人 */ - createUser?: string; - /** 更新人 */ - updateUser?: string; - /** 软删除 */ - isDelete?: boolean; - userId?: number; - /** 头像 */ - avatar?: string; - /** 签名 */ - signature?: string; - /** 密码 */ - password?: string; - /** 昵称 */ - nickname?: string; - /** 性别 */ - gender?: string; - /** 出生日期 */ - birthday?: string; - /** 民族 */ - nation?: string; - /** 籍贯 */ - nativePlace?: string; - /** 家庭住址 */ - homeAddress?: string; - /** 通信地址 */ - mailingAddress?: string; - /** 证件类型 */ - idCardType?: string; - /** 证件号码 */ - idCardNumber?: string; - /** 文化程度 */ - cultureLevel?: string; - /** 政治面貌 */ - politicalOutlook?: string; - /** 毕业院校 */ - college?: string; - /** 学历 */ - education?: string; - /** 学制 */ - eduLength?: string; - /** 学位 */ - degree?: string; - /** 手机 -这里使用了SM4自动加密解密 */ - phone?: string; - /** 邮箱 */ - email?: string; - /** 家庭电话 */ - homeTel?: string; - /** 办公电话 */ - officeTel?: string; - /** 紧急联系人 */ - emergencyContact?: string; - /** 紧急联系人电话 */ - emergencyPhone?: string; - /** 紧急联系人地址 */ - emergencyAddress?: string; - /** 员工编号 */ - empNo?: string; - /** 入职日期 */ - entryDate?: string; - /** 职级 */ - positionLevel?: string; - /** 主管id */ - directorId?: number; - /** 上次修改密码时间 */ - pwdRemindUpdateTime?: string; - /** 上次登录ip */ - lastLoginIp?: string; - /** 上次登录地点 */ - lastLoginAddress?: string; - /** 上次登录时间 */ - lastLoginTime?: string; - /** 上次登录设备 */ - lastLoginDevice?: string; - /** 最新登录ip */ - latestLoginIp?: string; - /** 最新登录地点 */ - latestLoginAddress?: string; - /** 最新登录时间 */ - latestLoginTime?: string; - /** 最新登录设备 */ - latestLoginDevice?: string; - /** 排序码 */ - sortCode?: number; - /** 默认模块 */ - defaultModule?: number; - /** 机构信息 */ - orgName?: string; - /** 机构信息全称 */ - orgNames?: string; - /** 职位信息 */ - positionName?: string; - /** 组织和机构ID列表,组织ID从上到下最后是职位 */ - orgAndPosIdList?: number[]; - directorInfo?: UserSelectorOutPut; - /** 按钮码集合 */ - buttonCodeList?: string[]; - /** 权限码集合 */ - permissionCodeList?: string[]; - /** 角色码集合 */ - roleCodeList?: string[]; - /** 角色ID集合 */ - roleIdList?: number[]; - /** 数据范围集合 */ - dataScopeList?: DataScope[]; - defaultDataScope?: DefaultDataScope; - /** 机构及以下机构ID集合 */ - scopeOrgChildList?: number[]; - /** 机构及以下机构ID集合 */ - moduleList?: SysResource[]; - /** 租户Id */ - tenantId?: number; - /** 账号 */ - account: string; - /** 姓名 */ - name: string; - /** 组织id */ - orgId?: number; - /** 职位id */ - positionId?: number; - }; - - type userCenterLoginMenuGetParams = { - /** 主键Id */ - Id?: number; - }; - - type userCenterMyMessageDetailGetParams = { - /** 主键Id */ - Id?: number; - }; - - type userCenterMyMessagePageGetParams = { - /** 站内信分类 */ - Category?: string; - /** 当前页码 */ - PageNum?: number; - /** 每页条数 */ - PageSize?: number; - /** 排序字段 */ - SortField?: string; - /** 排序方式,升序:ascend;降序:descend" */ - SortOrder?: string; - /** 关键字 */ - SearchKey?: string; - }; - - type UserEditInput = { - /** 拓展信息 */ - extJson?: string; - status?: string; - /** 创建时间 */ - createTime?: string; - /** 更新时间 */ - updateTime?: string; - /** 创建者Id */ - createUserId?: number; - /** 修改者Id */ - updateUserId?: number; - /** 创建人 */ - createUser?: string; - /** 更新人 */ - updateUser?: string; - /** 软删除 */ - isDelete?: boolean; - userId?: number; - /** 头像 */ - avatar?: string; - /** 签名 */ - signature?: string; - /** 密码 */ - password?: string; - /** 昵称 */ - nickname?: string; - /** 性别 */ - gender?: string; - /** 出生日期 */ - birthday?: string; - /** 民族 */ - nation?: string; - /** 籍贯 */ - nativePlace?: string; - /** 家庭住址 */ - homeAddress?: string; - /** 通信地址 */ - mailingAddress?: string; - /** 证件类型 */ - idCardType?: string; - /** 证件号码 */ - idCardNumber?: string; - /** 文化程度 */ - cultureLevel?: string; - /** 政治面貌 */ - politicalOutlook?: string; - /** 毕业院校 */ - college?: string; - /** 学历 */ - education?: string; - /** 学制 */ - eduLength?: string; - /** 学位 */ - degree?: string; - /** 手机 -这里使用了SM4自动加密解密 */ - phone?: string; - /** 邮箱 */ - email?: string; - /** 家庭电话 */ - homeTel?: string; - /** 办公电话 */ - officeTel?: string; - /** 紧急联系人 */ - emergencyContact?: string; - /** 紧急联系人电话 */ - emergencyPhone?: string; - /** 紧急联系人地址 */ - emergencyAddress?: string; - /** 员工编号 */ - empNo?: string; - /** 入职日期 */ - entryDate?: string; - /** 职级 */ - positionLevel?: string; - /** 主管id */ - directorId?: number; - /** 上次修改密码时间 */ - pwdRemindUpdateTime?: string; - /** 上次登录ip */ - lastLoginIp?: string; - /** 上次登录地点 */ - lastLoginAddress?: string; - /** 上次登录时间 */ - lastLoginTime?: string; - /** 上次登录设备 */ - lastLoginDevice?: string; - /** 最新登录ip */ - latestLoginIp?: string; - /** 最新登录地点 */ - latestLoginAddress?: string; - /** 最新登录时间 */ - latestLoginTime?: string; - /** 最新登录设备 */ - latestLoginDevice?: string; - /** 排序码 */ - sortCode?: number; - /** 默认模块 */ - defaultModule?: number; - /** 机构信息 */ - orgName?: string; - /** 机构信息全称 */ - orgNames?: string; - /** 职位信息 */ - positionName?: string; - /** 组织和机构ID列表,组织ID从上到下最后是职位 */ - orgAndPosIdList?: number[]; - directorInfo?: UserSelectorOutPut; - /** 按钮码集合 */ - buttonCodeList?: string[]; - /** 权限码集合 */ - permissionCodeList?: string[]; - /** 角色码集合 */ - roleCodeList?: string[]; - /** 角色ID集合 */ - roleIdList?: number[]; - /** 数据范围集合 */ - dataScopeList?: DataScope[]; - defaultDataScope?: DefaultDataScope; - /** 机构及以下机构ID集合 */ - scopeOrgChildList?: number[]; - /** 机构及以下机构ID集合 */ - moduleList?: SysResource[]; - /** 租户Id */ - tenantId?: number; - /** 账号 */ - account: string; - /** 姓名 */ - name: string; - /** 组织id */ - orgId?: number; - /** 职位id */ - positionId?: number; - /** Id */ - id?: number; - }; - - type UserGrantResourceInput = { - /** 角色Id */ - id?: number; - /** 授权资源信息 */ - grantInfoList: RelationRoleResource[]; - /** 是否代码生成 */ - isCodeGen?: boolean; - defaultDataScope: DefaultDataScope; - }; - - type UserGrantRoleInput = { - /** Id */ - id?: number; - /** 授权权限信息 */ - roleIdList: number[]; - }; - - type UserPageInput = { - /** 当前页码 */ - pageNum?: number; - /** 每页条数 */ - pageSize?: number; - /** 排序字段 */ - sortField?: string; - /** 排序方式,升序:ascend;降序:descend" */ - sortOrder?: string; - /** 关键字 */ - searchKey?: string; - /** 所属组织 */ - orgId?: number; - expression?: ExpressionableSysUser; - /** 用户状态 */ - status?: string; - }; - - type UserSelectorOutPut = { - /** Id */ - id?: number; - /** 组织ID */ - orgId?: number; - /** 账号 */ - account?: string; - /** 姓名 */ - name?: string; - /** 性别 */ - gender?: string; - }; - - type VisitLogDeleteInput = { - /** 分类 */ - category?: string; - }; -} diff --git a/src/api/SimpleAdmin/userCenter.ts b/src/api/SimpleAdmin/userCenter.ts deleted file mode 100644 index 90639f1..0000000 --- a/src/api/SimpleAdmin/userCenter.ts +++ /dev/null @@ -1,255 +0,0 @@ -// @ts-ignore -/* eslint-disable */ -import request from '@/utils/request'; - -/** 删除我的消息 POST /userCenter/deleteMessage */ -export async function userCenterDeleteMessagePost( - body: API.BaseIdInput, - options?: { [key: string]: any } -) { - return request(`api/userCenter/deleteMessage`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 获取个人菜单 GET /userCenter/loginMenu */ -export async function userCenterLoginMenuGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.userCenterLoginMenuGetParams, - options?: { [key: string]: any } -) { - return request(`api/userCenter/loginMenu`, { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - }); -} - -/** 获取组织架构 GET /userCenter/loginOrgTree */ -export async function userCenterLoginOrgTreeGet(options?: { - [key: string]: any; -}) { - return request(`api/userCenter/loginOrgTree`, { - method: 'GET', - ...(options || {}), - }); -} - -/** 获取个人工作台 GET /userCenter/loginWorkbench */ -export async function userCenterLoginWorkbenchGet(options?: { - [key: string]: any; -}) { - return request(`api/userCenter/loginWorkbench`, { - method: 'GET', - ...(options || {}), - }); -} - -/** 读取登录用户站内信详情 GET /userCenter/myMessageDetail */ -export async function userCenterMyMessageDetailGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.userCenterMyMessageDetailGetParams, - options?: { [key: string]: any } -) { - return request( - `api/userCenter/myMessageDetail`, - { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - } - ); -} - -/** 获取登录用户的站内信分页 GET /userCenter/myMessagePage */ -export async function userCenterMyMessagePageGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.userCenterMyMessagePageGetParams, - options?: { [key: string]: any } -) { - return request(`api/userCenter/myMessagePage`, { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - }); -} - -/** 最新未读消息 GET /userCenter/newUnRead */ -export async function userCenterNewUnReadGet(options?: { [key: string]: any }) { - return request(`api/userCenter/newUnRead`, { - method: 'GET', - ...(options || {}), - }); -} - -/** 修改默认模块 POST /userCenter/setDefaultModule */ -export async function userCenterSetDefaultModulePost( - body: API.SetDefaultModuleInput, - options?: { [key: string]: any } -) { - return request(`api/userCenter/setDefaultModule`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 设置未读 POST /userCenter/setDelete */ -export async function userCenterSetDeletePost( - body: API.MessageReadInput, - options?: { [key: string]: any } -) { - return request(`api/userCenter/setDelete`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 设置已读 POST /userCenter/setRead */ -export async function userCenterSetReadPost( - body: API.MessageReadInput, - options?: { [key: string]: any } -) { - return request(`api/userCenter/setRead`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 快捷方式菜单树 GET /userCenter/shortcutTree */ -export async function userCenterShortcutTreeGet(options?: { - [key: string]: any; -}) { - return request(`api/userCenter/shortcutTree`, { - method: 'GET', - ...(options || {}), - }); -} - -/** 未读消息数 GET /userCenter/UnReadCount */ -export async function userCenterUnReadCountGet(options?: { - [key: string]: any; -}) { - return request(`api/userCenter/UnReadCount`, { - method: 'GET', - ...(options || {}), - }); -} - -/** 修改头像 POST /userCenter/updateAvatar */ -export async function userCenterUpdateAvatarPost( - body: {}, - File?: File, - options?: { [key: string]: any } -) { - const formData = new FormData(); - - if (File) { - formData.append('File', File); - } - - Object.keys(body).forEach((ele) => { - const item = (body as any)[ele]; - - if (item !== undefined && item !== null) { - if (typeof item === 'object' && !(item instanceof File)) { - if (item instanceof Array) { - item.forEach((f) => formData.append(ele, f || '')); - } else { - formData.append(ele, JSON.stringify(item)); - } - } else { - formData.append(ele, item); - } - } - }); - - return request(`api/userCenter/updateAvatar`, { - method: 'POST', - data: formData, - requestType: 'form', - ...(options || {}), - }); -} - -/** 修改密码 POST /userCenter/updatePassword */ -export async function userCenterUpdatePasswordPost( - body: API.UpdatePasswordInput, - options?: { [key: string]: any } -) { - return request(`api/userCenter/updatePassword`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 更新签名 POST /userCenter/updateSignature */ -export async function userCenterUpdateSignaturePost( - body: API.UpdateSignatureInput, - options?: { [key: string]: any } -) { - return request(`api/userCenter/updateSignature`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 编辑个人信息 POST /userCenter/updateUserInfo */ -export async function userCenterUpdateUserInfoPost( - body: API.UpdateInfoInput, - options?: { [key: string]: any } -) { - return request(`api/userCenter/updateUserInfo`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 编辑工作台 POST /userCenter/updateUserWorkbench */ -export async function userCenterUpdateUserWorkbenchPost( - body: API.UpdateWorkbenchInput, - options?: { [key: string]: any } -) { - return request(`api/userCenter/updateUserWorkbench`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} diff --git a/src/api/SimpleAdmin/userManagement.ts b/src/api/SimpleAdmin/userManagement.ts deleted file mode 100644 index 270d46f..0000000 --- a/src/api/SimpleAdmin/userManagement.ts +++ /dev/null @@ -1,369 +0,0 @@ -// @ts-ignore -/* eslint-disable */ -import request from '@/utils/request'; - -/** 添加用户 POST /sys/organization/user/add */ -export async function sysOrganizationUserAddPost( - body: API.UserAddInput, - options?: { [key: string]: any } -) { - return request(`api/sys/organization/user/add`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 删除用户 POST /sys/organization/user/delete */ -export async function sysOrganizationUserDeletePost( - body: API.BaseIdListInput, - options?: { [key: string]: any } -) { - return request(`api/sys/organization/user/delete`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 用户详情 GET /sys/organization/user/detail */ -export async function sysOrganizationUserDetailGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysOrganizationUserDetailGetParams, - options?: { [key: string]: any } -) { - return request( - `api/sys/organization/user/detail`, - { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - } - ); -} - -/** 禁用用户 POST /sys/organization/user/disableUser */ -export async function sysOrganizationUserDisableUserPost( - body: API.BaseIdInput, - options?: { [key: string]: any } -) { - return request(`api/sys/organization/user/disableUser`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 修改用户 POST /sys/organization/user/edit */ -export async function sysOrganizationUserEditPost( - body: API.UserEditInput, - options?: { [key: string]: any } -) { - return request(`api/sys/organization/user/edit`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 批量修改用户 POST /sys/organization/user/edits */ -export async function sysOrganizationUserEditsPost( - body: API.BatchEditInput, - options?: { [key: string]: any } -) { - return request(`api/sys/organization/user/edits`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 启用用户 POST /sys/organization/user/enableUser */ -export async function sysOrganizationUserEnableUserPost( - body: API.BaseIdInput, - options?: { [key: string]: any } -) { - return request(`api/sys/organization/user/enableUser`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 用户导出 POST /sys/organization/user/export */ -export async function sysOrganizationUserExportPost( - body: API.UserPageInput, - options?: { [key: string]: any } -) { - return request( - `api/sys/organization/user/export`, - { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - } - ); -} - -/** 给用户授权权限 POST /sys/organization/user/grantPermission */ -export async function sysOrganizationUserGrantPermissionPost( - body: API.GrantPermissionInput, - options?: { [key: string]: any } -) { - return request(`api/sys/organization/user/grantPermission`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 给用户授权资源 POST /sys/organization/user/grantResource */ -export async function sysOrganizationUserGrantResourcePost( - body: API.UserGrantResourceInput, - options?: { [key: string]: any } -) { - return request(`api/sys/organization/user/grantResource`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 给用户授权角色 POST /sys/organization/user/grantRole */ -export async function sysOrganizationUserGrantRolePost( - body: API.UserGrantRoleInput, - options?: { [key: string]: any } -) { - return request(`api/sys/organization/user/grantRole`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 用户导入 POST /sys/organization/user/import */ -export async function sysOrganizationUserImportPost( - body: API.ImportResultInputSysUserImportInput, - options?: { [key: string]: any } -) { - return request( - `api/sys/organization/user/import`, - { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - } - ); -} - -/** 获取用户拥有权限 GET /sys/organization/user/ownPermission */ -export async function sysOrganizationUserOwnPermissionGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysOrganizationUserOwnPermissionGetParams, - options?: { [key: string]: any } -) { - return request( - `api/sys/organization/user/ownPermission`, - { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - } - ); -} - -/** 获取用户拥有资源 GET /sys/organization/user/ownResource */ -export async function sysOrganizationUserOwnResourceGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysOrganizationUserOwnResourceGetParams, - options?: { [key: string]: any } -) { - return request( - `api/sys/organization/user/ownResource`, - { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - } - ); -} - -/** 获取用户拥有角色 GET /sys/organization/user/ownRole */ -export async function sysOrganizationUserOwnRoleGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysOrganizationUserOwnRoleGetParams, - options?: { [key: string]: any } -) { - return request( - `api/sys/organization/user/ownRole`, - { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - } - ); -} - -/** 用户分页查询 GET /sys/organization/user/page */ -export async function sysOrganizationUserPageGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysOrganizationUserPageGetParams, - options?: { [key: string]: any } -) { - return request( - `api/sys/organization/user/page`, - { - method: 'GET', - params: { - ...params, - Expression: undefined, - ...params['Expression'], - }, - ...(options || {}), - } - ); -} - -/** 获取权限授权树 GET /sys/organization/user/permissionTreeSelector */ -export async function sysOrganizationUserPermissionTreeSelectorGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysOrganizationUserPermissionTreeSelectorGetParams, - options?: { [key: string]: any } -) { - return request( - `api/sys/organization/user/permissionTreeSelector`, - { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - } - ); -} - -/** 导入预览 POST /sys/organization/user/preview */ -export async function sysOrganizationUserPreviewPost( - body: {}, - File?: File, - options?: { [key: string]: any } -) { - const formData = new FormData(); - - if (File) { - formData.append('File', File); - } - - Object.keys(body).forEach((ele) => { - const item = (body as any)[ele]; - - if (item !== undefined && item !== null) { - if (typeof item === 'object' && !(item instanceof File)) { - if (item instanceof Array) { - item.forEach((f) => formData.append(ele, f || '')); - } else { - formData.append(ele, JSON.stringify(item)); - } - } else { - formData.append(ele, item); - } - } - }); - - return request( - `api/sys/organization/user/preview`, - { - method: 'POST', - data: formData, - requestType: 'form', - ...(options || {}), - } - ); -} - -/** 重置密码 POST /sys/organization/user/resetPassword */ -export async function sysOrganizationUserResetPasswordPost( - body: API.BaseIdInput, - options?: { [key: string]: any } -) { - return request(`api/sys/organization/user/resetPassword`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json-patch+json', - }, - data: body, - ...(options || {}), - }); -} - -/** 获取用户选择器 GET /sys/organization/user/selector */ -export async function sysOrganizationUserSelectorGet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.sysOrganizationUserSelectorGetParams, - options?: { [key: string]: any } -) { - return request( - `api/sys/organization/user/selector`, - { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - } - ); -} - -/** 模板下载 GET /sys/organization/user/template */ -export async function sysOrganizationUserTemplateGet(options?: { - [key: string]: any; -}) { - return request( - `api/sys/organization/user/template`, - { - method: 'GET', - ...(options || {}), - } - ); -} diff --git a/src/api/rbac/axios-config.ts b/src/api/rbac/axios-config.ts new file mode 100644 index 0000000..a0f545b --- /dev/null +++ b/src/api/rbac/axios-config.ts @@ -0,0 +1,183 @@ +import axios, { AxiosError, AxiosRequestConfig } from 'axios' +import { Message } from '@arco-design/web-vue' +import router from '@/router' +import { OpenAPI, clearAuthToken } from './index' +import { useRbacUserStore } from '@/store/modules/rbac-user' + +// 创建自定义 axios 实例 +// 注意:baseURL 设置为空,因为 OpenAPI.BASE 已经处理了 URL 构建 +// 生产环境:OpenAPI.BASE = 'http://43.139.210.35:5281' +// 开发环境:OpenAPI.BASE = ''(通过 Vite 代理) +export const axiosInstance = axios.create({ + baseURL: '', // 始终为空,URL 由 OpenAPI.BASE + path 构建 + timeout: 30000, + headers: { + 'Content-Type': 'application/json' + } +}) + +// 是否正在刷新 Token +let isRefreshing = false +// 等待刷新的请求队列 +let refreshSubscribers: ((token: string) => void)[] = [] + +// 添加请求到等待队列 +function subscribeTokenRefresh(callback: (token: string) => void) { + refreshSubscribers.push(callback) +} + +// 通知所有等待的请求 +function onTokenRefreshed(token: string) { + refreshSubscribers.forEach(callback => callback(token)) + refreshSubscribers = [] +} + +// 请求拦截器 +axiosInstance.interceptors.request.use( + async (config: AxiosRequestConfig) => { + const userStore = useRbacUserStore() + + // 确保 headers 存在 + if (!config.headers) { + config.headers = {} + } + + // 优先使用 userStore 的 accessToken(最可靠) + let token: string | undefined + + if (userStore.accessToken) { + token = userStore.accessToken + } else if (OpenAPI.TOKEN) { + // 兼容:从 OpenAPI 配置中获取 token + token = typeof OpenAPI.TOKEN === 'function' + ? await OpenAPI.TOKEN({} as any) + : OpenAPI.TOKEN + } + + // 如果找到了 token,设置 Authorization header + if (token) { + // 如果token已经包含Bearer前缀,直接使用;否则添加Bearer前缀 + if (typeof token === 'string' && token.startsWith('Bearer ')) { + config.headers.Authorization = token + } else if (typeof token === 'string' && token.startsWith('Bearer_')) { + // 处理 Bearer_xxx 格式,转换为 Bearer xxx + config.headers.Authorization = `Bearer ${token.replace('Bearer_', '')}` + } else { + config.headers.Authorization = `Bearer ${token}` + } + + // 调试信息 + const isDev = (import.meta as any).env?.MODE === 'development' + if (isDev) { + console.log('[RBAC Request] Authorization header set:', config.headers.Authorization?.substring(0, 20) + '...') + } + } else { + // 调试信息:如果没有 token,记录日志(生产环境也记录,方便排查) + const isDev = (import.meta as any).env?.MODE === 'development' + console.warn('[RBAC Request] No token found:', { + hasAccessToken: !!userStore.accessToken, + hasOpenAPIToken: !!OpenAPI.TOKEN, + url: config.url, + isDev + }) + } + + return config + }, + (error: AxiosError) => { + return Promise.reject(error) + } +) + +// 响应拦截器 +axiosInstance.interceptors.response.use( + (response) => { + return response + }, + async (error: AxiosError) => { + const originalRequest = error.config as AxiosRequestConfig & { _retry?: boolean } + const userStore = useRbacUserStore() + + if (error.response) { + const status = error.response.status + const data: any = error.response.data + + // 401 错误处理:尝试刷新 Token + if (status === 401 && !originalRequest._retry) { + // 如果没有 refreshToken,直接登出 + if (!userStore.refreshToken) { + userStore.logout() + router.push('/login') + Message.error('未授权,请重新登录') + return Promise.reject(error) + } + + // 如果正在刷新,将请求加入队列 + if (isRefreshing) { + return new Promise(resolve => { + subscribeTokenRefresh((token: string) => { + if (!originalRequest.headers) { + originalRequest.headers = {} + } + originalRequest.headers.Authorization = `Bearer ${token}` + resolve(axiosInstance(originalRequest)) + }) + }) + } + + originalRequest._retry = true + isRefreshing = true + + try { + // 尝试刷新 Token + const success = await userStore.refreshAccessToken() + + if (success) { + // 刷新成功,重试原请求 + onTokenRefreshed(userStore.accessToken) + if (!originalRequest.headers) { + originalRequest.headers = {} + } + originalRequest.headers.Authorization = `Bearer ${userStore.accessToken}` + return axiosInstance(originalRequest) + } else { + // 刷新失败,登出 + userStore.logout() + router.push('/login') + Message.error('登录已过期,请重新登录') + return Promise.reject(error) + } + } catch { + userStore.logout() + router.push('/login') + Message.error('登录已过期,请重新登录') + return Promise.reject(error) + } finally { + isRefreshing = false + } + } + + switch (status) { + case 401: + Message.error('未授权,请重新登录') + break + case 403: + Message.error('没有权限访问') + break + case 404: + Message.error('请求的资源不存在') + break + case 500: + Message.error(data?.message || '服务器错误') + break + default: + Message.error(data?.message || '请求失败') + } + } else if (error.request) { + Message.error('网络错误,请检查网络连接') + } else { + Message.error('请求配置错误') + } + return Promise.reject(error) + } +) diff --git a/src/api/rbac/generated/core/ApiError.ts b/src/api/rbac/generated/core/ApiError.ts new file mode 100644 index 0000000..d6b8fcc --- /dev/null +++ b/src/api/rbac/generated/core/ApiError.ts @@ -0,0 +1,25 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { ApiRequestOptions } from './ApiRequestOptions'; +import type { ApiResult } from './ApiResult'; + +export class ApiError extends Error { + public readonly url: string; + public readonly status: number; + public readonly statusText: string; + public readonly body: any; + public readonly request: ApiRequestOptions; + + constructor(request: ApiRequestOptions, response: ApiResult, message: string) { + super(message); + + this.name = 'ApiError'; + this.url = response.url; + this.status = response.status; + this.statusText = response.statusText; + this.body = response.body; + this.request = request; + } +} diff --git a/src/api/rbac/generated/core/ApiRequestOptions.ts b/src/api/rbac/generated/core/ApiRequestOptions.ts new file mode 100644 index 0000000..c19adcc --- /dev/null +++ b/src/api/rbac/generated/core/ApiRequestOptions.ts @@ -0,0 +1,17 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export type ApiRequestOptions = { + readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH'; + readonly url: string; + readonly path?: Record; + readonly cookies?: Record; + readonly headers?: Record; + readonly query?: Record; + readonly formData?: Record; + readonly body?: any; + readonly mediaType?: string; + readonly responseHeader?: string; + readonly errors?: Record; +}; diff --git a/src/api/rbac/generated/core/ApiResult.ts b/src/api/rbac/generated/core/ApiResult.ts new file mode 100644 index 0000000..ad8fef2 --- /dev/null +++ b/src/api/rbac/generated/core/ApiResult.ts @@ -0,0 +1,11 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export type ApiResult = { + readonly url: string; + readonly ok: boolean; + readonly status: number; + readonly statusText: string; + readonly body: any; +}; diff --git a/src/api/rbac/generated/core/CancelablePromise.ts b/src/api/rbac/generated/core/CancelablePromise.ts new file mode 100644 index 0000000..eb02246 --- /dev/null +++ b/src/api/rbac/generated/core/CancelablePromise.ts @@ -0,0 +1,131 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export class CancelError extends Error { + + constructor(message: string) { + super(message); + this.name = 'CancelError'; + } + + public get isCancelled(): boolean { + return true; + } +} + +export interface OnCancel { + readonly isResolved: boolean; + readonly isRejected: boolean; + readonly isCancelled: boolean; + + (cancelHandler: () => void): void; +} + +export class CancelablePromise implements Promise { + #isResolved: boolean; + #isRejected: boolean; + #isCancelled: boolean; + readonly #cancelHandlers: (() => void)[]; + readonly #promise: Promise; + #resolve?: (value: T | PromiseLike) => void; + #reject?: (reason?: any) => void; + + constructor( + executor: ( + resolve: (value: T | PromiseLike) => void, + reject: (reason?: any) => void, + onCancel: OnCancel + ) => void + ) { + this.#isResolved = false; + this.#isRejected = false; + this.#isCancelled = false; + this.#cancelHandlers = []; + this.#promise = new Promise((resolve, reject) => { + this.#resolve = resolve; + this.#reject = reject; + + const onResolve = (value: T | PromiseLike): void => { + if (this.#isResolved || this.#isRejected || this.#isCancelled) { + return; + } + this.#isResolved = true; + if (this.#resolve) this.#resolve(value); + }; + + const onReject = (reason?: any): void => { + if (this.#isResolved || this.#isRejected || this.#isCancelled) { + return; + } + this.#isRejected = true; + if (this.#reject) this.#reject(reason); + }; + + const onCancel = (cancelHandler: () => void): void => { + if (this.#isResolved || this.#isRejected || this.#isCancelled) { + return; + } + this.#cancelHandlers.push(cancelHandler); + }; + + Object.defineProperty(onCancel, 'isResolved', { + get: (): boolean => this.#isResolved, + }); + + Object.defineProperty(onCancel, 'isRejected', { + get: (): boolean => this.#isRejected, + }); + + Object.defineProperty(onCancel, 'isCancelled', { + get: (): boolean => this.#isCancelled, + }); + + return executor(onResolve, onReject, onCancel as OnCancel); + }); + } + + get [Symbol.toStringTag]() { + return "Cancellable Promise"; + } + + public then( + onFulfilled?: ((value: T) => TResult1 | PromiseLike) | null, + onRejected?: ((reason: any) => TResult2 | PromiseLike) | null + ): Promise { + return this.#promise.then(onFulfilled, onRejected); + } + + public catch( + onRejected?: ((reason: any) => TResult | PromiseLike) | null + ): Promise { + return this.#promise.catch(onRejected); + } + + public finally(onFinally?: (() => void) | null): Promise { + return this.#promise.finally(onFinally); + } + + public cancel(): void { + if (this.#isResolved || this.#isRejected || this.#isCancelled) { + return; + } + this.#isCancelled = true; + if (this.#cancelHandlers.length) { + try { + for (const cancelHandler of this.#cancelHandlers) { + cancelHandler(); + } + } catch (error) { + console.warn('Cancellation threw an error', error); + return; + } + } + this.#cancelHandlers.length = 0; + if (this.#reject) this.#reject(new CancelError('Request aborted')); + } + + public get isCancelled(): boolean { + return this.#isCancelled; + } +} diff --git a/src/api/rbac/generated/core/OpenAPI.ts b/src/api/rbac/generated/core/OpenAPI.ts new file mode 100644 index 0000000..d210b7a --- /dev/null +++ b/src/api/rbac/generated/core/OpenAPI.ts @@ -0,0 +1,32 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { ApiRequestOptions } from './ApiRequestOptions'; + +type Resolver = (options: ApiRequestOptions) => Promise; +type Headers = Record; + +export type OpenAPIConfig = { + BASE: string; + VERSION: string; + WITH_CREDENTIALS: boolean; + CREDENTIALS: 'include' | 'omit' | 'same-origin'; + TOKEN?: string | Resolver | undefined; + USERNAME?: string | Resolver | undefined; + PASSWORD?: string | Resolver | undefined; + HEADERS?: Headers | Resolver | undefined; + ENCODE_PATH?: ((path: string) => string) | undefined; +}; + +export const OpenAPI: OpenAPIConfig = { + BASE: '', + VERSION: '1', + WITH_CREDENTIALS: false, + CREDENTIALS: 'include', + TOKEN: undefined, + USERNAME: undefined, + PASSWORD: undefined, + HEADERS: undefined, + ENCODE_PATH: undefined, +}; diff --git a/src/api/rbac/generated/core/request.ts b/src/api/rbac/generated/core/request.ts new file mode 100644 index 0000000..db6f278 --- /dev/null +++ b/src/api/rbac/generated/core/request.ts @@ -0,0 +1,329 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import axios from 'axios'; +import type { AxiosError, AxiosRequestConfig, AxiosResponse, AxiosInstance } from 'axios'; +// 在浏览器环境中使用原生的 FormData,而不是 Node.js 的 form-data 包 +// import FormData from 'form-data'; + +import { ApiError } from './ApiError'; +import type { ApiRequestOptions } from './ApiRequestOptions'; +import type { ApiResult } from './ApiResult'; +import { CancelablePromise } from './CancelablePromise'; +import type { OnCancel } from './CancelablePromise'; +import type { OpenAPIConfig } from './OpenAPI'; +import { axiosInstance } from '../../axios-config'; + +export const isDefined = (value: T | null | undefined): value is Exclude => { + return value !== undefined && value !== null; +}; + +export const isString = (value: any): value is string => { + return typeof value === 'string'; +}; + +export const isStringWithValue = (value: any): value is string => { + return isString(value) && value !== ''; +}; + +export const isBlob = (value: any): value is Blob => { + return ( + typeof value === 'object' && + typeof value.type === 'string' && + typeof value.stream === 'function' && + typeof value.arrayBuffer === 'function' && + typeof value.constructor === 'function' && + typeof value.constructor.name === 'string' && + /^(Blob|File)$/.test(value.constructor.name) && + /^(Blob|File)$/.test(value[Symbol.toStringTag]) + ); +}; + +// 在浏览器环境中,FormData 是全局对象 +export const isFormData = (value: any): value is FormData => { + return typeof FormData !== 'undefined' && value instanceof FormData; +}; + +export const isSuccess = (status: number): boolean => { + return status >= 200 && status < 300; +}; + +export const base64 = (str: string): string => { + try { + return btoa(str); + } catch (err) { + // @ts-ignore + return Buffer.from(str).toString('base64'); + } +}; + +export const getQueryString = (params: Record): string => { + const qs: string[] = []; + + const append = (key: string, value: any) => { + qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`); + }; + + const process = (key: string, value: any) => { + if (isDefined(value)) { + if (Array.isArray(value)) { + value.forEach(v => { + process(key, v); + }); + } else if (typeof value === 'object') { + Object.entries(value).forEach(([k, v]) => { + process(`${key}[${k}]`, v); + }); + } else { + append(key, value); + } + } + }; + + Object.entries(params).forEach(([key, value]) => { + process(key, value); + }); + + if (qs.length > 0) { + return `?${qs.join('&')}`; + } + + return ''; +}; + +const getUrl = (config: OpenAPIConfig, options: ApiRequestOptions): string => { + const encoder = config.ENCODE_PATH || encodeURI; + + const path = options.url + .replace('{api-version}', config.VERSION) + .replace(/{(.*?)}/g, (substring: string, group: string) => { + if (options.path?.hasOwnProperty(group)) { + return encoder(String(options.path[group])); + } + return substring; + }); + + const url = `${config.BASE}${path}`; + if (options.query) { + return `${url}${getQueryString(options.query)}`; + } + return url; +}; + +export const getFormData = (options: ApiRequestOptions): FormData | undefined => { + if (options.formData) { + const formData = new FormData(); + + const process = (key: string, value: any) => { + if (isString(value) || isBlob(value)) { + formData.append(key, value); + } else { + formData.append(key, JSON.stringify(value)); + } + }; + + Object.entries(options.formData) + .filter(([_, value]) => isDefined(value)) + .forEach(([key, value]) => { + if (Array.isArray(value)) { + value.forEach(v => process(key, v)); + } else { + process(key, value); + } + }); + + return formData; + } + return undefined; +}; + +type Resolver = (options: ApiRequestOptions) => Promise; + +export const resolve = async (options: ApiRequestOptions, resolver?: T | Resolver): Promise => { + if (typeof resolver === 'function') { + return (resolver as Resolver)(options); + } + return resolver; +}; + +export const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptions, formData?: FormData): Promise> => { + const [token, username, password, additionalHeaders] = await Promise.all([ + resolve(options, config.TOKEN), + resolve(options, config.USERNAME), + resolve(options, config.PASSWORD), + resolve(options, config.HEADERS), + ]); + + // 浏览器原生的 FormData 没有 getHeaders 方法,只有 Node.js 的 form-data 包才有 + // 在浏览器环境中,FormData 会自动设置正确的 Content-Type(包括 boundary) + const formHeaders = (typeof formData !== 'undefined' && typeof (formData as any)?.getHeaders === 'function') + ? (formData as any).getHeaders() + : {} + + const headers = Object.entries({ + Accept: 'application/json', + ...additionalHeaders, + ...options.headers, + ...formHeaders, + }) + .filter(([_, value]) => isDefined(value)) + .reduce((headers, [key, value]) => ({ + ...headers, + [key]: String(value), + }), {} as Record); + + if (isStringWithValue(token)) { + headers['Authorization'] = `Bearer ${token}`; + } + + if (isStringWithValue(username) && isStringWithValue(password)) { + const credentials = base64(`${username}:${password}`); + headers['Authorization'] = `Basic ${credentials}`; + } + + if (options.body) { + if (options.mediaType) { + headers['Content-Type'] = options.mediaType; + } else if (isBlob(options.body)) { + headers['Content-Type'] = options.body.type || 'application/octet-stream'; + } else if (isString(options.body)) { + headers['Content-Type'] = 'text/plain'; + } else if (!isFormData(options.body)) { + headers['Content-Type'] = 'application/json'; + } + } + + return headers; +}; + +export const getRequestBody = (options: ApiRequestOptions): any => { + if (options.body) { + return options.body; + } + return undefined; +}; + +export const sendRequest = async ( + config: OpenAPIConfig, + options: ApiRequestOptions, + url: string, + body: any, + formData: FormData | undefined, + headers: Record, + onCancel: OnCancel, + axiosClient: AxiosInstance +): Promise> => { + const source = axios.CancelToken.source(); + + const requestConfig: AxiosRequestConfig = { + url, + headers, + data: body ?? formData, + method: options.method, + withCredentials: config.WITH_CREDENTIALS, + cancelToken: source.token, + }; + + onCancel(() => source.cancel('The user aborted a request.')); + + try { + return await axiosClient.request(requestConfig); + } catch (error) { + const axiosError = error as AxiosError; + if (axiosError.response) { + return axiosError.response; + } + throw error; + } +}; + +export const getResponseHeader = (response: AxiosResponse, responseHeader?: string): string | undefined => { + if (responseHeader) { + const content = response.headers[responseHeader]; + if (isString(content)) { + return content; + } + } + return undefined; +}; + +export const getResponseBody = (response: AxiosResponse): any => { + if (response.status !== 204) { + return response.data; + } + return undefined; +}; + +export const catchErrorCodes = (options: ApiRequestOptions, result: ApiResult): void => { + const errors: Record = { + 400: 'Bad Request', + 401: 'Unauthorized', + 403: 'Forbidden', + 404: 'Not Found', + 500: 'Internal Server Error', + 502: 'Bad Gateway', + 503: 'Service Unavailable', + ...options.errors, + } + + const error = errors[result.status]; + if (error) { + throw new ApiError(options, result, error); + } + + if (!result.ok) { + const errorStatus = result.status ?? 'unknown'; + const errorStatusText = result.statusText ?? 'unknown'; + const errorBody = (() => { + try { + return JSON.stringify(result.body, null, 2); + } catch (e) { + return undefined; + } + })(); + + throw new ApiError(options, result, + `Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}` + ); + } +}; + +/** + * Request method + * @param config The OpenAPI configuration object + * @param options The request options from the service + * @param axiosClient The axios client instance to use + * @returns CancelablePromise + * @throws ApiError + */ +export const request = (config: OpenAPIConfig, options: ApiRequestOptions, axiosClient: AxiosInstance = axiosInstance): CancelablePromise => { + return new CancelablePromise(async (resolve, reject, onCancel) => { + try { + const url = getUrl(config, options); + const formData = getFormData(options); + const body = getRequestBody(options); + const headers = await getHeaders(config, options, formData); + + if (!onCancel.isCancelled) { + const response = await sendRequest(config, options, url, body, formData, headers, onCancel, axiosClient); + const responseBody = getResponseBody(response); + const responseHeader = getResponseHeader(response, options.responseHeader); + + const result: ApiResult = { + url, + ok: isSuccess(response.status), + status: response.status, + statusText: response.statusText, + body: responseHeader ?? responseBody, + }; + + catchErrorCodes(options, result); + + resolve(result.body); + } + } catch (error) { + reject(error); + } + }); +}; diff --git a/src/api/rbac/generated/index.ts b/src/api/rbac/generated/index.ts new file mode 100644 index 0000000..a12c9fe --- /dev/null +++ b/src/api/rbac/generated/index.ts @@ -0,0 +1,42 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export { ApiError } from './core/ApiError'; +export { CancelablePromise, CancelError } from './core/CancelablePromise'; +export { OpenAPI } from './core/OpenAPI'; +export type { OpenAPIConfig } from './core/OpenAPI'; + +export type { ApplicationExceptionResult } from './models/ApplicationExceptionResult'; +export type { MenuCreateDto } from './models/MenuCreateDto'; +export type { MenuDto } from './models/MenuDto'; +export type { MenuTreeDto } from './models/MenuTreeDto'; +export { MenuType } from './models/MenuType'; +export type { MenuUpdateDto } from './models/MenuUpdateDto'; +export type { OrganizationCreateDto } from './models/OrganizationCreateDto'; +export type { OrganizationDto } from './models/OrganizationDto'; +export type { OrganizationMoveDto } from './models/OrganizationMoveDto'; +export type { OrganizationTreeDto } from './models/OrganizationTreeDto'; +export type { OrganizationType } from './models/OrganizationType'; +export type { OrganizationUpdateDto } from './models/OrganizationUpdateDto'; +export type { PermissionDefinitionDto } from './models/PermissionDefinitionDto'; +export type { PermissionGroupDto } from './models/PermissionGroupDto'; +export type { RoleCreateDto } from './models/RoleCreateDto'; +export type { RoleDto } from './models/RoleDto'; +export type { RoleDtoPagedResultDto } from './models/RoleDtoPagedResultDto'; +export type { RoleSimpleDto } from './models/RoleSimpleDto'; +export type { RoleUpdateDto } from './models/RoleUpdateDto'; +export type { UpdatePasswordDto } from './models/UpdatePasswordDto'; +export type { UserCreateDto } from './models/UserCreateDto'; +export type { UserDto } from './models/UserDto'; +export type { UserDtoPagedResultDto } from './models/UserDtoPagedResultDto'; +export type { UserInfoDto } from './models/UserInfoDto'; +export type { UserSimpleDto } from './models/UserSimpleDto'; +export type { UserUpdateDto } from './models/UserUpdateDto'; + +export { AuthService } from './services/AuthService'; +export { MenuService } from './services/MenuService'; +export { OrganizationService } from './services/OrganizationService'; +export { PermissionService } from './services/PermissionService'; +export { RoleService } from './services/RoleService'; +export { UserService } from './services/UserService'; diff --git a/src/api/rbac/generated/models/ApplicationExceptionResult.ts b/src/api/rbac/generated/models/ApplicationExceptionResult.ts new file mode 100644 index 0000000..df94fb7 --- /dev/null +++ b/src/api/rbac/generated/models/ApplicationExceptionResult.ts @@ -0,0 +1,9 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export type ApplicationExceptionResult = { + message?: string | null; + details?: string | null; +}; + diff --git a/src/api/rbac/generated/models/MenuCreateDto.ts b/src/api/rbac/generated/models/MenuCreateDto.ts new file mode 100644 index 0000000..22b4476 --- /dev/null +++ b/src/api/rbac/generated/models/MenuCreateDto.ts @@ -0,0 +1,52 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { MenuType } from './MenuType'; +/** + * 创建菜单 DTO + */ +export type MenuCreateDto = { + /** + * 父级菜单ID + */ + pId?: string | null; + /** + * 名称 + */ + name: string; + /** + * 权限代码 + */ + permissionCode?: string | null; + type: MenuType; + /** + * 图标 + */ + icon?: string | null; + /** + * 路由 + */ + route?: string | null; + /** + * 组件 + */ + component?: string | null; + /** + * 排序 + */ + order?: number; + /** + * 是否隐藏 + */ + isHidden?: boolean; + /** + * 是否缓存 + */ + isCached?: boolean; + /** + * 描述 + */ + description?: string | null; +}; + diff --git a/src/api/rbac/generated/models/MenuDto.ts b/src/api/rbac/generated/models/MenuDto.ts new file mode 100644 index 0000000..d6bc102 --- /dev/null +++ b/src/api/rbac/generated/models/MenuDto.ts @@ -0,0 +1,57 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { MenuType } from './MenuType'; +/** + * 菜单 DTO + */ +export type MenuDto = { + id?: string; + createdAt?: string; + createdBy?: string | null; + updatedAt?: string | null; + updatedBy?: string | null; + /** + * 父级菜单ID + */ + pId?: string; + /** + * 名称 + */ + name?: string | null; + /** + * 权限代码 + */ + permissionCode?: string | null; + type?: MenuType; + /** + * 图标 + */ + icon?: string | null; + /** + * 路由 + */ + route?: string | null; + /** + * 组件 + */ + component?: string | null; + /** + * 排序 + */ + order?: number; + /** + * 是否隐藏 + */ + isHidden?: boolean; + /** + * 是否缓存 + */ + isCached?: boolean; + /** + * 描述 + */ + description?: string | null; +}; + diff --git a/src/api/rbac/generated/models/MenuTreeDto.ts b/src/api/rbac/generated/models/MenuTreeDto.ts new file mode 100644 index 0000000..0433a08 --- /dev/null +++ b/src/api/rbac/generated/models/MenuTreeDto.ts @@ -0,0 +1,61 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { MenuType } from './MenuType'; +/** + * 菜单树 DTO + */ +export type MenuTreeDto = { + id?: string; + createdAt?: string; + createdBy?: string | null; + updatedAt?: string | null; + updatedBy?: string | null; + /** + * 父级菜单ID + */ + pId?: string; + /** + * 名称 + */ + name?: string | null; + /** + * 权限代码 + */ + permissionCode?: string | null; + type?: MenuType; + /** + * 图标 + */ + icon?: string | null; + /** + * 路由 + */ + route?: string | null; + /** + * 组件 + */ + component?: string | null; + /** + * 排序 + */ + order?: number; + /** + * 是否隐藏 + */ + isHidden?: boolean; + /** + * 是否缓存 + */ + isCached?: boolean; + /** + * 描述 + */ + description?: string | null; + /** + * 子菜单列表 + */ + children?: Array | null; +}; + diff --git a/src/api/rbac/generated/models/MenuType.ts b/src/api/rbac/generated/models/MenuType.ts new file mode 100644 index 0000000..9a33365 --- /dev/null +++ b/src/api/rbac/generated/models/MenuType.ts @@ -0,0 +1,8 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export enum MenuType { + '_1' = 1, + '_2' = 2, +} diff --git a/src/api/rbac/generated/models/MenuUpdateDto.ts b/src/api/rbac/generated/models/MenuUpdateDto.ts new file mode 100644 index 0000000..e30dad0 --- /dev/null +++ b/src/api/rbac/generated/models/MenuUpdateDto.ts @@ -0,0 +1,42 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/** + * 更新菜单 DTO + */ +export type MenuUpdateDto = { + /** + * 名称 + */ + name?: string | null; + /** + * 权限代码 + */ + permissionCode?: string | null; + /** + * 图标 + */ + icon?: string | null; + /** + * 路由 + */ + route?: string | null; + /** + * 组件 + */ + component?: string | null; + /** + * 是否隐藏 + */ + isHidden?: boolean | null; + /** + * 是否缓存 + */ + isCached?: boolean | null; + /** + * 描述 + */ + description?: string | null; +}; + diff --git a/src/api/rbac/generated/models/OrganizationCreateDto.ts b/src/api/rbac/generated/models/OrganizationCreateDto.ts new file mode 100644 index 0000000..01bdcea --- /dev/null +++ b/src/api/rbac/generated/models/OrganizationCreateDto.ts @@ -0,0 +1,16 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { OrganizationType } from './OrganizationType'; +export type OrganizationCreateDto = { + parentId?: string | null; + name?: string | null; + code?: string | null; + type?: OrganizationType; + leaderId?: string | null; + order?: number; + description?: string | null; + isEnabled?: boolean; +}; + diff --git a/src/api/rbac/generated/models/OrganizationDto.ts b/src/api/rbac/generated/models/OrganizationDto.ts new file mode 100644 index 0000000..c2da76f --- /dev/null +++ b/src/api/rbac/generated/models/OrganizationDto.ts @@ -0,0 +1,22 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { OrganizationType } from './OrganizationType'; +export type OrganizationDto = { + id?: string; + parentId?: string | null; + name?: string | null; + code?: string | null; + type?: OrganizationType; + leaderId?: string | null; + leaderName?: string | null; + order?: number; + description?: string | null; + isEnabled?: boolean; + createdBy?: string; + createdAt?: string; + updatedBy?: string; + updatedAt?: string; +}; + diff --git a/src/api/rbac/generated/models/OrganizationMoveDto.ts b/src/api/rbac/generated/models/OrganizationMoveDto.ts new file mode 100644 index 0000000..2c5840d --- /dev/null +++ b/src/api/rbac/generated/models/OrganizationMoveDto.ts @@ -0,0 +1,8 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export type OrganizationMoveDto = { + newParentId?: string | null; +}; + diff --git a/src/api/rbac/generated/models/OrganizationTreeDto.ts b/src/api/rbac/generated/models/OrganizationTreeDto.ts new file mode 100644 index 0000000..321c252 --- /dev/null +++ b/src/api/rbac/generated/models/OrganizationTreeDto.ts @@ -0,0 +1,18 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { OrganizationType } from './OrganizationType'; +export type OrganizationTreeDto = { + id?: string; + parentId?: string | null; + name?: string | null; + code?: string | null; + type?: OrganizationType; + leaderId?: string | null; + leaderName?: string | null; + order?: number; + isEnabled?: boolean; + children?: Array | null; +}; + diff --git a/src/api/rbac/generated/models/OrganizationType.ts b/src/api/rbac/generated/models/OrganizationType.ts new file mode 100644 index 0000000..8e5681d --- /dev/null +++ b/src/api/rbac/generated/models/OrganizationType.ts @@ -0,0 +1,6 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export type OrganizationType = 1 | 2 | 3; + diff --git a/src/api/rbac/generated/models/OrganizationUpdateDto.ts b/src/api/rbac/generated/models/OrganizationUpdateDto.ts new file mode 100644 index 0000000..bb5e759 --- /dev/null +++ b/src/api/rbac/generated/models/OrganizationUpdateDto.ts @@ -0,0 +1,14 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { OrganizationType } from './OrganizationType'; +export type OrganizationUpdateDto = { + name?: string | null; + type?: OrganizationType; + leaderId?: string | null; + order?: number | null; + description?: string | null; + isEnabled?: boolean | null; +}; + diff --git a/src/api/rbac/generated/models/PermissionDefinitionDto.ts b/src/api/rbac/generated/models/PermissionDefinitionDto.ts new file mode 100644 index 0000000..6329a3a --- /dev/null +++ b/src/api/rbac/generated/models/PermissionDefinitionDto.ts @@ -0,0 +1,30 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/** + * 权限定义 DTO + */ +export type PermissionDefinitionDto = { + /** + * 权限代码 + */ + code?: string | null; + /** + * 权限名称 + */ + name?: string | null; + /** + * 父级权限代码 + */ + parentCode?: string | null; + /** + * 描述 + */ + description?: string | null; + /** + * 子权限列表 + */ + children?: Array | null; +}; + diff --git a/src/api/rbac/generated/models/PermissionGroupDto.ts b/src/api/rbac/generated/models/PermissionGroupDto.ts new file mode 100644 index 0000000..f85f8d4 --- /dev/null +++ b/src/api/rbac/generated/models/PermissionGroupDto.ts @@ -0,0 +1,23 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { PermissionDefinitionDto } from './PermissionDefinitionDto'; +/** + * 权限分组 DTO + */ +export type PermissionGroupDto = { + /** + * 分组代码 + */ + code?: string | null; + /** + * 分组名称 + */ + name?: string | null; + /** + * 权限列表 + */ + permissions?: Array | null; +}; + diff --git a/src/api/rbac/generated/models/RoleCreateDto.ts b/src/api/rbac/generated/models/RoleCreateDto.ts new file mode 100644 index 0000000..54bab1b --- /dev/null +++ b/src/api/rbac/generated/models/RoleCreateDto.ts @@ -0,0 +1,22 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/** + * 创建角色 DTO + */ +export type RoleCreateDto = { + /** + * 名称 + */ + name: string; + /** + * 编码 + */ + code: string; + /** + * 权限列表 + */ + permissions?: Array | null; +}; + diff --git a/src/api/rbac/generated/models/RoleDto.ts b/src/api/rbac/generated/models/RoleDto.ts new file mode 100644 index 0000000..545cc2d --- /dev/null +++ b/src/api/rbac/generated/models/RoleDto.ts @@ -0,0 +1,27 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/** + * 角色 DTO + */ +export type RoleDto = { + id?: string; + createdAt?: string; + createdBy?: string | null; + updatedAt?: string | null; + updatedBy?: string | null; + /** + * 名称 + */ + name?: string | null; + /** + * 编码 + */ + code?: string | null; + /** + * 权限列表 + */ + permissions?: Array | null; +}; + diff --git a/src/api/rbac/generated/models/RoleDtoPagedResultDto.ts b/src/api/rbac/generated/models/RoleDtoPagedResultDto.ts new file mode 100644 index 0000000..57d6081 --- /dev/null +++ b/src/api/rbac/generated/models/RoleDtoPagedResultDto.ts @@ -0,0 +1,19 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { RoleDto } from './RoleDto'; +/** + * 分页结果 DTO + */ +export type RoleDtoPagedResultDto = { + /** + * 总数量 + */ + total?: number; + /** + * 数据列表 + */ + items?: Array | null; +}; + diff --git a/src/api/rbac/generated/models/RoleSimpleDto.ts b/src/api/rbac/generated/models/RoleSimpleDto.ts new file mode 100644 index 0000000..cfaa3c9 --- /dev/null +++ b/src/api/rbac/generated/models/RoleSimpleDto.ts @@ -0,0 +1,19 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/** + * 角色简单 DTO + */ +export type RoleSimpleDto = { + id?: string; + /** + * 名称 + */ + name?: string | null; + /** + * 编码 + */ + code?: string | null; +}; + diff --git a/src/api/rbac/generated/models/RoleUpdateDto.ts b/src/api/rbac/generated/models/RoleUpdateDto.ts new file mode 100644 index 0000000..419a906 --- /dev/null +++ b/src/api/rbac/generated/models/RoleUpdateDto.ts @@ -0,0 +1,14 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/** + * 更新角色 DTO + */ +export type RoleUpdateDto = { + /** + * 名称 + */ + name?: string | null; +}; + diff --git a/src/api/rbac/generated/models/UpdatePasswordDto.ts b/src/api/rbac/generated/models/UpdatePasswordDto.ts new file mode 100644 index 0000000..feb1380 --- /dev/null +++ b/src/api/rbac/generated/models/UpdatePasswordDto.ts @@ -0,0 +1,18 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/** + * 修改密码 DTO + */ +export type UpdatePasswordDto = { + /** + * 旧密码 + */ + oldPassword: string; + /** + * 新密码 + */ + newPassword: string; +}; + diff --git a/src/api/rbac/generated/models/UserCreateDto.ts b/src/api/rbac/generated/models/UserCreateDto.ts new file mode 100644 index 0000000..8c8c59d --- /dev/null +++ b/src/api/rbac/generated/models/UserCreateDto.ts @@ -0,0 +1,34 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/** + * 创建用户 DTO + */ +export type UserCreateDto = { + /** + * 名称 + */ + name: string; + /** + * 账号 + */ + account: string; + /** + * 密码 + */ + password: string; + /** + * 邮箱 + */ + email?: string | null; + /** + * 头像 + */ + avatar?: string | null; + /** + * 角色ID列表 + */ + roleIds?: Array | null; +}; + diff --git a/src/api/rbac/generated/models/UserDto.ts b/src/api/rbac/generated/models/UserDto.ts new file mode 100644 index 0000000..41f1f04 --- /dev/null +++ b/src/api/rbac/generated/models/UserDto.ts @@ -0,0 +1,36 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { RoleSimpleDto } from './RoleSimpleDto'; +/** + * 用户 DTO + */ +export type UserDto = { + id?: string; + createdAt?: string; + createdBy?: string | null; + updatedAt?: string | null; + updatedBy?: string | null; + /** + * 名称 + */ + name?: string | null; + /** + * 账号 + */ + account?: string | null; + /** + * 邮箱 + */ + email?: string | null; + /** + * 头像 + */ + avatar?: string | null; + /** + * 角色列表 + */ + roles?: Array | null; +}; + diff --git a/src/api/rbac/generated/models/UserDtoPagedResultDto.ts b/src/api/rbac/generated/models/UserDtoPagedResultDto.ts new file mode 100644 index 0000000..8443569 --- /dev/null +++ b/src/api/rbac/generated/models/UserDtoPagedResultDto.ts @@ -0,0 +1,19 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { UserDto } from './UserDto'; +/** + * 分页结果 DTO + */ +export type UserDtoPagedResultDto = { + /** + * 总数量 + */ + total?: number; + /** + * 数据列表 + */ + items?: Array | null; +}; + diff --git a/src/api/rbac/generated/models/UserInfoDto.ts b/src/api/rbac/generated/models/UserInfoDto.ts new file mode 100644 index 0000000..c6b217e --- /dev/null +++ b/src/api/rbac/generated/models/UserInfoDto.ts @@ -0,0 +1,45 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { MenuTreeDto } from './MenuTreeDto'; +import type { RoleSimpleDto } from './RoleSimpleDto'; +/** + * 用户信息 DTO(包含权限和菜单) + */ +export type UserInfoDto = { + id?: string; + createdAt?: string; + createdBy?: string | null; + updatedAt?: string | null; + updatedBy?: string | null; + /** + * 名称 + */ + name?: string | null; + /** + * 账号 + */ + account?: string | null; + /** + * 邮箱 + */ + email?: string | null; + /** + * 头像 + */ + avatar?: string | null; + /** + * 角色列表 + */ + roles?: Array | null; + /** + * 权限列表 + */ + permissions?: Array | null; + /** + * 菜单列表 + */ + menus?: Array | null; +}; + diff --git a/src/api/rbac/generated/models/UserSimpleDto.ts b/src/api/rbac/generated/models/UserSimpleDto.ts new file mode 100644 index 0000000..3ec2c04 --- /dev/null +++ b/src/api/rbac/generated/models/UserSimpleDto.ts @@ -0,0 +1,23 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/** + * 用户简单 DTO + */ +export type UserSimpleDto = { + id?: string; + /** + * 名称 + */ + name?: string | null; + /** + * 账号 + */ + account?: string | null; + /** + * 头像 + */ + avatar?: string | null; +}; + diff --git a/src/api/rbac/generated/models/UserUpdateDto.ts b/src/api/rbac/generated/models/UserUpdateDto.ts new file mode 100644 index 0000000..38be0d0 --- /dev/null +++ b/src/api/rbac/generated/models/UserUpdateDto.ts @@ -0,0 +1,22 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/** + * 更新用户 DTO + */ +export type UserUpdateDto = { + /** + * 名称 + */ + name?: string | null; + /** + * 邮箱 + */ + email?: string | null; + /** + * 头像 + */ + avatar?: string | null; +}; + diff --git a/src/api/rbac/generated/services/AuthService.ts b/src/api/rbac/generated/services/AuthService.ts new file mode 100644 index 0000000..0742e23 --- /dev/null +++ b/src/api/rbac/generated/services/AuthService.ts @@ -0,0 +1,76 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { UserInfoDto } from '../models/UserInfoDto'; +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; +export class AuthService { + /** + * @param account + * @param password + * @returns UserInfoDto Success + * @throws ApiError + */ + public static postRbacAuthLogin( + account?: string, + password?: string, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/rbac/auth/login', + query: { + 'account': account, + 'password': password, + }, + errors: { + 400: `Bad Request`, + }, + }); + } + /** + * @param userId + * @returns UserInfoDto Success + * @throws ApiError + */ + public static getRbacAuthGetCurrentUser( + userId?: string, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/rbac/auth/get-current-user', + query: { + 'userId': userId, + }, + errors: { + 400: `Bad Request`, + }, + }); + } + /** + * @param userId + * @param oldPassword + * @param newPassword + * @returns any Success + * @throws ApiError + */ + public static postRbacAuthChangePassword( + userId?: string, + oldPassword?: string, + newPassword?: string, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/rbac/auth/change-password', + query: { + 'userId': userId, + 'oldPassword': oldPassword, + 'newPassword': newPassword, + }, + errors: { + 400: `Bad Request`, + }, + }); + } +} diff --git a/src/api/rbac/generated/services/MenuService.ts b/src/api/rbac/generated/services/MenuService.ts new file mode 100644 index 0000000..b8100b9 --- /dev/null +++ b/src/api/rbac/generated/services/MenuService.ts @@ -0,0 +1,168 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { MenuCreateDto } from '../models/MenuCreateDto'; +import type { MenuDto } from '../models/MenuDto'; +import type { MenuTreeDto } from '../models/MenuTreeDto'; +import type { MenuUpdateDto } from '../models/MenuUpdateDto'; +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; +export class MenuService { + /** + * @param id + * @returns MenuDto Success + * @throws ApiError + */ + public static getRbacMenuGet( + id?: string, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/rbac/menu/get', + query: { + 'id': id, + }, + errors: { + 400: `Bad Request`, + }, + }); + } + /** + * @returns MenuTreeDto Success + * @throws ApiError + */ + public static getRbacMenuGetMenuTree(): CancelablePromise> { + return __request(OpenAPI, { + method: 'GET', + url: '/rbac/menu/get-menu-tree', + errors: { + 400: `Bad Request`, + }, + }); + } + /** + * @param userId + * @returns MenuTreeDto Success + * @throws ApiError + */ + public static getRbacMenuGetUserMenus( + userId?: string, + ): CancelablePromise> { + return __request(OpenAPI, { + method: 'GET', + url: '/rbac/menu/get-user-menus', + query: { + 'userId': userId, + }, + errors: { + 400: `Bad Request`, + }, + }); + } + /** + * @param requestBody + * @returns MenuDto Success + * @throws ApiError + */ + public static postRbacMenuCreate( + requestBody?: MenuCreateDto, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/rbac/menu/create', + body: requestBody, + mediaType: 'application/json', + errors: { + 400: `Bad Request`, + }, + }); + } + /** + * @param id + * @param requestBody + * @returns MenuDto Success + * @throws ApiError + */ + public static putRbacMenuUpdate( + id?: string, + requestBody?: MenuUpdateDto, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'PUT', + url: '/rbac/menu/update', + query: { + 'id': id, + }, + body: requestBody, + mediaType: 'application/json', + errors: { + 400: `Bad Request`, + }, + }); + } + /** + * @param id + * @param order + * @returns any Success + * @throws ApiError + */ + public static putRbacMenuUpdateOrder( + id?: string, + order?: number, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'PUT', + url: '/rbac/menu/update-order', + query: { + 'id': id, + 'order': order, + }, + errors: { + 400: `Bad Request`, + }, + }); + } + /** + * @param id + * @returns any Success + * @throws ApiError + */ + public static deleteRbacMenuDelete( + id?: string, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'DELETE', + url: '/rbac/menu/delete', + query: { + 'id': id, + }, + errors: { + 400: `Bad Request`, + }, + }); + } + /** + * @param menuId + * @param targetParentId + * @returns any Success + * @throws ApiError + */ + public static postRbacMenuMoveMenu( + menuId?: string, + targetParentId?: string, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/rbac/menu/move-menu', + query: { + 'menuId': menuId, + 'targetParentId': targetParentId, + }, + errors: { + 400: `Bad Request`, + }, + }); + } +} diff --git a/src/api/rbac/generated/services/OrganizationService.ts b/src/api/rbac/generated/services/OrganizationService.ts new file mode 100644 index 0000000..44085d5 --- /dev/null +++ b/src/api/rbac/generated/services/OrganizationService.ts @@ -0,0 +1,148 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { OrganizationCreateDto } from '../models/OrganizationCreateDto'; +import type { OrganizationDto } from '../models/OrganizationDto'; +import type { OrganizationMoveDto } from '../models/OrganizationMoveDto'; +import type { OrganizationTreeDto } from '../models/OrganizationTreeDto'; +import type { OrganizationUpdateDto } from '../models/OrganizationUpdateDto'; +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; +export class OrganizationService { + /** + * @returns OrganizationDto Success + * @throws ApiError + */ + public static getRbacOrganizationGet({ + id, + }: { + id?: string, + }): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/rbac/organization/get', + query: { + 'id': id, + }, + errors: { + 400: `Bad Request`, + }, + }); + } + /** + * @returns OrganizationDto Success + * @throws ApiError + */ + public static getRbacOrganizationGetList(): CancelablePromise> { + return __request(OpenAPI, { + method: 'GET', + url: '/rbac/organization/get-list', + errors: { + 400: `Bad Request`, + }, + }); + } + /** + * @returns OrganizationTreeDto Success + * @throws ApiError + */ + public static getRbacOrganizationGetTree(): CancelablePromise> { + return __request(OpenAPI, { + method: 'GET', + url: '/rbac/organization/get-tree', + errors: { + 400: `Bad Request`, + }, + }); + } + /** + * @returns OrganizationDto Success + * @throws ApiError + */ + public static postRbacOrganizationCreate({ + requestBody, + }: { + requestBody?: OrganizationCreateDto, + }): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/rbac/organization/create', + body: requestBody, + mediaType: 'application/json', + errors: { + 400: `Bad Request`, + }, + }); + } + /** + * @returns OrganizationDto Success + * @throws ApiError + */ + public static putRbacOrganizationUpdate({ + id, + requestBody, + }: { + id?: string, + requestBody?: OrganizationUpdateDto, + }): CancelablePromise { + return __request(OpenAPI, { + method: 'PUT', + url: '/rbac/organization/update', + query: { + 'id': id, + }, + body: requestBody, + mediaType: 'application/json', + errors: { + 400: `Bad Request`, + }, + }); + } + /** + * @returns any Success + * @throws ApiError + */ + public static deleteRbacOrganizationDelete({ + id, + }: { + id?: string, + }): CancelablePromise { + return __request(OpenAPI, { + method: 'DELETE', + url: '/rbac/organization/delete', + query: { + 'id': id, + }, + errors: { + 400: `Bad Request`, + }, + }); + } + /** + * @returns any Success + * @throws ApiError + */ + public static postRbacOrganizationMove({ + id, + requestBody, + }: { + id?: string, + requestBody?: OrganizationMoveDto, + }): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/rbac/organization/move', + query: { + 'id': id, + }, + body: requestBody, + mediaType: 'application/json', + errors: { + 400: `Bad Request`, + }, + }); + } +} + diff --git a/src/api/rbac/generated/services/PermissionService.ts b/src/api/rbac/generated/services/PermissionService.ts new file mode 100644 index 0000000..d7eba36 --- /dev/null +++ b/src/api/rbac/generated/services/PermissionService.ts @@ -0,0 +1,82 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { PermissionDefinitionDto } from '../models/PermissionDefinitionDto'; +import type { PermissionGroupDto } from '../models/PermissionGroupDto'; +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; +export class PermissionService { + /** + * @returns PermissionDefinitionDto Success + * @throws ApiError + */ + public static getRbacPermissionGetAllPermissions(): CancelablePromise> { + return __request(OpenAPI, { + method: 'GET', + url: '/rbac/permission/get-all-permissions', + errors: { + 400: `Bad Request`, + }, + }); + } + /** + * @returns PermissionGroupDto Success + * @throws ApiError + */ + public static getRbacPermissionGetPermissionTree(): CancelablePromise> { + return __request(OpenAPI, { + method: 'GET', + url: '/rbac/permission/get-permission-tree', + errors: { + 400: `Bad Request`, + }, + }); + } + /** + * @param userId + * @param permissionCode + * @returns boolean Success + * @throws ApiError + */ + public static postRbacPermissionCheckPermission( + userId?: string, + permissionCode?: string, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/rbac/permission/check-permission', + query: { + 'userId': userId, + 'permissionCode': permissionCode, + }, + errors: { + 400: `Bad Request`, + }, + }); + } + /** + * @param userId + * @param requestBody + * @returns boolean Success + * @throws ApiError + */ + public static postRbacPermissionCheckPermissions( + userId?: string, + requestBody?: Array, + ): CancelablePromise> { + return __request(OpenAPI, { + method: 'POST', + url: '/rbac/permission/check-permissions', + query: { + 'userId': userId, + }, + body: requestBody, + mediaType: 'application/json', + errors: { + 400: `Bad Request`, + }, + }); + } +} diff --git a/src/api/rbac/generated/services/RoleService.ts b/src/api/rbac/generated/services/RoleService.ts new file mode 100644 index 0000000..805d976 --- /dev/null +++ b/src/api/rbac/generated/services/RoleService.ts @@ -0,0 +1,218 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { RoleCreateDto } from '../models/RoleCreateDto'; +import type { RoleDto } from '../models/RoleDto'; +import type { RoleDtoPagedResultDto } from '../models/RoleDtoPagedResultDto'; +import type { RoleSimpleDto } from '../models/RoleSimpleDto'; +import type { RoleUpdateDto } from '../models/RoleUpdateDto'; +import type { UserSimpleDto } from '../models/UserSimpleDto'; +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; +export class RoleService { + /** + * @param id + * @returns RoleDto Success + * @throws ApiError + */ + public static getRbacRoleGet( + id?: string, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/rbac/role/get', + query: { + 'id': id, + }, + errors: { + 400: `Bad Request`, + }, + }); + } + /** + * @param keyword 关键字(搜索名称或编码) + * @param page 页码(从1开始) + * @param pageSize 每页数量 + * @param orderBy 排序字段 + * @param descending 是否降序 + * @returns RoleDtoPagedResultDto Success + * @throws ApiError + */ + public static getRbacRoleGetList( + keyword?: string, + page?: number, + pageSize?: number, + orderBy?: string, + descending?: boolean, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/rbac/role/get-list', + query: { + 'Keyword': keyword, + 'Page': page, + 'PageSize': pageSize, + 'OrderBy': orderBy, + 'Descending': descending, + }, + errors: { + 400: `Bad Request`, + }, + }); + } + /** + * @returns RoleSimpleDto Success + * @throws ApiError + */ + public static getRbacRoleGetAllRoles(): CancelablePromise> { + return __request(OpenAPI, { + method: 'GET', + url: '/rbac/role/get-all-roles', + errors: { + 400: `Bad Request`, + }, + }); + } + /** + * @param requestBody + * @returns RoleDto Success + * @throws ApiError + */ + public static postRbacRoleCreate( + requestBody?: RoleCreateDto, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/rbac/role/create', + body: requestBody, + mediaType: 'application/json', + errors: { + 400: `Bad Request`, + }, + }); + } + /** + * @param id + * @param requestBody + * @returns RoleDto Success + * @throws ApiError + */ + public static putRbacRoleUpdate( + id?: string, + requestBody?: RoleUpdateDto, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'PUT', + url: '/rbac/role/update', + query: { + 'id': id, + }, + body: requestBody, + mediaType: 'application/json', + errors: { + 400: `Bad Request`, + }, + }); + } + /** + * @param id + * @returns any Success + * @throws ApiError + */ + public static deleteRbacRoleDelete( + id?: string, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'DELETE', + url: '/rbac/role/delete', + query: { + 'id': id, + }, + errors: { + 400: `Bad Request`, + }, + }); + } + /** + * @param roleId + * @param requestBody + * @returns any Success + * @throws ApiError + */ + public static postRbacRoleAssignPermissions( + roleId?: string, + requestBody?: Array, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/rbac/role/assign-permissions', + query: { + 'roleId': roleId, + }, + body: requestBody, + mediaType: 'application/json', + errors: { + 400: `Bad Request`, + }, + }); + } + /** + * @param roleId + * @returns string Success + * @throws ApiError + */ + public static getRbacRoleGetRolePermissions( + roleId?: string, + ): CancelablePromise> { + return __request(OpenAPI, { + method: 'GET', + url: '/rbac/role/get-role-permissions', + query: { + 'roleId': roleId, + }, + errors: { + 400: `Bad Request`, + }, + }); + } + /** + * @param roleId + * @returns UserSimpleDto Success + * @throws ApiError + */ + public static getRbacRoleGetRoleUsers( + roleId?: string, + ): CancelablePromise> { + return __request(OpenAPI, { + method: 'GET', + url: '/rbac/role/get-role-users', + query: { + 'roleId': roleId, + }, + errors: { + 400: `Bad Request`, + }, + }); + } + /** + * @param roleId + * @returns number Success + * @throws ApiError + */ + public static getRbacRoleGetRoleUserCount( + roleId?: string, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/rbac/role/get-role-user-count', + query: { + 'roleId': roleId, + }, + errors: { + 400: `Bad Request`, + }, + }); + } +} diff --git a/src/api/rbac/generated/services/UserService.ts b/src/api/rbac/generated/services/UserService.ts new file mode 100644 index 0000000..2df4818 --- /dev/null +++ b/src/api/rbac/generated/services/UserService.ts @@ -0,0 +1,295 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { RoleDto } from '../models/RoleDto'; +import type { UpdatePasswordDto } from '../models/UpdatePasswordDto'; +import type { UserCreateDto } from '../models/UserCreateDto'; +import type { UserDto } from '../models/UserDto'; +import type { UserDtoPagedResultDto } from '../models/UserDtoPagedResultDto'; +import type { UserSimpleDto } from '../models/UserSimpleDto'; +import type { UserUpdateDto } from '../models/UserUpdateDto'; +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; +export class UserService { + /** + * @param id + * @returns UserDto Success + * @throws ApiError + */ + public static getRbacUserGet( + id?: string, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/rbac/user/get', + query: { + 'id': id, + }, + errors: { + 400: `Bad Request`, + }, + }); + } + /** + * @param keyword 关键字(搜索名称或账号) + * @param roleId 角色ID + * @param page 页码(从1开始) + * @param pageSize 每页数量 + * @param orderBy 排序字段 + * @param descending 是否降序 + * @returns UserDtoPagedResultDto Success + * @throws ApiError + */ + public static getRbacUserGetList( + keyword?: string, + roleId?: string, + page?: number, + pageSize?: number, + orderBy?: string, + descending?: boolean, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/rbac/user/get-list', + query: { + 'Keyword': keyword, + 'RoleId': roleId, + 'Page': page, + 'PageSize': pageSize, + 'OrderBy': orderBy, + 'Descending': descending, + }, + errors: { + 400: `Bad Request`, + }, + }); + } + /** + * @param roleId + * @returns UserSimpleDto Success + * @throws ApiError + */ + public static getRbacUserGetUsersByRole( + roleId?: string, + ): CancelablePromise> { + return __request(OpenAPI, { + method: 'GET', + url: '/rbac/user/get-users-by-role', + query: { + 'roleId': roleId, + }, + errors: { + 400: `Bad Request`, + }, + }); + } + /** + * @param requestBody + * @returns UserDto Success + * @throws ApiError + */ + public static postRbacUserCreate( + requestBody?: UserCreateDto, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/rbac/user/create', + body: requestBody, + mediaType: 'application/json', + errors: { + 400: `Bad Request`, + }, + }); + } + /** + * @param id + * @param requestBody + * @returns UserDto Success + * @throws ApiError + */ + public static putRbacUserUpdate( + id?: string, + requestBody?: UserUpdateDto, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'PUT', + url: '/rbac/user/update', + query: { + 'id': id, + }, + body: requestBody, + mediaType: 'application/json', + errors: { + 400: `Bad Request`, + }, + }); + } + /** + * @param id + * @param requestBody + * @returns any Success + * @throws ApiError + */ + public static putRbacUserUpdatePassword( + id?: string, + requestBody?: UpdatePasswordDto, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'PUT', + url: '/rbac/user/update-password', + query: { + 'id': id, + }, + body: requestBody, + mediaType: 'application/json', + errors: { + 400: `Bad Request`, + }, + }); + } + /** + * @param id + * @param avatarUrl + * @returns any Success + * @throws ApiError + */ + public static putRbacUserUpdateAvatar( + id?: string, + avatarUrl?: string, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'PUT', + url: '/rbac/user/update-avatar', + query: { + 'id': id, + 'avatarUrl': avatarUrl, + }, + errors: { + 400: `Bad Request`, + }, + }); + } + /** + * @param id + * @returns any Success + * @throws ApiError + */ + public static deleteRbacUserDelete( + id?: string, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'DELETE', + url: '/rbac/user/delete', + query: { + 'id': id, + }, + errors: { + 400: `Bad Request`, + }, + }); + } + /** + * @param ids + * @returns any Success + * @throws ApiError + */ + public static deleteRbacUserDeleteBatch( + ids?: Array, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'DELETE', + url: '/rbac/user/delete-batch', + query: { + 'ids': ids, + }, + errors: { + 400: `Bad Request`, + }, + }); + } + /** + * @param userId + * @param requestBody + * @returns any Success + * @throws ApiError + */ + public static postRbacUserAssignRoles( + userId?: string, + requestBody?: Array, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/rbac/user/assign-roles', + query: { + 'userId': userId, + }, + body: requestBody, + mediaType: 'application/json', + errors: { + 400: `Bad Request`, + }, + }); + } + /** + * @param userId + * @returns RoleDto Success + * @throws ApiError + */ + public static getRbacUserGetUserRoles( + userId?: string, + ): CancelablePromise> { + return __request(OpenAPI, { + method: 'GET', + url: '/rbac/user/get-user-roles', + query: { + 'userId': userId, + }, + errors: { + 400: `Bad Request`, + }, + }); + } + /** + * @param userId + * @returns string Success + * @throws ApiError + */ + public static getRbacUserGetUserPermissions( + userId?: string, + ): CancelablePromise> { + return __request(OpenAPI, { + method: 'GET', + url: '/rbac/user/get-user-permissions', + query: { + 'userId': userId, + }, + errors: { + 400: `Bad Request`, + }, + }); + } + /** + * @param userId + * @param permissionCode + * @returns boolean Success + * @throws ApiError + */ + public static postRbacUserHasPermission( + userId?: string, + permissionCode?: string, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/rbac/user/has-permission', + query: { + 'userId': userId, + 'permissionCode': permissionCode, + }, + errors: { + 400: `Bad Request`, + }, + }); + } +} diff --git a/src/api/rbac/index.ts b/src/api/rbac/index.ts new file mode 100644 index 0000000..ec2023e --- /dev/null +++ b/src/api/rbac/index.ts @@ -0,0 +1,42 @@ +/** + * API 统一导出 + * 使用自动生成的 Service + */ + +// 导出所有生成的类型和服务 +export * from './generated' + +// 配置 API +import { OpenAPI } from './generated/core/OpenAPI' +import { axiosInstance } from './axios-config' + +// 设置基础 URL +// 生产环境和开发环境都使用相对路径,通过 nginx/Vite 代理转发 +// 生产环境:通过 nginx 代理 /rbac -> http://43.139.210.35:5281 +// 开发环境:通过 Vite 代理 /rbac -> http://43.139.210.35:5281 +OpenAPI.BASE = '' + +// 调试信息 +const isProduction = (import.meta as any).env?.MODE === 'production' || (import.meta as any).env?.PROD === true +if (isProduction) { + console.log('[RBAC Config] Production mode: BASE =', OpenAPI.BASE, '(using nginx proxy)') +} else { + console.log('[RBAC Config] Development mode: BASE =', OpenAPI.BASE, '(using Vite proxy)') +} + +// 认证 token 管理 +export function setAuthToken(token: string) { + OpenAPI.TOKEN = token +} + +export function clearAuthToken() { + OpenAPI.TOKEN = undefined +} + +// 获取当前 token +export function getAuthToken() { + return OpenAPI.TOKEN +} + +// 导出 axios 实例供其他地方使用 +export { axiosInstance } diff --git a/src/components/menu/use-menu-tree.ts b/src/components/menu/use-menu-tree.ts index 15640c9..7862107 100644 --- a/src/components/menu/use-menu-tree.ts +++ b/src/components/menu/use-menu-tree.ts @@ -1,47 +1,56 @@ import { computed } from 'vue'; import { RouteRecordRaw, RouteRecordNormalized } from 'vue-router'; -import usePermission from '@/hooks/permission'; +import router from '@/router'; import { useAppStore, useAuthStore } from '@/store'; import appClientMenus from '@/router/app-menus'; -import { cloneDeep } from 'lodash'; import { getRouteName } from '@/utils/route-name-mapper'; +// 缓存模块映射,避免每次计算都执行 import.meta.glob(兼容非 Vite 环境) +const modules: Record = {}; + export default function useMenuTree() { - const permission = usePermission(); const appStore = useAppStore(); const authStore = useAuthStore(); - const appRoute = computed(() => { - // 优先使用授权菜单(如果存在) - if (authStore.authMenuListGet.length > 0) { - console.log('使用授权菜单,菜单数量:', authStore.authMenuListGet.length); - console.log('显示菜单列表:', authStore.showMenuListGet); - // 将授权菜单转换为路由格式 - const routes = convertMenuToRoute(authStore.showMenuListGet); - console.log('转换后的路由:', routes); - return routes as RouteRecordNormalized[]; + const appRoute = computed(() => { + // 完全使用前端静态路由,不依赖后端、不做过滤 + if (appClientMenus && appClientMenus.length) { + return appClientMenus as RouteRecordNormalized[]; } - // 其次使用服务器菜单 - if (appStore.menuFromServer && appStore.appAsyncMenus.length > 0) { - console.log('使用服务器菜单'); - return appStore.appAsyncMenus; - } - // 最后使用客户端菜单 - console.log('使用客户端菜单'); - return appClientMenus; + // 兜底:当静态菜单尚未就绪时,从 router 已注册路由构建菜单,避免初次进入为空白 + const staticRoutes = router + .getRoutes() + .filter((r) => r.meta?.requiresAuth && r.path && r.path !== '/'); + return staticRoutes.map((r) => ({ + path: r.path, + name: r.name, + meta: r.meta, + redirect: r.redirect, + children: r.children, + })) as RouteRecordRaw[]; }); + // 组件路径映射:将不存在的路径映射到实际存在的路径 + const componentPathMap: Record = { + 'home/index': 'dashboard/workplace/index', + 'home': 'dashboard/workplace/index', + }; + /** 将菜单转换为路由格式 */ function convertMenuToRoute(menuList: any[]): RouteRecordRaw[] { if (!menuList || !Array.isArray(menuList) || menuList.length === 0) { - console.warn('菜单列表为空或格式不正确'); return []; } - return menuList.map((menu) => { + return menuList.map((menu, index) => { // 确保菜单有必要的字段 if (!menu) { - console.warn('菜单项为空,跳过'); + return null; + } + + // 过滤掉特殊的"系统首页"菜单(category 为 "SPA" 且 module 为 null 的菜单) + // 这类菜单通常是从其他地方自动添加的,不应该显示在导航菜单中 + if (menu.category === 'SPA' && (menu.module === null || menu.module === undefined)) { return null; } @@ -52,10 +61,15 @@ export default function useMenuTree() { name: menu.name, }); - const route: RouteRecordRaw = { + // 生成唯一的路由名称,基于菜单的唯一标识符(code、path 或 name) + // 使用稳定的标识符而不是随机数,确保每次计算都生成相同的名称 + const uniqueId = menu.code || menu.path || menu.name || `menu_${index}`; + const fallbackName = routeName || uniqueId.toString().replace(/[^a-zA-Z0-9]/g, '_'); + + const route = { path: menu.path || (menu.name ? `/${menu.name}` : '/'), // 使用映射的路由名称,如果没有则使用路径生成,最后兜底 - name: routeName || menu.path?.replace(/\//g, '') || `menu_${Math.random()}`, + name: fallbackName, meta: { ...(menu.meta || {}), locale: menu.meta?.title || menu.meta?.locale || menu.title || menu.name || '', @@ -67,11 +81,10 @@ export default function useMenuTree() { children: menu.children && Array.isArray(menu.children) && menu.children.length > 0 ? convertMenuToRoute(menu.children).filter(Boolean) as RouteRecordRaw[] : undefined, - }; + } as RouteRecordRaw; // 如果有组件路径,设置组件 if (menu.component && typeof menu.component === 'string') { - const modules = import.meta.glob('@/views/**/*.vue'); // 后端返回的 component 一般是类似: // - 'views/dashboard/workplace/index' // - 'trajectoryCenter/trajectoryOrder/index' @@ -81,35 +94,43 @@ export default function useMenuTree() { componentPath = componentPath.replace(/^@\/views\//, '').replace(/^\/src\/views\//, ''); // 如果还带有 'views/' 前缀,也去掉一次 componentPath = componentPath.replace(/^views\//, ''); + + // 检查是否需要映射 + if (componentPathMap[componentPath]) { + componentPath = componentPathMap[componentPath]; + } + const fullPath = `/src/views/${componentPath}.vue`; if (modules[fullPath]) { route.component = modules[fullPath]; - } else { - console.warn(`组件路径不存在: ${fullPath}`); } + // 如果组件不存在,不设置 component,让路由使用默认布局或父路由的布局 + // 这样路由仍然可以工作,只是没有对应的组件 } return route; }).filter(Boolean) as RouteRecordRaw[]; } const menuTree = computed(() => { - const copyRouter = cloneDeep(appRoute.value) as RouteRecordNormalized[]; - copyRouter.sort((a: RouteRecordNormalized, b: RouteRecordNormalized) => { - return (a.meta.order || 0) - (b.meta.order || 0); - }); + // 如果 appRoute 为空,直接返回空数组 + if (!appRoute.value || appRoute.value.length === 0) { + return []; + } + + // 使用浅拷贝而不是深拷贝,因为后续操作不会修改原始对象 + const routes = [...(appRoute.value as RouteRecordRaw[])]; + + // 先排序 + routes.sort((a, b) => (a.meta?.order || 0) - (b.meta?.order || 0)); + function travel(_routes: RouteRecordRaw[], layer: number) { - if (!_routes) return null; - - const collector: any = _routes.map((element) => { - // no access - if (!permission.accessRouter(element)) { - return null; - } + if (!_routes || _routes.length === 0) return []; + const collector = (_routes as RouteRecordRaw[]).map((element) => { // leaf node if (element.meta?.hideChildrenInMenu || !element.children) { element.children = []; - return element; + return element as RouteRecordRaw; } // route filter hideInMenu true @@ -127,23 +148,23 @@ export default function useMenuTree() { if (subItem.length) { element.children = subItem; - return element; + return element as RouteRecordRaw; } // the else logic if (layer > 1) { element.children = subItem; - return element; + return element as RouteRecordRaw; } if (element.meta?.hideInMenu === false) { - return element; + return element as RouteRecordRaw; } return null; }); - return collector.filter(Boolean); + return collector.filter(Boolean) as RouteRecordRaw[]; } - return travel(copyRouter, 0); + return travel(routes, 0); }); return { diff --git a/src/components/navbar/Message.vue b/src/components/navbar/Message.vue index abe5e5f..3cec591 100644 --- a/src/components/navbar/Message.vue +++ b/src/components/navbar/Message.vue @@ -142,9 +142,10 @@ return newUnRead.value.filter((item) => item.category === category); } - /** 显示更多 - 跳转到站内信页面 */ + /** 显示更多 - 站内信功能已移除 */ function toMessage() { - router.push({ name: 'UserMessage' }); + // 站内信功能已移除,不再跳转 + console.log('站内信功能已移除'); } diff --git a/src/components/top-nav/RightTopMessage.vue b/src/components/top-nav/RightTopMessage.vue index e74d339..7ac185c 100644 --- a/src/components/top-nav/RightTopMessage.vue +++ b/src/components/top-nav/RightTopMessage.vue @@ -108,16 +108,10 @@ const onMessageDropdownVisibleChange = (visible: boolean) => { } }; -// 点击菜单项 +// 点击菜单项 - 站内信功能已移除 const onMessageMenuClick = (event: any) => { - const { key } = event; - if (key === 'notification') { - router.push({ name: 'UserMessage', query: { type: 'notification' } }); - } else if (key === 'message') { - router.push({ name: 'UserMessage', query: { type: 'message' } }); - } else if (key === 'notice') { - router.push({ name: 'UserMessage', query: { type: 'notice' } }); - } + // 站内信功能已移除,不再跳转 + console.log('站内信功能已移除'); }; onMounted(() => { diff --git a/src/components/top-nav/index.vue b/src/components/top-nav/index.vue index 4abe5f1..691a23c 100644 --- a/src/components/top-nav/index.vue +++ b/src/components/top-nav/index.vue @@ -28,35 +28,46 @@ class="cursor-pointer hover:text-blue-600 text-gray-800" @click="() => goto(menuItem)" > - {{ formatMenuTitle(menuItem.title || menuItem.meta?.locale) }} + {{ formatMenuTitle(menuItem.name || menuItem.meta?.title) }} - - {{ formatMenuTitle(item.title || item.meta?.locale) }} - + {{ formatMenuTitle(item.name || item.meta?.title) }} + - - {{ formatMenuTitle(item.title || item.meta?.locale) }} - + {{ formatMenuTitle(item.name || item.meta?.title) }} + @@ -158,52 +169,214 @@ @@ -386,7 +600,8 @@ onMounted(() => { border-radius: 20px; white-space: nowrap; transition: all 0.3s ease; - margin: 0 4px; + margin: 0 16px; + cursor: pointer; &:hover, &.active { diff --git a/src/composables/useSystemConfig.ts b/src/composables/useSystemConfig.ts index a3ccf5e..8f125b1 100644 --- a/src/composables/useSystemConfig.ts +++ b/src/composables/useSystemConfig.ts @@ -1,5 +1,6 @@ import { ref } from 'vue'; -import { sysSysInfoGet } from '@/api/SimpleAdmin/common'; +// RBAC 系统暂不使用系统配置接口 +// import { sysSysInfoGet } from '@/api/SimpleAdmin/common'; /** * 系统配置 composable @@ -16,49 +17,20 @@ export function useSystemConfig() { const logoUrl = ref(''); /** - * 获取系统配置 + * 获取系统配置 - RBAC 系统使用默认值 */ const fetchSysInfo = async () => { try { loading.value = true; - const res = await sysSysInfoGet(); - const data = (res as any)?.data || res || {}; - console.log('获取系统配置:', data); - - // 如果返回的是数组格式(配置项列表),需要转换为对象 - if (Array.isArray(data)) { - const configObj: any = {}; - data.forEach((item: any) => { - if (item.configKey && item.configValue !== undefined) { - configObj[item.configKey] = item.configValue; - } - }); - console.log('转换后的配置对象:', configObj); - console.log('SYS_LOGO值:', configObj.SYS_LOGO); - sysInfo.value = configObj; - - // 如果有logo URL,设置图片URL - if (configObj.SYS_LOGO) { - loadLogoImage(configObj.SYS_LOGO); - } else { - logoUrl.value = '/src/assets/logo.png'; - } - - return configObj; - } else { - // 如果已经是对象格式,直接使用 - console.log('SYS_LOGO值:', data.SYS_LOGO); - sysInfo.value = data; - - // 如果有logo URL,设置图片URL - if (data.SYS_LOGO) { - loadLogoImage(data.SYS_LOGO); - } else { - logoUrl.value = '/src/assets/logo.png'; - } - - return data; - } + // RBAC 系统使用默认配置 + const defaultConfig = { + SYS_NAME: '哪哪发物流', + SYS_VERSION: 'v1.0.0', + SYS_LOGO: '/src/assets/logo.png', + }; + sysInfo.value = defaultConfig; + logoUrl.value = defaultConfig.SYS_LOGO; + return defaultConfig; } catch (error) { console.error('获取系统配置失败', error); return {}; diff --git a/src/locale/en-US.ts b/src/locale/en-US.ts index 1964988..89ac1ee 100644 --- a/src/locale/en-US.ts +++ b/src/locale/en-US.ts @@ -23,8 +23,6 @@ import locale403 from '@/views/exception/403/locale/en-US'; import locale404 from '@/views/exception/404/locale/en-US'; import locale500 from '@/views/exception/500/locale/en-US'; -import localeUserSetting from '@/views/user/setting/locale/en-US'; - import localeSettings from './en-US/settings'; export default { @@ -65,8 +63,6 @@ export default { 'menu.visualization.dataAnalysis': 'Analysis', 'menu.visualization.multiDimensionDataAnalysis': 'Multi-Dimension Data Analysis', 'menu.user': 'User Center', - 'menu.user.setting': 'Settings', - 'menu.user.message': 'Messages', 'menu.user.recharge': 'Recharge', 'menu.user.rechargeRecord': 'Recharge Records', 'menu.arcoWebsite': 'Arco Design', @@ -114,6 +110,7 @@ export default { 'menu.api.apiDebugger': 'API Debugger', 'menu.system': 'System', 'menu.system.org': 'Organization', + 'menu.system.organization': 'Organization', 'menu.system.user': 'User', 'menu.system.position': 'Position', 'menu.system.role': 'Role', @@ -1925,5 +1922,4 @@ export default { ...locale403, ...locale404, ...locale500, - ...localeUserSetting, }; diff --git a/src/locale/zh-CN.ts b/src/locale/zh-CN.ts index 6098891..3e536b6 100644 --- a/src/locale/zh-CN.ts +++ b/src/locale/zh-CN.ts @@ -23,8 +23,6 @@ import locale403 from '@/views/exception/403/locale/zh-CN'; import locale404 from '@/views/exception/404/locale/zh-CN'; import locale500 from '@/views/exception/500/locale/zh-CN'; -import localeUserSetting from '@/views/user/setting/locale/zh-CN'; - import localeSettings from './zh-CN/settings'; export default { @@ -65,8 +63,6 @@ export default { 'menu.visualization.dataAnalysis': '分析页', 'menu.visualization.multiDimensionDataAnalysis': '多维度数据分析', 'menu.user': '个人', - 'menu.user.setting': '个人设置', - 'menu.user.message': '站内信', 'menu.user.recharge': '资金充值', 'menu.user.rechargeRecord': '充值记录', 'menu.arcoWebsite': 'Arco Design', @@ -114,6 +110,7 @@ export default { 'menu.api.apiDebugger': 'API调试', 'menu.system': '系统', 'menu.system.org': '组织管理', + 'menu.system.organization': '组织管理', 'menu.system.user': '用户管理', 'menu.system.position': '职位管理', 'menu.system.role': '角色管理', @@ -1916,5 +1913,4 @@ export default { ...locale403, ...locale404, ...locale500, - ...localeUserSetting, }; diff --git a/src/main.ts b/src/main.ts index 6521f81..75e2b75 100644 --- a/src/main.ts +++ b/src/main.ts @@ -16,6 +16,8 @@ import globalProperties from './plugins/globalProperties'; import './mock'; // 导入 ECharts 配置,确保组件在应用启动时注册 import './utils/echarts'; +// 初始化 RBAC token(从localStorage恢复) +import { setAuthToken } from './api/rbac'; import App from './App.vue'; // Styles are imported via arco-plugin. See config/plugin/arcoStyleImport.ts in the directory for details // 样式通过 arco-plugin 插件导入。详见目录文件 config/plugin/arcoStyleImport.ts @@ -130,4 +132,11 @@ watch(() => i18n.global.locale.value, () => { setupVxeTableI18n(); }); +// 初始化 RBAC token(从localStorage恢复) +// 优先使用新的 access_token,兼容旧的 rbac_token +const rbacAccessToken = localStorage.getItem('rbac_access_token') || localStorage.getItem('rbac_token'); +if (rbacAccessToken) { + setAuthToken(rbacAccessToken); +} + app.mount('#app'); diff --git a/src/mock/index.ts b/src/mock/index.ts index 90a33db..faec7d3 100644 --- a/src/mock/index.ts +++ b/src/mock/index.ts @@ -17,8 +17,6 @@ import '@/views/profile/basic/mock'; import '@/views/visualization/data-analysis/mock'; import '@/views/visualization/multi-dimension-data-analysis/mock'; -import '@/views/user/setting/mock'; - Mock.setup({ timeout: '600-1000', }); diff --git a/src/mock/user.ts b/src/mock/user.ts index df9fd58..32eeba1 100644 --- a/src/mock/user.ts +++ b/src/mock/user.ts @@ -71,7 +71,7 @@ setupMock({ Mock.mock(new RegExp('/api/user/menu'), () => { const menuList = [ { - path: '/dashboard', + path: '/home', name: 'home', meta: { locale: 'menu.server.home', diff --git a/src/router/constants.ts b/src/router/constants.ts index ded267c..77ef685 100644 --- a/src/router/constants.ts +++ b/src/router/constants.ts @@ -14,5 +14,5 @@ export const DEFAULT_ROUTE_NAME = 'Workplace'; export const DEFAULT_ROUTE = { title: 'menu.home.workplace', name: DEFAULT_ROUTE_NAME, - fullPath: '/dashboard/workplace', + fullPath: '/home/workplace', }; diff --git a/src/router/dynamicRouter.ts b/src/router/dynamicRouter.ts index 0c79324..da8d570 100644 --- a/src/router/dynamicRouter.ts +++ b/src/router/dynamicRouter.ts @@ -5,7 +5,7 @@ import { useAuthStore } from '@/store'; import router from '@/router'; import { getRouteName } from '@/utils/route-name-mapper'; -const HOME_URL = '/dashboard/workplace'; // 默认首页路径 +const HOME_URL = '/home/workplace'; // 默认首页路径 // 引入 views 文件夹下所有 vue 文件 const modules = import.meta.glob('@/views/**/*.vue'); @@ -53,17 +53,30 @@ export const initDynamicRouter = async () => { const chooseModule = userStore.chooseModuleGet; // 获取当前选择模块 let homePath: string = HOME_URL; // 首页路径 + console.log('初始化动态路由,选择的模块ID:', chooseModule); + if (!chooseModule) { + console.error('未选择模块'); return routerError(false, '请选择模块', '请先选择模块!'); } // 1.获取菜单列表 && 按钮权限列表(强制刷新,不使用缓存) - await authStore.getAuthMenuList(chooseModule, true); + try { + console.log('开始获取菜单列表,模块ID:', chooseModule); + await authStore.getAuthMenuList(chooseModule, true); + console.log('菜单列表获取成功,菜单数量:', authStore.authMenuListGet.length); + } catch (menuError: any) { + console.error('获取菜单列表失败:', menuError); + const errorMsg = menuError?.response?.data?.msg || menuError?.message || '获取菜单列表失败'; + return routerError(true, '获取菜单失败', errorMsg); + } + await authStore.getAuthButtonList(); // 2.判断当前用户有没有菜单权限 if (!authStore.authMenuListGet.length) { - return routerError(); + console.error('菜单列表为空,用户没有菜单权限'); + return routerError(true, '无权限访问', '当前账号在该模块下无任何菜单权限,请联系系统管理员!'); } // 获取首页路径 diff --git a/src/router/guard/permission.ts b/src/router/guard/permission.ts index ad3724e..3d3750a 100644 --- a/src/router/guard/permission.ts +++ b/src/router/guard/permission.ts @@ -3,15 +3,28 @@ import NProgress from 'nprogress'; // progress bar import usePermission from '@/hooks/permission'; import { useUserStore, useAppStore } from '@/store'; +import { useRbacUserStore } from '@/store/modules/rbac-user'; +import { hasPermission } from '@/utils/rbac-permission'; import { appRoutes } from '../routes'; import { WHITE_LIST, NOT_FOUND } from '../constants'; +import { Message } from '@arco-design/web-vue'; export default function setupPermissionGuard(router: Router) { router.beforeEach(async (to, from, next) => { const appStore = useAppStore(); const userStore = useUserStore(); + const rbacUserStore = useRbacUserStore(); const Permission = usePermission(); const permissionsAllow = Permission.accessRouter(to); + + // 检查 RBAC 权限 + if (to.meta?.permission) { + if (!hasPermission(to.meta.permission as string)) { + Message.error('没有权限访问该页面'); + next(from.path || '/'); + return; + } + } if (appStore.menuFromServer) { // 针对来自服务端的菜单配置进行处理 // Handle routing configuration from the server diff --git a/src/router/guard/userLoginInfo.ts b/src/router/guard/userLoginInfo.ts index 0971a68..773a202 100644 --- a/src/router/guard/userLoginInfo.ts +++ b/src/router/guard/userLoginInfo.ts @@ -2,8 +2,8 @@ import type { Router, LocationQueryRaw } from 'vue-router'; import NProgress from 'nprogress'; // progress bar import { useUserStore } from '@/store'; +import { useRbacUserStore } from '@/store/modules/rbac-user'; import { isLogin } from '@/utils/auth'; -import { sysAuthBGetLoginUserGet } from '@/api/SimpleAdmin/bEndPermissionVerify'; export default function setupUserLoginInfoGuard(router: Router) { // 标记是否已经获取过用户信息,避免重复请求 @@ -36,24 +36,32 @@ export default function setupUserLoginInfoGuard(router: Router) { if (!hasFetchedUserInfo) { hasFetchedUserInfo = true; try { - const res = await sysAuthBGetLoginUserGet(); - // request.ts 已经处理了响应格式,如果响应是 { code: 200, data: {...} },会直接返回 data - const userInfo = res?.data || res; - - if (userInfo && (userInfo.name || userInfo.accountId)) { - userStore.setInfo(userInfo as any); - next(); + // 使用 RBAC 系统获取用户信息 + const rbacUserStore = useRbacUserStore(); + if (rbacUserStore.userInfo?.id) { + // 从 RBAC store 获取用户信息 + await rbacUserStore.getCurrentUser(); + const rbacUserInfo = rbacUserStore.userInfo; + + if (rbacUserInfo) { + // 将 RBAC 用户信息转换为 itfx 用户信息格式 + const userInfo: any = { + account: rbacUserInfo.account, + name: rbacUserInfo.name || rbacUserInfo.account, + avatar: rbacUserInfo.avatar, + email: rbacUserInfo.email, + id: rbacUserInfo.id, + accountId: rbacUserInfo.id, // 兼容 accountId + defaultModule: undefined, + moduleList: [], + }; + userStore.setInfo(userInfo); + next(); + } else { + throw new Error('用户信息不存在'); + } } else { - // 获取用户信息失败,跳转到登录页 - hasFetchedUserInfo = false; - await userStore.logout(); - next({ - name: 'login', - query: { - redirect: to.name as string, - ...to.query, - } as LocationQueryRaw, - }); + throw new Error('用户未登录'); } } catch (error) { // 获取用户信息失败(可能是 token 过期),跳转到登录页 diff --git a/src/router/index.ts b/src/router/index.ts index 4965e04..e230a4b 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,4 +1,4 @@ -import { createRouter, createWebHashHistory } from 'vue-router'; +import { createRouter, createWebHistory } from 'vue-router'; import NProgress from 'nprogress'; // progress bar import 'nprogress/nprogress.css'; @@ -9,7 +9,7 @@ import createRouteGuard from './guard'; NProgress.configure({ showSpinner: false }); // NProgress Configuration const router = createRouter({ - history: createWebHashHistory(), + history: createWebHistory(), routes: [ { path: '/', diff --git a/src/router/routes/index.ts b/src/router/routes/index.ts index 3c84a53..9142c5d 100644 --- a/src/router/routes/index.ts +++ b/src/router/routes/index.ts @@ -1,6 +1,7 @@ import type { RouteRecordNormalized } from 'vue-router'; // 统一从 newModules 目录读取所有路由模块 +// 注意:路由配置需要同步加载,但路由组件本身是懒加载的 const modules = import.meta.glob('./newModules/*.ts', { eager: true }); const externalModules = import.meta.glob('./externalModules/*.ts', { eager: true, diff --git a/src/router/routes/newModules/dashboard.ts b/src/router/routes/newModules/dashboard.ts index a3ea961..8850e2c 100644 --- a/src/router/routes/newModules/dashboard.ts +++ b/src/router/routes/newModules/dashboard.ts @@ -2,7 +2,7 @@ import { DEFAULT_LAYOUT } from '../base'; import { AppRouteRecordRaw } from '../types'; const DASHBOARD: AppRouteRecordRaw = { - path: '/dashboard', + path: '/home', name: 'home', component: DEFAULT_LAYOUT, meta: { diff --git a/src/router/routes/newModules/form.ts b/src/router/routes/newModules/form.ts index 8b2cd16..5ffaab6 100644 --- a/src/router/routes/newModules/form.ts +++ b/src/router/routes/newModules/form.ts @@ -1,39 +1,2 @@ -import { DEFAULT_LAYOUT } from '../base'; -import { AppRouteRecordRaw } from '../types'; - -const FORM: AppRouteRecordRaw = { - path: '/form', - name: 'form', - component: DEFAULT_LAYOUT, - meta: { - locale: 'menu.form', - icon: 'icon-settings', - requiresAuth: true, - order: 3, - }, - children: [ - { - path: 'step', - name: 'Step', - component: () => import('@/views/form/step/index.vue'), - meta: { - locale: 'menu.form.step', - requiresAuth: true, - roles: ['admin'], - }, - }, - { - path: 'group', - name: 'Group', - component: () => import('@/views/form/group/index.vue'), - meta: { - locale: 'menu.form.group', - requiresAuth: true, - roles: ['admin'], - }, - }, - ], -}; - -export default FORM; +export default []; diff --git a/src/router/routes/newModules/organization.ts b/src/router/routes/newModules/organization.ts index addb9f0..5de666e 100644 --- a/src/router/routes/newModules/organization.ts +++ b/src/router/routes/newModules/organization.ts @@ -12,15 +12,6 @@ const ORGANIZATION: AppRouteRecordRaw = { order: 999, }, children: [ - { - path: 'org', - name: 'OrganizationOrg', - component: () => import('@/views/system/organization/org/index.vue'), - meta: { - locale: 'menu.system.org', - requiresAuth: true, - }, - }, { path: 'user', name: 'OrganizationUser', @@ -28,15 +19,7 @@ const ORGANIZATION: AppRouteRecordRaw = { meta: { locale: 'menu.system.user', requiresAuth: true, - }, - }, - { - path: 'position', - name: 'OrganizationPosition', - component: () => import('@/views/system/organization/position/index.vue'), - meta: { - locale: 'menu.system.position', - requiresAuth: true, + permission: 'Rbac.Users.Query', }, }, { @@ -46,15 +29,7 @@ const ORGANIZATION: AppRouteRecordRaw = { meta: { locale: 'menu.system.role', requiresAuth: true, - }, - }, - { - path: 'module', - name: 'OrganizationModule', - component: () => import('@/views/system/organization/module/index.vue'), - meta: { - locale: 'menu.system.module', - requiresAuth: true, + permission: 'Rbac.Roles.Query', }, }, { @@ -64,51 +39,17 @@ const ORGANIZATION: AppRouteRecordRaw = { meta: { locale: 'menu.system.menu', requiresAuth: true, + permission: 'Rbac.Menus.Query', }, }, { - path: 'dict', - name: 'OrganizationDict', - component: () => import('@/views/system/dict/index.vue'), + path: 'organizations', + name: 'OrganizationManagement', + component: () => import('@/views/system/organization/index.vue'), meta: { - locale: 'menu.system.dict', - requiresAuth: true, - }, - }, - { - path: 'config', - name: 'OrganizationConfig', - component: () => import('@/views/system/config/index.vue'), - meta: { - locale: 'menu.system.config', - requiresAuth: true, - }, - }, - { - path: 'announcement', - name: 'OrganizationAnnouncement', - component: () => import('@/views/system/announcement/index.vue'), - meta: { - locale: 'menu.system.announcement', - requiresAuth: true, - }, - }, - { - path: 'vislog', - name: 'OrganizationVisLog', - component: () => import('@/views/system/audit/vislog/index.vue'), - meta: { - locale: 'menu.system.vislog', - requiresAuth: true, - }, - }, - { - path: 'oplog', - name: 'OrganizationOpLog', - component: () => import('@/views/system/audit/oplog/index.vue'), - meta: { - locale: 'menu.system.oplog', + locale: 'menu.system.organization', requiresAuth: true, + permission: 'Rbac.Organizations.Query', }, }, ], diff --git a/src/router/routes/newModules/profile.ts b/src/router/routes/newModules/profile.ts index 4c396fc..d6d1738 100644 --- a/src/router/routes/newModules/profile.ts +++ b/src/router/routes/newModules/profile.ts @@ -1,28 +1 @@ -import { DEFAULT_LAYOUT } from '../base'; -import { AppRouteRecordRaw } from '../types'; - -const PROFILE: AppRouteRecordRaw = { - path: '/profile', - name: 'profile', - component: DEFAULT_LAYOUT, - meta: { - locale: 'menu.profile', - requiresAuth: true, - icon: 'icon-file', - order: 4, - }, - children: [ - { - path: 'basic', - name: 'Basic', - component: () => import('@/views/profile/basic/index.vue'), - meta: { - locale: 'menu.profile.basic', - requiresAuth: true, - roles: ['admin'], - }, - }, - ], -}; - -export default PROFILE; +export default []; diff --git a/src/router/routes/newModules/result.ts b/src/router/routes/newModules/result.ts index 7f4be06..5ffaab6 100644 --- a/src/router/routes/newModules/result.ts +++ b/src/router/routes/newModules/result.ts @@ -1,39 +1,2 @@ -import { DEFAULT_LAYOUT } from '../base'; -import { AppRouteRecordRaw } from '../types'; - -const RESULT: AppRouteRecordRaw = { - path: '/result', - name: 'result', - component: DEFAULT_LAYOUT, - meta: { - locale: 'menu.result', - icon: 'icon-check-circle', - requiresAuth: true, - order: 5, - }, - children: [ - { - path: 'success', - name: 'Success', - component: () => import('@/views/result/success/index.vue'), - meta: { - locale: 'menu.result.success', - requiresAuth: true, - roles: ['admin'], - }, - }, - { - path: 'error', - name: 'Error', - component: () => import('@/views/result/error/index.vue'), - meta: { - locale: 'menu.result.error', - requiresAuth: true, - roles: ['admin'], - }, - }, - ], -}; - -export default RESULT; +export default []; diff --git a/src/router/routes/newModules/system-management.ts b/src/router/routes/newModules/system-management.ts new file mode 100644 index 0000000..6226f37 --- /dev/null +++ b/src/router/routes/newModules/system-management.ts @@ -0,0 +1,59 @@ +import { DEFAULT_LAYOUT } from '../base'; +import { AppRouteRecordRaw } from '../types'; + +const SYSTEM_MANAGEMENT: AppRouteRecordRaw = { + path: '/system', + name: 'SystemManagement', + component: DEFAULT_LAYOUT, + meta: { + locale: 'menu.system', + icon: 'icon-settings', + requiresAuth: true, + order: 999, + }, + children: [ + { + path: 'users', + name: 'SystemUsers', + component: () => import('@/views/system/organization/user/index.vue'), + meta: { + locale: 'menu.system.user', + requiresAuth: true, + permission: 'Rbac.Users.Query', + }, + }, + { + path: 'roles', + name: 'SystemRoles', + component: () => import('@/views/system/permission/role/index.vue'), + meta: { + locale: 'menu.system.role', + requiresAuth: true, + permission: 'Rbac.Roles.Query', + }, + }, + { + path: 'menus', + name: 'SystemMenus', + component: () => import('@/views/system/permission/menu/index.vue'), + meta: { + locale: 'menu.system.menu', + requiresAuth: true, + permission: 'Rbac.Menus.Query', + }, + }, + { + path: 'organizations', + name: 'SystemOrganizations', + component: () => import('@/views/system/organization/index.vue'), + meta: { + locale: 'menu.system.organization', + requiresAuth: true, + permission: 'Rbac.Organizations.Query', + }, + }, + ], +}; + +export default SYSTEM_MANAGEMENT; + diff --git a/src/router/routes/newModules/system.ts b/src/router/routes/newModules/system.ts index 0890080..e04a184 100644 --- a/src/router/routes/newModules/system.ts +++ b/src/router/routes/newModules/system.ts @@ -2,8 +2,8 @@ import { DEFAULT_LAYOUT } from '../base'; import { AppRouteRecordRaw } from '../types'; const SYSTEM: AppRouteRecordRaw = { - path: '/system', - name: 'system', + path: '/api', + name: 'api', component: DEFAULT_LAYOUT, meta: { locale: 'menu.api', @@ -19,6 +19,7 @@ const SYSTEM: AppRouteRecordRaw = { meta: { locale: 'menu.api.upstreamInterface', requiresAuth: true, + permission: 'Api.Interfaces.Query', }, }, { @@ -29,6 +30,7 @@ const SYSTEM: AppRouteRecordRaw = { locale: 'menu.api.createInterface', requiresAuth: true, hideInMenu: true, + permission: 'Api.Interfaces.Create', }, }, { @@ -38,6 +40,7 @@ const SYSTEM: AppRouteRecordRaw = { meta: { locale: 'menu.api.downstreamInterface', requiresAuth: true, + permission: 'Api.ServiceProviders.Query', }, }, { @@ -46,21 +49,22 @@ const SYSTEM: AppRouteRecordRaw = { component: () => import('@/views/system/interface/interface-config.vue'), meta: { locale: 'menu.api.editInterface', - activeMenu: '/system/interface', + activeMenu: '/api/interface', hideInMenu: true, dynamicNewTab: true, requiresAuth: true, + permission: 'Api.Interfaces.Update', }, }, // { - // path: '/system/serviceProvider/serviceInterfaceList', + // path: '/api/serviceProvider/serviceInterfaceList', // name: 'ServiceInterfaceList', // component: () => // import('@/views/system/serviceProvidersList/serviceInterFaceIist.vue'), // meta: { // locale: '服务商接口列表', - // activeMenu: '/system/serviceProvider/serviceInterfaceList', + // activeMenu: '/api/serviceProvider/serviceInterfaceList', // hidden: true, // dynamicNewTab: true, // requiresAuth: true, @@ -68,12 +72,13 @@ const SYSTEM: AppRouteRecordRaw = { // }, { - path: '/system/newList/adhibition-list', + path: '/api/newList/adhibition-list', name: 'AdhibitionList', component: () => import('@/views/system/newList/adhibition-list.vue'), meta: { locale: 'menu.api.appList', requiresAuth: true, + permission: 'Api.Applications.Query', }, }, @@ -85,27 +90,30 @@ const SYSTEM: AppRouteRecordRaw = { meta: { locale: 'menu.api.requestLog', requiresAuth: true, + permission: 'Api.Logs.Query', }, }, { - path: '/system/applicationStatistics', + path: '/api/applicationStatistics', name: 'ApplicationStatistics', component: () => import('@/views/system/applicationStatistics.vue'), meta: { locale: 'menu.api.callStatistics', requiresAuth: true, + permission: 'Api.Statistics.Query', }, }, { - path: '/system/newList/createApplication', + path: '/api/newList/createApplication', name: 'CreateApplication', component: () => import('@/views/system/newList/createApplication.vue'), meta: { locale: 'menu.api.createApplication', requiresAuth: true, hideInMenu: true, + permission: 'Api.Applications.Create', }, }, @@ -119,6 +127,7 @@ const SYSTEM: AppRouteRecordRaw = { dynamicNewTab: false, hideInMenu: true, requiresAuth: true, + permission: 'Api.ServiceProviders.Create', }, }, @@ -129,6 +138,7 @@ const SYSTEM: AppRouteRecordRaw = { meta: { locale: 'menu.api.apiDebugger', requiresAuth: true, + permission: 'Api.Debugger.Query', }, }, ], diff --git a/src/router/routes/newModules/trajectory.ts b/src/router/routes/newModules/trajectory.ts index 8504cff..c0c301e 100644 --- a/src/router/routes/newModules/trajectory.ts +++ b/src/router/routes/newModules/trajectory.ts @@ -2,7 +2,7 @@ import { DEFAULT_LAYOUT } from '../base'; import { AppRouteRecordRaw } from '../types'; const SYSTEM: AppRouteRecordRaw = { - path: '/trajectoryCenter', + path: '/track', name: 'TrajectoryCenter', component: DEFAULT_LAYOUT, meta: { @@ -13,7 +13,7 @@ const SYSTEM: AppRouteRecordRaw = { }, children: [ { - path: 'trajectoryOrder', + path: 'order', name: 'TrajectoryOrder', component: () => import('@/views/trajectoryCenter/trajectoryOrder/index.vue'), @@ -21,10 +21,11 @@ const SYSTEM: AppRouteRecordRaw = { locale: 'menu.track.trackOrder', requiresAuth: true, order: 1, + permission: 'Track.Orders.Query', }, }, { - path: 'trajectoryWarningOrder', + path: 'warningOrder', name: 'TrajectoryWarningOrder', component: () => import('@/views/trajectoryCenter/trajectoryWarningOrder/index.vue'), @@ -32,10 +33,11 @@ const SYSTEM: AppRouteRecordRaw = { locale: 'menu.track.warningOrder', requiresAuth: true, order: 2, + permission: 'Track.Warnings.Query', }, }, { - path: 'trajectoryState', + path: 'state', name: 'TrajectoryState', component: () => import('@/views/trajectoryCenter/trajectoryState/index.vue'), @@ -43,10 +45,11 @@ const SYSTEM: AppRouteRecordRaw = { locale: 'menu.track.trackState', requiresAuth: true, order: 3, + permission: 'Track.States.Query', }, }, { - path: 'trajectoryFlag', + path: 'flag', name: 'TrajectoryFlag', component: () => import('@/views/trajectoryCenter/trajectoryFlag/index.vue'), @@ -54,10 +57,11 @@ const SYSTEM: AppRouteRecordRaw = { locale: 'menu.track.trackFlag', requiresAuth: true, order: 4, + permission: 'Track.Flags.Query', }, }, { - path: 'trajectoryContent', + path: 'content', name: 'TrajectoryContent', component: () => import('@/views/trajectoryCenter/trajectoryContent/index.vue'), @@ -65,10 +69,11 @@ const SYSTEM: AppRouteRecordRaw = { locale: 'menu.track.trackContent', requiresAuth: true, order: 5, + permission: 'Track.Content.Query', }, }, { - path: 'trajectoryPull', + path: 'pull', name: 'TrajectoryPull', component: () => import('@/views/trajectoryCenter/trajectoryMapping/Pull.vue'), @@ -76,10 +81,11 @@ const SYSTEM: AppRouteRecordRaw = { locale: 'menu.track.trackPull', requiresAuth: true, order: 6, + permission: 'Track.Mapping.Query', }, }, { - path: 'trajectoryPush', + path: 'push', name: 'TrajectoryPush', component: () => import('@/views/trajectoryCenter/trajectoryMapping/Push.vue'), @@ -87,6 +93,7 @@ const SYSTEM: AppRouteRecordRaw = { locale: 'menu.track.trackPush', requiresAuth: true, order: 7, + permission: 'Track.Mapping.Query', }, }, { @@ -97,6 +104,7 @@ const SYSTEM: AppRouteRecordRaw = { locale: 'menu.track.kpiRegion', requiresAuth: true, order: 8, + permission: 'Track.Kpi.Query', }, }, { @@ -108,6 +116,7 @@ const SYSTEM: AppRouteRecordRaw = { locale: 'menu.track.kpiEarlyWarningConfig', requiresAuth: true, order: 9, + permission: 'Track.Kpi.Query', }, }, ], diff --git a/src/router/routes/newModules/user.ts b/src/router/routes/newModules/user.ts index c103a72..fa07fe0 100644 --- a/src/router/routes/newModules/user.ts +++ b/src/router/routes/newModules/user.ts @@ -12,26 +12,6 @@ const USER: AppRouteRecordRaw = { order: 7, }, children: [ - { - path: 'setting', - name: 'Setting', - component: () => import('@/views/user/setting/index.vue'), - meta: { - locale: 'menu.user.setting', - requiresAuth: true, - roles: ['*'], - }, - }, - { - path: 'message', - name: 'UserMessage', - component: () => import('@/views/system/message/index.vue'), - meta: { - locale: 'menu.user.message', - requiresAuth: true, - roles: ['*'], - }, - }, { path: 'recharge', name: 'VipRechargeDeposit', diff --git a/src/router/routes/newModules/visualization.ts b/src/router/routes/newModules/visualization.ts index aefa2b1..d6d1738 100644 --- a/src/router/routes/newModules/visualization.ts +++ b/src/router/routes/newModules/visualization.ts @@ -1,39 +1 @@ -import { DEFAULT_LAYOUT } from '../base'; -import { AppRouteRecordRaw } from '../types'; - -const VISUALIZATION: AppRouteRecordRaw = { - path: '/visualization', - name: 'visualization', - component: DEFAULT_LAYOUT, - meta: { - locale: 'menu.visualization', - requiresAuth: true, - icon: 'icon-apps', - order: 1, - }, - children: [ - { - path: 'data-analysis', - name: 'DataAnalysis', - component: () => import('@/views/visualization/data-analysis/index.vue'), - meta: { - locale: 'menu.visualization.dataAnalysis', - requiresAuth: true, - roles: ['admin'], - }, - }, - { - path: 'multi-dimension-data-analysis', - name: 'MultiDimensionDataAnalysis', - component: () => - import('@/views/visualization/multi-dimension-data-analysis/index.vue'), - meta: { - locale: 'menu.visualization.multiDimensionDataAnalysis', - requiresAuth: true, - roles: ['admin'], - }, - }, - ], -}; - -export default VISUALIZATION; +export default []; diff --git a/src/store/modules/auth/index.ts b/src/store/modules/auth/index.ts index d491a0c..e4b4d56 100644 --- a/src/store/modules/auth/index.ts +++ b/src/store/modules/auth/index.ts @@ -1,6 +1,6 @@ import { defineStore } from 'pinia'; -import { userCenterLoginMenuGet } from '@/api/SimpleAdmin/userCenter'; -import { useUserStore } from '../user'; +import { MenuService } from '@/api/rbac'; +import { useRbacUserStore } from '../rbac-user'; const name = 'auth'; // 定义模块名称 @@ -9,16 +9,20 @@ export interface MenuItem { id?: number | string; name?: string; path?: string; + route?: string; // 兼容 route 字段 component?: string; + type?: number; // 菜单类型:1=菜单,2=按钮 meta?: { title?: string; icon?: string; order?: number; isHide?: boolean; + hideInMenu?: boolean; // 兼容 hideInMenu isFull?: boolean; isAffix?: boolean; isKeepAlive?: boolean; isHome?: boolean; + locale?: string; // 国际化 key [key: string]: any; }; children?: MenuItem[]; @@ -69,10 +73,19 @@ export const useAuthStore = defineStore({ this.authMenuList = []; } - // 每次都从服务器获取最新菜单数据,不使用缓存 - const res = await userCenterLoginMenuGet({ id: moduleId }); - const resData = (res as any)?.data?.data || (res as any)?.data || res || []; - this.authMenuList = Array.isArray(resData) ? resData : []; + // 使用 RBAC 系统获取用户菜单 + const rbacUserStore = useRbacUserStore(); + if (!rbacUserStore.userInfo?.id) { + console.warn('用户未登录,无法获取菜单'); + this.authMenuList = []; + return; + } + + // 从 RBAC 系统获取用户菜单树 + const menuTree = await MenuService.getRbacMenuGetUserMenus(rbacUserStore.userInfo.id); + // 将菜单树转换为菜单列表格式 + const menuList = convertMenuTreeToMenuList(menuTree || []); + this.authMenuList = Array.isArray(menuList) ? menuList : []; console.log('获取到的菜单列表:', this.authMenuList); console.log('菜单列表长度:', this.authMenuList.length); } catch (error) { @@ -92,7 +105,18 @@ export const useAuthStore = defineStore({ /** 过滤隐藏的菜单 */ function filterHideMenu(menuList: MenuItem[]): MenuItem[] { return menuList - .filter((item) => !item.meta?.isHide) + .filter((item) => { + // 过滤掉隐藏的菜单 + if (item.meta?.isHide) { + return false; + } + // 过滤掉特殊的"系统首页"菜单(category 为 "SPA" 且 module 为 null 的菜单) + // 这类菜单通常是从其他地方自动添加的,不应该显示在导航菜单中 + if (item.category === 'SPA' && (item.module === null || item.module === undefined)) { + return false; + } + return true; + }) .map((item) => { if (item.children && item.children.length > 0) { return { @@ -122,3 +146,35 @@ function flattenMenuList(menuList: MenuItem[]): MenuItem[] { return result; } +/** 将 RBAC 菜单树转换为菜单列表格式 */ +function convertMenuTreeToMenuList(menuTree: any[]): MenuItem[] { + return menuTree.map((menu: any) => { + const menuItem: MenuItem = { + id: menu.id, + name: menu.name, + path: menu.route || menu.path, // 优先使用 route,兼容 path + route: menu.route, // 保留 route 字段 + component: menu.component, + type: menu.type, // 菜单类型 + meta: { + title: menu.name, + icon: menu.icon, + order: menu.order, + isHide: menu.isHidden || false, // 使用 isHidden 字段 + hideInMenu: menu.isHidden || false, // 兼容字段 + isFull: menu.isFull, + isAffix: menu.isAffix, + isKeepAlive: menu.isCached || false, // 使用 isCached 字段 + isHome: menu.isHome, + locale: menu.meta?.locale, // 保留 locale + }, + }; + + if (menu.children && menu.children.length > 0) { + menuItem.children = convertMenuTreeToMenuList(menu.children); + } + + return menuItem; + }); +} + diff --git a/src/store/modules/message/index.ts b/src/store/modules/message/index.ts index fef637b..54a011e 100644 --- a/src/store/modules/message/index.ts +++ b/src/store/modules/message/index.ts @@ -1,8 +1,9 @@ import { defineStore } from 'pinia'; -import { - userCenterUnReadCountGet, - userCenterNewUnReadGet, -} from '@/api/SimpleAdmin/userCenter'; +// RBAC 系统暂不支持消息功能 +// import { +// userCenterUnReadCountGet, +// userCenterNewUnReadGet, +// } from '@/api/SimpleAdmin/userCenter'; import useUserStore from '../user'; export interface MessageState { @@ -40,57 +41,16 @@ export const useMessageStore = defineStore('message', { unReadCountSet(value: number) { this.unReadCount = value; }, - /** 获取未读消息数 */ + /** 获取未读消息数 - RBAC 系统暂不支持消息功能 */ async getUnReadInfo() { - // 检查用户是否已登录,如果未登录则不请求 - const userStore = useUserStore(); - if (!userStore.token || userStore.token === '') { - return; - } - - try { - const res = await userCenterUnReadCountGet(); - const data = res.data || res; - const unReadCountList = Array.isArray(data) ? data : (data?.list || []); - - if (unReadCountList.length > 0) { - // 未读消息信息数量转换 - this.unReadInfo = unReadCountList.reduce((acc: Record, item: any) => { - acc[item.category] = item.unReadCount || 0; - return acc; - }, {}); - - // 遍历未读消息信息,获取未读消息总数 - let count = 0; - unReadCountList.forEach((item: any) => { - count += item.unReadCount || 0; - }); - - // 如果未读消息总数大于当前未读消息总数,则获取最新未读消息 - if (count > this.unReadCount) { - await this.getNewUnRead(); - } - this.unReadCountSet(count); - } else { - this.unReadCountSet(0); - this.unReadInfo = {}; - } - } catch (error) { - console.error('获取未读消息数失败:', error); - } + // RBAC 系统暂不支持消息功能,直接设置为 0 + this.unReadCountSet(0); + this.unReadInfo = {}; }, - /** 获取最新未读消息 */ + /** 获取最新未读消息 - RBAC 系统暂不支持消息功能 */ async getNewUnRead() { - try { - const res = await userCenterNewUnReadGet(); - const data = res.data || res; - const newUnReadList = Array.isArray(data) ? data : (data?.list || []); - if (newUnReadList.length > 0) { - this.newUnRead = newUnReadList; - } - } catch (error) { - console.error('获取最新未读消息失败:', error); - } + // RBAC 系统暂不支持消息功能 + this.newUnRead = []; }, /** 获取未读消息数 */ getUnReadCount(category: string) { diff --git a/src/store/modules/rbac-user.ts b/src/store/modules/rbac-user.ts new file mode 100644 index 0000000..c8091ef --- /dev/null +++ b/src/store/modules/rbac-user.ts @@ -0,0 +1,233 @@ +import { defineStore } from 'pinia' +import { ref, computed } from 'vue' +import { AuthService, setAuthToken, clearAuthToken } from '@/api/rbac' +import type { UserInfoDto } from '@/api/rbac' +import { Message } from '@arco-design/web-vue' +import { handleApiError } from '@/utils/rbac-error-handler' + +// Token 存储 key +const TOKEN_KEY = 'rbac_access_token' +const REFRESH_TOKEN_KEY = 'rbac_refresh_token' +const TOKEN_EXPIRES_KEY = 'rbac_token_expires_at' +const USER_INFO_KEY = 'rbac_userInfo' +// 兼容旧代码的 key +const OLD_TOKEN_KEY = 'rbac_token' + +// 登录结果类型(如果 API 返回的是 UserInfoDto,需要适配) +interface LoginResult { + accessToken?: string | null + refreshToken?: string | null + expiresIn?: number + userId?: string + // 如果 API 直接返回 UserInfoDto,则包含用户信息 + [key: string]: any +} + +export const useRbacUserStore = defineStore('rbacUser', () => { + const accessToken = ref(localStorage.getItem(TOKEN_KEY) || '') + const refreshToken = ref(localStorage.getItem(REFRESH_TOKEN_KEY) || '') + const tokenExpiresAt = ref(Number(localStorage.getItem(TOKEN_EXPIRES_KEY)) || 0) + const savedUserInfo = localStorage.getItem(USER_INFO_KEY) + const userInfo = ref(savedUserInfo ? JSON.parse(savedUserInfo) : null) + + const permissions = computed(() => userInfo.value?.permissions || []) + const menus = computed(() => userInfo.value?.menus || []) + const isLoggedIn = computed(() => !!accessToken.value) + // 兼容旧代码 + const token = computed(() => accessToken.value) + + // 保存 Token 信息 + function saveTokens(result: LoginResult | UserInfoDto) { + // 如果返回的是 LoginResultDto 格式(包含 accessToken 和 refreshToken) + if ('accessToken' in result && result.accessToken) { + accessToken.value = result.accessToken + refreshToken.value = result.refreshToken || '' + // 计算过期时间(提前5分钟刷新) + tokenExpiresAt.value = Date.now() + ((result.expiresIn || 3600) - 300) * 1000 + + localStorage.setItem(TOKEN_KEY, accessToken.value) + if (refreshToken.value) { + localStorage.setItem(REFRESH_TOKEN_KEY, refreshToken.value) + } + localStorage.setItem(TOKEN_EXPIRES_KEY, String(tokenExpiresAt.value)) + } else { + // 兼容旧格式:如果返回的是 UserInfoDto,尝试从响应中获取 token + // 或者使用临时方案(这种情况需要后端更新 API) + const tempToken = (result as any).accessToken || (result as any).token + if (tempToken) { + accessToken.value = tempToken + localStorage.setItem(TOKEN_KEY, accessToken.value) + } + } + + // 如果结果中包含用户信息,保存用户信息 + if ('id' in result || 'account' in result) { + userInfo.value = result as UserInfoDto + localStorage.setItem(USER_INFO_KEY, JSON.stringify(result)) + } + + // 设置 API token + if (accessToken.value) { + setAuthToken(accessToken.value) + } + + // 兼容旧代码 + if (accessToken.value) { + localStorage.setItem(OLD_TOKEN_KEY, accessToken.value) + } + } + + // 检查 Token 是否需要刷新 + function isTokenExpiringSoon(): boolean { + return tokenExpiresAt.value > 0 && Date.now() >= tokenExpiresAt.value + } + + // 刷新 Token + async function refreshAccessToken(): Promise { + if (!refreshToken.value) { + return false + } + + try { + // 注意:如果 API 还没有 refresh-token 接口,这里会失败 + // 需要后端提供 /rbac/auth/refresh-token 接口 + const result = await (AuthService as any).postRbacAuthRefreshToken?.({ + refreshToken: refreshToken.value + }) + if (result) { + saveTokens(result) + return true + } + return false + } catch { + // 刷新失败,清除登录状态 + logout() + return false + } + } + + // 登录 + async function login(account: string, password: string) { + try { + const result = await AuthService.postRbacAuthLogin(account, password) + + // 如果 API 返回的是 LoginResultDto 格式 + if ('accessToken' in result) { + saveTokens(result as LoginResult) + // 获取用户完整信息 + await getCurrentUser() + } else { + // 如果返回的是 UserInfoDto(旧格式),需要适配 + // 这种情况下,token 可能需要在响应头中获取,或者后端需要更新 API + userInfo.value = result as UserInfoDto + localStorage.setItem(USER_INFO_KEY, JSON.stringify(result)) + + // 如果没有 token,尝试从其他地方获取(如响应头) + // 这里需要根据实际 API 响应调整 + if (!accessToken.value) { + // 临时方案:如果后端还没有返回 token,可能需要等待 API 更新 + console.warn('登录响应中未找到 accessToken,可能需要更新 API') + } + } + + Message.success('登录成功') + return true + } catch (error) { + handleApiError(error) + return false + } + } + + // 获取当前用户信息 + async function getCurrentUser() { + try { + // 检查是否需要刷新 Token + if (isTokenExpiringSoon()) { + await refreshAccessToken() + } + + // 如果已有用户信息,使用用户ID;否则不传参数(让后端从 token 中获取) + const userId = userInfo.value?.id + const data = await AuthService.getRbacAuthGetCurrentUser(userId) + userInfo.value = data + localStorage.setItem(USER_INFO_KEY, JSON.stringify(data)) + return data + } catch (error) { + logout() + throw error + } + } + + // 刷新用户信息(强制从服务器获取最新数据) + async function refreshUserInfo() { + try { + const userId = userInfo.value?.id + const data = await AuthService.getRbacAuthGetCurrentUser(userId) + userInfo.value = data + localStorage.setItem(USER_INFO_KEY, JSON.stringify(data)) + return data + } catch (error) { + handleApiError(error) + throw error + } + } + + // 登出 + function logout() { + accessToken.value = '' + refreshToken.value = '' + tokenExpiresAt.value = 0 + userInfo.value = null + + localStorage.removeItem(TOKEN_KEY) + localStorage.removeItem(REFRESH_TOKEN_KEY) + localStorage.removeItem(TOKEN_EXPIRES_KEY) + localStorage.removeItem(USER_INFO_KEY) + // 兼容旧代码 + localStorage.removeItem(OLD_TOKEN_KEY) + localStorage.removeItem('token') + localStorage.removeItem('userInfo') + + // 清除 API token + clearAuthToken() + } + + // 初始化:恢复登录状态 + function initAuth() { + if (accessToken.value) { + setAuthToken(accessToken.value) + } + } + + // 自动初始化 + initAuth() + + // 检查权限 + function hasPermission(permission: string): boolean { + return permissions.value.includes(permission) + } + + // 检查角色 + function hasRole(roleCode: string): boolean { + return userInfo.value?.roles?.some((r) => r.code === roleCode) || false + } + + return { + token, + accessToken, + refreshToken, + userInfo, + permissions, + menus, + isLoggedIn, + login, + getCurrentUser, + refreshUserInfo, + logout, + hasPermission, + hasRole, + refreshAccessToken, + isTokenExpiringSoon, + } +}) + diff --git a/src/store/modules/user/index.ts b/src/store/modules/user/index.ts index 0d81e81..c5ddfe2 100644 --- a/src/store/modules/user/index.ts +++ b/src/store/modules/user/index.ts @@ -66,7 +66,20 @@ const useUserStore = defineStore('user', { // 在更新之前,保存当前的 chooseModule,避免被覆盖 const currentChooseModule = this.chooseModule; - this.$patch(partial); + // 处理可能包含嵌套结构的字段,避免循环引用 + const cleanPartial: Partial = { ...partial }; + + // 如果包含 moduleList,进行深拷贝避免循环引用 + if (partial.moduleList !== undefined) { + try { + cleanPartial.moduleList = JSON.parse(JSON.stringify(partial.moduleList)); + } catch (e) { + console.warn('无法序列化 moduleList,使用原始值'); + cleanPartial.moduleList = partial.moduleList; + } + } + + this.$patch(cleanPartial); // 如果设置了 defaultModule,保存到 localStorage if (partial.defaultModule !== undefined) { @@ -114,13 +127,24 @@ const useUserStore = defineStore('user', { } }, - // Get user's information + // Get user's information - 使用 RBAC 系统 async info() { try { - const { sysAuthBGetLoginUserGet } = await import('@/api/SimpleAdmin/bEndPermissionVerify'); - const res = await sysAuthBGetLoginUserGet(); - if (res && res.data) { - this.setInfo(res.data as any); + // RBAC 系统使用 rbacUserStore 获取用户信息 + const { useRbacUserStore } = await import('../rbac-user'); + const rbacUserStore = useRbacUserStore(); + if (rbacUserStore.userInfo) { + // 将 RBAC 用户信息转换为 itfx 用户信息格式 + const userInfo: any = { + account: rbacUserStore.userInfo.account, + name: rbacUserStore.userInfo.name || rbacUserStore.userInfo.account, + avatar: rbacUserStore.userInfo.avatar, + email: rbacUserStore.userInfo.email, + id: rbacUserStore.userInfo.id, + defaultModule: undefined, + moduleList: [], + }; + this.setInfo(userInfo); } else { throw new Error('获取用户信息失败'); } diff --git a/src/utils/importMenus.ts b/src/utils/importMenus.ts index 2b17db6..2794845 100644 --- a/src/utils/importMenus.ts +++ b/src/utils/importMenus.ts @@ -1,4 +1,5 @@ -import { sysLimitMenuAddPost, sysLimitMenuTreeGet } from '@/api/SimpleAdmin/menuManagement'; +// RBAC 系统使用 MenuService 管理菜单 +import { MenuService } from '@/api/rbac'; import { Message } from '@arco-design/web-vue'; import { useUserStore } from '@/store'; @@ -20,12 +21,12 @@ interface MenuItem { // 菜单数据 - 基于实际路由配置生成 // 注意:所有路由文件已统一移动到 newModules 目录,统一管理 const menuData: MenuItem[] = [ - // 仪表盘 - 来自 newModules/dashboard.ts + // 首页 - 来自 newModules/dashboard.ts { - title: '仪表盘', - code: 'dashboard', + title: '首页', + code: 'home', menuType: 'CATALOG', - path: '/dashboard', + path: '/home', icon: 'icon-dashboard', sortCode: 0, status: 'ENABLE', @@ -33,9 +34,9 @@ const menuData: MenuItem[] = [ children: [ { title: '工作台', - code: 'dashboard_workplace', + code: 'home_workplace', menuType: 'MENU', - path: '/dashboard/workplace', + path: '/home/workplace', component: 'views/dashboard/workplace/index', icon: 'icon-home', sortCode: 1, @@ -49,7 +50,7 @@ const menuData: MenuItem[] = [ title: 'API', code: 'api', menuType: 'CATALOG', - path: '/system', + path: '/api', icon: 'icon-computer', sortCode: 1, status: 'ENABLE', @@ -59,7 +60,7 @@ const menuData: MenuItem[] = [ title: '上游接口', code: 'system_upstream_interface', menuType: 'MENU', - path: '/system/interface', + path: '/api/interface', component: 'views/system/interface/index', icon: 'icon-code', sortCode: 1, @@ -70,7 +71,7 @@ const menuData: MenuItem[] = [ title: '下游接口', code: 'system_downstream_interface', menuType: 'MENU', - path: '/system/serviceProvidersList', + path: '/api/serviceProvidersList', component: 'views/system/serviceProvidersList/index', icon: 'icon-code', sortCode: 2, @@ -81,7 +82,7 @@ const menuData: MenuItem[] = [ title: 'App列表', code: 'system_app_list', menuType: 'MENU', - path: '/system/newList/adhibition-list', + path: '/api/newList/adhibition-list', component: 'views/system/newList/adhibition-list', icon: 'icon-apps', sortCode: 3, @@ -92,7 +93,7 @@ const menuData: MenuItem[] = [ title: '请求日志', code: 'system_request_log', menuType: 'MENU', - path: '/system/log-record', + path: '/api/log-record', component: 'views/system/log-record/index', icon: 'icon-file-text', sortCode: 4, @@ -103,7 +104,7 @@ const menuData: MenuItem[] = [ title: '调用统计', code: 'system_call_statistics', menuType: 'MENU', - path: '/system/applicationStatistics', + path: '/api/applicationStatistics', component: 'views/system/applicationStatistics', icon: 'icon-bar-chart', sortCode: 5, @@ -114,7 +115,7 @@ const menuData: MenuItem[] = [ title: 'API调试', code: 'system_api_debugger', menuType: 'MENU', - path: '/system/api-debugger', + path: '/api/api-debugger', component: 'views/system/api-debugger/index', icon: 'icon-bug', sortCode: 6, @@ -128,7 +129,7 @@ const menuData: MenuItem[] = [ title: '轨迹', code: 'trajectory', menuType: 'CATALOG', - path: '/trajectoryCenter', + path: '/track', icon: 'icon-computer', sortCode: 2, status: 'ENABLE', @@ -138,7 +139,7 @@ const menuData: MenuItem[] = [ title: '轨迹订单', code: 'trajectory_order', menuType: 'MENU', - path: '/trajectoryCenter/trajectoryOrder', + path: '/track/order', component: 'views/trajectoryCenter/trajectoryOrder/index', icon: 'icon-file', sortCode: 1, @@ -149,7 +150,7 @@ const menuData: MenuItem[] = [ title: '预警订单', code: 'trajectory_warning_order', menuType: 'MENU', - path: '/trajectoryCenter/trajectoryWarningOrder', + path: '/track/warningOrder', component: 'views/trajectoryCenter/trajectoryWarningOrder/index', icon: 'icon-exclamation-circle', sortCode: 2, @@ -160,7 +161,7 @@ const menuData: MenuItem[] = [ title: '轨迹状态', code: 'trajectory_state', menuType: 'MENU', - path: '/trajectoryCenter/trajectoryState', + path: '/track/state', component: 'views/trajectoryCenter/trajectoryState/index', icon: 'icon-info-circle', sortCode: 3, @@ -171,7 +172,7 @@ const menuData: MenuItem[] = [ title: '轨迹标记', code: 'trajectory_flag', menuType: 'MENU', - path: '/trajectoryCenter/trajectoryFlag', + path: '/track/flag', component: 'views/trajectoryCenter/trajectoryFlag/index', icon: 'icon-flag', sortCode: 4, @@ -182,7 +183,7 @@ const menuData: MenuItem[] = [ title: '轨迹内容', code: 'trajectory_content', menuType: 'MENU', - path: '/trajectoryCenter/trajectoryContent', + path: '/track/content', component: 'views/trajectoryCenter/trajectoryContent/index', icon: 'icon-file-text', sortCode: 5, @@ -193,7 +194,7 @@ const menuData: MenuItem[] = [ title: '轨迹拉取', code: 'trajectory_pull', menuType: 'MENU', - path: '/trajectoryCenter/trajectoryPull', + path: '/track/pull', component: 'views/trajectoryCenter/trajectoryMapping/Pull', icon: 'icon-download', sortCode: 6, @@ -204,7 +205,7 @@ const menuData: MenuItem[] = [ title: '轨迹推送', code: 'trajectory_push', menuType: 'MENU', - path: '/trajectoryCenter/trajectoryPush', + path: '/track/push', component: 'views/trajectoryCenter/trajectoryMapping/Push', icon: 'icon-upload', sortCode: 7, @@ -215,7 +216,7 @@ const menuData: MenuItem[] = [ title: '预警分区', code: 'trajectory_kpi_region', menuType: 'MENU', - path: '/trajectoryCenter/kpiRegion', + path: '/track/kpiRegion', component: 'views/trajectoryCenter/kpiRegion/index', icon: 'icon-map', sortCode: 8, @@ -226,7 +227,7 @@ const menuData: MenuItem[] = [ title: '预警配置', code: 'trajectory_kpi_config', menuType: 'MENU', - path: '/trajectoryCenter/kpiEarlyWarningConfig', + path: '/track/kpiEarlyWarningConfig', component: 'views/trajectoryCenter/kpiEarlyWarningConfig/index', icon: 'icon-settings', sortCode: 9, @@ -417,25 +418,6 @@ const menuData: MenuItem[] = [ status: 'ENABLE', isHide: false, children: [ - { - title: '用户设置', - code: 'user_setting', - menuType: 'MENU', - path: '/user/setting', - component: 'views/user/setting/index', - icon: 'icon-settings', - sortCode: 1, - status: 'ENABLE', - isHide: false, - }, - { - title: '站内信', - code: 'user_message', - menuType: 'MENU', - path: '/user/message', - component: 'views/system/message/index', - icon: 'icon-message', - sortCode: 2, status: 'ENABLE', isHide: false, }, @@ -592,15 +574,14 @@ const menuData: MenuItem[] = [ let cachedMenuTree: any[] = []; let cachedModuleId: number | null = null; -// 检查菜单是否已存在 +// 检查菜单是否已存在 - RBAC 系统暂不支持模块概念,使用菜单树 async function checkMenuExists(code: string, moduleId: number): Promise { try { - // 如果缓存的是不同模块的数据,重新获取 - if (cachedModuleId !== moduleId || cachedMenuTree.length === 0) { - const response = await sysLimitMenuTreeGet({ module: moduleId }); - const tree = (response as any)?.data || response; + // RBAC 系统使用菜单树,不需要模块ID + if (cachedMenuTree.length === 0) { + const response = await MenuService.getRbacMenuGetMenuTree(); + const tree = (response as any) || []; cachedMenuTree = Array.isArray(tree) ? tree : []; - cachedModuleId = moduleId; } const findMenu = (menus: any[]): number | null => { @@ -831,9 +812,9 @@ async function addMenu( console.log(`requestData.name 存在:`, 'name' in requestData); console.log(`requestData.name 值:`, requestData.name); - // 直接调用 API,确保 name 字段被包含 - const response = await sysLimitMenuAddPost(requestData); - const menuId = (response as any)?.data?.id || (response as any)?.id || null; + // 使用 RBAC 系统创建菜单 + const response = await MenuService.postRbacMenuCreate(requestData); + const menuId = (response as any)?.id || null; if (menuId) { console.log(`✓ 菜单添加成功: ${menu.title} (ID: ${menuId})`); diff --git a/src/utils/rbac-error-handler.ts b/src/utils/rbac-error-handler.ts new file mode 100644 index 0000000..8ad4d8a --- /dev/null +++ b/src/utils/rbac-error-handler.ts @@ -0,0 +1,63 @@ +import { Message } from '@arco-design/web-vue' +import { ApiError } from '@/api/rbac/generated/core/ApiError' +import router from '@/router' + +/** + * 全局错误处理器 + */ +export function handleApiError(error: any): void { + if (error instanceof ApiError) { + const { status, body } = error + + // 尝试从响应体中提取 message + let errorMessage = '请求失败' + + if (body) { + // 后端可能返回的格式:{ message: '错误信息' } 或 { Message: '错误信息' } + errorMessage = body.message || body.Message || body.error || body.Error || errorMessage + } + + switch (status) { + case 400: + Message.error(errorMessage || '请求参数错误') + break + case 401: + Message.error('未授权,请重新登录') + localStorage.removeItem('token') + localStorage.removeItem('userInfo') + router.push('/login') + break + case 403: + Message.error(errorMessage || '没有权限访问') + break + case 404: + Message.error(errorMessage || '请求的资源不存在') + break + case 500: + Message.error(errorMessage || '服务器错误') + break + default: + Message.error(errorMessage) + } + } else if (error?.message) { + Message.error(error.message) + } else { + Message.error('未知错误') + } +} + +/** + * 包装异步函数,自动处理错误 + */ +export function withErrorHandler Promise>( + fn: T +): (...args: Parameters) => Promise | undefined> { + return async (...args: Parameters) => { + try { + return await fn(...args) + } catch (error) { + handleApiError(error) + return undefined + } + } +} diff --git a/src/utils/rbac-permission.ts b/src/utils/rbac-permission.ts new file mode 100644 index 0000000..d47c91a --- /dev/null +++ b/src/utils/rbac-permission.ts @@ -0,0 +1,44 @@ +import { useRbacUserStore } from '@/store/modules/rbac-user' + +/** + * 检查是否有权限 + */ +export function hasPermission(permission: string): boolean { + // 临时放开菜单权限校验,直接按照路由配置展示 + // TODO: 恢复时改回 userStore.permissions.includes(permission) + return true +} + +/** + * 检查是否有任一权限 + */ +export function hasAnyPermission(permissions: string[]): boolean { + // 临时放开 + return true +} + +/** + * 检查是否有所有权限 + */ +export function hasAllPermissions(permissions: string[]): boolean { + // 临时放开 + return true +} + +/** + * 检查是否有角色 + */ +export function hasRole(roleCode: string): boolean { + const userStore = useRbacUserStore() + return userStore.userInfo?.roles?.some(r => r.code === roleCode) || false +} + +/** + * 检查是否有任一角色 + */ +export function hasAnyRole(roleCodes: string[]): boolean { + const userStore = useRbacUserStore() + return roleCodes.some(code => + userStore.userInfo?.roles?.some(r => r.code === code) + ) || false +} diff --git a/src/utils/request.ts b/src/utils/request.ts index 0130c66..972a53a 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -26,7 +26,15 @@ service.interceptors.request.use( // 从 localStorage 获取 token const token = localStorage.getItem('token'); if (token) { - config.headers.Authorization = `Bearer ${token}`; + // 如果token已经包含Bearer前缀,直接使用;否则添加Bearer前缀 + if (token.startsWith('Bearer ')) { + config.headers.Authorization = token; + } else if (token.startsWith('Bearer_')) { + // 处理 Bearer_xxx 格式,转换为 Bearer xxx + config.headers.Authorization = `Bearer ${token.replace('Bearer_', '')}`; + } else { + config.headers.Authorization = `Bearer ${token}`; + } } config.headers['Accept-Language'] = 'zh-CN'; @@ -148,22 +156,40 @@ service.interceptors.response.use( break; case 401: // 401 未授权,登录过期 + // 检查是否是RBAC API的401,如果是则登出;否则可能是权限问题 + const isRbacApi = error.config?.url?.includes('/rbac/'); const errorMessage = data?.message || data?.msg || '登录已过期,请重新登录'; - Message.error({ - content: errorMessage, - duration: 3000, - }); - // 清除 token 和用户信息 - clearToken(); - userStore.resetInfo(); - // 跳转到登录页 - const currentPath = router.currentRoute.value.fullPath; - router.replace({ - name: 'login', - query: { - redirect: currentPath, - }, - }); + + if (isRbacApi) { + // RBAC API的401,说明token过期,需要重新登录 + Message.error({ + content: errorMessage, + duration: 3000, + }); + // 清除所有token和用户信息 + clearToken(); + userStore.resetInfo(); + // 清除RBAC相关存储(包括新旧格式) + localStorage.removeItem('rbac_token'); + localStorage.removeItem('rbac_access_token'); + localStorage.removeItem('rbac_refresh_token'); + localStorage.removeItem('rbac_token_expires_at'); + localStorage.removeItem('rbac_userInfo'); + // 跳转到登录页 + const currentPath = router.currentRoute.value.fullPath; + router.replace({ + name: 'login', + query: { + redirect: currentPath, + }, + }); + } else { + // 非RBAC API的401,可能是权限问题,只提示错误,不登出 + Message.error({ + content: errorMessage || '未授权访问', + duration: 3000, + }); + } break; case 403: Message.error({ diff --git a/src/utils/route-name-mapper.ts b/src/utils/route-name-mapper.ts index c660f25..328562b 100644 --- a/src/utils/route-name-mapper.ts +++ b/src/utils/route-name-mapper.ts @@ -13,33 +13,45 @@ const routeNameMap: Record = { 'order': 'Order', '/order': 'Order', - // 仪表盘相关 - 'dashboard_workplace': 'Workplace', - '/dashboard/workplace': 'Workplace', - 'dashboard': 'Dashboard', - '/dashboard': 'Dashboard', + // 首页相关 + 'home_workplace': 'Workplace', + '/home/workplace': 'Workplace', + 'home': 'Home', + '/home': 'Home', // 轨迹中心相关 'trajectory': 'TrajectoryCenter', - '/trajectoryCenter': 'TrajectoryCenter', + '/track': 'TrajectoryCenter', 'trajectory_order': 'TrajectoryOrder', - '/trajectoryCenter/trajectoryOrder': 'TrajectoryOrder', + '/track/order': 'TrajectoryOrder', 'trajectory_warning_order': 'TrajectoryWarningOrder', - '/trajectoryCenter/trajectoryWarningOrder': 'TrajectoryWarningOrder', + '/track/warningOrder': 'TrajectoryWarningOrder', 'trajectory_state': 'TrajectoryState', - '/trajectoryCenter/trajectoryState': 'TrajectoryState', + '/track/state': 'TrajectoryState', 'trajectory_flag': 'TrajectoryFlag', - '/trajectoryCenter/trajectoryFlag': 'TrajectoryFlag', + '/track/flag': 'TrajectoryFlag', 'trajectory_content': 'TrajectoryContent', - '/trajectoryCenter/trajectoryContent': 'TrajectoryContent', + '/track/content': 'TrajectoryContent', 'trajectory_pull': 'TrajectoryPull', - '/trajectoryCenter/trajectoryPull': 'TrajectoryPull', + '/track/pull': 'TrajectoryPull', 'trajectory_push': 'TrajectoryPush', - '/trajectoryCenter/trajectoryPush': 'TrajectoryPush', + '/track/push': 'TrajectoryPush', 'trajectory_kpi_region': 'KpiRegion', - '/trajectoryCenter/kpiRegion': 'KpiRegion', + '/track/kpiRegion': 'KpiRegion', 'trajectory_kpi_config': 'KpiEarlyWarningConfig', - '/trajectoryCenter/kpiEarlyWarningConfig': 'KpiEarlyWarningConfig', + '/track/kpiEarlyWarningConfig': 'KpiEarlyWarningConfig', + + // 系统管理相关 + 'system': 'SystemManagement', + '/system': 'SystemManagement', + 'system_users': 'SystemUsers', + '/system/users': 'SystemUsers', + 'system_roles': 'SystemRoles', + '/system/roles': 'SystemRoles', + 'system_menus': 'SystemMenus', + '/system/menus': 'SystemMenus', + 'system_organizations': 'SystemOrganizations', + '/system/organizations': 'SystemOrganizations', // 可以继续添加其他映射... }; diff --git a/src/views/dashboard/workplace/components/announcement.vue b/src/views/dashboard/workplace/components/announcement.vue index d7249be..c905ddc 100644 --- a/src/views/dashboard/workplace/components/announcement.vue +++ b/src/views/dashboard/workplace/components/announcement.vue @@ -30,7 +30,8 @@ - - diff --git a/src/views/demo/index.vue b/src/views/demo/index.vue deleted file mode 100644 index dd01f30..0000000 --- a/src/views/demo/index.vue +++ /dev/null @@ -1,444 +0,0 @@ - - - - - diff --git a/src/views/demo/index2.vue b/src/views/demo/index2.vue deleted file mode 100644 index 28a6a05..0000000 --- a/src/views/demo/index2.vue +++ /dev/null @@ -1,150 +0,0 @@ - - - - - diff --git a/src/views/demo/interface-config.vue b/src/views/demo/interface-config.vue deleted file mode 100644 index 01ee111..0000000 --- a/src/views/demo/interface-config.vue +++ /dev/null @@ -1,1703 +0,0 @@ - - - - - diff --git a/src/views/demo/json-diff-demo.vue b/src/views/demo/json-diff-demo.vue deleted file mode 100644 index 375e1c5..0000000 --- a/src/views/demo/json-diff-demo.vue +++ /dev/null @@ -1,50 +0,0 @@ - - - - - diff --git a/src/views/demo/json-editor-demo.vue b/src/views/demo/json-editor-demo.vue deleted file mode 100644 index 8042f57..0000000 --- a/src/views/demo/json-editor-demo.vue +++ /dev/null @@ -1,57 +0,0 @@ - - - - - diff --git a/src/views/example/pro-table-demo.vue b/src/views/example/pro-table-demo.vue deleted file mode 100644 index 0f3e447..0000000 --- a/src/views/example/pro-table-demo.vue +++ /dev/null @@ -1,412 +0,0 @@ - - - - - diff --git a/src/views/interface/config.vue b/src/views/interface/config.vue index 4249a59..0768405 100644 --- a/src/views/interface/config.vue +++ b/src/views/interface/config.vue @@ -7,7 +7,6 @@ import XEUtils from 'xe-utils'; import type { RouteLocationNormalizedLoaded, Router } from 'vue-router'; import FormPro from '@/components/FormPro/index.vue'; import TablePro from '@/components/TablePro/index.vue'; -import { IconDrag } from '@arco-design/web-vue/es/icon'; import { postParameterParse, postParameterValidateParameter, @@ -15,7 +14,7 @@ import { import { getInterfaceGetInterfaceById } from '@/api/InterfaceServices/interface'; import { postInterfaceSaveInterface } from '@/api/InterfaceServices/interface'; import { getDictionaryGetList } from '@/api/ApplicationServices/dictionary'; -import { paramColumns } from '@/views/demo/config/interface-config'; +import type { VxeGridPropTypes } from 'vxe-table'; // Form configuration const formItems = [ @@ -112,6 +111,63 @@ let formData = reactive({ isReturnMessage: true, }); +// 参数表格列配置 +const paramColumns: VxeGridPropTypes.Columns = [ + { + field: 'asdsad', + title: '按住拖动', + className: 'sort', + width: 80, + slots: { + default: 'asdsad', + }, + }, + { + field: 'name', + title: '参数名', + treeNode: true, + editRender: { autofocus: '.el-input__inner' }, + slots: { + edit: 'name_edit', + }, + }, + { + field: 'cnName', + title: '参数名(中文)', + editRender: { autofocus: '.el-input__inner' }, + slots: { + edit: 'cnName_edit', + }, + }, + { + field: 'type', + title: '参数类型', + editRender: {}, + slots: { + edit: 'type_edit', + default: 'type_default', + }, + }, + { + field: 'description', + title: '参数描述', + editRender: { autofocus: '.el-input__inner' }, + slots: { + edit: 'description_edit', + }, + }, + { + field: 'action', + title: '操作', + fixed: 'right', + align: 'center', + width: 180, + slots: { + default: 'action', + }, + }, +]; + const tableProps = reactive({ columns: paramColumns, data: [], @@ -226,18 +282,110 @@ const save = async () => { return; } - const requestData = { - ...formData, - id: route.value.query.id ? Number(route.value.query.id) : undefined, - optionType: route.value.query.id ? 3 : 1, - inParameterList: requestSort.value.length ? requestSort.value : tableProps.data, - outParameterList: backSort.value.length ? backSort.value : tableProps1.data, + confirmLoading.value = true; + + // 从表格组件获取最新的数据 + const tableData1 = tableRef.value?.xGrid?.getTableData()?.tableData || tableProps.data || []; + const tableData2 = tableRef1.value?.xGrid?.getTableData()?.tableData || tableProps1.data || []; + + // 处理入参列表 + let rc: any[] = cloneDeep(tableData1); + requestSort.value?.forEach((item: any) => { + const idx = rc.findIndex((i) => i.id === item.id); + if (idx > -1) rc[idx] = item; + else rc.push(item); + }); + + // 清理不需要的字段 + rc.forEach((el: any) => { + el.Id = undefined; + el.children = undefined; + el._X_ROW_CHILD = undefined; + }); + + // 处理出参列表 + let fc: any[] = cloneDeep(tableData2); + backSort.value?.forEach((item: any) => { + const idx = fc.findIndex((i) => i.id === item.id); + if (idx > -1) fc[idx] = item; + else fc.push(item); + }); + + // 清理不需要的字段 + fc.forEach((el: any) => { + el.Id = undefined; + el.children = undefined; + el._X_ROW_CHILD = undefined; + }); + + // 处理排序数组 + if (requestSort.value?.length) { + requestSort.value.forEach((el: any) => { + el.Id = undefined; + el.children = undefined; + el._X_ROW_CHILD = undefined; + el.isRequired = !!el.isRequired; + }); + } + if (backSort.value?.length) { + backSort.value.forEach((el: any) => { + el.Id = undefined; + el.children = undefined; + el._X_ROW_CHILD = undefined; + el.isRequired = !!el.isRequired; + }); + } + + // 添加 sort 和 alias 字段,并确保 isRequired 为布尔值 + rc = rc.map((item) => { + return { + ...item, + sort: getRowSeq(item, tableRef.value), + isRequired: !!item.isRequired, + alias: item?.alias || 'item.name', + }; + }); + fc = fc.map((item) => { + return { + ...item, + sort: getRowSeq(item, tableRef1.value), + isRequired: !!item.isRequired, + alias: item?.alias || 'item.name', + }; + }); + + // 处理表单数据,将 undefined 转为空字符串 + const data = cloneDeep(formData); + Object.keys(data).forEach((key) => { + if ((data as any)[key] === undefined) (data as any)[key] = ''; + }); + + // 根据是否有 id 决定使用哪个参数列表(与上游接口逻辑一致) + const id = route.value.query.id ? Number(route.value.query.id) : undefined; + const inParameterList = id + ? (requestSort.value.length ? requestSort.value : rc.reverse()) + : (rc.length ? rc.reverse() : requestSort.value); + const outParameterList = id + ? (backSort.value.length ? backSort.value : fc.reverse()) + : (fc.length ? fc.reverse() : backSort.value); + + // 获取二次请求参数(formParameterList) + // 如果页面中有第三个表格用于二次请求参数,需要定义 tableRef2 并在这里获取数据 + let formParameterList: any[] = []; + + const requestData: API.SaveInterfaceInput = { + ...data, + id, + optionType: (id ? 3 : 1) as API.OptionType, + isUpStream: false, // 下游接口 + inParameterList, + outParameterList, + ...(formParameterList.length > 0 && { formParameterList }), }; - confirmLoading.value = true; - const { code } = await postInterfaceSaveInterface(requestData); + const result = await postInterfaceSaveInterface(requestData); - if (code === '200') { + if (result) { console.log(route.value.query.id ? '修改成功' : '新增成功'); router.value.push({ name: 'SystemInterface', @@ -401,10 +549,10 @@ onUnmounted(() => { > - {{ option.label }} + {{ option.value }} @@ -499,10 +647,10 @@ onUnmounted(() => { > - {{ option.label }} + {{ option.value }} diff --git a/src/views/login/components/login-form.vue b/src/views/login/components/login-form.vue index d3b8c1c..b75c7cf 100644 --- a/src/views/login/components/login-form.vue +++ b/src/views/login/components/login-form.vue @@ -97,8 +97,9 @@ import { useStorage } from '@vueuse/core'; import { useUserStore } from '@/store'; import useLoading from '@/hooks/loading'; - import { sysAuthBLoginPost, sysAuthBGetPicCaptchaGet } from '@/api/SimpleAdmin/bEndPermissionVerify'; - import { sysLoginPolicyGet } from '@/api/SimpleAdmin/common'; + // RBAC 系统使用新的登录接口,此组件已废弃,请使用 pwd-login/index.vue + // import { sysAuthBLoginPost, sysAuthBGetPicCaptchaGet } from '@/api/SimpleAdmin/bEndPermissionVerify'; + // import { sysLoginPolicyGet } from '@/api/SimpleAdmin/common'; const router = useRouter(); const { t } = useI18n(); @@ -124,34 +125,14 @@ device: 'PC' as const, }); - // 加载验证码 + // 加载验证码 - RBAC 系统暂不支持验证码 const loadCaptcha = async () => { - try { - const res = await sysAuthBGetPicCaptchaGet(); - if (res && res.data) { - validCodeBase64.value = (res.data as any).validCodeBase64 || ''; - validCodeReqNo.value = (res.data as any).validCodeReqNo || ''; - } - } catch (error) { - console.error('加载验证码失败', error); - } + captchaOpen.value = false; }; - // 检查是否需要验证码 + // 检查是否需要验证码 - RBAC 系统暂不支持验证码 const checkCaptchaPolicy = async () => { - try { - const res = await sysLoginPolicyGet(); - if (res && res.data) { - const policies = Array.isArray(res.data) ? res.data : []; - const captchaPolicy = policies.find((item: any) => item.configKey === 'LOGIN_CAPTCHA_OPEN'); - captchaOpen.value = captchaPolicy?.configValue === 'true'; - if (captchaOpen.value) { - await loadCaptcha(); - } - } - } catch (error) { - console.error('获取登录策略失败', error); - } + captchaOpen.value = false; }; onMounted(() => { @@ -185,26 +166,49 @@ validCodeReqNo: captchaOpen.value ? validCodeReqNo.value : undefined, }; - const res = await sysAuthBLoginPost(loginData); + // RBAC 系统使用新的登录接口 + const { useRbacUserStore } = await import('@/store/modules/rbac-user'); + const rbacUserStore = useRbacUserStore(); + const success = await rbacUserStore.login(values.account, values.password); - if (res && res.data) { - const loginResult = res.data as any; + if (success && rbacUserStore.userInfo) { // 保存 token - if (loginResult.token) { - localStorage.setItem('token', loginResult.token); - // 保存用户信息 - if (loginResult.userInfo) { - userStore.setInfo(loginResult.userInfo); - } + if (rbacUserStore.token) { + localStorage.setItem('token', rbacUserStore.token); + // 将 RBAC 用户信息转换为 itfx 用户信息格式 + const userInfo: any = { + account: rbacUserStore.userInfo.account, + name: rbacUserStore.userInfo.name || rbacUserStore.userInfo.account, + avatar: rbacUserStore.userInfo.avatar, + email: rbacUserStore.userInfo.email, + id: rbacUserStore.userInfo.id, + defaultModule: undefined, + moduleList: [], + }; + userStore.setInfo(userInfo); } const { redirect, ...othersQuery } = router.currentRoute.value.query; - router.push({ - name: (redirect as string) || 'SystemInterface', + + const routeOptions: any = { query: { ...othersQuery, }, - }); + }; + + if (redirect) { + const redirectStr = redirect as string; + if (redirectStr.startsWith('/')) { + routeOptions.path = redirectStr; + } else { + routeOptions.name = redirectStr; + } + } else { + // 默认进入静态首页 + routeOptions.name = 'Workplace'; + } + + router.push(routeOptions); Message.success('登录成功'); const { rememberPassword } = loginConfig.value; diff --git a/src/views/login/components/phone-login/index.vue b/src/views/login/components/phone-login/index.vue index 6102555..4a3c15d 100644 --- a/src/views/login/components/phone-login/index.vue +++ b/src/views/login/components/phone-login/index.vue @@ -54,39 +54,21 @@ @@ -168,11 +170,28 @@ onMounted(() => { /* 深蓝色科技背景 */ background: #002770; + /* 优化:减少动画对性能的影响 */ + /* 在页面加载完成前暂停所有动画 */ + animation-play-state: paused; + + /* 支持用户的动画偏好设置 */ + @media (prefers-reduced-motion: reduce) { + *, + *::before, + *::after { + animation-duration: 0.01ms !important; + animation-iteration-count: 1 !important; + transition-duration: 0.01ms !important; + } + } + /* 几何图形 */ .geometric-shape { position: absolute; z-index: 1; opacity: 0.6; + /* 优化:只在动画时使用 will-change,减少内存占用 */ + transform: translateZ(0); /* 启用硬件加速 */ &.hexagon-1 { top: 25%; @@ -182,7 +201,10 @@ onMounted(() => { background: #FFF394; clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%); filter: drop-shadow(0 0 25px rgba(255, 243, 148, 0.9)); + /* 优化:延迟启动动画,减少初始加载压力 */ animation: hexagonPulse 4s ease-in-out infinite; + animation-delay: 1s; + animation-play-state: paused; } &.hexagon-2 { @@ -194,6 +216,8 @@ onMounted(() => { clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%); filter: drop-shadow(0 0 20px rgba(255, 243, 148, 0.7)); animation: hexagonPulse 5s ease-in-out infinite reverse; + animation-delay: 1.5s; + animation-play-state: paused; opacity: 0.5; } @@ -236,6 +260,7 @@ onMounted(() => { stroke-width: 2; stroke-dasharray: 5, 5; animation: lineFlow 3s linear infinite; + animation-play-state: paused; filter: drop-shadow(0 0 3px rgba(255, 243, 148, 0.8)); } } @@ -249,6 +274,8 @@ onMounted(() => { clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); box-shadow: 0 0 10px rgba(255, 243, 148, 1); z-index: 2; + transform: translateZ(0); + animation-play-state: paused; &.particle-1 { top: 20%; @@ -359,10 +386,13 @@ onMounted(() => { position: absolute; top: 50%; left: 40%; - transform: translate(-50%, -50%); + transform: translate(-50%, -50%) translateZ(0); z-index: 2; filter: drop-shadow(0 0 30px rgba(67, 122, 207, 0.6)); + /* 优化:延迟启动地球旋转动画 */ animation: earthRotate 30s linear infinite; + animation-delay: 0.5s; + animation-play-state: paused; svg { display: block; @@ -377,6 +407,9 @@ onMounted(() => { z-index: 3; filter: drop-shadow(0 0 25px rgba(255, 243, 148, 0.8)); animation: moonFloat 20s ease-in-out infinite; + animation-delay: 0.8s; + animation-play-state: paused; + transform: translateZ(0); svg { display: block; @@ -394,6 +427,8 @@ onMounted(() => { filter: drop-shadow(0 0 8px rgba(255, 243, 148, 0.6)); opacity: 0.6; animation: asteroidGlow 3s ease-in-out infinite; + animation-play-state: paused; + transform: translateZ(0); &.asteroid-1 { top: 20%; @@ -436,6 +471,7 @@ onMounted(() => { border-radius: 50%; filter: blur(2px); box-shadow: 0 0 10px rgba(255, 243, 148, 0.8); + animation-play-state: paused; &.meteor-1 { top: 10%; @@ -464,6 +500,8 @@ onMounted(() => { position: absolute; z-index: 4; filter: drop-shadow(0 0 15px rgba(255, 243, 148, 1)); + transform: translateZ(0); + animation-play-state: paused; svg { display: block; @@ -488,6 +526,8 @@ onMounted(() => { z-index: 3; filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.3)); opacity: 0.6; + transform: translateZ(0); + animation-play-state: paused; svg { display: block; diff --git a/src/views/not-found/index.vue b/src/views/not-found/index.vue index a8cffcf..7c3fce4 100644 --- a/src/views/not-found/index.vue +++ b/src/views/not-found/index.vue @@ -11,9 +11,29 @@ import { useRouter } from 'vue-router'; const router = useRouter(); - const back = () => { - // 跳转到系统接口页面 - router.push({ name: 'SystemInterface' }); + const back = async () => { + try { + // 先尝试使用路由名称跳转 + await router.push({ name: 'SystemInterface' }); + } catch (error) { + // 如果路由名称不存在,尝试使用路径跳转 + try { + await router.push({ path: '/api/interface' }); + } catch (pathError) { + // 如果路径也不存在,尝试返回上一页 + if (window.history.length > 1) { + router.back(); + } else { + // 如果没有历史记录,跳转到首页 + try { + await router.push({ path: '/home/workplace' }); + } catch (homeError) { + // 如果首页也不存在,跳转到登录页 + router.push({ path: '/login' }); + } + } + } + } }; diff --git a/src/views/system/announcement/components/NoticeDetail.vue b/src/views/system/announcement/components/NoticeDetail.vue deleted file mode 100644 index 6a2802e..0000000 --- a/src/views/system/announcement/components/NoticeDetail.vue +++ /dev/null @@ -1,208 +0,0 @@ - - - - - - diff --git a/src/views/system/announcement/components/NoticeForm.vue b/src/views/system/announcement/components/NoticeForm.vue deleted file mode 100644 index 8c6775f..0000000 --- a/src/views/system/announcement/components/NoticeForm.vue +++ /dev/null @@ -1,699 +0,0 @@ - - - - - - diff --git a/src/views/system/announcement/index.vue b/src/views/system/announcement/index.vue deleted file mode 100644 index d53d0e6..0000000 --- a/src/views/system/announcement/index.vue +++ /dev/null @@ -1,372 +0,0 @@ - - - - - - diff --git a/src/views/system/audit/oplog/components/columnChat.vue b/src/views/system/audit/oplog/components/columnChat.vue deleted file mode 100644 index a8e75e1..0000000 --- a/src/views/system/audit/oplog/components/columnChat.vue +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - diff --git a/src/views/system/audit/oplog/components/detail.vue b/src/views/system/audit/oplog/components/detail.vue deleted file mode 100644 index 590917e..0000000 --- a/src/views/system/audit/oplog/components/detail.vue +++ /dev/null @@ -1,135 +0,0 @@ - - - - - - - diff --git a/src/views/system/audit/oplog/components/pieChat.vue b/src/views/system/audit/oplog/components/pieChat.vue deleted file mode 100644 index 10c49f7..0000000 --- a/src/views/system/audit/oplog/components/pieChat.vue +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - diff --git a/src/views/system/audit/oplog/index.vue b/src/views/system/audit/oplog/index.vue deleted file mode 100644 index 958e15e..0000000 --- a/src/views/system/audit/oplog/index.vue +++ /dev/null @@ -1,249 +0,0 @@ - - - - - - - diff --git a/src/views/system/audit/vislog/components/detail.vue b/src/views/system/audit/vislog/components/detail.vue deleted file mode 100644 index 9d50e6f..0000000 --- a/src/views/system/audit/vislog/components/detail.vue +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - diff --git a/src/views/system/audit/vislog/components/lineChat.vue b/src/views/system/audit/vislog/components/lineChat.vue deleted file mode 100644 index 3dac5ef..0000000 --- a/src/views/system/audit/vislog/components/lineChat.vue +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - diff --git a/src/views/system/audit/vislog/components/pieChat.vue b/src/views/system/audit/vislog/components/pieChat.vue deleted file mode 100644 index 33c9087..0000000 --- a/src/views/system/audit/vislog/components/pieChat.vue +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - diff --git a/src/views/system/audit/vislog/index.vue b/src/views/system/audit/vislog/index.vue deleted file mode 100644 index 6e3932e..0000000 --- a/src/views/system/audit/vislog/index.vue +++ /dev/null @@ -1,249 +0,0 @@ - - - - - - - diff --git a/src/views/system/config/components/SafetyConfig/index.vue b/src/views/system/config/components/SafetyConfig/index.vue deleted file mode 100644 index 79a237e..0000000 --- a/src/views/system/config/components/SafetyConfig/index.vue +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - diff --git a/src/views/system/config/components/SafetyConfig/loginForm.vue b/src/views/system/config/components/SafetyConfig/loginForm.vue deleted file mode 100644 index 3db18a9..0000000 --- a/src/views/system/config/components/SafetyConfig/loginForm.vue +++ /dev/null @@ -1,185 +0,0 @@ - - - - - - diff --git a/src/views/system/config/components/SafetyConfig/pwdForm.vue b/src/views/system/config/components/SafetyConfig/pwdForm.vue deleted file mode 100644 index 098f2ee..0000000 --- a/src/views/system/config/components/SafetyConfig/pwdForm.vue +++ /dev/null @@ -1,216 +0,0 @@ - - - - - - diff --git a/src/views/system/config/components/SysBaseConfig.vue b/src/views/system/config/components/SysBaseConfig.vue deleted file mode 100644 index 07a7e6c..0000000 --- a/src/views/system/config/components/SysBaseConfig.vue +++ /dev/null @@ -1,505 +0,0 @@ - - - - - - diff --git a/src/views/system/config/index.vue b/src/views/system/config/index.vue deleted file mode 100644 index ae865af..0000000 --- a/src/views/system/config/index.vue +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - diff --git a/src/views/system/dict/components/DictFormModal.vue b/src/views/system/dict/components/DictFormModal.vue deleted file mode 100644 index 922cefd..0000000 --- a/src/views/system/dict/components/DictFormModal.vue +++ /dev/null @@ -1,137 +0,0 @@ - - - - diff --git a/src/views/system/dict/composables/useDictManagement.ts b/src/views/system/dict/composables/useDictManagement.ts deleted file mode 100644 index 1c0f480..0000000 --- a/src/views/system/dict/composables/useDictManagement.ts +++ /dev/null @@ -1,290 +0,0 @@ -import { ref, reactive } from 'vue'; -import { Message, Modal } from '@arco-design/web-vue'; -import { - sysOpsDictPageGet, - sysOpsDictTreeGet, - sysOpsDictAddPost, - sysOpsDictEditPost, - sysOpsDictDeletePost, -} from '@/api/SimpleAdmin/systemDict'; - -export function useDictManagement() { - const formVisible = ref(false); - const isEdit = ref(false); - const currentId = ref(null); - const currentCategory = ref('FRM'); - const currentParentId = ref(-1); - const dictTreeData = ref([]); - - const formData = reactive({ - dictLabel: '', - dictValue: '', - status: 'ENABLE', - sortCode: 99, - category: 'FRM', - parentId: 0, - }); - - // 转换为树选择器格式 - const convertToTreeSelect = (data: any[]): any[] => { - return data.map((item) => ({ - key: item.id, - title: item.dictLabel, - value: item.id, - children: item.children ? convertToTreeSelect(item.children) : undefined, - })); - }; - - // 获取字典树(支持搜索) - const getDictTree = async (params?: { Category?: string; SearchKey?: string }) => { - try { - const category = params?.Category ?? currentCategory.value; - const res = await sysOpsDictTreeGet({ - Category: category, - SearchKey: params?.SearchKey || '', - } as API.sysOpsDictTreeGetParams); - - // 响应拦截器已经返回了 res.data,所以 res 本身就是数据 - let list: any[] = []; - - if (!res) { - return { - totalCount: 0, - items: [], - }; - } - - // SimpleAdmin 返回的数据格式可能是数组或对象 - if (Array.isArray(res)) { - list = res.filter((item: any) => item != null); - } else if (res && typeof res === 'object') { - // 先检查是否有嵌套的 data 字段(兼容某些特殊情况) - const data = (res as any).data || res; - - if (Array.isArray(data)) { - list = data.filter((item: any) => item != null); - } else if (data && typeof data === 'object') { - // 如果是对象,尝试获取 list 或 data 字段 - list = Array.isArray(data.list) - ? data.list.filter((item: any) => item != null) - : Array.isArray(data.data) - ? data.data.filter((item: any) => item != null) - : []; - } - } - - // 转换为树选择器格式 - dictTreeData.value = convertToTreeSelect(list); - - return { - totalCount: list.length, - items: list, - }; - } catch (error) { - console.error('获取字典树失败', error); - console.error('错误详情:', error instanceof Error ? error.stack : error); - Message.error(`获取字典树失败: ${error instanceof Error ? error.message : '未知错误'}`); - return { - totalCount: 0, - items: [], - }; - } - }; - - // 获取字典列表 - const getDictList = async (params: any) => { - try { - const pageSize = Math.min(params.pageSize || 20, 100); - - const res = await sysOpsDictPageGet({ - PageNum: params.currentPage || params.pageIndex || 1, - PageSize: pageSize, - Category: params.category || 'FRM', - ParentId: params.parentId || 0, - SearchKey: params.searchKey || '', - }); - - console.log('getDictList 原始响应:', res); - - let list: any[] = []; - let total = 0; - - if (!res) { - console.log('响应为空'); - return { - totalCount: 0, - items: [], - }; - } - - // 处理响应数据 - // 响应拦截器已经返回了 res.data,所以 res 可能是: - // 1. 直接是 { pageNum, pageSize, total, list } 格式 - // 2. 或者是 { code: 200, data: { pageNum, pageSize, total, list } } 格式(如果拦截器没处理) - let data = res; - - // 如果还有嵌套的 data 字段,取出来 - if (res && typeof res === 'object' && 'data' in res && !('list' in res) && !('total' in res)) { - data = (res as any).data; - } - - console.log('处理后的 data:', data); - - if (Array.isArray(data)) { - // 如果 data 直接是数组 - list = data.filter((item: any) => item != null); - total = list.length; - } else if (data && typeof data === 'object') { - // 如果 data 是对象,尝试从 list 字段获取数据 - if (Array.isArray(data.list)) { - list = data.list.filter((item: any) => item != null); - total = data.total || data.totalCount || data.count || list.length; - } else if (Array.isArray(data.items)) { - // 兼容 items 字段 - list = data.items.filter((item: any) => item != null); - total = data.total || data.totalCount || data.count || list.length; - } else { - // 如果都没有,尝试将 data 本身当作数组 - list = []; - total = 0; - } - } - - console.log('最终返回的数据:', { totalCount: total, items: list }); - - return { - totalCount: total, - items: list, - }; - } catch (error) { - console.error('获取字典列表失败', error); - return { - totalCount: 0, - items: [], - }; - } - }; - - // 初始化表单数据 - const initFormData = () => { - Object.assign(formData, { - dictLabel: '', - dictValue: '', - status: 'ENABLE', - sortCode: 99, - category: currentCategory.value, - parentId: currentParentId.value === -1 ? 0 : (currentParentId.value as number), - }); - }; - - // 新增 - const handleAdd = async () => { - isEdit.value = false; - currentId.value = null; - initFormData(); - // 确保树形数据已加载 - await getDictTree({ Category: currentCategory.value }); - formVisible.value = true; - }; - - // 编辑 - const handleEdit = async (record: any) => { - isEdit.value = true; - currentId.value = record.id; - Object.assign(formData, { - dictLabel: record.dictLabel || '', - dictValue: record.dictValue || '', - status: record.status || 'ENABLE', - sortCode: record.sortCode || 99, - category: record.category || currentCategory.value, - parentId: record.parentId || 0, - }); - // 确保树形数据已加载 - await getDictTree({ Category: record.category || currentCategory.value }); - formVisible.value = true; - }; - - // 删除 - const handleDelete = (record: any, onSuccess?: () => void) => { - Modal.warning({ - title: '删除确认', - content: `确定要删除字典【${record.dictLabel}】吗?删除后无法恢复!`, - okText: '确定删除', - cancelText: '取消', - onOk: async () => { - try { - await sysOpsDictDeletePost({ ids: [record.id] }); - Message.success('删除成功'); - onSuccess?.(); - } catch (error) { - Message.error('删除失败'); - } - }, - }); - }; - - // 批量删除 - const handleBatchDelete = (selectedRows: any[], onSuccess?: () => void) => { - if (selectedRows.length === 0) { - Message.warning('请选择要删除的字典'); - return; - } - Modal.warning({ - title: '删除确认', - content: `确定要删除选中的 ${selectedRows.length} 个字典吗?删除后无法恢复!`, - okText: '确定删除', - cancelText: '取消', - onOk: async () => { - try { - const ids = selectedRows.map((row) => row.id); - await sysOpsDictDeletePost({ ids }); - Message.success('删除成功'); - onSuccess?.(); - } catch (error) { - Message.error('删除失败'); - } - }, - }); - }; - - // 提交表单 - const handleSubmit = async (submitData: any, onSuccess?: () => void) => { - try { - if (isEdit.value && currentId.value) { - await sysOpsDictEditPost({ - id: currentId.value, - ...submitData, - }); - Message.success('编辑成功'); - } else { - await sysOpsDictAddPost(submitData); - Message.success('新增成功'); - } - formVisible.value = false; - onSuccess?.(); - } catch (error: any) { - if (error?.errors) { - return; - } - Message.error(isEdit.value ? '编辑失败' : '新增失败'); - } - }; - - return { - formVisible, - isEdit, - formData, - currentCategory, - currentParentId, - currentId, - dictTreeData, - getDictList, - getDictTree, - handleAdd, - handleEdit, - handleDelete, - handleBatchDelete, - handleSubmit, - }; -} - diff --git a/src/views/system/dict/index.vue b/src/views/system/dict/index.vue deleted file mode 100644 index 721dd74..0000000 --- a/src/views/system/dict/index.vue +++ /dev/null @@ -1,552 +0,0 @@ - - - - - diff --git a/src/views/system/interface/components/EnteredMap.vue b/src/views/system/interface/components/EnteredMap.vue index 44f663f..5405252 100644 --- a/src/views/system/interface/components/EnteredMap.vue +++ b/src/views/system/interface/components/EnteredMap.vue @@ -1,5 +1,5 @@ - - - - - diff --git a/src/views/system/message/index.vue b/src/views/system/message/index.vue deleted file mode 100644 index aa14dea..0000000 --- a/src/views/system/message/index.vue +++ /dev/null @@ -1,403 +0,0 @@ - - - - - - diff --git a/src/views/system/newList/adhibition-list.vue b/src/views/system/newList/adhibition-list.vue index 4040084..37cf1de 100644 --- a/src/views/system/newList/adhibition-list.vue +++ b/src/views/system/newList/adhibition-list.vue @@ -327,8 +327,8 @@ import { getInterfaceGetInterfaceDropdownList } from '@/api/InterfaceServices/in Object.assign(selectedApp.value, { name: editForm.value.name, description: editForm.value.description, - webhookUrl: editForm.value.webhookUrl, - isOnline: editForm.value.isOnline + webhookUrl: editForm.value.webhookUrl + // 注意:不更新 isOnline,因为应用状态是通过滑块单独控制的 }); // 更新应用列表中的对应项 @@ -337,8 +337,8 @@ import { getInterfaceGetInterfaceDropdownList } from '@/api/InterfaceServices/in Object.assign(appList.value[appIndex], { name: editForm.value.name, description: editForm.value.description, - webhookUrl: editForm.value.webhookUrl, - isOnline: editForm.value.isOnline + webhookUrl: editForm.value.webhookUrl + // 注意:不更新 isOnline,因为应用状态是通过滑块单独控制的 }); } diff --git a/src/views/system/organization/index.vue b/src/views/system/organization/index.vue new file mode 100644 index 0000000..9644594 --- /dev/null +++ b/src/views/system/organization/index.vue @@ -0,0 +1,375 @@ + + + + + + diff --git a/src/views/system/organization/module/components/ModuleFormModal.vue b/src/views/system/organization/module/components/ModuleFormModal.vue deleted file mode 100644 index e9f95e1..0000000 --- a/src/views/system/organization/module/components/ModuleFormModal.vue +++ /dev/null @@ -1,100 +0,0 @@ - - - - diff --git a/src/views/system/organization/module/composables/useModuleManagement.ts b/src/views/system/organization/module/composables/useModuleManagement.ts deleted file mode 100644 index 19de77a..0000000 --- a/src/views/system/organization/module/composables/useModuleManagement.ts +++ /dev/null @@ -1,206 +0,0 @@ -import { ref, reactive } from 'vue'; -import { Message, Modal } from '@arco-design/web-vue'; -import { - sysLimitModulePageGet, - sysLimitModuleAddPost, - sysLimitModuleEditPost, - sysLimitModuleDeletePost, - sysLimitModuleDetailGet, -} from '@/api/SimpleAdmin/moduleManagement'; - -export function useModuleManagement() { - const formVisible = ref(false); - const isEdit = ref(false); - const currentId = ref(null); - - const formData = reactive({ - title: '', - name: '', - code: '', - icon: '', - status: 'ENABLE', - sortCode: 0, - description: '', - }); - - // 获取模块列表 - const getModuleList = async (params: any) => { - try { - // 限制 pageSize 不超过 100 - const pageSize = Math.min(params.pageSize || 20, 100); - - const res = await sysLimitModulePageGet({ - PageNum: params.currentPage || params.pageIndex || 1, - PageSize: pageSize, - SearchKey: params.title || params.name || params.SearchKey || '', - }); - - // 响应拦截器已经返回了 res.data,所以 res 本身就是数据 - let list: any[] = []; - let total = 0; - - if (!res) { - return { - totalCount: 0, - items: [], - }; - } - - // 如果 res 是数组,直接使用 - if (Array.isArray(res)) { - list = res.filter((item: any) => item != null); - total = list.length; - } - // 如果 res 是对象,尝试从 list 字段获取数据 - else if (res && typeof res === 'object') { - // 先检查是否有嵌套的 data 字段(兼容某些特殊情况) - const data = (res as any).data || res; - - if (Array.isArray(data)) { - list = data.filter((item: any) => item != null); - total = list.length; - } else if (data && typeof data === 'object') { - list = Array.isArray(data.list) ? data.list.filter((item: any) => item != null) : []; - total = data.total || data.totalCount || data.count || list.length; - } - } - - return { - totalCount: total, - items: list, - }; - } catch (error) { - console.error('获取模块列表失败', error); - return { - totalCount: 0, - items: [], - }; - } - }; - - // 初始化表单数据 - const initFormData = () => { - Object.assign(formData, { - title: '', - name: '', - code: '', - icon: '', - status: 'ENABLE', - sortCode: 0, - description: '', - }); - }; - - // 新增 - const handleAdd = () => { - isEdit.value = false; - currentId.value = null; - initFormData(); - formVisible.value = true; - }; - - // 编辑 - const handleEdit = async (record: any) => { - isEdit.value = true; - currentId.value = record.id; - try { - const res = await sysLimitModuleDetailGet({ Id: record.id }); - // 响应拦截器已经返回了 res.data,所以 res 本身就是数据 - if (res) { - const data = (res as any).data || res; - Object.assign(formData, { - title: data.title || '', - name: data.name || '', - code: data.code || '', - icon: data.icon || '', - status: data.status || 'ENABLE', - sortCode: data.sortCode || 0, - description: data.description || '', - }); - formVisible.value = true; - } - } catch (error) { - Message.error('获取模块详情失败'); - } - }; - - // 删除 - const handleDelete = (record: any, onSuccess?: () => void) => { - Modal.warning({ - title: '删除确认', - content: `确定要删除模块【${record.title}】吗?删除后无法恢复!`, - okText: '确定删除', - cancelText: '取消', - onOk: async () => { - try { - await sysLimitModuleDeletePost({ ids: [record.id] }); - Message.success('删除成功'); - onSuccess?.(); - } catch (error) { - Message.error('删除失败'); - } - }, - }); - }; - - // 批量删除 - const handleBatchDelete = (selectedRows: any[], onSuccess?: () => void) => { - if (selectedRows.length === 0) { - Message.warning('请选择要删除的模块'); - return; - } - Modal.warning({ - title: '删除确认', - content: `确定要删除选中的 ${selectedRows.length} 个模块吗?删除后无法恢复!`, - okText: '确定删除', - cancelText: '取消', - onOk: async () => { - try { - const ids = selectedRows.map((row) => row.id); - await sysLimitModuleDeletePost({ ids }); - Message.success('删除成功'); - onSuccess?.(); - } catch (error) { - Message.error('删除失败'); - } - }, - }); - }; - - // 提交表单 - const handleSubmit = async (submitData: any, onSuccess?: () => void) => { - try { - if (isEdit.value && currentId.value) { - await sysLimitModuleEditPost({ - id: currentId.value, - ...submitData, - }); - Message.success('编辑成功'); - } else { - await sysLimitModuleAddPost(submitData); - Message.success('新增成功'); - } - formVisible.value = false; - onSuccess?.(); - } catch (error: any) { - if (error?.errors) { - return; - } - Message.error(isEdit.value ? '编辑失败' : '新增失败'); - } - }; - - return { - formVisible, - isEdit, - currentId, - formData, - getModuleList, - handleAdd, - handleEdit, - handleDelete, - handleBatchDelete, - handleSubmit, - }; -} - diff --git a/src/views/system/organization/module/index.vue b/src/views/system/organization/module/index.vue deleted file mode 100644 index 1a761b0..0000000 --- a/src/views/system/organization/module/index.vue +++ /dev/null @@ -1,238 +0,0 @@ - - - - - diff --git a/src/views/system/organization/org/index.vue b/src/views/system/organization/org/index.vue deleted file mode 100644 index aadef46..0000000 --- a/src/views/system/organization/org/index.vue +++ /dev/null @@ -1,1069 +0,0 @@ - - - - - diff --git a/src/views/system/organization/position/components/PositionFormModal.vue b/src/views/system/organization/position/components/PositionFormModal.vue deleted file mode 100644 index 4a5d5b8..0000000 --- a/src/views/system/organization/position/components/PositionFormModal.vue +++ /dev/null @@ -1,83 +0,0 @@ - - - - diff --git a/src/views/system/organization/position/composables/usePositionManagement.ts b/src/views/system/organization/position/composables/usePositionManagement.ts deleted file mode 100644 index 79e3dd4..0000000 --- a/src/views/system/organization/position/composables/usePositionManagement.ts +++ /dev/null @@ -1,214 +0,0 @@ -import { ref, reactive } from 'vue'; -import { Message, Modal } from '@arco-design/web-vue'; -import { - sysOrganizationPositionPageGet, - sysOrganizationPositionAddPost, - sysOrganizationPositionEditPost, - sysOrganizationPositionDeletePost, - sysOrganizationPositionDetailGet, -} from '@/api/SimpleAdmin/positionManagement'; -import { sysOrganizationOrgTreeGet } from '@/api/SimpleAdmin/organizationManagement'; - -export function usePositionManagement() { - const formVisible = ref(false); - const isEdit = ref(false); - const currentId = ref(null); - const orgTreeData = ref([]); - - const formData = reactive({ - name: '', - code: '', - sortCode: 0, - remark: '', - }); - - // 获取组织树 - const getOrgTree = async () => { - try { - const res = await sysOrganizationOrgTreeGet(); - // 响应拦截器已经返回了 res.data,所以 res 本身就是数据 - if (res) { - const data = Array.isArray(res) ? res : (res as any).data || res; - const list = Array.isArray(data) ? data : []; - orgTreeData.value = list; - } - } catch (error) { - console.error('获取组织树失败', error); - } - }; - - // 获取职位列表(支持按组织ID过滤) - const getPositionList = async (params: any) => { - try { - const res = await sysOrganizationPositionPageGet({ - PageNum: params.currentPage || params.pageIndex || 1, - PageSize: params.pageSize || 10, - SearchKey: params.name || params.SearchKey || '', - OrgId: params.OrgId || undefined, - }); - - // 响应拦截器已经返回了 res.data,所以 res 本身就是数据 - let list: any[] = []; - let total = 0; - - if (!res) { - return { - totalCount: 0, - items: [], - }; - } - - // 如果 res 是数组,直接使用 - if (Array.isArray(res)) { - list = res.filter((item: any) => item != null); - total = list.length; - } - // 如果 res 是对象,尝试从 list 字段获取数据 - else if (res && typeof res === 'object') { - // 先检查是否有嵌套的 data 字段(兼容某些特殊情况) - const data = (res as any).data || res; - - if (Array.isArray(data)) { - list = data.filter((item: any) => item != null); - total = list.length; - } else if (data && typeof data === 'object') { - list = Array.isArray(data.list) ? data.list.filter((item: any) => item != null) : []; - total = data.total || data.totalCount || data.count || list.length; - } - } - - return { - totalCount: total, - items: list, - }; - } catch (error) { - console.error('获取职位列表失败', error); - return { - totalCount: 0, - items: [], - }; - } - }; - - // 初始化表单数据 - const initFormData = () => { - Object.assign(formData, { - name: '', - code: '', - sortCode: 0, - remark: '', - }); - }; - - // 新增 - const handleAdd = () => { - isEdit.value = false; - currentId.value = null; - initFormData(); - formVisible.value = true; - }; - - // 编辑 - const handleEdit = async (record: any) => { - isEdit.value = true; - currentId.value = record.id; - try { - const res = await sysOrganizationPositionDetailGet({ Id: record.id }); - // 响应拦截器已经返回了 res.data,所以 res 本身就是数据 - if (res) { - const data = (res as any).data || res; - Object.assign(formData, { - name: data.name || '', - code: data.code || '', - sortCode: data.sortCode || 0, - remark: data.remark || '', - }); - formVisible.value = true; - } - } catch (error) { - Message.error('获取职位详情失败'); - } - }; - - // 删除 - const handleDelete = (record: any, onSuccess?: () => void) => { - Modal.warning({ - title: '删除确认', - content: `确定要删除职位【${record.name}】吗?删除后无法恢复!`, - okText: '确定删除', - cancelText: '取消', - onOk: async () => { - try { - await sysOrganizationPositionDeletePost({ ids: [record.id] }); - Message.success('删除成功'); - onSuccess?.(); - } catch (error) { - Message.error('删除失败'); - } - }, - }); - }; - - // 批量删除 - const handleBatchDelete = (selectedRows: any[], onSuccess?: () => void) => { - if (selectedRows.length === 0) { - Message.warning('请选择要删除的职位'); - return; - } - Modal.warning({ - title: '删除确认', - content: `确定要删除选中的 ${selectedRows.length} 个职位吗?删除后无法恢复!`, - okText: '确定删除', - cancelText: '取消', - onOk: async () => { - try { - const ids = selectedRows.map((row) => row.id); - await sysOrganizationPositionDeletePost({ ids }); - Message.success('删除成功'); - onSuccess?.(); - } catch (error) { - Message.error('删除失败'); - } - }, - }); - }; - - // 提交表单 - const handleSubmit = async (submitData: any, onSuccess?: () => void) => { - try { - if (isEdit.value && currentId.value) { - await sysOrganizationPositionEditPost({ - id: currentId.value, - ...submitData, - }); - Message.success('编辑成功'); - } else { - await sysOrganizationPositionAddPost(submitData); - Message.success('新增成功'); - } - formVisible.value = false; - onSuccess?.(); - } catch (error: any) { - if (error?.errors) { - return; - } - Message.error(isEdit.value ? '编辑失败' : '新增失败'); - } - }; - - return { - formVisible, - isEdit, - currentId, - formData, - orgTreeData, - getOrgTree, - getPositionList, - handleAdd, - handleEdit, - handleDelete, - handleBatchDelete, - handleSubmit, - }; -} - diff --git a/src/views/system/organization/position/index.vue b/src/views/system/organization/position/index.vue deleted file mode 100644 index f476503..0000000 --- a/src/views/system/organization/position/index.vue +++ /dev/null @@ -1,627 +0,0 @@ - - - - - diff --git a/src/views/system/organization/user/components/DataScopeSelector.vue b/src/views/system/organization/user/components/DataScopeSelector.vue deleted file mode 100644 index 738b836..0000000 --- a/src/views/system/organization/user/components/DataScopeSelector.vue +++ /dev/null @@ -1,169 +0,0 @@ - - - - - - diff --git a/src/views/system/organization/user/components/GrantResourceModal.vue b/src/views/system/organization/user/components/GrantResourceModal.vue deleted file mode 100644 index 5180b92..0000000 --- a/src/views/system/organization/user/components/GrantResourceModal.vue +++ /dev/null @@ -1,755 +0,0 @@ - - - - - - - diff --git a/src/views/system/organization/user/components/GrantRoleModal.vue b/src/views/system/organization/user/components/GrantRoleModal.vue deleted file mode 100644 index 845cc0c..0000000 --- a/src/views/system/organization/user/components/GrantRoleModal.vue +++ /dev/null @@ -1,412 +0,0 @@ - - - - - diff --git a/src/views/system/organization/user/components/UserFormModal.vue b/src/views/system/organization/user/components/UserFormModal.vue deleted file mode 100644 index 0fed1ff..0000000 --- a/src/views/system/organization/user/components/UserFormModal.vue +++ /dev/null @@ -1,190 +0,0 @@ - - - - diff --git a/src/views/system/organization/user/composables/useUserManagement.ts b/src/views/system/organization/user/composables/useUserManagement.ts deleted file mode 100644 index fe4b78e..0000000 --- a/src/views/system/organization/user/composables/useUserManagement.ts +++ /dev/null @@ -1,286 +0,0 @@ -import { ref, reactive } from 'vue'; -import { Message, Modal } from '@arco-design/web-vue'; -import { - sysOrganizationUserPageGet, - sysOrganizationUserAddPost, - sysOrganizationUserEditPost, - sysOrganizationUserDeletePost, - sysOrganizationUserDetailGet, - sysOrganizationUserEnableUserPost, - sysOrganizationUserDisableUserPost, -} from '@/api/SimpleAdmin/userManagement'; -import { sysOrganizationOrgTreeGet } from '@/api/SimpleAdmin/organizationManagement'; -import { sysOrganizationPositionSelectorGet } from '@/api/SimpleAdmin/positionManagement'; - -export function useUserManagement() { - const formVisible = ref(false); - const isEdit = ref(false); - const currentId = ref(null); - const orgTreeData = ref([]); // 用于树组件 - const orgTreeDataForSelect = ref([]); // 用于选择器 - const positionOptions = ref>([]); - - const formData = reactive({ - account: '', - password: '', - confirmPassword: '', - realName: '', - phone: '', - email: '', - orgId: undefined, - positionId: undefined, - status: 'ENABLE', - sortCode: 0, - remark: '', - }); - - // 获取组织树 - const getOrgTree = async () => { - try { - const res = await sysOrganizationOrgTreeGet(); - // 响应拦截器已经返回了 res.data,所以 res 本身就是数据 - if (res) { - const data = Array.isArray(res) ? res : (res as any).data || res; - const list = Array.isArray(data) ? data : []; - orgTreeData.value = list; - orgTreeDataForSelect.value = convertToTreeSelect(list); - } - } catch (error) { - console.error('获取组织树失败', error); - } - }; - - // 获取职位列表 - const getPositionList = async () => { - try { - const res = await sysOrganizationPositionSelectorGet({}); - // 响应拦截器已经返回了 res.data,所以 res 本身就是数据 - if (res) { - const data = Array.isArray(res) ? res : (res as any).data || res; - const list = Array.isArray(data) ? data : []; - positionOptions.value = list.map((item: any) => ({ - label: item.name, - value: item.id, - })); - } - } catch (error) { - console.error('获取职位列表失败', error); - } - }; - - // 转换为树选择器格式 - const convertToTreeSelect = (data: any[]): any[] => { - return data.map((item) => ({ - key: item.id, - title: item.name, - value: item.id, - children: item.children ? convertToTreeSelect(item.children) : undefined, - })); - }; - - // 获取用户列表(支持按组织ID过滤) - const getUserList = async (params: any) => { - try { - const res = await sysOrganizationUserPageGet({ - PageNum: params.currentPage || params.pageIndex || 1, - PageSize: params.pageSize || 10, - SearchKey: params.account || params.realName || params.SearchKey || '', - OrgId: params.OrgId || undefined, - }); - - // 响应拦截器已经返回了 res.data,所以 res 本身就是数据 - let list: any[] = []; - let total = 0; - - if (!res) { - return { - totalCount: 0, - items: [], - }; - } - - // 如果 res 是数组,直接使用 - if (Array.isArray(res)) { - list = res.filter((item: any) => item != null); - total = list.length; - } - // 如果 res 是对象,尝试从 list 字段获取数据 - else if (res && typeof res === 'object') { - // 先检查是否有嵌套的 data 字段(兼容某些特殊情况) - const data = (res as any).data || res; - - if (Array.isArray(data)) { - list = data.filter((item: any) => item != null); - total = list.length; - } else if (data && typeof data === 'object') { - list = Array.isArray(data.list) ? data.list.filter((item: any) => item != null) : []; - total = data.total || data.totalCount || data.count || list.length; - } - } - - return { - totalCount: total, - items: list, - }; - } catch (error) { - console.error('获取用户列表失败', error); - return { - totalCount: 0, - items: [], - }; - } - }; - - // 初始化表单数据 - const initFormData = () => { - Object.assign(formData, { - account: '', - password: '', - confirmPassword: '', - realName: '', - phone: '', - email: '', - orgId: undefined, - positionId: undefined, - status: 'ENABLE', - sortCode: 0, - remark: '', - }); - }; - - // 新增 - const handleAdd = () => { - isEdit.value = false; - currentId.value = null; - initFormData(); - formVisible.value = true; - }; - - // 编辑 - const handleEdit = async (record: any) => { - isEdit.value = true; - currentId.value = record.id; - try { - const res = await sysOrganizationUserDetailGet({ Id: record.id }); - // 响应拦截器已经返回了 res.data,所以 res 本身就是数据 - if (res) { - const data = (res as any).data || res; - Object.assign(formData, { - account: data.account || '', - realName: data.realName || '', - phone: data.phone || '', - email: data.email || '', - orgId: data.orgId, - positionId: data.positionId, - status: data.status || 'ENABLE', - sortCode: data.sortCode || 0, - remark: data.remark || '', - }); - formVisible.value = true; - } - } catch (error) { - Message.error('获取用户详情失败'); - } - }; - - // 删除 - const handleDelete = (record: any, onSuccess?: () => void) => { - Modal.warning({ - title: '删除确认', - content: `确定要删除用户【${record.account}】吗?删除后无法恢复!`, - okText: '确定删除', - cancelText: '取消', - onOk: async () => { - try { - await sysOrganizationUserDeletePost({ ids: [record.id] }); - Message.success('删除成功'); - onSuccess?.(); - } catch (error) { - Message.error('删除失败'); - } - }, - }); - }; - - // 批量删除 - const handleBatchDelete = (selectedRows: any[], onSuccess?: () => void) => { - if (selectedRows.length === 0) { - Message.warning('请选择要删除的用户'); - return; - } - Modal.warning({ - title: '删除确认', - content: `确定要删除选中的 ${selectedRows.length} 个用户吗?删除后无法恢复!`, - okText: '确定删除', - cancelText: '取消', - onOk: async () => { - try { - const ids = selectedRows.map((row) => row.id); - await sysOrganizationUserDeletePost({ ids }); - Message.success('删除成功'); - onSuccess?.(); - } catch (error) { - Message.error('删除失败'); - } - }, - }); - }; - - // 状态切换 - const handleStatusChange = async (record: any, val: boolean, onSuccess?: () => void) => { - try { - if (val) { - await sysOrganizationUserEnableUserPost({ id: record.id }); - Message.success('启用成功'); - } else { - await sysOrganizationUserDisableUserPost({ id: record.id }); - Message.success('禁用成功'); - } - onSuccess?.(); - } catch (error) { - Message.error('操作失败'); - } - }; - - // 提交表单 - const handleSubmit = async (submitData: any, onSuccess?: () => void) => { - try { - if (isEdit.value && currentId.value) { - await sysOrganizationUserEditPost({ - id: currentId.value, - ...submitData, - }); - Message.success('编辑成功'); - } else { - await sysOrganizationUserAddPost(submitData); - Message.success('新增成功'); - } - formVisible.value = false; - onSuccess?.(); - } catch (error: any) { - if (error?.errors) { - return; - } - Message.error(isEdit.value ? '编辑失败' : '新增失败'); - } - }; - - return { - formVisible, - isEdit, - currentId, - formData, - orgTreeData, - orgTreeDataForSelect, - positionOptions, - getOrgTree, - getPositionList, - getUserList, - handleAdd, - handleEdit, - handleDelete, - handleBatchDelete, - handleStatusChange, - handleSubmit, - }; -} diff --git a/src/views/system/organization/user/index.vue b/src/views/system/organization/user/index.vue index dbeffbe..1f3dd79 100644 --- a/src/views/system/organization/user/index.vue +++ b/src/views/system/organization/user/index.vue @@ -1,749 +1,497 @@ - - - diff --git a/src/views/system/permission/button/index.vue b/src/views/system/permission/button/index.vue index 6e7030e..257b841 100644 --- a/src/views/system/permission/button/index.vue +++ b/src/views/system/permission/button/index.vue @@ -94,14 +94,16 @@ import { import TablePro from '@/components/TablePro/index.vue'; const { t } = useI18n(); -import { - sysLimitButtonPageGet, - sysLimitButtonAddPost, - sysLimitButtonEditPost, - sysLimitButtonDeletePost, - sysLimitButtonDetailGet, -} from '@/api/SimpleAdmin/permissionButton'; -import { sysLimitMenuTreeGet } from '@/api/SimpleAdmin/menuManagement'; +// RBAC 系统暂不支持按钮管理功能 +// import { +// sysLimitButtonPageGet, +// sysLimitButtonAddPost, +// sysLimitButtonEditPost, +// sysLimitButtonDeletePost, +// sysLimitButtonDetailGet, +// } from '@/api/SimpleAdmin/permissionButton'; +// RBAC 系统使用 MenuService +import { MenuService } from '@/api/rbac'; import type { VxeGridProps } from 'vxe-table'; defineOptions({ @@ -172,18 +174,12 @@ const formConfig = { ], }; -// 获取菜单树 +// 获取菜单树 - 使用 RBAC 系统 const getMenuTree = async () => { try { - const res = await sysLimitMenuTreeGet({ - Module: 0, - }); - - if (res && res.data) { - const data = res.data as any; - const list = Array.isArray(data) ? data : []; - menuTreeData.value = convertToTreeSelect(list); - } + const res = await MenuService.getRbacMenuGetMenuTree(); + const list = Array.isArray(res) ? res : []; + menuTreeData.value = convertToTreeSelect(list); } catch (error) { console.error('获取菜单树失败', error); } @@ -199,36 +195,13 @@ const convertToTreeSelect = (data: any[]): any[] => { })); }; -// 获取按钮列表 +// 获取按钮列表 - RBAC 系统暂不支持按钮管理功能 const getButtonList = async (params: any) => { - try { - const res = await sysLimitButtonPageGet({ - PageNum: params.currentPage || 1, - PageSize: params.pageSize || 10, - SearchKey: params.title || '', - ParentId: params.parentId || undefined, - }); - - if (res && res.data) { - const data = res.data as any; - return { - page: { - total: data.total || 0, - }, - result: Array.isArray(data.list) ? data.list : [], - }; - } - return { - page: { total: 0 }, - result: [], - }; - } catch (error) { - console.error('获取按钮列表失败', error); - return { - page: { total: 0 }, - result: [], - }; - } + // RBAC 系统暂不支持按钮管理功能,返回空数据 + return { + page: { total: 0 }, + result: [], + }; }; onMounted(() => { @@ -249,90 +222,24 @@ const handleAdd = () => { formVisible.value = true; }; -// 编辑 +// 编辑 - RBAC 系统暂不支持按钮管理功能 const handleEdit = async (record: any) => { - isEdit.value = true; - currentId.value = record.id; - try { - const res = await sysLimitButtonDetailGet({ Id: record.id }); - if (res && res.data) { - const data = res.data as any; - Object.assign(formData, { - title: data.title || '', - code: data.code || '', - parentId: data.parentId || 0, - sortCode: data.sortCode || 0, - description: data.description || '', - }); - formVisible.value = true; - } - } catch (error) { - Message.error(t('system.button.message.getDetailFailed')); - } + Message.warning('RBAC 系统暂不支持按钮管理功能'); }; -// 删除 +// 删除 - RBAC 系统暂不支持按钮管理功能 const handleDelete = (record: any) => { - Modal.confirm({ - title: t('system.button.modal.deleteConfirmTitle'), - content: t('system.button.modal.deleteConfirmContentSingle', { title: record.title }), - onOk: async () => { - try { - await sysLimitButtonDeletePost({ ids: [record.id] }); - Message.success(t('system.button.message.deleteSuccess')); - tableRef.value?.refresh(); - } catch (error) { - Message.error(t('system.button.message.deleteFailed')); - } - }, - }); + Message.warning('RBAC 系统暂不支持按钮管理功能'); }; -// 批量删除 +// 批量删除 - RBAC 系统暂不支持按钮管理功能 const handleBatchDelete = () => { - if (selectedRows.value.length === 0) { - Message.warning(t('system.button.message.selectButtonsToDelete')); - return; - } - Modal.confirm({ - title: t('system.button.modal.deleteConfirmTitle'), - content: t('system.button.modal.deleteConfirmContentBatch', { count: selectedRows.value.length }), - onOk: async () => { - try { - const ids = selectedRows.value.map((row) => row.id); - await sysLimitButtonDeletePost({ ids }); - Message.success(t('system.button.message.deleteSuccess')); - selectedRows.value = []; - tableRef.value?.refresh(); - } catch (error) { - Message.error(t('system.button.message.deleteFailed')); - } - }, - }); + Message.warning('RBAC 系统暂不支持按钮管理功能'); }; -// 提交表单 +// 提交表单 - RBAC 系统暂不支持按钮管理功能 const handleSubmit = async () => { - try { - await formRef.value?.validate(); - if (isEdit.value && currentId.value) { - await sysLimitButtonEditPost({ - id: currentId.value, - ...formData, - }); - Message.success(t('system.button.message.editSuccess')); - } else { - await sysLimitButtonAddPost(formData); - Message.success(t('system.button.message.addSuccess')); - } - formVisible.value = false; - tableRef.value?.refresh(); - } catch (error: any) { - if (error?.errors) { - return; - } - Message.error(isEdit.value ? t('system.button.message.editFailed') : t('system.button.message.addFailed')); - } + Message.warning('RBAC 系统暂不支持按钮管理功能'); }; // 取消 diff --git a/src/views/system/permission/menu/components/MenuFormModal.vue b/src/views/system/permission/menu/components/MenuFormModal.vue deleted file mode 100644 index 457edb3..0000000 --- a/src/views/system/permission/menu/components/MenuFormModal.vue +++ /dev/null @@ -1,156 +0,0 @@ - - - - diff --git a/src/views/system/permission/menu/composables/useMenuManagement.ts b/src/views/system/permission/menu/composables/useMenuManagement.ts deleted file mode 100644 index cc94988..0000000 --- a/src/views/system/permission/menu/composables/useMenuManagement.ts +++ /dev/null @@ -1,317 +0,0 @@ -import { ref, reactive, onMounted } from 'vue'; -import { useRoute } from 'vue-router'; -import { useUserStore } from '@/store'; -import { Message, Modal } from '@arco-design/web-vue'; -import { - sysLimitMenuTreeGet, - sysLimitMenuAddPost, - sysLimitMenuEditPost, - sysLimitMenuDeletePost, - sysLimitMenuDetailGet, -} from '@/api/SimpleAdmin/menuManagement'; - -export function useMenuManagement() { - const route = useRoute(); - const userStore = useUserStore(); - - const formVisible = ref(false); - const isEdit = ref(false); - const currentId = ref(null); - const menuTreeData = ref([]); - - // 获取当前模块 ID - 使用用户当前选择的模块 ID(类似 SimpleAdmin 的 chooseModule) - const getCurrentModuleId = (): number => { - // 优先从 chooseModule 获取(当前选择的模块,类似 SimpleAdmin) - const chooseModule = userStore.chooseModuleGet; - if (chooseModule && typeof chooseModule === 'number' && chooseModule > 0) { - return chooseModule; - } - - // 如果 chooseModule 没有,尝试从 defaultModule 获取 - const defaultModule = userStore.userInfo?.defaultModule; - if (defaultModule && typeof defaultModule === 'number' && defaultModule > 0) { - return defaultModule; - } - - // 如果用户信息中没有,尝试从路由参数获取 - const routeModuleId = route.query.moduleId; - if (routeModuleId) { - const moduleId = Number(routeModuleId); - if (!isNaN(moduleId) && moduleId > 0) { - return moduleId; - } - } - - // 默认返回 0 - return 0; - }; - - const formData = reactive({ - title: '', - code: '', - menuType: 'MENU', - parentId: 0, - path: '', - component: '', - icon: '', - sortCode: 0, - status: 'ENABLE', - isHide: false, - description: '', - module: 0, - }); - - // 获取菜单类型文本 - const getMenuTypeText = (type: string) => { - const map: Record = { - CATALOG: '目录', - MENU: '菜单', - BUTTON: '按钮', - }; - return map[type] || type; - }; - - // 转换为树选择器格式 - const convertToTreeSelect = (data: any[]): any[] => { - return data.map((item) => ({ - key: item.id, - title: item.title, - value: item.id, - children: item.children ? convertToTreeSelect(item.children) : undefined, - })); - }; - - // 获取菜单树(支持搜索) - const getMenuTree = async (params?: { Module?: number; SearchKey?: string }) => { - try { - const moduleId = params?.Module ?? getCurrentModuleId(); - const res = await sysLimitMenuTreeGet({ - Module: moduleId, - SearchKey: params?.SearchKey || '', - } as API.sysLimitMenuTreeGetParams); - - // 响应拦截器已经返回了 res.data,所以 res 本身就是数据 - let list: any[] = []; - - if (!res) { - return { - totalCount: 0, - items: [], - }; - } - - // SimpleAdmin 返回的数据格式可能是数组或对象 - if (Array.isArray(res)) { - list = res.filter((item: any) => item != null); - } else if (res && typeof res === 'object') { - // 先检查是否有嵌套的 data 字段(兼容某些特殊情况) - const data = (res as any).data || res; - - if (Array.isArray(data)) { - list = data.filter((item: any) => item != null); - } else if (data && typeof data === 'object') { - // 如果是对象,尝试获取 list 或 data 字段 - list = Array.isArray(data.list) - ? data.list.filter((item: any) => item != null) - : Array.isArray(data.data) - ? data.data.filter((item: any) => item != null) - : []; - } - } - - // 转换为树选择器格式 - menuTreeData.value = convertToTreeSelect(list); - - return { - totalCount: list.length, - items: list, - }; - } catch (error) { - console.error('获取菜单树失败', error); - console.error('错误详情:', error instanceof Error ? error.stack : error); - Message.error(`获取菜单树失败: ${error instanceof Error ? error.message : '未知错误'}`); - return { - totalCount: 0, - items: [], - }; - } - }; - - // 初始化表单数据 - const initFormData = () => { - const currentModuleId = getCurrentModuleId(); - Object.assign(formData, { - title: '', - code: '', - menuType: 'MENU', - parentId: 0, - path: '', - component: '', - icon: '', - sortCode: 0, - status: 'ENABLE', - isHide: false, - description: '', - module: currentModuleId, // 使用当前模块 ID - }); - }; - - // 新增 - const handleAdd = () => { - isEdit.value = false; - currentId.value = null; - initFormData(); - formVisible.value = true; - }; - - // 编辑 - const handleEdit = async (record: any) => { - isEdit.value = true; - currentId.value = record.id; - try { - const res = await sysLimitMenuDetailGet({ Id: record.id } as API.sysLimitMenuDetailGetParams); - // 响应拦截器已经返回了 res.data,所以 res 本身就是数据 - if (res) { - const data = (res as any).data || res; - Object.assign(formData, { - title: data.title || '', - code: data.code || '', - menuType: data.menuType || 'MENU', - parentId: data.parentId || 0, - path: data.path || '', - component: data.component || '', - icon: data.icon || '', - sortCode: data.sortCode || 0, - status: data.status || 'ENABLE', - isHide: data.isHide || false, - description: data.description || '', - module: data.module || 0, - }); - formVisible.value = true; - } - } catch (error) { - console.error('获取菜单详情失败', error); - Message.error('获取菜单详情失败'); - } - }; - - // 删除 - const handleDelete = (record: any, onSuccess?: () => void) => { - Modal.warning({ - title: '删除确认', - content: `确定要删除菜单【${record.title}】吗?删除后无法恢复!`, - okText: '确定删除', - cancelText: '取消', - onOk: async () => { - try { - await sysLimitMenuDeletePost({ ids: [record.id] } as API.BaseIdListInput); - Message.success('删除成功'); - onSuccess?.(); - } catch (error) { - console.error('删除失败', error); - Message.error('删除失败'); - } - }, - }); - }; - - // 批量删除 - const handleBatchDelete = (selectedRows: any[], onSuccess?: () => void) => { - if (selectedRows.length === 0) { - Message.warning('请选择要删除的菜单'); - return; - } - Modal.warning({ - title: '删除确认', - content: `确定要删除选中的 ${selectedRows.length} 个菜单吗?删除后无法恢复!`, - okText: '确定删除', - cancelText: '取消', - onOk: async () => { - try { - const ids = selectedRows.map((row) => row.id).filter(id => id != null); - await sysLimitMenuDeletePost({ ids } as API.BaseIdListInput); - Message.success('删除成功'); - onSuccess?.(); - } catch (error) { - console.error('删除失败', error); - Message.error('删除失败'); - } - }, - }); - }; - - // 提交表单 - const handleSubmit = async (submitData: any, onSuccess?: () => void) => { - try { - const currentModuleId = getCurrentModuleId(); - - if (isEdit.value && currentId.value) { - // 编辑菜单 - const editData: API.MenuEditInput = { - id: currentId.value ?? 0, - title: submitData.title || '', - code: submitData.code || '', - name: submitData.code || submitData.title || '', // name 字段使用 code,如果没有则使用 title - menuType: submitData.menuType || 'MENU', - parentId: submitData.parentId ?? 0, - path: submitData.path || '', - component: submitData.component || '', - icon: submitData.icon || 'icon-file', - sortCode: submitData.sortCode ?? 0, - status: submitData.status || 'ENABLE', - isHide: submitData.isHide ?? false, - description: submitData.description || '', - module: submitData.module ?? currentModuleId ?? 0, // 使用提交的 module 或当前模块 ID - }; - await sysLimitMenuEditPost(editData); - Message.success('编辑成功'); - } else { - // 新增菜单 - 严格按照接口结构 - const addData: any = { - parentId: submitData.parentId ?? 0, - title: submitData.title || '', - name: submitData.code || submitData.title || '', // name 字段必须要有值 - menuType: submitData.menuType || 'MENU', - module: submitData.module ?? currentModuleId ?? 0, - path: submitData.path || '', - icon: submitData.icon || 'icon-file', - }; - - // 添加可选字段 - if (submitData.code) addData.code = submitData.code; - if (submitData.component) addData.component = submitData.component; - if (submitData.description) addData.description = submitData.description; - if (submitData.sortCode !== undefined && submitData.sortCode !== null) addData.sortCode = submitData.sortCode; - if (submitData.status) addData.status = submitData.status; - if (submitData.isHide !== undefined && submitData.isHide !== null) addData.isHide = submitData.isHide; - - await sysLimitMenuAddPost(addData as API.MenuAddInput); - Message.success('新增成功'); - } - formVisible.value = false; - onSuccess?.(); - } catch (error: any) { - console.error('提交失败', error); - if (error?.errors) { - return; - } - Message.error(isEdit.value ? '编辑失败' : '新增失败'); - } - }; - - return { - formVisible, - isEdit, - currentId, - formData, - menuTreeData, - getMenuTypeText, - getMenuTree, - handleAdd, - handleEdit, - handleDelete, - handleBatchDelete, - handleSubmit, - }; -} - diff --git a/src/views/system/permission/menu/index.vue b/src/views/system/permission/menu/index.vue index 01e00c9..721b5c5 100644 --- a/src/views/system/permission/menu/index.vue +++ b/src/views/system/permission/menu/index.vue @@ -1,519 +1,814 @@