Merge branch 'develop' into devTee

This commit is contained in:
setthawutttty 2025-09-05 14:42:28 +07:00
commit 3d4185f717
2 changed files with 26 additions and 15 deletions

View file

@ -7,9 +7,7 @@ import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useOrganizational } from "@/modules/02_organization/store/organizational"; import { useOrganizational } from "@/modules/02_organization/store/organizational";
/** /** import Type*/
* import Type
*/
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
import type { HistoryPos } from "@/modules/02_organization/interface/response/organizational"; import type { HistoryPos } from "@/modules/02_organization/interface/response/organizational";
@ -56,11 +54,11 @@ const baseColumns = ref<QTableProps["columns"]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "orgShortName", name: "shortName",
align: "left", align: "left",
label: "อักษรย่อ", label: "อักษรย่อ",
sortable: true, sortable: true,
field: "orgShortName", field: "shortName",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) => sort: (a: string, b: string) =>
@ -193,15 +191,8 @@ async function fetchHistoryPos(id: string) {
const data = res.data.result; const data = res.data.result;
rows.value = rows.value =
props.historyType === "HISTORY" props.historyType === "HISTORY"
? data ? formatHistoryData(data)
: data.map((e: any) => ({ : formatHistoryOwnerData(data);
...e,
fullname:
e.prefix && e.firstName && e.lastName
? `${e.prefix ?? ""} ${e.firstName ?? ""} ${e.lastName ?? ""}`
: "-",
shortName: e.orgShortName,
}));
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -211,6 +202,23 @@ async function fetchHistoryPos(id: string) {
}); });
} }
function formatHistoryData(data: HistoryPos[]) {
return data.map((item) => ({
...item,
shortName: item.orgShortName ?? "-",
}));
}
function formatHistoryOwnerData(data: HistoryPos[]) {
return data.map((item) => ({
...item,
fullname:
item.prefix && item.firstName && item.lastName
? `${item.prefix} ${item.firstName} ${item.lastName}`.trim()
: "-",
}));
}
/** ดูการเปลี่ยนแปลง modal เมื่อเป็น true จะเรียกเรียกข้อมูลประวัติตำแหน่ง*/ /** ดูการเปลี่ยนแปลง modal เมื่อเป็น true จะเรียกเรียกข้อมูลประวัติตำแหน่ง*/
watch( watch(
() => modal.value, () => modal.value,

View file

@ -167,11 +167,14 @@ interface PosMaster2 {
interface HistoryPos { interface HistoryPos {
id: string; //id node id: string; //id node
orgShotName: string; //ชื่อย่อส่วนราชการ orgShortName: string; //ชื่อย่อส่วนราชการ
lastUpdatedAt: Date; //วันที่แก้ไข lastUpdatedAt: Date; //วันที่แก้ไข
posMasterNoPrefix: string; //Prefix นำหน้าเลขที่ตำแหน่ง เป็น Optional (ไม่ใช่อักษรย่อของหน่วยงาน/ส่วนราชการ) posMasterNoPrefix: string; //Prefix นำหน้าเลขที่ตำแหน่ง เป็น Optional (ไม่ใช่อักษรย่อของหน่วยงาน/ส่วนราชการ)
posMasterNo: number; //เลขที่ตำแหน่ง เป็นตัวเลข posMasterNo: number; //เลขที่ตำแหน่ง เป็นตัวเลข
posMasterNoSuffix: string; //Suffix หลังเลขที่ตำแหน่ง เช่น ช. posMasterNoSuffix: string; //Suffix หลังเลขที่ตำแหน่ง เช่น ช.
prefix: string; //คำนำหน้าชื่อผู้ครองตำแหน่ง
firstName: string; //ชื่อผู้ครองตำแหน่ง
lastName: string; //นามสกุลผู้ครองตำแหน่ง
} }
interface SelectPerson { interface SelectPerson {