fix: ตัวแปร ค้นหาขั้นสูง เก็บใน store
This commit is contained in:
parent
3a7cfad344
commit
9dcb54a384
8 changed files with 330 additions and 384 deletions
|
|
@ -5,6 +5,8 @@ import { useQuasar } from "quasar";
|
|||
import { useRouter } from "vue-router";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useInvestigateDisStore } from "@/modules/11_discipline/store/InvestigateDisStore";
|
||||
import { useDisciplineMainStore } from "@/modules/11_discipline/store/Main";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
|
|
@ -22,43 +24,54 @@ const pagination = ref({
|
|||
const $q = useQuasar(); //ใช้ noti quasar
|
||||
const router = useRouter();
|
||||
const mixin = useCounterMixin();
|
||||
const store = useDisciplineMainStore();
|
||||
const dataInvestigateDis = useInvestigateDisStore();
|
||||
const { showLoader, hideLoader, messageError } = mixin;
|
||||
const { showLoader, hideLoader, messageError, convertDateToAPI } = mixin;
|
||||
const { fetchList } = dataInvestigateDis;
|
||||
|
||||
const filter = ref<string>(""); //search data table
|
||||
|
||||
const status = ref<string>("NEW");
|
||||
async function fetchListDisciplinary(data?: any) {
|
||||
async function fetchListDisciplinary(page?: number) {
|
||||
const body = {
|
||||
page: pagination.value.page,
|
||||
page: page ? page : pagination.value.page,
|
||||
pageSize: pagination.value.rowsPerPage,
|
||||
keyword: filter.value.trim(),
|
||||
status: status.value,
|
||||
...(data && data.respondentType
|
||||
? { respondentType: data.respondentType }
|
||||
: {}),
|
||||
...(data && data.offenseDetails
|
||||
? { offenseDetails: data.offenseDetails }
|
||||
: {}),
|
||||
...(data && data.disciplinaryFaultLevel
|
||||
? { disciplinaryFaultLevel: data.disciplinaryFaultLevel }
|
||||
: {}),
|
||||
...(data && data.disciplinaryCaseFault
|
||||
? { disciplinaryCaseFault: data.disciplinaryCaseFault }
|
||||
: {}),
|
||||
...(data && data.disciplinaryDateStart
|
||||
? { disciplinaryDateStart: data.disciplinaryDateStart }
|
||||
: {}),
|
||||
...(data && data.disciplinaryDateEnd
|
||||
? { disciplinaryDateEnd: data.disciplinaryDateEnd }
|
||||
: {}),
|
||||
...(data && data.dateReceivedStart
|
||||
? { dateReceivedStart: data.dateReceivedStart }
|
||||
: {}),
|
||||
...(data && data.dateReceivedEnd
|
||||
? { dateReceivedEnd: data.dateReceivedEnd }
|
||||
: {}),
|
||||
...(store.formInvestigateDisciplinary.respondentType && {
|
||||
respondentType: store.formInvestigateDisciplinary.respondentType,
|
||||
}),
|
||||
...(store.formInvestigateDisciplinary.offenseDetails && {
|
||||
offenseDetails: store.formInvestigateDisciplinary.offenseDetails,
|
||||
}),
|
||||
...(store.formInvestigateDisciplinary.disciplinaryFaultLevel && {
|
||||
disciplinaryFaultLevel:
|
||||
store.formInvestigateDisciplinary.disciplinaryFaultLevel,
|
||||
}),
|
||||
...(store.formInvestigateDisciplinary.disciplinaryCaseFault && {
|
||||
disciplinaryCaseFault:
|
||||
store.formInvestigateDisciplinary.disciplinaryCaseFault.trim(),
|
||||
}),
|
||||
...(store.formInvestigateDisciplinary.disciplinaryDate?.[0] && {
|
||||
disciplinaryDateStart: convertDateToAPI(
|
||||
store.formInvestigateDisciplinary.disciplinaryDate[0]
|
||||
),
|
||||
}),
|
||||
...(store.formInvestigateDisciplinary.disciplinaryDate?.[1] && {
|
||||
disciplinaryDateEnd: convertDateToAPI(
|
||||
store.formInvestigateDisciplinary.disciplinaryDate[1]
|
||||
),
|
||||
}),
|
||||
...(store.formInvestigateDisciplinary.dateReceived?.[0] && {
|
||||
dateReceivedStart: convertDateToAPI(
|
||||
store.formInvestigateDisciplinary.dateReceived[0]
|
||||
),
|
||||
}),
|
||||
...(store.formInvestigateDisciplinary.dateReceived?.[1] && {
|
||||
dateReceivedEnd: convertDateToAPI(
|
||||
store.formInvestigateDisciplinary.dateReceived[1]
|
||||
),
|
||||
}),
|
||||
};
|
||||
showLoader();
|
||||
await http
|
||||
|
|
@ -99,9 +112,9 @@ function filterStatus(statusReturn: string) {
|
|||
getSearch();
|
||||
}
|
||||
|
||||
function getSearch(data?:any) {
|
||||
function getSearch(page?: number) {
|
||||
pagination.value.page = 1;
|
||||
fetchListDisciplinary(data);
|
||||
fetchListDisciplinary(page);
|
||||
}
|
||||
|
||||
watch(
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ function updatePagination(newPagination: any) {
|
|||
|
||||
<q-space />
|
||||
<!-- ค้นหาข้อความใน table -->
|
||||
<DialogSearchAdvanced :get-data="(value:any)=> props.getSearch?.(value)" />
|
||||
<DialogSearchAdvanced :get-data="(value:number)=> props.getSearch?.(value)" />
|
||||
<q-input
|
||||
standout
|
||||
dense
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue