From f9bc87a39d31afa72311a24ac38a8107794e2fac Mon Sep 17 00:00:00 2001 From: qiaochuLei <124648559+qiaochuLei@users.noreply.github.com> Date: Thu, 9 Nov 2023 15:34:31 +0800 Subject: [PATCH] fix: bug#19771 * fix: bug#19771 --- .env.develop | 3 +- .env.production | 3 +- package.json | 2 +- src/api/comm.ts | 4 +- src/api/initHome.ts | 3 +- src/api/system/dictionary.ts | 50 ++ src/api/system/region.ts | 22 + src/api/system/role.ts | 9 +- src/api/system/user.ts | 9 +- src/components/AMapComponent/index.vue | 5 +- src/components/Layout/SinglePage.vue | 129 +++ src/components/Layout/components/Notice.vue | 14 +- .../Layout/components/NoticeInfo.vue | 3 +- src/components/Layout/index.ts | 3 +- src/router/index.ts | 2 +- src/router/menu.ts | 4 +- src/store/menu.ts | 41 +- src/utils/menu.ts | 53 +- src/utils/request.ts | 8 +- .../components/NotificationRecord/index.vue | 5 +- .../components/StationMessage/index.vue | 5 +- .../Center/components/Subscribe/index.vue | 17 +- src/views/account/Center/components/data.ts | 37 +- .../device/Instance/Detail/Info/index.vue | 2 +- .../components/BindParentDevice/index.vue | 2 +- src/views/iframe/index.vue | 61 +- src/views/init-home/Menu/index.vue | 16 +- src/views/init-home/Role/index.vue | 246 +++++- src/views/init-home/data/RoleData.ts | 3 + src/views/init-home/data/baseMenu.ts | 797 +++++++++++++++++- src/views/init-home/index.vue | 7 +- .../system/Apply/componenets/MenuDialog.vue | 11 +- src/views/system/Basis/index.vue | 1 - .../components/Left/Export/index.vue | 98 +++ .../Dictionary/components/Left/index.vue | 218 +++++ .../Dictionary/components/Left/save/index.vue | 125 +++ .../components/Right/Save/index.vue | 143 ++++ .../Dictionary/components/Right/index.vue | 225 +++++ src/views/system/Dictionary/index.vue | 45 + src/views/system/Menu/Detail/BasicInfo.vue | 13 +- src/views/system/Menu/Setting/index.vue | 87 +- src/views/system/Menu/Setting/utils.ts | 19 +- src/views/system/Menu/components/fields.ts | 1 + src/views/system/Menu/index.vue | 46 +- src/views/system/NoticeRule/index.vue | 44 +- src/views/system/Region/LeftTree/index.vue | 240 ++++++ src/views/system/Region/MapTool/index.ts | 0 src/views/system/Region/MapTool/map.vue | 304 +++++++ src/views/system/Region/Save/BuildIn.vue | 124 +++ src/views/system/Region/Save/TracePoint.vue | 45 + src/views/system/Region/Save/index.vue | 234 +++++ src/views/system/Region/index.vue | 65 ++ .../Relationship/components/EditDialog.vue | 64 +- src/views/system/Relationship/index.vue | 12 +- .../system/Role/Detail/Permiss/index.vue | 42 +- src/views/system/Role/RoleLeft/index.vue | 175 ++++ .../Role/RoleRight/components/AddDialog.vue | 139 +++ src/views/system/Role/RoleRight/index.vue | 193 +++++ .../system/Role/components/AddDialog.vue | 79 -- src/views/system/Role/index.vue | 176 +--- .../system/User/components/EditUserDialog.vue | 276 +++--- src/views/system/User/index.vue | 42 +- vite.config.ts | 1 + yarn.lock | 8 +- 64 files changed, 4317 insertions(+), 543 deletions(-) create mode 100644 src/api/system/dictionary.ts create mode 100644 src/api/system/region.ts create mode 100644 src/components/Layout/SinglePage.vue create mode 100644 src/views/system/Dictionary/components/Left/Export/index.vue create mode 100644 src/views/system/Dictionary/components/Left/index.vue create mode 100644 src/views/system/Dictionary/components/Left/save/index.vue create mode 100644 src/views/system/Dictionary/components/Right/Save/index.vue create mode 100644 src/views/system/Dictionary/components/Right/index.vue create mode 100644 src/views/system/Dictionary/index.vue create mode 100644 src/views/system/Region/LeftTree/index.vue create mode 100644 src/views/system/Region/MapTool/index.ts create mode 100644 src/views/system/Region/MapTool/map.vue create mode 100644 src/views/system/Region/Save/BuildIn.vue create mode 100644 src/views/system/Region/Save/TracePoint.vue create mode 100644 src/views/system/Region/Save/index.vue create mode 100644 src/views/system/Region/index.vue create mode 100644 src/views/system/Role/RoleLeft/index.vue create mode 100644 src/views/system/Role/RoleRight/components/AddDialog.vue create mode 100644 src/views/system/Role/RoleRight/index.vue delete mode 100644 src/views/system/Role/components/AddDialog.vue diff --git a/.env.develop b/.env.develop index c8349cd4..8ace0858 100644 --- a/.env.develop +++ b/.env.develop @@ -1,2 +1,3 @@ ENV=develop -VITE_APP_BASE_API=/api \ No newline at end of file +VITE_APP_BASE_API=/api +VITE_TOKEN_KEY = X-Access-Token diff --git a/.env.production b/.env.production index 990e0635..73450e9f 100644 --- a/.env.production +++ b/.env.production @@ -1,2 +1,3 @@ ENV=production -VITE_APP_BASE_API=/api \ No newline at end of file +VITE_APP_BASE_API=/api +VITE_TOKEN_KEY = X-Access-Token diff --git a/package.json b/package.json index 6976a7c2..c8700605 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "event-source-polyfill": "^1.0.31", "global": "^4.4.0", "jetlinks-store": "^0.0.3", - "jetlinks-ui-components": "^1.0.34-4", + "jetlinks-ui-components": "^1.0.34-7", "js-cookie": "^3.0.1", "jsencrypt": "^3.3.2", "less": "^4.1.3", diff --git a/src/api/comm.ts b/src/api/comm.ts index 42384c5e..312d52ce 100644 --- a/src/api/comm.ts +++ b/src/api/comm.ts @@ -36,4 +36,6 @@ export const systemVersion = () => server.get<{edition?: string}>('/system/versi */ export const queryDashboard = (data: Record) => server.post(`/dashboard/_multi`, data) -export const fileUpload = (data: any) => server.post('/file/static', data) \ No newline at end of file +export const fileUpload = (data: any) => server.post('/file/static', data) + +export const lowCodeUrl = () => server.get('/system/config/low-code') \ No newline at end of file diff --git a/src/api/initHome.ts b/src/api/initHome.ts index 3b339a74..9359b8d2 100644 --- a/src/api/initHome.ts +++ b/src/api/initHome.ts @@ -4,7 +4,8 @@ import server from '@/utils/request'; export const updateMenus = (data: any) => server.patch(`/menu/iot/_all`, data) // 添加角色 export const addRole = (data: any) => server.post(`/role`, data) - +//添加角色分组 +export const addRoleGroup = (data:any) => server.patch('/role/group',data) //更新权限菜单 export const getRoleMenu = (id: string) => server.get(`/menu/role/${id}/_grant/tree`) diff --git a/src/api/system/dictionary.ts b/src/api/system/dictionary.ts new file mode 100644 index 00000000..451d1a24 --- /dev/null +++ b/src/api/system/dictionary.ts @@ -0,0 +1,50 @@ +import server, { request } from '@/utils/request'; + +/** + * 查询字典列表 + */ +export const getDicList = (data:any) => request.post('/dictionary/_query/no-paging',data) + +/** + * 查询字典分页 + */ +export const getDic_page = (data:any) => request.post('/dictionary/_query',data) +/** + * 查询字典ID是否重复 + */ +export const verifyId = (id:string) => request.post(`/dictionary/_exists`,{where:`id is ${id}`}) + +/** + * 保存字典 + */ +export const addDictionary = (data:any) => request.patch('/dictionary',data) + +/** + * 删除字典 + */ +export const deleteDictionary =(id:string) => request.delete(`/dictionary/${id}`) + +/** + * 查询字典项 + */ +export const queryDicItem = (data:any)=>request.post('/dictionary-item/_query',data) + +/** + * 保存字典项 + */ +export const saveDicItem = (data:any) => request.patch('/dictionary-item',data) + +/** + * 删除字典项 + */ +export const deleteDicItem = (id:string) => request.delete(`/dictionary-item/${id}`) + +/** + * 校验字典项value唯一 + */ +export const verifyValue = (data:any) => request.post('/dictionary-item/_exists',data) + +/** + * 下载字典 + */ +export const downDic = (data:any) => request.post('/dictionary/detail/_query',data) \ No newline at end of file diff --git a/src/api/system/region.ts b/src/api/system/region.ts new file mode 100644 index 00000000..80f5d217 --- /dev/null +++ b/src/api/system/region.ts @@ -0,0 +1,22 @@ +import server from '@/utils/request'; + +// 获取全部地区(树结构) +export const getRegionTree = (): Promise => server.post(`/area/_all/tree`); + +// 校验名称是否存在 +export const validateName = (name: string, id?: string): Promise => server.get(`/area/name/_validate?name=${name}${id ? `&id=${id}` : ''}`); + +//校验行政区划代码是否存在 +export const validateCode = (code: string, id?: string): Promise => server.get(`/area/code/_validate?code=${code}${id ? `&id=${id}` : ''}`); + +// 删除 +export const delRegion = (id: string): Promise => server.remove(`/area/${id}`); + +// 保存 +export const saveRegion = (data: any): Promise => server.post(`/area`, data); + +// 更新 +export const updateRegion = (data: any): Promise => server.patch(`/area`, data); + +// 获取全部内置地区(树结构) +export const getBuiltinRegionTree = (data: any): Promise => server.post(`/area/builtin/_all/tree`, data); diff --git a/src/api/system/role.ts b/src/api/system/role.ts index 9198a5e3..bb9a2670 100644 --- a/src/api/system/role.ts +++ b/src/api/system/role.ts @@ -1,3 +1,4 @@ +import request from '@/utils/request'; import server from '@/utils/request'; // 获取角色列表 @@ -25,4 +26,10 @@ export const getUserByRole_api = (data: any): Promise => server.post(`/user // 将用户与角色绑定 export const bindUser_api = (roleId:string, data: string[]): Promise => server.post(`/role/${roleId}/users/_bind`, data); // 将用户与角色解绑 -export const unbindUser_api = (roleId:string, data: string[]): Promise => server.post(`/role/${roleId}/users/_unbind`, data); \ No newline at end of file +export const unbindUser_api = (roleId:string, data: string[]): Promise => server.post(`/role/${roleId}/users/_unbind`, data); +//查询分组 +export const queryRoleGroup = (data:any) => request.post('/role/group/_query/no-paging',data) +//保存分组 +export const saveRoleGroup = (data:any) => request.patch('/role/group',data) +//删除分组 +export const deleteRoleGroup = (id:string) => request.remove(`/role/group/${id}`) \ No newline at end of file diff --git a/src/api/system/user.ts b/src/api/system/user.ts index 9b6a01c3..4a36c5d3 100644 --- a/src/api/system/user.ts +++ b/src/api/system/user.ts @@ -15,8 +15,11 @@ export const validateField_api = (type: 'username' | 'password', name: string) = // 获取角色列表 export const getRoleList_api = () => server.get(`/role/_query/no-paging?paging=false`); + +//获取角色列表 +export const getRoleList = (data:any) => server.post('/role/group/detail/_query/tree',data) // 获取组织列表 -export const getDepartmentList_api = () => server.get(`/organization/_all/tree?paging=false`); +export const getDepartmentList_api = (data:any) => server.post(`/organization/_all/tree`,data); // 获取用户信息 export const getUser_api = (id: string) => server.get(`/user/detail/${id}`); @@ -33,4 +36,6 @@ export const updatePassword_api = (data: { id: string, password: string }) => se // 修改用户状态 export const changeUserStatus_api = (data: object) => server.patch(`/user`,data); // 删除用户 -export const deleteUser_api = (id: string) => server.remove(`/user/${id}`); \ No newline at end of file +export const deleteUser_api = (id: string) => server.remove(`/user/${id}`); +// 查询角色不分页 +export const queryRole_api = (data: any): Promise => server.post(`/role/_query/no-paging`, data) \ No newline at end of file diff --git a/src/components/AMapComponent/index.vue b/src/components/AMapComponent/index.vue index 6dec0ed4..8de55a2e 100644 --- a/src/components/AMapComponent/index.vue +++ b/src/components/AMapComponent/index.vue @@ -22,6 +22,8 @@ import '@vuemap/vue-amap/dist/style.css'; import { getAMapUiPromise } from './utils'; import { useSystem } from '@/store/system'; +const emit = defineEmits('init') + const system = useSystem(); interface AMapProps { style?: CSSProperties; @@ -65,8 +67,9 @@ const initMap = (e: any) => { if (isOpenUi.value) { getAMapUI(); } + emit('init', e) }; \ No newline at end of file + diff --git a/src/components/Layout/SinglePage.vue b/src/components/Layout/SinglePage.vue new file mode 100644 index 00000000..c2f0fd49 --- /dev/null +++ b/src/components/Layout/SinglePage.vue @@ -0,0 +1,129 @@ + - diff --git a/src/views/init-home/Menu/index.vue b/src/views/init-home/Menu/index.vue index d4270dde..6ce235ff 100644 --- a/src/views/init-home/Menu/index.vue +++ b/src/views/init-home/Menu/index.vue @@ -96,12 +96,26 @@ const menuCount = (menus: any[]) => { return pre + _count; }, 0); }; +/** + * 添加options show用于控制菜单是否显示函数 + */ +const dealMenu = (data:any) =>{ + data.forEach((item:any)=>{ + item.options = Object.assign({ + show: true + }, item?.options || {}) + if(item.children){ + dealMenu(item.children) + } + }) +} /** * 初始化菜单 */ const initMenu = async () => { return new Promise(async (resolve) => { // 用户中心 + dealMenu(menuDatas.current) console.log([...menuDatas.current!, USER_CENTER_MENU_DATA]); const res = await updateMenus([...menuDatas.current!, USER_CENTER_MENU_DATA]); if (res.status === 200) { @@ -125,4 +139,4 @@ defineExpose({ margin-right: 16px; } } - \ No newline at end of file + diff --git a/src/views/init-home/Role/index.vue b/src/views/init-home/Role/index.vue index de2505b8..a1701027 100644 --- a/src/views/init-home/Role/index.vue +++ b/src/views/init-home/Role/index.vue @@ -1,15 +1,31 @@ \ No newline at end of file +} \ No newline at end of file diff --git a/src/views/init-home/data/RoleData.ts b/src/views/init-home/data/RoleData.ts index 098e5a41..ae6f81f8 100644 --- a/src/views/init-home/data/RoleData.ts +++ b/src/views/init-home/data/RoleData.ts @@ -13,15 +13,18 @@ export const RoleData = { [ROLEKEYS.device]: { name: '设备接入岗', description: '该角色负责设备接入模块的维护管理', + groupId:'default_group', state: { text: '正常', value: 'enabled' }, }, [ROLEKEYS.link]: { name: '运维管理岗', + groupId:'default_group', description: '该角色负责系统运维模块的维护管理', state: { text: '正常', value: 'enabled' }, }, [ROLEKEYS.complex]: { name: '综合管理岗', + groupId:'default_group', description: '该角色负责系统运维和设备接入模块的维护管理', state: { text: '正常', value: 'enabled' }, }, diff --git a/src/views/init-home/data/baseMenu.ts b/src/views/init-home/data/baseMenu.ts index a8211b1b..8fe72816 100644 --- a/src/views/init-home/data/baseMenu.ts +++ b/src/views/init-home/data/baseMenu.ts @@ -13,6 +13,9 @@ export const USER_CENTER_MENU_DATA = { sortIndex: 9999, granted: true, owner: 'iot', + options: { + isShow: false, + }, permissions: [ { permission: 'system_config', @@ -1413,7 +1416,7 @@ export default [ }, ], }, - + ], accessSupport: { text: "间接支持", value: "indirect" }, supportDataAccess: false, @@ -3445,6 +3448,30 @@ export default [ permission: 'role', actions: ['query'], }, + { + permission: 'role-group', + actions: ['query'] + } + ], + }, + { + id: 'groupUpdate', + name: '角色组编辑', + permissions: [ + { + permission: 'role-group', + actions: ['query','save'] + } + ], + }, + { + id: 'groupDelete', + name: '角色组删除', + permissions: [ + { + permission: 'role-group', + actions: ['query','delete'] + } ], }, ], @@ -4013,6 +4040,144 @@ export default [ accessSupport: { text: "不支持", value: "unsupported" }, supportDataAccess: false }, + { + code: 'system/Dictionary', + name: '数据字典', + owner: 'iot', + id: 'b69782873cc24be8165c6ad292359092', + sortIndex: 12, + url: '/system/Dictionary', + icon: 'FormOutlined', + showPage: ['dictionary'], + permissions: [], + buttons: [ + { + id: "add", + name: "新增", + permissions: [ + { + permission: "dictionary", + actions: [ + "save" + ] + } + ] + }, + { + id: "delete", + name: "删除", + permissions: [ + { + permission: "dictionary", + actions: [ + "delete" + ] + } + ] + }, + { + id: "update", + name: "编辑", + permissions: [ + { + permission: "dictionary", + actions: [ + "save" + ] + } + ] + }, + { + id: "import", + name: "导入", + permissions: [ + { + permission: "dictionary", + actions: [ + "save" + ] + } + ] + }, + { + id: "down", + name: "下载", + permissions: [ + { + permission: "dictionary", + actions: [ + "query" + ] + } + ] + }, + { + id: "action", + name: "启用/禁用", + permissions: [ + { + permission: "dictionary", + actions: [ + "save" + ] + } + ] + } + ], + accessSupport: { text: "不支持", value: "unsupported" }, + supportDataAccess: false + }, + { + code: 'system/Region', + name: '地区管理', + owner: 'iot', + id: 'b69782873cc24be8165c6ad29233333', + sortIndex: 12, + url: '/system/region', + icon: 'FormOutlined', + showPage: ['area'], + permissions: [], + buttons: [ + { + id: "add", + name: "新增", + permissions: [ + { + permission: "area", + actions: [ + "save" + ] + } + ] + }, + { + id: "delete", + name: "删除", + permissions: [ + { + permission: "area", + actions: [ + "delete" + ] + } + ] + }, + { + id: "update", + name: "编辑", + permissions: [ + { + permission: "area", + actions: [ + "save" + ] + } + ] + }, + ], + accessSupport: { text: "不支持", value: "unsupported" }, + supportDataAccess: false + }, // { // code: 'system/License', // name: 'License管理', @@ -4426,5 +4591,635 @@ export default [ supportDataAccess: false }, ], + }, + { + "path": "3n23", + "sortIndex": 5, + "level": 1, + "owner": "iot", + "name": "WEB IDE", + "code": "web_ide", + "url": "/web_ide", + "icon": "MenuUnfoldOutlined", + showPage: ["low-code-info", "low-code-editor"], + "options": { + isShow: false, + }, + "accessSupport": { + "text": "不支持", + "value": "unsupported" + }, + "indirectMenus": [], + permissions: [ + { + "permission": "low-code-info", + "actions": [ + "add", "query", "save", "delete" + ] + }, + { + "permission": "low-code-editor", + "actions": [ + "query", "deploy" + ] + } + ], + "creatorId": "1199596756811550720", + "createTime": 1698735482730, + "supportDataAccess": false + }, + { + "path": "3nkE", + "sortIndex": 6, + "level": 1, + "owner": "iot", + "name": "工作流", + "code": "process", + "url": "/workflow", + "icon": "MenuUnfoldOutlined", + showPage: ["process-form","process-deployment", "process-runtime"], + "options": { + "show": true, + "isShow": false + }, + "permissions": [ + { + "permission": "low-code-info", + "actions": [ + "query" + ] + }, + { + "permission": "process-runtime", + "actions": [ + "reject", + "start", + "self", + "claim", + "complete", + "createAndStart", + "repeal" + ] + } + ], + "accessSupport": { + "text": "不支持", + "value": "unsupported" + }, + "indirectMenus": [], + "children": [ + // { + // "path": "3nkE-n7lJ", + // "sortIndex": 1, + // "level": 2, + // "name": "工作流", + // "code": "process/home", + // "describe": "", + // "url": "/workflow/home", + // "icon": "UpCircleOutlined", + // showPage: ["process-form"], + // "permissions": [ + // { + // "permission": "process-form", + // "actions": [ + // "query" + // ] + // }, + // { + // "permission": "low-code-info", + // "actions": [ + // "query" + // ] + // }, + // ], + // "accessSupport": { + // "text": "不支持", + // "value": "unsupported" + // }, + // "indirectMenus": [], + // "buttons": [], + // "options": { + // "show": true + // }, + // "creatorId": "1199596756811550720", + // "createTime": 1699263818795, + // "supportDataAccess": false + // }, + { + "path": "3nkE-n7lJ", + "sortIndex": 2, + "level": 2, + "name": "表单", + "code": "process/form", + "describe": "", + "url": "/workflow/form", + "icon": "UpCircleOutlined", + showPage: ["process-form"], + "permissions": [ + { + "permission": "process-form", + "actions": [ + "query" + ] + } + ], + "accessSupport": { + "text": "不支持", + "value": "unsupported" + }, + "indirectMenus": [], + "buttons": [ + { + "id": "add", + "name": "新增", + "permissions": [ + { + "permission": "process-form", + "actions": [ + "save" + ] + } + ] + }, + { + "id": "save", + "name": "保存", + "permissions": [ + { + "permission": "process-form", + "actions": [ + "save" + ] + } + ] + }, + { + "id": "update", + "name": "编辑", + "permissions": [ + { + "permission": "process-form", + "actions": [ + "save" + ] + } + ] + }, + { + "id": "delete", + "name": "删除", + "permissions": [ + { + "permission": "process-form", + "actions": [ + "delete" + ] + } + ] + } + ], + "options": { + "show": true + }, + "creatorId": "1199596756811550720", + "createTime": 1699263818795, + "supportDataAccess": false + }, + { + "path": "3nkE-ysKb", + "sortIndex": 3, + "level": 2, + "name": "流程模型", + "code": "process/model", + "describe": "", + "url": "/workflow/model", + "icon": "UpCircleOutlined", + showPage: ["process-definition"], + "permissions": [ + { + "permission": "process-definition", + "actions": [ + "query" + ] + } + ], + "accessSupport": { + "text": "不支持", + "value": "unsupported" + }, + "indirectMenus": [], + "buttons": [ + { + "id": "add", + "name": "新增", + "permissions": [ + { + "permission": "process-definition", + "actions": [ + "save" + ] + } + ] + }, + { + "id": "delete", + "name": "删除", + "permissions": [ + { + "permission": "process-definition", + "actions": [ + "delete" + ] + } + ] + }, + { + "id": "update", + "name": "编辑", + "permissions": [ + { + "permission": "process-definition", + "actions": [ + "save" + ] + } + ] + }, + { + "id": "save", + "name": "保存", + "permissions": [ + { + "permission": "process-definition", + "actions": [ + "save" + ] + } + ] + }, + { + "id": "deploy", + "name": "部署", + "permissions": [ + { + "permission": "process-definition", + "actions": [ + "save" + ] + } + ] + } + ], + "options": { + "show": true + }, + "creatorId": "1199596756811550720", + "createTime": 1699264341009, + "supportDataAccess": false + }, + { + "path": "3nkE-fJkR", + "sortIndex": 4, + "level": 2, + "name": "流程实例", + "code": "process/instance", + "describe": "", + showPage: ["process-deployment"], + "url": "/workflow/instance", + "icon": "UpCircleOutlined", + "status": 1, + "permissions": [ + { + "permission": "process-deployment", + "actions": [ + "query" + ] + } + ], + "accessSupport": { + "text": "不支持", + "value": "unsupported" + }, + "indirectMenus": [], + "buttons": [ + { + "id": "action", + "name": "启/禁用", + "permissions": [ + { + "permission": "process-deployment", + "actions": [ + "save" + ] + } + ] + }, + { + "id": "auth", + "name": "权限控制", + "permissions": [ + { + "permission": "process-deployment", + "actions": [ + "save" + ] + } + ] + }, + { + "id": "delete", + "name": "删除", + "permissions": [ + { + "permission": "process-deployment", + "actions": [ + "delete" + ] + } + ] + } + ], + "options": { + "show": true + }, + "creatorId": "1199596756811550720", + "createTime": 1699264485954, + "supportDataAccess": false + }, + { + "path": "3nkE-i2nG", + "sortIndex": 5, + "level": 2, + "name": "发起流程", + "code": "process/initiate", + "describe": "", + "url": "/workflow/initiate", + "icon": "UpOutlined", + showPage: ["process-runtime"], + "permissions": [ + { + "permission": "process-definition", + "actions": [ + "query" + ] + }, + { + "permission": "process-deployment", + "actions": [ + "query" + ] + }, + { + "permission": "process-form", + "actions": [ + "query" + ] + }, + { + "permission": "process-runtime", + "actions": [ + "reject", + "start", + "self", + "claim", + "complete", + "createAndStart", + "repeal" + ] + } + ], + "accessSupport": { + "text": "不支持", + "value": "unsupported" + }, + "indirectMenus": [], + "options": { + "show": true + }, + "creatorId": "1199596756811550720", + "createTime": 1699269393605, + "supportDataAccess": false + }, + { + "path": "3nkE-4T1D", + "sortIndex": 6, + "level": 2, + "name": "待办事项", + "code": "process/me/todo", + "describe": "", + "url": "/workflow/me/todo", + "icon": "UpCircleOutlined", + showPage: ["process-runtime"], + "permissions": [ + { + "permission": "process-definition", + "actions": [ + "query" + ] + }, + { + "permission": "process-deployment", + "actions": [ + "query" + ] + }, + { + "permission": "process-form", + "actions": [ + "query" + ] + }, + { + "permission": "process-runtime", + "actions": [ + "reject", + "start", + "self", + "claim", + "complete", + "createAndStart", + "repeal" + ] + } + ], + "accessSupport": { + "text": "不支持", + "value": "unsupported" + }, + "indirectMenus": [], + "options": { + "show": true + }, + "creatorId": "1199596756811550720", + "createTime": 1699269425041, + "supportDataAccess": false + }, + { + "path": "3nkE-RXP3", + "sortIndex": 7, + "level": 2, + "name": "已办事项", + "code": "process/me/finished", + "describe": "", + "url": "/workflow/me/finished", + "icon": "UpCircleOutlined", + showPage: ["process-runtime"], + "permissions": [ + { + "permission": "process-definition", + "actions": [ + "query" + ] + }, + { + "permission": "process-deployment", + "actions": [ + "query" + ] + }, + { + "permission": "process-form", + "actions": [ + "query" + ] + }, + { + "permission": "process-runtime", + "actions": [ + "reject", + "start", + "self", + "claim", + "complete", + "createAndStart", + "repeal" + ] + } + ], + "accessSupport": { + "text": "不支持", + "value": "unsupported" + }, + "indirectMenus": [], + "options": { + "show": true + }, + "creatorId": "1199596756811550720", + "createTime": 1699269455412, + "supportDataAccess": false + }, + { + "path": "3nkE-ibau", + "sortIndex": 8, + "level": 2, + "name": "我发起的", + "code": "process/me/initiate", + "describe": "", + "url": "/workflow/me/initiate", + "icon": "UpCircleOutlined", + showPage: ["process-runtime"], + "permissions": [ + { + "permission": "process-definition", + "actions": [ + "query" + ] + }, + { + "permission": "process-deployment", + "actions": [ + "query" + ] + }, + { + "permission": "process-form", + "actions": [ + "query" + ] + }, + { + "permission": "process-runtime", + "actions": [ + "reject", + "start", + "self", + "claim", + "complete", + "createAndStart", + "repeal" + ] + } + ], + "accessSupport": { + "text": "不支持", + "value": "unsupported" + }, + "indirectMenus": [], + "options": { + "show": true + }, + "creatorId": "1199596756811550720", + "createTime": 1699269488928, + "supportDataAccess": false + }, + { + "path": "3nkE-vCQb", + "sortIndex": 10, + "level": 2, + "name": "抄送给我", + "code": "process/me/cc", + "describe": "", + "url": "/workflow/me/cc", + "icon": "BorderInnerOutlined", + "status": 1, + showPage: ["process-runtime"], + "permissions": [ + { + "permission": "process-definition", + "actions": [ + "query" + ] + }, + { + "permission": "process-runtime", + "actions": [ + "reject", + "start", + "self", + "claim", + "complete", + "createAndStart", + "repeal" + ] + }, + { + "permission": "process-deployment", + "actions": [ + "query" + ] + }, + { + "permission": "process-form", + "actions": [ + "query" + ] + } + ], + "accessSupport": { + "text": "不支持", + "value": "unsupported" + }, + "indirectMenus": [], + "options": { + "show": true + }, + "creatorId": "1199596756811550720", + "createTime": 1699348851779, + "supportDataAccess": false + } + ], + "creatorId": "8004214f8141f29cb951befdca3615f0", + "createTime": 1699262480040, + "supportDataAccess": false } ]; diff --git a/src/views/init-home/index.vue b/src/views/init-home/index.vue index f8becc64..3e48d85c 100644 --- a/src/views/init-home/index.vue +++ b/src/views/init-home/index.vue @@ -112,6 +112,11 @@ const submitData = async () => { loading.value = false; return; } + const roleGroupRes = await roleRef.value.submitRoleGroup(); + if (!roleGroupRes) { + loading.value = false; + return; + } const initDataRes = await initDataRef.value.save(); if (!initDataRes) { loading.value = false; @@ -119,7 +124,7 @@ const submitData = async () => { } loading.value = false; // 当前数据是否成功提交 - if (basicRes && menuRes && roleRes && initDataRes) { + if (basicRes && menuRes && roleRes && roleGroupRes && initDataRes) { onlyMessage('保存成功'); // // 记录初始化数据,跳转首页 const res = await saveInit(); diff --git a/src/views/system/Apply/componenets/MenuDialog.vue b/src/views/system/Apply/componenets/MenuDialog.vue index c5f13f13..ce351e2c 100644 --- a/src/views/system/Apply/componenets/MenuDialog.vue +++ b/src/views/system/Apply/componenets/MenuDialog.vue @@ -127,7 +127,16 @@ function getMenus(id: string) { { column: 'appId', value: id, - }, + }, + { + terms:[ + { + value:"%show\":true%", + termType:"like", + column:"options" + } + ] + } ], }; getMenuTree_api(params).then((resp: any) => { diff --git a/src/views/system/Basis/index.vue b/src/views/system/Basis/index.vue index 8fddcbb4..7424577b 100644 --- a/src/views/system/Basis/index.vue +++ b/src/views/system/Basis/index.vue @@ -332,7 +332,6 @@ import { save_api } from '@/api/system/basis'; import { usePermissionStore } from '@/store/permission'; import { useSystem } from '@/store/system'; import { settingDetail } from '@/api/login'; - const action = `${BASE_API_PATH}/file/static`; const headers = { [TOKEN_KEY]: LocalStore.get(TOKEN_KEY) }; const formRef = ref(); diff --git a/src/views/system/Dictionary/components/Left/Export/index.vue b/src/views/system/Dictionary/components/Left/Export/index.vue new file mode 100644 index 00000000..ebf5f3ec --- /dev/null +++ b/src/views/system/Dictionary/components/Left/Export/index.vue @@ -0,0 +1,98 @@ + + + + \ No newline at end of file diff --git a/src/views/system/Dictionary/components/Left/index.vue b/src/views/system/Dictionary/components/Left/index.vue new file mode 100644 index 00000000..f6ad60f6 --- /dev/null +++ b/src/views/system/Dictionary/components/Left/index.vue @@ -0,0 +1,218 @@ + + + + \ No newline at end of file diff --git a/src/views/system/Dictionary/components/Left/save/index.vue b/src/views/system/Dictionary/components/Left/save/index.vue new file mode 100644 index 00000000..17306c29 --- /dev/null +++ b/src/views/system/Dictionary/components/Left/save/index.vue @@ -0,0 +1,125 @@ + + + + \ No newline at end of file diff --git a/src/views/system/Dictionary/components/Right/Save/index.vue b/src/views/system/Dictionary/components/Right/Save/index.vue new file mode 100644 index 00000000..66cf6bb7 --- /dev/null +++ b/src/views/system/Dictionary/components/Right/Save/index.vue @@ -0,0 +1,143 @@ + + + + \ No newline at end of file diff --git a/src/views/system/Dictionary/components/Right/index.vue b/src/views/system/Dictionary/components/Right/index.vue new file mode 100644 index 00000000..6b3bc8e1 --- /dev/null +++ b/src/views/system/Dictionary/components/Right/index.vue @@ -0,0 +1,225 @@ + + + + \ No newline at end of file diff --git a/src/views/system/Dictionary/index.vue b/src/views/system/Dictionary/index.vue new file mode 100644 index 00000000..f7a5cf78 --- /dev/null +++ b/src/views/system/Dictionary/index.vue @@ -0,0 +1,45 @@ + + + + \ No newline at end of file diff --git a/src/views/system/Menu/Detail/BasicInfo.vue b/src/views/system/Menu/Detail/BasicInfo.vue index 656295cf..82f55070 100644 --- a/src/views/system/Menu/Detail/BasicInfo.vue +++ b/src/views/system/Menu/Detail/BasicInfo.vue @@ -329,6 +329,7 @@ const form = reactive({ getMenuInfo_api(routeParams.id).then((resp: any) => { form.data = { ...(resp.result as formType), + permissions: resp.result?.permissions ? resp.result.permissions : [], accessSupport: resp.result?.accessSupport?.value || 'unsupported', }; @@ -337,7 +338,15 @@ const form = reactive({ if (isNoCommunity) { // 获取关联菜单 - getMenuTree_api({ paging: false }).then((resp: any) => { + getMenuTree_api({ paging: false,terms:[{terms:[{ + terms:[ + { + value:"%show\":true%", + termType:"like", + column:"options" + } + ] + }]}]}).then((resp: any) => { form.treeData = resp.result; }); // 获取资产类型 @@ -377,7 +386,7 @@ const form = reactive({ const params = { ...form.data, owner: form.data?.owner ?? null, - options: { show: true }, + options: form.data?.options || { show: true }, accessSupport: { value: accessSupportValue, label: diff --git a/src/views/system/Menu/Setting/index.vue b/src/views/system/Menu/Setting/index.vue index 19a5a8e4..5fc19416 100644 --- a/src/views/system/Menu/Setting/index.vue +++ b/src/views/system/Menu/Setting/index.vue @@ -65,6 +65,7 @@ import { import { filterMenu, initData, + inItSelected, drop, select, getMaxDepth, @@ -128,31 +129,70 @@ const getProvidersFn = async () => { } } getProvidersFn(); -function filterTree(nodes: Array, selectedKeys: Array) { +/** + * 作用:过滤掉非选中菜单重新组成新的数组 + */ +// function filterTree(nodes: Array, selectedKeys: Array,parentId?:string) { +// const filtered = []; +// for (let i = 0; i < nodes.length; i++) { +// const node = nodes[i]; +// if (!node.code) { +// continue; +// } +// node.parentId = parentId ? undefined : parentId +// if (selectedKeys.indexOf(node.code) !== -1) { +// filtered.push(node); +// if (node.children) { +// node.children = filterTree(node.children, selectedKeys,node.id); +// } +// } else if (node.children) { +// node.children = filterTree(node.children, selectedKeys,node.id); +// if (node.children.length > 0) { +// filtered.push(node); +// } +// } +// } +// return filtered; +// } +/** + * + * @param nodes 菜单数据 + * @param selectedKeys 选中的菜单 + * 选中和非选中改变show的值 + */ +const dealTree = (nodes: Array, selectedKeys: Array,parentId?:string) =>{ const filtered = []; for (let i = 0; i < nodes.length; i++) { const node = nodes[i]; if (!node.code) { continue; } + node.parentId = parentId ? undefined : parentId + node?.options ? node.options.show = false : node.options = { show : false } if (selectedKeys.indexOf(node.code) !== -1) { - filtered.push(node); + node.options.show = true if (node.children) { - node.children = filterTree(node.children, selectedKeys); + node.children = dealTree(node.children, selectedKeys,node.id); } } else if (node.children) { - node.children = filterTree(node.children, selectedKeys); - if (node.children.length > 0) { - filtered.push(node); + node.children = dealTree(node.children, selectedKeys,node.id); + const children =node.children.filter((item:any)=>{ + item.options.show === true + }) + if (children.length > 0) { + node.options.show = true } + }else{ + node.options.show = false } + filtered.push(node) } return filtered; } - const handleOk = async () => { - const _dataArr = filterTree(cloneDeep(treeData.value), selectedKeys.value); + // const _dataArr = filterTree(cloneDeep(treeData.value), selectedKeys.value); + const _dataArr = dealTree(cloneDeep(treeData.value),selectedKeys.value) const _dataSorts = handleSorts(_dataArr) loading.value = true; const res = await updateMenus(_dataSorts).catch(() => {}); @@ -203,13 +243,13 @@ const onDragend = (info: AntTreeNodeDropEvent) => { onMounted(() => { getSystemPermission_api().then((resp: any) => { - const filterBaseMenu = BaseMenu.filter(item => ![ - USER_CENTER_MENU_CODE,messageSubscribe - ].includes(item.code)) - baseMenu.value = filterMenu( - resp.result.map((item: any) => JSON.parse(item).id), - filterBaseMenu, - ); + // const filterBaseMenu = BaseMenu.filter(item => ![ + // USER_CENTER_MENU_CODE,messageSubscribe + // ].includes(item.code)) + // baseMenu.value = filterMenu( + // resp.result.map((item: any) => JSON.parse(item).id), + // filterBaseMenu, + // ); getMenuTree_api(params).then((resp: any) => { if (resp.status == 200) { systemMenu.value = resp.result?.filter( @@ -219,17 +259,16 @@ onMounted(() => { ].includes(item.code), ); //初始化菜单 - initData(baseMenu.value); // 不要克隆,通过引用 处理key和name - const systemMenuData = initData(systemMenu.value); + // initData(baseMenu.value); // 不要克隆,通过引用 处理key和name + const systemMenuData = inItSelected(systemMenu.value); selectedKeys.value = systemMenuData.checkedKeys; - - const AllMenu = filterMenus(mergeArr( - cloneDeep(baseMenu.value), - cloneDeep(systemMenu.value), - )) - console.log(AllMenu); + // const AllMenu = filterMenus(mergeArr( + // cloneDeep(baseMenu.value), + // cloneDeep(systemMenu.value), + // )) + // console.log(AllMenu); // 处理排序 - treeData.value = handleSortsArr(AllMenu); + treeData.value = handleSortsArr(systemMenu.value); } }); }); diff --git a/src/views/system/Menu/Setting/utils.ts b/src/views/system/Menu/Setting/utils.ts index 33d5787c..4fe5105c 100644 --- a/src/views/system/Menu/Setting/utils.ts +++ b/src/views/system/Menu/Setting/utils.ts @@ -115,9 +115,7 @@ export const initData = (Menu: any) => { arr.forEach((item: any) => { item.title = item.code; item.key = item.code; // treeData需要唯一key - checkedKeys.push(item.code); - if (item?.children) { getMap(item?.children); } @@ -127,6 +125,23 @@ export const initData = (Menu: any) => { return { checkedKeys }; }; +/**通过options判断选中菜单 */ +export const inItSelected = (Menu:any) =>{ + const checkedKeys: any = []; + const getMap = (arr: any) => { + arr.forEach((item: any) => { + item.title = item.code; + item.key = item.code; // treeData需要唯一key + item?.options?.show ? checkedKeys.push(item.code) : ''; + if (item?.children) { + getMap(item?.children); + } + }); + }; + getMap(Menu); + return { checkedKeys }; +} + /** * 查找父级、子级code * @param data 当前完整的菜单 diff --git a/src/views/system/Menu/components/fields.ts b/src/views/system/Menu/components/fields.ts index 4297d200..582e39fa 100644 --- a/src/views/system/Menu/components/fields.ts +++ b/src/views/system/Menu/components/fields.ts @@ -62,6 +62,7 @@ const direction = [ 'RadiusUpright', 'Fullscreen', 'FullscreenExit', + 'EnvironmentOutlined', ]; const suggestion = [ diff --git a/src/views/system/Menu/index.vue b/src/views/system/Menu/index.vue index 7e35eee8..14d1ae04 100644 --- a/src/views/system/Menu/index.vue +++ b/src/views/system/Menu/index.vue @@ -41,11 +41,12 @@ @@ -200,6 +214,7 @@ import { updateUser_api, updatePassword_api, getUser_api, + getRoleList } from '@/api/system/user'; import { Rule } from 'ant-design-vue/es/form'; import { DefaultOptionType } from 'ant-design-vue/es/vc-tree-select/TreeSelect'; @@ -207,16 +222,8 @@ import { AxiosResponse } from 'axios'; import { passwordRegEx } from '@/utils/validate'; import { filterSelectNode, onlyMessage } from '@/utils/comm'; import { uniqBy } from 'lodash-es'; -import { useUserInfo } from '@/store/userInfo'; import { storeToRefs } from 'pinia'; -const userInfoStore = useUserInfo() -const { userInfos } = storeToRefs(userInfoStore) - -const admin = computed(() => { - return userInfos.value?.username === 'admin'; -}) - const deptPermission = 'system/Department'; const rolePermission = 'system/Role'; @@ -287,10 +294,9 @@ const form = reactive({ }, }, - roleOptions: [] as optionType[], + roleOptions: [], departmentOptions: [] as DefaultOptionType[], - _roleOptions: [] as optionType[], _departmentOptions: [] as DefaultOptionType[], init: () => { @@ -314,8 +320,8 @@ const form = reactive({ (item: dictType) => item.id, ), }; - form._roleOptions = resp.result?.roleList?.map((i: any) => { - return {label: i.name, value: i.id} + form.data.roleIdList = resp.result?.roleList?.map((i: any) => { + return i.id }); form._departmentOptions = resp.result?.orgList nextTick(() => { @@ -353,16 +359,22 @@ const form = reactive({ return api(params); }, getRoleList: () => { - getRoleList_api().then((resp: any) => { - form.roleOptions = resp.result.map((item: dictType) => ({ - label: item.name, - value: item.id, - })); + getRoleList({ sorts: [{ name: 'createTime', order: 'desc' }] }).then((resp: any) => { + if(resp.status === 200){ + form.roleOptions = dealRoleList(resp.result) + } }); }, getDepartmentList: () => { - getDepartmentList_api().then((resp: any) => { - form.departmentOptions = resp.result; + getDepartmentList_api({ + paging: false, + sorts: [{ name: 'sortIndex', order: 'asc' }], + }).then((resp: any) => { + form.departmentOptions = resp.result.sort((a: any, b: any) => + a.sortIndex === b.sortIndex + ? b.createTime - a.createTime + : a.sortIndex - b.sortIndex, + ); // 报存源数据; }); }, IsShow: (...typeList: modalType[]) => typeList.includes(props.type), @@ -376,13 +388,25 @@ const form = reactive({ }, }); -const _roleOptions = computed(() => { - return uniqBy([...form.roleOptions, ...form._roleOptions], 'value') -}) - -const _departmentOptions = computed(() => { - return uniqBy([...form.departmentOptions, ...form._departmentOptions], 'id') -}) +const dealRoleList = (data:any) =>{ + return data.map((item:any)=>{ + return { + name: item.groupName, + id: item.groupId, + disabled: true, + children: item?.roles ? item.roles.map((i:any)=>{ + return { + name:i.name, + id:i.id + } + }) : [] + } + }) +} +// 组织已删除在仍显示在列表中 +// const _departmentOptions = computed(() => { +// return uniqBy([...form.departmentOptions, ...form._departmentOptions], 'id') +// }) form.init(); @@ -447,4 +471,16 @@ type optionType = { } } } +.formName{ + margin-bottom: 10px; + font-size: 16px; + &::before{ + width: 2px; + background-color: rgb(184, 184, 184); + display: inline-block; + height: 13px; + margin-right: 3px; + content:'' + } +} diff --git a/src/views/system/User/index.vue b/src/views/system/User/index.vue index 71c6b654..28542da6 100644 --- a/src/views/system/User/index.vue +++ b/src/views/system/User/index.vue @@ -29,6 +29,13 @@ +