Browse Source

chore: compose

master
wangxiang 2 years ago
parent
commit
6a90c274d7
No known key found for this signature in database
GPG Key ID: 1BA7946AB6B232E4
  1. 2
      src/enums/workflowEnum.ts
  2. 93
      src/views/workflow/task/HistoryTask.vue
  3. 2
      src/views/workflow/task/index.vue
  4. 36
      src/views/workflow/task/task.data.ts

2
src/enums/workflowEnum.ts

@ -8,5 +8,5 @@
export enum PageEnum { export enum PageEnum {
TODO_TASK_PAGE = '/workflow/transaction/todo', TODO_TASK_PAGE = '/workflow/transaction/todo',
TASK_FORM_PAGE = '/workflow/task/taskForm', TASK_FORM_PAGE = '/workflow/task/taskForm',
TASK_FORM_VIEW_PAGE = '/workflow/task/taskViewForm' TASK_FORM_VIEW_PAGE = '/workflow/task/taskFormView'
} }

93
src/views/workflow/task/HistoryTask.vue

@ -2,17 +2,20 @@
<div> <div>
<BasicTable @register="registerTable"> <BasicTable @register="registerTable">
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="column.key === 'name'">
{{ record.name }}
<a-button v-if="record.rollBack"
type="primary"
danger
@click="handleRollBackTask(record)"
>回滚任务</a-button>
</template>
<template v-if="column.key === 'action'"> <template v-if="column.key === 'action'">
<TableAction :actions="[ <TableAction :actions="[
{ {
label: '办理', label: '历史',
icon: 'fa6-regular:pen-to-square', icon: 'fa6-solid:clock-rotate-left',
onClick: handleTodo.bind(null, record) onClick: handleProcessView.bind(null, record)
},
{
label: '进度',
icon: 'fa6-solid:bars-progress',
onClick: handleTrace.bind(null, record)
}]" }]"
/> />
</template> </template>
@ -31,27 +34,26 @@
*/ */
import { defineComponent } from 'vue'; import { defineComponent } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table'; import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal'; import { historyColumns, searchFormSchema } from './task.data';
import { columns, searchFormSchema } from './task.data'; import { listHistoryTask, getTaskDefinition } from '/@/api/platform/workflow/controller/task';
import { listTodoTask, getTaskDefinition } from '/@/api/platform/workflow/controller/task';
import { PageEnum } from '/@/enums/workflowEnum'; import { PageEnum } from '/@/enums/workflowEnum';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import WorkflowChartModal from './popups/WorkflowChartModal.vue'; import { useMessage } from '/@/hooks/web/useMessage';
import { undoTask } from '/@/api/platform/workflow/controller/task';
export default defineComponent({ export default defineComponent({
name: 'WorkflowTodoTask', name: 'WorkflowHistoryTask',
components: { components: {
WorkflowChartModal,
BasicTable, BasicTable,
TableAction, TableAction,
}, },
setup() { setup() {
const [registerModal, { openModal }] = useModal();
const { push } = useRouter(); const { push } = useRouter();
const [registerTable] = useTable({ const { createConfirm, createMessage } = useMessage();
api: listTodoTask, const [registerTable, { reload }] = useTable({
api: listHistoryTask,
rowKey: 'id', rowKey: 'id',
columns, columns: historyColumns,
formConfig: { formConfig: {
compact: true, compact: true,
labelWidth: 100, labelWidth: 100,
@ -74,44 +76,57 @@
}, },
}); });
async function handleTodo(record: Recordable) { async function handleProcessView(record: Recordable) {
const { taskInfo, vars } = record;
const task = await getTaskDefinition({ const task = await getTaskDefinition({
taskId: taskInfo.id, taskDefKey: record.taskDefKey,
taskName: taskInfo.name, processInsId: record.processInsId,
taskDefKey: taskInfo.taskDefKey, processDefId: record.processDefId
processInsId: taskInfo.processInsId,
processDefId: taskInfo.processDefId,
processDefKey: taskInfo.processDefKey
}); });
await push({ await push({
path: PageEnum.TASK_FORM_PAGE, path: PageEnum.TASK_FORM_VIEW_PAGE,
query: { query: {
_meta: 'y', _meta: 'y',
title: `审批【${taskInfo.name || ''}`, taskId: record.id,
formTitle: `${vars.title}`, taskDefKey: task.taskDefKey,
title: `${record.processDefName}${record.name}`,
formTitle: `${record.processDefName}`,
formType: task.formType, formType: task.formType,
formKey: task.formKey, formKey: task.formKey,
formReadOnly: String(task.formReadOnly), processDefKey: task.processDefKey,
processInsId: task.processInsId, processInsId: task.processInsId,
processDefId: task.processDefId, processDefId: task.processDefId,
processDefKey: task.processDefKey, businessId: task.businessId,
taskId: task.taskId, }
taskDefKey: task.taskDefKey, });
businessId: task.businessId }
function handleRollBackTask(record: Recordable) {
createConfirm({
iconType: 'warning',
title: '警告',
content: '确定回滚该已办任务吗?',
onOk: async () => {
const { taskInfo } = record;
await undoTask({
processInsId: record.processInsId,
currentTaskId: taskInfo.id,
currentTaskDefKey: taskInfo.taskDefKey,
undoTaskId: record.id,
undoTaskDefKey: record.taskDefKey
});
handleRefreshTable();
} }
}); });
} }
function handleTrace(record: Recordable) { function handleRefreshTable() {
openModal(true, { record: record.taskInfo }); reload();
} }
return { return {
handleTodo, handleProcessView,
handleTrace,
registerTable, registerTable,
registerModal, handleRollBackTask,
}; };
} }
}); });

2
src/views/workflow/task/index.vue

@ -51,7 +51,7 @@
const { push } = useRouter(); const { push } = useRouter();
const [registerTable] = useTable({ const [registerTable] = useTable({
api: listTodoTask, api: listTodoTask,
rowKey: 'id', rowKey: 'taskInfo.id',
columns, columns,
formConfig: { formConfig: {
compact: true, compact: true,

36
src/views/workflow/task/task.data.ts

@ -56,3 +56,39 @@ export const searchFormSchema: FormSchema[] = [
colProps: { span: 8 } colProps: { span: 8 }
} }
]; ];
export const historyColumns: BasicColumn[] = [
{
title: '任务名称',
dataIndex: 'name',
width: 200,
},
{
title: '流程标题',
dataIndex: ['vars', 'title'],
width: 200,
},
{
title: '流程名称',
dataIndex: 'processDefName',
width: 200,
},
{
title: '办理状态',
dataIndex: 'mesName',
width: 150,
customRender: ({ record }) => {
return h(Tag, { color: 'processing' }, () => record.mesName);
}
},
{
title: '流程发起人',
dataIndex: ['vars', 'userName'],
width: 150
},
{
title: '完成时间',
dataIndex: 'endTime',
width: 200
}
];

Loading…
Cancel
Save