From 43e46804786af504d44d0a031ede1dd3ec86b5c9 Mon Sep 17 00:00:00 2001 From: hhyo Date: Tue, 5 May 2020 15:17:01 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AD=89=E5=BE=85=E5=AE=A1=E6=89=B9=E7=9A=84SQ?= =?UTF-8?q?L=E5=B7=A5=E5=8D=95=E8=AF=A6=E6=83=85=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E5=BD=93=E5=89=8D=E5=85=A8=E9=83=A8=E5=AE=A1=E6=89=B9=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/views.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/sql/views.py b/sql/views.py index 299d1a5906..74011d62c2 100644 --- a/sql/views.py +++ b/sql/views.py @@ -24,7 +24,7 @@ from sql.utils.workflow_audit import Audit from sql.utils.sql_review import can_execute, can_timingtask, can_cancel, can_view, can_rollback from common.utils.const import Const, WorkflowDict -from sql.utils.resource_group import user_groups, user_instances +from sql.utils.resource_group import user_groups, user_instances, auth_group_users import logging @@ -110,7 +110,7 @@ def detail(request, workflow_id): # 是否可审核 is_can_review = Audit.can_review(request.user, workflow_id, 2) - # 是否可执行 + # 是否可执行 TODO 这几个判断方法入参都修改为workflow对象,可减少多次数据库交互 is_can_execute = can_execute(request.user, workflow_id) # 是否可定时执行 is_can_timingtask = can_timingtask(request.user, workflow_id) @@ -121,9 +121,16 @@ def detail(request, workflow_id): # 获取审核日志 try: - audit_id = Audit.detail_by_workflow_id(workflow_id=workflow_id, - workflow_type=WorkflowDict.workflow_type['sqlreview']).audit_id + audit_detail = Audit.detail_by_workflow_id(workflow_id=workflow_id, + workflow_type=WorkflowDict.workflow_type['sqlreview']) + audit_id = audit_detail.audit_id last_operation_info = Audit.logs(audit_id=audit_id).latest('id').operation_info + # 等待审批的展示当前全部审批人 + if workflow_detail.status == 'workflow_manreviewing': + auth_group_name = Group.objects.get(id=audit_detail.current_audit).name + current_audit_users = auth_group_users([auth_group_name], audit_detail.group_id) + current_audit_users_display = [user.display for user in current_audit_users] + last_operation_info += ',当前审批人:' + ','.join(current_audit_users_display) except Exception as e: logger.debug(f'无审核日志记录,错误信息{e}') last_operation_info = ''