From d3d09809d69577ab1589c099516d7caecfd4b2ee Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Wed, 18 Dec 2024 17:56:30 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=20=E0=B8=9B?= =?UTF-8?q?=E0=B8=A3=E0=B8=B0=E0=B8=A7=E0=B8=B1=E0=B8=95=E0=B8=B4=E0=B8=96?= =?UTF-8?q?=E0=B8=B7=E0=B8=AD=E0=B8=84=E0=B8=A3=E0=B8=AD=E0=B8=87=E0=B8=95?= =?UTF-8?q?=E0=B8=B3=E0=B9=81=E0=B8=AB=E0=B8=99=E0=B9=88=E0=B8=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/DialogHistory.vue | 123 ++---------------- 1 file changed, 14 insertions(+), 109 deletions(-) diff --git a/src/modules/04_registryPerson/components/DialogHistory.vue b/src/modules/04_registryPerson/components/DialogHistory.vue index bc95028cb..83d9844c8 100644 --- a/src/modules/04_registryPerson/components/DialogHistory.vue +++ b/src/modules/04_registryPerson/components/DialogHistory.vue @@ -2,7 +2,7 @@ import { ref } from "vue"; import { useQuasar } from "quasar"; -import { useRouter,useRoute } from "vue-router"; +import { useRouter, useRoute } from "vue-router"; import { useCounterMixin } from "@/stores/mixin"; import http from "@/plugins/http"; import config from "@/app.config"; @@ -11,10 +11,7 @@ import config from "@/app.config"; import type { QTableProps } from "quasar"; import type { QForm } from "quasar"; import type { DataOption } from "@/modules/04_registryPerson/interface/index/Main"; -import type { - HistoryPos, - Position, -} from "@/modules/04_registryPerson/interface/response/History"; +import type { HistoryPos } from "@/modules/04_registryPerson/interface/response/History"; /** import components*/ import DialogHeader from "@/components/DialogHeader.vue"; @@ -30,7 +27,9 @@ const { showLoader, hideLoader, messageError, date2Thai } = useCounterMixin(); const modal = defineModel("modal", { required: true }); //แสดง popup ประวัติถือครองตำแหน่ง //ตัวแปร -const employeeClass = ref(route.name == "registryNew" ? 'officer':'perm'); //ประเภทข้า่รายการ +const employeeClass = ref( + route.name == "registryNew" ? "officer" : "perm" +); //ประเภทข้า่รายการ const typeKeyword = ref(""); const Keyword = ref(""); const positionKeyword = ref(""); @@ -43,8 +42,6 @@ const typeKeywordOps = ref([ { id: "no", name: "ตำแหน่งเลขที่" }, { id: "position", name: "ตำแหน่ง" }, ]); -const positionOps = ref([]); -const options = ref([]); /** Table*/ const columns = ref([ @@ -100,43 +97,6 @@ const columns = ref([ ]); const rows = ref([]); -/** function fetch ข้อมูลตำแหน่ง ข้าราชการ*/ -function fecthPositionOfficer() { - http - .get(config.API.listPositionPathHistory) - .then((res) => { - let data = res.data.result.items; - - positionOps.value = data.map((e: Position) => ({ - id: e.id, - name: e.name, - })); - options.value = positionOps.value; - }) - .catch((err) => { - messageError($q, err); - }); -} - -/** function fetch ข้อมูลตำแหน่ง ลูกจ้างประจำ*/ -function fetchPositionPerm() { - http - .get(config.API.listPositionEmployeePositionHistory) - .then((res) => { - let data = res.data.result.items; - console.log(data); - - positionOps.value = data.map((e: Position) => ({ - id: e.id, - name: e.name, - })); - options.value = positionOps.value; - }) - .catch((err) => { - messageError($q, err); - }); -} - /** function เปลี่ยนประเภท*/ function changeEmployeeClass() { typeKeyword.value = ""; @@ -145,22 +105,6 @@ function changeEmployeeClass() { rows.value = []; } -/** - * function เลือกฟิลด์ที่จะค้นหา - * @param typeKeyword ประเภทฟิลด์ - */ -function selectTypeKeyword(typeKeyword: string) { - positionOps.value = []; - positionKeyword.value = ""; - Keyword.value = ""; - - if (typeKeyword == "position" && employeeClass.value === "officer") { - fecthPositionOfficer(); - } else if (typeKeyword == "position" && employeeClass.value === "perm") { - fetchPositionPerm(); - } -} - /** * function ค้นหาประวัติถือครองตำแหน่ง * @param type ประเภทข่าราชการ @@ -208,26 +152,6 @@ function clickSearch(type: string) { }); } -/** - * function ค้นหาข่อมูล Optiion - * @param val คำค้นหา - * @param update function - */ -function filterFn(val: string, update: Function) { - if (val === "") { - update(() => { - options.value = positionOps.value; - }); - return; - } else { - update(() => { - options.value = positionOps.value.filter( - (e) => e.name.search(val) !== -1 - ); - }); - } -} - /** * function redirect ไปทะเบียนประวัติ * @param id @@ -261,7 +185,7 @@ function closeDialog() {
-
+
@@ -312,40 +236,21 @@ function closeDialog() { placeholder="ตำแหน่งเลขที่" :rules="[(val:string) => !!val || `${'กรุณากรอก ตำแหน่งเลขที่'}`]" hide-bottom-space - style="width: 250px" />
- - + v-model="positionKeyword" + placeholder="ตำแหน่ง" + :rules="[(val:string) => !!val || `${'กรุณากรอก ตำแหน่ง'}`]" + hide-bottom-space + />
-
+