ปรับ filter ทะเบียนประวัติใหม่
This commit is contained in:
parent
27a0297c92
commit
52544f7363
3 changed files with 52 additions and 32 deletions
|
|
@ -7,8 +7,8 @@ interface FormFilter {
|
||||||
posLevel: string;
|
posLevel: string;
|
||||||
retireYear: string | null;
|
retireYear: string | null;
|
||||||
rangeYear: { min: number; max: number };
|
rangeYear: { min: number; max: number };
|
||||||
isShowRetire: boolean;
|
isShowRetire: boolean | null;
|
||||||
isProbation: boolean;
|
isProbation: boolean | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface FormAddPerson {
|
interface FormAddPerson {
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ export const useRegistryNewDataStore = defineStore("registryNew", () => {
|
||||||
const searchTypeOption = ref<DataOption[]>([
|
const searchTypeOption = ref<DataOption[]>([
|
||||||
{ id: "fullName", name: "ชื่อ-นามสกุล" },
|
{ id: "fullName", name: "ชื่อ-นามสกุล" },
|
||||||
{ id: "citizenId", name: "เลขประจำตัวประชาชน" },
|
{ id: "citizenId", name: "เลขประจำตัวประชาชน" },
|
||||||
{ id: "posNo", name: "ตำแหน่งเลขที่" },
|
// { id: "posNo", name: "ตำแหน่งเลขที่" },
|
||||||
{ id: "position", name: "ตำแหน่งสายงาน" },
|
{ id: "position", name: "ตำแหน่งสายงาน" },
|
||||||
]);
|
]);
|
||||||
const employeeClassOps = ref<DataOption[]>([
|
const employeeClassOps = ref<DataOption[]>([
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, computed, onMounted } from "vue";
|
import { ref, reactive, computed, onMounted, watch } from "vue";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
|
|
@ -25,9 +25,9 @@ const mode = ref<"table" | "card">("table");
|
||||||
|
|
||||||
const isShowFilter = ref<boolean>(false);
|
const isShowFilter = ref<boolean>(false);
|
||||||
const isShowBtnFilter = ref<boolean>(true);
|
const isShowBtnFilter = ref<boolean>(true);
|
||||||
|
const empType = ref<string>("officer"); // ประเภท ขรก./ลูกจ้างประจำ/ลูกจ้างชั่วคราว
|
||||||
const labelOption = reactive({
|
const labelOption = reactive({
|
||||||
type: "ประเภททั้งหมด",
|
type: "ข้าราชการ กทม.สามัญ",
|
||||||
posType: "ทั้งหมด",
|
posType: "ทั้งหมด",
|
||||||
posLevel: "ทั้งหมด",
|
posLevel: "ทั้งหมด",
|
||||||
retireYear: "",
|
retireYear: "",
|
||||||
|
|
@ -43,8 +43,8 @@ const formFilter = reactive<FormFilter>({
|
||||||
posLevel: "",
|
posLevel: "",
|
||||||
retireYear: "",
|
retireYear: "",
|
||||||
rangeYear: { min: 0, max: 60 },
|
rangeYear: { min: 0, max: 60 },
|
||||||
isShowRetire: false,
|
isShowRetire: null,
|
||||||
isProbation: false,
|
isProbation: null,
|
||||||
});
|
});
|
||||||
const maxPage = ref<number>(1);
|
const maxPage = ref<number>(1);
|
||||||
|
|
||||||
|
|
@ -112,7 +112,7 @@ function fetchYearOption() {
|
||||||
async function fetchDataPerson(search: boolean = false) {
|
async function fetchDataPerson(search: boolean = false) {
|
||||||
showLoader();
|
showLoader();
|
||||||
|
|
||||||
let queryParams:any = {
|
let queryParams: any = {
|
||||||
page: formFilter.page,
|
page: formFilter.page,
|
||||||
pageSize: formFilter.pageSize,
|
pageSize: formFilter.pageSize,
|
||||||
};
|
};
|
||||||
|
|
@ -121,17 +121,30 @@ async function fetchDataPerson(search: boolean = false) {
|
||||||
queryParams = Object.assign({}, queryParams, {
|
queryParams = Object.assign({}, queryParams, {
|
||||||
searchField: searchType.value,
|
searchField: searchType.value,
|
||||||
searchKeyword: formFilter.keyword,
|
searchKeyword: formFilter.keyword,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (labelOption.posLevel != "ทั้งหมด") {
|
||||||
|
queryParams = Object.assign({}, queryParams, {
|
||||||
posLevel: labelOption.posLevel,
|
posLevel: labelOption.posLevel,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (labelOption.posType != "ทั้งหมด") {
|
||||||
|
queryParams = Object.assign({}, queryParams, {
|
||||||
posType: labelOption.posType,
|
posType: labelOption.posType,
|
||||||
});
|
});
|
||||||
if (formFilter.isProbation) {
|
|
||||||
queryParams.isProbation = formFilter.isProbation;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (formFilter.isShowRetire) {
|
|
||||||
queryParams.isRetire = formFilter.isShowRetire;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (formFilter.isProbation != null) {
|
||||||
|
queryParams.isProbation = formFilter.isProbation;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (formFilter.isShowRetire != null) {
|
||||||
|
queryParams.isRetire = formFilter.isShowRetire;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check type person empType.value
|
||||||
http
|
http
|
||||||
.get(config.API.registryNew, { params: queryParams })
|
.get(config.API.registryNew, { params: queryParams })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
|
@ -142,9 +155,9 @@ async function fetchDataPerson(search: boolean = false) {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
setTimeout(() => {
|
// setTimeout(() => {
|
||||||
hideLoader();
|
hideLoader();
|
||||||
}, 500);
|
// }, 500);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -172,14 +185,18 @@ function onclickSearch() {
|
||||||
|
|
||||||
function selectType(item: DataOption) {
|
function selectType(item: DataOption) {
|
||||||
labelOption.type = item.name;
|
labelOption.type = item.name;
|
||||||
|
empType.value = item.id;
|
||||||
|
fetchDataPerson();
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectPosType(item: DataOption) {
|
function selectPosType(item: DataOption) {
|
||||||
labelOption.posType = item.name;
|
labelOption.posType = item.name;
|
||||||
|
fetchDataPerson();
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectPosLevel(item: DataOption) {
|
function selectPosLevel(item: DataOption) {
|
||||||
labelOption.posLevel = item.name;
|
labelOption.posLevel = item.name;
|
||||||
|
fetchDataPerson();
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectRetireYear(item: DataOption) {
|
function selectRetireYear(item: DataOption) {
|
||||||
|
|
@ -187,9 +204,7 @@ function selectRetireYear(item: DataOption) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearSelect(t: string) {
|
function clearSelect(t: string) {
|
||||||
if (t === "type") {
|
if (t === "posType") {
|
||||||
labelOption.type = "ประเภททั้งหมด";
|
|
||||||
} else if (t === "posType") {
|
|
||||||
labelOption.posType = "ทั้งหมด";
|
labelOption.posType = "ทั้งหมด";
|
||||||
} else if (t === "posLevel") {
|
} else if (t === "posLevel") {
|
||||||
labelOption.posLevel = "ทั้งหมด";
|
labelOption.posLevel = "ทั้งหมด";
|
||||||
|
|
@ -199,6 +214,8 @@ function clearSelect(t: string) {
|
||||||
formFilter.rangeYear.min = 0;
|
formFilter.rangeYear.min = 0;
|
||||||
formFilter.rangeYear.max = 60;
|
formFilter.rangeYear.max = 60;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fetchDataPerson();
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
|
@ -248,6 +265,7 @@ onMounted(async () => {
|
||||||
clearable
|
clearable
|
||||||
placeholder="ค้นหา"
|
placeholder="ค้นหา"
|
||||||
class="col-9 q-pr-md"
|
class="col-9 q-pr-md"
|
||||||
|
@clear="fetchDataPerson"
|
||||||
>
|
>
|
||||||
<template v-slot:before>
|
<template v-slot:before>
|
||||||
<q-icon name="search" color="deep-orange" />
|
<q-icon name="search" color="deep-orange" />
|
||||||
|
|
@ -292,7 +310,7 @@ onMounted(async () => {
|
||||||
<template v-slot:label>
|
<template v-slot:label>
|
||||||
{{ `${labelOption.type}` }}
|
{{ `${labelOption.type}` }}
|
||||||
|
|
||||||
<q-btn
|
<!-- <q-btn
|
||||||
size="10px"
|
size="10px"
|
||||||
flat
|
flat
|
||||||
round
|
round
|
||||||
|
|
@ -300,7 +318,7 @@ onMounted(async () => {
|
||||||
icon="close"
|
icon="close"
|
||||||
v-if="labelOption.type !== 'ประเภททั้งหมด'"
|
v-if="labelOption.type !== 'ประเภททั้งหมด'"
|
||||||
@click.stop.prevent="clearSelect('type')"
|
@click.stop.prevent="clearSelect('type')"
|
||||||
/>
|
/> -->
|
||||||
</template>
|
</template>
|
||||||
<q-list>
|
<q-list>
|
||||||
<q-item
|
<q-item
|
||||||
|
|
@ -401,14 +419,14 @@ onMounted(async () => {
|
||||||
|
|
||||||
<q-separator inset vertical class="lineFil" />
|
<q-separator inset vertical class="lineFil" />
|
||||||
|
|
||||||
<q-btn-dropdown
|
<!-- <q-btn-dropdown
|
||||||
flat
|
flat
|
||||||
dense
|
dense
|
||||||
rounded
|
rounded
|
||||||
label-color="white"
|
label-color="white"
|
||||||
dropdown-icon="mdi-chevron-down"
|
dropdown-icon="mdi-chevron-down"
|
||||||
class="q-px-sm"
|
class="q-px-sm"
|
||||||
><!-- class="custom-btn" -->
|
>
|
||||||
<template v-slot:label>
|
<template v-slot:label>
|
||||||
{{ `ปีเกษียณ${labelOption.retireYear}` }}
|
{{ `ปีเกษียณ${labelOption.retireYear}` }}
|
||||||
<q-btn
|
<q-btn
|
||||||
|
|
@ -434,9 +452,9 @@ onMounted(async () => {
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
</q-list>
|
</q-list>
|
||||||
</q-btn-dropdown>
|
</q-btn-dropdown> -->
|
||||||
|
|
||||||
<q-separator inset vertical class="lineFil" />
|
<!-- <q-separator inset vertical class="lineFil" /> -->
|
||||||
|
|
||||||
<!-- <datepicker
|
<!-- <datepicker
|
||||||
menu-class-name="modalfix"
|
menu-class-name="modalfix"
|
||||||
|
|
@ -483,14 +501,14 @@ onMounted(async () => {
|
||||||
</template>
|
</template>
|
||||||
</datepicker> -->
|
</datepicker> -->
|
||||||
|
|
||||||
<q-btn-dropdown
|
<!-- <q-btn-dropdown
|
||||||
flat
|
flat
|
||||||
dense
|
dense
|
||||||
rounded
|
rounded
|
||||||
label-color="white"
|
label-color="white"
|
||||||
dropdown-icon="mdi-chevron-down"
|
dropdown-icon="mdi-chevron-down"
|
||||||
class="q-px-sm"
|
class="q-px-sm"
|
||||||
><!-- class="custom-btn" -->
|
>
|
||||||
<template v-slot:label>
|
<template v-slot:label>
|
||||||
{{
|
{{
|
||||||
`อายุราชการ (${formFilter.rangeYear.min} - ${formFilter.rangeYear.max} ปี)`
|
`อายุราชการ (${formFilter.rangeYear.min} - ${formFilter.rangeYear.max} ปี)`
|
||||||
|
|
@ -534,9 +552,9 @@ onMounted(async () => {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</q-btn-dropdown>
|
</q-btn-dropdown> -->
|
||||||
|
|
||||||
<q-separator inset vertical class="lineFil" />
|
<!-- <q-separator inset vertical class="lineFil" /> -->
|
||||||
|
|
||||||
<q-btn-dropdown
|
<q-btn-dropdown
|
||||||
flat
|
flat
|
||||||
|
|
@ -554,6 +572,7 @@ onMounted(async () => {
|
||||||
v-model="formFilter.isProbation"
|
v-model="formFilter.isProbation"
|
||||||
color="primary"
|
color="primary"
|
||||||
label="ทดลองปฏิบัติหน้าที่ราชการ"
|
label="ทดลองปฏิบัติหน้าที่ราชการ"
|
||||||
|
@update:model-value="fetchDataPerson"
|
||||||
/>
|
/>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
|
|
@ -563,6 +582,7 @@ onMounted(async () => {
|
||||||
v-model="formFilter.isShowRetire"
|
v-model="formFilter.isShowRetire"
|
||||||
color="primary"
|
color="primary"
|
||||||
label="แสดงข้อมูลผู้พ้นจากราชการ"
|
label="แสดงข้อมูลผู้พ้นจากราชการ"
|
||||||
|
@update:model-value="fetchDataPerson"
|
||||||
/>
|
/>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue