feat: 流程撤回到上一节点
This commit is contained in:
@ -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,
|
||||
},
|
||||
});
|
||||
|
||||
function restartProcess() {
|
||||
restartProcessVisible.value = true;
|
||||
}
|
||||
function restartProcessClose() {
|
||||
restartProcessVisible.value = false;
|
||||
reload();
|
||||
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('撤回失败, 无可撤回节点'),
|
||||
});
|
||||
}
|
||||
|
||||
})
|
||||
},
|
||||
onCancel() {},
|
||||
});
|
||||
}
|
||||
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