fix: remove manual expense detail add action
This commit is contained in:
@@ -590,7 +590,6 @@ export default {
|
||||
const { currentUser } = useSystemState()
|
||||
const editingExpenseId = ref('')
|
||||
const savingExpenseId = ref('')
|
||||
const creatingExpense = ref(false)
|
||||
const uploadingExpenseId = ref('')
|
||||
const deletingAttachmentId = ref('')
|
||||
const deletingExpenseId = ref('')
|
||||
@@ -898,7 +897,6 @@ export default {
|
||||
|| returnBusy.value
|
||||
|| approveBusy.value
|
||||
|| payBusy.value
|
||||
|| creatingExpense.value
|
||||
|| smartEntryRecognitionBusy.value
|
||||
|| Boolean(uploadingExpenseId.value)
|
||||
|| Boolean(deletingAttachmentId.value)
|
||||
@@ -1086,7 +1084,7 @@ export default {
|
||||
return `已选择 ${names.length} 张附件`
|
||||
})
|
||||
const smartEntryUploadBusy = computed(() =>
|
||||
smartEntryUploadDialogOpen.value && (creatingExpense.value || Boolean(uploadingExpenseId.value))
|
||||
smartEntryUploadDialogOpen.value && Boolean(uploadingExpenseId.value)
|
||||
)
|
||||
const attachmentPreviewEntries = computed(() =>
|
||||
expenseItems.value
|
||||
@@ -1839,48 +1837,6 @@ export default {
|
||||
return ''
|
||||
}
|
||||
|
||||
async function createDraftExpenseItem({ openEditor = true } = {}) {
|
||||
if (!request.value.claimId) {
|
||||
toast('当前草稿缺少 claimId,暂时无法新增费用明细。')
|
||||
return null
|
||||
}
|
||||
|
||||
creatingExpense.value = true
|
||||
try {
|
||||
const existingIds = new Set(expenseItems.value.map((item) => item.id))
|
||||
const claim = await createExpenseClaimItem(request.value.claimId, {})
|
||||
const createdItem = Array.isArray(claim?.items)
|
||||
? claim.items.find((entry) => !existingIds.has(String(entry?.id || '')))
|
||||
: null
|
||||
|
||||
if (!createdItem) {
|
||||
throw new Error('新增费用明细失败,请稍后重试。')
|
||||
}
|
||||
|
||||
const nextItem = buildExpenseItemViewModel(createdItem, expenseItems.value.length, request.value)
|
||||
expenseItems.value = rebuildExpenseItems([...expenseItems.value, nextItem], request.value)
|
||||
creatingExpense.value = false
|
||||
if (openEditor) {
|
||||
startExpenseEdit(nextItem)
|
||||
toast('已新增一条费用明细,请继续填写。')
|
||||
}
|
||||
return nextItem
|
||||
} catch (error) {
|
||||
toast(error?.message || '新增费用明细失败,请稍后重试。')
|
||||
return null
|
||||
} finally {
|
||||
creatingExpense.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function handleAddExpenseItem() {
|
||||
if (!isEditableRequest.value || actionBusy.value) {
|
||||
return
|
||||
}
|
||||
|
||||
await createDraftExpenseItem({ openEditor: true })
|
||||
}
|
||||
|
||||
function triggerSmartEntryUpload() {
|
||||
if (!isEditableRequest.value || actionBusy.value) {
|
||||
return
|
||||
@@ -2590,12 +2546,12 @@ export default {
|
||||
currentSubmitRiskWarning,
|
||||
canEditDetailNote, deleteActionLabel, deleteBusy, deleteDialogDescription, deleteDialogOpen,
|
||||
deleteDialogTitle, deletingAttachmentId, deletingExpenseId, detailNote, detailNoteDirty,
|
||||
detailNoteEditor, detailNoteEditorView, detailNoteTags, draftBlockingIssues, editingExpenseId, creatingExpense, expenseEditor,
|
||||
detailNoteEditor, detailNoteEditorView, detailNoteTags, draftBlockingIssues, editingExpenseId, expenseEditor,
|
||||
expenseItems, expenseTableColumnCount, expenseTotal, expenseUploadInput,
|
||||
expenseTypeOptions: EXPENSE_TYPE_OPTIONS,
|
||||
goToNextSubmitRisk, goToPreviousSubmitRisk,
|
||||
focusExpenseRisk,
|
||||
handleAddExpenseItem, handleApproveRequest, handleDeleteRequest, handleExpenseFileChange, handleSmartEntryFileChange,
|
||||
handleApproveRequest, handleDeleteRequest, handleExpenseFileChange, handleSmartEntryFileChange,
|
||||
handleModifyApplication,
|
||||
handlePayRequest,
|
||||
handleReturnRequest, handleSubmit, heroFactItems, isApplicationDocument, isDraftRequest, isEditableRequest, isTravelRequest,
|
||||
|
||||
Reference in New Issue
Block a user