Merge branch 'develop' into devTee

This commit is contained in:
setthawutttty 2025-01-21 14:49:21 +07:00
commit bfec6530a6
3 changed files with 244 additions and 60 deletions

View file

@ -775,7 +775,7 @@ async function getAssign() {
...dataPerson,
name: `${dataPerson.name} (${dataPerson.position}${
dataPerson.positionLevel && dataPerson.positionType
? ", " + dataPerson.positionType + " : " + dataPerson.positionLevel
? dataPerson.positionLevel
: ""
})`,
}));
@ -1009,7 +1009,7 @@ function updateAppointMent() {
...dataPerson,
name: `${dataPerson.name} (${dataPerson.position}${
dataPerson.positionLevel && dataPerson.positionType
? ", " + dataPerson.positionType + " : " + dataPerson.positionLevel
? + dataPerson.positionLevel
: ""
})`,
}));
@ -1035,7 +1035,7 @@ function updateAppointMent() {
label: dataPerson.position
? `${dataPerson.name} (${dataPerson.position}${
dataPerson.positionLevel && dataPerson.positionType
? ", " + dataPerson.positionType + " : " + dataPerson.positionLevel
? +dataPerson.positionLevel
: ""
})`
: dataPerson.name,

View file

@ -63,63 +63,93 @@ const optionsResult = ref<any>([
},
]);
const props = defineProps({
tab: { type: String, require: true },
data: { type: Object, require: true },
});
/** get
* @param id personal id
*/
async function fecthAssign(id: string) {
showLoader();
await http
.get(config.API.evaluateReportcreate(id))
.then((res) => {
assign.value = res.data.result.assign;
person.value = res.data.result.person;
mentors.value = res.data.result.mentors;
date_start.value = res.data.result.assign.date_start;
date_finish.value = res.data.result.assign.date_finish;
async function fecthAssign() {
const data = props.data;
if (
res.data.result.result.develop_complete != null &&
res.data.result.result.evaluate_result != null
) {
develop.value = res.data.result.result.develop_complete;
result.value = res.data.result.result.evaluate_result;
changeReson52(Number(res.data.result.result.evaluate_result));
}
assign.value = data?.assign;
person.value = data?.person;
mentors.value = data?.mentors;
date_start.value = data?.assign.date_start;
date_finish.value = data?.assign.date_finish;
if (
data?.result.develop_complete != null &&
data?.result.evaluate_result != null
) {
develop.value = data.result.develop_complete;
result.value = data.result.evaluate_result;
changeReson52(Number(data.result.evaluate_result));
}
director_id.value = data?.chairman;
director_id2.value = data?.commander;
if (mentors.value.length != 0) {
director_id3.value = mentors.value[0];
}
commander.value = data?.commander;
optionDirector.value = mentors.value;
director_id.value = res.data.result.chairman;
director_id2.value = res.data.result.commander;
if (mentors.value.length != 0) {
director_id3.value = mentors.value[0];
}
commander.value = res.data.result.commander;
optionDirector.value = mentors.value;
})
.catch((e) => {
// messageError($q, e);
})
.finally(() => {
hideLoader();
});
// showLoader();
// await http
// .get(config.API.evaluateReportcreate(id))
// .then((res) => {
// assign.value = res.data.result.assign;
// person.value = res.data.result.person;
// mentors.value = res.data.result.mentors;
// date_start.value = res.data.result.assign.date_start;
// date_finish.value = res.data.result.assign.date_finish;
// if (
// res.data.result.result.develop_complete != null &&
// res.data.result.result.evaluate_result != null
// ) {
// develop.value = res.data.result.result.develop_complete;
// result.value = res.data.result.result.evaluate_result;
// changeReson52(Number(res.data.result.result.evaluate_result));
// }
// director_id.value = res.data.result.chairman;
// director_id2.value = res.data.result.commander;
// if (mentors.value.length != 0) {
// director_id3.value = mentors.value[0];
// }
// commander.value = res.data.result.commander;
// optionDirector.value = mentors.value;
// })
// .catch((e) => {
// // messageError($q, e);
// })
// .finally(() => {
// hideLoader();
// });
}
/** get
* @param id personal id
*/
const fecthResult = async (id: string) => {
const noNumber = props?.tab ? Number(props?.tab.charAt(4)) : "";
await http
.get(config.API.createformReport(id))
.get(config.API.createformReport(id) + `&evaluate_no=${noNumber}`)
.then(async (res: any) => {
if (res.data.result != null) {
const data = await res.data.result.evaluate;
ID.value = data.id;
date_start.value = data.date_start;
date_finish.value = data.date_finish;
develop.value = await Number(data.develop_complete);
result.value = await Number(data.pass_result);
reson.value = await data.reson;
chairman_dated.value = await data.chairman_dated;
director1_dated.value = await data.director1_dated;
director2_dated.value = await data.director2_dated;
develop.value = Number(data.develop_complete);
result.value = Number(data.pass_result);
reson.value = data.reson;
chairman_dated.value = data.chairman_dated;
director1_dated.value = data.director1_dated;
director2_dated.value = data.director2_dated;
status.value = false;
action.value = "edit";
expand_month.value = data.expand_month;
@ -188,7 +218,8 @@ async function postData(action: string) {
chairman_dated: chairman_dated.value,
director1_dated: director1_dated.value,
director2_dated: director2_dated.value,
expand_month: expand_month.value,
expand_month: expand_month.value ? expand_month.value : undefined,
evaluate_no: props?.tab ? Number(props?.tab.charAt(4)) : undefined,
};
if (action === "post") {
showLoader();
@ -255,7 +286,7 @@ function changeReson52(val: number) {
}
onMounted(() => {
fecthAssign(assignId.value);
fecthAssign();
fecthResult(assignId.value);
});
</script>
@ -264,7 +295,7 @@ onMounted(() => {
<div class="row col-12">
<div class="toptitle text-dark col-12 row items-center q-gutter-md">
<div>แบบรายงานการประเมนฯ</div>
<q-btn
<!-- <q-btn
v-if="!status"
size="12px"
flat
@ -289,7 +320,7 @@ onMounted(() => {
</q-item>
</q-list>
</q-menu>
</q-btn>
</q-btn> -->
</div>
<div class="col-12 row">
@ -317,7 +348,9 @@ onMounted(() => {
<div class="col-12 text-top0 row items-center">
<q-icon name="mdi-label" color="grey-4" class="q-pr-sm" />
ประเมนผล
<span class="text-primary q-pr-sm"> ครงท 1 </span>
<span class="text-primary q-pr-sm">
ครงท {{ props?.tab ? props?.tab.charAt(4) : "" }}</span
>
</div>
<div class="col-12 text-top0 row items-center">
@ -326,7 +359,7 @@ onMounted(() => {
</div>
</div>
<q-form ref="myForm">
<q-form ref="myForm" class="col-12">
<div class="row col-12">
<div class="col-12 row q-col-gutter-md">
<div class="col-xs-12 col-sm-6">
@ -507,6 +540,11 @@ onMounted(() => {
label="จำนวนเดือน"
:rules="[(val:string) => !!val || 'กรุณากรอกจำนวนเดือน']"
type="number"
:readonly="
!status ||
checkRoutePermisson ||
probationStore.dataPermissions?.tab6.isEdit == false
"
/>
</div>
</div>
@ -621,11 +659,8 @@ onMounted(() => {
</div>
</div>
<div class="col-12 row q-mt-xs">
<div class="col-12 text-top2 row items-center">
คณะกรรมการ
<!-- ความเหนของผอำนาจสงบรรจตามมาตรา 52 -->
</div>
<!-- <div class="col-12 row q-mt-xs">
<div class="col-12 text-top2 row items-center">คณะกรรมการ</div>
<div class="col-12 row q-col-gutter-md">
<q-select
class="col-xs-12 col-sm-8"
@ -685,12 +720,11 @@ onMounted(() => {
</datepicker>
</div>
</div>
</div>
</div> -->
<div class="col-12 row q-mt-xs">
<!-- <div class="col-12 row q-mt-xs">
<div class="col-12 text-top2 row items-center">
คณะกรรมการ
<!-- อำนาจสงบรรจตามมาตรา 52 -->
</div>
<div class="col-12 row q-col-gutter-md">
@ -753,7 +787,7 @@ onMounted(() => {
</datepicker>
</div>
</div>
</div>
</div> -->
</div>
</q-form>

View file

@ -1,16 +1,166 @@
<script setup lang="ts">
import { ref, defineAsyncComponent } from "vue";
import { ref, defineAsyncComponent, onMounted } from "vue";
import { useQuasar } from "quasar";
import { useRoute, useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
import genReport from "@/plugins/genreport";
const Header = defineAsyncComponent(
() =>
import(
"@/modules/05_placement/components/probation/FormEvaluation/Header.vue"
)
);
const FormReport = defineAsyncComponent(
() =>
import(
"@/modules/05_placement/components/probation/FormEvaluation/FormReport.vue"
)
);
import { useProbationDataStore } from "@/modules/05_placement/storeProbation";
const $q = useQuasar();
const router = useRouter();
const route = useRoute();
const probationStore = useProbationDataStore();
const {
date2Thai,
messageError,
success,
showLoader,
hideLoader,
dialogConfirm,
dialogMessageNotify,
} = useCounterMixin();
const tab = ref<string>("save1");
const tabs = ref<any[]>([{ no: 1 }, { no: 2 }]);
const dataArrayNumber = ref<number>(1);
const evaluate = ref<any>([]);
const assignId = ref<string>(route.params.form.toString());
const personalId = ref<string>(route.params.personalId.toString());
const isLoad = ref<boolean>(false);
const fullName = ref<string>("");
const dataResult = ref<any>();
/**
* @param id assignId
*/
async function fecthAssign(id: string) {
isLoad.value = false;
showLoader();
await http
.get(config.API.evaluateReportcreate(id))
.then((res) => {
dataResult.value = res.data.result;
fullName.value = res.data.result.person.name;
console.log();
tabs.value = res.data.result.result.map((e: any, index: number) => {
return { no: index + 1, ...e };
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
isLoad.value = true;
});
}
/**
* download file
* @param type type
*/
async function onDownloadFile(type: string) {
const noNumber = tab.value ? Number(tab.value.charAt(4)) : "";
showLoader();
await http
.get(config.API.reportEvaluateResult(type, assignId.value) + `/${noNumber}`)
.then(async (res) => {
const data = res.data.result;
await genReport(
data,
`แบบรายงานการประเมินฯ${fullName.value}.${type}`,
type
);
})
.catch(async (e) => {
messageError($q, JSON.parse(await e.response.data.text()));
})
.finally(() => {
hideLoader();
});
}
const changeTab = (tabVal: string) => {
tab.value = tabVal;
dataArrayNumber.value = Number(tabVal.charAt(4));
};
/** ไปหน้า page add */
function addData() {
tabs.value.push({ no: 2 });
}
onMounted(() => {
fecthAssign(assignId.value);
});
</script>
<template>
<div class="col-12 q-ma-sm">
<Header
v-if="tabs.length > 0"
:change-tab="changeTab"
:add-data="addData"
:loop="tabs.length"
:FileDownload="onDownloadFile"
:checkPermission="
probationStore?.dataPermissions?.tab6?.isEdit && tabs.length === 1
"
/>
<q-tab-panels
v-model="tab"
animated
swipeable
vertical
transition-prev="jump-up"
transition-next="jump-up"
v-if="tabs.length > 0"
class="mt"
>
<q-tab-panel v-for="item in tabs" :name="`save${item.no}`" :key="item.no">
<FormReport :tab="tab" :data="dataResult" action="edit" v-if="isLoad" />
</q-tab-panel>
</q-tab-panels>
<!-- <div class="q-gutter-md" v-if="tabs.length === 0">
<div class="flex justify-center items-center q-my-md q-gutter-md">
<q-btn
v-if="!checkRoutePermisson"
outline
color="primary"
label="สร้างแบบประเมิน"
@click="addData"
:disable="probationStore.dataPermissions?.tab5.isEdit == false"
/>
</div>
</div> -->
<!-- <div class="col-12 q-ma-sm">
<FormReport />
</div>
</div> -->
</template>
<style lang="scss" scoped>
.mt {
margin-top: 25px;
}
</style>