From 568635fe653a0c243659d79fe04fc2caa28597a1 Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Wed, 24 Jan 2024 15:40:43 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=20=E0=B9=80?= =?UTF-8?q?=E0=B8=9E=E0=B8=B4=E0=B9=88=E0=B8=A1=E0=B8=A3=E0=B8=B2=E0=B8=A2?= =?UTF-8?q?=E0=B8=8A=E0=B8=B7=E0=B9=88=E0=B8=AD=E0=B8=81=E0=B8=A3=E0=B8=A3?= =?UTF-8?q?=E0=B8=A1=E0=B8=81=E0=B8=B2=E0=B8=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/Director/Form.vue | 290 +++++++++++++++--- 1 file changed, 251 insertions(+), 39 deletions(-) diff --git a/src/modules/12_evaluatePersonal/components/Director/Form.vue b/src/modules/12_evaluatePersonal/components/Director/Form.vue index e03c49217..a98fec562 100644 --- a/src/modules/12_evaluatePersonal/components/Director/Form.vue +++ b/src/modules/12_evaluatePersonal/components/Director/Form.vue @@ -2,13 +2,20 @@ import { ref, reactive, watch } from "vue"; import { useCounterMixin } from "@/stores/mixin"; import { useQuasar } from "quasar"; +import type { QTableProps } from "quasar"; import type { FormData, FormRef, + typeOp, + ResponsePreson, + tableType, } from "@/modules/11_discipline/interface/request/director"; import http from "@/plugins/http"; import config from "@/app.config"; +import PopupPersonal from "@/components/Dialogs/PopupPersonal.vue"; +const modalPersonal = ref(false); +const personId = ref(""); const $q = useQuasar(); const mixin = useCounterMixin(); const { @@ -40,6 +47,13 @@ const emit = defineEmits(["formDataReturn"]); // const idCard = ref(""); const idCardRef = ref(null); +const type = ref("idcard"); +const search = ref(""); +const typeOps = ref([ + { id: "idcard", name: "เลขประจำตัวประชาชน" }, + { id: "firstname", name: "ชื่อ" }, + { id: "lastname", name: "นามสกุล" }, +]); /** * ข้อมูลทั้งก้อน form @@ -52,8 +66,70 @@ const formData = reactive({ position: "", phone: "", email: "", + qualification: "", }); +/** หัวข้อที่เเสดงในตารางผู้ถูกร้องเรียน */ +const visibleColumnsRespondent = ref([ + "info", + "no", + // "idcard", + "name", + // "posNo", + "position", + // "positionLevel", + // "salary", + "organization", +]); + +const columnsRespondent = ref([ + { + name: "info", + align: "center", + label: "", + sortable: false, + field: "info", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + { + name: "no", + align: "left", + label: "ลำดับ", + sortable: false, + field: "no", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + { + name: "name", + align: "left", + label: "ชื่อ - นามสกุล", + sortable: true, + field: "name", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + { + name: "position", + align: "left", + label: "ตำแหน่ง", + sortable: true, + field: "position", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + { + name: "organization", + align: "left", + label: "หน่วยงาน", + sortable: true, + field: "organization", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, +]); + /** * เช็คข้อมูลจาก props * เมื่อมีข้อมูล @@ -119,6 +195,8 @@ function addEmployee() { /** * ตรวจสอบข้อมูลก่อนส่งไปยัง api */ +const rows = ref([]); +const searchRef = ref(null); const prefixRef = ref(null); const firstnameRef = ref(null); const lastnameRef = ref(null); @@ -157,53 +235,181 @@ function inputEdit(val: boolean) { "full-width cursor-pointer inputgreen": !val, }; } + +/** update เมื่อเปลี่ยน option */ +function updateSelect() { + search.value = ""; +} + +async function searchInput() { + searchRef.value.validate(); + if (!searchRef.value.hasError) { + showLoader(); + const body = { + fieldName: type.value, + keyword: search.value, + }; + await http + .post(config.API.searchPersonal(), body) + .then((res) => { + const data = res.data.result; + const list = data.map((e: ResponsePreson) => ({ + personId: e.personId, + idcard: e.idcard, + prefix: e.prefix, + firstName: e.firstName, + lastName: e.lastName, + name: `${e.prefix}${e.firstName} ${e.lastName}`, + posNo: e.posNo ?? "-", + position: e.position ?? "-", + positionLevel: e.positionLevel ?? "-", + salary: e.salaries ?? "-", + organization: e.organization ?? "-", + phone: e.phone ?? "-", + email: e.email ?? "-", + })); + + rows.value = list; + }) + .catch((err) => {}) + .finally(() => { + hideLoader(); + }); + } +} + +function returnDetail(data: any) { + formData.prefix = data.prefix; + formData.firstname = data.firstName; + formData.lastname = data.lastName; + formData.position = data.position; + formData.phone = data.phone; + formData.email = data.email; +} + +/** + * function ดูประวัติแบบย่อย + * @param id personId + */ +function onclickViewinfo(id: string) { + modalPersonal.value = true; + personId.value = id; +} + +function updatemodalPersonal(modal: boolean) { + modalPersonal.value = modal; +}