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 hasStartWorkButton
? ` ? `
function handleStartwork(record: Recordable) { function handleStartwork(record: Recordable) {
if (record.workflowData) { const { processId, schemaId } = record.workflowData;
visibleLookProcessRef.value = true; router.push({
processIdRef.value = record.workflowData?.processId; path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
} query: {
readonly: 1,
taskId: ''
}
});
} }
${ ${
hasFlowRecordButton hasFlowRecordButton

View File

@ -42,6 +42,12 @@
<Title :font-size="18" default-value="流转信息"></Title> <Title :font-size="18" default-value="流转信息"></Title>
<flow-history :items="getTaskRecords()"></flow-history> <flow-history :items="getTaskRecords()"></flow-history>
<opinion-dialog ref="opinionDlg" /> <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>
</div> </div>
</template> </template>
@ -61,6 +67,7 @@ import Title from '/@/components/Title/src/Title.vue';
import FlowHistory from '/@/components/SecondDev/FlowHistory.vue'; import FlowHistory from '/@/components/SecondDev/FlowHistory.vue';
import { message } from 'ant-design-vue'; import { message } 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';
const { data, approveUserData, initProcessData, notificationError, notificationSuccess } = userTaskItem(); const { data, approveUserData, initProcessData, notificationError, notificationSuccess } = userTaskItem();
const { bus, FLOW_PROCESSED } = useEventBus(); const { bus, FLOW_PROCESSED } = useEventBus();
@ -80,6 +87,7 @@ const formConfigs = ref();
const opinionDlg = ref(); const opinionDlg = ref();
const validateSuccess = ref(false); const validateSuccess = ref(false);
const formInformation = ref(); const formInformation = ref();
const showFlowChart = ref(false);
let approvalData = reactive({ let approvalData = reactive({
isCountersign: false, isCountersign: false,
@ -99,7 +107,19 @@ let approvalData = reactive({
}); });
let approvedType = ref(ApproveType.AGREE); 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() { function close() {
tabStore.closeTab(currentRoute, router); tabStore.closeTab(currentRoute, router);
@ -267,7 +287,7 @@ async function getApproveParams() {
async function onFinish(values) { async function onFinish(values) {
try { try {
if (/*validateSuccess.value*/ true) { if (validateSuccess.value) {
let params = await getApproveParams(); let params = await getApproveParams();
await postApproval(params); await postApproval(params);
flowSuccess(); flowSuccess();

View File

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