updated competency cal

This commit is contained in:
Warunee Tamkoo 2024-04-25 15:28:43 +07:00
parent df49f223e7
commit 7f53399af5
5 changed files with 401 additions and 47 deletions

View file

@ -11,8 +11,6 @@ import config from "@/app.config";
import { useQuasar } from "quasar";
import { useRoute } from "vue-router";
import type { FormCapacityList } from "@/modules/08_KPI/interface/request/index";
const route = useRoute();
const idParam = ref<string>(route.params.id as string);
@ -39,24 +37,15 @@ const idProps = defineModel<string | null>("id", { required: true });
const competencyType = defineModel<string>("competencyType", {
required: true,
});
const splitterModel = ref<number>(30);
const search = ref<string>("");
const define = ref<string>("");
const formula = ref<string>("");
const type = ref<string>("");
const listCheck = ref<string>();
const listTarget = ref<any>([]);
const listTargetMain = ref<any>([]);
const expectedLevelOp = ref<DataOptions[]>([
{ id: "1", name: "1" },
{ id: "2", name: "2" },
{ id: "3", name: "3" },
{ id: "4", name: "4" },
{ id: "5", name: "5" },
]);
const expectedLevelOp = ref<Object[]>(["1", "2", "3", "4", "5"]);
const formDetail = reactive<any>({
id: "",
type: "สมรรถนะหลัก",
@ -153,7 +142,7 @@ function onSubmit() {
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog();
props.getDataList?.();
props.getDataList?.(competencyType.value);
})
.catch((e) => {
messageError($q, e);
@ -166,21 +155,23 @@ function onSubmit() {
}
function getData() {
showLoader()
showLoader();
http
.get(config.API.KpiCapacity + `?type=${type.value}`)
.then((res) => {
const data = res.data.result.data;
listTarget.value = data;
listTargetMain.value = data;
formScore.score1 = data.capacityDetails[0].description;
formScore.score2 = data.capacityDetails[1].description;
formScore.score3 = data.capacityDetails[2].description;
formScore.score4 = data.capacityDetails[3].description;
formScore.score5 = data.capacityDetails[4].description;
if (data.capacityDetails) {
formScore.score1 = data.capacityDetails[0].description;
formScore.score2 = data.capacityDetails[1].description;
formScore.score3 = data.capacityDetails[2].description;
formScore.score4 = data.capacityDetails[3].description;
formScore.score5 = data.capacityDetails[4].description;
}
})
.finally(() => {
hideLoader()
hideLoader();
});
}
@ -216,16 +207,17 @@ function getDataById() {
.catch((e) => {})
.finally(() => {});
}
watch(
() => modal.value,
() => {
if (modal.value == true) {
if (modal.value) {
type.value = competencyType.value;
getData();
if (idProps.value) {
setTimeout(() => {
getDataById();
}, 1000);
}, 500);
} else {
if (type.value == "HEAD") {
expectedLevel.value = store.defaultCompetencyCoreLevel;
@ -239,6 +231,7 @@ watch(
}
);
</script>
<template>
<q-dialog v-model="modal" persistent>
<q-card class="col-12" style="width: 85%">
@ -388,9 +381,6 @@ watch(
:options="expectedLevelOp"
dense
emit-value
map-options
option-label="id"
option-value="name"
outlined
lazy-rules
:rules="[(val:string) => !!val || `${'กรุณาเลือกระดับที่คาดหวัง'}`,]"