refactor: กด เข้าสินค้าเเล้ว ให้ แสดงนำนวนหาย ที่ต้องการ

This commit is contained in:
Net 2024-07-11 11:44:17 +07:00
parent 2dac800fad
commit 16584f6d9c

View file

@ -101,18 +101,36 @@ const stat = ref<
icon: string; icon: string;
count: number; count: number;
label: string; label: string;
mode: 'group' | 'type' | 'service' | 'product';
color: 'pink' | 'purple' | 'green' | 'orange'; color: 'pink' | 'purple' | 'green' | 'orange';
}[] }[]
>([ >([
{ icon: 'mdi-folder', count: 0, label: 'productAndService', color: 'pink' }, {
icon: 'mdi-folder',
count: 0, label: 'productAndService',
mode: 'group',
color: 'pink'
},
{ {
icon: 'mdi-folder-table', icon: 'mdi-folder-table',
count: 0, count: 0,
label: 'productAndServiceType', label: 'productAndServiceType',
mode: 'type',
color: 'purple', color: 'purple',
}, },
{ icon: 'mdi-server-network', count: 0, label: 'service', color: 'orange' }, {
{ icon: 'mdi-folder', count: 0, label: 'product', color: 'green' }, icon: 'mdi-server-network',
count: 0, label: 'service',
mode: 'service',
color: 'orange'
},
{
icon: 'mdi-folder',
count: 0, label: 'product',
mode: 'product',
color: 'green'
},
]); ]);
const { t } = useI18n(); const { t } = useI18n();
@ -330,6 +348,8 @@ const totalProduct = ref<number>(0);
const totalService = ref<number>(0); const totalService = ref<number>(0);
const totalProductAndService = ref<number>(0); const totalProductAndService = ref<number>(0);
const filterStat = ref<('group' | 'type' | 'service' | 'product')[]>([]);
// //
const currentPageGroup = ref<number>(1); const currentPageGroup = ref<number>(1);
const maxPageGroup = ref<number>(1); const maxPageGroup = ref<number>(1);
@ -1134,6 +1154,9 @@ onMounted(async () => {
text: 'manage', text: 'manage',
handler: () => { handler: () => {
productMode.value = 'group'; productMode.value = 'group';
}, },
}, },
]; ];
@ -1152,6 +1175,7 @@ watch(productMode, () => {
text: 'manage', text: 'manage',
handler: () => { handler: () => {
productMode.value = 'group'; productMode.value = 'group';
filterStat.value = []
}, },
}, },
]; ];
@ -1162,6 +1186,9 @@ watch(productMode, () => {
argsi18n: { name: pathGroupName.value }, argsi18n: { name: pathGroupName.value },
handler: () => { handler: () => {
productMode.value = 'type'; productMode.value = 'type';
filterStat.value = filterStat.value.filter((item) => {
return item !== 'type';
})
}, },
}); });
} }
@ -1311,7 +1338,7 @@ watch(inputSearchProductAndService, async () => {
<div style="display: inline-block"> <div style="display: inline-block">
<StatCard <StatCard
label-i18n label-i18n
:branch="stat" :branch="stat.filter((v) => !filterStat.includes(v.mode) )"
:dark="$q.dark.isActive" :dark="$q.dark.isActive"
nowrap nowrap
/> />
@ -1514,6 +1541,7 @@ watch(inputSearchProductAndService, async () => {
:props="props" :props="props"
@click=" @click="
async () => { async () => {
filterStat.push(productMode);
if (productMode === 'type') { if (productMode === 'type') {
pathTypeName = props.row.name; pathTypeName = props.row.name;
currentIdType = props.row.id; currentIdType = props.row.id;
@ -1532,6 +1560,8 @@ watch(inputSearchProductAndService, async () => {
await fetchListType(); await fetchListType();
flowStore.rotate(); flowStore.rotate();
} }
} }
" "
> >
@ -1882,6 +1912,7 @@ watch(inputSearchProductAndService, async () => {
" "
@on-click=" @on-click="
async () => { async () => {
filterStat.push(productMode);
if (productMode === 'type') { if (productMode === 'type') {
pathTypeName = props.row.name; pathTypeName = props.row.name;
currentIdType = props.row.id; currentIdType = props.row.id;