fix(oa): 同意/拒绝/打回前自动发送评论草稿

审批动作前冲刷评论区未发送内容,减少先点发送再审批的一步操作。
关联 #118。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zlwuandCursor committed 2026-11-19 11:55:53 +08:00
1 parent 0929164bf5
commit a69dcc5bca
8 files changed
+137 -13

No files matched your search

@@ -99,6 +99,7 @@
/>
<OaCommentPanel
v-if="detail?.id"
ref="commentPanelRef"
:instance-id="detail.id"
:instance-status="detail.status || ''"
@refresh="load"
@@ -236,6 +237,9 @@
const userStore = useUserStore()
const loading = ref(false)
const acting = ref(false)
const commentPanelRef = ref<{ flushDraft?: (opts?: { quiet?: boolean }) => Promise<boolean> } | null>(
null
)
const detail = ref<any>(null)
const viewFormData = ref<Record<string, any>>({})
const viewRule = ref<any[]>([])
@@ -392,9 +396,17 @@
}
}
/** 同意/拒绝/打回前先发送评论区未提交草稿 */
async function flushPendingComment(): Promise<boolean> {
const flush = commentPanelRef.value?.flushDraft
if (!flush) return true
return await flush()
}
async function act(kind: 'approve' | 'reject') {
const task = myPendingTask.value
if (!task) return
if (!(await flushPendingComment())) return
let comment = ''
try {
const res = await ElMessageBox.prompt(
@@ -436,6 +448,7 @@
async function doReturn() {
const task = myPendingTask.value
if (!task) return
if (!(await flushPendingComment())) return
let comment = ''
try {
const res = await ElMessageBox.prompt('请填写打回意见(必填)', '打回', {