From 1fb4478394198452d2822d89b613b7bc6c49c26f Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Thu, 8 Feb 2024 16:59:57 +0700 Subject: [PATCH] no message --- src/api/02_organizational/api.organization.ts | 8 +- .../components/DialogSelectPerson.vue | 92 +++++++++++++------ 2 files changed, 70 insertions(+), 30 deletions(-) diff --git a/src/api/02_organizational/api.organization.ts b/src/api/02_organizational/api.organization.ts index ece780221..d9f9ba3c3 100644 --- a/src/api/02_organizational/api.organization.ts +++ b/src/api/02_organizational/api.organization.ts @@ -2,6 +2,7 @@ import env from "../index"; const organization = `${env.API_URI}/org`; const orgPos = `${env.API_URI}/org/pos`; +const orgProfile = `${env.API_URI}/org/profile`; export default { /** โครงสร้างอัตรากำลัง*/ @@ -32,5 +33,10 @@ export default { orgPosExecutiveById: (id: string) => `${orgPos}/executive/${id}`, orgPosHistory: (id: string) => `${orgPos}/history/${id}`, - orgSalaryPosition:`${orgPos}/position?keyword=&type=ALL`, + orgSalaryPosition: `${orgPos}/position?keyword=&type=ALL`, + + /**ครองตำแหน่ง */ + orgSearchProfile: `${orgProfile}/search`, + orgProfile: `${orgProfile}`, + orgDeleteProfile: (id: string) => `${orgProfile}/delete/${id}`, }; diff --git a/src/modules/02_organizationalNew/components/DialogSelectPerson.vue b/src/modules/02_organizationalNew/components/DialogSelectPerson.vue index e4aa61e5d..63e01a1a8 100644 --- a/src/modules/02_organizationalNew/components/DialogSelectPerson.vue +++ b/src/modules/02_organizationalNew/components/DialogSelectPerson.vue @@ -59,6 +59,7 @@ const props = defineProps({ }); const row = ref([]); const rowResult = ref([]); + const formData = reactive({ positionNo: "", //*เลขที่ตำแหน่ง positionType: "", //*เลขที่ตำแหน่ง @@ -267,8 +268,8 @@ function clearForm() { formData.positionLevel = ""; formData.personal = ""; formData.position = ""; - row.value = [] - rowResult.value = [] + row.value = []; + rowResult.value = []; } watch( @@ -362,27 +363,61 @@ function onSubmit() { } /** เมื่อ enter ให้ทำการ ค้นหาข้อมูล */ -function searchData() { - const data = [ - { - id: "test1", - citizenId: "test1", - name: "test1", - posTypeName: "test1", - positionName: "test1", - posLevelName: "test1", - }, - { - id: "test2", - citizenId: "test2", - name: "test2", - posTypeName: "test2", - positionName: "test2", - posLevelName: "test2", - }, - ]; +const page = ref(1); +const pageSize = ref(20); +async function searchData() { + showLoader(); + console.log(formData); + const reqBody = { + posTypeId: formData.positionType, // id ประเภทตำแหน่ง + posLevelId: formData.positionLevel, // id ระดับตำแหน่ง + position: formData.position, // ตำแหน่ง + page: page.value, //*หน้า + pageSize: pageSize.value, //*จำนวนแถวต่อหน้า + keyword: formData.personal, //นามสกุล ชื่อ สกุล เลขบัตร + }; + await http + .post(config.API.orgSearchProfile, reqBody) + .then((res) => { + console.log(res); + const list = res.data.result.data.map((e) => ({ + id: e.id, + citizenId: e.citizenId, + name: `${e.prefix + e.firstName + e.lastName}`, + posTypeName: e.posType ?? "-", + positionName: e.position ?? "-", + posLevelName: e.posLevel ?? "-", + })); + rowResult.value = list; + }) - rowResult.value = data; + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); + + // const data = [ + // { + // id: "test1", + // citizenId: "test1", + // name: "test1", + // posTypeName: "test1", + // positionName: "test1", + // posLevelName: "test1", + // }, + // { + // id: "test2", + // citizenId: "test2", + // name: "test2", + // posTypeName: "test2", + // positionName: "test2", + // posLevelName: "test2", + // }, + // ]; + + // rowResult.value = data; // props.fetchListDisciplinary?.(); } @@ -509,7 +544,6 @@ function clearPosition() {
-