refactor: edit layout columns
This commit is contained in:
parent
c4f4fad267
commit
f188bb931d
1 changed files with 57 additions and 53 deletions
|
|
@ -85,6 +85,28 @@ const columns = [
|
||||||
field: 'name',
|
field: 'name',
|
||||||
sortable: true,
|
sortable: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: 'taxNo',
|
||||||
|
align: 'left',
|
||||||
|
label: 'general.taxNo',
|
||||||
|
field: 'taxNo',
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: 'branchLabelTel',
|
||||||
|
align: 'left',
|
||||||
|
label: 'branch.card.branchLabelTel',
|
||||||
|
field: 'telephoneNo',
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: 'contactName',
|
||||||
|
align: 'left',
|
||||||
|
label: 'general.contactName',
|
||||||
|
field: 'contactName',
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
name: 'branchLabelAddress',
|
name: 'branchLabelAddress',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
|
@ -92,18 +114,6 @@ const columns = [
|
||||||
field: 'address',
|
field: 'address',
|
||||||
sortable: true,
|
sortable: true,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: 'branchLabelTel',
|
|
||||||
align: 'left',
|
|
||||||
label: 'general.telephone',
|
|
||||||
field: 'telephoneNo',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'branchLabelType',
|
|
||||||
align: 'left',
|
|
||||||
label: 'general.type',
|
|
||||||
field: 'isHeadOffice',
|
|
||||||
},
|
|
||||||
] satisfies QTableProps['columns'];
|
] satisfies QTableProps['columns'];
|
||||||
|
|
||||||
const modal = ref<boolean>(false);
|
const modal = ref<boolean>(false);
|
||||||
|
|
@ -267,31 +277,26 @@ const beforeBranch = ref<{ id: string; code: string }>({
|
||||||
code: '',
|
code: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const modeView = ref<boolean>(false);
|
||||||
const inputSearch = ref<string>('');
|
const inputSearch = ref<string>('');
|
||||||
const fieldDisplay = ref<
|
|
||||||
(
|
const fieldDisplay = computed(() => {
|
||||||
| 'branchLabelName'
|
return columns
|
||||||
| 'branchLabelAddress'
|
.filter((v) => {
|
||||||
| 'branchLabelTel'
|
return !(
|
||||||
| 'branchLabelType'
|
modeView.value === true &&
|
||||||
| 'orderNumber'
|
(v.name.includes('branchLabelName') || v.name.includes('orderNumber'))
|
||||||
)[]
|
);
|
||||||
>([
|
})
|
||||||
'orderNumber',
|
.map((v) => v.name);
|
||||||
'branchLabelName',
|
});
|
||||||
'branchLabelTel',
|
|
||||||
'branchLabelAddress',
|
const fieldSelected = ref<string[]>([...fieldDisplay.value]);
|
||||||
'branchLabelType',
|
|
||||||
]);
|
watch(modeView, () => {
|
||||||
const fieldSelected = ref<
|
fieldSelected.value = [...fieldDisplay.value];
|
||||||
(
|
});
|
||||||
| 'orderNumber'
|
|
||||||
| 'branchLabelName'
|
|
||||||
| 'branchLabelAddress'
|
|
||||||
| 'branchLabelTel'
|
|
||||||
| 'branchLabelType'
|
|
||||||
)[]
|
|
||||||
>(fieldDisplay.value);
|
|
||||||
const fieldSelectedBranch = ref<{
|
const fieldSelectedBranch = ref<{
|
||||||
label: string;
|
label: string;
|
||||||
value: string;
|
value: string;
|
||||||
|
|
@ -309,8 +314,6 @@ const stats = ref<
|
||||||
}[]
|
}[]
|
||||||
>([]);
|
>([]);
|
||||||
|
|
||||||
const modeView = ref<boolean>(false);
|
|
||||||
|
|
||||||
const splitterModel = ref(25);
|
const splitterModel = ref(25);
|
||||||
|
|
||||||
const defaultFormData = {
|
const defaultFormData = {
|
||||||
|
|
@ -1255,21 +1258,25 @@ watch(currentHq, () => {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</q-td>
|
</q-td>
|
||||||
|
|
||||||
|
<q-td v-if="fieldSelected.includes('taxNo')">
|
||||||
|
{{ props.row.taxNo }}
|
||||||
|
</q-td>
|
||||||
|
|
||||||
|
<q-td v-if="fieldSelected.includes('branchLabelTel')">
|
||||||
|
{{ props.row.contact[0]?.telephoneNo || '-' }}
|
||||||
|
</q-td>
|
||||||
|
|
||||||
|
<q-td v-if="fieldSelected.includes('contactName')">
|
||||||
|
{{ props.row.contactName }}
|
||||||
|
</q-td>
|
||||||
|
|
||||||
<q-td
|
<q-td
|
||||||
v-if="fieldSelected.includes('branchLabelAddress')"
|
v-if="fieldSelected.includes('branchLabelAddress')"
|
||||||
>
|
>
|
||||||
{{ props.row.address }}
|
{{ props.row.address }}
|
||||||
</q-td>
|
</q-td>
|
||||||
<q-td v-if="fieldSelected.includes('branchLabelTel')">
|
{{ console.log(props.row) }}
|
||||||
{{ props.row.contact[0]?.telephoneNo || '-' }}
|
|
||||||
</q-td>
|
|
||||||
<q-td v-if="fieldSelected.includes('branchLabelType')">
|
|
||||||
{{
|
|
||||||
props.row.isHeadOffice
|
|
||||||
? $t('branch.card.branchHQLabel')
|
|
||||||
: $t('branch.card.branchLabel')
|
|
||||||
}}
|
|
||||||
</q-td>
|
|
||||||
<q-td>
|
<q-td>
|
||||||
<KebabAction
|
<KebabAction
|
||||||
:status="props.row.status"
|
:status="props.row.status"
|
||||||
|
|
@ -1363,18 +1370,15 @@ watch(currentHq, () => {
|
||||||
$i18n.locale === 'eng'
|
$i18n.locale === 'eng'
|
||||||
? props.row.nameEN
|
? props.row.nameEN
|
||||||
: props.row.name,
|
: props.row.name,
|
||||||
|
taxNo: props.row.taxNo,
|
||||||
branchLabelTel: props.row.contact
|
branchLabelTel: props.row.contact
|
||||||
.map((c: BranchContact) => c.telephoneNo)
|
.map((c: BranchContact) => c.telephoneNo)
|
||||||
.join(','),
|
.join(','),
|
||||||
|
contactName: props.row.contactName,
|
||||||
branchLabelAddress:
|
branchLabelAddress:
|
||||||
$i18n.locale === 'eng'
|
$i18n.locale === 'eng'
|
||||||
? `${props.row.addressEN || ''} ${props.row.subDistrict?.nameEN || ''} ${props.row.district?.nameEN || ''} ${props.row.province?.nameEN || ''}`
|
? `${props.row.addressEN || ''} ${props.row.subDistrict?.nameEN || ''} ${props.row.district?.nameEN || ''} ${props.row.province?.nameEN || ''}`
|
||||||
: `${props.row.address || ''} ${props.row.subDistrict?.name || ''} ${props.row.district?.name || ''} ${props.row.province?.name || ''}`,
|
: `${props.row.address || ''} ${props.row.subDistrict?.name || ''} ${props.row.district?.name || ''} ${props.row.province?.name || ''}`,
|
||||||
branchLabelType: $t(
|
|
||||||
props.row.isHeadOffice
|
|
||||||
? 'branch.card.branchHQLabel'
|
|
||||||
: 'branch.card.branchLabel',
|
|
||||||
),
|
|
||||||
branchImgUrl: `/branch/${props.row.id}/branch-image`,
|
branchImgUrl: `/branch/${props.row.id}/branch-image`,
|
||||||
}"
|
}"
|
||||||
:field-selected="fieldSelected"
|
:field-selected="fieldSelected"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue