feat: 流程撤回到上一节点
This commit is contained in:
@ -37,6 +37,7 @@ enum Api {
|
|||||||
SetSign = '/workflow/execute/set-sign',
|
SetSign = '/workflow/execute/set-sign',
|
||||||
Withdraw = '/workflow/execute/my-task/withdraw',
|
Withdraw = '/workflow/execute/my-task/withdraw',
|
||||||
SetAssignee = '/workflow/execute/set-assignee',
|
SetAssignee = '/workflow/execute/set-assignee',
|
||||||
|
withdrawNode = '/workflow/execute/withdraw-node',
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -422,3 +423,19 @@ export async function postSetAssignee(taskId, assignees, mode: ErrorMessageMode
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 查询撤回节点
|
||||||
|
*/
|
||||||
|
|
||||||
|
export async function getDrawNode(processId, mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.get<boolean>(
|
||||||
|
{
|
||||||
|
url: Api.withdrawNode,
|
||||||
|
params: { processId },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
@ -26,6 +26,7 @@
|
|||||||
<a-menu @click="onMoreClick">
|
<a-menu @click="onMoreClick">
|
||||||
<a-menu-item v-if="!readonly && hasBtnFinish" key="finish">终止</a-menu-item>
|
<a-menu-item v-if="!readonly && hasBtnFinish" key="finish">终止</a-menu-item>
|
||||||
<a-menu-item v-if="!readonly" key="transfer">转办</a-menu-item>
|
<a-menu-item v-if="!readonly" key="transfer">转办</a-menu-item>
|
||||||
|
<a-menu-item v-if="readonly && drawNode" key="drawBack">撤回</a-menu-item>
|
||||||
<a-menu-item key="flowchart">查看流程图</a-menu-item>
|
<a-menu-item key="flowchart">查看流程图</a-menu-item>
|
||||||
</a-menu>
|
</a-menu>
|
||||||
</template>
|
</template>
|
||||||
@ -62,12 +63,12 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import { onMounted, reactive, ref, unref } from 'vue';
|
import { onMounted, reactive, ref, unref, createVNode } from 'vue';
|
||||||
import FormInformation from '/@/views/secondDev/FormInformation.vue';
|
import FormInformation from '/@/views/secondDev/FormInformation.vue';
|
||||||
import userTaskItem from '/@/views/workflow/task/hooks/userTaskItem';
|
import userTaskItem from '/@/views/workflow/task/hooks/userTaskItem';
|
||||||
import { getApprovalProcess, postApproval, postGetNextTaskMaybeArrival, postTransfer } from '/@/api/workflow/task';
|
import { getApprovalProcess, postApproval, postGetNextTaskMaybeArrival, postTransfer, getDrawNode, withdraw } from '/@/api/workflow/task';
|
||||||
import { ApproveCode, ApproveType } from '/@/enums/workflowEnum';
|
import { ApproveCode, ApproveType } from '/@/enums/workflowEnum';
|
||||||
import { CheckCircleOutlined, StopOutlined, CloseOutlined, DownOutlined } from '@ant-design/icons-vue';
|
import { CheckCircleOutlined, StopOutlined, CloseOutlined, DownOutlined, ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||||
import OpinionDialog from '/@/components/SecondDev/OpinionDialog.vue';
|
import OpinionDialog from '/@/components/SecondDev/OpinionDialog.vue';
|
||||||
import TransferDialog from '/@/components/SecondDev/TransferDialog.vue';
|
import TransferDialog from '/@/components/SecondDev/TransferDialog.vue';
|
||||||
import { separator } from '/@bpmn/config/info';
|
import { separator } from '/@bpmn/config/info';
|
||||||
@ -77,6 +78,10 @@
|
|||||||
import { message, Modal } from 'ant-design-vue';
|
import { message, Modal } from 'ant-design-vue';
|
||||||
import useEventBus from '/@/hooks/event/useEventBus';
|
import useEventBus from '/@/hooks/event/useEventBus';
|
||||||
import ProcessInformation from '/@/views/workflow/task/components/flow/ProcessInformation.vue';
|
import ProcessInformation from '/@/views/workflow/task/components/flow/ProcessInformation.vue';
|
||||||
|
import { useI18n } from '/@/hooks/web/useI18n';
|
||||||
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
|
const { t } = useI18n();
|
||||||
|
const { notification } = useMessage();
|
||||||
|
|
||||||
const { data, approveUserData, initProcessData, notificationError, notificationSuccess } = userTaskItem();
|
const { data, approveUserData, initProcessData, notificationError, notificationSuccess } = userTaskItem();
|
||||||
const { bus, FLOW_PROCESSED } = useEventBus();
|
const { bus, FLOW_PROCESSED } = useEventBus();
|
||||||
@ -101,6 +106,7 @@
|
|||||||
const hasBtnApprove = ref(true);
|
const hasBtnApprove = ref(true);
|
||||||
const hasBtnReject = ref(false);
|
const hasBtnReject = ref(false);
|
||||||
const hasBtnFinish = ref(false);
|
const hasBtnFinish = ref(false);
|
||||||
|
const drawNode = ref('')
|
||||||
|
|
||||||
let approvalData = reactive({
|
let approvalData = reactive({
|
||||||
isCountersign: false,
|
isCountersign: false,
|
||||||
@ -134,6 +140,33 @@
|
|||||||
});
|
});
|
||||||
} else if (key === 'transfer') {
|
} else if (key === 'transfer') {
|
||||||
onTransferClick();
|
onTransferClick();
|
||||||
|
} else if(key === 'drawBack') {
|
||||||
|
Modal.confirm({
|
||||||
|
title: t('提示'),
|
||||||
|
icon: createVNode(ExclamationCircleOutlined),
|
||||||
|
content: t('请确认是否撤回该流程?'),
|
||||||
|
okText: t('确定'),
|
||||||
|
okType: 'danger',
|
||||||
|
cancelText: t('取消'),
|
||||||
|
onOk() {
|
||||||
|
withdraw(processId.value, drawNode.value).then(res => {
|
||||||
|
if (res) {
|
||||||
|
notification.open({
|
||||||
|
type: 'success',
|
||||||
|
message: t('撤回'),
|
||||||
|
description: t('撤回成功'),
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
notification.open({
|
||||||
|
type: 'error',
|
||||||
|
message: t('撤回'),
|
||||||
|
description: t('撤回失败'),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onCancel() {},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -300,9 +333,16 @@
|
|||||||
approvalData.circulateConfigs = [];
|
approvalData.circulateConfigs = [];
|
||||||
}
|
}
|
||||||
renderKey.value = Math.random() + '';
|
renderKey.value = Math.random() + '';
|
||||||
|
getBackNode()
|
||||||
} catch (error) {}
|
} catch (error) {}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function getBackNode() {
|
||||||
|
getDrawNode(processId.value).then(res => {
|
||||||
|
drawNode.value = res[0].activityId
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
async function submit() {
|
async function submit() {
|
||||||
data.submitLoading = true;
|
data.submitLoading = true;
|
||||||
validateSuccess.value = false;
|
validateSuccess.value = false;
|
||||||
|
|||||||
@ -1,15 +1,16 @@
|
|||||||
<template>
|
<template>
|
||||||
<BasicTable @register="registerTable" @selection-change="selectionChange">
|
<BasicTable @register="registerTable" @row-dbClick="onRowDblClick" @selection-change="selectionChange">
|
||||||
<template #toolbar>
|
<template #toolbar>
|
||||||
<div class="button-box">
|
<div class="button-box">
|
||||||
<RejectProcess
|
<a-button @click="drawBack">{{ t('撤回') }}</a-button>
|
||||||
|
<!-- <RejectProcess
|
||||||
:taskId="taskId"
|
:taskId="taskId"
|
||||||
:processId="processId"
|
:processId="processId"
|
||||||
@close="reload"
|
@close="reload"
|
||||||
@restart="restartProcess"
|
@restart="restartProcess"
|
||||||
class="mr-2"
|
class="mr-2"
|
||||||
><a-button v-auth="'processtasks:withdraw'">{{ t('撤回') }}</a-button></RejectProcess
|
><a-button v-auth="'processtasks:withdraw'">{{ t('撤回') }}</a-button></RejectProcess
|
||||||
>
|
> -->
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -17,29 +18,36 @@
|
|||||||
<a-progress v-if="record.currentProgress" :percent="record.currentProgress" size="small" />
|
<a-progress v-if="record.currentProgress" :percent="record.currentProgress" size="small" />
|
||||||
</template>
|
</template>
|
||||||
</BasicTable>
|
</BasicTable>
|
||||||
<LaunchProcess
|
<!-- <LaunchProcess
|
||||||
v-if="restartProcessVisible"
|
v-if="restartProcessVisible"
|
||||||
:schemaId="schemaId"
|
:schemaId="schemaId"
|
||||||
:taskId="taskId"
|
:taskId="taskId"
|
||||||
@close="restartProcessClose"
|
@close="restartProcessClose"
|
||||||
/>
|
/> -->
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import userTaskTable from './../../hooks/userTaskTable';
|
import userTaskTable from './../../hooks/userTaskTable';
|
||||||
|
|
||||||
import { ref } from 'vue';
|
import { ref, createVNode } from 'vue';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
|
||||||
import LookProcess from './../LookProcess.vue';
|
import LookProcess from './../LookProcess.vue';
|
||||||
import LaunchProcess from './../LaunchProcess.vue';
|
import LaunchProcess from './../LaunchProcess.vue';
|
||||||
import RejectProcess from './../RejectProcess.vue';
|
import RejectProcess from './../RejectProcess.vue';
|
||||||
|
|
||||||
import { BasicTable, useTable, BasicColumn } from '/@/components/Table';
|
import { BasicTable, useTable, BasicColumn } from '/@/components/Table';
|
||||||
|
import { getDrawNode, withdraw } from '/@/api/workflow/task';
|
||||||
import { getSchemaTask } from '/@/api/workflow/process';
|
import { getSchemaTask } from '/@/api/workflow/process';
|
||||||
import { TaskTypeUrl } from '/@/enums/workflowEnum';
|
import { TaskTypeUrl } from '/@/enums/workflowEnum';
|
||||||
import { useI18n } from '/@/hooks/web/useI18n';
|
import { useI18n } from '/@/hooks/web/useI18n';
|
||||||
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
|
import { Modal } from 'ant-design-vue';
|
||||||
|
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||||
|
const { notification } = useMessage();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const restartProcessVisible = ref(false);
|
const restartProcessVisible = ref(false);
|
||||||
|
const router = useRouter();
|
||||||
const configColumns: BasicColumn[] = [
|
const configColumns: BasicColumn[] = [
|
||||||
{
|
{
|
||||||
title: t('流水号'),
|
title: t('流水号'),
|
||||||
@ -79,7 +87,7 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
const { formConfig, processId, taskId, schemaId, selectionChange } = userTaskTable();
|
const { formConfig, processId, taskId, schemaId, selectionChange } = userTaskTable();
|
||||||
const [registerTable, { reload }] = useTable({
|
const [registerTable, { reload, clearSelectedRowKeys }] = useTable({
|
||||||
title: t('已办任务列表'),
|
title: t('已办任务列表'),
|
||||||
api: getSchemaTask,
|
api: getSchemaTask,
|
||||||
rowKey: 'id',
|
rowKey: 'id',
|
||||||
@ -88,6 +96,9 @@
|
|||||||
beforeFetch: (params) => {
|
beforeFetch: (params) => {
|
||||||
return { data: params, taskUrl: TaskTypeUrl.FINISHED_TASKS };
|
return { data: params, taskUrl: TaskTypeUrl.FINISHED_TASKS };
|
||||||
},
|
},
|
||||||
|
rowSelection: {
|
||||||
|
type: 'radio'
|
||||||
|
},
|
||||||
useSearchForm: true,
|
useSearchForm: true,
|
||||||
showTableSetting: true,
|
showTableSetting: true,
|
||||||
striped: false,
|
striped: false,
|
||||||
@ -98,14 +109,71 @@
|
|||||||
width: 50,
|
width: 50,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
const drawBack = () => {
|
||||||
|
if (!processId.value) {
|
||||||
|
notification.error({
|
||||||
|
message: t('提示'),
|
||||||
|
description: t('请选择要撤回的流程'),
|
||||||
|
});
|
||||||
|
return
|
||||||
|
}
|
||||||
|
Modal.confirm({
|
||||||
|
title: t('提示'),
|
||||||
|
icon: createVNode(ExclamationCircleOutlined),
|
||||||
|
content: t('请确认是否撤回该流程?'),
|
||||||
|
okText: t('确定'),
|
||||||
|
okType: 'danger',
|
||||||
|
cancelText: t('取消'),
|
||||||
|
onOk() {
|
||||||
|
getDrawNode(processId.value).then(r=> {
|
||||||
|
if (r.length) {
|
||||||
|
withdraw(processId.value, r[0].activityId).then(res => {
|
||||||
|
if (res) {
|
||||||
|
notification.open({
|
||||||
|
type: 'success',
|
||||||
|
message: t('撤回'),
|
||||||
|
description: t('撤回成功'),
|
||||||
|
});
|
||||||
|
reload()
|
||||||
|
clearSelectedRowKeys()
|
||||||
|
} else {
|
||||||
|
notification.open({
|
||||||
|
type: 'error',
|
||||||
|
message: t('撤回'),
|
||||||
|
description: t('撤回失败'),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
notification.open({
|
||||||
|
type: 'error',
|
||||||
|
message: t('撤回'),
|
||||||
|
description: t('撤回失败, 无可撤回节点'),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function restartProcess() {
|
})
|
||||||
restartProcessVisible.value = true;
|
},
|
||||||
|
onCancel() {},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
function restartProcessClose() {
|
const onRowDblClick = (record, index) => {
|
||||||
restartProcessVisible.value = false;
|
const { processId, taskId, schemaId } = record;
|
||||||
reload();
|
router.push({
|
||||||
|
path: `/flow/${schemaId}/${processId}/approveFlow`,
|
||||||
|
query: {
|
||||||
|
taskId,
|
||||||
|
readonly: 1
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
// function restartProcess() {
|
||||||
|
// restartProcessVisible.value = true;
|
||||||
|
// }
|
||||||
|
// function restartProcessClose() {
|
||||||
|
// restartProcessVisible.value = false;
|
||||||
|
// reload();
|
||||||
|
// }
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
|
|||||||
Reference in New Issue
Block a user