fix(oid): статус СТ до оповещения — на финале согласования шлём Согласована
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -248,26 +248,33 @@ export function useStep4Approval(args: UseStep4ApprovalArgs) {
|
||||
setChain(updatedChain);
|
||||
onSave({ approvalChain: updatedChain });
|
||||
|
||||
const nextPending = updatedChain.find((m) => m.status === "pending");
|
||||
if (nextPending) {
|
||||
if (currentMember.spApprovalId) {
|
||||
await notify(currentMember.spApprovalId);
|
||||
}
|
||||
if (nextPending.spApprovalId) {
|
||||
await notify(nextPending.spApprovalId);
|
||||
}
|
||||
}
|
||||
|
||||
const allDone = updatedChain.every(
|
||||
(m) =>
|
||||
m.status === "approved" ||
|
||||
m.status === "skipped" ||
|
||||
m.status === "recommends"
|
||||
);
|
||||
|
||||
if (allDone) {
|
||||
// Финал: сначала статус «Согласовано», потом оповещение — иначе поток прочитает
|
||||
// «На согласовании» и не отправит «Согласована» (а раньше на финале вообще ничего
|
||||
// не слал, т.к. nextPending уже нет). Порядок как в ветке отклонения.
|
||||
await service.updateOIDStatus(oid!.id, "approved");
|
||||
onSave({ oid: { ...oid!, status: "approved" }, approvalChain: updatedChain });
|
||||
if (currentMember.spApprovalId) {
|
||||
await notify(currentMember.spApprovalId);
|
||||
}
|
||||
onStepComplete(4);
|
||||
} else {
|
||||
const nextPending = updatedChain.find((m) => m.status === "pending");
|
||||
if (nextPending) {
|
||||
if (currentMember.spApprovalId) {
|
||||
await notify(currentMember.spApprovalId);
|
||||
}
|
||||
if (nextPending.spApprovalId) {
|
||||
await notify(nextPending.spApprovalId);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const othersToDelete = chain.filter(
|
||||
|
||||
Reference in New Issue
Block a user