diff --git a/src/api/14_KPI/api.KPI.ts b/src/api/14_KPI/api.KPI.ts index c79f6b90b..97e20ae68 100644 --- a/src/api/14_KPI/api.KPI.ts +++ b/src/api/14_KPI/api.KPI.ts @@ -3,39 +3,68 @@ const KPI = `${env.API_URI}/kpi`; const kpiPeriod = `${env.API_URI}/kpi/period`; const kpiEvaluation = `${env.API_URI}/kpi/evaluation`; const kpiUserEvaluation = `${env.API_URI}/kpi/user/evaluation`; -const kpiAchievement = `${env.API_URI}/kpi/user/achievement`; -const kpiGroup = `${env.API_URI}/kpi/group`; const kpiPlan = `${env.API_URI}/kpi/plan`; +const kpiRole = `${env.API_URI}/kpi/role`; const kpiSpecial = `${env.API_URI}/kpi/special`; const kpiCapacity = `${env.API_URI}/kpi/capacity`; -const kpiLink = `${env.API_URI}/kpi/link`; -const KpiUser = `${env.API_URI}/kpi/user`; const KpiFile = `${env.API_URI}/salary/file`; +const KpiEvaluationInfo = `${env.API_URI}/kpi/evaluation`; +const Kpiorg = `${env.API_URI}/org/profile/commander`; + +const KpiUser = `${env.API_URI}/kpi/user`; +const kpiAchievement = `${env.API_URI}/kpi/user/achievement`; +const kpiReason = `${env.API_URI}/kpi/reason`; + +const urlFile = `${env.API_URI}/salary`; + +const kpiGroup = `${env.API_URI}/kpi/group`; +const kpiLink = `${env.API_URI}/kpi/link`; + export default { KPI, + kpiUserEvaluation, /** รอบการประเมินผล*/ kpiPeriod, kpiPeriodById: (id: string) => `${kpiPeriod}/${id}`, + kpiEvaluation, - kpiFile: KpiFile, + kpiPlan, + kpiPlanById: (id: string) => `${kpiPlan}/${id}`, /** role */ + kpiRole, kpiRoleMainList: `${KPI}/role`, + kpiSpecial, + kpiCapacity, + KpiFile: KpiFile, + + kpiAchievement: (type: string) => `${kpiAchievement}/${type}`, + kpiAchievementPoint: (type: string) => `${kpiAchievement}/${type}/point`, + + kpiScoreTotal: () => `${kpiEvaluation}/point`, + + /** ผลสัมฤทธิ์ของงาน*/ + fileByFile: (name: string, group: string, id: string, fileName: string) => + `${urlFile}/file/${name}/${group}/${id}/${fileName}`, + kpiUserCapacity: `${KpiUser}/capacity`, + KpiEvaluationInfo, + Kpiorg, + kpiEvaluationCheck: `${kpiEvaluation}/check`, + kpiSendToStatus: (id: string) => `${kpiEvaluation}/status/${id}`, + kpiReqEdit: (id: string) => `${kpiEvaluation}/edit/${id}`, + /**ประเมิน*/ + kpiAchievementDevelop: `${kpiAchievement}/development`, + + kpiCommentP: (typP: string, type: string, role: string, id: string) => + `${kpiReason}/${typP}/${type}/${role}/${id}`, + kpiGroup, kpiGroupById: (id: string) => `${kpiGroup}/${id}`, - kpiPlan, - kpiPlanById: (id: string) => `${kpiPlan}/${id}`, - kpiSpecial, /** สมรรถนะ */ - kpiCapacity, kpiLink, - kpiUserEvaluation, profilePosition: () => `${env.API_URI}/org/profile/keycloak/position`, - kpiAchievement: (type: string) => `${kpiAchievement}/${type}`, - kpiAchievementPoint: (type: string) => `${kpiAchievement}/${type}/point`, - kpiUserCapacity: `${KpiUser}/capacity`, }; diff --git a/src/api/registry/api.registry.ts b/src/api/registry/api.registry.ts index d353d710a..525f343b5 100644 --- a/src/api/registry/api.registry.ts +++ b/src/api/registry/api.registry.ts @@ -176,4 +176,6 @@ export default { //ข้อมูลครอบครับ profileFamily: (empType: string, type: string) => `${registryNew}${empType}/family/${type}`, + profileFamilyHistory: (id: string, empType: string, type: string) => + `${registryNew}${empType}/family/${type}/history/${id}`, }; diff --git a/src/modules/01_metadataNew/components/competency/04ListCriteria.vue b/src/modules/01_metadataNew/components/competency/04ListCriteria.vue index b4cca12a9..460d86b48 100644 --- a/src/modules/01_metadataNew/components/competency/04ListCriteria.vue +++ b/src/modules/01_metadataNew/components/competency/04ListCriteria.vue @@ -43,7 +43,7 @@ function onSubmit() { }; http - .put(config.API.kpiEvaluation, body.formScore) + .put(config.API.kpiUserEvaluation, body.formScore) .then((res) => { success($q, "บันทึกสำเร็จ"); }) @@ -53,7 +53,7 @@ function onSubmit() { function getData() { showLoader(); http - .get(config.API.kpiEvaluation) + .get(config.API.kpiUserEvaluation) .then((res) => { dataLevel.value = res.data.result.data; }) diff --git a/src/modules/04_registryNew/components/TableView.vue b/src/modules/04_registryNew/components/TableView.vue index 6f8bc3084..4d29ff608 100644 --- a/src/modules/04_registryNew/components/TableView.vue +++ b/src/modules/04_registryNew/components/TableView.vue @@ -75,7 +75,7 @@ const columns = ref([ { name: "posPath", align: "left", - label: "สายงาน", + label: "ประเภทตำแหน่ง", sortable: true, field: "posType", headerStyle: "font-size: 14px", @@ -91,42 +91,47 @@ const columns = ref([ field: "posLevel", headerStyle: "font-size: 14px", style: "font-size: 14px", + format(val, row) { + return row.posTypeShortName + ? row.posTypeShortName + " " + row.posLevel + : row.posLevel; + }, sort: (a: string, b: string) => a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), }, { - name: "posOc", + name: "org", align: "left", label: "สังกัด", sortable: true, - field: "posOc", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - sort: (a: string, b: string) => - a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), - }, - { - name: "year", - align: "left", - label: "ปีงบประมาณ", - sortable: true, - field: "year", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - sort: (a: string, b: string) => - a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), - }, - { - name: "salary", - align: "left", - label: "ค่าจ้าง", - sortable: true, - field: "salary", + field: "org", headerStyle: "font-size: 14px", style: "font-size: 14px", sort: (a: string, b: string) => a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), }, + // { + // name: "year", + // align: "left", + // label: "ปีงบประมาณ", + // sortable: true, + // field: "year", + // headerStyle: "font-size: 14px", + // style: "font-size: 14px", + // sort: (a: string, b: string) => + // a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), + // }, + // { + // name: "salary", + // align: "left", + // label: "ค่าจ้าง", + // sortable: true, + // field: "salary", + // headerStyle: "font-size: 14px", + // style: "font-size: 14px", + // sort: (a: string, b: string) => + // a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), + // }, ]); const visibleColumns = ref([ @@ -137,9 +142,9 @@ const visibleColumns = ref([ "posPath", "posType", "posLevel", - "posOc", - "year", - "salary", + "org", + // "year", + // "salary", ]); function updatePagePagination() { @@ -284,7 +289,14 @@ watch( @@ -296,7 +308,7 @@ watch( (formFilter.page - 1) * formFilter.pageSize + props.rowIndex + 1 }} - - + @@ -398,7 +410,11 @@ watch( {{ - props.row.posLevel ? props.row.posLevel : "-" + props.row.posLevel + ? props.row.posTypeShortName + ? `${props.row.posTypeShortName} ${props.row.posLevel}` + : props.row.posLevel + : "-" }} diff --git a/src/modules/04_registryNew/components/detail/GovernmentInformation/01_Info.vue b/src/modules/04_registryNew/components/detail/GovernmentInformation/01_Info.vue index 78dedc239..e9cdc17a9 100644 --- a/src/modules/04_registryNew/components/detail/GovernmentInformation/01_Info.vue +++ b/src/modules/04_registryNew/components/detail/GovernmentInformation/01_Info.vue @@ -2,7 +2,6 @@ import { ref, reactive, watch, onMounted } from "vue"; import { useCounterMixin } from "@/stores/mixin"; import type { - MyObjectRef, RequestItemsHistoryObject, FormMain, } from "@/modules/04_registryNew/interface/index/government"; @@ -25,6 +24,7 @@ const { messageError, showLoader, hideLoader, + success, } = mixin; const profileId = ref(route.params.id.toString()); @@ -70,24 +70,6 @@ const containDateRef = ref(null); const workDateRef = ref(null); const reasonSameDateRef = ref(null); -const objectRef: MyObjectRef = { - containDate: containDateRef, - workDate: workDateRef, - reasonSameDate: reasonSameDateRef, -}; - -const fieldLabels = { - ocId: "สังกัด", - positionId: "ตำแหน่ง", - numberId: "เลขที่ตำแหน่ง", - positionExecutive: "ตำแหน่งทางการบริหาร", - positionExecutiveSide: "ด้านทางการบริหาร", - positionLine: "สายงาน", - positionLevel: "ระดับ", - positionType: "ประเภท", - positionPathSide: "ด้าน/สาขา", -}; - const visibleColumnsHistory = ref([ "oc", "position", @@ -317,7 +299,6 @@ const columnsHistory = ref([ /** เปิด dialog */ function openDialogEdit() { modalEdit.value = true; - containDate.value = formMain.containDate ? formMain.containDate : null; workDate.value = formMain.workDate ? formMain.workDate : null; reasonSameDate.value = formMain.reasonSameDate @@ -338,23 +319,6 @@ function closeDialog() { reasonSameDate.value = null; } -/** validate check*/ -function validateForm() { - const hasError = []; - for (const key in objectRef) { - 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)) { - onSubmit(); - } -} - function onSubmit() { dialogConfirm($q, () => { showLoader(); @@ -371,9 +335,10 @@ function onSubmit() { : reasonSameDate.value, } ) - .then((res) => { - closeDialog(); + .then(() => { getData(); + success($q, "บันทึกข้อมูลสำเร็จ"); + closeDialog(); }) .catch((e) => { messageError($q, e); @@ -381,8 +346,6 @@ function onSubmit() { .finally(() => { hideLoader(); }); - - closeDialog(); }); } @@ -393,15 +356,15 @@ function getData() { .get(config.API.profileNewGovernmentById(profileId.value, empType.value)) .then((res) => { const data = res.data.result; - formMain.ocId = data.org; //สังกัด - formMain.positionId = data.position; //ตำแหน่ง - formMain.positionLine = data.positionField; //สายงาน - formMain.positionLevel = data.posLevel; //ระดับ - formMain.numberId = data.posMasterNo; //เลขที่ตำแหน่ง - formMain.positionType = data.posType; //ประเภท - formMain.positionExecutive = data.posExecutive; //ตำแหน่งทางการ บริหาร - formMain.positionPathSide = data.positionArea; //ด้านสาขา - formMain.positionExecutiveSide = data.positionExecutiveField; //ด้านทางการบริหาร + formMain.ocId = data.org ?? "-"; //สังกัด + formMain.positionId = data.position ?? "-"; //ตำแหน่ง + formMain.positionLine = data.positionField ?? "-"; //สายงาน + formMain.positionLevel = data.posLevel ?? "-"; //ระดับ + formMain.numberId = data.posMasterNo ?? "-"; //เลขที่ตำแหน่ง + formMain.positionType = data.posType ?? "-"; //ประเภท + formMain.positionExecutive = data.posExecutive ?? "-"; //ตำแหน่งทางการ บริหาร + formMain.positionPathSide = data.positionArea ?? "-"; //ด้านสาขา + formMain.positionExecutiveSide = data.positionExecutiveField ?? "-"; //ด้านทางการบริหาร formMain.containDate = data.dateAppoint; formMain.workDate = data.dateStart; @@ -463,16 +426,6 @@ function getDataHistory() { }); } -// watch( -// () => modalHistory.value, -// (isOpen) => { -// if (isOpen === true) { -// filterKeyword.value = ""; -// getDataHistory(); -// } -// } -// ); - onMounted(() => { getData(); }); @@ -505,34 +458,72 @@ onMounted(() => {
-
-
- {{ - fieldLabels[field as keyof typeof fieldLabels] - }} +
+
+
สังกัด
+
+
{{ formMain.ocId }}
+
+
+
+
ตำแหน่ง
+
+
{{ formMain.positionId }}
+
+
+
+
เลขที่ตำแหน่ง
+
+
{{ formMain.numberId }}
+
+
+
+
ตำแหน่งทางการบริหาร
- {{ formMain[field] ? formMain[field] : "-" }} + {{ formMain.positionExecutive }} +
+
+
+
+
ด้านทางการบริหาร
+
+
+ {{ formMain.positionExecutiveSide }}
-
-
- {{ - fieldLabels[field as keyof typeof fieldLabels] - }} +
+
+
สายงาน
- {{ formMain[field] ? formMain[field] : "-" }} + {{ formMain.positionLine }} +
+
+
+
+
{{ empType === "" ? "ประเภทตำแหน่ง" : "กลุ่มงาน" }}
+
+
+ {{ formMain.positionType }} +
+
+
+
+
{{ empType === "" ? "ระดับตำแหน่ง" : "ระดับชั้นงาน" }}
+
+
+ {{ formMain.positionLevel }} +
+
+
+
+
ด้าน/สาขา
+
+
+ {{ formMain.positionPathSide }}
@@ -665,7 +656,7 @@ onMounted(() => { -
+ @@ -785,7 +776,7 @@ onMounted(() => { บันทึกข้อมูล - +
diff --git a/src/modules/04_registryNew/components/detail/PersonalInformation/04_FamilyNew.vue b/src/modules/04_registryNew/components/detail/PersonalInformation/04_FamilyNew.vue index 53c2b06d2..0e793196c 100644 --- a/src/modules/04_registryNew/components/detail/PersonalInformation/04_FamilyNew.vue +++ b/src/modules/04_registryNew/components/detail/PersonalInformation/04_FamilyNew.vue @@ -2,12 +2,15 @@ import { reactive, ref, onMounted } from "vue"; 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 { DataOption } from "@/modules/04_registryNew/interface/index/Main"; +import type { + FormPerson, + FormChildren, +} from "@/modules/04_registryNew/interface/index/family"; import DialogHeader from "@/components/DialogHeader.vue"; @@ -37,6 +40,7 @@ const visibleColumns = ref([ "lastName", "job", "isLive", + "lastNameOld", ]); const columns = ref([ { @@ -76,6 +80,15 @@ const columns = ref([ headerStyle: "font-size: 14px", style: "font-size: 14px", }, + { + name: "lastNameOld", + align: "left", + label: "นามสกุลเดิม", + sortable: true, + field: "lastNameOld", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, { name: "job", align: "left", @@ -93,39 +106,39 @@ const columns = ref([ field: "isLive", headerStyle: "font-size: 14px", style: "font-size: 14px", - format: (val) => convertisLive(val), + format: (val) => (val ? "มีชีวิต" : "ถึงแก่กรรม"), }, ]); const rows = ref([]); /** ข้อมูล*/ -const fatherData = ref({ - isLive: 1, - citizenId: "1231231231231", - prefix: "นาย", - firstName: "ตรีชาไทย", - lastName: "หวังดี", - job: "จอมพล", +const fatherData = reactive({ + isLive: null, + citizenId: "", + prefix: "", + firstName: "", + lastName: "", + job: "", }); -const motherData = ref({ - isLive: 0, - citizenId: "1572476458930", - prefix: "นาง", - firstName: "บุษดี", - lastName: "มาดี", - job: "พยาบาล", +const motherData = reactive({ + isLive: null, + citizenId: "", + prefix: "", + firstName: "", + lastName: "", + job: "", }); -const coupleData = ref({ - isLive: 1, - citizenId: "1231231231231", - prefix: "นาย", - firstName: "ตรีชาไทย", - lastName: "หวังดี", - job: "จอมพล", - lastNameOld: "หวังดี", - statusMarital: "แต่งงานแล้ว", +const coupleData = reactive({ + isLive: null, + citizenId: "", + prefix: "", + firstName: "", + lastName: "", + job: "", + lastNameOld: "", + statusMarital: "", }); -const childData = ref([{}]); +const childData = ref([]); const modal = ref(false); const modalHistory = ref(false); @@ -134,12 +147,13 @@ const filterHistory = ref(""); const titleForm = ref(""); const typeForm = ref(""); const isEdit = ref(false); +const childernId = ref(""); const optionRelationshipMain = ref([]); const optionRelationship = ref([]); const fromData = reactive({ - isLive: 0, + isLive: 1, citizenId: "", prefix: "", firstName: "", @@ -152,9 +166,20 @@ const fromData = reactive({ function fetchDataFather() { showLoader(); http - .get(config.API.profileFamily(empType.value, "father")) + .get( + config.API.profileFamily(empType.value, "father") + `/${profileId.value}` + ) .then((res) => { - console.log(res); + const data = res.data.result; + + if (data) { + fatherData.isLive = data.fatherLive; + fatherData.citizenId = data.fatherCitizenId; + fatherData.prefix = data.fatherPrefix; + fatherData.firstName = data.fatherFirstName; + fatherData.lastName = data.fatherLastName; + fatherData.job = data.fatherCareer; + } }) .catch((err) => { messageError($q, err); @@ -166,9 +191,19 @@ function fetchDataFather() { function fetchDataMother() { showLoader(); http - .get(config.API.profileFamily(empType.value, "mother ")) + .get( + config.API.profileFamily(empType.value, "mother") + `/${profileId.value}` + ) .then((res) => { - console.log(res); + const data = res.data.result; + if (data) { + motherData.isLive = data.motherLive; + motherData.citizenId = data.motherCitizenId; + motherData.prefix = data.motherPrefix; + motherData.firstName = data.motherFirstName; + motherData.lastName = data.motherLastName; + motherData.job = data.motherCareer; + } }) .catch((err) => { messageError($q, err); @@ -180,9 +215,21 @@ function fetchDataMother() { function fetchDataCouple() { showLoader(); http - .get(config.API.profileFamily(empType.value, "couple")) + .get( + config.API.profileFamily(empType.value, "couple") + `/${profileId.value}` + ) .then((res) => { - console.log(res); + const data = res.data.result; + if (data) { + coupleData.isLive = data.coupleLive; + coupleData.citizenId = data.coupleCitizenId; + coupleData.prefix = data.couplePrefix; + coupleData.firstName = data.coupleFirstName; + coupleData.lastName = data.coupleLastName; + coupleData.job = data.coupleCareer; + coupleData.lastNameOld = data.coupleLastNameOld; + coupleData.statusMarital = data.relationship; + } }) .catch((err) => { messageError($q, err); @@ -194,9 +241,13 @@ function fetchDataCouple() { function fetchDataChildren() { showLoader(); http - .get(config.API.profileFamily(empType.value, "children")) + .get( + config.API.profileFamily(empType.value, "children") + + `/${profileId.value}` + ) .then((res) => { - console.log(res); + const data = res.data.result; + childData.value = data; }) .catch((err) => { messageError($q, err); @@ -207,21 +258,52 @@ function fetchDataChildren() { } function onSubmit(type: string) { - dialogConfirm($q, () => { - if (type === "father") { - } else if (type === "mother") { - } else if (type === "couple") { - } else if (type === "child") { - submitChildren(); + dialogConfirm($q, async () => { + showLoader(); + + const formBody = { + profileId: + !isEdit.value && empType.value === "" ? profileId.value : undefined, + profileEmployeeId: + !isEdit.value && empType.value !== "" ? profileId.value : undefined, + [`${type}CitizenId`]: fromData.citizenId, + [`${type}Prefix`]: fromData.prefix, + [`${type}FirstName`]: fromData.firstName, + [`${type}LastName`]: fromData.lastName, + [`${type}Career`]: fromData.job, + [`${type}Live`]: fromData.isLive === 1 ? true : false, + relationship: type === "couple" ? fromData.statusMarital : undefined, + coupleLastNameOld: type === "couple" ? fromData.lastNameOld : undefined, + }; + + const url = + isEdit.value && type === "children" + ? config.API.profileFamily(empType.value, type) + `/${childernId.value}` + : config.API.profileFamily(empType.value, type); + const method = isEdit.value && type === "children" ? "patch" : "post"; + try { + await http[method](url, formBody); + success($q, "บันทึกข้อมูลสำเร็จ"); + type === "father" + ? fetchDataFather() + : type === "mother" + ? fetchDataMother() + : type === "couple" + ? fetchDataCouple() + : fetchDataChildren(); + closeDialog(); + } catch (e) { + messageError($q, e); + } finally { + hideLoader(); } - closeDialog(); }); } function closeDialog() { modal.value = false; modalHistory.value = false; - fromData.isLive = 0; + fromData.isLive = 1; fromData.citizenId = ""; fromData.prefix = ""; fromData.firstName = ""; @@ -239,43 +321,52 @@ function onOpenDialogForm( modal.value = true; typeForm.value = type; isEdit.value = isStatusEdit; + console.log(data); if (type === "father") { titleForm.value = "บิดา"; - if (isStatusEdit) { - fromData.isLive = fatherData.value.isLive; - fromData.citizenId = fatherData.value.citizenId; - fromData.prefix = fatherData.value.prefix; - fromData.firstName = fatherData.value.firstName; - fromData.lastName = fatherData.value.lastName; - fromData.job = fatherData.value.job; - } + console.log(fatherData.isLive); + + fromData.isLive = + fatherData.isLive === null ? 1 : fatherData.isLive ? 1 : 0; + fromData.citizenId = fatherData.citizenId; + fromData.prefix = fatherData.prefix; + fromData.firstName = fatherData.firstName; + fromData.lastName = fatherData.lastName; + fromData.job = fatherData.job; } else if (type === "mother") { titleForm.value = "มารดา"; - if (isStatusEdit) { - fromData.isLive = motherData.value.isLive; - fromData.citizenId = motherData.value.citizenId; - fromData.prefix = motherData.value.prefix; - fromData.firstName = motherData.value.firstName; - fromData.lastName = motherData.value.lastName; - fromData.job = motherData.value.job; - } + + fromData.isLive = + motherData.isLive === null ? 1 : motherData.isLive ? 1 : 0; + fromData.citizenId = motherData.citizenId; + fromData.prefix = motherData.prefix; + fromData.firstName = motherData.firstName; + fromData.lastName = motherData.lastName; + fromData.job = motherData.job; } else if (type === "couple") { titleForm.value = "คู่สมรส"; - } else if (type === "child") { + fromData.isLive = 1; + } else if (type === "children") { titleForm.value = "บุตร"; - fromData.isLive = data.isLive; - fromData.citizenId = data.citizenId; - fromData.prefix = data.prefix; - fromData.firstName = data.firstName; - fromData.lastName = data.lastName; - fromData.job = data.job; + if (isStatusEdit) { + childernId.value = data.id; + fromData.isLive = + data.childrenLive === null ? 1 : data.childrenLive ? 1 : 0; + fromData.citizenId = data.childrenCitizenId; + fromData.prefix = data.childrenPrefix; + fromData.firstName = data.childrenFirstName; + fromData.lastName = data.childrenLastName; + fromData.job = data.childrenCareer; + } } } -function onOpenDialogHistory(type: string) { +function onOpenDialogHistory(type: string, id: string = "") { modalHistory.value = true; - console.log(type); + typeForm.value = type; + const historyId = type === "children" ? id : profileId.value; + fetchHistory(historyId, type); } function fetchDataRelationship() { @@ -305,42 +396,30 @@ const filterSelectorRelation = (val: any, update: Function) => { }); }; -function convertisLive(status: number) { - switch (status) { - case 1: - return "ถึงแก่กรรม"; - case 2: - return "มีชีวิต"; - - default: - break; - } -} - -function submitChildren() { - const body = { - profileId: empType.value === "" ? profileId.value : undefined, - profileEmployeeId: empType.value !== "" ? profileId.value : undefined, - childrenCareer: fromData.job, - childrenFirstName: fromData.firstName, - childrenLastName: fromData.lastName, - childrenPrefix: fromData.prefix, - childrenLive: fromData.isLive === 1 ? true : false, - childrenCitizenId: fromData.citizenId, - }; - +function fetchHistory(id: string, type: string) { + hideLoader(); http - .post(config.API.profileFamily(empType.value, "children"), body) - .then(() => { - success($q, "บันทึกข้อมูลสำเร็จ"); + .get(config.API.profileFamilyHistory(id, empType.value, type)) + .then((res) => { + const data = res.data.result; + rows.value = data.map((e: any) => ({ + citizenId: e[`${type}CitizenId`], + prefix: e[`${type}Prefix`], + firstName: e[`${type}FirstName`], + lastName: e[`${type}LastName`], + job: e[`${type}Career`], + isLive: e[`${type}Live`], + lastNameOld: type === "couple" ? e.coupleLastNameOld : undefined, + })); }) .catch((err) => { messageError($q, err); + }) + .finally(() => { + hideLoader(); }); } -function fetchHistory() {} - onMounted(() => { fetchDataFather(); fetchDataMother(); @@ -379,7 +458,7 @@ onMounted(() => { size="14px" @click="onOpenDialogHistory('father')" > - ประวัติการแก้ไขข้อมูลครอบครัวประวัติการแก้ไขข้อมูลบิดา
@@ -415,8 +494,13 @@ onMounted(() => { สถานภาพการมีชีวิต
-
มีชีวิตอยู่
-
ถึงแก่กรรม
+ {{ + fatherData.isLive === true + ? "มีชีวิตอยู่" + : fatherData.isLive === false + ? "ถึงแก่กรรม" + : "-" + }}
@@ -449,7 +533,7 @@ onMounted(() => { size="14px" @click="onOpenDialogHistory('mother')" > - ประวัติการแก้ไขข้อมูลครอบครัวประวัติการแก้ไขข้อมูลมารดา
@@ -468,7 +552,10 @@ onMounted(() => {
{{ motherData.prefix - ? motherData.prefix + motherData.firstName + " " + motherData.lastName + ? motherData.prefix + + motherData.firstName + + " " + + motherData.lastName : "-" }}
@@ -482,8 +569,13 @@ onMounted(() => { สถานภาพการมีชีวิต
-
มีชีวิตอยู่
-
ถึงแก่กรรม
+ {{ + motherData.isLive === true + ? "มีชีวิตอยู่" + : motherData.isLive === false + ? "ถึงแก่กรรม" + : "-" + }}
@@ -509,7 +601,7 @@ onMounted(() => { > -
+
{ size="14px" @click="onOpenDialogHistory('couple')" > - ประวัติการแก้ไขข้อมูลครอบครัวประวัติการแก้ไขข้อมูลคู่สมรส
- +
คู่สมรส
@@ -535,7 +631,7 @@ onMounted(() => {
สถานภาพการสมรส
- {{ coupleData.statusMarital }} + {{ coupleData.statusMarital ?? "-" }}
@@ -543,7 +639,7 @@ onMounted(() => {
เลขบัตรประจำตัวประชาชน
- {{ coupleData.citizenId }} + {{ coupleData.citizenId ?? "-" }}
@@ -560,7 +656,13 @@ onMounted(() => {
อาชีพ
- {{ coupleData.job }} + {{ coupleData.job ?? "-" }} +
+ +
+
นามสกุลเดิม
+
+ {{ coupleData.lastNameOld }}
@@ -568,8 +670,13 @@ onMounted(() => { สถานภาพการมีชีวิต
-
มีชีวิตอยู่
-
ถึงแก่กรรม
+ {{ + coupleData.isLive === true + ? "มีชีวิตอยู่" + : coupleData.isLive === false + ? "ถึงแก่กรรม" + : "-" + }}
@@ -588,7 +695,7 @@ onMounted(() => { color="primary" icon="add" size="14px" - @click="onOpenDialogForm('child')" + @click="onOpenDialogForm('children')" > เพิ่มบุตร @@ -597,7 +704,7 @@ onMounted(() => {
- +
บุตรคนที่ : {{ index + 1 }} @@ -611,7 +718,7 @@ onMounted(() => { icon="mdi-pencil-outline" size="14px" dense - @click="onOpenDialogForm('child', true, item)" + @click="onOpenDialogForm('children', true, item)" > แก้ไขข้อมูล @@ -622,9 +729,9 @@ onMounted(() => { color="info" icon="mdi-history" size="14px" - @click="onOpenDialogHistory('child')" + @click="onOpenDialogHistory('children', item.id)" > - ประวัติการแก้ไขข้อมูลครอบครัวประวัติการแก้ไขข้อมูลบุตร
@@ -635,7 +742,7 @@ onMounted(() => {
เลขบัตรประจำตัวประชาชน
- {{ item.citizenId }} + {{ item.childrenCitizenId }}
@@ -644,14 +751,17 @@ onMounted(() => {
{{ - item.prefix - ? item.prefix + item.firstName + " " + item.lastName + item.childrenPrefix + ? item.childrenPrefix + + item.childrenFirstName + + " " + + item.childrenLastName : "-" }}
อาชีพ
- {{ item.job }} + {{ item.childrenCareer }}
@@ -659,8 +769,13 @@ onMounted(() => { สถานภาพการมีชีวิต
-
มีชีวิตอยู่
-
ถึงแก่กรรม
+ {{ + item.childrenLive === true + ? "มีชีวิตอยู่" + : item.childrenLive === false + ? "ถึงแก่กรรม" + : "-" + }}
@@ -674,19 +789,12 @@ onMounted(() => { -
{ - +
@@ -899,7 +1018,11 @@ onMounted(() => { :display-value="$q.lang.table.columns" emit-value map-options - :options="columns" + :options=" + typeForm === 'couple' + ? columns + : columns?.filter((e) => e.name !== 'lastNameOld') + " option-value="name" options-cover style="min-width: 150px" @@ -910,7 +1033,11 @@ onMounted(() => { flat bordered dense - :columns="columns" + :columns=" + typeForm === 'couple' + ? columns + : columns?.filter((e) => e.name !== 'lastNameOld') + " :rows="rows" :paging="true" :rows-per-page-options="[10, 25, 50, 100]" diff --git a/src/modules/04_registryNew/components/detail/PersonalInformation/05_Education.vue b/src/modules/04_registryNew/components/detail/PersonalInformation/05_Education.vue index c6ee665ff..c8ece79b7 100644 --- a/src/modules/04_registryNew/components/detail/PersonalInformation/05_Education.vue +++ b/src/modules/04_registryNew/components/detail/PersonalInformation/05_Education.vue @@ -653,6 +653,8 @@ async function addData() { } function editData(idData: string) { + console.log(educationData); + http .patch(config.API.profileNewEducationByEducationId(idData, empType.value), { ...educationData, @@ -660,6 +662,8 @@ function editData(idData: string) { startYear: undefined, endYear: undefined, isDate: isDate.value === "false" ? false : true, + durationYear: + educationData.durationYear === "" ? null : educationData.durationYear, }) .then(() => { fetchData(id.value); @@ -797,7 +801,7 @@ onMounted(async () => {
- {{ col.value === "" ? "-" : col.value }} + {{ col.value === ""|| col.value === null ? "-" : col.value }}
diff --git a/src/modules/04_registryNew/components/detail/Salary/01_PositionSalary.vue b/src/modules/04_registryNew/components/detail/Salary/01_PositionSalary.vue index 4e653cc85..67eb614d5 100644 --- a/src/modules/04_registryNew/components/detail/Salary/01_PositionSalary.vue +++ b/src/modules/04_registryNew/components/detail/Salary/01_PositionSalary.vue @@ -143,7 +143,6 @@ const formFilter = reactive({ pageSize: 10, keyword: "", }); -const maxPage = ref(1); const pagination = ref({ page: 1, @@ -176,11 +175,17 @@ const salaryId = ref(""); const dataLevel = ref([]); const posNoOptions = ref(store.optionTemplatePos); -const positionLineOptions = ref(store.optionTemplatePos); + const posTypeOptions = ref([]); const posTypeOptionsMain = ref([]); const posLevelOption = ref([]); const posLevelOptionMain = ref([]); +const positionFielOptiond = ref([]); +const positionFielOptiondMain = ref([]); +const positionAreaOptiond = ref([]); +const positionAreaOptiondMain = ref([]); +const posExecutiveOption = ref([]); +const posExecutiveOptionMain = ref([]); const docOption = ref(store.optionTemplateDoc); @@ -219,18 +224,26 @@ 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: e.posLevelName, + name: e.posLevelName.toString(), })); - posLevelOption.value = posLevelOptionMain.value; + formDataSalary.positionLevel = !status ? "" : formDataSalary.positionLevel; } } async function onClickOpenDialog(statusEdit: boolean = false, data: any = []) { - dataLevel.value.length === 0 && (await fetchType()); + if (empType.value === "") { + dataLevel.value.length === 0 && fetchType(); + fetchDataOption(); + fetchDataOptionExecutive(); + } else { + fetchOptionGroup(); + } + setTimeout(async () => { statusEdit && (await updateSelectType(data.positionType, true)); isStatusEdit.value = statusEdit; @@ -270,8 +283,8 @@ function filterSelector(val: any, update: Function, filtername: string) { break; case "positionLine": update(() => { - positionLineOptions.value = store.optionTemplatePos.filter( - (v: DataOption2) => v.name.indexOf(val) > -1 + positionFielOptiond.value = positionFielOptiondMain.value.filter( + (v: DataOption) => v.name.indexOf(val) > -1 ); }); break; @@ -296,6 +309,21 @@ function filterSelector(val: any, update: Function, filtername: string) { ); }); 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; @@ -318,14 +346,19 @@ function onSubmit() { async function submit() { const formData = { - profileId: isStatusEdit.value || empType.value !== ''? undefined : profileId.value, - profileEmployeeId: empType.value !== "" ? profileId.value : undefined, + 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: formDataSalary.positionLine, //สายงาน - positionPathSide: formDataSalary.positionPathSide, // ด้าน/สาขา - positionExecutive: formDataSalary.positionExecutive, //ตำแหน่งทางการบริหาร + 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: @@ -395,6 +428,95 @@ function onClikcHistory(id: string) { modalHistory.value = true; } +async function fetchDataOption() { + showLoader(); + await http + .get(config.API.orgPosPosition + `?keyword=&type=ALL`) + .then((res) => { + const data = res.data.result; + console.log(res); + + 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 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(); + }); +} + +async function fetchOptionGroup() { + showLoader(); + await http + .get(config.API.orgEmployeeType) + .then(async (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(); + }); +} + onMounted(() => { fetchListSalary(); }); @@ -535,7 +657,7 @@ onMounted(() => { - + - - -
- -
- -
-
- - -
-
{ lazy-rules borderless v-model="formDataSalary.positionType" - :label="`${'ตำแหน่งประเภท'}`" + :label="empType == '' ? 'ตำแหน่งประเภท' : 'กลุ่มงาน'" emit-value map-options option-label="name" @@ -711,7 +780,7 @@ onMounted(() => { use-input input-debounce="0" @update:model-value="updateSelectType" - :rules="[(val: string) => !!val || `${'กรุณาเลือกตำแหน่งประเภท'}`]" + :rules="empType == '' ? [(val: string) => !!val || 'กรุณาเลือกตำแหน่งประเภท' ]:[(val: string) => !!val || 'กรุณาเลือกกลุ่มงาน' ]" @filter="(inputValue: any, doneFn: Function) => filterSelector(inputValue, doneFn, 'posType' )" @@ -726,8 +795,8 @@ onMounted(() => { lazy-rules borderless v-model="formDataSalary.positionLevel" - :rules="[(val: string) => !!val || `${'กรุณาเลือกระดับตำแหน่ง'}`]" - :label="`${'ระดับตำแหน่ง'}`" + :rules="empType == '' ? [(val: string) => !!val || 'กรุณาเลือกระดับตำแหน่ง' ] : [(val: string) => !!val || 'กรุณาเลือกระดับชั้นงาน']" + :label="empType == '' ? 'ระดับตำแหน่ง' : 'ระดับชั้นงาน'" emit-value map-options option-label="name" @@ -742,6 +811,76 @@ onMounted(() => { />
+ +
+ +
+ +
+ +
+ +
+ +
+
{ hide-bottom-space />
+
{ id: e.id, name: e.posLevelName, })); - posLevelOps.value = list; + const seen = new Set(); + posLevelOps.value = list.filter((item: DataOption) => { + if (seen.has(item.name)) { + return false; + } else { + seen.add(item.name); + return true; + } + }); } return { fetchType, diff --git a/src/modules/04_registryNew/views/detailView.vue b/src/modules/04_registryNew/views/detailView.vue index db82a9f41..4e452ca88 100644 --- a/src/modules/04_registryNew/views/detailView.vue +++ b/src/modules/04_registryNew/views/detailView.vue @@ -465,7 +465,7 @@ async function selectAvatarHistory() { showLoader(); await http .get(config.API.orgProfileAvatar + `/select/${profileId.value}/${data.id}`) - .then(async(res) => { + .then(async (res) => { closeImage(); await fetchDataPersonal(); @@ -512,7 +512,7 @@ onMounted(async () => { dropdown-icon="mdi-chevron-down" > diff --git a/src/modules/04_registryNew/views/list.vue b/src/modules/04_registryNew/views/list.vue index 5118a2721..cb3383b48 100644 --- a/src/modules/04_registryNew/views/list.vue +++ b/src/modules/04_registryNew/views/list.vue @@ -1,11 +1,10 @@ diff --git a/src/modules/14_KPI/components/Tab/Topic/03_Develop.vue b/src/modules/14_KPI/components/Tab/Topic/03_Develop.vue new file mode 100644 index 000000000..55190bb9f --- /dev/null +++ b/src/modules/14_KPI/components/Tab/Topic/03_Develop.vue @@ -0,0 +1,449 @@ + + + + + diff --git a/src/modules/14_KPI/components/Table.vue b/src/modules/14_KPI/components/Table.vue deleted file mode 100644 index 1d46c384a..000000000 --- a/src/modules/14_KPI/components/Table.vue +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/src/modules/14_KPI/components/detailList/01_Assessment.vue b/src/modules/14_KPI/components/detailList/01_Assessment.vue deleted file mode 100644 index 58d269d07..000000000 --- a/src/modules/14_KPI/components/detailList/01_Assessment.vue +++ /dev/null @@ -1,244 +0,0 @@ - - - - - diff --git a/src/modules/14_KPI/components/detailList/Dialog/01_FormIndicator.vue b/src/modules/14_KPI/components/detailList/Dialog/01_FormIndicator.vue deleted file mode 100644 index 65e8531a6..000000000 --- a/src/modules/14_KPI/components/detailList/Dialog/01_FormIndicator.vue +++ /dev/null @@ -1,527 +0,0 @@ - - - - diff --git a/src/modules/14_KPI/components/detailList/TabMain.vue b/src/modules/14_KPI/components/detailList/TabMain.vue deleted file mode 100644 index 1f9e7cc17..000000000 --- a/src/modules/14_KPI/components/detailList/TabMain.vue +++ /dev/null @@ -1,102 +0,0 @@ - - - - - diff --git a/src/modules/14_KPI/components/detailList/Topic/!02_CompetencyCard.vue b/src/modules/14_KPI/components/detailList/Topic/!02_CompetencyCard.vue deleted file mode 100644 index 665dc0864..000000000 --- a/src/modules/14_KPI/components/detailList/Topic/!02_CompetencyCard.vue +++ /dev/null @@ -1,345 +0,0 @@ - diff --git a/src/modules/14_KPI/interface/request/index.ts b/src/modules/14_KPI/interface/request/index.ts new file mode 100644 index 000000000..25eb9e8e0 --- /dev/null +++ b/src/modules/14_KPI/interface/request/index.ts @@ -0,0 +1,82 @@ +interface FormProfile { + fullName: string; + + position: string; + type: string; + level: string; + status: string | undefined; + result: string | undefined; + score: string; + + avartar: string; +} + +interface FormDataAssigned { + including: string; + includingName: string; + target: string; + unit: string; + weight: number | null; + achievement1: string; + achievement2: string; + achievement3: string; + achievement4: string; + achievement5: string; + meaning: string; + formula: string; + kpiUserEvaluationId: string; +} + +interface FormCapacityList { + id: string | null; + name: string; + level: string; + point: number; + weight: number; + summary: number; +} + +interface ListCriteria { + id: string; + level: number; + description: string; +} +interface ListCapacity { + id: string; + level: number; + description: string; + capacityId: string; +} + +interface FormComment { + topic: string; + reason: string; +} + +interface FormCommentByRole { + id: string; + topic: string; + reason: string; + + reasonEvaluator: string; + reasonCommander: string; + reasonCommanderHigh: string; +} + +interface FormQuery { + page: number; + pageSize: number; + round: string; + keyword: string; +} + +export type { + FormProfile, + FormDataAssigned, + FormCapacityList, + ListCriteria, + ListCapacity, + FormComment, + FormCommentByRole, + FormQuery, +}; diff --git a/src/modules/14_KPI/interface/response/index.ts b/src/modules/14_KPI/interface/response/index.ts new file mode 100644 index 000000000..c93bb00ff --- /dev/null +++ b/src/modules/14_KPI/interface/response/index.ts @@ -0,0 +1,44 @@ +interface ResEvaluator { + createdAt: string; + createdFullName: string; + createdUserId: string; + id: string; + kpiUserEvaluationId: string; + lastUpdateFullName: string; + lastUpdateUserId: string; + lastUpdatedAt: string; + reason: string; + topic: string; + type: string; +} + +interface ResRound { + createdAt: string; + createdFullName: string; + createdUserId: string; + durationKPI: string; + endDate: string; + id: string; + isActive: boolean; + lastUpdateFullName: string; + lastUpdateUserId: string; + lastUpdatedAt: string; + startDate: string; + year: number; +} +interface ResEvaluatorAssessor { + commanderHighId: string | null; + commanderId: string | null; + createdAt: string; + evaluationResults: string; + evaluationStatus: string; + evaluatorId: string; + firstname: string; + id: string; + kpiPeriodId: string; + lastname: string; + prefix: string; + profileId: string; +} + +export type { ResEvaluator, ResRound, ResEvaluatorAssessor }; diff --git a/src/modules/14_KPI/store.ts b/src/modules/14_KPI/store.ts new file mode 100644 index 000000000..85cc771d5 --- /dev/null +++ b/src/modules/14_KPI/store.ts @@ -0,0 +1,402 @@ +import { defineStore } from "pinia"; +import { ref, reactive } from "vue"; +import type { DataOption } from "@/modules/14_KPI/interface/index/Main"; +import type { FormQuery } from "@/modules/14_KPI/interface/request/index"; + +export const useKpiDataStore = defineStore("KPIDataAdmin", () => { + const tabMainevaluator = ref("1"); + const yearRound = ref(new Date().getFullYear()); + const formQuery = reactive({ + page: 1, + pageSize: 10, + round: "", + keyword: "", + }); + const selected = ref([]); + + const tabMain = ref("1"); + const dataProfile = ref({ + profileId: null, + prefix: "", + rank: "", + firstName: "", + lastName: "", + citizenId: "", + position: "", + posMaster: null, + posLevelName: null, + posLevelRank: null, + posLevelId: null, + posTypeName: null, + posTypeRank: null, + posTypeId: null, + posExecutiveName: "", + posExecutivePriority: null, + posExecutiveId: null, + rootId: null, + root: "", + child1Id: null, + child1: null, + child2Id: null, + child2: null, + child3Id: null, + child3: null, + child4Id: null, + child4: null, + node: null, + nodeId: null, + }); + + const dataEvaluation = ref({ + evaluationReqEdit: null, + evaluationStatus: null, + profileId: null, + evaluatorId: null, + commanderId: null, + commanderHighId: null, + plannedPoint: 0, + rolePoint: 0, + specialPoint: 0, + }); + + const competencyType = ref([ + { + id: "HEAD", + name: "สมรรถนะหลัก", + }, + { + id: "GROUP", + name: "สมรรถนะประจำกลุ่มงาน", + }, + { + id: "EXECUTIVE", + name: "สมรรถนะประจำผู้บริหารกรุงเทพมหานคร", + }, + { + id: "DIRECTOR", + name: "สมรรถนะเฉพาะสำหรับตำแหน่ง ผอ.เขต ผช.ผอ.เขต และหัวหน้าฝ่ายในสังกัด สนง.เขต", + }, + { + id: "INSPECTOR", + name: "สมรรถนะเฉพาะสำหรับตำแหน่งผู้ตรวจราชการ กทม. และผู้ตรวจราชการ", + }, + ]); + + function convertCompetencyType(val: string) { + const competency = competencyType.value.find( + (x: DataOption) => x.id == val + ); + return competency?.name; + } + + const statusOptions = ref([ + { + id: "NEW", + name: "จัดทำข้อตกลง", + }, + { + id: "NEW_EVALUATOR", + name: "รอผู้ประเมินตรวจสอบข้อตกลง", + }, + { + id: "NEW_COMMANDER", + name: "รอผู้บังคับบัญชาเหนือขึ้นไปตรวจสอบข้อตกลง", + }, + { + id: "NEW_COMMANDER_HIGH", + name: "รอผู้บังคับบัญชาเหนือขึ้นไปอีกชั้นหนึ่งตรวจสอบข้อตกลง", + }, + { + id: "APPROVE", + name: "รายงานความก้าวหน้า", + }, + { + id: "EVALUATING", + name: "รายงานผลสำเร็จของงาน", + }, + { + id: "EVALUATING_EVALUATOR", + name: "รอผู้ประเมินตรวจสอบผล", + }, + { + id: "EVALUATING_COMMANDER", + name: "รอผู้บังคับบัญชาเหนือขึ้นไปตรวจสอบผล", + }, + { + id: "EVALUATING_COMMANDER_HIGH", + name: "รอผู้บังคับบัญชาเหนือขึ้นไปอีกชั้นหนึ่งตรวจสอบผล", + }, + { + id: "COMPLETE", + name: "เสร็จสิ้น", + }, + ]); + + function convertStatus(val: string) { + return statusOptions.value.find((x: DataOption) => x.id == val)?.name; + } + + function convertResults(val: string) { + switch (val) { + case "PENDING": + return "รอดำเนินการ"; + case "PASSED": + return "ผ่านการประเมิน"; + case "NOTPASSED": + return "ไม่ผ่านการประเมิน"; + default: + break; + } + } + + function checkCompetency() { + const position = dataEvaluation.value.position; + const posTypeName = dataEvaluation.value.posTypeName; + const posLevelName = dataEvaluation.value.posLevelName; + const executiveName = dataEvaluation.value.posExecutiveName; + + if ( + position == "ผู้ตรวจราชการกรุงเทพมหานคร" || + position == "ผู้ตรวจราชการ" + ) { + competencyType.value = competencyType.value.filter( + (x: DataOption) => x.id == "HEAD" || x.id == "INSPECTOR" + ); + } else if (position == "ผู้อำนวยการเขต") { + competencyType.value = competencyType.value.filter( + (x: DataOption) => x.id == "HEAD" || x.id == "DIRECTOR" + ); + } else { + if (executiveName == null) { + competencyType.value = competencyType.value.filter( + (x: DataOption) => x.id == "HEAD" || x.id == "GROUP" + ); + } else { + competencyType.value = competencyType.value.filter( + (x: DataOption) => x.id == "HEAD" || x.id == "EXECUTIVE" + ); + } + // switch (posTypeName + " " + posLevelName) { + // // case "ทั่วไป ปฏิบัติงาน": + // // case "ทั่วไป ชำนาญงาน": + // // case "ทั่วไป อาวุโส": + // // case "วิชาการ ปฏิบัติการ": + // // case "วิชาการ ชำนาญการ": + // // case "วิชาการ ชำนาญการพิเศษ": + // // case "วิชาการ เชี่ยวชาญ": + // // case "วิชาการ ทรงคุณวุฒิ": + // // competencyType.value = competencyType.value.filter( + // // (x: DataOption) => x.id == "HEAD" || x.id == "GROUP" + // // ); + // // break; + // case "อำนวยการ ต้น": + // case "อำนวยการ สูง": + // case "บริหาร ต้น": + // case "บริหาร สูง": + // competencyType.value = competencyType.value.filter( + // (x: DataOption) => x.id == "HEAD" || x.id == "EXECUTIVE" + // ); + // break; + // default: + // competencyType.value = competencyType.value.filter( + // (x: DataOption) => x.id == "HEAD" || x.id == "GROUP" + // ); + // break; + // } + } + } + + const defaultCompetencyCoreLevel = ref(); + const defaultCompetencyGroupLevel = ref(null); + function checkCompetencyDefaultCompetencyLevel() { + const posTypeName = dataEvaluation.value.posTypeName; + const posLevelName = dataEvaluation.value.posLevelName; + + switch (posTypeName + " " + posLevelName) { + case "บริหาร สูง": + defaultCompetencyCoreLevel.value = 5; + break; + case "บริหาร ต้น": + defaultCompetencyCoreLevel.value = 4; + break; + case "อำนวยการ สูง": + defaultCompetencyCoreLevel.value = 4; + break; + case "อำนวยการ ต้น": + defaultCompetencyCoreLevel.value = 3; + break; + case "วิชาการ ทรงคุณวุฒิ": + defaultCompetencyCoreLevel.value = 5; + defaultCompetencyGroupLevel.value = 5; + break; + case "วิชาการ เชี่ยวชาญ": + defaultCompetencyCoreLevel.value = 4; + defaultCompetencyGroupLevel.value = 4; + break; + case "วิชาการ ชำนาญการพิเศษ": + defaultCompetencyCoreLevel.value = 3; + defaultCompetencyGroupLevel.value = 4; + break; + case "วิชาการ ชำนาญการ": + defaultCompetencyCoreLevel.value = 2; + defaultCompetencyGroupLevel.value = 3; + break; + case "วิชาการ ปฏิบัติการ": + defaultCompetencyCoreLevel.value = 1; + defaultCompetencyGroupLevel.value = 2; + break; + case "ทั่วไป ทักษะพิเศษ": + defaultCompetencyCoreLevel.value = 4; + defaultCompetencyGroupLevel.value = 4; + break; + case "ทั่วไป อาวุโส": + defaultCompetencyCoreLevel.value = 3; + defaultCompetencyGroupLevel.value = 3; + break; + case "ทั่วไป ชำนาญงาน": + defaultCompetencyCoreLevel.value = 2; + defaultCompetencyGroupLevel.value = 2; + break; + case "ทั่วไป ปฏิบัติงาน": + defaultCompetencyCoreLevel.value = 1; + defaultCompetencyGroupLevel.value = 1; + break; + default: + defaultCompetencyCoreLevel.value = 1; + defaultCompetencyGroupLevel.value = 1; + break; + } + } + + const ratingColors = ref([ + "light-blue-3", + "light-blue-6", + "blue", + "blue-9", + "blue-10", + ]); + + // ROLE & TAB + const rolePerson = ref("USER"); //"USER" | "EVALUATOR" | "COMMANDER", "COMMANDERHIGH" + const tabOpen = ref(1); + function checkStep() { + const role = + dataEvaluation.value.profileId == dataProfile.value.profileId + ? "USER" + : dataEvaluation.value.evaluatorId == dataProfile.value.profileId + ? "EVALUATOR" + : dataEvaluation.value.commanderId == dataProfile.value.profileId + ? "COMMANDER" + : dataEvaluation.value.commanderHighId == dataProfile.value.profileId + ? "COMMANDERHIGH" + : ""; + rolePerson.value = role; + + switch (dataEvaluation.value.evaluationStatus) { + case "NEW": + tabOpen.value = 1; + break; + case "NEW_EVALUATOR": + tabOpen.value = 1; + break; + case "NEW_COMMANDER": + tabOpen.value = 1; + break; + case "NEW_COMMANDER_HIGH": + tabOpen.value = 1; + break; + case "APPROVE": + tabOpen.value = 2; + break; + case "EVALUATING": + tabOpen.value = 3; + break; + case "EVALUATING_EVALUATOR": + tabOpen.value = 3; + break; + case "EVALUATING_COMMANDER": + tabOpen.value = 3; + break; + case "EVALUATING_COMMANDER_HIGH": + tabOpen.value = 3; + break; + case "COMPLETE": + tabOpen.value = 3; + break; + default: + tabOpen.value = 1; + break; + } + } + + // SUMMARY GENERAL CASE + const indicatorWeightTotal = ref(0); // น้ำหนักรวมกรณีทั่วไป + const indicatorWeight1Total = ref(0); // น้ำหนักรวมมิติที่ 1 ต้องไม่เกิน 100% + const indicatorWeight2Total = ref(0); // น้ำหนักรวมมิติที่ 2 ต้องไม่เกิน 20 + + const indicatorPercentVal = ref(0); // รวมผลการประเมิน (ร้อยละ) ที่ได้จริง + const indicatorScore = ref(70); // สรุปผลการประเมินผลสัมฤทธิ์ของงาน ( คะแนนเต็ม indicatorScore คะแนน) + const competencyScore = ref(20); // ผลการประเมินสมรรถนะ (competencyScore คะแนน) + const devScoreVal = ref(0); // ผลการประเมินการพัฒนาตนเองที่ได้กี่คะแนน + const competencyDevScore = ref(30); // สรุปผลการประเมินพฤติกรรมการปฏิบัติราชการ (สมรรถนะ+การพัฒนาตนเอง) (คะแนนเต็ม competencyDevScore คะแนน) + const devScore = ref(10); // ผลการประเมินการพัฒนาตนเอง (devScore คะแนน) + + // SUMMARY EXCLUSIVE CASE + const excusiveIndicator1PercentVal = ref(0); // รวมผลการประเมิน (ร้อยละ) มิติที่ 1 ที่ได้จริง + const excusiveIndicator1Weight = ref(60); // น้ำหนักของมิติที่ 1 + const excusiveIndicator1ScoreVal = ref(0); // คะแนนมิติที่ 1 ที่ได้จริง + const excusiveIndicator2Weight = ref(20); // น้ำหนักของมิติที่ 2 + const excusiveIndicator2PercentVal = ref(0); // รวมผลการประเมิน (ร้อยละ) มิติที่ 2 ที่ได้จริง + const excusiveIndicator2ScoreVal = ref(0); // คะแนนมิติที่ 2 ที่ได้จริง + const excusiveIndicatorScore = ref(80); // สรุปผลการประเมินผลสัมฤทธิ์ของงาน (มิติที่ 1 + มิติที่ 2) ( คะแนนเต็ม excusiveIndicatorScore คะแนน) + const excusiveCompetencyScore = ref(20); // ผลการประเมินสมรรถนะ (competencyScore คะแนน) + + const indicatorScoreVal = ref(0); // สรุปผลการประเมินผลสัมฤทธิ์ของงานที่ได้ + const competencyScoreVal = ref(0); // ผลการประเมินสมรรถนะที่ได้กี่คะแนน + + return { + tabMain, + dataProfile, + dataEvaluation, + competencyType, + convertCompetencyType, + convertStatus, + convertResults, + checkCompetency, + checkCompetencyDefaultCompetencyLevel, + defaultCompetencyCoreLevel, + defaultCompetencyGroupLevel, + ratingColors, + checkStep, + tabOpen, + rolePerson, + + // score + indicatorWeightTotal, + indicatorWeight1Total, + indicatorWeight2Total, + indicatorPercentVal, + indicatorScore, + indicatorScoreVal, + competencyScore, + competencyScoreVal, + devScore, + devScoreVal, + competencyDevScore, + excusiveCompetencyScore, + excusiveIndicator1PercentVal, + excusiveIndicator1Weight, + excusiveIndicator1ScoreVal, + excusiveIndicator2Weight, + excusiveIndicator2PercentVal, + excusiveIndicator2ScoreVal, + excusiveIndicatorScore, + + //รายการการประเมินผลการปฏิบัติราชการระดับบุคคล + tabMainevaluator, + formQuery, + yearRound, + selected, + statusOptions, + }; +}); diff --git a/src/modules/14_KPI/store/KPIStore.ts b/src/modules/14_KPI/store/KPIStore.ts deleted file mode 100644 index 18533052d..000000000 --- a/src/modules/14_KPI/store/KPIStore.ts +++ /dev/null @@ -1,194 +0,0 @@ -import { defineStore } from "pinia"; -import { ref } from "vue"; -import type { DataOption } from "@/modules/14_KPI/interface/index/Main"; - -// store -export const useKPIDataStore = defineStore("KPIDataStore", () => { - const competencyTypeVal = ref("HEAD"); - - const tabMain = ref("1"); - const dataProfile = ref(); - const dataEvaluation = ref({ - plannedPoint: 0, - rolePoint: 0, - specialPoint: 0, - capacityPoint: 0, - }); - - const competencyType = ref([ - { - id: "HEAD", - name: "สมรรถนะหลัก", - }, - { - id: "GROUP", - name: "สมรรถนะประจำกลุ่มงาน", - }, - { - id: "EXECUTIVE", - name: "สมรรถนะประจำผู้บริหารกรุงเทพมหานคร", - }, - { - id: "DIRECTOR", - name: "สมรรถนะเฉพาะสำหรับตำแหน่ง ผอ.เขต ผช.ผอ.เขต และหัวหน้าฝ่ายในสังกัด สนง.เขต", - }, - { - id: "INSPECTOR", - name: "สมรรถนะเฉพาะสำหรับตำแหน่งผู้ตรวจราชการ กทม. และผู้ตรวจราชการ", - }, - ]); - - function convertStatus(val: string) { - switch (val) { - case "PENDING": - return "รอดำเนินการ"; - case "INPROGRESS": - return "กําลังดำเนินการ"; - case "DONE": - return "ประเมินเสร็จสิ้น"; - default: - break; - } - } - - function convertResults(val: string) { - switch (val) { - case "PENDING": - return "รอดำเนินการ"; - case "PASSED": - return "ผ่านการประเมิน"; - case "NOTPASSED": - return "ไม่ผ่านการประเมิน"; - default: - break; - } - } - - const ratingColors = ref([ - "light-blue-3", - "light-blue-6", - "blue", - "blue-9", - "blue-10", - ]); - - function checkCompetency() { - const position = dataProfile.value.position; - const posTypeName = dataProfile.value.posTypeName; - const posLevelName = dataProfile.value.posLevelName; - - if ( - position == "ผู้ตรวจราชการกรุงเทพมหานคร" || - position == "ผู้ตรวจราชการ" - ) { - competencyType.value = competencyType.value.filter( - (x: DataOption) => x.id == "HEAD" || x.id == "INSPECTOR" - ); - } else if (position == "ผู้อำนวยการเขต") { - competencyType.value = competencyType.value.filter( - (x: DataOption) => x.id == "HEAD" || x.id == "DIRECTOR" - ); - } else { - switch (posTypeName + " " + posLevelName) { - // case "ทั่วไป ปฏิบัติงาน": - // case "ทั่วไป ชำนาญงาน": - // case "ทั่วไป อาวุโส": - // case "วิชาการ ปฏิบัติการ": - // case "วิชาการ ชำนาญการ": - // case "วิชาการ ชำนาญการพิเศษ": - // case "วิชาการ เชี่ยวชาญ": - // case "วิชาการ ทรงคุณวุฒิ": - // competencyType.value = competencyType.value.filter( - // (x: DataOptions) => x.id == "HEAD" || x.id == "GROUP" - // ); - // break; - case "อำนวยการ ต้น": - case "อำนวยการ สูง": - case "บริหาร ต้น": - case "บริหาร สูง": - competencyType.value = competencyType.value.filter( - (x: DataOption) => x.id == "HEAD" || x.id == "EXECUTIVE" - ); - break; - default: - competencyType.value = competencyType.value.filter( - (x: DataOption) => x.id == "HEAD" || x.id == "GROUP" - ); - break; - } - } - } - - const defaultCompetencyCoreLevel = ref(); - const defaultCompetencyGroupLevel = ref(null); - function checkCompetencyDefaultCompetencyLevel() { - const posTypeName = dataProfile.value.posTypeName; - const posLevelName = dataProfile.value.posLevelName; - - switch (posTypeName + " " + posLevelName) { - case "บริหาร สูง": - defaultCompetencyCoreLevel.value = 5; - break; - case "บริหาร ต้น": - defaultCompetencyCoreLevel.value = 4; - break; - case "อำนวยการ สูง": - defaultCompetencyCoreLevel.value = 4; - break; - case "อำนวยการ ต้น": - defaultCompetencyCoreLevel.value = 3; - break; - case "วิชาการ ทรงคุณวุฒิ": - defaultCompetencyCoreLevel.value = 5; - defaultCompetencyGroupLevel.value = 5; - break; - case "วิชาการ เชี่ยวชาญ": - defaultCompetencyCoreLevel.value = 4; - defaultCompetencyGroupLevel.value = 4; - break; - case "วิชาการ ชำนาญการพิเศษ": - defaultCompetencyCoreLevel.value = 3; - defaultCompetencyGroupLevel.value = 4; - break; - case "วิชาการ ชำนาญการ": - defaultCompetencyCoreLevel.value = 2; - defaultCompetencyGroupLevel.value = 3; - break; - case "วิชาการ ปฏิบัติการ": - defaultCompetencyCoreLevel.value = 1; - defaultCompetencyGroupLevel.value = 2; - break; - case "ทั่วไป ทักษะพิเศษ": - defaultCompetencyCoreLevel.value = 4; - defaultCompetencyGroupLevel.value = 4; - break; - case "ทั่วไป อาวุโส": - defaultCompetencyCoreLevel.value = 3; - defaultCompetencyGroupLevel.value = 3; - break; - case "ทั่วไป ชำนาญงาน": - defaultCompetencyCoreLevel.value = 2; - defaultCompetencyGroupLevel.value = 2; - break; - case "ทั่วไป ปฏิบัติงาน": - defaultCompetencyCoreLevel.value = 1; - defaultCompetencyGroupLevel.value = 1; - break; - default: - break; - } - } - - return { - competencyTypeVal, - competencyType, - convertStatus, - convertResults, - tabMain, - dataProfile, - dataEvaluation, - ratingColors, - checkCompetency, - checkCompetencyDefaultCompetencyLevel, - }; -}); diff --git a/src/modules/14_KPI/views/detail.vue b/src/modules/14_KPI/views/detail.vue index b7f83f3c4..e9cc7831d 100644 --- a/src/modules/14_KPI/views/detail.vue +++ b/src/modules/14_KPI/views/detail.vue @@ -1,29 +1,47 @@ @@ -103,132 +310,436 @@ onMounted(async () => { flat color="primary" class="q-mr-sm" - @click=" - () => { - store.dataEvaluation = {}; - isReadonly ? router.push(`/KPI-list`) : router.push(`/KPI`); - } - " + @click="router.push(`/KPI-list`)" /> - {{ id ? `รายละเอียดแบบประเมิน` : `เพิ่มแบบประเมิน` }} - + รายละเอียดการประเมินผลการปฏิบัติราชการระดับบุคคล
-
- -
- - +
+
+ +
+ + + +
+
+
+
+
+ {{ + `${store.dataEvaluation.prefix}${store.dataEvaluation.firstName} ${store.dataEvaluation.lastName}` + }} + +
+ *น้ำหนัก(ร้อยละ) ผลสัมฤทธิ์ของงานไม่ถูกต้อง + + ส่งให้ผู้ประเมินอนุมัติ + - - -
-
-
-
-
- {{ - formProfile.fullName ? formProfile.fullName : "-" - }} - -
- - ดูข้อมูลการช่วยราชการ - - - ดูข้อมูลการทดลองงาน - + + ส่งให้ผู้ประเมินอนุมัติผลการประเมิน + + + + ขอแก้ไขข้อตกลง + + + + + {{ + store.dataEvaluation.evaluationStatus === "NEW" && + store.rolePerson === "USER" + ? "แก้ไขผู้ประเมิน" + : "ข้อมูลผู้ประเมิน" + }} + + + ดูข้อมูลการช่วยราชการ + + + ดูข้อมูลการทดลองงาน + +
-
-
-
-
-
-
- ตำแหน่งในสายงาน - {{ - formProfile.position - }} +
+
+
+
+
+ ตำแหน่งในสายงาน + {{ + store.dataEvaluation.position + }} +
-
-
-
- ประเภทตำแหน่ง - {{ - formProfile.type - }} +
+
+ ประเภทตำแหน่ง + {{ + store.dataEvaluation.posTypeName + }} +
-
-
-
- ระดับตำแหน่ง - {{ - formProfile.level - }} +
+
+ ระดับตำแหน่ง + {{ + store.dataEvaluation.posLevelName + }} +
-
-
-
- สถานะการประเมิน - {{ - formProfile.status - }} +
+
+ สถานะการประเมิน + {{ + formProfile.status + }} +
-
-
-
- ผลการประเมิน - {{ - formProfile.result - }} +
+
+ ผลการประเมิน + {{ + formProfile.result + }} +
-
-
-
- คะแนนประเมิน - {{ (indicatorScore + competencyScore).toFixed(2) }} - +
+
+ คะแนนประเมิน + + {{ + store.dataEvaluation.posExecutiveName == null + ? ( + store.indicatorScoreVal + + store.competencyScoreVal + + store.devScoreVal + ).toFixed(2) + : ( + store.excusiveIndicator1ScoreVal + + store.excusiveIndicator2ScoreVal + + store.competencyScoreVal + ).toFixed(2) + }} + +
-
- + - - - + + + +
+ + + + + + + +
+ + + + + + + +
+
+ + + บันทึกข้อมูล + +
+
+
+ +