fix: ตัวแปร ค้นหาขั้นสูง เก็บใน store
This commit is contained in:
parent
3a7cfad344
commit
9dcb54a384
8 changed files with 330 additions and 384 deletions
|
|
@ -7,7 +7,7 @@ import http from "@/plugins/http";
|
|||
import config from "@/app.config";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useDisciplineResultStore } from "@/modules/11_discipline/store/ResultStore";
|
||||
|
||||
import { useDisciplineMainStore } from "@/modules/11_discipline/store/Main";
|
||||
import type { Pagination } from "@/modules/03_recruiting/interface/index/Main";
|
||||
|
||||
import Table from "@/modules/11_discipline/components/4_Result/Table.vue";
|
||||
|
|
@ -15,9 +15,10 @@ import Table from "@/modules/11_discipline/components/4_Result/Table.vue";
|
|||
const $q = useQuasar(); // show dialog
|
||||
const router = useRouter();
|
||||
const mixin = useCounterMixin();
|
||||
const store = useDisciplineResultStore();
|
||||
const { showLoader, hideLoader, messageError } = mixin;
|
||||
const { fetchList } = store;
|
||||
const storeResult = useDisciplineResultStore();
|
||||
const store = useDisciplineMainStore();
|
||||
const { showLoader, hideLoader, messageError, convertDateToAPI } = mixin;
|
||||
const { fetchList } = storeResult;
|
||||
|
||||
const filter = ref<string>("");
|
||||
const status = ref<string>("DONE");
|
||||
|
|
@ -31,38 +32,46 @@ const pagination = ref({
|
|||
});
|
||||
|
||||
/** function เรียกรายการสรุปผลการพิจารณาทางวินัย*/
|
||||
async function fetchListResult(data?: any) {
|
||||
async function fetchListResult(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.resultDisciplineType
|
||||
? { resultDisciplineType: data.resultDisciplineType }
|
||||
: {}),
|
||||
...(data && data.resultTitleType
|
||||
? { resultTitleType: data.resultTitleType }
|
||||
: {}),
|
||||
...(data && data.resultOc ? { resultOc: data.resultOc } : {}),
|
||||
...(data && data.resultYear ? { resultYear: data.resultYear } : {}),
|
||||
...(store.formResult.respondentType && {
|
||||
respondentType: store.formResult.respondentType,
|
||||
}),
|
||||
...(store.formResult.offenseDetails && {
|
||||
offenseDetails: store.formResult.offenseDetails,
|
||||
}),
|
||||
...(store.formResult.disciplinaryFaultLevel && {
|
||||
disciplinaryFaultLevel: store.formResult.disciplinaryFaultLevel,
|
||||
}),
|
||||
...(store.formResult.disciplinaryCaseFault && {
|
||||
disciplinaryCaseFault: store.formResult.disciplinaryCaseFault.trim(),
|
||||
}),
|
||||
...(store.formResult.disciplinaryDate?.[0] && {
|
||||
disciplinaryDateStart: convertDateToAPI(
|
||||
store.formResult.disciplinaryDate[0]
|
||||
),
|
||||
}),
|
||||
...(store.formResult.disciplinaryDate?.[1] && {
|
||||
disciplinaryDateEnd: convertDateToAPI(
|
||||
store.formResult.disciplinaryDate[1]
|
||||
),
|
||||
}),
|
||||
...(store.formResult.resultDisciplineType && {
|
||||
resultDisciplineType: store.formResult.resultDisciplineType.trim(),
|
||||
}),
|
||||
...(store.formResult.resultTitleType && {
|
||||
resultTitleType: store.formResult.resultTitleType.trim(),
|
||||
}),
|
||||
...(store.formResult.resultOc && {
|
||||
resultOc: store.formResult.resultOc.trim(),
|
||||
}),
|
||||
...(store.formResult.resultYear && {
|
||||
resultYear: store.formResult.resultYear,
|
||||
}),
|
||||
};
|
||||
showLoader();
|
||||
await http
|
||||
|
|
@ -103,9 +112,9 @@ function filterStatus(statusReturn: string) {
|
|||
getSearch();
|
||||
}
|
||||
|
||||
function getSearch(data?: any) {
|
||||
function getSearch(page?: number) {
|
||||
pagination.value.page = 1;
|
||||
fetchListResult(data);
|
||||
fetchListResult(page);
|
||||
}
|
||||
|
||||
watch(
|
||||
|
|
@ -131,11 +140,11 @@ onMounted(async () => {
|
|||
<div>
|
||||
<Table
|
||||
style="max-height: 80vh"
|
||||
:rows="store.rows"
|
||||
:columns="store.columns"
|
||||
:visible-columns="store.visibleColumns"
|
||||
:rows="storeResult.rows"
|
||||
:columns="storeResult.columns"
|
||||
:visible-columns="storeResult.visibleColumns"
|
||||
v-model:inputfilter="filter"
|
||||
v-model:inputvisible="store.visibleColumns"
|
||||
v-model:inputvisible="storeResult.visibleColumns"
|
||||
:nornmalData="true"
|
||||
:paging="true"
|
||||
:titleText="''"
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ function updatePagination(newPagination: any) {
|
|||
</q-select>
|
||||
|
||||
<q-space />
|
||||
<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