From 0739f2b9d7ffdb2a7c45b2b6526ba5ee9150fc42 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Thu, 7 May 2026 10:40:58 +0700 Subject: [PATCH 1/2] feat(receive): add input rank --- .../components/Receive/ReceiveAddPerson.vue | 72 ++++++++++++++++--- .../components/Receive/receiveDetail.vue | 68 +++++++++++++++++- .../interface/index/ProfileType.ts | 3 + 3 files changed, 132 insertions(+), 11 deletions(-) diff --git a/src/modules/05_placement/components/Receive/ReceiveAddPerson.vue b/src/modules/05_placement/components/Receive/ReceiveAddPerson.vue index e6d2da0ce..fa0551e99 100644 --- a/src/modules/05_placement/components/Receive/ReceiveAddPerson.vue +++ b/src/modules/05_placement/components/Receive/ReceiveAddPerson.vue @@ -48,6 +48,7 @@ const informaData = ref({ employeeType: null, employeeClass: null, profileType: null, + rank: "", }); // รายการข้อมูลทั้งหมด @@ -60,6 +61,7 @@ const Ops = ref({ religionOps: [], employeeClassOps: [], employeeTypeOps: [], + rankOps: [], }); // ข้อมูลเมื่อเลือกแล้ว const OpsFilter = ref({ @@ -71,6 +73,7 @@ const OpsFilter = ref({ religionOps: [], employeeClassOps: [], employeeTypeOps: [], + rankOps: [], }); // รูป profile @@ -135,6 +138,16 @@ async function fetchPerson() { }); Ops.value.religionOps = optionreligions; OpsFilter.value.religionOps = optionreligions; + + let rank: DataOption[] = []; + data.rank.map((r: DataOptioninfo) => { + rank.push({ + id: r.id.toString(), + name: r.name.toString(), + }); + }); + Ops.value.rankOps = rank; + OpsFilter.value.rankOps = rank; }) .catch((e) => { messageError($q, e); @@ -204,7 +217,13 @@ function filterSelector(val: string, update: Function, refData: string) { ); }); break; - + case "rankOps": + update(() => { + Ops.value.rankOps = OpsFilter.value.rankOps.filter( + (v: DataOption) => v.name.toLowerCase().indexOf(newVal) > -1 + ); + }); + break; default: break; } @@ -227,7 +246,7 @@ function onSubmit() { if (fileData.value != null) formData.append("File", fileData.value); //แก้ไขรูป if (informaData.value.citizenId != undefined) formData.append("citizenId", informaData.value.citizenId); - if (informaData.value.prefix != undefined) + if (informaData.value.prefix != undefined && informaData.value.prefix != "") formData.append("prefix", informaData.value.prefix); if (informaData.value.firstName != undefined) formData.append("firstName", informaData.value.firstName); @@ -256,6 +275,8 @@ function onSubmit() { formData.append("employeeType", informaData.value.employeeType); if (informaData.value.employeeClass != undefined) formData.append("employeeClass", informaData.value.employeeClass); + if (informaData.value.rank != undefined && informaData.value.rank != "") + formData.append("rank", informaData.value.rank); dialogConfirm($q, async () => { showLoader(); @@ -289,6 +310,15 @@ function updateBirthDate(v: Date) { age.value = calculateAge(v); } +function prefixRankRule() { + return [ + () => + !!informaData.value.rank || + !!informaData.value.prefix || + "กรุณาเลือกคำนำหน้าชื่อ หรือยศ", + ]; +} + /** * ทำงานเมื่อมีการเรียกใช้ Components */ @@ -383,7 +413,7 @@ onMounted(async () => {
-
+
{ mask="#############" />
-
+
{ option-value="name" map-options hide-bottom-space - :rules="[ - (val:string) => { - return val.length > 0 || 'กรุณาเลือกคำนำหน้าชื่อ'; - }, - ]" + :rules="prefixRankRule()" + reactive-rules emit-value use-input hide-selected @@ -432,6 +460,32 @@ onMounted(async () => { )" />
+
+ +
({ { id: "gov", name: "งบประมาณเงินอุดหนุนรัฐบาล" }, { id: "bkk", name: "งบประมาณกรุงเทพมหานคร" }, ], + rankOps: [], }); const OpsFilter = ref({ prefixOps: [], @@ -129,6 +130,7 @@ const OpsFilter = ref({ { id: "gov", name: "งบประมาณเงินอุดหนุนรัฐบาล" }, { id: "bkk", name: "งบประมาณกรุงเทพมหานคร" }, ], + rankOps: [], }); /** ฟังก์ชันดึงข้อมูลรายการข้อมูลเกี่ยวกับบุคคล (dropdown list)*/ @@ -186,6 +188,16 @@ async function fetchPerson() { }); Ops.value.religionOps = optionreligions; OpsFilter.value.religionOps = optionreligions; + + let rank: DataOption[] = []; + data.rank.map((r: DataOptioninfo) => { + rank.push({ + id: r.id.toString(), + name: r.name.toString(), + }); + }); + Ops.value.rankOps = rank; + OpsFilter.value.rankOps = rank; }) .catch((e) => { messageError($q, e); @@ -230,6 +242,7 @@ async function getData() { (data.prefix == "00000000-0000-0000-0000-000000000000" ? null : data.prefix) ?? "", + rank: data.rank ?? "", firstname: data.firstName ?? "", lastname: data.lastName ?? "", birthDate: @@ -295,6 +308,7 @@ async function fetchData(data: any) { (data.prefix == "00000000-0000-0000-0000-000000000000" ? null : data.prefix) ?? "", + rank: data.rank ?? "", firstname: data.firstName ?? "", lastname: data.lastName ?? "", birthDate: data.dateOfBirth !== null ? new Date(data.dateOfBirth) : null, @@ -436,6 +450,14 @@ function filterSelector(val: string, update: Function, refData: string) { }); break; + case "rankOps": + update(() => { + Ops.value.rankOps = OpsFilter.value.rankOps.filter( + (v: DataOption) => v.name.toLowerCase().indexOf(newVal) > -1 + ); + }); + break; + default: break; } @@ -470,6 +492,7 @@ function saveData() { positionNumberOld: posNo.value, amount: 0, amountOld: salary.value, + rank: informaData.value.rank, }; showLoader(); http @@ -517,6 +540,15 @@ function updateBirthDate(v: Date) { informaData.value.age = calculateAge(v); } +function prefixRankRule() { + return [ + () => + !!informaData.value.rank || + !!informaData.value.prefixId || + "กรุณาเลือกคำนำหน้าชื่อ หรือยศ", + ]; +} + /** ทำงานเมื่อมีการเรียกใช้ Components*/ onMounted(async () => { await fetchPerson(); @@ -598,7 +630,7 @@ onMounted(async () => {
ข้อมูลส่วนตัว
-
+
{ mask="#############" />
-
+
{ option-value="name" :label="`${'คำนำหน้าชื่อ'}`" use-input + clearable input-debounce="0" + :rules="prefixRankRule()" + reactive-rules @filter="(inputValue:string, doneFn:Function) => filterSelector(inputValue, doneFn,'prefixOps' ) " />
+ +
+ +
+
Date: Tue, 12 May 2026 15:24:53 +0700 Subject: [PATCH 2/2] refactor(receive): display prefix --- src/components/CardProfile.vue | 6 +++--- .../05_placement/components/Receive/receiveDetail.vue | 6 +++--- src/modules/05_placement/views/03_receiveMain.vue | 4 +++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/components/CardProfile.vue b/src/components/CardProfile.vue index d6b9fe4cf..72fe7aad0 100644 --- a/src/components/CardProfile.vue +++ b/src/components/CardProfile.vue @@ -43,9 +43,9 @@ async function fetchDataProfile(data: DataProfile) { profile.avatar = data?.avatar ? data.avatar : ""; } profile.id = data.profileId; - profile.fullName = `${data.prefix ?? ""}${data.firstName ?? ""} ${ - data.lastName ?? "" - } `; + profile.fullName = `${data.rank ? data.rank : data.prefix ?? ""}${ + data.firstName ?? "" + } ${data.lastName ?? ""} `; if (data["posTypeNameOld"] !== undefined) { profile.position = diff --git a/src/modules/05_placement/components/Receive/receiveDetail.vue b/src/modules/05_placement/components/Receive/receiveDetail.vue index cae4da5bc..950cfa42c 100644 --- a/src/modules/05_placement/components/Receive/receiveDetail.vue +++ b/src/modules/05_placement/components/Receive/receiveDetail.vue @@ -227,9 +227,9 @@ async function getData() { } rows.value = list; profileId.value = data.profileId; - title.value.fullname = `${data.prefix ?? ""}${data.firstName ?? ""} ${ - data.lastName ?? "" - }`; + title.value.fullname = `${data.rank ? data.rank : data.prefix ?? ""}${ + data.firstName ?? "" + } ${data.lastName ?? ""}`; title.value.organizationPositionOld = data.organizationPositionOld ?? "-"; title.value.positionLevelOld = data.positionLevelOld ?? "-"; title.value.positionTypeOld = data.positionTypeOld ?? "-"; diff --git a/src/modules/05_placement/views/03_receiveMain.vue b/src/modules/05_placement/views/03_receiveMain.vue index f34bf8a48..58b7a544b 100644 --- a/src/modules/05_placement/views/03_receiveMain.vue +++ b/src/modules/05_placement/views/03_receiveMain.vue @@ -110,7 +110,9 @@ const columns = ref([ sort: (a: string, b: string) => a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), format(val, row) { - return `${row.prefix ?? ""}${row.firstName ?? ""} ${row.lastName ?? ""}`; + return ` ${row.rank ? row.rank : row.prefix ?? ""}${ + row.firstName ?? "" + } ${row.lastName ?? ""}`; }, }, {