{ "widgettype": "Page", "options": { "title": "待办任务", "style": {"height": "100vh", "padding": "0"} }, "subwidgets": [ { "widgettype": "VBox", "options": {"style": {"padding": "16px", "height": "100%"}}, "subwidgets": [ { "widgettype": "Text", "options": {"text": "待办审批任务", "style": {"fontSize": "20px", "fontWeight": "bold", "marginBottom": "16px"}} }, { "widgettype": "DataViewer", "options": { "title": "任务列表", "data_url": "/main/workflow_approval/api/task_list.dspy", "page_rows": 20, "row_options": { "fields": [ {"name": "instance_title", "label": "审批事项", "uitype": "text"}, {"name": "step_name", "label": "审批步骤", "uitype": "text"}, {"name": "module_type", "label": "模块", "uitype": "text"}, {"name": "status", "label": "状态", "uitype": "text"}, {"name": "assigned_at", "label": "分配时间", "uitype": "text"}, {"name": "due_at", "label": "截止时间", "uitype": "text"} ] }, "row_actions": [ { "label": "审批", "onclick": "openDialog('approveDialog'); setDialogField('approveDialog', 'task_id', '${id}'); setDialogField('approveDialog', 'task_title', '${instance_title}')", "condition": "status == 'pending'" }, { "label": "查看详情", "onclick": "openDialog('taskDetailDialog'); setDialogField('taskDetailDialog', 'task_id', '${id}'); setDialogField('taskDetailDialog', 'task_title', '${instance_title}'); setDialogField('taskDetailDialog', 'step_name', '${step_name}'); setDialogField('taskDetailDialog', 'assigned_at', '${assigned_at}'); setDialogField('taskDetailDialog', 'due_at', '${due_at}'); setDialogField('taskDetailDialog', 'approval_type', '${approval_type}')" } ] } }, { "widgettype": "Dialog", "id": "approveDialog", "options": { "title": "审批处理", "width": 500, "content": { "widgettype": "Form", "id": "approveForm", "fields": [ {"name": "task_id", "label": "任务ID", "uitype": "hidden"}, {"name": "task_title", "label": "审批事项", "uitype": "text", "readonly": true}, {"name": "decision", "label": "审批意见", "uitype": "textarea"} ], "actions": [ {"widgettype": "Button", "options": {"label": "取消", "onclick": "closeDialog('approveDialog')"}}, {"widgettype": "Button", "options": {"label": "拒绝", "style": {"backgroundColor": "#dc3545", "color": "#fff"}, "onclick": "submitForm('approveForm', '/main/workflow_approval/api/task_reject.dspy', 'approveDialog', null)"}}, {"widgettype": "Button", "options": {"label": "批准", "style": {"backgroundColor": "#28a745", "color": "#fff"}, "onclick": "submitForm('approveForm', '/main/workflow_approval/api/task_approve.dspy', 'approveDialog', null)"}} ] } } }, { "widgettype": "Dialog", "id": "taskDetailDialog", "options": { "title": "任务详情", "width": 500, "content": { "widgettype": "VBox", "options": {"gap": 8}, "subwidgets": [ {"widgettype": "Text", "id": "detail_title", "options": {"text": ""}}, {"widgettype": "Divider", "options": {}}, {"widgettype": "HBox", "options": {"gap": 8}, "subwidgets": [ {"widgettype": "Text", "options": {"text": "步骤: ", "style": {"fontWeight": "bold"}}}, {"widgettype": "Text", "id": "detail_step", "options": {"text": ""}} ]}, {"widgettype": "HBox", "options": {"gap": 8}, "subwidgets": [ {"widgettype": "Text", "options": {"text": "审批类型: ", "style": {"fontWeight": "bold"}}}, {"widgettype": "Text", "id": "detail_type", "options": {"text": ""}} ]}, {"widgettype": "HBox", "options": {"gap": 8}, "subwidgets": [ {"widgettype": "Text", "options": {"text": "分配时间: ", "style": {"fontWeight": "bold"}}}, {"widgettype": "Text", "id": "detail_assigned", "options": {"text": ""}} ]}, {"widgettype": "HBox", "options": {"gap": 8}, "subwidgets": [ {"widgettype": "Text", "options": {"text": "截止时间: ", "style": {"fontWeight": "bold"}}}, {"widgettype": "Text", "id": "detail_due", "options": {"text": ""}} ]}, {"widgettype": "Divider", "options": {}}, {"widgettype": "HBox", "options": {"gap": 8}, "subwidgets": [ {"widgettype": "Button", "options": {"label": "关闭", "onclick": "closeDialog('taskDetailDialog')"}}, {"widgettype": "Button", "options": {"label": "去审批", "style": {"backgroundColor": "#007bff", "color": "#fff"}, "onclick": "closeDialog('taskDetailDialog'); openDialog('approveDialog'); setDialogField('approveDialog', 'task_id', getDialogField('taskDetailDialog', 'task_id')); setDialogField('approveDialog', 'task_title', getDialogField('taskDetailDialog', 'task_title'))"}} ]} ] } } } ] } ] }