fix(mobile): converge work report confirmation
This commit is contained in:
@@ -251,6 +251,7 @@ import {
|
||||
isCurrentWorkReportRequest,
|
||||
isDefinitiveWorkReportRejection,
|
||||
organizeWorkReport,
|
||||
prepareWorkReportOrganizeInput,
|
||||
stableWorkReportRequestId,
|
||||
submitWorkReport,
|
||||
uploadWorkReportAttachment,
|
||||
@@ -430,6 +431,7 @@ const organizeInput = async (
|
||||
const transcript = text.trim();
|
||||
if (!transcript || organizing.value || draftLocked.value || submittedReport.value) return;
|
||||
const previousDraft = draftPayload();
|
||||
const organizeRequest = prepareWorkReportOrganizeInput(transcript, previousDraft);
|
||||
pushMessage<UserMessage>({
|
||||
role: 'user',
|
||||
text: transcript,
|
||||
@@ -443,8 +445,8 @@ const organizeInput = async (
|
||||
speechPlayback.stop();
|
||||
try {
|
||||
const result = await organizeWorkReport({
|
||||
transcript,
|
||||
currentDraft: previousDraft,
|
||||
transcript: organizeRequest.transcript,
|
||||
currentDraft: organizeRequest.currentDraft,
|
||||
attachmentOssId: attachment.value?.ossId,
|
||||
attachmentName: attachment.value?.fileName
|
||||
});
|
||||
|
||||
@@ -52,6 +52,29 @@ export const isCurrentWorkReportRequest = (
|
||||
currentAccountKey: string
|
||||
) => generation === currentGeneration && accountKey === currentAccountKey;
|
||||
|
||||
export const prepareWorkReportOrganizeInput = (
|
||||
transcript: string,
|
||||
currentDraft?: WorkReportDraft
|
||||
): { transcript: string; currentDraft?: WorkReportDraft } => {
|
||||
const addition = transcript.trim();
|
||||
if (!currentDraft) return { transcript: addition };
|
||||
|
||||
const currentContent = currentDraft.content.trim();
|
||||
const content = !currentContent
|
||||
? addition
|
||||
: !addition || currentContent === addition
|
||||
? currentContent
|
||||
: `${currentContent}\n${addition}`;
|
||||
|
||||
return {
|
||||
transcript: '',
|
||||
currentDraft: {
|
||||
...currentDraft,
|
||||
content
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export const workReportTypes: Array<{ value: WorkReportType; label: string; desc: string; icon: string }> = [
|
||||
{ value: 'CASE', label: '优秀案例', desc: '现场处理得好的真实案例', icon: '⭐' },
|
||||
{ value: 'VIDEO', label: '操作视频', desc: '值得推广的操作演示视频', icon: '🎬' },
|
||||
|
||||
Reference in New Issue
Block a user