fix: sort selected field

This commit is contained in:
Methapon2001 2024-12-10 14:22:15 +07:00
parent eaa92f214d
commit 42585c859c
2 changed files with 25 additions and 11 deletions

View file

@ -101,11 +101,19 @@ defineProps<{
<slot name="data"></slot> <slot name="data"></slot>
<template v-if="!$slots.data"> <template v-if="!$slots.data">
<div <div
v-for="key in fieldSelected || [ v-for="key in (
'branchLabelAddress', fieldSelected || [
'branchLabelTel', 'branchLabelAddress',
'branchLabelType', 'branchLabelTel',
]" 'branchLabelType',
]
).sort((lhs, rhs) => {
let order = Object.keys(data);
return (
order.findIndex((i) => i === lhs) -
order.findIndex((i) => i === rhs)
);
})"
:key="key" :key="key"
class="branch-card__data" class="branch-card__data"
> >

View file

@ -1603,17 +1603,23 @@ const emptyCreateDialog = ref(false);
<div <div
class="col-12 q-py-sm row" class="col-12 q-py-sm row"
v-for="key in fieldSelected v-for="key in fieldSelected
.filter((v) => {
return columnsCustomer.some(
(c) => c.name === v,
);
})
.filter((v) => { .filter((v) => {
return ( return (
v !== 'orderNumber' && v !== 'orderNumber' &&
v !== 'titleName' && v !== 'titleName' &&
v !== 'address' && v !== 'address' &&
v !== 'contactName' v !== 'contactName' &&
columnsCustomer.some((c) => c.name === v)
);
})
.sort((lhs, rhs) => {
const fields = [
...columnsEmployee,
...columnsCustomer,
];
return (
fields.findIndex((i) => i.name === lhs) -
fields.findIndex((i) => i.name === rhs)
); );
})" })"
:key="key" :key="key"