updated kpi

This commit is contained in:
Warunee Tamkoo 2024-06-26 20:24:39 +07:00
parent f7f0198613
commit c7cda1c7ba
11 changed files with 185 additions and 78 deletions

View file

@ -152,10 +152,6 @@ function fetchAssigned() {
}); });
} }
function onInfo() {
modalCriteria.value = true;
}
function getCriteria() { function getCriteria() {
http http
.get(config.API.KpiEvaluationInfo) .get(config.API.KpiEvaluationInfo)
@ -195,6 +191,24 @@ watch(
store.indicatorScoreVal = store.indicatorScoreVal =
store.indicatorPercentVal * (store.indicatorScore / 100); store.indicatorPercentVal * (store.indicatorScore / 100);
if (
store.isUpdate &&
store.tabMain === "3" &&
(store.dataEvaluation.evaluationStatus === "EVALUATOR" ||
store.dataEvaluation.evaluationStatus === "EVALUATING_EVALUATOR")
) {
http
.put(config.API.updatePoint(evaluationId.value), {
totalPoint1: store.indicatorScoreVal.toFixed(2),
summaryPoint: (
store.indicatorScoreVal +
store.competencyScoreVal +
store.devScoreVal
).toFixed(2),
})
.then((res) => {});
}
} }
} }
); );
@ -221,7 +235,12 @@ onMounted(() => {
</div> </div>
<div class="q-gutter-md q-mt-sm"> <div class="q-gutter-md q-mt-sm">
<!-- องคประกอบท 1 --> <!-- องคประกอบท 1 -->
<div v-if="store.dataEvaluation.posExecutiveName != null"> <div
v-if="
store.dataEvaluation.posTypeName == 'อำนวยการ' &&
store.dataEvaluation.posTypeName == 'บริหาร'
"
>
<Work <Work
v-model:data="rows_01" v-model:data="rows_01"
:title="`มิติที่ 1 ภารกิจตามนโยบายและยุทธศาสตร์ของกรุงเทพมหานคร`" :title="`มิติที่ 1 ภารกิจตามนโยบายและยุทธศาสตร์ของกรุงเทพมหานคร`"
@ -419,7 +438,8 @@ onMounted(() => {
:rows="[ :rows="[
{ {
name: `สรุปผลการประเมินสมรรถนะ (คะแนนเต็ม ${ name: `สรุปผลการประเมินสมรรถนะ (คะแนนเต็ม ${
!store.dataEvaluation.posExecutiveName store.dataEvaluation.posTypeName != 'อำนวยการ' &&
store.dataEvaluation.posTypeName != 'บริหาร'
? store.competencyScore ? store.competencyScore
: store.excusiveCompetencyScore : store.excusiveCompetencyScore
} คะแนน)`, } คะแนน)`,
@ -446,7 +466,12 @@ onMounted(() => {
class="q-mt-xs q-mb-md" class="q-mt-xs q-mb-md"
/> />
<div v-if="!store.dataEvaluation.posExecutiveName"> <div
v-if="
store.dataEvaluation.posTypeName != 'อำนวยการ' &&
store.dataEvaluation.posTypeName != 'บริหาร'
"
>
<Develop /> <Develop />
<div v-if="isShowScore"> <div v-if="isShowScore">
@ -484,7 +509,10 @@ onMounted(() => {
<div v-if="isShowScore"> <div v-if="isShowScore">
<div <div
v-if="store.dataEvaluation.posExecutiveName == null" v-if="
store.dataEvaluation.posTypeName != 'อำนวยการ' &&
store.dataEvaluation.posTypeName != 'บริหาร'
"
class="row text-body2 text-weight-bold" class="row text-body2 text-weight-bold"
> >
<div class="col-12 text-center row justify-center"> <div class="col-12 text-center row justify-center">

View file

@ -37,10 +37,10 @@ const additionalSuperiorComment = ref<string>("");
const superiorCommentCheck = ref<string>(""); const superiorCommentCheck = ref<string>("");
const additionalSuperiorCheck = ref<string>(""); const additionalSuperiorCheck = ref<string>("");
const weight1 = ref<number>(10); const weight1 = ref<number>(0);
const result1 = ref<number>(0); const result1 = ref<number>(0);
const weight2 = ref<number>(50); const weight2 = ref<number>(0);
const result2 = ref<number>(60); const result2 = ref<number>(0);
const sumWeight = computed(() => { const sumWeight = computed(() => {
return weight1.value + weight2.value; return weight1.value + weight2.value;
}); });
@ -179,6 +179,10 @@ async function fetchEvaluation() {
.then(async (res) => { .then(async (res) => {
const data = res.data.result; const data = res.data.result;
store.dataEvaluation = await data; store.dataEvaluation = await data;
if (data.profileId == store.dataProfile.id) {
userOpen();
}
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
@ -188,6 +192,12 @@ async function fetchEvaluation() {
}); });
} }
function userOpen() {
http.get(config.API.openPoint(id.value)).then(async (res) => {
// success($q, "");
});
}
function getData() { function getData() {
http http
.get(config.API.kpiSendToGet(id.value)) .get(config.API.kpiSendToGet(id.value))
@ -202,9 +212,10 @@ function getData() {
additionalSuperiorCheck.value = data.isReasonCommanderHigh.toString(); additionalSuperiorCheck.value = data.isReasonCommanderHigh.toString();
additionalSuperiorComment.value = data.reasonCommanderHigh; additionalSuperiorComment.value = data.reasonCommanderHigh;
result1.value = data.totalPoint1 result1.value = data.totalPoint1;
result2.value = data.totalPoint2_1 + data.totalPoint2_2 result2.value = data.totalPoint2_1 + data.totalPoint2_2;
weight1.value = data.weightPoint1;
weight2.value = data.weightPoint2;
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
@ -456,7 +467,10 @@ onMounted(() => {
lazy-rules lazy-rules
v-model="superiorComment" v-model="superiorComment"
outlined outlined
:readonly="superiorCommentCheck == 'true'||store.dataEvaluation.evaluationStatus !== 'SUMMARY_COMMANDER'" :readonly="
superiorCommentCheck == 'true' ||
store.dataEvaluation.evaluationStatus !== 'SUMMARY_COMMANDER'
"
type="textarea" type="textarea"
label="ความเห็นของผู้บังคับบัญชาเหนือขึ้นไป" label="ความเห็นของผู้บังคับบัญชาเหนือขึ้นไป"
hide-bottom-space hide-bottom-space

View file

@ -130,7 +130,7 @@ function onSubmit() {
dialogConfirm($q, async () => { dialogConfirm($q, async () => {
try { try {
showLoader(); showLoader();
console.log(rows.value); store.isUpdate = true;
const formData = rows.value.map((e: any) => ({ const formData = rows.value.map((e: any) => ({
id: e.id, id: e.id,

View file

@ -115,6 +115,7 @@ function onSubmit() {
dialogMessageNotify($q, "กรุณาเลือกระดับคะแนนตามเกณฑ์การประเมิน"); dialogMessageNotify($q, "กรุณาเลือกระดับคะแนนตามเกณฑ์การประเมิน");
} else { } else {
dialogConfirm($q, () => { dialogConfirm($q, () => {
store.isUpdate = true;
const data = rows.value; const data = rows.value;
const body = data.map((i: any) => ({ const body = data.map((i: any) => ({
id: i.id, id: i.id,

View file

@ -5,11 +5,14 @@ import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useQuasar, type QTableProps } from "quasar"; import { useQuasar, type QTableProps } from "quasar";
import { ref } from "vue"; import { ref } from "vue";
import { useKpiDataStore } from "@/modules/08_KPI/store";
const props = defineProps({ const props = defineProps({
getAll: Function, getAll: Function,
}); });
const store = useKpiDataStore();
const $q = useQuasar(); const $q = useQuasar();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { const {
@ -89,6 +92,7 @@ function onSubmit() {
summary: i.summary, summary: i.summary,
})); }));
showLoader(); showLoader();
store.isUpdate = true;
http http
.post(config.API.kpiAchievementDevelop + `/point`, data) .post(config.API.kpiAchievementDevelop + `/point`, data)
.then((res) => { .then((res) => {

View file

@ -20,7 +20,7 @@ import DialogListCriteria from "@/modules/08_KPI/components/Tab/Dialog/DialogLis
import DialogCompetncyByRow from "@/modules/08_KPI/components/Tab/Dialog/DialogCompetncyByRow.vue"; import DialogCompetncyByRow from "@/modules/08_KPI/components/Tab/Dialog/DialogCompetncyByRow.vue";
import DialogLevel from "@/modules/08_KPI/components/Tab/Dialog/DialogLevel.vue"; import DialogLevel from "@/modules/08_KPI/components/Tab/Dialog/DialogLevel.vue";
const modalLevel = ref<boolean>(false) const modalLevel = ref<boolean>(false);
const modalCompetncyByRow = ref<boolean>(false); const modalCompetncyByRow = ref<boolean>(false);
const dataCompetncyByRow = ref<any[]>([]); const dataCompetncyByRow = ref<any[]>([]);
const dataLevel = ref<any[]>([]); const dataLevel = ref<any[]>([]);
@ -170,7 +170,10 @@ function getData(type: string) {
let weightAvg = weight / total; let weightAvg = weight / total;
let resultAvg = result / total; let resultAvg = result / total;
if (store.dataEvaluation.posExecutiveName != null) { if (
store.dataEvaluation.posTypeName == "อำนวยการ" &&
store.dataEvaluation.posTypeName == "บริหาร"
) {
store.competencyScoreVal = store.competencyScoreVal =
weightAvg != 0 weightAvg != 0
? (resultAvg / weightAvg) * store.excusiveCompetencyScore ? (resultAvg / weightAvg) * store.excusiveCompetencyScore
@ -181,6 +184,24 @@ function getData(type: string) {
? (resultAvg / weightAvg) * store.competencyScore ? (resultAvg / weightAvg) * store.competencyScore
: 0; : 0;
} }
if (
store.isUpdate &&
store.tabMain === "3" &&
(store.dataEvaluation.evaluationStatus === "EVALUATOR" ||
store.dataEvaluation.evaluationStatus === "EVALUATING_EVALUATOR")
) {
http
.put(config.API.updatePoint(store.dataEvaluation.id), {
totalPoint2_1: store.competencyScoreVal.toFixed(2),
summaryPoint: (
store.indicatorScoreVal +
store.competencyScoreVal +
store.devScoreVal
).toFixed(2),
})
.then((res) => {});
}
} }
}); });
} }
@ -248,7 +269,7 @@ const isEditStep3 = computed(() => {
store.tabMain === "3") || store.tabMain === "3") ||
(store.dataEvaluation.evaluationStatus === "EVALUATING_EVALUATOR" && (store.dataEvaluation.evaluationStatus === "EVALUATING_EVALUATOR" &&
store.rolePerson === "EVALUATOR" && store.rolePerson === "EVALUATOR" &&
store.tabMain === "3")|| store.tabMain === "3") ||
(store.dataEvaluation.evaluationStatus === "EVALUATING" && (store.dataEvaluation.evaluationStatus === "EVALUATING" &&
store.rolePerson === "EVALUATOR" && store.rolePerson === "EVALUATOR" &&
store.tabMain === "3") store.tabMain === "3")
@ -276,9 +297,9 @@ function onAchievement(data: any) {
dataCompetncyByRow.value = data; dataCompetncyByRow.value = data;
} }
function onLevel(num:number,list:any){ function onLevel(num: number, list: any) {
dataLevel.value = list.filter((i:any)=> i.level == num) dataLevel.value = list.filter((i: any) => i.level == num);
modalLevel.value = true modalLevel.value = true;
} }
onMounted(() => { onMounted(() => {
@ -407,7 +428,12 @@ onMounted(() => {
}} }}
</div> </div>
<div v-else-if="col.name == 'level'"> <div v-else-if="col.name == 'level'">
<div @click="onLevel(props.row.level,props.row.achievement)" class="text-teal">{{ props.row.level }}</div> <div
@click="onLevel(props.row.level, props.row.achievement)"
class="text-teal"
>
{{ props.row.level }}
</div>
</div> </div>
<div v-else> <div v-else>
{{ col.value }} {{ col.value }}
@ -595,10 +621,7 @@ onMounted(() => {
v-model:rows="dataCompetncyByRow" v-model:rows="dataCompetncyByRow"
/> />
<DialogLevel <DialogLevel v-model:modal="modalLevel" v-model:rows="dataLevel" />
v-model:modal="modalLevel"
v-model:rows="dataLevel"
/>
</template> </template>
<style scoped> <style scoped>

View file

@ -32,6 +32,11 @@ const {
success, success,
} = mixin; } = mixin;
const isUpdate = defineModel("isUpdate", {
type: Boolean,
default: false,
});
const formData = reactive({ const formData = reactive({
isDevelopment70: false, isDevelopment70: false,
isDevelopment20: false, isDevelopment20: false,
@ -121,6 +126,24 @@ function getDevelop() {
(sum: number, e: any) => sum + e.summary, (sum: number, e: any) => sum + e.summary,
0 0
); );
if (
store.isUpdate &&
store.tabMain === "3" &&
(store.dataEvaluation.evaluationStatus === "EVALUATOR" ||
store.dataEvaluation.evaluationStatus === "EVALUATING_EVALUATOR")
) {
http
.put(config.API.updatePoint(store.dataEvaluation.id), {
totalPoint2_2: store.devScoreVal.toFixed(2),
summaryPoint: (
store.indicatorScoreVal +
store.competencyScoreVal +
store.devScoreVal
).toFixed(2),
})
.then((res) => {});
}
}); });
} }
@ -181,7 +204,7 @@ const isEditStep3 = computed(() => {
store.tabMain === "3") || store.tabMain === "3") ||
(store.dataEvaluation.evaluationStatus === "EVALUATING_EVALUATOR" && (store.dataEvaluation.evaluationStatus === "EVALUATING_EVALUATOR" &&
store.rolePerson === "EVALUATOR" && store.rolePerson === "EVALUATOR" &&
store.tabMain === "3")|| store.tabMain === "3") ||
(store.dataEvaluation.evaluationStatus === "EVALUATING" && (store.dataEvaluation.evaluationStatus === "EVALUATING" &&
store.rolePerson === "EVALUATOR" && store.rolePerson === "EVALUATOR" &&
store.tabMain === "3") store.tabMain === "3")

View file

@ -21,6 +21,7 @@ export const useKpiDataStore = defineStore("KPIDate", () => {
date2Thai, date2Thai,
} = mixin; } = mixin;
const isUpdate = ref<boolean>(false);
const tabMainevaluator = ref<string>("1"); const tabMainevaluator = ref<string>("1");
const yearRound = ref<number>(new Date().getFullYear()); const yearRound = ref<number>(new Date().getFullYear());
const formQuery = reactive<FormQuery>({ const formQuery = reactive<FormQuery>({
@ -420,5 +421,6 @@ export const useKpiDataStore = defineStore("KPIDate", () => {
yearRound, yearRound,
selected, selected,
work, work,
isUpdate,
}; };
}); });

View file

@ -283,31 +283,31 @@ function sendToEvaluatore(status: string) {
); );
} }
function sendToSummary(status: string) { // function sendToSummary(status: string) {
dialogConfirm( // dialogConfirm(
$q, // $q,
() => { // () => {
if (id.value) { // if (id.value) {
showLoader(); // showLoader();
http // http
.get(config.API.kpiSendToSummary(id.value)) // .get(config.API.kpiSendToSummary(id.value))
.then((res) => { // .then((res) => {
success($q, "ส่งไปสรุปผลการประเมินสำเร็จ"); // success($q, "");
getAll() // getAll();
store.tabMain = '4' // store.tabMain = "4";
}) // })
.catch((e) => { // .catch((e) => {
messageError($q, e); // messageError($q, e);
}) // })
.finally(() => { // .finally(() => {
hideLoader(); // hideLoader();
}); // });
} // }
}, // },
"ยืนยันการส่งไปสรุปผลการประเมิน", // "",
"ต้องการยืนยันส่งไปสรุปผลการประเมินใช่หรือไม่?" // "?"
); // );
} // }
function requireEdit() { function requireEdit() {
dialogConfirm( dialogConfirm(
$q, $q,
@ -364,27 +364,31 @@ function sendToEvauator() {
} }
function goToSummary() { function goToSummary() {
dialogConfirm($q, () => { dialogConfirm(
showLoader(); $q,
http () => {
.post(config.API.sendToSummary(store.dataEvaluation.id), { showLoader();
status: "SUMMARY", http
}) .get(config.API.sendToSummary(store.dataEvaluation.id))
.then(async (res) => { .then(async (res) => {
await getAll(); await getAll();
store.tabMain = "4"; store.tabMain = "4";
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
}) })
.finally(() => { .finally(() => {
hideLoader(); hideLoader();
}); });
}); },
"ยืนยันการส่งไปสรุปผลการประเมิน",
"ต้องการยืนยันส่งไปสรุปผลการประเมินใช่หรือไม่?"
);
} }
onMounted(async () => { onMounted(async () => {
showLoader(); showLoader();
store.isUpdate = await false;
await getAll(); await getAll();
}); });
</script> </script>
@ -457,7 +461,8 @@ onMounted(async () => {
<div class="q-gutter-x-sm"> <div class="q-gutter-x-sm">
<span <span
v-if=" v-if="
(store.dataEvaluation.posTypeName != 'อำนวยการ' && (store.tabMain === '1' &&
store.dataEvaluation.posTypeName != 'อำนวยการ' &&
store.dataEvaluation.posTypeName != 'บริหาร' && store.dataEvaluation.posTypeName != 'บริหาร' &&
store.indicatorWeightTotal != 100) || store.indicatorWeightTotal != 100) ||
(store.dataEvaluation.posTypeName == 'อำนวยการ' && (store.dataEvaluation.posTypeName == 'อำนวยการ' &&
@ -527,7 +532,7 @@ onMounted(async () => {
>งใหประเมนรายงานผลสำเรจของงาน</q-tooltip >งใหประเมนรายงานผลสำเรจของงาน</q-tooltip
> >
</q-btn> </q-btn>
<q-btn <!-- <q-btn
v-if=" v-if="
store.rolePerson == 'EVALUATOR' && store.rolePerson == 'EVALUATOR' &&
store.dataEvaluation.evaluationStatus == store.dataEvaluation.evaluationStatus ==
@ -543,7 +548,7 @@ onMounted(async () => {
@click="sendToSummary('SUMMARY')" @click="sendToSummary('SUMMARY')"
> >
<q-tooltip>งไปสรปผลการประเม</q-tooltip> <q-tooltip>งไปสรปผลการประเม</q-tooltip>
</q-btn> </q-btn> -->
<q-btn <q-btn
v-if=" v-if="
store.rolePerson == 'USER' && store.rolePerson == 'USER' &&
@ -573,7 +578,7 @@ onMounted(async () => {
" "
:disabled=" :disabled="
store.dataEvaluation.evaluatorId == null || store.dataEvaluation.evaluatorId == null ||
store.dataEvaluation.summaryPoint > 0 store.dataEvaluation.summaryPoint <= 0
" "
unelevated unelevated
round round

View file

@ -329,15 +329,21 @@ function getOrgOp() {
const data = res.data.result; const data = res.data.result;
evaluatorIdMainOp.value = data.caregiver.map((i: any) => ({ evaluatorIdMainOp.value = data.caregiver.map((i: any) => ({
id: i.id, id: i.id,
name: `${i.prefix ? i.prefix :''}${i.firstName ? i.firstName : ''} ${i.lastName ? i.lastName:''}`, name: `${i.prefix ? i.prefix : ""}${i.firstName ? i.firstName : ""} ${
i.lastName ? i.lastName : ""
}`,
})); }));
commanderIdMainOp.value = data.commander.map((i: any) => ({ commanderIdMainOp.value = data.commander.map((i: any) => ({
id: i.id, id: i.id,
name: `${i.prefix ? i.prefix :''}${i.firstName ? i.firstName : ''} ${i.lastName ? i.lastName:''}`, name: `${i.prefix ? i.prefix : ""}${i.firstName ? i.firstName : ""} ${
i.lastName ? i.lastName : ""
}`,
})); }));
commanderHighMainOp.value = data.chairman.map((i: any) => ({ commanderHighMainOp.value = data.chairman.map((i: any) => ({
id: i.id, id: i.id,
name: `${i.prefix ? i.prefix :''}${i.firstName ? i.firstName : ''} ${i.lastName ? i.lastName:''}`, name: `${i.prefix ? i.prefix : ""}${i.firstName ? i.firstName : ""} ${
i.lastName ? i.lastName : ""
}`,
})); }));
}) })
.catch((e) => { .catch((e) => {
@ -636,7 +642,7 @@ onMounted(() => {
:options="roundDialgOp" :options="roundDialgOp"
hide-bottom-space hide-bottom-space
lazy-rules lazy-rules
:rules="[(val) => !!val.id || `${'กรุณาเลือกรอบการประเมิน'}`]" :rules="[(val:any) => !!val.id || `${'กรุณาเลือกรอบการประเมิน'}`]"
@update:model-value="checkClosed" @update:model-value="checkClosed"
/> />
</div> </div>

View file

@ -186,6 +186,7 @@ watch(
function onChangTab() { function onChangTab() {
store.formQuery.page = 1; store.formQuery.page = 1;
dataListMain.value = [];
fetchList(); fetchList();
store.selected = []; store.selected = [];
} }