Merge branch 'develop' into devTee

This commit is contained in:
STW_TTTY\stwtt 2024-05-01 18:11:28 +07:00
commit a1c835b70e
12 changed files with 343 additions and 159 deletions

View file

@ -30,6 +30,8 @@ const {
hideLoader,
success,
dialogRemove,
findOrgName,
findPosMasterNo,
} = mixin;
const visibleColumns = ref<string[]>([
@ -73,7 +75,7 @@ const columns = ref<QTableProps["columns"]>([
{
name: "posNo",
align: "left",
label: "ตำแหน่งเลขที่",
label: "เลขที่ตำแหน่ง",
sortable: true,
field: "posNo",
headerStyle: "font-size: 14px",
@ -91,7 +93,7 @@ const columns = ref<QTableProps["columns"]>([
{
name: "positionLevel",
align: "left",
label: "ระดับ",
label: "ประเภทตำแหน่ง",
sortable: true,
field: "positionLevel",
headerStyle: "font-size: 14px",
@ -181,8 +183,13 @@ const getData = async () => {
id: item.id,
fullname: `${item.prefix}${item.firstName} ${item.lastName}`,
position: item.position,
posNo: item.posNo,
positionLevel: item.positionLevel,
posNo: findPosMasterNo(item),
positionLevel:
item.posTypeName == null && item.posLevelName == null
? "-"
: (item.posTypeName != null ? item.posTypeName : "") +
" " +
(item.posLevelName != null ? ` (${item.posLevelName})` : ""),
createdAt: date2Thai(item.createdAt),
organization: item.organization,
reason: item.reason,
@ -323,7 +330,7 @@ onMounted(async () => {
:props="props"
@click="openDetail(props.row.id)"
>
{{ props.row.position }}
{{ props.row.position ?? "-" }}
</q-td>
<q-td
key="positionLevel"

View file

@ -12,7 +12,7 @@ import config from "@/app.config";
import type { QForm } from "quasar";
import type { ResponseData } from "@/modules/05_placement/interface/response/officer";
import PopupPersonal from "@/components/Dialogs/PopupPersonal.vue";
import PopupPersonal from "@/components/Dialogs/PopupPersonalNew.vue";
const modalPersonal = ref<boolean>(false);
const personalId = ref<string>("");
@ -67,10 +67,10 @@ const getData = async () => {
prefix.value = data.prefix;
firstName.value = data.firstName;
lastName.value = data.lastName;
avatar.value = data.avatar ?? "";
position.value = data.position;
position.value = data.position ?? "-";
posNo.value = data.posNo;
positionLevel.value = data.positionLevel;
positionLevel.value = `${data.posTypeName}(${data.posLevelName})`;
createdAt.value = data.createdAt;
organization.value = data.organization;
reason.value = data.reason;
@ -82,6 +82,7 @@ const getData = async () => {
positionNumberOld.value = data.positionNumberOld;
organizationPositionOld.value = data.organizationPositionOld;
dateRepatriation.value = data.dateRepatriation;
fetchProfile(data.profileId);
})
.catch((e) => {
messageError($q, e);
@ -91,6 +92,27 @@ const getData = async () => {
});
};
function fetchProfile(id: string) {
showLoader();
http
.get(
config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, `profile-${id}`)
)
.then(async (res) => {
avatar.value = res.data.downloadUrl;
})
.catch((e) => {
if (e.response.data.message === "ไม่พบไฟล์ในระบบ") {
avatar.value = "";
} else {
messageError($q, e);
}
})
.finally(() => {
hideLoader();
});
}
const getClass = (val: boolean) => {
return {
"full-width inputgreen cursor-pointer": val,
@ -200,15 +222,15 @@ onMounted(async () => {
<div class="col-12 q-pl-md">
<div class="col-12 text-top">ตำแหนงในสายงาน</div>
<div class="col-12 text-detail">
{{ positionTypeOld }}
{{ position }}
</div>
</div>
</div>
<div class="col-xs-6 col-sm-3 row items-center">
<div class="col-12">
<div class="col-12 text-top">ระด</div>
<div class="col-12 text-top">ประเภทตำแหน</div>
<div class="col-12 text-detail">
{{ positionLevelOld }}
{{ positionLevel }}
</div>
</div>
</div>
@ -216,7 +238,7 @@ onMounted(async () => {
<div class="col-12">
<div class="col-12 text-top">งก</div>
<div class="col-12 text-detail">
{{ organizationPositionOld }}
{{ organization }}
</div>
</div>
</div>

View file

@ -7,7 +7,7 @@ import http from "@/plugins/http";
import config from "@/app.config";
import type { QForm } from "quasar";
import type { resHelpDetail } from "@/modules/05_placement/interface/response/officer";
import PopupPersonal from "@/components/Dialogs/PopupPersonal.vue";
import PopupPersonal from "@/components/Dialogs/PopupPersonalNew.vue";
const modalPersonal = ref<boolean>(false);
const personId = ref<string>("");
@ -60,28 +60,52 @@ const getData = async () => {
(id.value = data.id);
profileId.value = data.profileId;
prefix.value = data.prefix;
avatar.value = data.avatar ?? "";
firstName.value = data.firstName;
lastName.value = data.lastName;
position.value = data.position;
position.value = data.position ?? "-";
posNo.value = data.posNo;
positionLevel.value = data.positionLevel;
positionLevel.value = `${data.posTypeName}(${data.posLevelName})`;
createdAt.value = data.createdAt;
organization.value = data.organization;
reason.value = data.reason;
status.value = data.status;
dateStart.value = data.dateStart;
dateEnd.value = data.dateEnd;
positionTypeOld.value = data.positionTypeOld;
positionLevelOld.value = data.positionLevelOld;
positionTypeOld.value = data.position;
positionLevelOld.value = `${data.posTypeName}(${data.posLevelName})`;
positionNumberOld.value = data.positionNumberOld;
organizationPositionOld.value = data.organizationPositionOld;
fetchProfile(data.profileId);
})
.catch((e) => {
messageError($q, e);
})
.catch((e) => {})
.finally(() => {
hideLoader();
});
};
function fetchProfile(id: string) {
showLoader();
http
.get(
config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, `profile-${id}`)
)
.then(async (res) => {
avatar.value = res.data.downloadUrl;
})
.catch((e) => {
if (e.response.data.message === "ไม่พบไฟล์ในระบบ") {
avatar.value = "";
} else {
messageError($q, e);
}
})
.finally(() => {
hideLoader();
});
}
const getClass = (val: boolean) => {
return {
"full-width inputgreen cursor-pointer": val,
@ -124,7 +148,7 @@ const saveData = async () => {
showLoader();
await http
.put(config.API.officerMainEdit(dataId), body)
.then((res: any) => {
.then(() => {
success($q, "แก้ไขข้อมูลเพื่อลงบัญชีแนบท้ายสำเร็จ");
edit.value = false;
})
@ -190,15 +214,15 @@ onMounted(async () => {
<div class="col-12 q-pl-md">
<div class="col-12 text-top">ตำแหนงในสายงาน</div>
<div class="col-12 text-detail">
{{ positionTypeOld }}
{{ position }}
</div>
</div>
</div>
<div class="col-xs-6 col-sm-3 row items-center">
<div class="col-12">
<div class="col-12 text-top">ระด</div>
<div class="col-12 text-top">ประเภทตำแหน</div>
<div class="col-12 text-detail">
{{ positionLevelOld }}
{{ positionLevel }}
</div>
</div>
</div>
@ -206,7 +230,7 @@ onMounted(async () => {
<div class="col-12">
<div class="col-12 text-top">งก</div>
<div class="col-12 text-detail">
{{ organizationPositionOld }}
{{ organization }}
</div>
</div>
</div>

View file

@ -31,6 +31,8 @@ const {
hideLoader,
success,
dialogRemove,
findOrgName,
findPosMasterNo,
} = mixin;
//
@ -71,7 +73,7 @@ const columns = ref<QTableProps["columns"]>([
{
name: "posNo",
align: "left",
label: "ตำแหน่งเลขที่",
label: "เลขที่ตำแหน่ง",
sortable: true,
field: "posNo",
headerStyle: "font-size: 14px",
@ -89,7 +91,7 @@ const columns = ref<QTableProps["columns"]>([
{
name: "positionLevel",
align: "left",
label: "ระดับ",
label: "ประเภทตำแหน่ง",
sortable: true,
field: "positionLevel",
headerStyle: "font-size: 14px",
@ -196,9 +198,14 @@ const getData = async () => {
rows.value = data.map((item: officerType) => ({
id: item.id,
fullname: `${item.prefix}${item.firstName} ${item.lastName}`,
position: item.position,
posNo: item.posNo,
positionLevel: item.positionLevel,
position: item.position != null ? item.position : "-",
posNo: findPosMasterNo(item),
positionLevel:
item.posTypeName == null && item.posLevelName == null
? "-"
: (item.posTypeName != null ? item.posTypeName : "") +
" " +
(item.posLevelName != null ? ` (${item.posLevelName})` : ""),
createdAt: date2Thai(item.createdAt),
organization: item.organization,
reason: item.reason,
@ -209,13 +216,14 @@ const getData = async () => {
positionTypeOld: item.positionTypeOld,
positionLevelOld: item.positionLevelOld,
positionNumberOld: item.positionNumberOld,
organizationPositionOld: item.organizationPositionOld,
organizationPositionOld: findOrgName(item),
isActive: item.isActive,
dateEnd: item.dateEnd == null ? "-" : date2Thai(new Date(item.dateEnd)),
dateEnd: item.dateEnd == null ? "" : date2Thai(new Date(item.dateEnd)),
dateStart:
item.dateStart == null ? "-" : date2Thai(new Date(item.dateStart)),
item.dateStart == null ? "" : date2Thai(new Date(item.dateStart)),
}));
})
.catch((e) => {})
.finally(() => {
hideLoader();
@ -243,6 +251,7 @@ onMounted(async () => {
await getData();
});
</script>
<template>
<div class="toptitle text-dark col-12 row items-center">รายการชวยราชการ</div>
<q-card flat bordered class="col-12 q-mt-sm">

View file

@ -87,7 +87,7 @@ const ProductivityArray = computed(() => {
return Array(productivityCount.value).fill("");
});
const OPmain = ref<
Array<{ id: number; title: string; description: string; level: number }>
Array<{ id: number; naem: string; description: string; level: string }>
>([]);
const OPgroup = ref<
Array<{ id: number; title: string; description: string; level: number }>
@ -163,8 +163,8 @@ interface CheckboxItem {
* @param id personal id
*/
async function dataEdit(id: string) {
await myForm.value.validate().then((result: boolean) => {
if (result) {
// await myForm.value.validate().then((result: boolean) => {
// if (result) {
showLoader();
const data = putDataEdit(id);
http
@ -176,10 +176,10 @@ async function dataEdit(id: string) {
getAssign();
hideLoader();
});
} else {
dialogMessageNotify($q, "กรุณากรอกข้อมูลให้ครบ");
}
});
// } else {
// dialogMessageNotify($q, "");
// }
// });
}
/**
@ -305,6 +305,7 @@ async function getUser() {
.get(config.API.orgProfilePlacement(personalId))
.then((res: any) => {
const data = res.data.result;
OPcaretaker.value = data.caregiver.map((item: any) => ({
id: item.id,
name: item.prefix + item.firstName + " " + item.lastName,
@ -369,6 +370,7 @@ async function getUser() {
async function getAssignNew(id: string) {
await http.get(config.API.newAssign(id)).then((res: any) => {
const data = res.data.data;
const monthOption = {
value: data.assign_month,
label: `${data.assign_month} เดือน`,
@ -388,30 +390,66 @@ async function getAssignNew(id: string) {
* get อม สมรรถนะหล
* @param id personal id
*/
const assign_competencyMain = ref<any>();
async function getcompetency(id: string) {
await http.get(config.API.competencyOptions(id)).then((res: any) => {
const data = res.data.data;
OPmain.value = data;
main.value = data[0];
main2.value = data[1];
main3.value = data[2];
main4.value = data[3];
main5.value = data[4];
});
http
.get(config.API.kpiCapacity + `/head`)
.then((res) => {
const data = res.data.result;
assign_competencyMain.value = data;
main.value = data[0];
main2.value = data[1];
main3.value = data[2];
main4.value = data[3];
main5.value = data[4];
console.log(main.value);
})
.catch((err) => {
messageError($q, err);
});
// await http.get(config.API.competencyOptions(id)).then((res: any) => {
// const data = res.data.data;
// console.log(data);
// OPmain.value = data;
// main.value = data[0];
// main2.value = data[1];
// main3.value = data[2];
// main4.value = data[3];
// main5.value = data[4];
// });
}
/**
* get อม สมรรถนะประจากลมงาน
* @param id personal id
*/
const assign_competencyGroupMain = ref<any>();
async function getCompetencyGroup(id: string) {
await http.get(config.API.competencyGroupOptions(id)).then((res: any) => {
const data = res.data.data;
OPgroup.value = data;
group.value = data[0];
group2.value = data[1];
group3.value = data[2];
});
console.log(position.value);
http
.get(config.API.kpiCapacity + `/group?positionName=${position.value}`)
.then((res) => {
const data = res.data.result;
assign_competencyGroupMain.value = data;
OPgroup.value = data;
group.value = data[0];
group2.value = data[1];
group3.value = data[2];
})
.catch((err) => {
messageError($q, err);
});
// await http.get(config.API.competencyGroupOptions(id)).then((res: any) => {
// const data = res.data.data;
// OPgroup.value = data;
// group.value = data[0];
// group2.value = data[1];
// group3.value = data[2];
// });
}
/**
@ -518,11 +556,11 @@ function putDataEdit(id: string) {
if (skill4.value) allSkills.push({ level: skill4.value.level });
const allCompetency = [];
if (main.value) allCompetency.push({ level: main.value.level });
if (main2.value) allCompetency.push({ level: main2.value.level });
if (main3.value) allCompetency.push({ level: main3.value.level });
if (main4.value) allCompetency.push({ level: main4.value.level });
if (main5.value) allCompetency.push({ level: main5.value.level });
if (main.value) allCompetency.push(main.value);
if (main2.value) allCompetency.push(main2.value);
if (main3.value) allCompetency.push(main3.value);
if (main4.value) allCompetency.push(main4.value);
if (main5.value) allCompetency.push(main5.value);
const assign_director = [
{
@ -603,8 +641,8 @@ function putDataEdit(id: string) {
assign_jobs: assign_job.filter((item) => item !== null),
other_desc: OtherLaw.value,
assign_skill: allSkills,
assign_competency: allCompetency,
assign_competency_group: allGroup,
assign_competency: assign_competencyMain.value,
assign_competency_group: assign_competencyGroupMain.value,
other4_desc: Other.value,
other5_no1_desc: Other5.value,
assign_outputs: Productivity_assign.filter((item) => item !== null),
@ -668,12 +706,7 @@ function putData(id: string) {
if (skill3.value) allSkills.push({ level: skill3.value.level });
if (skill4.value) allSkills.push({ level: skill4.value.level });
const allCompetency = [];
if (main.value) allCompetency.push({ level: main.value.level });
if (main2.value) allCompetency.push({ level: main2.value.level });
if (main3.value) allCompetency.push({ level: main3.value.level });
if (main4.value) allCompetency.push({ level: main4.value.level });
if (main5.value) allCompetency.push({ level: main5.value.level });
const allCompetency = assign_competencyMain.value;
const assign_director = [
{
@ -743,8 +776,8 @@ function putData(id: string) {
assign_jobs: assign_job.filter((item) => item !== null),
other_desc: OtherLaw.value,
assign_skill: allSkills,
assign_competency: allCompetency,
assign_competency_group: allGroup,
assign_competency: assign_competencyMain.value,
assign_competency_group: assign_competencyGroupMain.value,
other4_desc: Other.value,
other5_no1_desc: Other5.value,
assign_outputs: Productivity_assign.filter((item) => item !== null),
@ -768,13 +801,17 @@ function putData(id: string) {
* @param id personal id
*/
async function saveData(id: string) {
await myForm.value.validate().then((result: boolean) => {
if (result) {
dialogConfirm($q, async () => await DataSave(id));
} else {
dialogMessageNotify($q, "กรุณากรอกข้อมูลให้ครบ");
}
});
console.log("tests");
const data = putData(id);
console.log("data==>", data);
// await myForm.value.validate().then((result: boolean) => {
// if (result) {
dialogConfirm($q, async () => await DataSave(id));
// } else {
// dialogMessageNotify($q, "");
// }
// });
}
/**
@ -1006,12 +1043,12 @@ function filterFnChairman(val: string, update: any) {
/** เมื่อโหลดหน้า เรียกใช้งานฟังชั่น */
onMounted(async () => {
await getUser();
await getAssignNew(personalId);
await getLaw(personalId);
await getcompetency(personalId);
await getCompetencyGroup(personalId);
await getSkill(personalId);
await getKnowledge(personalId);
await getAssignNew(personalId);
await getcompetency(personalId);
await getCompetencyGroup(personalId);
if (assignId.value !== undefined) {
await getAssign();
}
@ -1019,7 +1056,11 @@ onMounted(async () => {
</script>
<template>
<q-form ref="myForm">
<q-form
greedy
@submit.prevent
@validation-success="assignId !== undefined ? saveEdit(assignId) : saveData(personalId)"
>
<div class="q-pa-sm">
<div class="toptitle text-dark col-12 row items-center">
<q-btn
@ -1098,14 +1139,14 @@ onMounted(async () => {
>
<q-tooltip>ยกเล</q-tooltip>
</q-btn>
<!-- @click="saveEdit(assignId)" -->
<q-btn
dense
flat
class="q-ml-md"
round
color="public"
@click="saveEdit(assignId)"
type="submit"
icon="mdi-content-save-outline"
>
<q-tooltip>นทกขอม</q-tooltip>
@ -1820,8 +1861,10 @@ onMounted(async () => {
<div class="col-12 row q-col-gutter-sm">
<div class="col-xs-12 col-sm-6">
<q-select
:options-html="true"
:option-label="
(item) => `${item.title} - ${item.description}`
(item) =>
`${item.name} - ระดับ:๑ ${item.description}`
"
option-value="id"
hide-bottom-space
@ -1838,19 +1881,21 @@ onMounted(async () => {
v-model="main"
label="ตัวที่ 1"
>
<template v-slot:selected-item="scope">
<!-- <template v-slot:selected-item="scope">
<div class="ellipsis-2-lines">
{{ scope.opt.title }} -
{{ scope.opt.description }}
</div>
</template></q-select
>
</template> -->
</q-select>
</div>
<div class="col-xs-12 col-sm-6">
<q-select
:options-html="true"
:option-label="
(item) => `${item.title} - ${item.description}`
(item) =>
`${item.name} - ระดับ:๑ ${item.description}`
"
option-value="id"
hide-bottom-space
@ -1867,19 +1912,21 @@ onMounted(async () => {
v-model="main2"
label="ตัวที่ 2"
>
<template v-slot:selected-item="scope">
<!-- <template v-slot:selected-item="scope">
<div class="ellipsis-2-lines">
{{ scope.opt.title }} -
{{ scope.opt.description }}
</div>
</template></q-select
>
</template> -->
</q-select>
</div>
<div class="col-xs-12 col-sm-6">
<q-select
:options-html="true"
:option-label="
(item) => `${item.title} - ${item.description}`
(item) =>
`${item.name} - ระดับ:๑ ${item.description}`
"
option-value="id"
hide-bottom-space
@ -1896,19 +1943,21 @@ onMounted(async () => {
v-model="main3"
label="ตัวที่ 3"
>
<template v-slot:selected-item="scope">
<!-- <template v-slot:selected-item="scope">
<div class="ellipsis-2-lines">
{{ scope.opt.title }} -
{{ scope.opt.description }}
</div>
</template></q-select
>
</template> -->
</q-select>
</div>
<div class="col-xs-12 col-sm-6">
<q-select
:options-html="true"
:option-label="
(item) => `${item.title} - ${item.description}`
(item) =>
`${item.name} - ระดับ:๑ ${item.description}`
"
option-value="id"
hide-bottom-space
@ -1925,13 +1974,13 @@ onMounted(async () => {
v-model="main4"
label="ตัวที่ 4"
>
<template v-slot:selected-item="scope">
<!-- <template v-slot:selected-item="scope">
<div class="ellipsis-2-lines">
{{ scope.opt.title }} -
{{ scope.opt.description }}
</div>
</template></q-select
>
</template> -->
</q-select>
</div>
<div class="col-xs-12 col-sm-6">
@ -1941,8 +1990,10 @@ onMounted(async () => {
:options="
filterMain(OPmain, [main, main2, main3, main4])
"
:options-html="true"
:option-label="
(item) => `${item.title} - ${item.description}`
(item) =>
`${item.name} - ระดับ:๑ ${item.description}`
"
option-value="id"
class="bg-white"
@ -1954,13 +2005,13 @@ onMounted(async () => {
v-model="main5"
label="ตัวที่ 5"
>
<template v-slot:selected-item="scope">
<!-- <template v-slot:selected-item="scope">
<div class="ellipsis-2-lines">
{{ scope.opt.title }} -
{{ scope.opt.description }}
</div>
</template></q-select
>
</template> -->
</q-select>
</div>
</div>
</div>
@ -1970,8 +2021,10 @@ onMounted(async () => {
<div class="col-12 row q-col-gutter-sm">
<div class="col-xs-12 col-sm-6">
<q-select
:options-html="true"
:option-label="
(item) => `${item.title} - ${item.description}`
(item) =>
`${item.name} - ระดับ:๒ ${item.description}`
"
option-value="id"
hide-bottom-space
@ -1988,19 +2041,21 @@ onMounted(async () => {
v-model="group"
label="ตัวที่ 1"
>
<template v-slot:selected-item="scope">
<!-- <template v-slot:selected-item="scope">
<div class="ellipsis-2-lines">
{{ scope.opt.title }} -
{{ scope.opt.description }}
</div>
</template></q-select
>
</template> -->
</q-select>
</div>
<div class="col-xs-12 col-sm-6">
<q-select
:options-html="true"
:option-label="
(item) => `${item.title} - ${item.description}`
(item) =>
`${item.name} - ระดับ:๒ ${item.description}`
"
option-value="id"
hide-bottom-space
@ -2017,19 +2072,21 @@ onMounted(async () => {
v-model="group2"
label="ตัวที่ 2"
>
<template v-slot:selected-item="scope">
<!-- <template v-slot:selected-item="scope">
<div class="ellipsis-2-lines">
{{ scope.opt.title }} -
{{ scope.opt.description }}
</div>
</template></q-select
>
</template> -->
</q-select>
</div>
<div class="col-xs-12 col-sm-6">
<q-select
:options-html="true"
:option-label="
(item) => `${item.title} - ${item.description}`
(item) =>
`${item.name} - ระดับ:๒ ${item.description}`
"
option-value="id"
map-options
@ -2046,13 +2103,13 @@ onMounted(async () => {
v-model="group3"
label="ตัวที่ 3"
>
<template v-slot:selected-item="scope">
<!-- <template v-slot:selected-item="scope">
<div class="ellipsis-2-lines">
{{ scope.opt.title }} -
{{ scope.opt.description }}
</div>
</template></q-select
>
</template> -->
</q-select>
</div>
</div>
</div>
@ -2827,13 +2884,11 @@ onMounted(async () => {
v-show="routeName == 'probationWorkAdd'"
class="flex justify-end q-pa-sm q-gutter-sm"
>
<q-btn
unelevated
label="บันทึก"
color="public"
@click="saveData(personalId)"
/>
<q-btn unelevated label="บันทึก" type="submit" color="public"
><q-tooltip>นทกขอม</q-tooltip></q-btn
>
</div>
<!-- @click="saveData(personalId)" -->
</div>
</div>
</q-form>

View file

@ -19,7 +19,9 @@ interface officerType {
isActive: boolean;
dateEnd: string;
dateStart: string;
dateRepatriation: Date
dateRepatriation: Date;
posTypeName?: string;
posLevelName?: string;
}
interface ResponseData {
data: {
@ -44,7 +46,9 @@ interface ResponseData {
positionNumberOld: string;
organizationPositionOld: string;
isActive: boolean;
dateRepatriation: Date
dateRepatriation: Date;
posTypeName: string;
posLevelName: string;
};
};
}
@ -71,11 +75,9 @@ interface resHelpDetail {
positionNumberOld: string;
organizationPositionOld: string;
isActive: boolean;
posTypeName: string;
posLevelName: string;
};
};
}
export type {
officerType,
ResponseData,
resHelpDetail
};
export type { officerType, ResponseData, resHelpDetail };