feat: 流程审批添加查看流程图,放出必填检查;流程发起添加loading

This commit is contained in:
GAOANG
2024-04-07 08:32:57 +08:00
parent fc8e052a4a
commit 4f32569fae
3 changed files with 86 additions and 53 deletions

View File

@ -1541,10 +1541,14 @@ ${hasTemplatePrint ? ' reactive ' : ''}
hasStartWorkButton
? `
function handleStartwork(record: Recordable) {
if (record.workflowData) {
visibleLookProcessRef.value = true;
processIdRef.value = record.workflowData?.processId;
}
const { processId, schemaId } = record.workflowData;
router.push({
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
query: {
readonly: 1,
taskId: ''
}
});
}
${
hasFlowRecordButton

View File

@ -42,6 +42,12 @@
<Title :font-size="18" default-value="流转信息"></Title>
<flow-history :items="getTaskRecords()"></flow-history>
<opinion-dialog ref="opinionDlg" />
<a-modal :visible="showFlowChart" centered class="geg" title="流程图" width="1200px" :closable="false">
<process-information :process-id="processId" :xml="data.xml" />
<template #footer>
<a-button type="primary" @click="closeFlowChart">关闭</a-button>
</template>
</a-modal>
</div>
</div>
</template>
@ -61,6 +67,7 @@ import Title from '/@/components/Title/src/Title.vue';
import FlowHistory from '/@/components/SecondDev/FlowHistory.vue';
import { message } from 'ant-design-vue';
import useEventBus from '/@/hooks/event/useEventBus';
import ProcessInformation from '/@/views/workflow/task/components/flow/ProcessInformation.vue';
const { data, approveUserData, initProcessData, notificationError, notificationSuccess } = userTaskItem();
const { bus, FLOW_PROCESSED } = useEventBus();
@ -80,6 +87,7 @@ const formConfigs = ref();
const opinionDlg = ref();
const validateSuccess = ref(false);
const formInformation = ref();
const showFlowChart = ref(false);
let approvalData = reactive({
isCountersign: false,
@ -99,7 +107,19 @@ let approvalData = reactive({
});
let approvedType = ref(ApproveType.AGREE);
function onMoreClick() { }
function onMoreClick(e) {
if (e.key === "flowchart") {
openFlowChart()
}
}
function closeFlowChart() {
showFlowChart.value = false;
}
function openFlowChart() {
showFlowChart.value = true;
}
function close() {
tabStore.closeTab(currentRoute, router);
@ -267,7 +287,7 @@ async function getApproveParams() {
async function onFinish(values) {
try {
if (/*validateSuccess.value*/ true) {
if (validateSuccess.value) {
let params = await getApproveParams();
await postApproval(params);
flowSuccess();

View File

@ -1,53 +1,55 @@
<template>
<div class="page-bg-wrap">
<div class="geg-flow-page">
<div class="top-toolbar">
<a-space :size="10" wrap>
<a-button style="margin-right: 10px" @click="close">
<slot name="icon">
<close-outlined />
</slot>
关闭
</a-button>
<a-button type="primary" :disabled="data.submitLoading" @click="saveLaunch">
<slot name="icon">
<send-outlined />
</slot>
提交
</a-button>
<a-button :disabled="data.submitLoading" @click="saveDraft">
<slot name="icon">
<clock-circle-outlined />
</slot>
暂存
</a-button>
<a-button>
<slot name="icon">
<printer-outlined />
</slot>
打印
</a-button>
<a-button @click="openFlowChart">
<slot name="icon">
<apartment-outlined />
</slot>
流程图
</a-button>
</a-space>
<a-spin tip="Loading..." :spinning="loading">
<div class="geg-flow-page">
<div class="top-toolbar">
<a-space :size="10" wrap>
<a-button style="margin-right: 10px" @click="close">
<slot name="icon">
<close-outlined />
</slot>
关闭
</a-button>
<a-button type="primary" :disabled="data.submitLoading" @click="saveLaunch">
<slot name="icon">
<send-outlined />
</slot>
提交
</a-button>
<a-button :disabled="data.submitLoading" @click="saveDraft">
<slot name="icon">
<clock-circle-outlined />
</slot>
暂存
</a-button>
<a-button>
<slot name="icon">
<printer-outlined />
</slot>
打印
</a-button>
<a-button @click="openFlowChart">
<slot name="icon">
<apartment-outlined />
</slot>
流程图
</a-button>
</a-space>
</div>
<div class="flow-content">
<FormInformation :key="randKey" ref="formInformation" :disabled="false"
:formAssignmentData="data.formAssignmentData" :formInfos="data.formInfos"
:opinions="data.opinions" :opinionsComponents="data.opinionsComponents" />
</div>
</div>
<div class="flow-content">
<FormInformation :key="randKey" ref="formInformation" :disabled="false"
:formAssignmentData="data.formAssignmentData" :formInfos="data.formInfos" :opinions="data.opinions"
:opinionsComponents="data.opinionsComponents" />
</div>
</div>
<a-modal :visible="showFlowChart" centered class="geg" closable title="流程图" width="1200px">
<process-information :process-id="processId" :xml="data.xml" />
<template #footer>
<a-button type="primary" @click="closeFlowChart">关闭</a-button>
</template>
</a-modal>
<opinion-dialog ref="opinionDlg" />
<a-modal :visible="showFlowChart" centered class="geg" closable title="流程图" width="1200px">
<process-information :process-id="processId" :xml="data.xml" />
<template #footer>
<a-button type="primary" @click="closeFlowChart">关闭</a-button>
</template>
</a-modal>
<opinion-dialog ref="opinionDlg" />
</a-spin>
</div>
</template>
@ -78,6 +80,7 @@ const fullPath = currentRoute.fullPath;
const rSchemaId = rParams.arg1;
const rDraftsId = rParams.arg2;
const taskId = ref();
const loading = ref(false)
const draftsJsonStr = localStorage.getItem('draftsJsonStr');
let formInformation = ref();
const opinionDlg = ref();
@ -193,6 +196,7 @@ function createFlowSuccess(taskList) {
message.success('流程发起成功');
data.submitLoading = false;
loading.value = false
setTimeout(() => {
close();
}, 500);
@ -233,6 +237,7 @@ async function onFinish(values) {
await postApproval(params);
flowSuccess();
data.submitLoading = false;
loading.value = false
}
} catch (error) {
flowFail();
@ -260,6 +265,7 @@ async function getApproveParams() {
async function saveLaunch() {
data.submitLoading = true;
loading.value = true
try {
let validateForms = await formInformation.value.validateForm();
let system = formInformation.value.getSystemType();
@ -300,6 +306,7 @@ async function saveLaunch() {
if (taskList.length > 0) {
notificationError('提交失败', '流程设计错误,开始后的第一个节点必须是审批人为发起人的起草节点。');
data.submitLoading = false;
loading.value = false
} else {
createFlowSuccess(taskList);
}
@ -309,10 +316,12 @@ async function saveLaunch() {
} else {
data.submitLoading = false;
notificationError(t('发起流程'), t('表单校验未通过'));
loading.value = false
}
}
} catch (error) {
data.submitLoading = false;
loading.value = false
notificationError(t('发起流程'), t('发起流程失败'));
}
}