yxk-20260729

改善提案
Task_improve005 不显示 TaskHandleInnerContent。评委选择“投票通过”或“投票反对”后弹出确认框;确认即锁定个人投票并直接完成当前流程任务。
This commit is contained in:
ye1023
2026-07-29 10:59:04 +08:00
parent 354ab93f53
commit c4fc82ef48
@@ -88,8 +88,8 @@
<template v-if="isTask('Task_improve005')">
<a-form-item label="我的投票">
<a-space v-if="currentVote">
<a-button :type="currentVote.voteResult === 'agree' ? 'primary' : 'default'" :disabled="voteLocked" :loading="savingVote" @click="saveVoteDraft('agree')">投票通过</a-button>
<a-button danger :type="currentVote.voteResult === 'disagree' ? 'primary' : 'default'" :disabled="voteLocked" :loading="savingVote" @click="saveVoteDraft('disagree')">投票反对</a-button>
<a-button :type="currentVote.voteResult === 'agree' ? 'primary' : 'default'" :loading="savingVote" @click="confirmInstituteVote('agree')">投票通过</a-button>
<a-button danger :type="currentVote.voteResult === 'disagree' ? 'primary' : 'default'" :loading="savingVote" @click="confirmInstituteVote('disagree')">投票反对</a-button>
<span>{{ voteResultLabel(currentVote) }}</span>
</a-space>
<span v-else class="form-help">当前用户不在所级评议投票名单中</span>
@@ -109,7 +109,9 @@
</template>
</a-form>
<!-- 所级投票以投票即办理完成避免通用同意/退回与投票结果产生歧义 -->
<TaskHandleInnerContent
v-if="!isTask('Task_improve005')"
:form-data="formData"
:claim="claim"
:before-handle="saveNodeAction"
@@ -178,7 +180,6 @@
import SUploadFile from '/@/components/semri/fileComponent/SUploadFile.vue';
import TaskHandleInnerContent from '/@/views/super/bpm/process/personalOffice/myHandleTask/content/TaskHandleInnerContent.vue';
import {
castInstituteVote,
queryDataById,
queryInstituteVoteCandidates,
queryImprovementInstituteVoteListByMainId,
@@ -198,7 +199,7 @@
claim: { type: Boolean, default: false },
});
const emit = defineEmits(['success', 'claimSuccess']);
const { createMessage } = useMessage();
const { createMessage, createConfirm } = useMessage();
const userStore = useUserStore();
const loading = ref(false);
const savingScore = ref(false);
@@ -257,7 +258,6 @@
return awardOptions.filter((item) => Number(item.value) >= Number(leaderAwardBase.value));
});
const currentVote = computed(() => voteRows.value.find((item) => String(item.voterId) === currentUserId.value));
const voteLocked = computed(() => currentVote.value?.voteStatus === 'voted');
watch(
() => [processInfo.value.mainId, processInfo.value.processInstanceId, processInfo.value.taskId, processInfo.value.taskDefKey],
@@ -351,13 +351,6 @@
}
await saveInstituteVoteMembers(actionPayload({ voterIds: selectedInstituteVoterIds.value }));
}
if (isTask('Task_improve005')) {
if (!currentVote.value?.voteResult) {
createMessage.warning('请先选择投票通过或投票反对');
return false;
}
await submitInstituteVote(actionPayload());
}
if (isTask('Task_improve006')) {
if (!finalAward.value) {
createMessage.warning('请选择最终奖项');
@@ -372,14 +365,27 @@
}
}
async function saveVoteDraft(voteResult: string) {
function confirmInstituteVote(voteResult: 'agree' | 'disagree') {
const voteLabel = voteResult === 'agree' ? '通过' : '反对';
createConfirm({
iconType: 'warning',
title: '确认投票',
content: `确认提交投票${voteLabel}吗?`,
okText: '确认提交',
cancelText: '取消',
onOk: () => submitInstituteVoteAndComplete(voteResult),
});
}
async function submitInstituteVoteAndComplete(voteResult: 'agree' | 'disagree') {
savingVote.value = true;
try {
await castInstituteVote(actionPayload({ voteResult }));
createMessage.success('投票已保存,提交办理前可修改');
await loadProposal();
// 后端在锁定投票后复用通用流程办理服务完成当前 Task5 任务。
await submitInstituteVote(actionPayload({ voteResult }));
createMessage.success('投票提交成功');
emit('success');
} catch (error: any) {
createMessage.warning(error?.message || '投票失败');
createMessage.warning(error?.message || '投票提交失败');
} finally {
savingVote.value = false;
}
@@ -444,8 +450,6 @@
function voteResultLabel(vote: Recordable) {
if (vote.voteStatus !== 'voted') {
if (vote.voteResult === 'agree') return '已选择投票通过,待提交办理';
if (vote.voteResult === 'disagree') return '已选择投票反对,待提交办理';
return '待投票';
}
return vote.voteResult === 'agree' ? '已投同意票' : '已投不同意票';