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() {
http
.get(config.API.KpiEvaluationInfo)
@ -195,6 +191,24 @@ watch(
store.indicatorScoreVal =
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 class="q-gutter-md q-mt-sm">
<!-- องคประกอบท 1 -->
<div v-if="store.dataEvaluation.posExecutiveName != null">
<div
v-if="
store.dataEvaluation.posTypeName == 'อำนวยการ' &&
store.dataEvaluation.posTypeName == 'บริหาร'
"
>
<Work
v-model:data="rows_01"
:title="`มิติที่ 1 ภารกิจตามนโยบายและยุทธศาสตร์ของกรุงเทพมหานคร`"
@ -419,7 +438,8 @@ onMounted(() => {
:rows="[
{
name: `สรุปผลการประเมินสมรรถนะ (คะแนนเต็ม ${
!store.dataEvaluation.posExecutiveName
store.dataEvaluation.posTypeName != 'อำนวยการ' &&
store.dataEvaluation.posTypeName != 'บริหาร'
? store.competencyScore
: store.excusiveCompetencyScore
} คะแนน)`,
@ -446,7 +466,12 @@ onMounted(() => {
class="q-mt-xs q-mb-md"
/>
<div v-if="!store.dataEvaluation.posExecutiveName">
<div
v-if="
store.dataEvaluation.posTypeName != 'อำนวยการ' &&
store.dataEvaluation.posTypeName != 'บริหาร'
"
>
<Develop />
<div v-if="isShowScore">
@ -484,7 +509,10 @@ onMounted(() => {
<div v-if="isShowScore">
<div
v-if="store.dataEvaluation.posExecutiveName == null"
v-if="
store.dataEvaluation.posTypeName != 'อำนวยการ' &&
store.dataEvaluation.posTypeName != 'บริหาร'
"
class="row text-body2 text-weight-bold"
>
<div class="col-12 text-center row justify-center">

View file

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

View file

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

View file

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

View file

@ -5,11 +5,14 @@ import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar, type QTableProps } from "quasar";
import { ref } from "vue";
import { useKpiDataStore } from "@/modules/08_KPI/store";
const props = defineProps({
getAll: Function,
});
const store = useKpiDataStore();
const $q = useQuasar();
const mixin = useCounterMixin();
const {
@ -89,6 +92,7 @@ function onSubmit() {
summary: i.summary,
}));
showLoader();
store.isUpdate = true;
http
.post(config.API.kpiAchievementDevelop + `/point`, data)
.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 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 dataCompetncyByRow = ref<any[]>([]);
const dataLevel = ref<any[]>([]);
@ -170,7 +170,10 @@ function getData(type: string) {
let weightAvg = weight / total;
let resultAvg = result / total;
if (store.dataEvaluation.posExecutiveName != null) {
if (
store.dataEvaluation.posTypeName == "อำนวยการ" &&
store.dataEvaluation.posTypeName == "บริหาร"
) {
store.competencyScoreVal =
weightAvg != 0
? (resultAvg / weightAvg) * store.excusiveCompetencyScore
@ -181,6 +184,24 @@ function getData(type: string) {
? (resultAvg / weightAvg) * store.competencyScore
: 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.dataEvaluation.evaluationStatus === "EVALUATING_EVALUATOR" &&
store.rolePerson === "EVALUATOR" &&
store.tabMain === "3")||
store.tabMain === "3") ||
(store.dataEvaluation.evaluationStatus === "EVALUATING" &&
store.rolePerson === "EVALUATOR" &&
store.tabMain === "3")
@ -276,9 +297,9 @@ function onAchievement(data: any) {
dataCompetncyByRow.value = data;
}
function onLevel(num:number,list:any){
dataLevel.value = list.filter((i:any)=> i.level == num)
modalLevel.value = true
function onLevel(num: number, list: any) {
dataLevel.value = list.filter((i: any) => i.level == num);
modalLevel.value = true;
}
onMounted(() => {
@ -407,7 +428,12 @@ onMounted(() => {
}}
</div>
<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 v-else>
{{ col.value }}
@ -595,10 +621,7 @@ onMounted(() => {
v-model:rows="dataCompetncyByRow"
/>
<DialogLevel
v-model:modal="modalLevel"
v-model:rows="dataLevel"
/>
<DialogLevel v-model:modal="modalLevel" v-model:rows="dataLevel" />
</template>
<style scoped>

View file

@ -32,6 +32,11 @@ const {
success,
} = mixin;
const isUpdate = defineModel("isUpdate", {
type: Boolean,
default: false,
});
const formData = reactive({
isDevelopment70: false,
isDevelopment20: false,
@ -121,6 +126,24 @@ function getDevelop() {
(sum: number, e: any) => sum + e.summary,
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.dataEvaluation.evaluationStatus === "EVALUATING_EVALUATOR" &&
store.rolePerson === "EVALUATOR" &&
store.tabMain === "3")||
store.tabMain === "3") ||
(store.dataEvaluation.evaluationStatus === "EVALUATING" &&
store.rolePerson === "EVALUATOR" &&
store.tabMain === "3")

View file

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

View file

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

View file

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

View file

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