Merge branch 'develop' of github.com:Frappet/BMA-EHR-USER into develop

* 'develop' of github.com:Frappet/BMA-EHR-USER:
  งานที่ได้รับมอบหมายพิเศษ
This commit is contained in:
Warunee Tamkoo 2024-05-09 12:13:12 +07:00
commit 613fbece2e
4 changed files with 203 additions and 66 deletions

View file

@ -5,6 +5,7 @@ const kpiPeriod = `${env.API_URI}/kpi/period`;
const kpiEvaluation = `${env.API_URI}/kpi/user/evaluation`; const kpiEvaluation = `${env.API_URI}/kpi/user/evaluation`;
const kpiPlan = `${env.API_URI}/kpi/plan`; const kpiPlan = `${env.API_URI}/kpi/plan`;
const kpiRole = `${env.API_URI}/kpi/role`; const kpiRole = `${env.API_URI}/kpi/role`;
const kpiSpecial = `${env.API_URI}/kpi/special`;
const KpiCapacity = `${env.API_URI}/kpi/capacity`; const KpiCapacity = `${env.API_URI}/kpi/capacity`;
const KpiFile = `${env.API_URI}/salary/file`; const KpiFile = `${env.API_URI}/salary/file`;
const KpiEvaluationInfo = `${env.API_URI}/kpi/evaluation`; const KpiEvaluationInfo = `${env.API_URI}/kpi/evaluation`;
@ -17,6 +18,7 @@ export default {
kpiEvaluation, kpiEvaluation,
kpiPlan, kpiPlan,
kpiRole, kpiRole,
kpiSpecial,
KpiCapacity, KpiCapacity,
file: KpiFile, file: KpiFile,
@ -25,7 +27,6 @@ export default {
kpiScoreTotal: () => `${kpiEvaluation}/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}`,

View file

@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, watch } from "vue"; import { ref, reactive, watch, computed } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useRoute } from "vue-router"; import { useRoute } from "vue-router";
import config from "@/app.config"; import config from "@/app.config";
@ -86,7 +86,7 @@ const roundOp = ref<DataOptions[]>([
{ id: "OCT", name: "รอบตุลาคม" }, { id: "OCT", name: "รอบตุลาคม" },
]); ]);
function fetchIndicators() { function fetchListPlan() {
formFilter.nodeId = store.dataProfile.nodeId; formFilter.nodeId = store.dataProfile.nodeId;
formFilter.node = store.dataProfile.node; formFilter.node = store.dataProfile.node;
formFilter.year = formFilter?.year ? formFilter.year.toString() : ""; formFilter.year = formFilter?.year ? formFilter.year.toString() : "";
@ -108,7 +108,7 @@ function fetchIndicators() {
}); });
} }
function fetchIndicatorsByid(id: string) { function fetchListPlanByid(id: string) {
showLoader(); showLoader();
http http
.get(config.API.kpiAchievement("planned") + `/${id}`) .get(config.API.kpiAchievement("planned") + `/${id}`)
@ -141,15 +141,13 @@ function fetchIndicatorsByid(id: string) {
} }
function fetchListRole() { function fetchListRole() {
const kpiPeriodId = store.dataEvaluation.kpiPeriodId; // const kpiPeriodId = store.dataEvaluation.kpiPeriodId;
const position = store.dataProfile.position; // const position = store.dataProfile.position;
formFilter.nodeId = store.dataProfile.nodeId; formFilter.nodeId = store.dataProfile.nodeId;
formFilter.node = store.dataProfile.node; formFilter.node = store.dataProfile.node;
formFilter.year = formFilter?.year ? formFilter.year.toString() : ""; formFilter.year = formFilter?.year ? formFilter.year.toString() : "";
formFilter.position = store.dataProfile.position; formFilter.position = store.dataProfile.position;
console.log(formFilter);
http http
.post(config.API.kpiRole + `/search`, formFilter) .post(config.API.kpiRole + `/search`, formFilter)
.then((res) => { .then((res) => {
@ -157,6 +155,9 @@ function fetchListRole() {
maxPage.value = Math.ceil(res.data.result.total / formFilter.pageSize); maxPage.value = Math.ceil(res.data.result.total / formFilter.pageSize);
totalList.value = res.data.result.total; totalList.value = res.data.result.total;
}) })
.catch((err) => {
messageError($q, err);
})
.finally(() => { .finally(() => {
hideLoader(); hideLoader();
}); });
@ -194,9 +195,76 @@ function fetchRoleByid(id: string) {
}); });
} }
function fetchListSpecial() {
formFilter.nodeId = store.dataProfile.nodeId;
formFilter.node = store.dataProfile.node;
formFilter.year = formFilter?.year ? formFilter.year.toString() : "";
const body = {
keyword: formFilter.keyword,
period: formFilter.period,
year: formFilter.year,
pageSize: formFilter.pageSize,
page: formFilter.page,
};
showLoader();
http
.post(config.API.kpiSpecial + `/search`, body)
.then((res) => {
listTarget.value = res.data.result.data;
maxPage.value = Math.ceil(res.data.result.total / formFilter.pageSize);
totalList.value = res.data.result.total;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
function fetchspecialByid(id: string) {
showLoader();
http
.get(config.API.kpiAchievement("special") + `/${id}`)
.then((res) => {
const data = res.data.result;
formDetail.including = data.including;
formDetail.includingName = data.includingName;
formDetail.target = data.target;
formDetail.unit = data.unit;
formDetail.achievement1 = data.achievement1;
formDetail.achievement2 = data.achievement2;
formDetail.achievement3 = data.achievement3;
formDetail.achievement4 = data.achievement4;
formDetail.achievement5 = data.achievement5;
formDetail.weight = data.weight;
formDetail.formula = data.formula;
formDetail.meaning = data.meaning;
formDetail.documentInfoEvidence = data.documentInfoEvidence;
if (data.startDate && data.endDate) {
formDetail.date = [];
formDetail.date[0] = data.startDate;
formDetail.date[1] = data.endDate;
}
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
function clickList(id: string, isData: boolean = false) { function clickList(id: string, isData: boolean = false) {
showLoader(); showLoader();
const url = numpage.value === 1 ? config.API.kpiPlan : config.API.kpiRole; const url =
numpage.value === 1
? config.API.kpiPlan
: numpage.value === 2
? config.API.kpiRole
: config.API.kpiSpecial;
http http
.get(`${url}/${id}`) .get(`${url}/${id}`)
.then((res) => { .then((res) => {
@ -276,7 +344,7 @@ function closeDialog() {
} }
function onSubmit() { function onSubmit() {
if (!listCheckID.value) { if (!listCheckID.value && numpage.value !== 3) {
dialogMessageNotify($q, "กรุณาเลือกตัวชี้วัด"); dialogMessageNotify($q, "กรุณาเลือกตัวชี้วัด");
} else { } else {
dialogConfirm($q, async () => { dialogConfirm($q, async () => {
@ -299,6 +367,15 @@ function onSubmit() {
documentInfoEvidence: formDetail.documentInfoEvidence, documentInfoEvidence: formDetail.documentInfoEvidence,
startDate: formDetail.date ? formDetail.date[0] : undefined, startDate: formDetail.date ? formDetail.date[0] : undefined,
endDate: formDetail.date ? formDetail.date[1] : undefined, endDate: formDetail.date ? formDetail.date[1] : undefined,
including: numpage.value === 3 ? formDetail.including : undefined,
includingName:
numpage.value === 3 ? formDetail.includingName : undefined,
period:
numpage.value === 3 ? store.dataEvaluation.durationKPI : undefined,
year:
numpage.value === 3
? store.dataEvaluation.year.toString()
: undefined,
}; };
try { try {
const urlPlanned = isStatusEdit.value const urlPlanned = isStatusEdit.value
@ -309,7 +386,16 @@ function onSubmit() {
? config.API.kpiAchievement("role") + `/${kpiUserPlannedId.value}` ? config.API.kpiAchievement("role") + `/${kpiUserPlannedId.value}`
: config.API.kpiAchievement("role"); : config.API.kpiAchievement("role");
const url = numpage.value === 1 ? urlPlanned : urlRole; const urlSpecial = isStatusEdit.value
? config.API.kpiAchievement("special") + `/${kpiUserPlannedId.value}`
: config.API.kpiAchievement("special");
const url =
numpage.value === 1
? urlPlanned
: numpage.value === 2
? urlRole
: urlSpecial;
const method = isStatusEdit.value ? "put" : "post"; const method = isStatusEdit.value ? "put" : "post";
await http[method](url, formBody); await http[method](url, formBody);
closeDialog(); closeDialog();
@ -323,52 +409,66 @@ function onSubmit() {
} }
} }
function fetchNewListIndicators() { function fetchNewList() {
formFilter.page = 1; formFilter.page = 1;
numpage.value === 1 ? fetchIndicators() : fetchListRole(); numpage.value === 1
? fetchListPlan()
: numpage.value === 2
? fetchListRole()
: fetchListSpecial();
} }
watch( watch(
() => modal.value, () => modal.value,
() => { () => {
if (modal.value) { if (modal.value) {
if (numpage.value === 1) { if (numpage.value === 1) {
fetchIndicators(); fetchListPlan();
isStatusEdit.value && fetchIndicatorsByid(kpiUserPlannedId.value); isStatusEdit.value && fetchListPlanByid(kpiUserPlannedId.value);
} else if (numpage.value === 2) { } else if (numpage.value === 2) {
fetchListRole(); fetchListRole();
isStatusEdit.value && fetchRoleByid(kpiUserPlannedId.value); isStatusEdit.value && fetchRoleByid(kpiUserPlannedId.value);
} else if (numpage.value === 3) {
fetchListSpecial();
isStatusEdit.value && fetchspecialByid(kpiUserPlannedId.value);
} }
} }
} }
); );
const title = computed(() => {
let name = "";
if (numpage.value === 1) {
name = isStatusEdit.value
? "แก้ไขตัวชี้วัดตามแผนปฏิบัติราชการประจําปี"
: "เพิ่มตัวชี้วัดตามแผนปฏิบัติราชการประจําปี";
} else if (numpage.value === 2) {
name = isStatusEdit.value
? "แก้ไขตัวชี้วัดตามหน้าที่ความรับผิดชอบ"
: "เพิ่มตัวชี้วัดตามหน้าที่ความรับผิดชอบ";
} else if (numpage.value === 3) {
name = isStatusEdit.value
? "แก้ไขตัวชี้วัดที่ได้รับมอบหมาย"
: "เพิ่มตัวชี้วัดที่ได้รับมอบหมาย";
}
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%">
<q-form greedy @submit.prevent @validation-success="onSubmit"> <q-form greedy @submit.prevent @validation-success="onSubmit">
<DialogHeader <DialogHeader :tittle="title" :close="closeDialog" />
:tittle="
numpage == 1
? isStatusEdit
? 'แก้ไขตัวชี้วัดตามแผนปฏิบัติราชการประจําปี'
: 'เพิ่มตัวชี้วัดตามแผนปฏิบัติราชการประจําปี'
: isStatusEdit
? 'แก้ไขตัวชี้วัดตามหน้าที่ความรับผิดชอบ'
: 'เพิ่มตัวชี้วัดตามหน้าที่ความรับผิดชอบ'
"
:close="closeDialog"
/>
<q-separator /> <q-separator />
<q-card-section class="q-pa-none scroll" style="max-height: 75vh"> <q-card-section class="q-pa-none scroll" style="max-height: 75vh">
<div class="col-12 row"> <div class="col-12 row">
<div class="bg-grey-1 q-pa-md col-3 row lineRight"> <div class="bg-grey-1 q-pa-md col-3 row lineRight">
<div class="col-12 fit"> <div class="col-12 fit">
<div class="row col-12"> <div class="row col-12" v-if="numpage !== 3">
<q-checkbox <q-checkbox
v-model="formFilter.isAll" v-model="formFilter.isAll"
label="แสดงตัวชี้วัดภายใต้หน่วยงาน/ส่วนราชการทุกระดับ" label="แสดงตัวชี้วัดภายใต้หน่วยงาน/ส่วนราชการทุกระดับ"
@update:model-value="fetchNewListIndicators()" @update:model-value="fetchNewList()"
/> />
</div> </div>
<div class="row q-col-gutter-sm col-12"> <div class="row q-col-gutter-sm col-12">
@ -380,7 +480,7 @@ watch(
autoApply autoApply
year-picker year-picker
:enableTimePicker="false" :enableTimePicker="false"
@update:model-value="fetchNewListIndicators()" @update:model-value="fetchNewList()"
> >
<template #year="{ year }">{{ year + 543 }}</template> <template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{ <template #year-overlay-value="{ value }">{{
@ -411,8 +511,7 @@ watch(
name="cancel" name="cancel"
class="cursor-pointer" class="cursor-pointer"
@click.stop.prevent=" @click.stop.prevent="
(formFilter.year = null), (formFilter.year = null), fetchNewList()
fetchNewListIndicators()
" "
/> />
</template> </template>
@ -433,7 +532,7 @@ watch(
input-class="text-red" input-class="text-red"
label="รอบการประเมิน" label="รอบการประเมิน"
clearable clearable
@update:model-value="fetchNewListIndicators()" @update:model-value="fetchNewList()"
/> />
</div> </div>
</div> </div>
@ -444,7 +543,7 @@ watch(
outlined outlined
dense dense
label="ค้นหา" label="ค้นหา"
@keydown.enter.prevent="fetchNewListIndicators()" @keydown.enter.prevent="fetchNewList()"
> >
<template v-slot:append> <template v-slot:append>
<q-icon v-if="formFilter.keyword == ''" name="search" /> <q-icon v-if="formFilter.keyword == ''" name="search" />
@ -452,9 +551,7 @@ watch(
v-if="formFilter.keyword !== ''" v-if="formFilter.keyword !== ''"
name="clear" name="clear"
class="cursor-pointer" class="cursor-pointer"
@click=" @click="(formFilter.keyword = ''), fetchNewList()"
(formFilter.keyword = ''), fetchNewListIndicators()
"
/> />
</template> </template>
</q-input> </q-input>
@ -507,7 +604,11 @@ watch(
direction-links direction-links
:max-pages="5" :max-pages="5"
@update:model-value=" @update:model-value="
numpage === 1 ? fetchIndicators() : fetchListRole() numpage === 1
? fetchListPlan()
: numpage === 2
? fetchListRole()
: fetchListSpecial()
" "
></q-pagination> ></q-pagination>
</div> </div>
@ -526,7 +627,7 @@ watch(
<div class="col-6"> <div class="col-6">
<q-card bordered class="full-height q-pa-sm"> <q-card bordered class="full-height q-pa-sm">
<div class="q-pa-sm q-col-gutter-lg"> <div class="q-pa-sm q-col-gutter-lg">
<div class="col-12 row"> <div class="col-12 row" v-if="numpage !== 3">
<div class="col-4 text-grey-6">หนวยงาน/วนราชการ</div> <div class="col-4 text-grey-6">หนวยงาน/วนราชการ</div>
<div class="col-8">{{ formDetail.nodeName }}</div> <div class="col-8">{{ formDetail.nodeName }}</div>
</div> </div>
@ -537,11 +638,43 @@ watch(
<div class="col-12 row"> <div class="col-12 row">
<div class="col-4 text-grey-6">ลำด/รหสตวช</div> <div class="col-4 text-grey-6">ลำด/รหสตวช</div>
<div class="col-8">{{ formDetail.including }}</div> <div class="col-8">
<q-input
v-if="numpage === 3"
outlined
v-model="formDetail.including"
bg-color="white"
dense
class="inputgreen"
:rules="[
(val) =>
!!val || `${'กรุณากรอกลำดับ/รหัสตัวชี้วัด'}`,
]"
lazy-rules
hide-bottom-space
/>
<div v-else>{{ formDetail.including }}</div>
</div>
</div> </div>
<div class="col-12 row"> <div class="col-12 row">
<div class="col-4 text-grey-6">อตวช</div> <div class="col-4 text-grey-6">อตวช</div>
<div class="col-8">{{ formDetail.includingName }}</div> <div class="col-8">
<q-input
v-if="numpage === 3"
outlined
v-model="formDetail.includingName"
bg-color="white"
dense
class="inputgreen"
:rules="[
(val) => !!val || `${'กรุณากรอกชื่อตัวชี้วัด'}`,
]"
lazy-rules
hide-bottom-space
/>
<div v-else>{{ formDetail.includingName }}</div>
</div>
</div> </div>
<div class="col-12 row"> <div class="col-12 row">
<div class="col-4 text-grey-6">าเปาหมาย</div> <div class="col-4 text-grey-6">าเปาหมาย</div>

View file

@ -123,11 +123,11 @@ const modalEvaluate = ref<boolean>(false);
function onAdd(edit: boolean = false, id: string = "") { function onAdd(edit: boolean = false, id: string = "") {
isStatusEdit.value = edit; isStatusEdit.value = edit;
kpiUserPlannedId.value = id; kpiUserPlannedId.value = id;
if (numpage.value !== 3) { // if (numpage.value !== 3) {
modal.value = true; modal.value = true;
} else if (numpage.value == 3) { // } else if (numpage.value == 3) {
modalAssigned.value = true; // modalAssigned.value = true;
} // }
} }
function onEvaluate() { function onEvaluate() {
@ -166,23 +166,23 @@ watch(
} }
); );
watch( // watch(
() => modalAssigned.value, // () => modalAssigned.value,
() => { // () => {
if (!modalAssigned.value) { // if (!modalAssigned.value) {
props.fetchList?.(); // props.fetchList?.();
} // }
} // }
); // );
watch( // watch(
() => modalEvaluate.value, // () => modalEvaluate.value,
() => { // () => {
if (!modalEvaluate.value) { // if (!modalEvaluate.value) {
props.fetchList?.(); // props.fetchList?.();
} // }
} // }
); // );
</script> </script>
<template> <template>
<q-card bordered style="border-radius: 5px" class="no-shadow"> <q-card bordered style="border-radius: 5px" class="no-shadow">
@ -338,18 +338,19 @@ watch(
:isStatusEdit="isStatusEdit" :isStatusEdit="isStatusEdit"
:kpiUserPlannedId="kpiUserPlannedId" :kpiUserPlannedId="kpiUserPlannedId"
/> />
<Dialog03
<!-- <Dialog03
v-model:modal="modalAssigned" v-model:modal="modalAssigned"
:numpage="numpage" :numpage="numpage"
:isStatusEdit="isStatusEdit" :isStatusEdit="isStatusEdit"
:kpiUserPlannedId="kpiUserPlannedId" :kpiUserPlannedId="kpiUserPlannedId"
/> /> -->
<DialogEvaluate <!-- <DialogEvaluate
v-model:modal="modalEvaluate" v-model:modal="modalEvaluate"
:data="rows" :data="rows"
:numpage="numpage" :numpage="numpage"
/> /> -->
</template> </template>
<style scoped> <style scoped>
.custom-table2 { .custom-table2 {

View file

@ -70,6 +70,7 @@ function fetchEvaluation() {
.get(config.API.kpiEvaluation + `/${id.value}`) .get(config.API.kpiEvaluation + `/${id.value}`)
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
store.dataEvaluation = data; store.dataEvaluation = 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);
@ -94,6 +95,7 @@ function getProfile() {
.get(config.API.profilePosition()) .get(config.API.profilePosition())
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
store.dataProfile = data; store.dataProfile = data;
store.checkCompetency(); store.checkCompetency();
store.checkCompetencyDefaultCompetencyLevel(); store.checkCompetencyDefaultCompetencyLevel();
@ -282,7 +284,7 @@ async function clearScore() {
async function getAll() { async function getAll() {
await fetchEvaluation(); await fetchEvaluation();
await (store.dataProfile === null ? getProfile() : ""); await getProfile(); // await (store.dataProfile === null ? getProfile() : "");
await getOrgOp(); await getOrgOp();
} }