This commit is contained in:
Warunee Tamkoo 2024-06-18 09:03:04 +07:00
parent a58016fb9d
commit 6d7547d14f
2 changed files with 43 additions and 34 deletions

View file

@ -13,7 +13,7 @@ const store = useKpiDataStore();
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
const id = ref<string>(route.params.id as string) const id = ref<string>(route.params.id as string);
const work = ref<boolean>(false); const work = ref<boolean>(false);
const $q = useQuasar(); const $q = useQuasar();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
@ -29,35 +29,37 @@ const {
} = mixin; } = mixin;
const modal = defineModel<boolean>("modal", { required: true }); const modal = defineModel<boolean>("modal", { required: true });
const isProbation = defineModel<boolean>("isProbation", { required: true });
function close() { function close() {
modal.value = false; modal.value = false;
} }
function getData() { // function getData() {
showLoader(); // showLoader();
http // http
.get(config.API.orgPosition+`/${store.dataProfile.profileId}`) // .get(config.API.orgPosition+`/${store.dataProfile.profileId}`)
.then((res) => { // .then((res) => {
const data = res.data.result.isProbation; // const data = res.data.result.isProbation;
work.value = data; // work.value = data;
}) // })
.catch((e) => { // .catch((e) => {
messageError($q, e); // messageError($q, e);
}) // })
.finally(() => { // .finally(() => {
hideLoader(); // hideLoader();
}); // });
} // }
watch( // watch(
() => modal.value, // () => modal.value,
(n) => { // (n) => {
if (n == true) { // if (n == true) {
getData(); // getData();
} // }
} // }
); // );
</script> </script>
<template> <template>
<q-dialog persistent v-model="modal"> <q-dialog persistent v-model="modal">
<q-card bordered style="min-width: 20vw"> <q-card bordered style="min-width: 20vw">
@ -66,7 +68,9 @@ watch(
<q-card-section class="q-pa-sm"> <q-card-section class="q-pa-sm">
<div class="row"> <div class="row">
<div class="col-12 text-center bg-grey-1 q-pa-md rounded-borders"> <div class="col-12 text-center bg-grey-1 q-pa-md rounded-borders">
<span class="text-weight-bold text-teal">{{work ? `อยู่ระหว่างทดลองงาน`:'พ้นจากการทดลองงาน'}}</span> <span class="text-weight-bold text-teal">{{
isProbation ? `อยู่ระหว่างทดลองงาน` : "-"
}}</span>
</div> </div>
</div> </div>
</q-card-section> </q-card-section>

View file

@ -63,7 +63,7 @@ async function fetchEvaluation() {
.get(config.API.kpiEvaluation + `/${id.value}`) .get(config.API.kpiEvaluation + `/${id.value}`)
.then(async (res) => { .then(async (res) => {
const data = res.data.result; const data = res.data.result;
console.log("🚀 ~ .then ~ data:", data) // console.log("🚀 ~ .then ~ data:", data);
store.dataEvaluation = await data; store.dataEvaluation = await data;
formProfile.status = store.convertStatus(data.evaluationStatus); formProfile.status = store.convertStatus(data.evaluationStatus);
@ -89,10 +89,10 @@ async function fetchEvaluation() {
async function getProfile() { async function getProfile() {
await http await http
.get(config.API.profilePosition()) .get(config.API.orgPosition + `/${store.dataEvaluation.profileId}`)
.then(async (res) => { .then(async (res) => {
const data = res.data.result; const data = await res.data.result;
store.dataProfile = await data; store.dataProfile = data;
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
@ -252,8 +252,8 @@ function filterOption(val: any, update: Function, refData: string) {
// } // }
async function getAll() { async function getAll() {
await getProfile();
await fetchEvaluation(); await fetchEvaluation();
await getProfile();
await getOrgOp(); await getOrgOp();
await store.checkStep(); await store.checkStep();
} }
@ -335,7 +335,7 @@ function sendToCommander() {
messageError($q, e); messageError($q, e);
}) })
.finally(() => { .finally(() => {
hideLoader() hideLoader();
}); });
}); });
} }
@ -418,7 +418,8 @@ onMounted(async () => {
store.indicatorWeightTotal != 100) || store.indicatorWeightTotal != 100) ||
(store.dataEvaluation.posExecutiveName != null && (store.dataEvaluation.posExecutiveName != null &&
(store.indicatorWeight1Total != 100 || (store.indicatorWeight1Total != 100 ||
store.indicatorWeight2Total != 20)) && store.dataEvaluation.evaluationStatus == 'NEW' store.indicatorWeight2Total != 20) &&
store.dataEvaluation.evaluationStatus == 'NEW')
" "
class="text-red" class="text-red"
>*ำหน(อยละ) ผลสมฤทธของงานไมกตอง</span >*ำหน(อยละ) ผลสมฤทธของงานไมกตอง</span
@ -465,7 +466,8 @@ onMounted(async () => {
<q-btn <q-btn
v-if=" v-if="
store.rolePerson == 'USER' && store.rolePerson == 'USER' &&
store.dataEvaluation.evaluationStatus == 'EVALUATING' && store.tabMain == '3' store.dataEvaluation.evaluationStatus == 'EVALUATING' &&
store.tabMain == '3'
" "
unelevated unelevated
round round
@ -831,7 +833,10 @@ onMounted(async () => {
</q-dialog> --> </q-dialog> -->
<DialogGovernment v-model:modal="modalGovernment" /> <DialogGovernment v-model:modal="modalGovernment" />
<DialogStatus v-model:modal="modalStatus" /> <DialogStatus
v-model:modal="modalStatus"
v-model:is-probation="store.dataProfile.isProbation"
/>
</template> </template>
<style> <style>
.bg-toolbar { .bg-toolbar {