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>
<template v-if="!$slots.data">
<div
v-for="key in fieldSelected || [
'branchLabelAddress',
'branchLabelTel',
'branchLabelType',
]"
v-for="key in (
fieldSelected || [
'branchLabelAddress',
'branchLabelTel',
'branchLabelType',
]
).sort((lhs, rhs) => {
let order = Object.keys(data);
return (
order.findIndex((i) => i === lhs) -
order.findIndex((i) => i === rhs)
);
})"
:key="key"
class="branch-card__data"
>

View file

@ -1603,17 +1603,23 @@ const emptyCreateDialog = ref(false);
<div
class="col-12 q-py-sm row"
v-for="key in fieldSelected
.filter((v) => {
return columnsCustomer.some(
(c) => c.name === v,
);
})
.filter((v) => {
return (
v !== 'orderNumber' &&
v !== 'titleName' &&
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"