diff --git a/src/assets/registry-banner.png b/src/assets/registry-banner.png index c2145632d..3aa0bd34f 100644 Binary files a/src/assets/registry-banner.png and b/src/assets/registry-banner.png differ diff --git a/src/modules/04_registryNew/components/registry/DialogAddData.vue b/src/modules/04_registryNew/components/registry/DialogAddData.vue new file mode 100644 index 000000000..0bb96aba0 --- /dev/null +++ b/src/modules/04_registryNew/components/registry/DialogAddData.vue @@ -0,0 +1,312 @@ + + + + + + + + + + + + + + + + + + + + + + + + บันทึกข้อมูล + + + + + + + + diff --git a/src/modules/04_registryNew/components/registry/DialogHistory.vue b/src/modules/04_registryNew/components/registry/DialogHistory.vue new file mode 100644 index 000000000..9226044b4 --- /dev/null +++ b/src/modules/04_registryNew/components/registry/DialogHistory.vue @@ -0,0 +1,431 @@ + + + + + + + + + + + ประวัติถือครองตำแหน่ง + + + + + + + + + + + + + + + + + ไม่มีข้อมูล + + + + + + + + + + + + + + + + + + + + + {{ col.label }} + + + + + + + {{ props.rowIndex + 1 }} + {{ props.row.order }} + {{ props.row.citizenId }} + {{ props.row.name }} + + {{ props.row.posNo }} + {{ + props.row.position + }} + {{ props.row.date }} + + + + + + + + + + + + + + diff --git a/src/modules/04_registryNew/components/registry/TableView.vue b/src/modules/04_registryNew/components/registry/TableView.vue index cf1e2402b..8e2e57af5 100644 --- a/src/modules/04_registryNew/components/registry/TableView.vue +++ b/src/modules/04_registryNew/components/registry/TableView.vue @@ -1,112 +1,272 @@ - + + + เพิ่มข้อมูล + + ประวัติถือครองตำแหน่ง + + + + + + + + + + + + + > @@ -116,27 +276,44 @@ const rows = [ - - + + - - - - - - - - {{ props.row.fullName }} - {{ props.row.citizenId }} - - + + {{ + (formFilter.page - 1) * formFilter.pageSize + props.rowIndex + 1 + }} + + + + + + + + + + + + + {{ + `${props.row.prefix}${props.row.firstName} ${props.row.lastName}` + }} + + {{ props.row.citizenId }} + + + - {{ col.value }} + {{ col.value ? col.value : "-" }} @@ -152,7 +329,9 @@ const rows = [ style="width: 120px; height: 120px; border-radius: 50%" /> - {{ props.row.fullName }} + {{ + `${props.row.prefix}${props.row.firstName} ${props.row.lastName}` + }} {{ props.row.citizenId }} @@ -198,7 +377,48 @@ const rows = [ + + + + + + + + + ไม่พบข้อมูล + + + + + + + + diff --git a/src/modules/04_registryNew/interface/request/Main.ts b/src/modules/04_registryNew/interface/request/Main.ts index b5eb23bd3..e21444cb0 100644 --- a/src/modules/04_registryNew/interface/request/Main.ts +++ b/src/modules/04_registryNew/interface/request/Main.ts @@ -1,14 +1,36 @@ -interface DataSumCalendarObject { - id: number; - monthFull: String; - count: number; - color: String; +interface FormFilter { + page: number; + pageSize: number; + keyword: string; + type: string; + posType: string; + posLevel: string; + retireYear: string | null; + rangeYear: { min: number; max: number }; + isShowRetire: boolean; + isProbation: boolean; } -interface DataListsObject { - id: number; - count: number; - name: string; +interface FormAddPerson { + prefix: string; + firstName: string; + lastName: string; + citizenId: string; + position: string; + posTypeId: string; + posLevelId: string; } -export type { DataSumCalendarObject, DataListsObject }; +interface MyObjectRef { + prefix: object | null; + firstName: object | null; + lastName: object | null; + citizenId: object | null; + position: object | null; + posTypeId: object | null; + posLevelId: object | null; + + [key: string]: any; +} + +export type { FormFilter, FormAddPerson, MyObjectRef }; diff --git a/src/modules/04_registryNew/interface/response/Main.ts b/src/modules/04_registryNew/interface/response/Main.ts index 611a9ff4e..1a3c81114 100644 --- a/src/modules/04_registryNew/interface/response/Main.ts +++ b/src/modules/04_registryNew/interface/response/Main.ts @@ -12,4 +12,15 @@ interface DataLevel { posLevelRank: number; } -export type { DataType, DataLevel }; +interface DataPerson { + citizenId: string; + firstName: string; + id: string; + lastName: string; + posLevelId: string; + posTypeId: string; + position: string; + prefix: string; +} + +export type { DataType, DataLevel, DataPerson }; diff --git a/src/modules/04_registryNew/store.ts b/src/modules/04_registryNew/store.ts index 2d4e7265e..fb46bf0dc 100644 --- a/src/modules/04_registryNew/store.ts +++ b/src/modules/04_registryNew/store.ts @@ -1,4 +1,5 @@ import { defineStore } from "pinia"; +import { ref } from "vue"; import type { DataOption } from "@/modules/04_registryNew/interface/index/Main"; import type { @@ -7,22 +8,47 @@ import type { } from "@/modules/04_registryNew/interface/response/Main"; export const useRegistryNewDataStore = defineStore("registryNew", () => { + const searchTypeOption = ref([ + { id: "fullName", name: "ชื่อ-นามสกุล" }, + { id: "citizenId", name: "เลขประจำตัวประชาชน" }, + { id: "posNo", name: "ตำแหน่งเลขที่" }, + { id: "position", name: "ตำแหน่งสายงาน" }, + ]); + const employeeClassOps = ref([ + { id: "officer", name: "ข้าราชการ กทม.สามัญ" }, + { id: "perm", name: "ลูกจ้างประจำ" }, + { id: "temp", name: "ลูกจ้างชั่วคราว" }, + ]); + const posTypeOps = ref([]); + const posTypeMain = ref([]); + const posLevelOps = ref([]); + const yearOps = ref([]); + const mode = ref("card"); + function fetchType(data: DataType[]) { + posTypeMain.value = data; const list: DataOption[] = data.map((e: DataType) => ({ id: e.id, name: e.posTypeName, })); - return list; + posTypeOps.value = list; } function fetchLevel(data: DataLevel[]) { const list: DataOption[] = data.map((e: DataLevel) => ({ id: e.id, name: e.posLevelName, })); - return list; + posLevelOps.value = list; } return { fetchType, fetchLevel, + posTypeMain, + searchTypeOption, + employeeClassOps, + posTypeOps, + posLevelOps, + yearOps, + mode, }; }); diff --git a/src/modules/04_registryNew/views/list.vue b/src/modules/04_registryNew/views/list.vue index fd75b1155..166c61b30 100644 --- a/src/modules/04_registryNew/views/list.vue +++ b/src/modules/04_registryNew/views/list.vue @@ -7,7 +7,8 @@ import config from "@/app.config"; /** importType*/ import type { QTableColumn } from "quasar"; import type { DataOption } from "@/modules/04_registryNew/interface/index/Main"; -import type { RangeYear } from "@/modules/04_registryNew/interface/index/registry"; +import type { DataPerson } from "@/modules/04_registryNew/interface/response/Main"; +import type { FormFilter } from "@/modules/04_registryNew/interface/request/Main"; /** importComponents*/ import Search from "@/modules/04_registryNew/components/registry/Search.vue"; @@ -22,211 +23,127 @@ const store = useRegistryNewDataStore(); const { showLoader, hideLoader, messageError } = useCounterMixin(); const mode = ref<"table" | "card">("table"); -const columns = [ - { - name: "no", - align: "left", - label: "ลำดับ", - sortable: true, - field: "no", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - sort: (a: string, b: string) => - a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), - }, - { - name: "fullName", - align: "center", - label: "ชื่อ - นามสกุล", - sortable: true, - field: "fullName", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - sort: (a: string, b: string) => - a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), - }, - { - name: "posNo", - align: "left", - label: "ตำแหน่งเลขที่", - sortable: true, - field: "posNo", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - sort: (a: string, b: string) => - a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), - }, - { - name: "position", - align: "left", - label: "ตำแหน่ง", - sortable: true, - field: "position", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - sort: (a: string, b: string) => - a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), - }, - { - name: "posPath", - align: "left", - label: "สายงาน", - sortable: true, - field: "posPath", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - sort: (a: string, b: string) => - a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), - }, - { - name: "posType", - align: "left", - label: "สายงาน", - sortable: true, - field: "posPath", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - sort: (a: string, b: string) => - a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), - }, - { - name: "posLevel", - align: "left", - label: "ระดับชั้นงาน", - sortable: true, - field: "posLevel", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - sort: (a: string, b: string) => - a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), - }, - { - name: "posOc", - align: "left", - label: "สังกัด", - sortable: true, - field: "posOc", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - sort: (a: string, b: string) => - a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), - }, - { - name: "year", - align: "left", - label: "ปีงบประมาณ", - sortable: true, - field: "year", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - sort: (a: string, b: string) => - a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), - }, - { - name: "salary", - align: "left", - label: "ค่าจ้าง", - sortable: true, - field: "salary", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - sort: (a: string, b: string) => - a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), - }, -] satisfies QTableColumn[]; -const visibleColumns = ref([ - "no", - "fullName", - "posNo", - "position", - "posPath", - "posType", - "posLevel", - "posOc", - "year", - "salary", -]); - -const isSearchData = ref(true); -const isShowFilter = ref(true); -const keyword = ref(""); - -const searchType = ref("fullName"); - -const searchTypeOption = ref([ - { id: "fullName", name: "ชื่อ-นามสกุล" }, - { id: "citizenId", name: "เลขประจำตัวประชาชน" }, - { id: "posNo", name: "ตำแหน่งเลขที่" }, - { id: "position", name: "ตำแหน่งสายงาน" }, -]); +const isShowFilter = ref(false); +const isShowBtnFilter = ref(true); const labelOption = reactive({ - type: "ทั้งหมด", + type: "ข้าราชการทั้งหมด", posType: "ทั้งหมด", posLevel: "ทั้งหมด", + retireYear: "", }); -const type = ref("ข้าราชการทั้งหมด"); -const posType = ref("ทั้งหมด"); -const posLevel = ref("ทั้งหมด"); -const retireYear = ref(null); -const isShowRetire = ref(false); -const isProbation = ref(false); -const TypeOption = ref([ - { id: "0", name: "ข้าราชการทั้งหมด" }, - { id: "1", name: "ข้าราชการ กทม.สามัญ" }, - { id: "2", name: "ลูกจ้างประจำ" }, - { id: "3", name: "ลููกจ้างชั่วคราว" }, -]); -const posTypeOption = ref([]); -const posLevelOption = ref([]); -const rangeYear = ref({ - min: 0, - max: 60, +const searchType = ref("fullName"); +const formFilter = reactive({ + page: 1, + pageSize: 12, + keyword: "", + type: "", + posType: "", + posLevel: "", + retireYear: "", + rangeYear: { min: 0, max: 60 }, + isShowRetire: false, + isProbation: false, }); +const maxPage = ref(1); + +const dataPersonMain = ref([]); const conditionTotal = computed(() => { let num: string = ""; - if (isProbation.value && isShowRetire.value) { + if (formFilter.isProbation && formFilter.isShowRetire) { num = "(2)"; - } else if (isProbation.value || isShowRetire.value) { + } else if (formFilter.isProbation || formFilter.isShowRetire) { num = "(1)"; } else ""; return num; }); +/** function เรียกข้อมูลประเภทตำแหน่ง*/ function fetchType() { - http - .get(config.API.orgPosType) - .then(async (res) => { - posTypeOption.value = store.fetchType(res.data.result); - }) - .catch((err) => { - messageError($q, err); - }) - .finally(() => { - hideLoader(); - }); + if (store.posTypeOps.length === 0) { + http + .get(config.API.orgPosType) + .then((res) => { + store.fetchType(res.data.result); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); + } } -async function fetchLevel() { +/** function เรียกข้อมูลระดับตำแหน่ง*/ +function fetchLevel() { + if (store.posLevelOps.length === 0) { + http + .get(config.API.orgPosLevel) + .then((res) => { + store.fetchLevel(res.data.result); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); + } +} + +function fetchYearOption() { + if (store.yearOps.length === 0) { + const options = []; + const year = new Date().getFullYear(); + + for (let i = year - 40; i <= year + 60; i++) { + options.push({ id: i.toString(), name: (i + 543).toString() }); + } + if (options) { + store.yearOps.push(...options); + } + } +} + +function fetchDataPerson() { + showLoader(); http - .get(config.API.orgPosLevel) - .then(async (res) => { - posLevelOption.value = store.fetchLevel(res.data.result); + .get( + config.API.registryNew + + `?page=${formFilter.page}&pageSize=${formFilter.pageSize}&keyword=${formFilter.keyword}` + ) + .then((res) => { + maxPage.value = Math.ceil(res.data.result.total / formFilter.pageSize); + dataPersonMain.value = res.data.result.data; }) .catch((err) => { messageError($q, err); }) .finally(() => { - hideLoader(); + setTimeout(() => { + hideLoader(); + }, 500); }); } function onClickShowFilter() { isShowFilter.value = !isShowFilter.value; + isShowBtnFilter.value = false; + if (isShowFilter.value) { + fetchType(); + fetchLevel(); + fetchYearOption(); + } +} + +function onclickSearch() { + formFilter.keyword = formFilter.keyword === null ? "" : formFilter.keyword; + fetchDataPerson(); } function selectType(item: DataOption) { @@ -241,24 +158,27 @@ function selectPosLevel(item: DataOption) { labelOption.posLevel = item.name; } +function selectRetireYear(item: DataOption) { + labelOption.retireYear = item.name; +} + function clearSelect(t: string) { if (t === "type") { - labelOption.type = "ทั้งหมด"; + labelOption.type = "ข้าราชการทั้งหมด"; } else if (t === "posType") { labelOption.posType = "ทั้งหมด"; } else if (t === "posLevel") { labelOption.posLevel = "ทั้งหมด"; } else if (t === "retireYear") { - retireYear.value = null; + labelOption.retireYear = ""; } else if (t === "rangeYear") { - rangeYear.value.min = 0; - rangeYear.value.max = 60; + formFilter.rangeYear.min = 0; + formFilter.rangeYear.max = 60; } } onMounted(async () => { - fetchType(); - fetchLevel(); + fetchDataPerson(); }); @@ -270,34 +190,41 @@ onMounted(async () => { ค้นหาข้อมูลทะเบียนประวัติ - - - - - + + + - - - - - + v-model="searchType" + :options="store.searchTypeOption" + emit-value + dense + emit-option + option-label="name" + option-value="id" + map-options + /> + + + + + + + + { /> - - - - - {{ `ประเภทข้าราชการ ${labelOption.type}` }} + + + + {{ `${labelOption.type}` }} - - - - - - {{ item.name }} - - - - + + + + + + {{ item.name }} + + + + - - - {{ `ประเภทตำแหน่ง ${labelOption.posType}` }} - - - - - - {{ item.name }} - - - - + + + {{ `ประเภทตำแหน่ง${labelOption.posType}` }} + + + + + + {{ item.name }} + + + + - - - {{ `ระดับตำแหน่ง ${labelOption.posLevel}` }} - - - - - - {{ item.name }} - - - - + + + {{ `ระดับตำแหน่ง${labelOption.posLevel}` }} + + + + + + {{ item.name }} + + + + - - {{ year + 543 }} - {{ - parseInt(value + 543) - }} - - - - - - - - + + + {{ `ปีเกษียณ${labelOption.retireYear}` }} + + + + + + {{ item.name }} + + + + - - - {{ `อายุราชการ (${rangeYear.min} - ${rangeYear.max} ปี)` }} - - - - - - จำนวนปี - - - - - + + + + + {{ + `อายุราชการ (${formFilter.rangeYear.min} - ${formFilter.rangeYear.max} ปี)` + }} + + + + + + จำนวนปี + + + + - + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + @@ -532,105 +503,18 @@ onMounted(async () => { - - - - ไม่พบข้อมูล - - - + + - - - - - - - -