fix bug kpi

This commit is contained in:
Warunee Tamkoo 2024-05-16 09:59:34 +07:00
parent 1fa38897cf
commit bb19640c98
5 changed files with 50 additions and 29 deletions

View file

@ -225,7 +225,7 @@ 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.dataProfile.posExecutiveName != null"> <div v-if="store.dataEvaluation.posExecutiveName != null">
<Work <Work
v-model:data="rows_01" v-model:data="rows_01"
:title="`มิติที่ 1 ภารกิจตามนโยบายและยุทธศาสตร์ของกรุงเทพมหานคร`" :title="`มิติที่ 1 ภารกิจตามนโยบายและยุทธศาสตร์ของกรุงเทพมหานคร`"
@ -433,7 +433,7 @@ onMounted(() => {
:rows="[ :rows="[
{ {
name: `สรุปผลการประเมินสมรรถนะ (คะแนนเต็ม ${ name: `สรุปผลการประเมินสมรรถนะ (คะแนนเต็ม ${
!store.dataProfile.posExecutiveName !store.dataEvaluation.posExecutiveName
? store.competencyScore ? store.competencyScore
: store.excusiveCompetencyScore : store.excusiveCompetencyScore
} คะแนน)`, } คะแนน)`,
@ -460,7 +460,7 @@ onMounted(() => {
class="q-mt-xs q-mb-md" class="q-mt-xs q-mb-md"
/> />
<div v-if="!store.dataProfile.posExecutiveName"> <div v-if="!store.dataEvaluation.posExecutiveName">
<Develop /> <Develop />
<div v-if="isShowScore"> <div v-if="isShowScore">
@ -498,7 +498,7 @@ onMounted(() => {
<div v-if="isShowScore"> <div v-if="isShowScore">
<div <div
v-if="store.dataProfile.posExecutiveName == null" v-if="store.dataEvaluation.posExecutiveName == null"
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

@ -162,7 +162,7 @@ function getData(type: string) {
let weightAvg = weight / total; let weightAvg = weight / total;
let resultAvg = result / total; let resultAvg = result / total;
if (store.dataProfile.posExecutiveName != null) { if (store.dataEvaluation.posExecutiveName != null) {
store.competencyScoreVal = store.competencyScoreVal =
weightAvg != 0 weightAvg != 0
? (resultAvg / weightAvg) * store.excusiveCompetencyScore ? (resultAvg / weightAvg) * store.excusiveCompetencyScore

View file

@ -130,10 +130,10 @@ export const useKpiDataStore = defineStore("KPIDate", () => {
} }
function checkCompetency() { function checkCompetency() {
const position = dataProfile.value.position; const position = dataEvaluation.value.position;
const posTypeName = dataProfile.value.posTypeName; const posTypeName = dataEvaluation.value.posTypeName;
const posLevelName = dataProfile.value.posLevelName; const posLevelName = dataEvaluation.value.posLevelName;
const executiveName = dataProfile.value.posExecutiveName; const executiveName = dataEvaluation.value.posExecutiveName;
if ( if (
position == "ผู้ตรวจราชการกรุงเทพมหานคร" || position == "ผู้ตรวจราชการกรุงเทพมหานคร" ||
@ -189,8 +189,8 @@ export const useKpiDataStore = defineStore("KPIDate", () => {
const defaultCompetencyCoreLevel = ref<number>(); const defaultCompetencyCoreLevel = ref<number>();
const defaultCompetencyGroupLevel = ref<number | null>(null); const defaultCompetencyGroupLevel = ref<number | null>(null);
function checkCompetencyDefaultCompetencyLevel() { function checkCompetencyDefaultCompetencyLevel() {
const posTypeName = dataProfile.value.posTypeName; const posTypeName = dataEvaluation.value.posTypeName;
const posLevelName = dataProfile.value.posLevelName; const posLevelName = dataEvaluation.value.posLevelName;
switch (posTypeName + " " + posLevelName) { switch (posTypeName + " " + posLevelName) {
case "บริหาร สูง": case "บริหาร สูง":

View file

@ -57,12 +57,15 @@ const router = useRouter();
async function fetchEvaluation() { async function fetchEvaluation() {
await http await http
.get(config.API.kpiEvaluation + `/${id.value}`) .get(config.API.kpiEvaluation + `/${id.value}`)
.then((res) => { .then(async(res) => {
const data = res.data.result; const data = await res.data.result;
store.dataEvaluation = data; store.dataEvaluation = await data;
formProfile.status = store.convertStatus(data.evaluationStatus); formProfile.status = store.convertStatus(data.evaluationStatus);
formProfile.result = store.convertResults(data.evaluationResults); formProfile.result = store.convertResults(data.evaluationResults);
await store.checkCompetency();
await store.checkCompetencyDefaultCompetencyLevel();
fetchProfile(data.profileId); fetchProfile(data.profileId);
plannedPoint.value = data.plannedPoint == null ? "" : data.plannedPoint; plannedPoint.value = data.plannedPoint == null ? "" : data.plannedPoint;
@ -85,9 +88,6 @@ function getProfile() {
.then(async (res) => { .then(async (res) => {
const data = await res.data.result; const data = await res.data.result;
store.dataProfile = await data; store.dataProfile = await data;
await store.checkCompetency();
await store.checkCompetencyDefaultCompetencyLevel();
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
@ -359,14 +359,9 @@ onMounted(async () => {
}}</span> }}</span>
<q-space /> <q-space />
<div class="q-gutter-x-sm"> <div class="q-gutter-x-sm">
<!-- {{
store.dataProfile.posExecutiveName == null &&
store.indicatorWeightTotal != 100
}}
| {{ store.indicatorWeightTotal }} | -->
<span <span
v-if=" v-if="
(store.dataProfile.posExecutiveName == null && (store.dataEvaluation.posExecutiveName == null &&
store.indicatorWeightTotal != 100) || store.indicatorWeightTotal != 100) ||
(store.dataEvaluation.posExecutiveName != null && (store.dataEvaluation.posExecutiveName != null &&
(store.indicatorWeight1Total != 100 || (store.indicatorWeight1Total != 100 ||
@ -381,7 +376,7 @@ onMounted(async () => {
store.dataEvaluation.evaluationStatus == 'NEW' store.dataEvaluation.evaluationStatus == 'NEW'
" "
:disabled=" :disabled="
(store.dataProfile.posExecutiveName == null && (store.dataEvaluation.posExecutiveName == null &&
store.indicatorWeightTotal != 100) || store.indicatorWeightTotal != 100) ||
(store.dataEvaluation.posExecutiveName != null && (store.dataEvaluation.posExecutiveName != null &&
(store.indicatorWeight1Total != 100 || (store.indicatorWeight1Total != 100 ||
@ -534,7 +529,7 @@ onMounted(async () => {
<span class="text-grey-6">คะแนนประเม</span> <span class="text-grey-6">คะแนนประเม</span>
<span class="text-weight-medium text-primary"> <span class="text-weight-medium text-primary">
{{ {{
store.dataProfile.posExecutiveName == null store.dataEvaluation.posExecutiveName == null
? ( ? (
store.indicatorScoreVal + store.indicatorScoreVal +
store.competencyScoreVal + store.competencyScoreVal +

View file

@ -25,6 +25,8 @@ const { showLoader, hideLoader, messageError, date2Thai, dialogConfirm } =
const rows = ref<any>(); const rows = ref<any>();
const visibleColumns = ref<string[]>([ const visibleColumns = ref<string[]>([
"createdAt", "createdAt",
"year",
"durationKPI",
"evaluationStatus", "evaluationStatus",
"evaluationResults", "evaluationResults",
]); ]);
@ -41,6 +43,30 @@ const columns = ref<QTableProps["columns"]>([
sort: (a: string, b: string) => sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), 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",
format: (v) => v + 543,
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "durationKPI",
align: "left",
label: "รอบการประเมิน",
sortable: true,
field: "durationKPI",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (v) => (v == "OCT" ? "ตุลาคม" : "เมษายน"),
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{ {
name: "evaluationStatus", name: "evaluationStatus",
align: "left", align: "left",
@ -219,10 +245,10 @@ function onSubmit() {
prefix: formRound.prefix, prefix: formRound.prefix,
firstName: formRound.firstName, firstName: formRound.firstName,
lastName: formRound.lastName, lastName: formRound.lastName,
// position: formRound.position, position: formRound.position,
// posLevelName: formRound.posLevelName, posLevelName: formRound.posLevelName,
// posTypeName: formRound.posTypeName, posTypeName: formRound.posTypeName,
// posExecutiveName: formRound.posExecutiveName, posExecutiveName: formRound.posExecutiveName,
evaluatorId: formRound.evaluatorId, evaluatorId: formRound.evaluatorId,
commanderId: formRound.commanderId == "" ? null : formRound.commanderId, commanderId: formRound.commanderId == "" ? null : formRound.commanderId,