From cd1649e0104ebef342c946f8d9ad580caeeedf33 Mon Sep 17 00:00:00 2001 From: xiangheng <11675084@qq.com> Date: Tue, 26 Dec 2023 00:57:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=AE=A1=E6=89=B9=E7=94=A8?= =?UTF-8?q?=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/src/api/perms/admin.ts | 5 + .../src/components/flow/flowEdit/Diagram.vue | 2 + .../flow/flowEdit/PropertyPanel.vue | 3 + admin/src/utils/util.ts | 29 +++--- .../flow_apply/components/apply_submit.vue | 16 ++-- .../views/organization/department/edit.vue | 68 ++++++++++---- .../views/organization/department/index.vue | 4 + .../flow/flow_history/flow_history_ctl.go | 14 ++- .../flow/flow_history/flow_history_schema.go | 7 +- .../flow/flow_history/flow_history_service.go | 93 +++++++++++++------ server/admin/system/admin/admin.go | 25 +++++ server/admin/system/admin/service.go | 8 +- server/admin/system/dept/schema.go | 3 + server/admin/system/dept/service.go | 9 +- server/admin/system/enter.go | 2 + server/model/system_model/system.go | 5 +- 16 files changed, 204 insertions(+), 89 deletions(-) diff --git a/admin/src/api/perms/admin.ts b/admin/src/api/perms/admin.ts index a54b275..18de0a2 100644 --- a/admin/src/api/perms/admin.ts +++ b/admin/src/api/perms/admin.ts @@ -29,3 +29,8 @@ export function adminDelete(params: any) { export function adminStatus(params: any) { return request.post({ url: '/system/admin/disable', params }) } + +// 部门下的管理员 +export function adminListByDeptId(params: any) { + return request.get({ url: '/system/admin/ListByDeptId', params }) +} diff --git a/admin/src/components/flow/flowEdit/Diagram.vue b/admin/src/components/flow/flowEdit/Diagram.vue index fa3495f..6a9e528 100644 --- a/admin/src/components/flow/flowEdit/Diagram.vue +++ b/admin/src/components/flow/flowEdit/Diagram.vue @@ -219,6 +219,8 @@ export default { label: node?.text?.value, type: node.type, fieldAuth: node?.properties?.fieldAuth, + + userType: node?.properties?.userType || 0, userId: node?.properties?.userId || 0, deptId: node?.properties?.deptId || 0, postId: node?.properties?.postId || 0 diff --git a/admin/src/components/flow/flowEdit/PropertyPanel.vue b/admin/src/components/flow/flowEdit/PropertyPanel.vue index aeee14e..9a8ff3d 100644 --- a/admin/src/components/flow/flowEdit/PropertyPanel.vue +++ b/admin/src/components/flow/flowEdit/PropertyPanel.vue @@ -133,9 +133,11 @@ export default { open(node, fieldList) { this.node = node + this.properties.userType = node?.properties?.userType || '' this.properties.userId = node?.properties?.userId || '' this.properties.deptId = node?.properties?.deptId || '' this.properties.postId = node?.properties?.postId || '' + this.properties.fieldAuth = node?.properties?.fieldAuth ? { ...node?.properties?.fieldAuth } : {} @@ -163,6 +165,7 @@ export default { this.setProperties('fieldAuth', { ...fieldAuth }) + this.setProperties('userType', this.properties.userType) this.setProperties('userId', this.properties.userId) this.setProperties('deptId', this.properties.deptId) this.setProperties('postId', this.properties.postId) diff --git a/admin/src/utils/util.ts b/admin/src/utils/util.ts index bba954e..8948a6b 100644 --- a/admin/src/utils/util.ts +++ b/admin/src/utils/util.ts @@ -48,25 +48,18 @@ export const treeToArray = (data: any[], props = { children: 'children' }) => { * @param {Object} props `{ parent: 'pid', children: 'children' }` */ -export const arrayToTree = ( - data: any[], - props = { id: 'id', parentId: 'pid', children: 'children' } -) => { - data = cloneDeep(data) - const { id, parentId, children } = props - const result: any[] = [] - const map = new Map() - data.forEach((item) => { - map.set(item[id], item) - const parent = map.get(item[parentId]) - if (parent) { - parent[children] = parent[children] ?? [] - parent[children].push(item) - } else { - result.push(item) +export function arrayToTree(arr, parentId = '') { + const tree = [] + for (const item of arr) { + if (item.pid == parentId) { + const children = arrayToTree(arr, item.id) + if (children.length > 0) { + item.children = children + } + tree.push(item) } - }) - return result + } + return tree } /** diff --git a/admin/src/views/flow/flow_apply/components/apply_submit.vue b/admin/src/views/flow/flow_apply/components/apply_submit.vue index 6883f8e..e5848e6 100644 --- a/admin/src/views/flow/flow_apply/components/apply_submit.vue +++ b/admin/src/views/flow/flow_apply/components/apply_submit.vue @@ -103,14 +103,14 @@ function open(applyId) { console.log('res', res) next_nodes.value = res - res.map((item) => { - if (item.type == 'bpmn:userTask') { - flow_history_get_approver(item).then((user) => { - console.log('user', user) - approverUserList.value = user - }) - } - }) + // res.map((item) => { + // if (item.type == 'bpmn:userTask') { + // } + // }) + }) + flow_history_get_approver({ applyId: applyId }).then((user) => { + console.log('user', user) + approverUserList.value = user }) } function BeforeClose() { diff --git a/admin/src/views/organization/department/edit.vue b/admin/src/views/organization/department/edit.vue index 07e3f5f..114d65e 100644 --- a/admin/src/views/organization/department/edit.vue +++ b/admin/src/views/organization/department/edit.vue @@ -33,15 +33,25 @@ :maxlength="100" /> - - + + placeholder="请选择上级部门" + @change="dutyChange" + > + + + + - + @@ -60,6 +70,8 @@