hrms-mgt/src/modules/04_registryPerson/components/detail/Salary/01_PositionSalary.vue

1260 lines
40 KiB
Vue
Raw Normal View History

<script setup lang="ts">
import { ref, reactive, onMounted, computed } from "vue";
import { checkPermission } from "@/utils/permissions";
import { useQuasar } from "quasar";
import { useRoute } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
import type { QTableProps } from "quasar";
import type {
DataOption2,
DataOption,
2024-08-01 12:12:28 +07:00
} from "@/modules/04_registryPerson/interface/index/Main";
2024-08-01 12:12:28 +07:00
import type { FormSalaryNew } from "@/modules/04_registryPerson/interface/request/Salary";
import type {
ResListSalary,
ResType,
} from "@/modules/04_registryPerson/interface/response/Salary";
import DialogHeader from "@/components/DialogHeader.vue";
2024-08-01 12:12:28 +07:00
import DialogHistory from "@/modules/04_registryPerson/components/detail/Salary/01_PositionSalaryHistory.vue";
import { useCounterMixin } from "@/stores/mixin";
2024-08-01 12:12:28 +07:00
import { useSalaryDataStore } from "@/modules/04_registryPerson/stores/salary";
import DialogPreviewCommand from "@/modules/18_command/components/DialogPreviewCommand.vue";
const $q = useQuasar();
const route = useRoute();
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
2024-08-13 11:22:48 +07:00
/** props*/
2024-11-04 15:21:23 +07:00
const isLeave = defineModel<boolean>("isLeave", {
required: true,
2024-10-21 17:56:47 +07:00
});
const store = useSalaryDataStore();
const {
date2Thai,
dialogConfirm,
showLoader,
hideLoader,
messageError,
success,
2024-08-13 11:22:48 +07:00
pathRegistryEmp,
onSearchDataTable,
} = useCounterMixin();
2024-08-13 11:22:48 +07:00
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
//Table
const rows = ref<ResListSalary[]>([]); //รายการตำแหน่งเงินเดือน
const rowsMain = ref<ResListSalary[]>([]); //รายการตำแหน่งเงินเดือน
const keyword = ref<string>(""); //คำค้นหา
const modalCommand = ref<boolean>(false);
const command = ref<string>("");
const commandId = ref<string>("");
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: empType.value === "-employee" ? "ค่าตอบแทนรายเดือน" : "เงินเดือน",
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",
},
{
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",
format(val, row) {
return `${
row.positionLevel
? row.positionLevel
: row.positionCee
? row.positionCee
: "-"
}`;
},
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",
format(val, row) {
return row.commandNo && row.commandYear
? `${row.commandNo}/${row.commandYear}`
: "";
},
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "remark",
align: "left",
label: "หมายเหตุ",
sortable: true,
field: "remark",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]);
const columns = computed(() => {
if (empType.value === "-employee") {
if (baseColumns.value) {
return baseColumns.value.filter(
(column) =>
column.name !== "positionSalaryAmount" &&
column.name !== "mouthSalaryAmount"
);
}
}
return baseColumns.value;
});
const visibleColumns = ref<string[]>([
"commandDateAffect",
"amount",
"positionSalaryAmount",
"mouthSalaryAmount",
"posNo",
"positionName",
"positionType",
"positionLevel",
"commandName",
"refCommandNo",
"remark",
]);
const pagination = ref({
page: 1,
rowsPerPage: 10,
});
const formDataSalary = reactive<FormSalaryNew>({
date: null, //วัน/เดือน/ปี
posNo: "", //ตำแหน่งเลขที่
templatePos: "", //ต้นแบบ (template) ตำแหน่ง
position: "", //ตำแหน่ง
positionType: "", //ประเภทตำแหน่ง, กลุ่มงาน
positionLevel: "", //ระดับตำแหน่ง, ระดับชั้นงาน
positionLine: "", // สายงาน
positionPathSide: "", //ด้าน/สาขา
positionExecutive: "", //ตำแหน่งทางการบริหาร
salary: null, //เงินเดือน
salaryPos: null, //เงินประจำตำแหน่ง
salaryCompensation: null, //เงินค่าตอบแทนรายเดือน
refCommandNo: "", //เลขที่คำสั่ง
templateDoc: "", //ต้นแบบ (template) เอกสารอ้างอิง
doc: "", //เอกสารอ้างอิง
amountSpecial: null, //เงินค่าตอบแทนพิเศษ
});
const modalDialogSalary = ref<boolean>(false); //แสดง popup ตำแหน่งเงินเดือน
const isStatusEdit = ref<boolean>(false); //สถานะแก้ไขข้อมูลตำแหน่งเงินเดือน
const salaryId = ref<string>(""); //id ที่ต้องการแก้ไข
const dataLevel = ref<ResType[]>([]); //รายการ ตำแหน่งเงินเดือน
const posNoOptions = ref<DataOption2[]>(store.optionTemplatePos);
const posTypeOptions = ref<DataOption[]>([]);
const posTypeOptionsMain = ref<DataOption[]>([]);
const posLevelOption = ref<DataOption[]>([]);
const posLevelOptionMain = ref<DataOption[]>([]);
const positionFielOptiond = ref<DataOption[]>([]);
const positionFielOptiondMain = ref<DataOption[]>([]);
const positionAreaOptiond = ref<DataOption[]>([]);
const positionAreaOptiondMain = ref<DataOption[]>([]);
const posExecutiveOption = ref<DataOption[]>([]);
const posExecutiveOptionMain = ref<DataOption[]>([]);
const docOption = ref<DataOption2[]>(store.optionTemplateDoc);
/** function fetch รายการ ตำแหน่งเงินเดือน*/
2024-11-12 14:04:38 +07:00
async function fetchListSalary() {
showLoader();
2024-11-12 14:04:38 +07:00
await http
.get(config.API.profileListSalaryNew(profileId.value, empType.value))
.then((res) => {
rows.value = res.data.result;
rowsMain.value = res.data.result;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
/** function fetch รายการ ตำแหน่งเงินเดือน*/
function fetchType() {
http
.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);
});
}
/**
* function เลอกประเภทตำแหน
* @param val
* @param status
*/
async function updateSelectType(val: string, status: boolean = false) {
const listLevel = await dataLevel.value.find(
(e: any) => e.posTypeName === val
);
if (listLevel) {
posLevelOptionMain.value = listLevel.posLevels.map((e: any) => ({
id: e.id,
name:
empType.value === ""
? e.posLevelName
: `${listLevel.posTypeShortName} ${e.posLevelName}`,
}));
formDataSalary.positionLevel = !status ? "" : formDataSalary.positionLevel;
}
}
/**
* function เป dialog ตำแหนงเงนเดอน
* @param statusEdit แกไข,เพ
* @param data
*/
function onClickOpenDialog(statusEdit: boolean = false, data: any = []) {
if (empType.value === "") {
dataLevel.value.length === 0 && fetchType();
fetchDataOption();
fetchDataOptionExecutive();
} else {
fetchOptionGroup();
}
// หาระดับตำแหน่ง
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.posNo = statusEdit ? data.posNo : "";
formDataSalary.templatePos = "";
formDataSalary.position = statusEdit ? data.position : "";
formDataSalary.positionLine = statusEdit ? data.positionLine : "";
formDataSalary.positionType = statusEdit ? data.positionType : "";
formDataSalary.positionLevel = statusEdit ? data.positionLevel : "";
formDataSalary.positionPathSide = statusEdit ? data.positionPathSide : "";
formDataSalary.positionExecutive = statusEdit ? data.positionExecutive : "";
formDataSalary.salaryCompensation = statusEdit ? data.mouthSalaryAmount : "";
2025-01-13 13:07:15 +07:00
formDataSalary.salary = statusEdit
? data.amount
? data.amount.toLocaleString()
: ""
: "";
formDataSalary.salaryPos = statusEdit
2025-01-13 13:07:15 +07:00
? data.positionSalaryAmount
? data.positionSalaryAmount.toLocaleString()
: ""
: "";
formDataSalary.refCommandNo = statusEdit ? data.refCommandNo : "";
formDataSalary.templateDoc = "";
formDataSalary.doc = statusEdit ? data.templateDoc : "";
2024-12-24 17:49:14 +07:00
formDataSalary.amountSpecial = statusEdit
? data.amountSpecial === 0
? ""
: data.amountSpecial
: "";
}
/** function ปิด dialog ตำแหน่งเงินเดือน*/
function onClickCloseDialog() {
modalDialogSalary.value = false;
}
/**
* ลเตอรอมลจาก input
* @param val าทอนให input
* @param update function จาก quasar
* @param filtername type กำหนด ของ input นๆ
*/
function filterSelector(val: string, update: Function, filtername: string) {
switch (filtername) {
case "pos":
update(() => {
posNoOptions.value = store.optionTemplatePos.filter(
(v: DataOption2) => v.name.indexOf(val) > -1
);
});
break;
case "positionLine":
update(() => {
positionFielOptiond.value = positionFielOptiondMain.value.filter(
(v: DataOption) => v.name.indexOf(val) > -1
);
});
break;
case "posType":
update(() => {
posTypeOptions.value = posTypeOptionsMain.value.filter(
(v: DataOption) => v.name.indexOf(val) > -1
);
});
break;
case "posLevel":
update(() => {
posLevelOption.value = posLevelOptionMain.value.filter(
(v: DataOption) => v.name.indexOf(val) > -1
);
});
break;
case "doc":
update(() => {
docOption.value = store.optionTemplateDoc.filter(
(v: DataOption2) => v.name.indexOf(val) > -1
);
});
break;
case "positionPathSide":
update(() => {
positionAreaOptiond.value = positionAreaOptiondMain.value.filter(
(v: DataOption) => v.name.indexOf(val) > -1
);
});
break;
case "positionExecutive":
update(() => {
posExecutiveOption.value = posExecutiveOptionMain.value.filter(
(v: DataOption) => v.name.indexOf(val) > -1
);
});
break;
default:
break;
}
}
/**
* function เลอกตนแบบ tamplate ตำแหน
* @param val
*/
function updatePos(val: string) {
formDataSalary.position = val;
}
/**
* function เลอกตนแบบ tamplate เอกสาร
* @param val
*/
function updateDoc(val: string) {
formDataSalary.doc = val;
}
/** function ยืนยันการบันทึกข้อมูล */
function onSubmit() {
dialogConfirm($q, async () => {
showLoader();
const formData = {
profileEmployeeId:
!isStatusEdit.value && empType.value !== ""
? profileId.value
: undefined,
profileId:
!isStatusEdit.value && empType.value === ""
? profileId.value
: undefined,
date: formDataSalary.date, // วันที่
posNo: formDataSalary.posNo, //ตำแหน่งเลขที่
position: formDataSalary.position, //ตำแหน่ง
positionLine:
empType.value === "" ? formDataSalary.positionLine : undefined, //สายงาน
positionPathSide:
empType.value === "" ? formDataSalary.positionPathSide : undefined, // ด้าน/สาขา
positionExecutive:
empType.value === "" ? formDataSalary.positionExecutive : undefined, //ตำแหน่งทางการบริหาร
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, "")), //เงินค่าตอบแทนรายเดือน
amountSpecial:
typeof formDataSalary.amountSpecial === "number"
? formDataSalary.amountSpecial
: Number(formDataSalary?.amountSpecial?.replace(/,/g, "")), //เงินค่าตอบแทนพิเศษ
refCommandNo: formDataSalary.refCommandNo, // เลขที่คำสั่ง
templateDoc: formDataSalary.doc, // เอกสารอ้างอิง
};
try {
const url = isStatusEdit.value
? config.API.profileListSalaryNew(salaryId.value, empType.value)
: config.API.profileSalaryNew(empType.value);
const method = isStatusEdit.value ? "patch" : "post";
await http[method](url, formData);
2024-11-12 14:04:38 +07:00
await onClickCloseDialog();
await fetchListSalary();
success($q, "บันทึกข้อมูลสำเร็จ");
} catch (e) {
messageError($q, e);
hideLoader();
} finally {
}
});
}
/**
* function เลอนรายการเงนเดอนข
* @param id รายการเงนเดอน
*/
2024-03-28 16:00:41 +07:00
function onSwapUp(id: string) {
showLoader();
http
.get(config.API.profileSalarySwapNew("up", id, empType.value))
.then(async () => {
await fetchListSalary();
2024-03-28 16:00:41 +07:00
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
/**
* function เลอนรายการเงนเดอนลง
* @param id รายการเงนเดอน
*/
2024-03-28 16:00:41 +07:00
function onSwapDown(id: string) {
showLoader();
http
.get(config.API.profileSalarySwapNew("down", id, empType.value))
.then(async () => {
await fetchListSalary();
2024-03-28 16:00:41 +07:00
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
const modalHistory = ref<boolean>(false);
/**
* function อมลประวการแกไขรายการเงนเดอน
* @param id รายการเงนเดอน
*/
function onClikcHistory(id: string) {
salaryId.value = id;
modalHistory.value = true;
}
/** function fetch ข้อมูลสายงาน*/
function fetchDataOption() {
showLoader();
http
.get(config.API.orgPosPosition + `?keyword=&type=ALL`)
.then((res) => {
const data = res.data.result;
const seen = new Set();
const seen2 = new Set();
const listPositionField = data.filter((item: any) => {
if (seen.has(item.positionField)) {
return false;
} else {
seen.add(item.positionField);
return true;
}
});
positionFielOptiondMain.value = listPositionField.map((e: any) => ({
id: e.positionField,
name: e.positionField,
}));
const listPositionArea = data.filter((item: any) => {
if (
item.positionArea === null ||
item.positionArea === "" ||
item.positionArea === "-" ||
seen2.has(item.positionArea)
) {
return false;
} else {
seen2.add(item.positionArea);
return true;
}
});
positionAreaOptiondMain.value = listPositionArea.map((e: any) => ({
id: e.positionArea,
name: e.positionArea,
}));
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
/** function fetch ข้อมูลตำแหน่งข้อมูลทางการบริหาร*/
function fetchDataOptionExecutive() {
showLoader();
http
.get(config.API.orgPosExecutive)
.then((res) => {
const data = res.data.result;
posExecutiveOptionMain.value = data.map((e: any) => ({
id: e.posExecutiveName,
name: e.posExecutiveName,
}));
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
/** function fetch ข้อมูลปรเภทตำแหน่ง*/
function fetchOptionGroup() {
showLoader();
http
.get(config.API.orgEmployeeType)
.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);
})
.finally(() => {
hideLoader();
});
}
const classInput = (val: boolean) => {
return {
"full-width inputgreen cursor-pointer": val,
"full-width cursor-pointer": !val,
};
};
function onRefCommand(data: ResListSalary) {
modalCommand.value = true;
command.value = data.refCommandNo;
commandId.value = data.commandId;
// commandId.value = 'bdf9da91-ba45-497a-a2b7-cc49e2446d97'; //จำลอง
}
function serchDataTable() {
rows.value = onSearchDataTable(
keyword.value,
rowsMain.value,
columns.value ? columns.value : []
);
}
/** ทำงานเมื่อ Components ถูกเรียกใช้งาน*/
onMounted(() => {
fetchListSalary();
});
</script>
<template>
<div class="row items-center q-gutter-x-sm q-pb-sm">
<q-btn
2024-11-04 15:21:23 +07:00
v-if="!isLeave && checkPermission($route)?.attrIsUpdate"
flat
color="primary"
round
dense
icon="add"
@click="onClickOpenDialog()"
>
<q-tooltip>เพมขอม</q-tooltip>
</q-btn>
<q-space />
<q-input
dense
outlined
v-model="keyword"
label="ค้นหา"
class="q-mr-sm"
@keydown.enter.pervent="serchDataTable"
>
<template v-slot:append>
2024-12-03 10:49:23 +07:00
<q-icon name="search" />
</template>
</q-input>
<q-select
v-model="visibleColumns"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columns"
option-value="name"
2024-11-05 16:33:46 +07:00
style="min-width: 140px"
/>
</div>
<d-table
ref="table"
row-key="id"
flat
bordered
dense
:columns="columns"
:rows="rows"
:paging="true"
v-model:pagination="pagination"
:rows-per-page-options="[10, 20, 50, 100]"
:visible-columns="visibleColumns"
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th auto-width />
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props">
2024-08-13 11:22:48 +07:00
<q-td>
<q-btn
flat
dense
round
color="deep-purple"
icon="mdi-history"
@click="onClikcHistory(props.row.id)"
>
<q-tooltip>ประวแกไขตำแหน/เงนเดอน</q-tooltip>
</q-btn>
<q-btn
2024-11-04 15:21:23 +07:00
v-if="isLeave == false && checkPermission($route)?.attrIsUpdate"
flat
:disable="
props.row.commandId !== null && props.row.commandId !== ''
"
2025-01-13 13:50:28 +07:00
:color="props.row.commandId ? 'grey' : 'edit'"
dense
round
icon="edit"
clickable
@click="onClickOpenDialog(true, props.row)"
>
<q-tooltip>แกไขขอม</q-tooltip>
</q-btn>
2024-08-13 11:22:48 +07:00
<q-btn
2024-11-04 15:21:23 +07:00
v-if="isLeave == false && checkPermission($route)?.attrIsUpdate"
2024-08-13 11:22:48 +07:00
dense
flat
round
:color="props.rowIndex + 1 == 1 ? 'grey' : 'green'"
:disable="props.rowIndex + 1 == 1"
icon="mdi-arrow-up-bold"
@click="onSwapUp(props.row.id)"
>
</q-btn>
<q-btn
2024-11-04 15:21:23 +07:00
v-if="isLeave == false && checkPermission($route)?.attrIsUpdate"
2024-08-13 11:22:48 +07:00
dense
flat
round
:color="rows.length == props.rowIndex + 1 ? 'grey' : 'red'"
:disable="rows.length == props.rowIndex + 1"
icon="mdi-arrow-down-bold"
@click="onSwapDown(props.row.id)"
>
</q-btn>
</q-td>
2024-10-21 17:56:47 +07:00
2024-07-24 16:37:04 +07:00
<q-td v-for="col in props.cols" :key="col.id">
<div
2024-10-28 18:09:33 +07:00
v-if="col.name == 'refCommandNo' && props.row.commandId"
@click="col.value ? onRefCommand(props.row) : null"
:class="
col.value
? 'table_ellipsis text-blue cursor-pointer'
: 'table_ellipsis'
"
>
{{ col.value ? col.value : "-" }}
2024-10-28 18:09:33 +07:00
<q-tooltip v-if="col.value">ดูคำสั่ง</q-tooltip>
</div>
<div v-else-if="col.name == 'amount'">
{{
props.row.amount
2024-12-10 13:54:37 +07:00
? `${props.row.amount.toLocaleString()}${
props.row.amountSpecial !== 0 && props.row.amountSpecial
2024-12-13 16:22:29 +07:00
? ` (${props.row.amountSpecial.toLocaleString()})`
: ""
}`
: "-"
}}
</div>
2024-10-28 18:09:33 +07:00
<div v-else-if="col.name == 'refCommandNo' && !props.row.commandId">
-
</div>
<div v-else class="table_ellipsis">
2024-07-24 16:37:04 +07:00
{{ col.value ? col.value : "-" }}
</div>
</q-td>
</q-tr>
</template>
</d-table>
<q-dialog v-model="modalDialogSalary" persistent>
<q-card style="width: 900px; max-width: 80vw">
<q-form greedy @submit.prevent @validation-success="onSubmit">
<DialogHeader
:tittle="
isStatusEdit ? 'แก้ไขตำแหน่ง/เงินเดือน' : 'เพิ่มตำแหน่ง/เงินเดือน'
"
:close="onClickCloseDialog"
/>
<q-separator color="grey-4" />
<q-card-section style="max-height: 100%" class="scroll">
<div class="row col-12 q-col-gutter-sm">
<div class="col-xs-6 col-sm-6 col-md-6">
<datepicker
v-model="formDataSalary.date"
:locale="'th'"
autoApply
:enableTimePicker="false"
week-start="0"
:class="classInput(true)"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
outlined
dense
borderless
:model-value="date2Thai(formDataSalary.date)"
:rules="[
(val: string) =>
!!val ||
`${'กรุณาเลือก วัน/เดือน/ปี'}`,
]"
:label="`${'วัน/เดือน/ปี'}`"
hide-bottom-space
>
<template v-slot:prepend>
<q-icon
name="event"
color="primary"
class="cursor-pointer"
>
</q-icon>
</template>
</q-input>
</template>
</datepicker>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
ref="posNoRef"
:class="classInput(true)"
outlined
dense
lazy-rules
borderless
v-model="formDataSalary.posNo"
hide-bottom-space
:label="`${'ตำแหน่งเลขที่'}`"
2024-12-20 13:33:24 +07:00
:rules="empType !== '-temp'? [(val: string) => !!val || `${'กรุณากรอกตำแหน่งเลขที่'}`]:[]"
>
</q-input>
</div>
<div class="col-xs-12 col-sm-12 col-md-12">
<q-select
ref="templatePosRef"
:class="classInput(true)"
outlined
dense
lazy-rules
borderless
clearable
v-model="formDataSalary.templatePos"
:label="`${'ต้นแบบ (template) ตำแหน่ง'}`"
option-label="name"
:options="posNoOptions"
option-value="name"
hide-bottom-space
emit-value
use-input
2024-12-03 10:49:23 +07:00
hide-selected
fill-input
input-debounce="0"
@update:modelValue="updatePos"
@filter="(inputValue: string,
doneFn: Function) => filterSelector(inputValue, doneFn, 'pos'
)"
2024-12-03 10:49:23 +07:00
>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
ไมอม
</q-item-section>
</q-item>
</template></q-select
>
</div>
<div class="col-xs-12 col-sm-12 col-md-12">
<q-input
ref="positionRef"
:class="classInput(true)"
outlined
dense
lazy-rules
borderless
v-model="formDataSalary.position"
:label="`${'ตำแหน่ง'}`"
type="textarea"
hide-bottom-space
:rules="[(val: string) => !!val || `${'กรุณากรอกตำแหน่ง'}`]"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-4">
<q-select
ref="positionType Ref"
outlined
:class="classInput(true)"
dense
lazy-rules
borderless
v-model="formDataSalary.positionType"
:label="empType == '' ? 'ประเภทตำแหน่ง' : 'กลุ่มงาน'"
emit-value
map-options
option-label="name"
:options="posTypeOptions"
option-value="name"
hide-bottom-space
use-input
2024-12-03 10:49:23 +07:00
hide-selected
fill-input
input-debounce="0"
@update:model-value="updateSelectType"
:rules="empType == '' ? [(val: string) => !!val || 'กรุณาเลือกประเภทตำแหน่ง' ]:[(val: string) => !!val || 'กรุณาเลือกกลุ่มงาน' ]"
@filter="(inputValue: string,
doneFn: Function) => filterSelector(inputValue, doneFn, 'posType'
)"
2024-12-03 10:49:23 +07:00
>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
ไมอม
</q-item-section>
</q-item>
</template>
</q-select>
</div>
<div class="col-xs-6 col-sm-6 col-md-4">
<q-select
:class="classInput(true)"
ref="positionLevel Ref"
outlined
dense
lazy-rules
borderless
v-model="formDataSalary.positionLevel"
:rules="empType == '' ? [(val: string) => !!val || 'กรุณาเลือกระดับตำแหน่ง' ] : [(val: string) => !!val || 'กรุณาเลือกระดับชั้นงาน']"
:label="empType == '' ? 'ระดับตำแหน่ง' : 'ระดับชั้นงาน'"
emit-value
map-options
option-label="name"
:options="posLevelOption"
option-value="name"
hide-bottom-space
use-input
2024-12-03 10:49:23 +07:00
hide-selected
fill-input
input-debounce="0"
@filter="(inputValue: string,
doneFn: Function) => filterSelector(inputValue, doneFn, 'posLevel'
)"
2024-12-03 10:49:23 +07:00
><template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
ไมอม
</q-item-section>
</q-item>
</template>
</q-select>
</div>
<div class="col-md-4"></div>
<div class="col-xs-6 col-sm-6 col-md-4" v-if="empType == ''">
<q-select
outlined
:class="classInput(true)"
dense
lazy-rules
borderless
v-model="formDataSalary.positionLine"
:label="`${'สายงาน'}`"
emit-value
map-options
option-label="name"
:options="positionFielOptiond"
option-value="id"
hide-bottom-space
use-input
2024-12-03 10:49:23 +07:00
hide-selected
fill-input
clearable
input-debounce="0"
@filter="(inputValue: string,
doneFn: Function) => filterSelector(inputValue, doneFn, 'positionLine'
)"
2024-12-03 10:49:23 +07:00
>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
ไมอม
</q-item-section>
</q-item>
</template></q-select
>
</div>
<div class="col-xs-6 col-sm-6 col-md-4" v-if="empType == ''">
<q-select
:class="classInput(true)"
outlined
dense
lazy-rules
borderless
v-model="formDataSalary.positionPathSide"
:label="`${'ด้าน/สาขา'}`"
emit-value
map-options
option-label="name"
:options="positionAreaOptiond"
option-value="id"
hide-bottom-space
use-input
2024-12-03 10:49:23 +07:00
hide-selected
fill-input
clearable
input-debounce="0"
@filter="(inputValue: string,
doneFn: Function) => filterSelector(inputValue, doneFn, 'positionPathSide'
)"
2024-12-03 10:49:23 +07:00
>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
ไมอม
</q-item-section>
</q-item>
</template>
</q-select>
</div>
<div class="col-xs-6 col-sm-6 col-md-4" v-if="empType == ''">
<q-select
:class="classInput(true)"
outlined
dense
lazy-rules
borderless
v-model="formDataSalary.positionExecutive"
:label="`${'ตำแหน่งทางการบริหาร'}`"
emit-value
map-options
option-label="name"
:options="posExecutiveOption"
option-value="id"
hide-bottom-space
use-input
2024-12-03 10:49:23 +07:00
hide-selected
fill-input
input-debounce="0"
clearable
@filter="(inputValue: string,
doneFn: Function) => filterSelector(inputValue, doneFn, 'positionExecutive'
)"
2024-12-03 10:49:23 +07:00
>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
ไมอม
</q-item-section>
</q-item>
</template>
</q-select>
</div>
<div class="col-xs-6 col-sm-6 col-md-4">
<q-input
:class="classInput(true)"
ref="salaryRef"
dense
outlined
v-model="formDataSalary.salary"
label="เงินเดือน"
mask="###,###,###,###"
reverse-fill-mask
:rules="[(val:string) => !!val || `${'กรุณากรอกเงินเดือน'}`]"
lazy-rules
hide-bottom-space
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-4">
<q-input
:class="classInput(true)"
ref="amountRef"
dense
outlined
v-model="formDataSalary.salaryPos"
label="เงินประจำตำแหน่ง"
mask="###,###,###,###"
reverse-fill-mask
lazy-rules
hide-bottom-space
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-4">
<q-input
:class="classInput(true)"
ref="amountRef"
dense
outlined
v-model="formDataSalary.salaryCompensation"
label="เงินค่าตอบแทนรายเดือน"
mask="###,###,###,###"
reverse-fill-mask
lazy-rules
hide-bottom-space
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-4">
<q-input
:class="classInput(true)"
ref="amountSpecialRef"
dense
outlined
v-model="formDataSalary.amountSpecial"
label="เงินค่าตอบแทนพิเศษ"
mask="###,###,###,###"
reverse-fill-mask
hide-bottom-space
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-12">
<q-input
:class="classInput(true)"
outlined
dense
lazy-rules
borderless
v-model="formDataSalary.refCommandNo"
hide-bottom-space
:label="`${'เลขที่คำสั่ง'}`"
>
2025-01-13 13:07:15 +07:00
<!-- mask="#####################" -->
<!-- :rules="[(val: string) => !!val || `${'กรุณากรอกเลขที่คำสั่ง'}`]" -->
</q-input>
</div>
<div class="col-xs-12 col-sm-12 col-md-12">
<q-select
:class="classInput(true)"
ref="templateDocRef"
outlined
dense
lazy-rules
borderless
clearable
v-model="formDataSalary.templateDoc"
:label="`${'ต้นแบบ (template) เอกสารอ้างอิง'}`"
option-label="name"
:options="docOption"
option-value="name"
emit-value
hide-bottom-space
use-input
2024-12-03 10:49:23 +07:00
hide-selected
fill-input
input-debounce="0"
@update:modelValue="updateDoc"
@filter="(inputValue: string,
doneFn: Function) => filterSelector(inputValue, doneFn, 'doc'
)"
2024-12-03 10:49:23 +07:00
>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
ไมอม
</q-item-section>
</q-item>
</template>
</q-select>
</div>
<div class="col-xs-12 col-sm-12 col-md-12">
<q-input
:class="classInput(true)"
ref="docRef"
outlined
dense
borderless
v-model="formDataSalary.doc"
:label="`${'เอกสารอ้างอิง'}`"
type="textarea"
/>
</div>
</div>
</q-card-section>
<q-separator />
<q-card-actions align="right">
<q-btn label="บันทึก" id="onSubmit" type="submit" color="public">
<q-tooltip>นทกขอม</q-tooltip>
</q-btn>
</q-card-actions>
</q-form>
</q-card>
</q-dialog>
<DialogHistory v-model:modal="modalHistory" v-model:salaryId="salaryId" />
<DialogPreviewCommand
v-model:modal="modalCommand"
v-model:command="command"
v-model:commandId="commandId"
/>
</template>
<style scoped></style>