refactor: handle filter file customer or employee
This commit is contained in:
parent
1df27aeed0
commit
29c7186f9a
1 changed files with 27 additions and 16 deletions
|
|
@ -182,22 +182,33 @@ async function fetchRequestAttachment(type: 'customer' | 'employee') {
|
|||
}
|
||||
|
||||
const currentListDocument = computed(() => {
|
||||
return props.listDocument.map((v, i) => {
|
||||
const fileIds = attachmentList.value[v]
|
||||
? Object.values(attachmentList.value[v])
|
||||
: [];
|
||||
const fileNames = fileIds.map((id) => String(id));
|
||||
return {
|
||||
no: i + 1,
|
||||
documentType: v,
|
||||
fileName: fileNames,
|
||||
amount: fileIds.length,
|
||||
documentInSystem: fileIds.length > 0,
|
||||
status: attributes.value
|
||||
? (attributes.value[state.tab]?.[v] ?? docStatus[0])
|
||||
: docStatus[0],
|
||||
};
|
||||
});
|
||||
return props.listDocument
|
||||
.map((v, i) => {
|
||||
const fileIds = attachmentList.value[v]
|
||||
? Object.values(attachmentList.value[v])
|
||||
: [];
|
||||
const fileNames = fileIds.map((id) => String(id));
|
||||
return {
|
||||
no: i + 1,
|
||||
documentType: v,
|
||||
fileName: fileNames,
|
||||
amount: fileIds.length,
|
||||
documentInSystem: fileIds.length > 0,
|
||||
status: attributes.value
|
||||
? (attributes.value[state.tab]?.[v] ?? docStatus[0])
|
||||
: docStatus[0],
|
||||
};
|
||||
})
|
||||
.filter((v) => {
|
||||
const filterFileCustomer = ['passport', 'visa', 'tm6'];
|
||||
const filterFileEmployee = ['citizen'];
|
||||
|
||||
if (state.tab === 'customer') {
|
||||
return !filterFileCustomer.includes(v.documentType);
|
||||
} else {
|
||||
return !filterFileEmployee.includes(v.documentType);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function triggerCancel() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue