feat: 流程撤回到上一节点
This commit is contained in:
@ -37,6 +37,7 @@ enum Api {
|
||||
SetSign = '/workflow/execute/set-sign',
|
||||
Withdraw = '/workflow/execute/my-task/withdraw',
|
||||
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-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 && drawNode" key="drawBack">撤回</a-menu-item>
|
||||
<a-menu-item key="flowchart">查看流程图</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
@ -62,12 +63,12 @@
|
||||
|
||||
<script setup>
|
||||
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 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 { 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 TransferDialog from '/@/components/SecondDev/TransferDialog.vue';
|
||||
import { separator } from '/@bpmn/config/info';
|
||||
@ -77,6 +78,10 @@
|
||||
import { message, Modal } from 'ant-design-vue';
|
||||
import useEventBus from '/@/hooks/event/useEventBus';
|
||||
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 { bus, FLOW_PROCESSED } = useEventBus();
|
||||
@ -101,6 +106,7 @@
|
||||
const hasBtnApprove = ref(true);
|
||||
const hasBtnReject = ref(false);
|
||||
const hasBtnFinish = ref(false);
|
||||
const drawNode = ref('')
|
||||
|
||||
let approvalData = reactive({
|
||||
isCountersign: false,
|
||||
@ -134,6 +140,33 @@
|
||||
});
|
||||
} else if (key === 'transfer') {
|
||||
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 = [];
|
||||
}
|
||||
renderKey.value = Math.random() + '';
|
||||
getBackNode()
|
||||
} catch (error) {}
|
||||
});
|
||||
|
||||
function getBackNode() {
|
||||
getDrawNode(processId.value).then(res => {
|
||||
drawNode.value = res[0].activityId
|
||||
})
|
||||
}
|
||||
|
||||
async function submit() {
|
||||
data.submitLoading = true;
|
||||
validateSuccess.value = false;
|
||||
|
||||
@ -1,15 +1,16 @@
|
||||
<template>
|
||||
<BasicTable @register="registerTable" @selection-change="selectionChange">
|
||||
<BasicTable @register="registerTable" @row-dbClick="onRowDblClick" @selection-change="selectionChange">
|
||||
<template #toolbar>
|
||||
<div class="button-box">
|
||||
<RejectProcess
|
||||
<a-button @click="drawBack">{{ t('撤回') }}</a-button>
|
||||
<!-- <RejectProcess
|
||||
:taskId="taskId"
|
||||
:processId="processId"
|
||||
@close="reload"
|
||||
@restart="restartProcess"
|
||||
class="mr-2"
|
||||
><a-button v-auth="'processtasks:withdraw'">{{ t('撤回') }}</a-button></RejectProcess
|
||||
>
|
||||
> -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -17,29 +18,36 @@
|
||||
<a-progress v-if="record.currentProgress" :percent="record.currentProgress" size="small" />
|
||||
</template>
|
||||
</BasicTable>
|
||||
<LaunchProcess
|
||||
<!-- <LaunchProcess
|
||||
v-if="restartProcessVisible"
|
||||
:schemaId="schemaId"
|
||||
:taskId="taskId"
|
||||
@close="restartProcessClose"
|
||||
/>
|
||||
/> -->
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
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 LaunchProcess from './../LaunchProcess.vue';
|
||||
import RejectProcess from './../RejectProcess.vue';
|
||||
|
||||
import { BasicTable, useTable, BasicColumn } from '/@/components/Table';
|
||||
import { getDrawNode, withdraw } from '/@/api/workflow/task';
|
||||
import { getSchemaTask } from '/@/api/workflow/process';
|
||||
import { TaskTypeUrl } from '/@/enums/workflowEnum';
|
||||
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 restartProcessVisible = ref(false);
|
||||
const router = useRouter();
|
||||
const configColumns: BasicColumn[] = [
|
||||
{
|
||||
title: t('流水号'),
|
||||
@ -79,7 +87,7 @@
|
||||
];
|
||||
|
||||
const { formConfig, processId, taskId, schemaId, selectionChange } = userTaskTable();
|
||||
const [registerTable, { reload }] = useTable({
|
||||
const [registerTable, { reload, clearSelectedRowKeys }] = useTable({
|
||||
title: t('已办任务列表'),
|
||||
api: getSchemaTask,
|
||||
rowKey: 'id',
|
||||
@ -88,6 +96,9 @@
|
||||
beforeFetch: (params) => {
|
||||
return { data: params, taskUrl: TaskTypeUrl.FINISHED_TASKS };
|
||||
},
|
||||
rowSelection: {
|
||||
type: 'radio'
|
||||
},
|
||||
useSearchForm: true,
|
||||
showTableSetting: true,
|
||||
striped: false,
|
||||
@ -98,14 +109,71 @@
|
||||
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() {
|
||||
restartProcessVisible.value = false;
|
||||
reload();
|
||||
const onRowDblClick = (record, index) => {
|
||||
const { processId, taskId, schemaId } = record;
|
||||
router.push({
|
||||
path: `/flow/${schemaId}/${processId}/approveFlow`,
|
||||
query: {
|
||||
taskId,
|
||||
readonly: 1
|
||||
}
|
||||
});
|
||||
};
|
||||
// function restartProcess() {
|
||||
// restartProcessVisible.value = true;
|
||||
// }
|
||||
// function restartProcessClose() {
|
||||
// restartProcessVisible.value = false;
|
||||
// reload();
|
||||
// }
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
|
||||
Reference in New Issue
Block a user