From 7a54b6d9b2b953f3a167c5e6e29c97a0afbef60e Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Thu, 6 Jun 2024 14:33:31 +0700 Subject: [PATCH] fix bug --- src/api/14_KPI/api.KPI.ts | 70 +++++++++ src/api/15_development/api.development.ts | 51 +++++++ src/api/index.ts | 4 +- src/app.config.ts | 9 ++ .../indicatorByPlan/IndicatorByPlan.vue | 2 +- .../01_metadata/interface/request/Main.ts | 2 +- .../01_metadata/stores/organizational.ts | 137 ++++++++++++++++++ 7 files changed, 271 insertions(+), 4 deletions(-) create mode 100644 src/api/14_KPI/api.KPI.ts create mode 100644 src/api/15_development/api.development.ts create mode 100644 src/modules/01_metadata/stores/organizational.ts diff --git a/src/api/14_KPI/api.KPI.ts b/src/api/14_KPI/api.KPI.ts new file mode 100644 index 00000000..97e20ae6 --- /dev/null +++ b/src/api/14_KPI/api.KPI.ts @@ -0,0 +1,70 @@ +import env from "../index"; +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 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 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, + 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}`, + + /** สมรรถนะ */ + + kpiLink, + + profilePosition: () => `${env.API_URI}/org/profile/keycloak/position`, +}; diff --git a/src/api/15_development/api.development.ts b/src/api/15_development/api.development.ts new file mode 100644 index 00000000..f7649aa4 --- /dev/null +++ b/src/api/15_development/api.development.ts @@ -0,0 +1,51 @@ +import env from "../index"; +const development = `${env.API_URI}/development`; +const developmentOrg = `${env.API_URI}/org`; +const devScholarship = `${env.API_URI}/development/scholarship`; +const developmentReport = `${env.API_URI}/development/report`; +const devStrategy = `${env.API_URI}/development/strategy`; +export default { + development, + /** history */ + developmentHistoryList: (type: string) => + `${development}/history/${type}/filter`, + developmentHistoryListByid: (type: string, id: string) => + `${development}/history/${type}/${id}`, + developmentHistoryAdd: (type: string) => `${development}/history/${type}`, + developmentProjectSearch: () => `${development}/main/search`, + developmentHistoryListOrg: (type: string, year: number) => + `${development}/history/${type}/org/${year}`, + + /** history employee */ + developmentProjectSearchEmployee: () => `${developmentOrg}/profile-employee/`, + + /** รายการโครงการ*/ + developmentMain: `${development}/main`, + developmentMainById: (id: string) => `${development}/main/${id}`, + developmentMainTab: (tab: string, id: string) => + `${development}/main/${tab}/${id}`, + + /** ทุนการศึกษา/ฝึกอบรม*/ + devScholarship, + devScholarshipByid: (id: string) => `${devScholarship}/${id}`, + devScholarshipStatus: (id: string, status: string) => + `${devScholarship}/status/${id}/${status}`, + + /** download File */ + developmentReportMain: () => `${developmentReport}/main`, + developmentReportHistory: () => `${developmentReport}/history-officer`, + developmentReportHistoryOfficer: () => + `${developmentReport}/history-employee`, + developmentReportScholarship: () => `${developmentReport}/scholarship`, + + // ปิดโครงการ + developmentMainFinish: (id: string) => `${development}/main/finish/${id}`, + // ข้อมูล status ของโครงการ + developmentMainStatus: (id: string) => `${development}/main/status/${id}`, + + /** โครงการ tab ข้อมูลเบื้องต้น */ + developmentBasicInfoById: (id: string) => `${development}/main/tab1/${id}`, + + /**API ยุทธศาสตร์*/ + devStrategy, +}; diff --git a/src/api/index.ts b/src/api/index.ts index 478cc27a..077efbf3 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -2,8 +2,8 @@ import { ref } from "vue" const env = ref(process.env.NODE_ENV || "development") -// export const apiUrlConfigPublish = import.meta.env.VITE_API_PUBLISH_URL; -// export const apiUrlConfigReport = import.meta.env.VITE_API_REPORT_URL; +export const apiUrlConfigPublish = import.meta.env.VITE_API_PUBLISH_URL; +export const apiUrlConfigReport = import.meta.env.VITE_API_REPORT_URL; // if (process.env.VUE_APP_TEST) { // env = "test"; // } diff --git a/src/app.config.ts b/src/app.config.ts index 6e0175fd..264dd6bd 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -32,6 +32,12 @@ import file from "./api/file/api.file"; /** API ManagementUsers*/ import menagement from "./api/manage/api.management"; +/** API ระเมินผลการปฏิบัติราชการระดับบุคคล*/ +import KPI from "./api/14_KPI/api.KPI"; + +/** API เงินเดือน/ค่าจ้าง*/ +import development from "./api/15_development/api.development"; + // environment variables export const compettitivePanel = import.meta.env.VITE_COMPETITIVE_EXAM_PANEL; export const qualifyDisableExamPanel = import.meta.env @@ -69,6 +75,9 @@ const API = { /** menagement*/ ...menagement, + /** KPI*/ + ...KPI, + ...development, }; export default { diff --git a/src/modules/01_metadata/components/Indicators/indicatorByPlan/IndicatorByPlan.vue b/src/modules/01_metadata/components/Indicators/indicatorByPlan/IndicatorByPlan.vue index 9011c5da..b5a1fa3a 100644 --- a/src/modules/01_metadata/components/Indicators/indicatorByPlan/IndicatorByPlan.vue +++ b/src/modules/01_metadata/components/Indicators/indicatorByPlan/IndicatorByPlan.vue @@ -9,7 +9,7 @@ import http from "@/plugins/http"; import type { DataOption } from "@/modules/01_metadata/interface/index/Main"; /** importStore*/ -import { usePositionEmp } from "@/modules/16_positionEmployee/store/organizational"; +import { usePositionEmp } from "@/modules/01_metadata/stores/organizational"; import { useCounterMixin } from "@/stores/mixin"; /**use*/ diff --git a/src/modules/01_metadata/interface/request/Main.ts b/src/modules/01_metadata/interface/request/Main.ts index 61316352..0dec0732 100644 --- a/src/modules/01_metadata/interface/request/Main.ts +++ b/src/modules/01_metadata/interface/request/Main.ts @@ -28,7 +28,7 @@ interface FormDataRole { includingName: string; target: string; unit: string; - weight: string; + weight: string | null; meaning: string; formula: string; documentInfoEvidence: string; diff --git a/src/modules/01_metadata/stores/organizational.ts b/src/modules/01_metadata/stores/organizational.ts new file mode 100644 index 00000000..5d52a52e --- /dev/null +++ b/src/modules/01_metadata/stores/organizational.ts @@ -0,0 +1,137 @@ +import { defineStore } from "pinia"; +import { reactive, ref } from "vue"; + +// /** importType*/ +// import type { +// DataActive, +// SumPosition, +// PosMaster, +// } from "@/modules/16_positionEmployee/interface/response/organizational"; + +export const usePositionEmp = defineStore("positionEmpStore", () => { + const typeOrganizational = ref("current"); + const statusView = ref("list"); + + const dataActive = ref(); + const activeId = ref(); + const draftId = ref(); + const historyId = ref(); + const treeId = ref(); + const level = ref(); + const isPublic = ref(false); + const orgPublishDate = ref(null); + const sumPosition = reactive({ + total: 0, + use: 0, + vacant: 0, + totalRoot: 0, + useRoot: 0, + vacantRoot: 0, + }); + + function getSumPosition(data: any) { + sumPosition.total = data.totalPosition; + sumPosition.totalRoot = data.totalRootPosition ? data.totalRootPosition : 0; + + if (typeOrganizational.value == "draft") { + sumPosition.use = data.totalPositionNextUse; + sumPosition.useRoot = data.totalRootPositionNextUse + ? data.totalRootPositionNextUse + : 0; + + sumPosition.vacant = data.totalPositionNextVacant; + sumPosition.vacantRoot = data.totalRootPositionNextVacant + ? data.totalRootPositionNextVacant + : 0; + } else { + sumPosition.use = data.totalPositionCurrentUse; + sumPosition.useRoot = data.totalRootPositionCurrentUse + ? data.totalRootPositionCurrentUse + : 0; + + sumPosition.vacant = data.totalPositionCurrentVacant; + sumPosition.vacantRoot = data.totalRootPositionCurrentVacant + ? data.totalRootPositionCurrentVacant + : 0; + } + } + + function fetchDataActive(data: any) { + activeId.value = data.activeId; + draftId.value = data.draftId; + dataActive.value = data; + isPublic.value = data.isPublic; + orgPublishDate.value = data.orgPublishDate; + } + + function fetchPosMaster(data: any[]) { + const newPosMaster = data.map((e: any) => ({ + ...e, + positionIsSelected: e.fullNameCurrentHolder + ? e.fullNameCurrentHolder + : "ว่าง", + posMasterNo: + e.orgShortname + + (e.posMasterNoPrefix ? e.posMasterNoPrefix : "") + + (e.posMasterNo ? e.posMasterNo : "") + + (e.posMasterNoSuffix ? e.posMasterNoSuffix : ""), + positionName: e.isSit ? e.profilePosition : e.positionName, + posTypeName: e.isSit ? e.profilePostype : e.posTypeName, + posLevelName: e.isSit ? e.profilePoslevel : e.posLevelName, + posExecutiveName: e.posExecutiveName, + isSit: e.isSit, + })); + + return newPosMaster; + } + + function checkLevel(type: number) { + switch (type) { + case 0: + return "Root"; + case 1: + return "Child1"; + case 2: + return "Child2"; + case 3: + return "Child3"; + default: + return "Child4"; + } + } + + function convertType(type: string) { + switch (type) { + case "DEPARTMENT": + return "ระดับสำนัก"; + case "OFFICE": + return "ระดับกอง/สำนักงาน/ส่วนราชการ/โรงพยาบาล/เทียบเท่ากอง"; + case "DIVISION": + return "ระดับส่วน/กลุ่มภารกิจ"; + case "SECTION": + return "ระดับฝ่าย/กลุ่มงาน"; + default: + return "-"; + } + } + + return { + typeOrganizational, + statusView, + + // + fetchDataActive, + checkLevel, + convertType, + draftId, + activeId, + historyId, + treeId, + level, + isPublic, + orgPublishDate, + fetchPosMaster, + sumPosition, + getSumPosition, + }; +});