feat(web): 优化应用外壳组合式函数和差旅报销创建脚本,增强前端状态管理
This commit is contained in:
@@ -198,9 +198,15 @@ export function useAppShell() {
|
|||||||
|
|
||||||
async function handleDraftSaved(payload = {}) {
|
async function handleDraftSaved(payload = {}) {
|
||||||
const claimNo = String(payload.claimNo || payload.claim_no || '').trim()
|
const claimNo = String(payload.claimNo || payload.claim_no || '').trim()
|
||||||
|
const status = String(payload.status || payload.claimStatus || '').trim()
|
||||||
|
const approvalStage = String(payload.approvalStage || payload.approval_stage || '').trim()
|
||||||
smartEntryOpen.value = false
|
smartEntryOpen.value = false
|
||||||
await reloadRequests()
|
await reloadRequests()
|
||||||
toast(`${claimNo || '该'}单据已保存到草稿,请到报销页面查看。`)
|
if (status === 'submitted') {
|
||||||
|
toast(`${claimNo || '该'}单据已提交审批${approvalStage ? `,当前节点:${approvalStage}` : ''}。`)
|
||||||
|
} else {
|
||||||
|
toast(`${claimNo || '该'}单据已保存到草稿,请到报销页面查看。`)
|
||||||
|
}
|
||||||
router.push({ name: 'app-requests' })
|
router.push({ name: 'app-requests' })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -854,6 +854,8 @@ function buildDraftSavedPayload({
|
|||||||
return {
|
return {
|
||||||
claimId: String(draftPayload?.claim_id || '').trim(),
|
claimId: String(draftPayload?.claim_id || '').trim(),
|
||||||
claimNo: String(draftPayload?.claim_no || '').trim(),
|
claimNo: String(draftPayload?.claim_no || '').trim(),
|
||||||
|
status: String(draftPayload?.status || '').trim(),
|
||||||
|
approvalStage: String(draftPayload?.approval_stage || '').trim(),
|
||||||
person: String(currentUser?.name || '').trim() || '当前用户',
|
person: String(currentUser?.name || '').trim() || '当前用户',
|
||||||
dept: String(currentUser?.role || '').trim() || '待补充部门',
|
dept: String(currentUser?.role || '').trim() || '待补充部门',
|
||||||
entity: String(linkedRequest?.entity || '').trim() || 'Northstar China Ltd.',
|
entity: String(linkedRequest?.entity || '').trim() || 'Northstar China Ltd.',
|
||||||
@@ -876,7 +878,9 @@ function buildDraftSavedPayload({
|
|||||||
expenseTableSummary: documents.length
|
expenseTableSummary: documents.length
|
||||||
? `已关联 ${documents.length} 份票据,请继续在报销页补充和确认`
|
? `已关联 ${documents.length} 份票据,请继续在报销页补充和确认`
|
||||||
: '当前尚未上传票据,请在报销页继续补充附件',
|
: '当前尚未上传票据,请在报销页继续补充附件',
|
||||||
note: '该草稿由 AI 工作台根据当前识别结果生成,可在个人报销页面继续补充明细、票据与说明。'
|
note: String(draftPayload?.status || '').trim() === 'submitted'
|
||||||
|
? '该报销单已由 AI 工作台提交审批,可在个人报销页面持续跟踪进度。'
|
||||||
|
: '该草稿由 AI 工作台根据当前识别结果生成,可在个人报销页面继续补充明细、票据与说明。'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3111,6 +3115,19 @@ export default {
|
|||||||
review_document_form_values: buildReviewDocumentCorrectionContext(reviewDocumentDrafts.value)
|
review_document_form_values: buildReviewDocumentCorrectionContext(reviewDocumentDrafts.value)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (payload?.result?.draft_payload?.status === 'submitted') {
|
||||||
|
emit(
|
||||||
|
'draft-saved',
|
||||||
|
buildDraftSavedPayload({
|
||||||
|
draftPayload: payload.result.draft_payload,
|
||||||
|
reviewPayload: payload?.result?.review_payload || message?.reviewPayload || activeReviewPayload.value,
|
||||||
|
inlineState: reviewInlineForm.value,
|
||||||
|
linkedRequest: linkedRequest.value,
|
||||||
|
currentUser: currentUser.value
|
||||||
|
})
|
||||||
|
)
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
reviewActionBusy.value = false
|
reviewActionBusy.value = false
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user