refactor: edit type
This commit is contained in:
parent
381f1c18e6
commit
d1133d0bc2
2 changed files with 15 additions and 6 deletions
|
|
@ -48,7 +48,8 @@ export const useCustomerForm = defineStore('form-customer', () => {
|
||||||
editCustomerId?: string;
|
editCustomerId?: string;
|
||||||
editCustomerCode?: string;
|
editCustomerCode?: string;
|
||||||
editCustomerBranchId?: string;
|
editCustomerBranchId?: string;
|
||||||
treeFile: { lable: string; file: { lable: string }[] }[];
|
treeFile: { label: string; file: { label: string }[] }[];
|
||||||
|
formDataOcr: Record<string, any>;
|
||||||
}>({
|
}>({
|
||||||
dialogType: 'info',
|
dialogType: 'info',
|
||||||
dialogOpen: false,
|
dialogOpen: false,
|
||||||
|
|
@ -63,6 +64,7 @@ export const useCustomerForm = defineStore('form-customer', () => {
|
||||||
editCustomerBranchId: '',
|
editCustomerBranchId: '',
|
||||||
defaultCustomerImageUrl: '',
|
defaultCustomerImageUrl: '',
|
||||||
treeFile: [],
|
treeFile: [],
|
||||||
|
formDataOcr: {},
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
|
@ -174,15 +176,15 @@ export const useCustomerForm = defineStore('form-customer', () => {
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!state.value.treeFile.some(
|
!state.value.treeFile.some(
|
||||||
(x) => x.lable === t(`customer.typeFile.${temp || ''}`),
|
(x) => x.label === t(`customer.typeFile.${temp || ''}`),
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
state.value.treeFile.push({
|
state.value.treeFile.push({
|
||||||
lable: t(`customer.typeFile.${temp || ''}`),
|
label: t(`customer.typeFile.${temp || ''}`),
|
||||||
file: r
|
file: r
|
||||||
.filter((x) => x.includes(temp || ''))
|
.filter((x) => x.includes(temp || ''))
|
||||||
.map((x) => ({
|
.map((x) => ({
|
||||||
lable: x,
|
label: x,
|
||||||
})),
|
})),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,12 +18,19 @@ const useOcr = defineStore('useOcrStore', () => {
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
const res = await axios
|
const res = await axios
|
||||||
.post(`${baseUrl}/`, payload.file, {
|
.post<{
|
||||||
|
document: string;
|
||||||
|
fields: { name: string; value: string }[];
|
||||||
|
result: string;
|
||||||
|
}>(`${baseUrl}/`, payload.file, {
|
||||||
headers: { 'Content-Type': payload.file?.type },
|
headers: { 'Content-Type': payload.file?.type },
|
||||||
onUploadProgress: (e) => console.log(e),
|
onUploadProgress: (e) => console.log(e),
|
||||||
})
|
})
|
||||||
.catch((e) => console.error(e));
|
.catch((e) => console.error(e));
|
||||||
// ]);
|
|
||||||
|
if (!res || res.status >= 400) return false;
|
||||||
|
|
||||||
|
return res.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue