ทะเบียนประวัติ Position

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-02-24 16:34:36 +07:00
parent 24f68d129d
commit c60f2acd22
4 changed files with 732 additions and 28 deletions

View file

@ -38,8 +38,16 @@ export default {
dataUserDuty: `${profileOrg}/duty/user`,
dataUserDutyByType: (type: string) => `${org}/profile${type}/duty/user`,
dataUserActpositionByType: (type: string) => `${org}/profile${type}/actposition/user`,
dataUserAssistanceByType: (type: string) => `${org}/profile${type}/assistance/user`,
dataUserActpositionByType: (type: string) =>
`${org}/profile${type}/actposition/user`,
dataUserAssistanceByType: (type: string) =>
`${org}/profile${type}/assistance/user`,
//ตำแหน่ง
dataUserPosition: (type: string) =>
`${org}/profile${type}/salary/position/user`,
dataUserPositionHistory: (emType: string, id: string) =>
`${org}/profile${emType}/salary/position/history/${id}`,
dataUserSalary: `${profileOrg}/salary/user`,
dataUserSalaryByType: (type: string) => `${org}/profile${type}/salary/user`,

View file

@ -0,0 +1,632 @@
<script setup lang="ts">
import { useQuasar, type QTableProps } from "quasar";
import { ref, onMounted, computed } from "vue";
import http from "@/plugins/http";
import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import { useDataStore } from "@/stores/data";
import type { SalaryFormType } from "@/modules/10_registry/interface/index/Main";
//history dialog
import DialogHistory from "@/modules/10_registry/Dialog/DialogHistory.vue";
const link = ref<string>("");
const $q = useQuasar();
const dataPerson = useDataStore();
const mixin = useCounterMixin();
const { showLoader, hideLoader, messageError, date2Thai, onSearchDataTable } =
mixin;
const idByRow = ref<string>("");
const rows = ref<SalaryFormType[]>([]);
const rowsData = ref<SalaryFormType[]>([]);
const filter = ref<string>("");
const rowsHistory = ref<SalaryFormType[]>([]);
const rowsHistoryData = ref<SalaryFormType[]>([]);
const mode = ref<boolean>($q.screen.gt.xs);
const checkType = ref<boolean>(
dataPerson.officerType == "OFFICER" ? true : false
);
const modalHistory = ref<boolean>(false);
/** ตัวแปรข้อมูล */
const visibleColumns = ref<string[]>([
"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",
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",
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",
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: "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",
style: "font-size: 14px",
format(val, row) {
return `${
row.positionLevel
? row.positionLevel
: row.positionCee
? row.positionCee
: "-"
}`;
},
},
{
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",
style: "font-size: 14px",
},
{
name: "positionExecutive",
align: "left",
label: "ตำแหน่งทางการบริหาร",
sortable: true,
field: "positionExecutive",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "positionExecutiveSide",
align: "left",
label: "ด้านทางการบริหาร",
sortable: true,
field: "positionExecutiveSide",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "salaryClass",
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",
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),
},
]);
/** เปิด dialog ประวัติ*/
function onHistory(id: string) {
modalHistory.value = true;
idByRow.value = id;
}
/** get data */
function getData() {
showLoader();
http
.get(config.API.dataUserPosition(link.value))
.then((res) => {
const data = res.data.result;
rows.value = data;
rowsData.value = data;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
/** get history */
function getHistory() {
showLoader();
http
.get(config.API.dataUserSalaryHistoryByType(link.value, idByRow.value))
.then((res) => {
const data = res.data.result;
rowsHistory.value = data;
rowsHistoryData.value = data;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
function onSearch() {
rows.value = onSearchDataTable(
filter.value,
rowsData.value,
columns.value ? columns.value : []
);
}
onMounted(async () => {
link.value = await dataPerson.getProFileType();
getData();
});
</script>
<template>
<!-- v-if="mode" -->
<div class="col-12">
<q-toolbar class="q-px-none">
<span class="text-blue-6 text-weight-bold text-body1">ตำแหน</span>
<q-space />
<q-input
v-if="mode"
class="inputgreen"
outlined
dense
v-model="filter"
label="ค้นหา"
style="max-width: 200px"
@keydown.enter="onSearch"
>
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
<q-select
v-if="mode"
class="q-ml-sm"
dense
multiple
outlined
emit-value
map-options
options-dense
option-value="name"
style="min-width: 140px"
v-model="visibleColumns"
:options="columns"
:display-value="$q.lang.table.columns"
/>
</q-toolbar>
<d-table
flat
dense
bordered
virtual-scroll
:rows="rows.length !== 0 ? rows : []"
:columns="columns"
:grid="!mode"
:rows-per-page-options="[10, 25, 50, 100]"
:visible-columns="visibleColumns"
:virtual-scroll-sticky-size-start="48"
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
<q-th auto-width />
</q-tr>
</template>
<template v-if="mode" v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td v-for="(col, index) in props.cols" :key="col.name">
<div v-if="col.name == 'no'">
{{ props.rowIndex + 1 }}
</div>
<div v-else-if="col.name == 'status'">
{{ props.row.status ? props.row.status : "-" }}
</div>
<div v-else>
{{ col.value ? col.value : "-" }}
</div>
</q-td>
<q-td auto-width>
<q-btn
color="info"
flat
dense
round
size="14px"
icon="mdi-history"
@click="onHistory(props.row.id)"
>
<q-tooltip>ประวแกไขตำแหน/เงนเดอน</q-tooltip>
</q-btn>
</q-td>
</q-tr>
</template>
<template v-else v-slot:item="props">
<div class="q-mb-xs col-xs-12 col-sm-6 col-md-4 col-lg-3">
<q-card bordered flat>
<q-list dense class="q-mt-lg relative-position">
<q-btn
icon="mdi-history"
color="info"
flat
dense
round
size="14px"
class="absolute_button"
@click="onHistory(props.row.id)"
>
<q-tooltip>ประวแกไขตำแหน/เงนเดอน</q-tooltip>
</q-btn>
<q-item v-for="col in props.cols" :key="col.name">
<q-item-section class="fix_top">
<q-item-label class="text-grey-6 text-weight-medium">{{
col.label
}}</q-item-label>
</q-item-section>
<q-item-section class="fix_top">
<q-item-label class="text-dark text-weight-medium">{{
col.value ? col.value : "-"
}}</q-item-label>
</q-item-section>
</q-item>
</q-list>
</q-card>
</div>
</template>
</d-table>
</div>
<DialogHistory
v-model:modal="modalHistory"
:title="'ตำแหน่ง'"
:getData="getHistory"
:rows="rowsHistory"
:rows-data="rowsHistoryData"
:visibleColumns="visibleColumnsHistory"
:columns="columnsHistory"
/>
</template>
<style scoped>
.absolute_button {
position: absolute;
right: 5px;
top: -20px;
}
.fix_top {
justify-content: start !important;
}
</style>

View file

@ -33,15 +33,17 @@ const modalHistory = ref<boolean>(false);
/** ตัวแปรข้อมูล */
const visibleColumns = ref<string[]>([
"date",
"commandDateAffect",
"amount",
"positionSalaryAmount",
"mouthSalaryAmount",
"posNo",
"positionName",
"positionType",
"positionLevel",
"templateDoc",
"commandName",
"refCommandNo",
"remark",
"lastUpdateFullName",
"lastUpdatedAt",
]);
@ -61,11 +63,11 @@ const columns = computed(() => {
const baseColumns = ref<QTableProps["columns"]>([
{
name: "date",
name: "commandDateAffect",
align: "left",
label: "วัน เดือน ปี",
sortable: true,
field: "date",
field: "commandDateAffect",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (v) => date2Thai(v),
@ -100,7 +102,6 @@ const baseColumns = ref<QTableProps["columns"]>([
style: "font-size: 14px",
format: (v) => Number(v).toLocaleString(),
},
{
name: "posNo",
align: "left",
@ -109,8 +110,23 @@ const baseColumns = ref<QTableProps["columns"]>([
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: "positionType",
align: "left",
@ -128,14 +144,23 @@ const baseColumns = ref<QTableProps["columns"]>([
field: "positionLevel",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format(val, row) {
return `${
row.positionLevel
? row.positionLevel
: row.positionCee
? row.positionCee
: "-"
}`;
},
},
{
name: "templateDoc",
name: "commandName",
align: "left",
label: "เอกสารอ้างอิง",
sortable: true,
field: "templateDoc",
field: "commandName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
@ -147,6 +172,20 @@ const baseColumns = ref<QTableProps["columns"]>([
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",
@ -170,12 +209,12 @@ const baseColumns = ref<QTableProps["columns"]>([
]);
const visibleColumnsHistory = ref<string[]>([
"date",
"commandDateAffect",
"amount",
"positionSalaryAmount",
"mouthSalaryAmount",
"oc",
"position",
"positionName",
"posNo",
"positionLine",
"positionPathSide",
@ -184,8 +223,9 @@ const visibleColumnsHistory = ref<string[]>([
"positionExecutive",
"positionExecutiveSide",
"salaryClass",
"templateDoc",
"commandName",
"refCommandNo",
"remark",
"lastUpdateFullName",
"lastUpdatedAt",
]);
@ -205,11 +245,11 @@ const columnsHistory = computed(() => {
const baseColumnsHistory = ref<QTableProps["columns"]>([
{
name: "date",
name: "commandDateAffect",
align: "left",
label: "วัน เดือน ปี",
sortable: true,
field: "date",
field: "commandDateAffect",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (v) => date2Thai(v),
@ -253,15 +293,7 @@ const baseColumnsHistory = ref<QTableProps["columns"]>([
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: "posNo",
align: "left",
@ -270,6 +302,22 @@ const baseColumnsHistory = ref<QTableProps["columns"]>([
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",
@ -335,11 +383,11 @@ const baseColumnsHistory = ref<QTableProps["columns"]>([
style: "font-size: 14px",
},
{
name: "templateDoc",
name: "commandName",
align: "left",
label: "เอกสารอ้างอิง",
sortable: true,
field: "templateDoc",
field: "commandName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
@ -351,6 +399,20 @@ const baseColumnsHistory = ref<QTableProps["columns"]>([
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",

View file

@ -8,6 +8,7 @@ import Leave from "@/modules/10_registry/02_Government/03_Leave.vue";
import Duty from "@/modules/10_registry/02_Government/04_Duty.vue";
import Actposition from "@/modules/10_registry/02_Government/05_Actposition.vue";
import Assistance from "@/modules/10_registry/02_Government/06_Assistance.vue";
import Position from "@/modules/10_registry/02_Government/07_Position.vue";
const router = useRouter();
</script>
@ -30,11 +31,12 @@ const router = useRouter();
<div :class="`row q-my-sm ${$q.screen.gt.xs ? '' : 'mobileClass'}`">
<Government />
<Position />
<Actposition />
<Assistance />
<Discipline />
<Leave />
<Duty />
<Actposition />
<Assistance />
</div>
</template>
<style scoped>