feat: employee file upload
This commit is contained in:
parent
cd7bbc21a6
commit
60d27ad809
4 changed files with 93 additions and 23 deletions
|
|
@ -2594,7 +2594,7 @@ const emptyCreateDialog = ref(false);
|
|||
@send-ocr="
|
||||
(group: any, file: any) => ocrStore.sendOcr({ file })
|
||||
"
|
||||
/>
|
||||
/>
|
||||
</div> -->
|
||||
|
||||
<div class="row q-col-gutter-sm" id="form-branch-customer-branch">
|
||||
|
|
@ -3109,11 +3109,44 @@ const emptyCreateDialog = ref(false);
|
|||
/>
|
||||
|
||||
<UploadFile
|
||||
:treeFile="[]"
|
||||
:tree-file="
|
||||
Object.values(
|
||||
currentFromDataEmployee.file?.reduce<
|
||||
Record<
|
||||
string,
|
||||
{ label: string; file: { label: string }[] }
|
||||
>
|
||||
>((a, c) => {
|
||||
const _group = c.group || 'other';
|
||||
if (!a[_group]) {
|
||||
a[_group] = {
|
||||
label: _group,
|
||||
file: [
|
||||
{
|
||||
label:
|
||||
c.name ||
|
||||
`${c.group}-${c.file?.name || Date.now()}`,
|
||||
},
|
||||
],
|
||||
};
|
||||
} else {
|
||||
a[_group].file.push({
|
||||
label:
|
||||
c.name ||
|
||||
`${c.group}-${c.file?.name || Date.now()}`,
|
||||
});
|
||||
}
|
||||
return a;
|
||||
}, {}) || {},
|
||||
)
|
||||
"
|
||||
v-model:file="currentFromDataEmployee.file"
|
||||
hide-action
|
||||
:readonly="!employeeFormState.isEmployeeEdit"
|
||||
:dropdown-list="uploadFileListEmployee"
|
||||
@send-ocr="
|
||||
async (v: any, f: any) => {
|
||||
await ocrStore.sendOcr({ file: f });
|
||||
async (_, file) => {
|
||||
if (file) await ocrStore.sendOcr({ file });
|
||||
}
|
||||
"
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -881,11 +881,13 @@ export const useEmployeeForm = defineStore('form-employee', () => {
|
|||
),
|
||||
file: _attach
|
||||
? await Promise.all(
|
||||
_attach.map(async (v) => {
|
||||
const group = v.split('-').at(0);
|
||||
_attach.map(async (name) => {
|
||||
const fragment = name.split('-');
|
||||
const group = fragment.length === 1 ? 'other' : fragment.at(0);
|
||||
|
||||
return {
|
||||
url: await employeeStore.getAttachment(_data.id, v),
|
||||
url: await employeeStore.getAttachment(_data.id, name),
|
||||
name,
|
||||
group,
|
||||
};
|
||||
}),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue