ทะเบียนประวัติ => ข้อมูลผลงานและเครื่องราชฯ

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-08-16 15:35:15 +07:00
parent 0e290d0c94
commit a268461792
6 changed files with 232 additions and 137 deletions

View file

@ -14,6 +14,10 @@ import type {
} from "@/modules/04_registryPerson/interface/index/Main";
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";
import DialogHistory from "@/modules/04_registryPerson/components/detail/Salary/01_PositionSalaryHistory.vue";
@ -130,7 +134,6 @@ const baseColumns = ref<QTableProps["columns"]>([
style: "font-size: 14px",
},
]);
const columns = computed(() => {
if (empType.value === "-employee") {
if (baseColumns.value) {
@ -143,7 +146,6 @@ const columns = computed(() => {
}
return baseColumns.value;
});
const visibleColumns = ref<string[]>([
"date",
"amount",
@ -155,18 +157,12 @@ const visibleColumns = ref<string[]>([
"templateDoc",
"refCommandNo",
]);
const formFilter = reactive({
page: 1,
pageSize: 10,
keyword: "",
});
const pagination = ref({
page: 1,
rowsPerPage: 10,
});
const rows = ref<any[]>([]);
const rows = ref<ResListSalary[]>([]);
const keyword = ref<string>("");
const formDataSalary = reactive<FormSalaryNew>({
date: null,
@ -189,7 +185,7 @@ const formDataSalary = reactive<FormSalaryNew>({
const modalDialogSalary = ref<boolean>(false);
const isStatusEdit = ref<boolean>(false);
const salaryId = ref<string>("");
const dataLevel = ref<any[]>([]);
const dataLevel = ref<ResType[]>([]);
const posNoOptions = ref<DataOption2[]>(store.optionTemplatePos);
@ -206,6 +202,9 @@ const posExecutiveOptionMain = ref<DataOption[]>([]);
const docOption = ref<DataOption2[]>(store.optionTemplateDoc);
/**
* function fetch รายการ ตำแหนงเงนเดอน
*/
function fetchListSalary() {
showLoader();
http
@ -221,6 +220,9 @@ function fetchListSalary() {
});
}
/**
* function fetch รายการ ตำแหนงเงนเดอน
*/
function fetchType() {
http
.get(config.API.orgPosType)
@ -237,6 +239,11 @@ function fetchType() {
});
}
/**
* function เลอกประเภทตำแหน
* @param val
* @param status
*/
async function updateSelectType(val: string, status: boolean = false) {
const listLevel = await dataLevel.value.find(
(e: any) => e.posTypeName === val
@ -252,7 +259,12 @@ async function updateSelectType(val: string, status: boolean = false) {
}
}
async function onClickOpenDialog(statusEdit: boolean = false, data: any = []) {
/**
* function เป dialog ตำแหนงเงนเดอน
* @param statusEdit แกไข,เพ
* @param data
*/
function onClickOpenDialog(statusEdit: boolean = false, data: any = []) {
if (empType.value === "") {
dataLevel.value.length === 0 && fetchType();
fetchDataOption();
@ -261,6 +273,7 @@ async function onClickOpenDialog(statusEdit: boolean = false, data: any = []) {
fetchOptionGroup();
}
//
setTimeout(async () => {
statusEdit && (await updateSelectType(data.positionType, true));
isStatusEdit.value = statusEdit;
@ -288,10 +301,19 @@ async function onClickOpenDialog(statusEdit: boolean = false, data: any = []) {
formDataSalary.doc = statusEdit ? data.templateDoc : "";
}
/**
* function dialog ตำแหนงเงนเดอน
*/
function onClickCloseDialog() {
modalDialogSalary.value = false;
}
/**
* ลเตอรอมลจาก input
* @param val าทอนให input
* @param update function จาก quasar
* @param filtername type กำหนด ของ input นๆ
*/
function filterSelector(val: any, update: Function, filtername: string) {
switch (filtername) {
case "pos":
@ -350,75 +372,91 @@ function filterSelector(val: any, update: Function, filtername: string) {
}
}
/**
* 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, () => {
submit();
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, "")), //
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);
await fetchListSalary();
success($q, "บันทึกข้อมูลสำเร็จ");
await onClickCloseDialog();
} catch (e) {
messageError($q, e);
} finally {
hideLoader();
}
});
}
async function submit() {
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, "")), //
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);
fetchListSalary();
onClickCloseDialog();
success($q, "บันทึกข้อมูลสำเร็จ");
} catch (e) {
messageError($q, e);
} finally {
hideLoader();
}
}
/**
* function เลอนรายการเงนเดอนข
* @param id รายการเงนเดอน
*/
function onSwapUp(id: string) {
showLoader();
http
.get(config.API.profileSalarySwapNew("up", id, empType.value))
.then(() => {
fetchListSalary();
.then(async () => {
await fetchListSalary();
})
.catch((err) => {
messageError($q, err);
@ -427,12 +465,17 @@ function onSwapUp(id: string) {
hideLoader();
});
}
/**
* function เลอนรายการเงนเดอนลง
* @param id รายการเงนเดอน
*/
function onSwapDown(id: string) {
showLoader();
http
.get(config.API.profileSalarySwapNew("down", id, empType.value))
.then(() => {
fetchListSalary();
.then(async () => {
await fetchListSalary();
})
.catch((err) => {
messageError($q, err);
@ -443,14 +486,22 @@ function onSwapDown(id: string) {
}
const modalHistory = ref<boolean>(false);
/**
* function อมลประวการแกไขรายการเงนเดอน
* @param id รายการเงนเดอน
*/
function onClikcHistory(id: string) {
salaryId.value = id;
modalHistory.value = true;
}
async function fetchDataOption() {
/**
* function fetch อมลสายงาน
*/
function fetchDataOption() {
showLoader();
await http
http
.get(config.API.orgPosPosition + `?keyword=&type=ALL`)
.then((res) => {
const data = res.data.result;
@ -497,6 +548,9 @@ async function fetchDataOption() {
});
}
/**
* function fetch อมลตำแหนงขอมลทางการบรหาร
*/
function fetchDataOptionExecutive() {
showLoader();
http
@ -516,11 +570,14 @@ function fetchDataOptionExecutive() {
});
}
async function fetchOptionGroup() {
/**
* function fetch อมลปรเภทตำแหน
*/
function fetchOptionGroup() {
showLoader();
await http
http
.get(config.API.orgEmployeeType)
.then(async (res) => {
.then((res) => {
dataLevel.value = res.data.result;
posTypeOptionsMain.value = res.data.result.map((e: any) => ({
id: e.id,
@ -561,20 +618,14 @@ const classInput = (val: boolean) => {
<q-tooltip>เพมขอม</q-tooltip>
</q-btn>
<q-space />
<q-input
dense
outlined
v-model="formFilter.keyword"
label="ค้นหา"
class="q-mr-sm"
>
<q-input dense outlined v-model="keyword" label="ค้นหา" class="q-mr-sm">
<template v-slot:append>
<q-icon v-if="formFilter.keyword == ''" name="search" />
<q-icon v-if="keyword == ''" name="search" />
<q-icon
v-else
name="clear"
class="cursor-pointer"
@click="formFilter.keyword = ''"
@click="keyword = ''"
/>
</template>
</q-input>
@ -600,7 +651,7 @@ const classInput = (val: boolean) => {
flat
bordered
dense
:filter="formFilter.keyword"
:filter="keyword"
:columns="columns"
:rows="rows"
:paging="true"

View file

@ -13,15 +13,8 @@ import { useCounterMixin } from "@/stores/mixin";
const $q = useQuasar();
const route = useRoute();
const {
date2Thai,
dialogConfirm,
showLoader,
hideLoader,
messageError,
success,
pathRegistryEmp,
} = useCounterMixin();
const { date2Thai, showLoader, hideLoader, messageError, pathRegistryEmp } =
useCounterMixin();
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
@ -242,6 +235,9 @@ function closeDialog() {
modal.value = false;
}
/**
* function fetch อมลประวการแกไข
*/
function fetchListHistory() {
showLoader();
http

View file

@ -23,7 +23,6 @@ const {
hideLoader,
messageError,
success,
dialogRemove,
pathRegistryEmp,
} = useCounterMixin();
const id = ref<string>("");
@ -111,24 +110,27 @@ const formData = reactive<RequestNoPaidObject>({
refCommandNo: "",
refCommandDate: null,
});
const formFilter = reactive({
page: 1,
pageSize: 10,
keyword: "",
});
const maxPage = ref<number>(1);
const keyword = ref<string>("");
const pagination = ref({
page: 1,
rowsPerPage: 10,
});
/**
* funciton นยนการบนทกขอม
*/
function onSubmit() {
dialogConfirm($q, () => {
isStatusEdit.value ? editData() : saveData();
onClickCloseDialog();
});
}
/**
* function เป Didalig นทกวนทไมไดบเงนเดอนฯ
* @param StatusEdit แกไข , เพ
* @param data อม
*/
function onClickOpenDialog(StatusEdit: boolean = false, data: any = []) {
isStatusEdit.value = StatusEdit;
id.value = StatusEdit ? data.id : "";
@ -140,14 +142,20 @@ function onClickOpenDialog(StatusEdit: boolean = false, data: any = []) {
modalDialog.value = true;
}
/**
* function Didalig นทกวนทไมไดบเงนเดอนฯ
*/
function onClickCloseDialog() {
modalDialog.value = false;
isStatusEdit.value = false;
}
async function getData() {
/**
* function fetch รายการบนทกวนทไมไดบเงนเดอนฯ
*/
function getData() {
showLoader();
await http
http
.get(config.API.profileNewNoPaidByProfileId(profileId.value, empType.value))
.then((res) => {
rows.value = res.data.result;
@ -160,18 +168,21 @@ async function getData() {
});
}
async function saveData() {
/**
* function เพมขอมลรายการบนทกวนทไมไดบเงนเดอนฯ
*/
function saveData() {
showLoader();
await http
http
.post(config.API.profileNewNoPaid(empType.value), {
...formData,
profileId: empType.value === "" ? profileId.value : undefined,
profileEmployeeId: empType.value !== "" ? profileId.value : undefined,
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
getData();
.then(async () => {
await getData();
onClickCloseDialog();
await success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
@ -181,17 +192,20 @@ async function saveData() {
});
}
async function editData() {
/**
* function แกไขขอมลรายการบนทกวนทไมไดบเงนเดอนฯ
*/
function editData() {
showLoader();
await http
http
.patch(config.API.profileNewNoPaidById(id.value, empType.value), {
...formData,
profileId: undefined,
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
getData();
.then(async () => {
await getData();
onClickCloseDialog();
await success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
@ -201,22 +215,9 @@ async function editData() {
});
}
// async function deleteData(id: string) {
// showLoader();
// await http
// .delete(config.API.profileNewNoPaidById(id))
// .then((res) => {
// success($q, "");
// getData();
// })
// .catch((e) => {
// messageError($q, e);
// })
// .finally(() => {
// hideLoader();
// });
// }
/**
* function เปดขอมลประวการแกไช
*/
function onClickHistory(rowId: string) {
id.value = rowId;
modalHistory.value = true;
@ -243,7 +244,7 @@ onMounted(() => {
<q-input
standout
dense
v-model="formFilter.keyword"
v-model="keyword"
ref="filterRef"
outlined
placeholder="ค้นหา"
@ -251,15 +252,15 @@ onMounted(() => {
>
<template v-slot:append>
<q-icon
v-if="formFilter.keyword == ''"
v-if="keyword == ''"
name="search"
@click.stop.prevent="formFilter.keyword = ''"
@click.stop.prevent="keyword = ''"
class="cursor-pointer"
/>
<q-icon
v-if="formFilter.keyword"
v-if="keyword"
name="cancel"
@click.stop.prevent="formFilter.keyword = ''"
@click.stop.prevent="keyword = ''"
class="cursor-pointer"
/>
</template>
@ -320,7 +321,7 @@ onMounted(() => {
:columns="columns"
:rows="rows"
:paging="true"
:filter="formFilter.keyword"
:filter="keyword"
v-model:pagination="pagination"
:rows-per-page-options="[20, 50, 100]"
:visible-columns="visibleColumns"

View file

@ -0,0 +1,41 @@
interface ResListSalary {
amount: number;
createdAt: string;
createdFullName: string;
createdUserId: string;
date: string;
id: string;
lastUpdateFullName: string;
lastUpdateUserId: string;
lastUpdatedAt: string;
mouthSalaryAmount: number;
order: number;
posNo: string;
position: string;
positionExecutive: string;
positionLevel: string;
positionLine: string;
positionPathSide: string;
positionSalaryAmount: number;
positionType: string;
profileEmployeeId: null | string;
profileId: string;
refCommandNo: string;
templateDoc: string;
}
interface ResType {
id: string;
posTypeName: string;
posTypeRank: number;
posLevels: PosLevel[];
}
interface PosLevel {
id: string;
posLevelAuthority: null;
posLevelName: string;
posLevelRank: number;
}
export type { ResListSalary, ResType };

View file

@ -285,10 +285,14 @@ async function fetchDataPersonal() {
}
function onClickDownloadKp7(type: string) {
console.log(empType.value);
showLoader();
const url =
type === "FULL"
? config.API.profileReportId(profileId.value)
? empType.value
? config.API.profileReportEmpId(profileId.value)
: config.API.profileReportId(profileId.value)
: config.API.profileKp7ShortId(profileId.value);
const fileName = type === "FULL" ? "ก.พ.7/ก.ก.1" : "ประวัติแบบย่อ";
http