fix bug kpi

This commit is contained in:
Warunee Tamkoo 2024-05-15 18:23:55 +07:00
parent 63611d0811
commit 1fa38897cf
7 changed files with 82 additions and 69 deletions

View file

@ -13,7 +13,6 @@ import { useCounterMixin } from "@/stores/mixin";
import { useKpiDataStore } from "@/modules/08_KPI/store"; import { useKpiDataStore } from "@/modules/08_KPI/store";
const $q = useQuasar(); const $q = useQuasar();
const route = useRoute();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const store = useKpiDataStore(); const store = useKpiDataStore();
const { const {
@ -294,6 +293,7 @@ function clickList(id: string, isData: boolean = false) {
formDetail.strategy = data.strategy; formDetail.strategy = data.strategy;
formDetail.strategyId = data.strategyId; formDetail.strategyId = data.strategyId;
formDetail.strategyName = data.strategyName; formDetail.strategyName = data.strategyName;
formDetail.documentInfoEvidence = data.documentInfoEvidence;
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -452,6 +452,7 @@ const title = computed(() => {
return name; return name;
}); });
</script> </script>
<template> <template>
<q-dialog v-model="modal" persistent> <q-dialog v-model="modal" persistent>
<q-card class="col-12" style="width: 100%"> <q-card class="col-12" style="width: 100%">

View file

@ -108,7 +108,7 @@ function onSubmitAdd() {
config.API.kpiCommentP( config.API.kpiCommentP(
"problem", "problem",
type.value + sendType.value, type.value + sendType.value,
"user", store.rolePerson.toLowerCase(),
sendId.value ? sendId.value : idList.value sendId.value ? sendId.value : idList.value
), ),
{ {
@ -162,7 +162,14 @@ function closeAdd() {
function getList() { function getList() {
showLoader(); showLoader();
http http
.get(config.API.kpiCommentP("problem", type.value, "user", idList.value)) .get(
config.API.kpiCommentP(
"problem",
type.value,
store.rolePerson.toLowerCase(),
idList.value
)
)
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
listTarget.value = data; listTarget.value = data;
@ -190,7 +197,12 @@ function onSubmitComment(role: string) {
showLoader(); showLoader();
http http
.put( .put(
config.API.kpiCommentP("problem", type.value, role, formDataView.id), config.API.kpiCommentP(
"problem",
type.value,
store.rolePerson.toLowerCase(),
formDataView.id
),
body body
) )
.then((res) => { .then((res) => {
@ -345,11 +357,11 @@ watch(
<div v-else> <div v-else>
<div class="row q-pa-md q-col-gutter-sm"> <div class="row q-pa-md q-col-gutter-sm">
<div class="row col-12 text-weight-medium"> <div class="row col-12 text-weight-medium">
<div class="col-4 text-grey-6">วขความกาวหน</div> <div class="col-4 text-grey-6">วขญห</div>
<div class="col-8">{{ formDataView.topic }}</div> <div class="col-8">{{ formDataView.topic }}</div>
</div> </div>
<div class="row col-12 text-weight-medium"> <div class="row col-12 text-weight-medium">
<div class="col-4 text-grey-6">รายละเอยดความกาวหน</div> <div class="col-4 text-grey-6">รายละเอยดญห</div>
<div class="col-8">{{ formDataView.reason }}</div> <div class="col-8">{{ formDataView.reason }}</div>
</div> </div>
<div class="col-12"> <div class="col-12">

View file

@ -16,17 +16,8 @@ import { useKpiDataStore } from "@/modules/08_KPI/store";
const store = useKpiDataStore(); const store = useKpiDataStore();
const $q = useQuasar(); const $q = useQuasar();
const route = useRoute();
const id = ref<string>(route.params.id as string);
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { const { dialogConfirm, showLoader, hideLoader, messageError, success } = mixin;
dialogConfirm,
showLoader,
hideLoader,
messageError,
dialogMessageNotify,
success,
} = mixin;
const modal = defineModel<boolean>("modal", { required: true }); const modal = defineModel<boolean>("modal", { required: true });
const type = defineModel<string>("type", { required: true }); const type = defineModel<string>("type", { required: true });
@ -93,7 +84,12 @@ function onSubmitAdd() {
showLoader(); showLoader();
http http
.put( .put(
config.API.kpiCommentP("progress", type.value, "user", idList.value), config.API.kpiCommentP(
"progress",
type.value,
store.rolePerson.toLocaleLowerCase(),
idList.value
),
{ {
reason: formDataAdd.reason, reason: formDataAdd.reason,
topic: formDataAdd.topic, topic: formDataAdd.topic,
@ -136,7 +132,14 @@ function closeAdd() {
function getList() { function getList() {
showLoader(); showLoader();
http http
.get(config.API.kpiCommentP("progress", type.value, "user", idList.value)) .get(
config.API.kpiCommentP(
"progress",
type.value,
store.rolePerson.toLocaleLowerCase(),
idList.value
)
)
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
listTarget.value = data; listTarget.value = data;
@ -164,7 +167,12 @@ function onSubmitComment(role: string) {
showLoader(); showLoader();
http http
.put( .put(
config.API.kpiCommentP("progress", type.value, role, formDataView.id), config.API.kpiCommentP(
"progress",
type.value,
store.rolePerson.toLocaleLowerCase(),
formDataView.id
),
body body
) )
.then((res) => { .then((res) => {

View file

@ -8,7 +8,7 @@ import http from "@/plugins/http";
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
import Dialog from "@/modules/08_KPI/components/Tab/Dialog/01_FormIndicator.vue"; import Dialog from "@/modules/08_KPI/components/Tab/Dialog/01_FormIndicator.vue";
import Dialog03 from "@/modules/08_KPI/components/Tab/Dialog/03_FormIndicatorSpecial.vue"; // import Dialog03 from "@/modules/08_KPI/components/Tab/Dialog/03_FormIndicatorSpecial.vue";
import DialogEvaluate from "@/modules/08_KPI/components/Tab/DialogEvaluate/01_Indicator.vue"; import DialogEvaluate from "@/modules/08_KPI/components/Tab/DialogEvaluate/01_Indicator.vue";
import DialogViewInfo from "@/modules/08_KPI/components/Tab/Dialog/DialogViewInfo.vue"; import DialogViewInfo from "@/modules/08_KPI/components/Tab/Dialog/DialogViewInfo.vue";
import DialogProgress from "@/modules/08_KPI/components/Tab/Dialog/DialogCommentProgress.vue"; import DialogProgress from "@/modules/08_KPI/components/Tab/Dialog/DialogCommentProgress.vue";

View file

@ -311,17 +311,14 @@ export const useKpiDataStore = defineStore("KPIDate", () => {
const indicatorWeight1Total = ref<number>(0); // น้ำหนักรวมมิติที่ 1 ต้องไม่เกิน 100% const indicatorWeight1Total = ref<number>(0); // น้ำหนักรวมมิติที่ 1 ต้องไม่เกิน 100%
const indicatorWeight2Total = ref<number>(0); // น้ำหนักรวมมิติที่ 2 ต้องไม่เกิน 20 const indicatorWeight2Total = ref<number>(0); // น้ำหนักรวมมิติที่ 2 ต้องไม่เกิน 20
const indicatorPercent = ref<number>(100); // รวมผลการประเมิน (ร้อยละ)
const indicatorPercentVal = ref<number>(0); // รวมผลการประเมิน (ร้อยละ) ที่ได้จริง const indicatorPercentVal = ref<number>(0); // รวมผลการประเมิน (ร้อยละ) ที่ได้จริง
const indicatorScore = ref<number>(70); // สรุปผลการประเมินผลสัมฤทธิ์ของงาน ( คะแนนเต็ม indicatorScore คะแนน) const indicatorScore = ref<number>(70); // สรุปผลการประเมินผลสัมฤทธิ์ของงาน ( คะแนนเต็ม indicatorScore คะแนน)
const competencyScore = ref<number>(20); // ผลการประเมินสมรรถนะ (competencyScore คะแนน) const competencyScore = ref<number>(20); // ผลการประเมินสมรรถนะ (competencyScore คะแนน)
const devScore = ref<number>(10); // ผลการประเมินการพัฒนาตนเอง (devScore คะแนน)
const devScoreVal = ref<number>(0); // ผลการประเมินการพัฒนาตนเองที่ได้กี่คะแนน const devScoreVal = ref<number>(0); // ผลการประเมินการพัฒนาตนเองที่ได้กี่คะแนน
const competencyDevScore = ref<number>(30); // สรุปผลการประเมินพฤติกรรมการปฏิบัติราชการ (สมรรถนะ+การพัฒนาตนเอง) (คะแนนเต็ม competencyDevScore คะแนน) const competencyDevScore = ref<number>(30); // สรุปผลการประเมินพฤติกรรมการปฏิบัติราชการ (สมรรถนะ+การพัฒนาตนเอง) (คะแนนเต็ม competencyDevScore คะแนน)
const competencyDevScoreVal = ref<number>(0); // สรุปผลการประเมินพฤติกรรมการปฏิบัติราชการ (สมรรถนะ+การพัฒนาตนเอง)ที่ได้กี่คะแนน const devScore = ref<number>(10); // ผลการประเมินการพัฒนาตนเอง (devScore คะแนน)
// SUMMARY EXCLUSIVE CASE // SUMMARY EXCLUSIVE CASE
const excusiveIndicatorPercent = ref<number>(100); // รวมผลการประเมิน (ร้อยละ) แต่ละมิติต้องไม่เกิน 100%
const excusiveIndicator1PercentVal = ref<number>(0); // รวมผลการประเมิน (ร้อยละ) มิติที่ 1 ที่ได้จริง const excusiveIndicator1PercentVal = ref<number>(0); // รวมผลการประเมิน (ร้อยละ) มิติที่ 1 ที่ได้จริง
const excusiveIndicator1Weight = ref<number>(60); // น้ำหนักของมิติที่ 1 const excusiveIndicator1Weight = ref<number>(60); // น้ำหนักของมิติที่ 1
const excusiveIndicator1ScoreVal = ref<number>(0); // คะแนนมิติที่ 1 ที่ได้จริง const excusiveIndicator1ScoreVal = ref<number>(0); // คะแนนมิติที่ 1 ที่ได้จริง
@ -355,7 +352,6 @@ export const useKpiDataStore = defineStore("KPIDate", () => {
indicatorWeightTotal, indicatorWeightTotal,
indicatorWeight1Total, indicatorWeight1Total,
indicatorWeight2Total, indicatorWeight2Total,
indicatorPercent,
indicatorPercentVal, indicatorPercentVal,
indicatorScore, indicatorScore,
indicatorScoreVal, indicatorScoreVal,
@ -364,9 +360,7 @@ export const useKpiDataStore = defineStore("KPIDate", () => {
devScore, devScore,
devScoreVal, devScoreVal,
competencyDevScore, competencyDevScore,
competencyDevScoreVal,
excusiveCompetencyScore, excusiveCompetencyScore,
excusiveIndicatorPercent,
excusiveIndicator1PercentVal, excusiveIndicator1PercentVal,
excusiveIndicator1Weight, excusiveIndicator1Weight,
excusiveIndicator1ScoreVal, excusiveIndicator1ScoreVal,

View file

@ -13,21 +13,12 @@ import DialogHeader from "@/components/DialogHeader.vue";
import type { FormProfile } from "@/modules/08_KPI/interface/request/index"; import type { FormProfile } from "@/modules/08_KPI/interface/request/index";
import type { DataOptions } from "@/modules/08_KPI/interface/index/Main"; import type { DataOptions } from "@/modules/08_KPI/interface/index/Main";
const scoreTotal = ref<boolean>(false); // const modalScore = ref<boolean>(false);
const modalScore = ref<boolean>(false);
const modalEdit = ref<boolean>(false); const modalEdit = ref<boolean>(false);
const route = useRoute(); const route = useRoute();
const id = ref<string>(route.params.id as string); const id = ref<string>(route.params.id as string);
const isReadonly = <boolean>(route.name === "KPIEditEvaluator" ? true : false); const isReadonly = <boolean>(route.name === "KPIEditEvaluator" ? true : false);
const totalScore = computed(
() =>
Number(plannedPoint.value) +
Number(rolePoint.value) +
Number(specialPoint.value) +
Number(capacityPoint.value)
);
const plannedPoint = ref<string>(""); const plannedPoint = ref<string>("");
const rolePoint = ref<string>(""); const rolePoint = ref<string>("");
const specialPoint = ref<string>(""); const specialPoint = ref<string>("");
@ -49,8 +40,6 @@ const commanderHighMainOp = ref<DataOptions[]>([]);
const evaluatorId = ref<any>(null); const evaluatorId = ref<any>(null);
const commanderId = ref<any>(null); const commanderId = ref<any>(null);
const commanderHighId = ref<any>(null); const commanderHighId = ref<any>(null);
const indicatorScore = ref<number>(0);
const competencyScore = ref<number>(0);
const formProfile = reactive<FormProfile>({ const formProfile = reactive<FormProfile>({
fullName: "", fullName: "",
@ -114,7 +103,7 @@ async function fetchProfile(id: string) {
config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, `profile-${id}`) config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, `profile-${id}`)
) )
.then(async (res) => { .then(async (res) => {
store.dataProfile.avartar = res.data.downloadUrl; store.dataEvaluation.avartar = res.data.downloadUrl;
}) })
.catch(() => { .catch(() => {
// profilePicture.value = avatar; // profilePicture.value = avatar;
@ -226,30 +215,6 @@ function filterOption(val: any, update: Function, refData: string) {
} }
} }
watch(
[plannedPoint, rolePoint, specialPoint, capacityPoint],
(
[newPlannedPoint, newRolePoint, newSpecialPoint, newCapacityPoint],
[oldPlannedPoint, oldRolePoint, oldSpecialPoint, oldCapacityPoint]
) => {
if (
newPlannedPoint !== "" &&
newRolePoint !== "" &&
newSpecialPoint !== "" &&
newCapacityPoint !== ""
) {
if (totalScore.value == 100) {
scoreTotal.value = false;
} else {
scoreTotal.value = true;
}
}
// else {
// console.log(2);
// }
}
);
// function onSubmitScore() { // function onSubmitScore() {
// showLoader(); // showLoader();
// http // http
@ -382,7 +347,7 @@ onMounted(async () => {
style="left: 2%; top: 50%; transform: translateY(-50%)" style="left: 2%; top: 50%; transform: translateY(-50%)"
> >
<q-avatar size="95px"> <q-avatar size="95px">
<q-img :src="store.dataProfile.avartar" /> <q-img :src="store.dataEvaluation.avartar" />
</q-avatar> </q-avatar>
</div> </div>
<div class="row col-12"> <div class="row col-12">
@ -390,7 +355,7 @@ onMounted(async () => {
<div class="col-12" style="padding-left: 12%"> <div class="col-12" style="padding-left: 12%">
<div class="row col-12 items-center"> <div class="row col-12 items-center">
<span class="text-h6 text-weight-medium text-primary">{{ <span class="text-h6 text-weight-medium text-primary">{{
`${store.dataProfile.prefix}${store.dataProfile.firstName} ${store.dataProfile.lastName}` `${store.dataEvaluation.prefix}${store.dataEvaluation.firstName} ${store.dataEvaluation.lastName}`
}}</span> }}</span>
<q-space /> <q-space />
<div class="q-gutter-x-sm"> <div class="q-gutter-x-sm">
@ -528,7 +493,7 @@ onMounted(async () => {
<div class="column"> <div class="column">
<span class="text-grey-6">ตำแหนงในสายงาน</span> <span class="text-grey-6">ตำแหนงในสายงาน</span>
<span class="text-weight-medium text-dark">{{ <span class="text-weight-medium text-dark">{{
store.dataProfile.position store.dataEvaluation.position
}}</span> }}</span>
</div> </div>
</div> </div>
@ -536,7 +501,7 @@ onMounted(async () => {
<div class="column"> <div class="column">
<span class="text-grey-6">ประเภทตำแหน</span> <span class="text-grey-6">ประเภทตำแหน</span>
<span class="text-weight-medium text-dark">{{ <span class="text-weight-medium text-dark">{{
store.dataProfile.posTypeName store.dataEvaluation.posTypeName
}}</span> }}</span>
</div> </div>
</div> </div>
@ -544,7 +509,7 @@ onMounted(async () => {
<div class="column"> <div class="column">
<span class="text-grey-6">ระดบตำแหน</span> <span class="text-grey-6">ระดบตำแหน</span>
<span class="text-weight-medium text-dark">{{ <span class="text-weight-medium text-dark">{{
store.dataProfile.posLevelName store.dataEvaluation.posLevelName
}}</span> }}</span>
</div> </div>
</div> </div>

View file

@ -94,6 +94,10 @@ const formRound = reactive({
evaluatorId: "", evaluatorId: "",
commanderId: "", commanderId: "",
commanderHighId: "", commanderHighId: "",
position: "",
posLevelName: "",
posTypeName: "",
posExecutiveName: "",
}); });
/** pagetion*/ /** pagetion*/
@ -170,6 +174,27 @@ function changRound() {
function redirectViewDetail(id: string) { function redirectViewDetail(id: string) {
store.tabMain = "1"; store.tabMain = "1";
store.indicatorWeightTotal = 0;
store.indicatorWeight1Total = 0;
store.indicatorWeight2Total = 0;
store.indicatorPercentVal = 0;
store.indicatorScore = 0;
store.indicatorScoreVal = 0;
store.competencyScore = 0;
store.competencyScoreVal = 0;
store.devScore = 0;
store.devScoreVal = 0;
store.competencyDevScore = 0;
store.excusiveCompetencyScore = 0;
store.excusiveIndicator1PercentVal = 0;
store.excusiveIndicator1Weight = 0;
store.excusiveIndicator1ScoreVal = 0;
store.excusiveIndicator2Weight = 0;
store.excusiveIndicator2PercentVal = 0;
store.excusiveIndicator2ScoreVal = 0;
store.excusiveIndicatorScore = 0;
router.push(`/KPI/${id}`); router.push(`/KPI/${id}`);
} }
@ -194,6 +219,10 @@ function onSubmit() {
prefix: formRound.prefix, prefix: formRound.prefix,
firstName: formRound.firstName, firstName: formRound.firstName,
lastName: formRound.lastName, lastName: formRound.lastName,
// position: formRound.position,
// posLevelName: formRound.posLevelName,
// posTypeName: formRound.posTypeName,
// posExecutiveName: formRound.posExecutiveName,
evaluatorId: formRound.evaluatorId, evaluatorId: formRound.evaluatorId,
commanderId: formRound.commanderId == "" ? null : formRound.commanderId, commanderId: formRound.commanderId == "" ? null : formRound.commanderId,
@ -227,6 +256,10 @@ function getProfile() {
formRound.prefix = data.prefix; formRound.prefix = data.prefix;
formRound.firstName = data.firstName; formRound.firstName = data.firstName;
formRound.lastName = data.lastName; formRound.lastName = data.lastName;
formRound.position = data.position;
formRound.posLevelName = data.posLevelName;
formRound.posTypeName = data.posTypeName;
formRound.posExecutiveName = data.posExecutiveName;
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);