refactor: เพิ่ม filter
This commit is contained in:
parent
bcf6a4ceb6
commit
4511137cc7
1 changed files with 53 additions and 1 deletions
|
|
@ -909,7 +909,43 @@ watch(locale, () => {
|
|||
<q-table
|
||||
flat
|
||||
bordered
|
||||
:rows="treeData"
|
||||
:rows="
|
||||
treeData
|
||||
.flatMap((v) => [v, ...v.branch])
|
||||
.filter((v) => {
|
||||
if (
|
||||
statusFilter === 'statusACTIVE' &&
|
||||
v.status === 'INACTIVE'
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
statusFilter === 'statusINACTIVE' &&
|
||||
v.status !== 'INACTIVE'
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const terms = `${v.code} ${$i18n.locale === 'en-US' ? v.nameEN : v.name} ${v.telephoneNo}`;
|
||||
if (inputSearch && !terms.includes(inputSearch)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (
|
||||
!!currentHq.id &&
|
||||
currentHq.id === v.headOfficeId
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
if (fieldSelectedBranch.value === 'all') return true;
|
||||
if (fieldSelectedBranch.value === 'branchHQLabel')
|
||||
return v.isHeadOffice;
|
||||
if (fieldSelectedBranch.value === 'branchLabel')
|
||||
return !v.isHeadOffice;
|
||||
|
||||
return false;
|
||||
})
|
||||
"
|
||||
:columns="columns"
|
||||
:grid="modeView"
|
||||
card-container-class="row q-col-gutter-md"
|
||||
|
|
@ -935,6 +971,22 @@ watch(locale, () => {
|
|||
'app-text-muted': props.row.status === 'INACTIVE',
|
||||
}"
|
||||
:props="props"
|
||||
@click="
|
||||
() => {
|
||||
if (props.row.isHeadOffice) {
|
||||
fieldSelectedBranch.value = '';
|
||||
inputSearch = '';
|
||||
currentHq = {
|
||||
id: props.row.id,
|
||||
code: props.row.code,
|
||||
};
|
||||
beforeBranch = {
|
||||
id: '',
|
||||
code: '',
|
||||
};
|
||||
}
|
||||
}
|
||||
"
|
||||
>
|
||||
<q-td>
|
||||
<div class="row items-center">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue