ทะเบียนประวัติ => ตำแหน่งเงืนเดืน

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-03-27 13:51:34 +07:00
parent e5aad00fea
commit f89b3b97a9
4 changed files with 261 additions and 247 deletions

View file

@ -2,6 +2,7 @@ import env from "../index";
const registryNew = `${env.API_URI}/org/profile/`; const registryNew = `${env.API_URI}/org/profile/`;
const metadata = `${env.API_URI}/org/metadata/`; const metadata = `${env.API_URI}/org/metadata/`;
const salaryNew = `${env.API_URI}/org/profile/salary`;
export default { export default {
registryNew, registryNew,
@ -115,30 +116,30 @@ export default {
profileNewDisciplineHisByDisciplineId: (disciplineId: string) => profileNewDisciplineHisByDisciplineId: (disciplineId: string) =>
`${registryNew}discipline/history/${disciplineId}`, `${registryNew}discipline/history/${disciplineId}`,
// ปฏิบัติราชการพิเศษ // ปฏิบัติราชการพิเศษ
profileNewDuty: `${registryNew}duty`, profileNewDuty: `${registryNew}duty`,
profileNewDutyByProfileId: (profileId: string) => profileNewDutyByProfileId: (profileId: string) =>
`${registryNew}duty/${profileId}`, `${registryNew}duty/${profileId}`,
profileNewDutyByDutyId: (dutyId: string) => profileNewDutyByDutyId: (dutyId: string) => `${registryNew}duty/${dutyId}`,
`${registryNew}duty/${dutyId}`, profileNewDutyHisByDutyId: (dutyId: string) =>
profileNewDutyHisByDutyId: (dutyId: string) => `${registryNew}duty/history/${dutyId}`,
`${registryNew}duty/history/${dutyId}`,
//ข้อมูลราชการ
profileNewGovernment: () => `${registryNew}government`,
profileNewGovernmentById: (id: string) => `${registryNew}government/${id}`,
profileNewGovernmentHistory: (id: string) =>
`${registryNew}government/history/${id}`,
//ข้อมูลราชการ //การลา
profileNewGovernment:()=>`${registryNew}government`, profileNewLeave: () => `${registryNew}leave`,
profileNewGovernmentById:(id:string)=>`${registryNew}government/${id}`, profileNewLeaveById: (id: string) => `${registryNew}leave/${id}`,
profileNewGovernmentHistory:(id:string)=>`${registryNew}government/history/${id}`, profileNewLeaveHistory: (id: string) => `${registryNew}leave/history/${id}`,
profileCheckDate: () => `${env.API_URI}/leave/user/check`,
//การลา profileNewLeaveType: () => `${env.API_URI}/leave/type`,
profileNewLeave:()=>`${registryNew}leave`,
profileNewLeaveById:(id:string)=>`${registryNew}leave/${id}`,
profileNewLeaveHistory:(id:string)=>`${registryNew}leave/history/${id}`,
profileCheckDate:()=>`${env.API_URI}/leave/user/check`,
profileNewLeaveType:()=>`${env.API_URI}/leave/type`,
/** ตำแหน่งเงินเดือน*/ /** ตำแหน่งเงินเดือน*/
profileSalaryNew: `${env.API_URI}/org/profileSalary`, profileSalaryNew: `${salaryNew}`,
profileSalaryNewById: (id: string) => profileListSalaryNew: (id: string) => `${salaryNew}/${id}`,
`${env.API_URI}/org/profileSalary/${id}`, profileListSalaryHistoryNew: (profileId: string) =>
`${salaryNew}/history/${profileId}`,
}; };

View file

@ -6,7 +6,10 @@ import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
import type { DataOption2 } from "@/modules/04_registryNew/interface/index/Main"; import type {
DataOption2,
DataOption,
} from "@/modules/04_registryNew/interface/index/Main";
import type { ObjectSalaryRef } from "@/modules/04_registryNew/interface/index/salary"; import type { ObjectSalaryRef } from "@/modules/04_registryNew/interface/index/salary";
import type { FormSalaryNew } from "@/modules/04_registryNew/interface/request/Salary"; import type { FormSalaryNew } from "@/modules/04_registryNew/interface/request/Salary";
@ -40,8 +43,7 @@ const columns = ref<QTableProps["columns"]>([
field: "date", field: "date",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) => format: (v) => date2Thai(v),
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "amount", name: "amount",
@ -51,8 +53,7 @@ const columns = ref<QTableProps["columns"]>([
field: "amount", field: "amount",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) => format: (v) => Number(v).toLocaleString(),
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "positionSalaryAmount", name: "positionSalaryAmount",
@ -62,8 +63,7 @@ const columns = ref<QTableProps["columns"]>([
field: "positionSalaryAmount", field: "positionSalaryAmount",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) => format: (v) => Number(v).toLocaleString(),
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "mouthSalaryAmount", name: "mouthSalaryAmount",
@ -73,8 +73,7 @@ const columns = ref<QTableProps["columns"]>([
field: "mouthSalaryAmount", field: "mouthSalaryAmount",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) => format: (v) => Number(v).toLocaleString(),
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
@ -85,8 +84,6 @@ const columns = ref<QTableProps["columns"]>([
field: "posNo", field: "posNo",
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" }),
}, },
{ {
@ -97,8 +94,6 @@ const columns = ref<QTableProps["columns"]>([
field: "postionTypeName", field: "postionTypeName",
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: "positionLevelName", name: "positionLevelName",
@ -108,20 +103,16 @@ const columns = ref<QTableProps["columns"]>([
field: "positionLevelName", field: "positionLevelName",
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: "salaryRef", name: "templateDoc",
align: "left", align: "left",
label: "เอกสารอ้างอิง", label: "เอกสารอ้างอิง",
sortable: true, sortable: true,
field: "salaryRef", field: "templateDoc",
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: "refCommandNo", name: "refCommandNo",
@ -131,8 +122,6 @@ const columns = ref<QTableProps["columns"]>([
field: "refCommandNo", field: "refCommandNo",
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" }),
}, },
]); ]);
const visibleColumns = ref<string[]>([ const visibleColumns = ref<string[]>([
@ -143,7 +132,7 @@ const visibleColumns = ref<string[]>([
"posNo", "posNo",
"postionTypeName", "postionTypeName",
"positionLevelName", "positionLevelName",
"salaryRef", "templateDoc",
"refCommandNo", "refCommandNo",
]); ]);
const formFilter = reactive({ const formFilter = reactive({
@ -159,39 +148,39 @@ const pagination = ref({
}); });
const rows = ref<any>([ const rows = ref<any>([
{ // {
date: new Date(), // date: new Date(),
amount: 20000, // amount: 20000,
positionSalaryAmount: 20000, // positionSalaryAmount: 20000,
mouthSalaryAmount: 20000, // mouthSalaryAmount: 20000,
posNo: "1", // posNo: "1",
postionTypeName: "คำแหน่งประเภท", // postionTypeName: "",
positionLevelName: "ระดับ", // positionLevelName: "",
salaryRef: "เอกสารอ้างอิง", // salaryRef: "",
refCommandNo: "เลขที่คำสั่ง", // refCommandNo: "",
}, // },
{ // {
date: new Date(), // date: new Date(),
amount: 20000, // amount: 20000,
positionSalaryAmount: 20000, // positionSalaryAmount: 20000,
mouthSalaryAmount: 20000, // mouthSalaryAmount: 20000,
posNo: "1", // posNo: "1",
postionTypeName: "คำแหน่งประเภท", // postionTypeName: "",
positionLevelName: "ระดับ", // positionLevelName: "",
salaryRef: "เอกสารอ้างอิง", // salaryRef: "",
refCommandNo: "เลขที่คำสั่ง", // refCommandNo: "",
}, // },
{ // {
date: new Date(), // date: new Date(),
amount: 20000, // amount: 20000,
positionSalaryAmount: 20000, // positionSalaryAmount: 20000,
mouthSalaryAmount: 20000, // mouthSalaryAmount: 20000,
posNo: "1", // posNo: "1",
postionTypeName: "คำแหน่งประเภท", // postionTypeName: "",
positionLevelName: "ระดับ", // positionLevelName: "",
salaryRef: "เอกสารอ้างอิง", // salaryRef: "",
refCommandNo: "เลขที่คำสั่ง", // refCommandNo: "",
}, // },
]); ]);
const formDataSalary = reactive<FormSalaryNew>({ const formDataSalary = reactive<FormSalaryNew>({
@ -199,11 +188,11 @@ const formDataSalary = reactive<FormSalaryNew>({
posNo: "", posNo: "",
templatePos: "", templatePos: "",
position: "", position: "",
positionLineName: "", positionLine: "",
typePosition: "", positionPathSide: "",
levelPosition: "", positionType: "",
positionPathSideName: "", positionLevel: "",
positionExecutiveName: "", positionExecutive: "",
salaryCompensation: null, salaryCompensation: null,
salary: null, salary: null,
salaryPos: null, salaryPos: null,
@ -212,42 +201,25 @@ const formDataSalary = reactive<FormSalaryNew>({
doc: "", doc: "",
}); });
/** ตัวแปร ref สำหรับแสดง validate */
const dateRef = ref<Object | null>(null);
const posNoRef = ref<Object | null>(null);
const positionRef = ref<Object | null>(null);
const typePositionRef = ref<Object | null>(null);
const levelPositionRef = ref<Object | null>(null);
const salaryRef = ref<Object | null>(null);
const docRef = ref<Object | null>(null);
const ObjectRef: ObjectSalaryRef = {
date: dateRef,
posNo: posNoRef,
position: positionRef,
typePosition: typePositionRef,
levelPosition: levelPositionRef,
salary: salaryRef,
doc: docRef,
};
const modalDialogSalary = ref<boolean>(false); const modalDialogSalary = ref<boolean>(false);
const isStatusEdit = ref<boolean>(false); const isStatusEdit = ref<boolean>(false);
const salaryId = ref<string>("");
const dataLevel = ref<any[]>([]);
const posNoOptions = ref<DataOption2[]>(store.optionTemplatePos); const posNoOptions = ref<DataOption2[]>(store.optionTemplatePos);
const positionLineOptions = ref<DataOption2[]>(store.optionTemplatePos); const positionLineOptions = ref<DataOption2[]>(store.optionTemplatePos);
const posTypeOptions = ref<DataOption2[]>(store.optionTemplatePos); const posTypeOptions = ref<DataOption[]>([]);
const posLevelOption = ref<DataOption2[]>(store.optionTemplatePos); const posTypeOptionsMain = ref<DataOption[]>([]);
const posLevelOption = ref<DataOption[]>([]);
const posLevelOptionMain = ref<DataOption[]>([]);
const docOption = ref<DataOption2[]>(store.optionTemplateDoc); const docOption = ref<DataOption2[]>(store.optionTemplateDoc);
function fetchListSalary() { function fetchListSalary() {
showLoader(); showLoader();
http http
.get( .get(config.API.profileListSalaryNew(profileId.value))
config.API.profileSalaryNewById("59134ef9-9e62-41d0-aac5-339be727f2b1")
)
.then((res) => { .then((res) => {
// console.log(res);
rows.value = res.data.result; rows.value = res.data.result;
}) })
.catch((err) => { .catch((err) => {
@ -258,29 +230,58 @@ function fetchListSalary() {
}); });
} }
function onClickOpenDialog(statusEdit: boolean = false, data: any = []) { function fetchType() {
isStatusEdit.value = statusEdit; http
modalDialogSalary.value = true; .get(config.API.orgPosType)
.then((res) => {
dataLevel.value = res.data.result;
posTypeOptionsMain.value = res.data.result.map((e: any) => ({
id: e.id,
name: e.posTypeName,
}));
posTypeOptions.value = posTypeOptionsMain.value;
})
.catch((err) => {
messageError($q, err);
});
}
async function updateSelectType(val: string, status: boolean = false) {
const listLevel = await dataLevel.value.find((e: any) => e.id === val);
if (listLevel) {
posLevelOptionMain.value = listLevel.posLevels.map((e: any) => ({
id: e.id,
name: e.posLevelName,
}));
posLevelOption.value = posLevelOptionMain.value;
formDataSalary.positionLevel = !status ? "" : formDataSalary.positionLevel;
}
}
async function onClickOpenDialog(statusEdit: boolean = false, data: any = []) {
dataLevel.value.length === 0 && (await fetchType());
setTimeout(async () => {
statusEdit && (await updateSelectType(data.positionType, true));
isStatusEdit.value = statusEdit;
}, 500);
posLevelOptionMain.value = !statusEdit ? [] : posLevelOptionMain.value;
modalDialogSalary.value = true;
salaryId.value = data.id;
formDataSalary.date = statusEdit ? data.date : null; formDataSalary.date = statusEdit ? data.date : null;
formDataSalary.posNo = statusEdit ? data.posNo : ""; formDataSalary.posNo = statusEdit ? data.posNo : "";
// formDataSalary.templatePos = statusEdit ? data.templatePos : ""; formDataSalary.templatePos = "";
// formDataSalary.position = statusEdit ? data.position : ""; formDataSalary.position = statusEdit ? data.position : "";
// formDataSalary.positionLineName = statusEdit ? data.positionLineName : ""; formDataSalary.positionLine = statusEdit ? data.positionLine : "";
// formDataSalary.typePosition = statusEdit ? data.postionTypeName : ""; formDataSalary.positionType = statusEdit ? data.positionType : "";
// formDataSalary.levelPosition = statusEdit ? data.levelPosition : ""; formDataSalary.positionLevel = statusEdit ? data.positionLevel : "";
// formDataSalary.positionPathSideName = statusEdit formDataSalary.positionPathSide = statusEdit ? data.positionPathSide : "";
// ? data.positionPathSideName formDataSalary.positionExecutive = statusEdit ? data.positionExecutive : "";
// : "";
// formDataSalary.positionExecutiveName = statusEdit
// ? data.positionExecutiveName
// : "";
formDataSalary.salaryCompensation = statusEdit ? data.mouthSalaryAmount : ""; formDataSalary.salaryCompensation = statusEdit ? data.mouthSalaryAmount : "";
formDataSalary.salary = statusEdit ? data.amount : ""; formDataSalary.salary = statusEdit ? data.amount : "";
formDataSalary.salaryPos = statusEdit ? data.positionSalaryAmount : ""; formDataSalary.salaryPos = statusEdit ? data.positionSalaryAmount : "";
// formDataSalary.refCommandNo = statusEdit ? data.refCommandNo : ""; formDataSalary.refCommandNo = statusEdit ? data.refCommandNo : "";
// formDataSalary.templateDoc = statusEdit ? data.templateDoc : ""; formDataSalary.templateDoc = "";
formDataSalary.doc = statusEdit ? data.salaryRef : ""; formDataSalary.doc = statusEdit ? data.templateDoc : "";
} }
function onClickCloseDialog() { function onClickCloseDialog() {
@ -296,7 +297,7 @@ function filterSelector(val: any, update: Function, filtername: string) {
); );
}); });
break; break;
case "positionLineName": case "positionLine":
update(() => { update(() => {
positionLineOptions.value = store.optionTemplatePos.filter( positionLineOptions.value = store.optionTemplatePos.filter(
(v: DataOption2) => v.name.indexOf(val) > -1 (v: DataOption2) => v.name.indexOf(val) > -1
@ -305,15 +306,15 @@ function filterSelector(val: any, update: Function, filtername: string) {
break; break;
case "posType": case "posType":
update(() => { update(() => {
posTypeOptions.value = store.optionTemplatePos.filter( posTypeOptions.value = posTypeOptionsMain.value.filter(
(v: DataOption2) => v.name.indexOf(val) > -1 (v: DataOption) => v.name.indexOf(val) > -1
); );
}); });
break; break;
case "posLevel": case "posLevel":
update(() => { update(() => {
posLevelOption.value = store.optionTemplatePos.filter( posLevelOption.value = posLevelOptionMain.value.filter(
(v: DataOption2) => v.name.indexOf(val) > -1 (v: DataOption) => v.name.indexOf(val) > -1
); );
}); });
break; break;
@ -339,30 +340,46 @@ function updateDoc(val: string) {
} }
function onSubmit() { function onSubmit() {
const hasError = []; dialogConfirm($q, () => {
for (const key in ObjectRef) { submit();
if (Object.prototype.hasOwnProperty.call(ObjectRef, key)) { });
const property = ObjectRef[key];
if (property.value && typeof property.value.validate === "function") {
const isValid = property.value.validate();
hasError.push(isValid);
}
}
}
if (hasError.every((result) => result === true)) {
dialogConfirm($q, () => {
submit();
});
}
} }
async function submit() { async function submit() {
console.log(formDataSalary);
const formData = {
profileId: isStatusEdit.value ? undefined : profileId.value,
date: formDataSalary.date, //
posNo: formDataSalary.posNo, //
position: formDataSalary.position, //
positionLine: formDataSalary.positionLine, //
positionPathSide: formDataSalary.positionPathSide, // /
positionExecutive: formDataSalary.positionExecutive, //
positionType: formDataSalary.positionType, //
positionLevel: formDataSalary.positionLevel, //
amount:
typeof formDataSalary.salary === "number"
? formDataSalary.salary
: Number(formDataSalary?.salary?.replace(/,/g, "")), //
positionSalaryAmount:
typeof formDataSalary.salaryPos === "number"
? formDataSalary.salaryPos
: Number(formDataSalary?.salaryPos?.replace(/,/g, "")), //
mouthSalaryAmount:
typeof formDataSalary.salaryCompensation === "number"
? formDataSalary.salaryCompensation
: Number(formDataSalary?.salaryCompensation?.replace(/,/g, "")), //
refCommandNo: formDataSalary.refCommandNo, //
templateDoc: formDataSalary.doc, //
};
console.log(formData);
try { try {
const url = isStatusEdit.value const url = isStatusEdit.value
? config.API.profileSalaryNewById("12312") ? config.API.profileListSalaryNew(salaryId.value)
: config.API.profileSalaryNew; : config.API.profileSalaryNew;
const method = isStatusEdit.value ? "put" : "post"; const method = isStatusEdit.value ? "patch" : "post";
await http[method](url, formDataSalary); await http[method](url, formData);
fetchListSalary(); fetchListSalary();
onClickCloseDialog(); onClickCloseDialog();
success($q, "บันทึกข้อมูลสำเร็จ"); success($q, "บันทึกข้อมูลสำเร็จ");
@ -374,7 +391,8 @@ async function submit() {
} }
const modalHistory = ref<boolean>(false); const modalHistory = ref<boolean>(false);
function ocClikcHistory() { function onClikcHistory(id: string) {
salaryId.value = id;
modalHistory.value = true; modalHistory.value = true;
} }
@ -396,7 +414,13 @@ onMounted(() => {
class="q-mr-sm" class="q-mr-sm"
> >
<template v-slot:append> <template v-slot:append>
<q-icon name="search" /> <q-icon v-if="formFilter.keyword == ''" name="search" />
<q-icon
v-else
name="clear"
class="cursor-pointer"
@click="formFilter.keyword = ''"
/>
</template> </template>
</q-input> </q-input>
@ -421,6 +445,7 @@ onMounted(() => {
flat flat
bordered bordered
dense dense
:filter="formFilter.keyword"
:columns="columns" :columns="columns"
:rows="rows" :rows="rows"
:paging="true" :paging="true"
@ -471,20 +496,9 @@ onMounted(() => {
:key="col.id" :key="col.id"
@click="onClickOpenDialog(true, props.row)" @click="onClickOpenDialog(true, props.row)"
> >
<div v-if="col.name === 'date'"> <div class="table_ellipsis">
{{ col.value ? date2Thai(col.value) : "-" }} {{ col.value ? col.value : "-" }}
</div> </div>
<div v-else-if="col.name === 'amount'">
{{ col.value ? col.value.toLocaleString() : "-" }}
</div>
<div v-else-if="col.name === 'positionSalaryAmount'">
{{ col.value ? col.value.toLocaleString() : "-" }}
</div>
<div v-else-if="col.name === 'mouthSalaryAmount'">
{{ col.value ? col.value.toLocaleString() : "-" }}
</div>
<div v-else>{{ col.value ? col.value : "-" }}</div>
</q-td> </q-td>
<q-td auto-width> <q-td auto-width>
<q-btn <q-btn
@ -494,7 +508,7 @@ onMounted(() => {
round round
size="14px" size="14px"
icon="mdi-history" icon="mdi-history"
@click="ocClikcHistory" @click="onClikcHistory(props.row.id)"
> >
<q-tooltip>ประวแกไขตำแหน/เงนเดอน</q-tooltip> <q-tooltip>ประวแกไขตำแหน/เงนเดอน</q-tooltip>
</q-btn> </q-btn>
@ -517,7 +531,7 @@ onMounted(() => {
<q-dialog v-model="modalDialogSalary" persistent full-width> <q-dialog v-model="modalDialogSalary" persistent full-width>
<q-card> <q-card>
<form @submit.prevent.stop="onSubmit"> <q-form greedy @submit.prevent @validation-success="onSubmit">
<DialogHeader <DialogHeader
:tittle=" :tittle="
isStatusEdit ? 'แก้ไขตำแหน่งเงินเดือน' : 'เพิ่มตำแหน่งเงินเดือน' isStatusEdit ? 'แก้ไขตำแหน่งเงินเดือน' : 'เพิ่มตำแหน่งเงินเดือน'
@ -542,7 +556,6 @@ onMounted(() => {
}}</template> }}</template>
<template #trigger> <template #trigger>
<q-input <q-input
ref="dateRef"
outlined outlined
dense dense
borderless borderless
@ -622,7 +635,7 @@ onMounted(() => {
dense dense
lazy-rules lazy-rules
borderless borderless
v-model="formDataSalary.positionLineName" v-model="formDataSalary.positionLine"
:label="`${'สายงาน'}`" :label="`${'สายงาน'}`"
emit-value emit-value
map-options map-options
@ -633,7 +646,7 @@ onMounted(() => {
use-input use-input
input-debounce="0" input-debounce="0"
@filter="(inputValue: any, @filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, 'positionLineName' doneFn: Function) => filterSelector(inputValue, doneFn, 'positionLine'
)" )"
/> />
</div> </div>
@ -643,7 +656,7 @@ onMounted(() => {
outlined outlined
dense dense
lazy-rules lazy-rules
v-model="formDataSalary.positionPathSideName" v-model="formDataSalary.positionPathSide"
hide-bottom-space hide-bottom-space
:label="`${'ด้าน/สาขา'}`" :label="`${'ด้าน/สาขา'}`"
/> />
@ -654,7 +667,7 @@ onMounted(() => {
dense dense
lazy-rules lazy-rules
borderless borderless
v-model="formDataSalary.positionExecutiveName" v-model="formDataSalary.positionExecutive"
hide-bottom-space hide-bottom-space
:label="`${'ตำแหน่งทางการบริหาร'}`" :label="`${'ตำแหน่งทางการบริหาร'}`"
> >
@ -663,12 +676,12 @@ onMounted(() => {
<div class="col-xs-6 col-sm-6 col-md-4"> <div class="col-xs-6 col-sm-6 col-md-4">
<q-select <q-select
ref="typePositionRef" ref="positionType Ref"
outlined outlined
dense dense
lazy-rules lazy-rules
borderless borderless
v-model="formDataSalary.typePosition" v-model="formDataSalary.positionType"
:label="`${'ตำแหน่งประเภท'}`" :label="`${'ตำแหน่งประเภท'}`"
emit-value emit-value
map-options map-options
@ -678,6 +691,7 @@ onMounted(() => {
hide-bottom-space hide-bottom-space
use-input use-input
input-debounce="0" input-debounce="0"
@update:model-value="updateSelectType"
:rules="[(val: string) => !!val || `${'กรุณาเลือกตำแหน่งประเภท'}`]" :rules="[(val: string) => !!val || `${'กรุณาเลือกตำแหน่งประเภท'}`]"
@filter="(inputValue: any, @filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, 'posType' doneFn: Function) => filterSelector(inputValue, doneFn, 'posType'
@ -687,19 +701,19 @@ onMounted(() => {
<div class="col-xs-6 col-sm-6 col-md-4"> <div class="col-xs-6 col-sm-6 col-md-4">
<q-select <q-select
ref="levelPositionRef" ref="positionLevel Ref"
outlined outlined
dense dense
lazy-rules lazy-rules
borderless borderless
v-model="formDataSalary.levelPosition" v-model="formDataSalary.positionLevel"
:rules="[(val: string) => !!val || `${'กรุณาเลือกระดับตำแหน่ง'}`]" :rules="[(val: string) => !!val || `${'กรุณาเลือกระดับตำแหน่ง'}`]"
:label="`${'ระดับตำแหน่ง'}`" :label="`${'ระดับตำแหน่ง'}`"
emit-value emit-value
map-options map-options
option-label="name" option-label="name"
:options="posLevelOption" :options="posLevelOption"
option-value="name" option-value="id"
hide-bottom-space hide-bottom-space
use-input use-input
input-debounce="0" input-debounce="0"
@ -730,6 +744,7 @@ onMounted(() => {
dense dense
outlined outlined
v-model="formDataSalary.salaryPos" v-model="formDataSalary.salaryPos"
:rules="[(val) => !!val || `${'กรุณากรอกเงินประจำตำแหน่ง'}`]"
label="เงินประจำตำแหน่ง" label="เงินประจำตำแหน่ง"
mask="###,###,###,###" mask="###,###,###,###"
reverse-fill-mask reverse-fill-mask
@ -812,11 +827,11 @@ onMounted(() => {
<q-tooltip>นทกขอม</q-tooltip></q-btn <q-tooltip>นทกขอม</q-tooltip></q-btn
> >
</q-card-section> </q-card-section>
</form> </q-form>
</q-card> </q-card>
</q-dialog> </q-dialog>
<DialogHistory v-model:modal="modalHistory" /> <DialogHistory v-model:modal="modalHistory" v-model:salaryId="salaryId" />
</template> </template>
<style scoped></style> <style scoped></style>

View file

@ -1,12 +1,27 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive } from "vue"; import { ref, watch } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
import DialogHeader from "@/components/DialogHeader.vue"; import DialogHeader from "@/components/DialogHeader.vue";
import { useCounterMixin } from "@/stores/mixin";
const $q = useQuasar();
const {
date2Thai,
dialogConfirm,
showLoader,
hideLoader,
messageError,
success,
} = useCounterMixin();
const modal = defineModel<boolean>("modal", { required: true }); const modal = defineModel<boolean>("modal", { required: true });
const salaryId = defineModel<string>("salaryId", { required: true });
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
@ -17,8 +32,7 @@ const columns = ref<QTableProps["columns"]>([
field: "date", field: "date",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) => format: (v) => date2Thai(v),
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "amount", name: "amount",
@ -28,8 +42,7 @@ const columns = ref<QTableProps["columns"]>([
field: "amount", field: "amount",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) => format: (v) => Number(v).toLocaleString(),
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "positionSalaryAmount", name: "positionSalaryAmount",
@ -38,9 +51,8 @@ const columns = ref<QTableProps["columns"]>([
sortable: true, sortable: true,
field: "positionSalaryAmount", field: "positionSalaryAmount",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
format: (v) => Number(v).toLocaleString(),
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "mouthSalaryAmount", name: "mouthSalaryAmount",
@ -49,9 +61,8 @@ const columns = ref<QTableProps["columns"]>([
sortable: true, sortable: true,
field: "mouthSalaryAmount", field: "mouthSalaryAmount",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
format: (v) => Number(v).toLocaleString(),
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "oc", name: "oc",
@ -61,8 +72,6 @@ const columns = ref<QTableProps["columns"]>([
field: "oc", field: "oc",
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: "position", name: "position",
@ -72,8 +81,6 @@ const columns = ref<QTableProps["columns"]>([
field: "position", field: "position",
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: "posNo", name: "posNo",
@ -83,8 +90,6 @@ const columns = ref<QTableProps["columns"]>([
field: "posNo", field: "posNo",
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: "positionLine", name: "positionLine",
@ -94,8 +99,6 @@ const columns = ref<QTableProps["columns"]>([
field: "positionLine", field: "positionLine",
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: "positionPathSide", name: "positionPathSide",
@ -105,8 +108,6 @@ const columns = ref<QTableProps["columns"]>([
field: "positionPathSide", field: "positionPathSide",
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: "positionType", name: "positionType",
@ -116,8 +117,6 @@ const columns = ref<QTableProps["columns"]>([
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.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "positionLevel", name: "positionLevel",
@ -127,8 +126,6 @@ const columns = ref<QTableProps["columns"]>([
field: "positionLevel", 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",
@ -138,8 +135,6 @@ const columns = 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: "positionExecutiveSide",
@ -149,8 +144,6 @@ const columns = ref<QTableProps["columns"]>([
field: "positionExecutiveSide", field: "positionExecutiveSide",
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: "salaryClass", name: "salaryClass",
@ -160,19 +153,15 @@ const columns = ref<QTableProps["columns"]>([
field: "salaryClass", field: "salaryClass",
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: "salaryRef", name: "templateDoc",
align: "left", align: "left",
label: "เอกสารอ้างอิง", label: "เอกสารอ้างอิง",
sortable: true, sortable: true,
field: "salaryRef", field: "templateDoc",
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: "refCommandNo", name: "refCommandNo",
@ -182,8 +171,6 @@ const columns = ref<QTableProps["columns"]>([
field: "refCommandNo", field: "refCommandNo",
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: "createdFullName", name: "createdFullName",
@ -193,8 +180,6 @@ const columns = ref<QTableProps["columns"]>([
field: "createdFullName", field: "createdFullName",
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: "createdAt", name: "createdAt",
@ -204,8 +189,7 @@ const columns = ref<QTableProps["columns"]>([
field: "createdAt", field: "createdAt",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) => format: (v) => date2Thai(v),
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
]); ]);
const visibleColumns = ref<string[]>([ const visibleColumns = ref<string[]>([
@ -223,7 +207,7 @@ const visibleColumns = ref<string[]>([
"positionExecutive", "positionExecutive",
"positionExecutiveSide", "positionExecutiveSide",
"salaryClass", "salaryClass",
"salaryRef", "templateDoc",
"refCommandNo", "refCommandNo",
"createdFullName", "createdFullName",
"createdAt", "createdAt",
@ -234,11 +218,33 @@ const pagination = ref({
rowsPerPage: 10, rowsPerPage: 10,
}); });
const filter = ref<string>(""); const keyword = ref<string>("");
function closeDialog() { function closeDialog() {
modal.value = false; modal.value = false;
} }
function fetchListHistory() {
showLoader();
http
.get(config.API.profileListSalaryHistoryNew(salaryId.value))
.then((res) => {
rows.value = res.data.result;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
watch(
() => modal.value,
() => {
modal.value && fetchListHistory();
}
);
</script> </script>
<template> <template>
<q-dialog v-model="modal" persistent full-width> <q-dialog v-model="modal" persistent full-width>
@ -254,12 +260,18 @@ function closeDialog() {
<q-input <q-input
dense dense
outlined outlined
v-model="filter" v-model="keyword"
label="ค้นหา" label="ค้นหา"
class="q-mr-sm" class="q-mr-sm"
> >
<template v-slot:append> <template v-slot:append>
<q-icon name="search" /> <q-icon v-if="keyword === ''" name="search" />
<q-icon
v-else
name="clear"
class="cursor-pointer"
@click="keyword = ''"
/>
</template> </template>
</q-input> </q-input>
@ -278,51 +290,37 @@ function closeDialog() {
style="min-width: 150px" style="min-width: 150px"
/> />
</q-toolbar> </q-toolbar>
<d-table <d-table
ref="table" ref="table"
row-key="id" row-key="id"
flat flat
bordered bordered
dense dense
:filter="filter" :filter="keyword"
:columns="columns" :columns="columns"
:rows="rows" :rows="rows"
:paging="true" :paging="true"
v-model:pagination="pagination" v-model:pagination="pagination"
:rows-per-page-options="[20, 50, 100]" :rows-per-page-options="[10, 20, 50, 100]"
:visible-columns="visibleColumns" :visible-columns="visibleColumns"
> >
<template v-slot:header="props"> <template v-slot:header="props">
<q-tr :props="props"> <q-tr :props="props">
<q-th auto-width />
<q-th auto-width />
<q-th v-for="col in props.cols" :key="col.name" :props="props"> <q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span> <span class="text-weight-medium">{{ col.label }}</span>
</q-th> </q-th>
<q-th auto-width />
</q-tr> </q-tr>
</template> </template>
<template v-slot:body="props"> <template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer"> <q-tr :props="props" class="cursor-pointer">
<q-td v-for="col in props.cols" :key="col.id"> <q-td v-for="col in props.cols">
<template> <div class="table_ellipsis">
{{ col.value ? col.value : "-" }} {{ col.value ? col.value : "-" }}
</template> </div>
</q-td> </q-td>
</q-tr> </q-tr>
</template> </template>
<!-- <template v-slot:pagination="scope">
<q-pagination
v-model="formFilter.page"
active-color="primary"
color="dark"
:max="Number(maxPage)"
:max-pages="5"
size="sm"
boundary-links
direction-links
></q-pagination>
</template> -->
</d-table> </d-table>
</q-card-section> </q-card-section>
</q-card> </q-card>

View file

@ -3,14 +3,14 @@ interface FormSalaryNew {
posNo: string; posNo: string;
templatePos: string; templatePos: string;
position: string; position: string;
positionLineName: string; positionLine: string;
typePosition: string; positionPathSide: string;
levelPosition: string; positionType: string;
positionPathSideName: string; positionLevel: string;
positionExecutiveName: string; positionExecutive: string;
salary: number | null; salary: number | string | null;
salaryPos: number | null; salaryPos: number | string | null;
salaryCompensation: number | null; salaryCompensation: number | string | null;
refCommandNo: string; refCommandNo: string;
templateDoc: string; templateDoc: string;
doc: string; doc: string;