feat: add disabled display field product service
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 9s

This commit is contained in:
Methapon2001 2025-02-26 16:09:44 +07:00
parent 16bcecc8d6
commit 896e1ba360

View file

@ -45,6 +45,8 @@ type ExclusiveProps = {
type: 'service' | 'product'; type: 'service' | 'product';
grid?: boolean; grid?: boolean;
disabledWorkerId?: string[]; disabledWorkerId?: string[];
disabledProductFields?: (typeof columnsProduct)[number]['name'][];
disabledServiceFields?: (typeof columnsService)[number]['name'][];
rows: Product[]; rows: Product[];
}; };
@ -76,7 +78,7 @@ const columnsProduct = [
label: 'productService.product.priceInformation', label: 'productService.product.priceInformation',
field: (v: Product) => v, field: (v: Product) => v,
}, },
] satisfies QTableColumn[]; ] as const satisfies QTableColumn[];
const columnsService = [ const columnsService = [
{ {
@ -110,7 +112,7 @@ const columnsService = [
label: 'general.createdAt', label: 'general.createdAt',
field: (v: Service) => dateFormatJS({ date: v.createdAt }), field: (v: Service) => dateFormatJS({ date: v.createdAt }),
}, },
] satisfies QTableColumn[]; ] as const satisfies QTableColumn[];
const props = defineProps<ExclusiveProps>(); const props = defineProps<ExclusiveProps>();
@ -165,7 +167,18 @@ function selectedIndex(item: any) {
:props="props" :props="props"
> >
<q-th <q-th
v-for="col in type === 'product' ? columnsProduct : columnsService" v-for="col in type === 'product'
? columnsProduct.filter((v) =>
disabledProductFields
? !disabledProductFields.includes(v.name)
: true,
)
: columnsService.filter((v) =>
disabledServiceFields
? !disabledServiceFields.includes(v.name)
: true,
)"
:auto-width="col.name === '#check'"
:key="col.name" :key="col.name"
:props="props" :props="props"
> >
@ -209,7 +222,17 @@ function selectedIndex(item: any) {
class="text-center" class="text-center"
> >
<q-td <q-td
v-for="col in type === 'product' ? columnsProduct : columnsService" v-for="col in type === 'product'
? columnsProduct.filter((v) =>
disabledProductFields
? !disabledProductFields.includes(v.name)
: true,
)
: columnsService.filter((v) =>
disabledServiceFields
? !disabledServiceFields.includes(v.name)
: true,
)"
:align="col.align" :align="col.align"
:key="col.name" :key="col.name"
> >