ข้อมูลราชการ ==> ตำแหน่ง

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-03-13 17:07:28 +07:00
parent cbee41e212
commit 2acaf97a28
4 changed files with 212 additions and 292 deletions

View file

@ -6,6 +6,8 @@ const profileOrg = `${env.API_URI}/org/profile`;
const report = `${env.API_URI}/org`; const report = `${env.API_URI}/org`;
const workflow = `${env.API_URI}/org/workflow`; const workflow = `${env.API_URI}/org/workflow`;
export default { export default {
orgCommandCode: `${metadata}commandCode`,
profilePosition: () => `${org}/profile/keycloak/position`, profilePosition: () => `${org}/profile/keycloak/position`,
searchCommander: `${org}/profile/search/commander`, searchCommander: `${org}/profile/search/commander`,

View file

@ -1,16 +1,18 @@
<script setup lang="ts"> <script setup lang="ts">
import { useQuasar, type QTableProps } from "quasar"; import { useQuasar, type QTableColumn } from "quasar";
import { ref, onMounted, computed } from "vue"; import { ref, onMounted, computed } from "vue";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useDataStore } from "@/stores/data"; import { useDataStore } from "@/stores/data";
import { useGovernmentPosDataStore } from "@/modules/10_registry/store/Position";
import type { import type {
SalaryFormType, SalaryFormType,
CardDataPos, CardDataPos,
} from "@/modules/10_registry/interface/index/Main"; } from "@/modules/10_registry/interface/index/Main";
import type { DataCommandCode } from "@/modules/10_registry/interface/response/Main";
//history dialog //history dialog
import DialogHistory from "@/modules/10_registry/Dialog/DialogHistory.vue"; import DialogHistory from "@/modules/10_registry/Dialog/DialogHistory.vue";
@ -18,6 +20,7 @@ import DialogHistory from "@/modules/10_registry/Dialog/DialogHistory.vue";
const link = ref<string>(""); const link = ref<string>("");
const $q = useQuasar(); const $q = useQuasar();
const dataPerson = useDataStore(); const dataPerson = useDataStore();
const store = useGovernmentPosDataStore();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { const {
showLoader, showLoader,
@ -26,6 +29,7 @@ const {
date2Thai, date2Thai,
onSearchDataTable, onSearchDataTable,
formatDatePosition, formatDatePosition,
findOrgName,
} = mixin; } = mixin;
const idByRow = ref<string>(""); const idByRow = ref<string>("");
@ -54,75 +58,20 @@ const cardData = ref<CardDataPos[]>([
}, },
]); ]);
const visibleColumns = ref<string[]>([ const baseColumns = ref<QTableColumn[]>([
"commandDateAffect",
"amount",
"positionSalaryAmount",
"mouthSalaryAmount",
"posNo",
"positionName",
"positionType",
"positionLevel",
"commandName",
"refCommandNo",
"remark",
"lastUpdateFullName",
"lastUpdatedAt",
]);
const columns = computed(() => {
if (checkType.value == false) {
if (baseColumns.value) {
return baseColumns.value.filter(
(column) =>
column.name !== "positionSalaryAmount" &&
column.name !== "mouthSalaryAmount"
);
}
}
return baseColumns.value;
});
const baseColumns = ref<QTableProps["columns"]>([
{ {
name: "commandDateAffect", name: "commandDateAffect",
align: "left", align: "left",
label: "วัน เดือน ปี", label: "วันที่คำสั่งมีผล",
sortable: true, sortable: true,
field: "commandDateAffect", field: "commandDateAffect",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
format: (v) => date2Thai(v), format: (v) => date2Thai(v),
}, sort: (a: string, b: string) =>
{ a
name: "amount", .toString()
align: "left", .localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
label: checkType.value ? "เงินเดือน" : "ค่าตอบแทนรายเดือน",
sortable: true,
field: "amount",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (v) => Number(v).toLocaleString(),
},
{
name: "positionSalaryAmount",
align: "left",
label: "เงินประจำตำแหน่ง",
sortable: true,
field: "positionSalaryAmount",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (v) => Number(v).toLocaleString(),
},
{
name: "mouthSalaryAmount",
align: "left",
label: "เงินค่าตอบแทนรายเดือน",
sortable: true,
field: "mouthSalaryAmount",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (v) => Number(v).toLocaleString(),
}, },
{ {
name: "posNo", name: "posNo",
@ -139,33 +88,43 @@ const baseColumns = ref<QTableProps["columns"]>([
? row.posNo ? row.posNo
: "-"; : "-";
}, },
sort: (a: string, b: string) =>
a
.toString()
.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "positionName", name: "positionName",
align: "left", align: "left",
label: "ตำแหน่ง", label: link.value === "-employee" ? "ตำแหน่ง" : "ตำแหน่งในสายงาน",
sortable: true, sortable: true,
field: "positionName", field: "positionName",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) =>
a
.toString()
.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "positionType", name: "positionType",
align: "left", align: "left",
label: "ประเภทตำแหน่ง", label: link.value === "-employee" ? "กลุ่มงาน" : "ประเภทตำแหน่ง",
sortable: true, sortable: true,
field: "positionType", field: "positionType",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) =>
a
.toString()
.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "positionLevel", name: "positionLevel",
align: "left", align: "left",
label: "ระดับ", label: link.value === "-employee" ? "ระดับชั้นงาน" : "ระดับ",
sortable: true, sortable: true,
field: "positionLevel", field: "positionLevel",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format(val, row) { format(val, row) {
return `${ return `${
row.positionLevel row.positionLevel
@ -175,207 +134,10 @@ const baseColumns = ref<QTableProps["columns"]>([
: "-" : "-"
}`; }`;
}, },
},
{
name: "commandName",
align: "left",
label: "เอกสารอ้างอิง",
sortable: true,
field: "commandName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "refCommandNo",
align: "left",
label: "เลขที่คำสั่ง",
sortable: true,
field: "refCommandNo",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format(val, row) {
return row.commandNo && row.commandYear
? `${row.commandNo}/${row.commandYear}`
: "";
},
},
{
name: "remark",
align: "left",
label: "หมายเหตุ",
sortable: true,
field: "remark",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "lastUpdateFullName",
align: "left",
label: "ผู้ดำเนินการ",
sortable: true,
field: "lastUpdateFullName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "lastUpdatedAt",
align: "left",
label: "วันที่แก้ไข",
sortable: true,
field: "lastUpdatedAt",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (v) => date2Thai(v, false, true),
},
]);
const visibleColumnsHistory = ref<string[]>([
"commandDateAffect",
"amount",
"positionSalaryAmount",
"mouthSalaryAmount",
"oc",
"positionName",
"posNo",
"positionLine",
"positionPathSide",
"positionType",
"positionLevel",
"positionExecutive",
"positionExecutiveSide",
"salaryClass",
"commandName",
"refCommandNo",
"remark",
"lastUpdateFullName",
"lastUpdatedAt",
]);
const columnsHistory = computed(() => {
if (checkType.value == false) {
if (baseColumnsHistory.value) {
return baseColumnsHistory.value.filter(
(column) =>
column.name !== "positionSalaryAmount" &&
column.name !== "mouthSalaryAmount"
);
}
}
return baseColumns.value;
});
const baseColumnsHistory = ref<QTableProps["columns"]>([
{
name: "commandDateAffect",
align: "left",
label: "วัน เดือน ปี",
sortable: true,
field: "commandDateAffect",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (v) => date2Thai(v),
},
{
name: "amount",
align: "left",
label: checkType.value ? "เงินเดือน" : "ค่าตอบแทนรายเดือน",
sortable: true,
field: "amount",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (v) => Number(v).toLocaleString(),
},
{
name: "positionSalaryAmount",
align: "left",
label: "เงินประจำตำแหน่ง",
sortable: true,
field: "positionSalaryAmount",
headerStyle: "font-size: 14px",
format: (v) => Number(v).toLocaleString(),
style: "font-size: 14px",
},
{
name: "mouthSalaryAmount",
align: "left",
label: "เงินค่าตอบแทนรายเดือน",
sortable: true,
field: "mouthSalaryAmount",
headerStyle: "font-size: 14px",
format: (v) => Number(v).toLocaleString(),
style: "font-size: 14px",
},
{
name: "oc",
align: "left",
label: "สังกัด",
sortable: true,
field: "oc",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "posNo",
align: "left",
label: "ตำแหน่งเลขที่",
sortable: true,
field: "posNo",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format(val, row) {
return row.posNoAbb && row.posNo
? `${row.posNoAbb}${row.posNo}`
: row.posNo
? row.posNo
: "-";
},
},
{
name: "positionName",
align: "left",
label: "ตำแหน่ง",
sortable: true,
field: "positionName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "positionLine",
align: "left",
label: "สายงาน",
sortable: true,
field: "positionLine",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "positionPathSide",
align: "left",
label: "ด้าน/สาขา",
sortable: true,
field: "positionPathSide",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "positionType",
align: "left",
label: "ตำแหน่งประเภท",
sortable: true,
field: "positionType",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "positionLevel",
align: "left",
label: "ระดับ",
sortable: true,
field: "positionLevel",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "positionExecutive", name: "positionExecutive",
@ -385,47 +147,94 @@ const baseColumnsHistory = ref<QTableProps["columns"]>([
field: "positionExecutive", field: "positionExecutive",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "positionExecutiveSide", name: "amount",
align: "left", align: "left",
label: "ด้านทางการบริหาร", label: link.value === "-employee" ? "ค่าตอบแทนรายเดือน" : "เงินเดือน",
sortable: true, sortable: true,
field: "positionExecutiveSide", field: "amount",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
format(v, row) {
return row.amount
? `${row.amount.toLocaleString()}${
row.amountSpecial !== 0 && row.amountSpecial
? ` (${row.amountSpecial.toLocaleString()})`
: ""
}`
: "-";
},
sort: (a: string, b: string) =>
a
.toString()
.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "salaryClass", name: "commandNo",
align: "left",
label: "ตำแหน่ง (รายละเอียด)",
sortable: true,
field: "salaryClass",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "commandName",
align: "left",
label: "เอกสารอ้างอิง",
sortable: true,
field: "commandName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "refCommandNo",
align: "left", align: "left",
label: "เลขที่คำสั่ง", label: "เลขที่คำสั่ง",
sortable: true, sortable: true,
field: "refCommandNo", field: "commandNo",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format(val, row) { format(val, row) {
return row.commandNo && row.commandYear return row.commandNo && row.commandYear
? `${row.commandNo}/${row.commandYear}` ? `${row.commandNo}/${row.commandYear}`
: ""; : "";
}, },
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "commandCode",
align: "left",
label: "ประเภทคำสั่ง",
sortable: true,
field: "commandCode",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format(val, row) {
return store.convertCommandCodeName(val);
},
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "commandDateSign",
align: "left",
label: "วันที่ลงนาม",
sortable: true,
field: "commandDateSign",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (v) => date2Thai(v),
sort: (a: string, b: string) =>
a
.toString()
.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "organization",
align: "left",
label: "สังกัด",
sortable: true,
field: "organization",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format(val, row) {
return findOrgName({
root: row.orgRoot,
child1: row.orgChild1,
child2: row.orgChild2,
child3: row.orgChild3,
child4: row.orgChild4,
});
},
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "remark", name: "remark",
@ -435,6 +244,8 @@ const baseColumnsHistory = ref<QTableProps["columns"]>([
field: "remark", field: "remark",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "lastUpdateFullName", name: "lastUpdateFullName",
@ -444,6 +255,10 @@ const baseColumnsHistory = ref<QTableProps["columns"]>([
field: "lastUpdateFullName", field: "lastUpdateFullName",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) =>
a
.toString()
.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "lastUpdatedAt", name: "lastUpdatedAt",
@ -454,8 +269,42 @@ const baseColumnsHistory = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
format: (v) => date2Thai(v, false, true), format: (v) => date2Thai(v, false, true),
sort: (a: string, b: string) =>
a
.toString()
.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
]); ]);
const baseVisibleColumns = ref<string[]>([
"commandDateAffect",
"posNo",
"positionName",
"positionType",
"positionLevel",
"positionExecutive",
"amount",
"commandNo",
"commandCode",
"commandDateSign",
"organization",
"remark",
"lastUpdateFullName",
"lastUpdatedAt",
]);
const columns = ref<QTableColumn[]>(
baseColumns.value.filter(
(e: QTableColumn) =>
e.name !== "lastUpdateFullName" && e.name !== "lastUpdatedAt"
)
);
const visibleColumns = ref<String[]>(
baseVisibleColumns.value.filter(
(e: string) => e !== "lastUpdateFullName" && e !== "lastUpdatedAt"
)
);
const columnsHistory = ref<QTableColumn[]>(baseColumns.value);
const visibleColumnsHistory = ref<string[]>(baseVisibleColumns.value);
/** เปิด dialog ประวัติ*/ /** เปิด dialog ประวัติ*/
function onHistory(id: string) { function onHistory(id: string) {
@ -551,6 +400,29 @@ async function fetchDataTenure() {
}); });
} }
/** function fetch ข้อมูลประเภทคำสั่ง*/
async function fetchDataCommandCode() {
if (store.commandCodeData.length > 0) return false;
await http
.get(config.API.orgCommandCode)
.then((res) => {
const data = res.data.result;
const DataCommandCode = data.filter((e: DataCommandCode) =>
store.positionCode.includes(e.code)
);
const options = DataCommandCode.map((e: DataCommandCode) => ({
id: e.code.toString(),
name: e.name,
}));
store.commandCodeData = options;
})
.catch((err) => {
messageError($q, err);
});
}
onMounted(async () => { onMounted(async () => {
link.value = await dataPerson.getProFileType(); link.value = await dataPerson.getProFileType();
if (link.value === "-employee") { if (link.value === "-employee") {
@ -558,6 +430,7 @@ onMounted(async () => {
} }
getData(); getData();
fetchDataTenure(); fetchDataTenure();
fetchDataCommandCode();
}); });
</script> </script>

View file

@ -11,4 +11,14 @@ interface DataRequest {
topic: string; topic: string;
} }
export type { DataRequest }; interface DataCommandCode {
id: string;
createdAt: Date;
lastUpdatedAt: Date;
createdFullName: string;
lastUpdateFullName: string;
name: string;
code: number;
}
export type { DataRequest, DataCommandCode };

View file

@ -0,0 +1,35 @@
import { ref } from "vue";
import { defineStore } from "pinia";
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import type { DataOption } from "@/modules/10_registry/interface/index/Main";
const $q = useQuasar();
const mixin = useCounterMixin();
const {} = mixin;
export const useGovernmentPosDataStore = defineStore("GovernmentPos", () => {
// commandCode ขอตำแหน่ง
const positionCode = ref<number[]>([
0, 1, 2, 3, 4, 8, 9, 10, 11, 12, 13, 14, 15, 16,
]);
const commandCodeData = ref<DataOption[]>([]);
function convertCommandCodeName(val: string) {
return (
commandCodeData.value.find((e: DataOption) => e.id === val)?.name ?? "-"
);
}
return {
// Data
commandCodeData,
positionCode,
// Function
convertCommandCodeName,
};
});