Merge branch 'nice' into develop

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-01-31 11:30:29 +07:00
commit 09d00df7e9
3 changed files with 143 additions and 12 deletions

View file

@ -13,6 +13,7 @@ interface FormFilter {
isAll?: boolean; isAll?: boolean;
nodeId?: string | null; nodeId?: string | null;
node?: string | null | number; node?: string | null | number;
retireType?: null | string;
} }
interface FormAddPerson { interface FormAddPerson {
@ -54,6 +55,7 @@ interface QueryParams {
node?: number | string | null | undefined; node?: number | string | null | undefined;
nodeId?: string; nodeId?: string;
isAll?: boolean; isAll?: boolean;
retireType?: string | null;
} }
interface FormChangeName { interface FormChangeName {
@ -81,9 +83,9 @@ interface FormDataIDP {
createdAt?: Date | null; createdAt?: Date | null;
} }
interface RangeAge{ interface RangeAge {
min:number min: number;
max:number max: number;
} }
export type { export type {
FormFilter, FormFilter,
@ -93,5 +95,5 @@ export type {
QueryParams, QueryParams,
FormChangeName, FormChangeName,
FormDataIDP, FormDataIDP,
RangeAge RangeAge,
}; };

View file

@ -71,6 +71,7 @@ export const useRegistryNewDataStore = defineStore("registryNew", () => {
nodeId: null, nodeId: null,
node: null, node: null,
searchType: "fullName", searchType: "fullName",
retireType: null,
}); });
const labelOption = reactive({ const labelOption = reactive({
@ -79,6 +80,7 @@ export const useRegistryNewDataStore = defineStore("registryNew", () => {
posLevel: "ทั้งหมด", posLevel: "ทั้งหมด",
retireYear: "", retireYear: "",
node: "เลือกหน่วยงาน", node: "เลือกหน่วยงาน",
retireType: "ทั้งหมด",
}); });
function convertTypeRetired(val: string) { function convertTypeRetired(val: string) {
@ -103,12 +105,30 @@ export const useRegistryNewDataStore = defineStore("registryNew", () => {
case "PLACEMENT_TRANSFER": case "PLACEMENT_TRANSFER":
return "โอนออก "; return "โอนออก ";
case "RETIRE_RESIGN_EMP": case "RETIRE_RESIGN_EMP":
return "ให้ออกจากราชการ(ลูกจ้าง) "; return "ให้ออกจากราชการ(ลูกจ้าง)";
default: default:
return ""; return "";
} }
} }
const retireTypeOps = ref<DataOption[]>([
{ id: "RETIRE", name: "เกษียณ" },
{ id: "RETIRE_RESIGN", name: "ลาออก" },
{ id: "RETIRE_DECEASED", name: "ถึงแก่กรรม" },
{ id: "RETIRE_OUT", name: "ให้ออกจากราชการ" },
{ id: "DISCIPLINE_RESULT_REMOVE", name: "ปลดออกจากราชการ" },
{ id: "DISCIPLINE_RESULT_DISMISS", name: "ไล่ออกจากราชการ" },
{ id: "DISCIPLINE_SUSPEND", name: "ถูกพักจากราชการ" },
{ id: "PROBATION_REPORT", name: "ไม่ผ่านทดลองงาน" },
]);
const retireTypeEmpOps = ref<DataOption[]>([
{ id: "RETIRE", name: "เกษียณ" },
{ id: "RETIRE_RESIGN", name: "ลาออก" },
{ id: "RETIRE_DECEASED", name: "ถึงแก่กรรม" },
{ id: "RETIRE_RESIGN_EMP", name: "ให้ออกจากราชการ" },
]);
return { return {
fetchType, fetchType,
fetchLevel, fetchLevel,
@ -125,5 +145,7 @@ export const useRegistryNewDataStore = defineStore("registryNew", () => {
tabs, tabs,
tabsManu, tabsManu,
convertTypeRetired, convertTypeRetired,
retireTypeOps,
retireTypeEmpOps,
}; };
}); });

View file

@ -108,6 +108,9 @@ async function fetchDataPerson() {
if (store.formFilter.isShowRetire != null) { if (store.formFilter.isShowRetire != null) {
queryParams.isRetire = store.formFilter.isShowRetire; queryParams.isRetire = store.formFilter.isShowRetire;
queryParams.retireType = queryParams.isRetire
? store.formFilter.retireType
: undefined;
} }
if (empType.value !== "officer") { if (empType.value !== "officer") {
@ -187,9 +190,7 @@ async function insertAvatar(items: DataPerson[]) {
); );
} }
/** /** funciotn ค้นหาข้อมูล */
* funciotn นหาขอม
*/
function onclickSearch() { function onclickSearch() {
store.formFilter.page = 1; store.formFilter.page = 1;
store.formFilter.keyword = store.formFilter.keyword =
@ -203,15 +204,16 @@ function onclickSearch() {
*/ */
function selectType() { function selectType() {
empType.value = route.name == "registryNew" ? "officer" : "perm"; empType.value = route.name == "registryNew" ? "officer" : "perm";
store.formFilter.isShowRetire = false;
store.labelOption.retireType = "ทั้งหมด";
store.formFilter.retireType = null;
store.formFilter.keyword = "";
if (empType.value !== "officer") { if (empType.value !== "officer") {
store.formFilter.isShowRetire = null;
store.formFilter.isProbation = null; store.formFilter.isProbation = null;
store.formFilter.keyword = "";
fetchOptionGroup(); fetchOptionGroup();
} else { } else {
store.formFilter.isShowRetire = false;
store.formFilter.isProbation = false; store.formFilter.isProbation = false;
store.formFilter.keyword = "";
fetchType(); fetchType();
} }
@ -267,6 +269,17 @@ function selectPosLevel(item: DataOption) {
fetchDataPerson(); fetchDataPerson();
} }
/**
* function เลอกประเภทตำแหน
* @param item ประเภทระด
*/
function selectRetireType(item: DataOption) {
store.labelOption.retireType = item.name;
store.formFilter.page = 1;
store.formFilter.retireType = item.id;
fetchDataPerson();
}
/** /**
* function เคลวเลอก * function เคลวเลอก
* @param t ประเภทตวเลอก * @param t ประเภทตวเลอก
@ -291,6 +304,9 @@ function clearSelect(t: string) {
empType.value === "officer" empType.value === "officer"
? "เลือกหน่วยงาน/ส่วนราชการ" ? "เลือกหน่วยงาน/ส่วนราชการ"
: "เลือกหน่วยงาน"; : "เลือกหน่วยงาน";
} else if (t === "retireType") {
store.labelOption.retireType = "ทั้งหมด";
store.formFilter.retireType = null;
} }
store.formFilter.page = 1; store.formFilter.page = 1;
fetchDataPerson(); fetchDataPerson();
@ -554,6 +570,57 @@ onMounted(async () => {
@update:model-value="getSearch" @update:model-value="getSearch"
/> />
</div> </div>
<div
class="row q-gutter-sm justify-center"
v-if="empType !== 'officer'"
>
<q-toggle
v-model="store.formFilter.isShowRetire"
color="primary"
label="แสดงข้อมูลผู้พ้นจากราชการ"
@update:model-value="getSearch"
/>
<q-btn-dropdown
v-if="store.formFilter.isShowRetire"
rounded
flat
dense
label-color="white"
dropdown-icon="mdi-chevron-down"
class="q-px-sm"
>
<template v-slot:label>
{{
store.labelOption.retireType !== "ทั้งหมด"
? store.labelOption.retireType
: `ประเภท${store.labelOption.retireType}`
}}
<q-btn
v-if="store.labelOption.retireType !== 'ทั้งหมด'"
size="10px"
flat
round
color="white"
icon="close"
@click.stop.prevent="clearSelect('retireType')"
/>
</template>
<q-list>
<q-item
v-for="(item, index) in store.retireTypeEmpOps"
:key="index"
clickable
v-close-popup
@click="selectRetireType(item)"
>
<q-item-section>
<q-item-label>{{ item.name }}</q-item-label>
</q-item-section>
</q-item>
</q-list>
</q-btn-dropdown>
</div>
<div <div
v-if="empType === 'officer'" v-if="empType === 'officer'"
@ -578,6 +645,46 @@ onMounted(async () => {
label="แสดงตำแหน่งทั้งหมด" label="แสดงตำแหน่งทั้งหมด"
@update:model-value="getSearch" @update:model-value="getSearch"
/> />
<q-btn-dropdown
v-if="store.formFilter.isShowRetire"
rounded
flat
dense
label-color="white"
dropdown-icon="mdi-chevron-down"
class="q-px-sm"
>
<template v-slot:label>
{{
store.labelOption.retireType !== "ทั้งหมด"
? store.labelOption.retireType
: `ประเภทการพ้นจากราชการ${store.labelOption.retireType}`
}}
<q-btn
v-if="store.labelOption.retireType !== 'ทั้งหมด'"
size="10px"
flat
round
color="white"
icon="close"
@click.stop.prevent="clearSelect('retireType')"
/>
</template>
<q-list>
<q-item
v-for="(item, index) in store.retireTypeOps"
:key="index"
clickable
v-close-popup
@click="selectRetireType(item)"
>
<q-item-section>
<q-item-label>{{ item.name }}</q-item-label>
</q-item-section>
</q-item>
</q-list>
</q-btn-dropdown>
</div> </div>
</div> </div>
</div> </div>