แก้ไขคะแนนเต็ม
This commit is contained in:
parent
9f14fc9a7b
commit
eb87dee240
2 changed files with 182 additions and 19 deletions
|
|
@ -23,6 +23,9 @@ export default {
|
||||||
kpiAchievement: (type: string) => `${kpiAchievement}/${type}`,
|
kpiAchievement: (type: string) => `${kpiAchievement}/${type}`,
|
||||||
kpiAchievementPoint: (type: string) => `${kpiAchievement}/${type}/point`,
|
kpiAchievementPoint: (type: string) => `${kpiAchievement}/${type}/point`,
|
||||||
|
|
||||||
|
kpiScoreTotal: () => `${kpiEvaluation}/point`,
|
||||||
|
|
||||||
|
|
||||||
/** ผลสัมฤทธิ์ของงาน*/
|
/** ผลสัมฤทธิ์ของงาน*/
|
||||||
fileByFile: (name: string, group: string, id: string, fileName: string) =>
|
fileByFile: (name: string, group: string, id: string, fileName: string) =>
|
||||||
`${url}/file/${name}/${group}/${id}/${fileName}`,
|
`${url}/file/${name}/${group}/${id}/${fileName}`,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, reactive } from "vue";
|
import { ref, onMounted, reactive, computed, watch } from "vue";
|
||||||
import { useRoute, useRouter } from "vue-router";
|
import { useRoute, useRouter } from "vue-router";
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
|
|
@ -13,11 +13,26 @@ 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 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 rolePoint = ref<string>("");
|
||||||
|
const specialPoint = ref<string>("");
|
||||||
|
const capacityPoint = ref<string>("");
|
||||||
|
|
||||||
const store = useKpiDataStore();
|
const store = useKpiDataStore();
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
|
|
@ -59,6 +74,12 @@ function fetchEvaluation() {
|
||||||
formProfile.result = store.convertResults(data.evaluationResults);
|
formProfile.result = store.convertResults(data.evaluationResults);
|
||||||
fetchProfile(data.profileId);
|
fetchProfile(data.profileId);
|
||||||
console.log(store.dataEvaluation);
|
console.log(store.dataEvaluation);
|
||||||
|
|
||||||
|
plannedPoint.value = data.plannedPoint == null ? "" : data.plannedPoint;
|
||||||
|
rolePoint.value = data.rolePoint == null ? "" : data.rolePoint;
|
||||||
|
specialPoint.value = data.specialPoint == null ? "" : data.specialPoint;
|
||||||
|
capacityPoint.value =
|
||||||
|
data.capacityPoint == null ? "" : data.capacityPoint;
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
|
|
@ -127,26 +148,27 @@ async function clearDialog() {
|
||||||
|
|
||||||
function onSubmit() {
|
function onSubmit() {
|
||||||
dialogConfirm($q, () => {
|
dialogConfirm($q, () => {
|
||||||
if(id.value){
|
if (id.value) {
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
http
|
||||||
.put(config.API.kpiEvaluationCheck + `/${id.value}`, {
|
.put(config.API.kpiEvaluationCheck + `/${id.value}`, {
|
||||||
evaluatorId: evaluatorId.value ? evaluatorId.value.id:null,
|
evaluatorId: evaluatorId.value ? evaluatorId.value.id : null,
|
||||||
commanderId: commanderId.value ? commanderId.value.id:null,
|
commanderId: commanderId.value ? commanderId.value.id : null,
|
||||||
commanderHighId: commanderHighId.value ? commanderHighId.value.id:null,
|
commanderHighId: commanderHighId.value
|
||||||
})
|
? commanderHighId.value.id
|
||||||
.then((res) => {
|
: null,
|
||||||
success($q, "บันทึกสำเร็จ");
|
})
|
||||||
clearDialog();
|
.then((res) => {
|
||||||
})
|
success($q, "บันทึกสำเร็จ");
|
||||||
.catch((e) => {
|
clearDialog();
|
||||||
messageError($q, e);
|
})
|
||||||
})
|
.catch((e) => {
|
||||||
.finally(() => {
|
messageError($q, e);
|
||||||
hideLoader();
|
})
|
||||||
});
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -221,6 +243,53 @@ 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() {
|
||||||
|
showLoader();
|
||||||
|
http
|
||||||
|
.put(config.API.kpiScoreTotal() + `/${id.value}`, {
|
||||||
|
plannedPoint:plannedPoint.value,
|
||||||
|
rolePoint:rolePoint.value,
|
||||||
|
specialPoint:specialPoint.value,
|
||||||
|
capacityPoint:capacityPoint.value
|
||||||
|
})
|
||||||
|
.then(async (res) => {
|
||||||
|
await fetchEvaluation();
|
||||||
|
await getProfile();
|
||||||
|
await getOrgOp();
|
||||||
|
await success($q, "บันทึกสำเร็จ");
|
||||||
|
modalScore.value = false
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
messageError($q, e);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await fetchEvaluation();
|
await fetchEvaluation();
|
||||||
await getProfile();
|
await getProfile();
|
||||||
|
|
@ -276,6 +345,18 @@ onMounted(async () => {
|
||||||
}}</span>
|
}}</span>
|
||||||
<q-space />
|
<q-space />
|
||||||
<div class="q-gutter-x-sm">
|
<div class="q-gutter-x-sm">
|
||||||
|
<q-btn
|
||||||
|
v-if="!isReadonly"
|
||||||
|
unelevated
|
||||||
|
round
|
||||||
|
icon="mdi-format-list-bulleted-square"
|
||||||
|
color="grey-2"
|
||||||
|
text-color="amber-10"
|
||||||
|
size="md"
|
||||||
|
@click="modalScore = true"
|
||||||
|
>
|
||||||
|
<q-tooltip>แก้ไขคะแนนเต็ม</q-tooltip>
|
||||||
|
</q-btn>
|
||||||
<q-btn
|
<q-btn
|
||||||
v-if="!isReadonly"
|
v-if="!isReadonly"
|
||||||
unelevated
|
unelevated
|
||||||
|
|
@ -462,6 +543,85 @@ onMounted(async () => {
|
||||||
</q-form>
|
</q-form>
|
||||||
</q-card>
|
</q-card>
|
||||||
</q-dialog>
|
</q-dialog>
|
||||||
|
|
||||||
|
<q-dialog v-model="modalScore" persistent>
|
||||||
|
<q-card bordered style="width: 50vh">
|
||||||
|
<q-form greedy @submit.prevent @validation-success="onSubmitScore">
|
||||||
|
<DialogHeader
|
||||||
|
tittle="แก้ไขคะแนนเต็ม"
|
||||||
|
:close="
|
||||||
|
() => {
|
||||||
|
modalScore = false;
|
||||||
|
}
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
<q-separator />
|
||||||
|
<q-card-section>
|
||||||
|
<div class="column q-gutter-sm">
|
||||||
|
<q-input
|
||||||
|
v-model="plannedPoint"
|
||||||
|
label="งานตามแผนปฏิบัติราชการประจำปี"
|
||||||
|
dense
|
||||||
|
outlined
|
||||||
|
class="inputgreen"
|
||||||
|
mask="###"
|
||||||
|
:rules="[(val:string) => !!val || `${'กรุณากรอกคะเเนนงานตามแผนปฏิบัติราชการประจำปี หรือ 0'}`,]"
|
||||||
|
hide-bottom-space
|
||||||
|
lazy-rules
|
||||||
|
/>
|
||||||
|
<q-input
|
||||||
|
v-model="rolePoint"
|
||||||
|
label="งานตามหน้าที่ความรับผิดชอบหลัก"
|
||||||
|
dense
|
||||||
|
outlined
|
||||||
|
class="inputgreen"
|
||||||
|
mask="###"
|
||||||
|
:rules="[(val:string) => !!val || `${'กรุณากรอกคะเเนนงานตามหน้าที่ความรับผิดชอบหลัก หรือ 0'}`,]"
|
||||||
|
hide-bottom-space
|
||||||
|
lazy-rules
|
||||||
|
/>
|
||||||
|
<q-input
|
||||||
|
v-model="specialPoint"
|
||||||
|
label="งานที่ได้รับมอบหมายพิเศษ"
|
||||||
|
dense
|
||||||
|
outlined
|
||||||
|
class="inputgreen"
|
||||||
|
mask="###"
|
||||||
|
:rules="[(val:string) => !!val || `${'กรุณากรอกคะเเนนงานที่ได้รับมอบหมายพิเศษ หรือ 0'}`,]"
|
||||||
|
hide-bottom-space
|
||||||
|
lazy-rules
|
||||||
|
/>
|
||||||
|
<q-input
|
||||||
|
v-model="capacityPoint"
|
||||||
|
label="สมรรถนะ"
|
||||||
|
dense
|
||||||
|
outlined
|
||||||
|
class="inputgreen"
|
||||||
|
mask="###"
|
||||||
|
:rules="[(val:string) => !!val || `${'กรุณากรอกคะเเนนสมรรถนะ หรือ 0'}`,]"
|
||||||
|
hide-bottom-space
|
||||||
|
lazy-rules
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</q-card-section>
|
||||||
|
<q-separator />
|
||||||
|
<q-card-actions class="bg-white row justify-between">
|
||||||
|
<div class="col-8 text-center text-red text-bold">
|
||||||
|
<span v-if="scoreTotal == true"
|
||||||
|
>คะแนนเต็มรวมกันต้องเท่ากับ 100 คะแนน</span
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<q-btn
|
||||||
|
label="บันทึก"
|
||||||
|
color="secondary"
|
||||||
|
type="submit"
|
||||||
|
:disable="totalScore !== 100"
|
||||||
|
><q-tooltip>บันทึกข้อมูล</q-tooltip></q-btn
|
||||||
|
>
|
||||||
|
</q-card-actions>
|
||||||
|
</q-form>
|
||||||
|
</q-card>
|
||||||
|
</q-dialog>
|
||||||
</template>
|
</template>
|
||||||
<style>
|
<style>
|
||||||
.bg-toolbar {
|
.bg-toolbar {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue