refactor: Change the way data is sent
This commit is contained in:
parent
3727627717
commit
31f0aa3120
3 changed files with 12 additions and 7 deletions
|
|
@ -2319,8 +2319,8 @@ const emptyCreateDialog = ref(false);
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
@send-ocr="
|
@send-ocr="
|
||||||
async (_, file) => {
|
async (group, file) => {
|
||||||
if (file) await ocrStore.sendOcr({ file });
|
if (file) await ocrStore.sendOcr({ file, category: group });
|
||||||
employeeFormState.ocr = false;
|
employeeFormState.ocr = false;
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
|
|
@ -3325,8 +3325,9 @@ const emptyCreateDialog = ref(false);
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
@send-ocr="
|
@send-ocr="
|
||||||
async (_, file) => {
|
async (group, file) => {
|
||||||
if (file) await ocrStore.sendOcr({ file });
|
if (file)
|
||||||
|
await ocrStore.sendOcr({ file, category: group });
|
||||||
employeeFormState.ocr = false;
|
employeeFormState.ocr = false;
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
|
|
|
||||||
|
|
@ -213,8 +213,11 @@ defineProps<{
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
@send-ocr="
|
@send-ocr="
|
||||||
async (v: any, f: any) => {
|
async (group: any, file: any) => {
|
||||||
const res = await ocrStore.sendOcr({ file: f });
|
const res = await ocrStore.sendOcr({
|
||||||
|
file: file,
|
||||||
|
category: group,
|
||||||
|
});
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
const map = res.fields.reduce<Record<string, string>>(
|
const map = res.fields.reduce<Record<string, string>>(
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ const useOcr = defineStore('useOcrStore', () => {
|
||||||
async function sendOcr(
|
async function sendOcr(
|
||||||
payload: {
|
payload: {
|
||||||
file: File;
|
file: File;
|
||||||
|
category: string;
|
||||||
},
|
},
|
||||||
flow?: {
|
flow?: {
|
||||||
sessionId?: string;
|
sessionId?: string;
|
||||||
|
|
@ -22,7 +23,7 @@ const useOcr = defineStore('useOcrStore', () => {
|
||||||
document: string;
|
document: string;
|
||||||
fields: { name: string; value: string }[];
|
fields: { name: string; value: string }[];
|
||||||
result: string;
|
result: string;
|
||||||
}>(`${baseUrl}/`, payload.file, {
|
}>(`${baseUrl}/?category=${payload.category}`, payload.file, {
|
||||||
headers: { 'Content-Type': payload.file?.type },
|
headers: { 'Content-Type': payload.file?.type },
|
||||||
onUploadProgress: (e) => console.log(e),
|
onUploadProgress: (e) => console.log(e),
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue