feat: search user

This commit is contained in:
Methapon2001 2024-04-19 11:45:51 +07:00
parent 9b35e63dbd
commit 518a6b71f8

View file

@ -251,6 +251,7 @@ async function onSubmit() {
userStore.fetchList({ userStore.fetchList({
includeBranch: true, includeBranch: true,
query: !!inputSearch.value ? inputSearch.value : undefined,
userType: selectorLabel.value ?? undefined, userType: selectorLabel.value ?? undefined,
}); });
typeStats.value = await userStore.typeStats(); typeStats.value = await userStore.typeStats();
@ -281,6 +282,7 @@ async function onSubmit() {
selectorLabel.value = formData.value.userType; selectorLabel.value = formData.value.userType;
userStore.fetchList({ userStore.fetchList({
includeBranch: true, includeBranch: true,
query: !!inputSearch.value ? inputSearch.value : undefined,
userType: selectorLabel.value ?? undefined, userType: selectorLabel.value ?? undefined,
}); });
typeStats.value = await userStore.typeStats(); typeStats.value = await userStore.typeStats();
@ -302,6 +304,7 @@ async function onDelete(id: string) {
await userStore.deleteById(id); await userStore.deleteById(id);
await userStore.fetchList({ await userStore.fetchList({
includeBranch: true, includeBranch: true,
query: !!inputSearch.value ? inputSearch.value : undefined,
userType: selectorLabel.value ?? undefined, userType: selectorLabel.value ?? undefined,
}); });
typeStats.value = await userStore.typeStats(); typeStats.value = await userStore.typeStats();
@ -402,6 +405,7 @@ async function assignFormData(idEdit: string) {
onMounted(async () => { onMounted(async () => {
await userStore.fetchList({ await userStore.fetchList({
includeBranch: true, includeBranch: true,
query: !!inputSearch.value ? inputSearch.value : undefined,
userType: selectorLabel.value ?? undefined, userType: selectorLabel.value ?? undefined,
}); });
userStore.userOption.roleOpts.length === 0 userStore.userOption.roleOpts.length === 0
@ -427,6 +431,7 @@ watch(
mapUserType(label); mapUserType(label);
await userStore.fetchList({ await userStore.fetchList({
includeBranch: true, includeBranch: true,
query: !!inputSearch.value ? inputSearch.value : undefined,
userType: selectorLabel.value ?? undefined, userType: selectorLabel.value ?? undefined,
}); });
const res = await branchStore.userStats(label); const res = await branchStore.userStats(label);
@ -435,6 +440,13 @@ watch(
} }
}, },
); );
watch(inputSearch, async () => {
await userStore.fetchList({
pageSize: 9999,
query: !!inputSearch.value ? inputSearch.value : undefined,
});
});
</script> </script>
<template> <template>
@ -531,6 +543,7 @@ watch(
outlined outlined
dense dense
label="ค้นหา" label="ค้นหา"
debounce="500"
v-model="inputSearch" v-model="inputSearch"
></q-input> ></q-input>
</div> </div>