Merge branch 'dev-zhaoDN/auto-agree' into 'dev'
feat:流程自动审批功能 See merge request itc-framework/ma/2024/front!33
This commit is contained in:
@ -83,7 +83,9 @@
|
|||||||
import ProcessInformation from '/@/views/workflow/task/components/flow/ProcessInformation.vue';
|
import ProcessInformation from '/@/views/workflow/task/components/flow/ProcessInformation.vue';
|
||||||
import { useI18n } from '/@/hooks/web/useI18n';
|
import { useI18n } from '/@/hooks/web/useI18n';
|
||||||
import { useMessage } from '/@/hooks/web/useMessage';
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
|
import { useUserStore } from '/@/store/modules/user';
|
||||||
|
|
||||||
|
const userStore = useUserStore();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { notification } = useMessage();
|
const { notification } = useMessage();
|
||||||
|
|
||||||
@ -187,8 +189,10 @@
|
|||||||
tabStore.closeTab(currentRoute, router);
|
tabStore.closeTab(currentRoute, router);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function onApproveClick() {
|
async function onApproveClick(isAutoAgreeBreak = false) {
|
||||||
await submit();
|
if (!isAutoAgreeBreak) {
|
||||||
|
await submit();
|
||||||
|
}
|
||||||
if (!validateSuccess.value) {
|
if (!validateSuccess.value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -196,6 +200,10 @@
|
|||||||
const nextNodes = await postGetNextTaskMaybeArrival(params);
|
const nextNodes = await postGetNextTaskMaybeArrival(params);
|
||||||
approvalData.approvedType = ApproveType.AGREE;
|
approvalData.approvedType = ApproveType.AGREE;
|
||||||
approvalData.approvedResult = ApproveCode.AGREE;
|
approvalData.approvedResult = ApproveCode.AGREE;
|
||||||
|
//如果是自动同意触发的,关闭弹层的loading
|
||||||
|
if (isAutoAgreeBreak) {
|
||||||
|
opinionDlg.value.stopLoading()
|
||||||
|
}
|
||||||
opinionDlg.value.toggleDialog({
|
opinionDlg.value.toggleDialog({
|
||||||
action: 'agree',
|
action: 'agree',
|
||||||
nextNodes,
|
nextNodes,
|
||||||
@ -422,7 +430,9 @@
|
|||||||
try {
|
try {
|
||||||
if (validateSuccess.value || values === 'reject' || values === 'finish') {
|
if (validateSuccess.value || values === 'reject' || values === 'finish') {
|
||||||
let params = await getApproveParams();
|
let params = await getApproveParams();
|
||||||
await postApproval(params);
|
let response = await postApproval(params);
|
||||||
|
// 判断返回值是否带有isAutoAgree 来判断中间是否有自动审批的业务,如有再执行判断待审人员是否包含自己,不包含就直接flowSuccess
|
||||||
|
if (checkIsAutoAgree(response)) return
|
||||||
flowSuccess();
|
flowSuccess();
|
||||||
data.submitLoading = false;
|
data.submitLoading = false;
|
||||||
}
|
}
|
||||||
@ -430,4 +440,25 @@
|
|||||||
flowFail();
|
flowFail();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断该次审核是否触发自动同意事务,并且检验返回得task 是否是自身作为被审需要弹框再次审核
|
||||||
|
* @param response
|
||||||
|
*/
|
||||||
|
function checkIsAutoAgree(response) {
|
||||||
|
if (response != null
|
||||||
|
&& response.length != 0
|
||||||
|
&& response[0].isAutoAgree == true //
|
||||||
|
&& response[0].approveUserIds.includes(userStore.getUserInfo.id)) {
|
||||||
|
console.error('will reSelect user=', response[0].taskId);
|
||||||
|
// 注入新得taskId
|
||||||
|
taskId.value = response[0].taskId;
|
||||||
|
data.submitLoading = false;
|
||||||
|
onApproveClick(true);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user