审批流优化

This commit is contained in:
‘huanghaiixia’
2025-11-28 14:44:37 +08:00
parent 9b3d1f0c8e
commit e9f08e4100
5 changed files with 77 additions and 31 deletions

View File

@ -1,21 +1,21 @@
<template> <template>
<a-spin :spinning="spinning" tip="请稍后..."> <a-spin :spinning="spinning" tip="加载中...">
<div class="page-bg-wrap"> <div class="page-bg-wrap">
<!-- <div class="top-toolbar" id="formViewPage"> --> <!-- <div class="top-toolbar" id="formViewPage">
<!-- <a-space :size="10" wrap style="gap: 0"> <a-space :size="10" wrap style="gap: 0">
<a-button style="margin-right: 10px" @click="close"> <a-button style="margin-right: 10px" @click="close">
<slot name="icon"><close-outlined /></slot>取消 <slot name="icon"><close-outlined /></slot>取消
</a-button> </a-button>
<a-button v-if="mode != 'view'" style="margin-right: 10px" type="primary" @click="handleSubmit('save')"> <a-button style="margin-right: 10px" @click="handleSubmit('save')">
<slot name="icon"><save-outlined /></slot>保存 <slot name="icon"><save-outlined /></slot>保存
</a-button> </a-button>
<a-button v-if="mode != 'view'" style="margin-right: 10px" type="primary" @click="handleSubmit('submit')"> <a-button style="margin-right: 10px" type="primary" @click="handleSubmit('submit')">
<slot name="icon"><check-circle-outlined /></slot>保存并提交 <slot name="icon"><check-circle-outlined /></slot>保存并提交
</a-button> </a-button>
<a-button v-if="mode != 'view'" style="margin-right: 10px" type="primary" @click="handleSubmit"> <a-button style="margin-right: 10px" >
<slot name="icon"><download-outlined /></slot>下载模板 <slot name="icon"><download-outlined /></slot>下载模板
</a-button> </a-button>
<a-button v-if="mode != 'view'" type="primary" @click="handleSubmit"> <a-button >
<slot name="icon"><upload-outlined /></slot>导入 <slot name="icon"><upload-outlined /></slot>导入
</a-button> </a-button>
</a-space> </a-space>
@ -475,17 +475,23 @@
() => props.id, () => props.id,
(val) => { (val) => {
if (val) { if (val) {
if (val) { getList(val)
getList(val) }
} },
} {
immediate: true
}
);
watch(
() => props.disabled,
(val) => {
isDisable.value = val
}, },
{ {
immediate: true immediate: true
} }
); );
onMounted(() => { onMounted(() => {
isDisable.value = props.disabled || false
getOption() getOption()
if (pageId.value) { if (pageId.value) {
getList(pageId.value) getList(pageId.value)
@ -495,13 +501,15 @@
}); });
async function getList(id) { async function getList(id) {
spinning.value = true
let data = await getLngCustomer(id) let data = await getLngCustomer(id)
spinning.value = false
Object.assign(formState, {...data}) Object.assign(formState, {...data})
formState.lngCustomerAttrPowerList = formState.lngCustomerAttrPowerList || [{}] formState.lngCustomerAttrPowerList = formState.lngCustomerAttrPowerList || [{}]
Object.assign(dataBank, formState.lngCustomerBankList || []) Object.assign(dataBank, formState.lngCustomerBankList || [])
Object.assign(dataCertificate, formState.lngCustomerDocList || []) Object.assign(dataCertificate, formState.lngCustomerDocList || [])
Object.assign(dataContact, formState.lngCustomerContactList || []) Object.assign(dataContact, formState.lngCustomerContactList || [])
Object.assign(dataUpload, formState.lngFileUploadList || []) Object.assign(dataFile, formState.lngFileUploadList || [])
} }
async function getOption() { async function getOption() {
optionSelect.cuMcodeList = await getDictionary('LNG_ENT_PR') optionSelect.cuMcodeList = await getDictionary('LNG_ENT_PR')
@ -662,7 +670,9 @@
function close() { function close() {
tabStore.closeTab(currentRoute.value, router); tabStore.closeTab(currentRoute.value, router);
} }
async function getFormValue() {
return formState
}
async function handleSubmit(type) { async function handleSubmit(type) {
try { try {
await formRef.value.validateFields(); await formRef.value.validateFields();
@ -761,7 +771,7 @@
defineExpose({ defineExpose({
handleSubmit, handleSubmit,
getFormValue
}); });
</script> </script>

View File

@ -38,7 +38,7 @@
</template> </template>
</a-space> </a-space>
</div> </div>
<component v-if="customFormConfig.codeList.includes(curPageCode)" :is="componentName" :disabled="readonly" /> <component v-if="customFormConfig.codeList.includes(curPageCode)" :is="componentName" ref="formInformation" :disabled="true" />
<FormInformation <FormInformation
v-else v-else
:key="renderKey" :key="renderKey"
@ -393,12 +393,16 @@
async function onApproveClick(isAutoAgreeBreak = false) { async function onApproveClick(isAutoAgreeBreak = false) {
try { try {
openSpinning(); openSpinning();
if (!isAutoAgreeBreak) { if (!customFormConfig.codeList.includes(curPageCode.value)) {
await submit(); if (!isAutoAgreeBreak) {
} await submit();
if (!validateSuccess.value) { }
closeSpinning(); if (!validateSuccess.value) {
return; closeSpinning();
return;
}
} else {
validateSuccess.value = true
} }
const params = await getApproveParams(); const params = await getApproveParams();
const nextNodes = await postGetNextTaskMaybeArrival(params); const nextNodes = await postGetNextTaskMaybeArrival(params);
@ -681,9 +685,20 @@
async function getApproveParams() { async function getApproveParams() {
try { try {
let formModels = {}
let system = {}
let fileFolderIds = []
if (!customFormConfig.codeList.includes(curPageCode.value)) {
let formModels = await formInformation.value.getFormModels(); let formModels = await formInformation.value.getFormModels();
let system = formInformation.value.getSystemType(); let system = formInformation.value.getSystemType();
let fileFolderIds = getUploadFileFolderIds(formModels); let fileFolderIds = getUploadFileFolderIds(formModels);
} else {
let value = await formInformation.value.getFormValue();
let key = data.formInfos[0]?.formConfig?.key
formModels[key] = value
system[key] = false
fileFolderIds = []
}
return { return {
approvedType: approvalData.approvedType, approvedType: approvalData.approvedType,
approvedResult: approvalData.approvedResult, // approvalData.approvedType 审批结果 如果为 4 就需要传buttonCode approvedResult: approvalData.approvedResult, // approvalData.approvedType 审批结果 如果为 4 就需要传buttonCode
@ -708,13 +723,16 @@
try { try {
if (validateSuccess.value || values === 'reject' || values === 'finish' || values === 'disagree') { if (validateSuccess.value || values === 'reject' || values === 'finish' || values === 'disagree') {
let params = await getApproveParams(); let params = await getApproveParams();
openSpinning()
let response = await postApproval(params); let response = await postApproval(params);
closeSpinning()
// 判断返回值是否带有isAutoAgree 来判断中间是否有自动审批的业务如有再执行判断待审人员是否包含自己不包含就直接flowSuccess // 判断返回值是否带有isAutoAgree 来判断中间是否有自动审批的业务如有再执行判断待审人员是否包含自己不包含就直接flowSuccess
if (checkIsAutoAgree(response)) return; if (checkIsAutoAgree(response)) return;
flowSuccess(); flowSuccess();
data.submitLoading = false; data.submitLoading = false;
} }
} catch (error) { } catch (error) {
closeSpinning()
flowFail(); flowFail();
throw new Error(error); throw new Error(error);
} }

View File

@ -16,7 +16,10 @@
</slot> </slot>
提交 提交
</a-button> </a-button>
<a-button :disabled="data.submitLoading" @click="saveDraft"> <a-button v-if="customFormConfig.codeList.includes(curPageCode)" @click="onSave">
<slot name="icon"><save-outlined /></slot>保存
</a-button>
<a-button v-else :disabled="data.submitLoading" @click="saveDraft">
<slot name="icon"> <slot name="icon">
<clock-circle-outlined /> <clock-circle-outlined />
</slot> </slot>
@ -29,6 +32,14 @@
</slot> </slot>
流程图 流程图
</a-button> </a-button>
<div v-if="customFormConfig.codeList.includes(curPageCode)">
<a-button>
<slot name="icon"><download-outlined /></slot>下载模板
</a-button>
<a-button>
<slot name="icon"><upload-outlined /></slot>导入
</a-button>
</div>
</a-space> </a-space>
</div> </div>
<div class="flow-content"> <div class="flow-content">
@ -54,7 +65,7 @@
import ProcessInformation from '/@/views/workflow/task/components/flow/ProcessInformation.vue'; import ProcessInformation from '/@/views/workflow/task/components/flow/ProcessInformation.vue';
import { getStartProcessInfo, getReStartProcessInfo, reLaunch, postLaunch, postApproval, postGetNextTaskMaybeArrival } from '/@/api/workflow/task'; import { getStartProcessInfo, getReStartProcessInfo, reLaunch, postLaunch, postApproval, postGetNextTaskMaybeArrival } from '/@/api/workflow/task';
import { useMultipleTabStore } from '/@/store/modules/multipleTab'; import { useMultipleTabStore } from '/@/store/modules/multipleTab';
import { CloseOutlined, SendOutlined, ClockCircleOutlined, PrinterOutlined, ApartmentOutlined } from '@ant-design/icons-vue'; import { CloseOutlined, SendOutlined, ClockCircleOutlined, PrinterOutlined, ApartmentOutlined, SaveOutlined, DownloadOutlined, UploadOutlined } from '@ant-design/icons-vue';
import { nextTick, onMounted, ref, toRaw, reactive, computed, defineAsyncComponent } from 'vue'; import { nextTick, onMounted, ref, toRaw, reactive, computed, defineAsyncComponent } from 'vue';
import { deleteDraft, postDraft, putDraft } from '/@/api/workflow/process'; import { deleteDraft, postDraft, putDraft } from '/@/api/workflow/process';
import { useI18n } from '/@/hooks/web/useI18n'; import { useI18n } from '/@/hooks/web/useI18n';
@ -314,7 +325,9 @@
draftId: rDraftsId.value draftId: rDraftsId.value
}; };
} }
async function onSave() {
let value = await formInformation.value.handleSubmit();
}
async function saveLaunchNew() { async function saveLaunchNew() {
if (!taskId.value && rDraftsId.value != '0') { if (!taskId.value && rDraftsId.value != '0') {
try { try {
@ -340,7 +353,7 @@
let obj = {} let obj = {}
system[key] = false system[key] = false
let value = await formInformation.value.handleSubmit(true); let value = await formInformation.value.handleSubmit();
obj[key] = value obj[key] = value
mainFormModels.value = obj mainFormModels.value = obj
console.log(mainFormModels.value, 6666) console.log(mainFormModels.value, 6666)

View File

@ -227,7 +227,12 @@
id.value = res?.formInfos[0]?.formData?.id id.value = res?.formInfos[0]?.formData?.id
initProcessData(res); initProcessData(res);
if (res.buttonConfigs) { if (res.buttonConfigs) {
approvalData.buttonConfigs = res.buttonConfigs; approvalData.buttonConfigs = res.buttonConfigs || [];
// 不显示保存按钮
let idx = approvalData.buttonConfigs.findIndex(v => v.buttonCode == 'draft')
if (idx >-1) {
approvalData.buttonConfigs.splice(idx, 1)
}
} }
if (res.relationTasks) { if (res.relationTasks) {
data.predecessorTasks = res.relationTasks; data.predecessorTasks = res.relationTasks;

View File

@ -26,17 +26,17 @@
<div v-show="activeIndex == index"> <div v-show="activeIndex == index">
<div class="page-bg-wrap"> <div class="page-bg-wrap">
<div class="top-toolbar" style="display: flex; margin-bottom: 10px"> <div class="top-toolbar" style="display: flex; margin-bottom: 10px">
<div id="adminButtons" v-show="activeIndex == index" style="margin-right: 10px"> <!-- <div id="adminButtons" v-show="activeIndex == index" style="margin-right: 10px">
<a-button @click="handleCancel" v-if="forms.modes[index] == 'edit'">取消</a-button> <a-button @click="handleCancel" v-if="forms.modes[index] == 'edit'">取消</a-button>
<a-button @click="handleSave" v-if="forms.modes[index] == 'edit'" type="primary" style="margin-left: 12px">保存</a-button> <a-button @click="handleSave" v-if="forms.modes[index] == 'edit'" type="primary" style="margin-left: 12px">保存</a-button>
<a-button @click="handleEdit" v-if="forms.modes[index] == 'view'">编辑</a-button> <a-button @click="handleEdit" v-if="forms.modes[index] == 'view'">编辑</a-button>
<a-button @click="handleDelete" type="danger" style="margin-left: 12px">删除</a-button> <a-button @click="handleDelete" type="danger" style="margin-left: 12px">删除</a-button>
</div> </div> -->
<div id="approveExtendButton"></div> <div id="approveExtendButton"></div>
<div id="approveRightButton"></div> <div id="approveRightButton"></div>
</div> </div>
<div style="height: 500px;" v-if="customFormConfig.codeList.includes(props.curPageCode)"> <div style="height: 500px;" v-if="customFormConfig.codeList.includes(props.curPageCode)">
<component :id="props.id" :is="componentName" :disabled="props.disabled" /> <component :id="props.id" :is="componentName" :disabled="true" />
</div> </div>
<div v-else> <div v-else>
<SystemForm class="form-box" v-if="item.formType == FormType.SYSTEM" :systemComponent="item.systemComponent" :isViewProcess="props.disabled" :formModel="item.formModel" :workflowConfig="item" :ref="setItemRef" /> <SystemForm class="form-box" v-if="item.formType == FormType.SYSTEM" :systemComponent="item.systemComponent" :isViewProcess="props.disabled" :formModel="item.formModel" :workflowConfig="item" :ref="setItemRef" />
@ -534,7 +534,7 @@
} }
.top-toolbar { .top-toolbar {
min-height: 44px; // min-height: 44px;
margin-bottom: 12px; margin-bottom: 12px;
border-bottom: 1px solid #eee; border-bottom: 1px solid #eee;
} }