ปรับ form ทดลองงาน

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-08-30 16:43:46 +07:00
parent 328dd6e1a3
commit 8e10d6dee9
8 changed files with 632 additions and 485 deletions

View file

@ -2,6 +2,7 @@
import { ref, onMounted, watch } from "vue"; import { ref, onMounted, watch } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useProbationDataStore } from "@/modules/05_placement/store"; import { useProbationDataStore } from "@/modules/05_placement/store";
import { useAssignDataStore } from "@/modules/05_placement/storeAssign";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useRouter, useRoute } from "vue-router"; import { useRouter, useRoute } from "vue-router";
import http from "@/plugins/http"; import http from "@/plugins/http";
@ -26,12 +27,10 @@ const {
} = mixin; } = mixin;
const route = useRoute(); const route = useRoute();
const assignId = ref<string>(route.params.form.toString()); const assignId = ref<string>(route.params.form.toString());
const assignStore = useAssignDataStore();
const { assign } = assignStore;
const personalId = ref<string>(route.params.personalId.toString()); const personalId = ref<string>(route.params.personalId.toString());
const saveEdit = (id: string) => {
dialogConfirm($q, () => console.log("save"));
};
const edit = () => { const edit = () => {
status.value = true; status.value = true;
}; };
@ -41,7 +40,6 @@ const cancel = () => {
}; };
const person = ref<any>([]); const person = ref<any>([]);
const assign = ref<any>([]);
const evaluate_no = ref<number>(); const evaluate_no = ref<number>();
const evaluate_id = ref<string>(""); const evaluate_id = ref<string>("");
const start_date = ref<Date>(new Date()); const start_date = ref<Date>(new Date());
@ -106,7 +104,8 @@ onMounted(async () => {
if (props.tab && props.action == "edit") { if (props.tab && props.action == "edit") {
evaluate_no.value = Number(props.tab.charAt(4)); evaluate_no.value = Number(props.tab.charAt(4));
dataArr.value = await props.data; dataArr.value = await props.data;
fecthAssign(); // fecthAssign();
fetchEvaluate();
} }
}); });
@ -114,80 +113,90 @@ watch(props, async () => {
if (props.tab && props.action == "edit") { if (props.tab && props.action == "edit") {
evaluate_no.value = Number(props.tab.charAt(4)); evaluate_no.value = Number(props.tab.charAt(4));
dataArr.value = await props.data; dataArr.value = await props.data;
fecthAssign(); // fecthAssign();
fetchEvaluate();
} }
}); });
const fecthAssign = async () => { // const fecthAssign = async () => {
showLoader(); // showLoader();
await http // await http
.get(config.API.evaluateCreate(assignId.value)) // .get(config.API.evaluateCreate(assignId.value))
.then(async (res: any) => { // .then(async (res: any) => {
if (props.action == "add") { // console.log(res);
person.value = res.data.data.person;
assign.value = res.data.data.assign;
commander.value = res.data.data.commander;
option.value.push(commander.value);
Autherise.value = commander.value.name; // if (props.action == "add") {
evaluate_no.value = res.data.data.evaluate_no; // person.value = res.data.data.person;
start_date.value = res.data.data.start_date; // // assign.value = res.data.data.assign;
date_finish.value = res.data.data.end_date; // commander.value = res.data.data.commander;
} // option.value.push(commander.value);
}) // Autherise.value = commander.value.name;
.catch((e) => { // evaluate_no.value = res.data.data.evaluate_no;
messageError($q, e); // start_date.value = res.data.data.start_date;
}) // date_finish.value = res.data.data.end_date;
.finally(() => { // }
if (props.action == "edit") { // })
fetchEvaluate(); // .catch((e) => {
} // messageError($q, e);
hideLoader(); // })
}); // .finally(() => {
}; // if (props.action == "edit") {
// fetchEvaluate();
// }
// hideLoader();
// });
// };
const fetchEvaluate = async () => { const fetchEvaluate = async () => {
let data = await dataArr.value; // showLoader();
evaluate_id.value = data.id; try {
start_date.value = data.date_start; let data = await dataArr.value;
date_finish.value = data.date_finish; evaluate_id.value = data.id;
knowledge_level.value = data.knowledge_level; start_date.value = data.date_start;
skill_level.value = data.skill_level; date_finish.value = data.date_finish;
competency_level.value = data.competency_level; knowledge_level.value = data.knowledge_level;
learn_level.value = data.learn_level; skill_level.value = data.skill_level;
apply_level.value = data.apply_level; competency_level.value = data.competency_level;
success_level.value = data.success_level; learn_level.value = data.learn_level;
achievement_other.value.text = data.achievement_other_desc; apply_level.value = data.apply_level;
achievement_other.value.level = data.achievement_other_level; success_level.value = data.success_level;
conduct_level.value[0] = data.conduct1_level; achievement_other.value.text = data.achievement_other_desc;
conduct_level.value[1] = data.conduct2_level; achievement_other.value.level = data.achievement_other_level;
conduct_level.value[2] = data.conduct3_level; conduct_level.value[0] = data.conduct1_level;
conduct_level.value[3] = data.conduct4_level; conduct_level.value[1] = data.conduct2_level;
moral_level.value[0] = data.moral1_level; conduct_level.value[2] = data.conduct3_level;
moral_level.value[1] = data.moral2_level; conduct_level.value[3] = data.conduct4_level;
moral_level.value[2] = data.moral3_level; moral_level.value[0] = data.moral1_level;
discipline_level.value[0] = data.discipline1_level; moral_level.value[1] = data.moral2_level;
discipline_level.value[1] = data.discipline2_level; moral_level.value[2] = data.moral3_level;
discipline_level.value[2] = data.discipline3_level; discipline_level.value[0] = data.discipline1_level;
discipline_level.value[3] = data.discipline4_level; discipline_level.value[1] = data.discipline2_level;
discipline_level.value[4] = data.discipline5_level; discipline_level.value[2] = data.discipline3_level;
behavio_orther.value.text = data.behavior_other_desc; discipline_level.value[3] = data.discipline4_level;
behavio_orther.value.level = data.behavior_other_level; discipline_level.value[4] = data.discipline5_level;
behavio_strength_desc.value = data.behavior_strength_desc; behavio_orther.value.text = data.behavior_other_desc;
behavior_improve_desc.value = data.behavior_improve_desc; behavio_orther.value.level = data.behavior_other_level;
orientation.value = data.orientation.toString(); behavio_strength_desc.value = data.behavior_strength_desc;
self_learning.value = data.self_learning.toString(); behavior_improve_desc.value = data.behavior_improve_desc;
training_seminar.value = data.training_seminar.toString(); orientation.value = data.orientation.toString();
other_training.value = data.other_training.toString(); self_learning.value = data.self_learning.toString();
if ( training_seminar.value = data.training_seminar.toString();
data.achievement_other_desc !== "" && other_training.value = data.other_training.toString();
data.achievement_other_level !== null if (
) { data.achievement_other_desc !== "" &&
etc.value = true; data.achievement_other_level !== null
} else etc.value = false; ) {
if (data.behavior_other_desc !== "" && data.behavior_other_level !== null) { etc.value = true;
etc2.value = true; } else etc.value = false;
} else etc2.value = false; if (data.behavior_other_desc !== "" && data.behavior_other_level !== null) {
status.value = false; etc2.value = true;
} else etc2.value = false;
status.value = false;
// setTimeout(() => {
// hideLoader();
// }, 1000);
} catch (error) {
hideLoader();
}
}; };
const Autherise = ref<any>(null); const Autherise = ref<any>(null);
@ -366,7 +375,9 @@ const save = () => {
</div> </div>
<div class="col-12 text-top0 row items-center"> <div class="col-12 text-top0 row items-center">
<q-icon name="mdi-label" color="grey-4" class="q-pr-sm" /> <q-icon name="mdi-label" color="grey-4" class="q-pr-sm" />
<span class="text-primary q-pr-sm">{{ "ครั้งที่ " + evaluate_no }}</span> <span class="text-primary q-pr-sm">{{
"ครั้งที่ " + evaluate_no
}}</span>
ระหวางวนท ระหวางวนท
<span class="text-black q-px-sm">{{ date2Thai(start_date) }}</span> <span class="text-black q-px-sm">{{ date2Thai(start_date) }}</span>
งวนท งวนท
@ -549,7 +560,8 @@ const save = () => {
<q-item-section> <q-item-section>
<q-item-label> <q-item-label>
<q-icon name="mdi-label" color="grey-4" class="q-pr-sm" /> <q-icon name="mdi-label" color="grey-4" class="q-pr-sm" />
1.5. ความสามารถในการปรบใชความรบงานในหนาท</q-item-label 1.5.
ความสามารถในการปรบใชความรบงานในหนาท</q-item-label
> >
</q-item-section> </q-item-section>
<q-item-section side> <q-item-section side>
@ -636,7 +648,8 @@ const save = () => {
dense dense
v-model="etc" v-model="etc"
@click=" @click="
(achievement_other.text = ''), (achievement_other.level = 0) (achievement_other.text = ''),
(achievement_other.level = 0)
" "
/></q-item-label> /></q-item-label>
</q-item-section> </q-item-section>
@ -644,7 +657,10 @@ const save = () => {
</q-list> </q-list>
</q-card> </q-card>
<q-card v-if="etc" class="text-top0 col-xs-12 col-sm-11 q-pa-xs q-pl-lg"> <q-card
v-if="etc"
class="text-top0 col-xs-12 col-sm-11 q-pa-xs q-pl-lg"
>
<q-list dense> <q-list dense>
<q-item dense tag="label" v-ripple> <q-item dense tag="label" v-ripple>
<q-item-section class="q-ml-md"> <q-item-section class="q-ml-md">
@ -1146,12 +1162,7 @@ const save = () => {
<!-- <Footer /> --> <!-- <Footer /> -->
<q-toolbar class="text-primary" v-if="routeName == 'FormEvaluateAdd'"> <q-toolbar class="text-primary" v-if="routeName == 'FormEvaluateAdd'">
<q-space /> <q-space />
<q-btn <q-btn label="บันทึก" color="secondary" @click="savaForm" />
label="บันทึก"
color="secondary"
@click="savaForm"
/>
</q-toolbar> </q-toolbar>
</div> </div>
</div> </div>

View file

@ -2,6 +2,7 @@
import { ref, watch, computed, onMounted } from "vue"; import { ref, watch, computed, onMounted } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useProbationDataStore } from "@/modules/05_placement/store"; import { useProbationDataStore } from "@/modules/05_placement/store";
import { useAssignDataStore } from "@/modules/05_placement/storeAssign";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useRouter, useRoute } from "vue-router"; import { useRouter, useRoute } from "vue-router";
import http from "@/plugins/http"; import http from "@/plugins/http";
@ -12,6 +13,8 @@ const routeName = router.currentRoute.value.name;
const $q = useQuasar(); const $q = useQuasar();
const probationStore = useProbationDataStore(); const probationStore = useProbationDataStore();
const { ratingColors } = probationStore; const { ratingColors } = probationStore;
const assignStore = useAssignDataStore();
const { assign } = assignStore;
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { const {
date2Thai, date2Thai,
@ -35,8 +38,6 @@ const edit = () => {
const cancel = () => { const cancel = () => {
status.value = false; status.value = false;
}; };
// const person = ref<any>([]);
const assign = ref<any>([]);
const evaluate_no = ref<number>(); const evaluate_no = ref<number>();
const evaluate_id = ref<string>(""); const evaluate_id = ref<string>("");
const start_date = ref<Date>(new Date()); const start_date = ref<Date>(new Date());
@ -46,9 +47,6 @@ const chairman = ref<any>([]);
const commander = ref<any>([]); const commander = ref<any>([]);
const mentors = ref<any>([{ name: "" }, { name: "" }]); const mentors = ref<any>([{ name: "" }, { name: "" }]);
const dataArr = ref<any>(); const dataArr = ref<any>();
const round = ref<any>();
const props = defineProps({ const props = defineProps({
tab: String, tab: String,
data: Object, data: Object,
@ -59,7 +57,7 @@ onMounted(async () => {
if (props.tab && props.action == "edit") { if (props.tab && props.action == "edit") {
evaluate_no.value = Number(props.tab.charAt(4)); evaluate_no.value = Number(props.tab.charAt(4));
dataArr.value = await props.data; dataArr.value = await props.data;
fecthAssign(); await fetchEvaluate();
} }
}); });
@ -67,95 +65,90 @@ watch(props, async () => {
if (props.tab && props.action == "edit") { if (props.tab && props.action == "edit") {
evaluate_no.value = Number(props.tab.charAt(4)); evaluate_no.value = Number(props.tab.charAt(4));
dataArr.value = await props.data; dataArr.value = await props.data;
fecthAssign(); await fetchEvaluate();
} }
}); });
// const fecthAssign = async () => {
// showLoader();
const fecthAssign = async () => { // await http
showLoader(); // .get(config.API.evaluateChairman(assignId.value))
await http // .then(async (res: any) => {
.get(config.API.evaluateChairman(assignId.value)) // if (props.action == "add") {
.then(async (res: any) => { // assign.value = res.data.data.assign;
if (props.action == "add") { // evaluate_no.value = res.data.data.evaluate_no;
assign.value = res.data.data.assign; // start_date.value = res.data.data.start_date;
evaluate_no.value = res.data.data.evaluate_no; // date_finish.value = res.data.data.end_date;
start_date.value = res.data.data.start_date; // chairman.value = res.data.data.chairman;
date_finish.value = res.data.data.end_date; // commander.value = res.data.data.commander;
chairman.value = res.data.data.chairman; // mentors.value = res.data.data.mentors;
commander.value = res.data.data.commander; // }
mentors.value = res.data.data.mentors; // })
} // .catch((e) => {
}) // messageError($q, e);
.catch((e) => { // })
messageError($q, e); // .finally(() => {
}) // if (props.action == "edit") {
.finally(() => { // fetchEvaluate();
if (props.action == "edit") { // }
fetchEvaluate(); // hideLoader();
} // });
hideLoader(); // };
});
};
const fetchEvaluate = async () => { const fetchEvaluate = async () => {
showLoader(); // showLoader();
let data = await dataArr.value; try {
evaluate_id.value = data.id; let data = await dataArr.value;
evaluate_id.value = data.id;
start_date.value = data.date_start;
date_finish.value = data.date_finish;
learn_level.value = data.knowledge_level;
apply_level.value = data.apply_level;
success_level.value = data.success_level;
achievement_other.value.text = data.achievement_other_desc;
achievement_other.value.level = data.achievement_other_level;
conduct_level.value[0] = data.conduct1_level;
conduct_level.value[1] = data.conduct2_level;
conduct_level.value[2] = data.conduct3_level;
conduct_level.value[3] = data.conduct4_level;
moral_level.value[0] = data.moral1_level;
moral_level.value[1] = data.moral2_level;
moral_level.value[2] = data.moral3_level;
discipline_level.value[0] = data.discipline1_level;
discipline_level.value[1] = data.discipline2_level;
discipline_level.value[2] = data.discipline3_level;
discipline_level.value[3] = data.discipline4_level;
discipline_level.value[4] = data.discipline5_level;
behavio_orther.value.text = data.behavior_other_desc;
behavio_orther.value.level = data.behavior_other_level;
orientation.value = data.develop_orientation_score;
self_learning.value = data.develop_self_learning_score;
training_seminar.value = data.develop_training_seminar_score;
other_training.value = data.develop_other_training_score;
orientation_percent.value = data.develop_orientation_percent;
self_learning_percent.value = data.develop_self_learning_percent;
training_seminar_percent.value = data.develop_training_seminar_percent;
other_training_percent.value = data.develop_other_training_percent;
develop_result.value = data.develop_result;
evaluate_result.value = data.evaluate_result;
start_date.value = data.date_start; if (
date_finish.value = data.date_finish; data.achievement_other_desc !== "" &&
learn_level.value = data.knowledge_level; data.achievement_other_level !== null
apply_level.value = data.apply_level; ) {
success_level.value = data.success_level; etc.value = true;
achievement_other.value.text = data.achievement_other_desc; } else etc.value = false;
achievement_other.value.level = data.achievement_other_level; if (data.behavior_other_desc !== "" && data.behavior_other_level !== null) {
conduct_level.value[0] = data.conduct1_level; etc2.value = true;
conduct_level.value[1] = data.conduct2_level; } else etc2.value = false;
conduct_level.value[2] = data.conduct3_level;
conduct_level.value[3] = data.conduct4_level;
moral_level.value[0] = data.moral1_level;
moral_level.value[1] = data.moral2_level;
moral_level.value[2] = data.moral3_level;
discipline_level.value[0] = data.discipline1_level;
discipline_level.value[1] = data.discipline2_level;
discipline_level.value[2] = data.discipline3_level;
discipline_level.value[3] = data.discipline4_level;
discipline_level.value[4] = data.discipline5_level;
behavio_orther.value.text = data.behavior_other_desc;
behavio_orther.value.level = data.behavior_other_level;
orientation.value = data.develop_orientation_score;
self_learning.value = data.develop_self_learning_score;
training_seminar.value = data.develop_training_seminar_score;
other_training.value = data.develop_other_training_score;
orientation_percent.value = data.develop_orientation_percent;
self_learning_percent.value = data.develop_self_learning_percent;
training_seminar_percent.value = data.develop_training_seminar_percent;
other_training_percent.value = data.develop_other_training_percent;
develop_result.value = data.develop_result;
evaluate_result.value = data.evaluate_result;
if ( status.value = false;
data.achievement_other_desc !== "" && // setTimeout(() => {
data.achievement_other_level !== null // hideLoader();
) { // }, 1000);
etc.value = true; } catch (error) {
} else etc.value = false; // hideLoader();
if (data.behavior_other_desc !== "" && data.behavior_other_level !== null) { }
etc2.value = true;
} else etc2.value = false;
status.value = false;
// })
// .catch((e) => {
// if (e.data.message !== "Data not found!") {
// messageError($q, e);
// }
// })
// .finally(() => {
// hideLoader();
// });
}; };
const list2_1 = [ const list2_1 = [
@ -238,7 +231,6 @@ const develop_result_option = ref<any>([
{ name: "ไม่ผ่าน (ต่ำกว่าร้อยละ 60)", value: 0 }, { name: "ไม่ผ่าน (ต่ำกว่าร้อยละ 60)", value: 0 },
]); ]);
// footer // footer
const Autherise = ref<any>(null);
const dateAutherise = ref<any>(new Date()); const dateAutherise = ref<any>(new Date());
// const option = ref<any>([]); // const option = ref<any>([]);
@ -495,7 +487,9 @@ const putformData = () => {
</div> </div>
<div class="col-12 text-top0 row items-center"> <div class="col-12 text-top0 row items-center">
<q-icon name="mdi-label" color="grey-4" class="q-pr-sm" /> <q-icon name="mdi-label" color="grey-4" class="q-pr-sm" />
<span class="text-primary q-pr-sm">{{ "ครั้งที่ " + evaluate_no }}</span> <span class="text-primary q-pr-sm">{{
"ครั้งที่ " + evaluate_no
}}</span>
ระหวางวนท ระหวางวนท
<span class="text-black q-px-sm">{{ date2Thai(start_date) }}</span> <span class="text-black q-px-sm">{{ date2Thai(start_date) }}</span>
งวนท งวนท
@ -559,7 +553,8 @@ const putformData = () => {
<q-item-section> <q-item-section>
<q-item-label> <q-item-label>
<q-icon name="mdi-label" color="grey-4" class="q-pr-sm" /> <q-icon name="mdi-label" color="grey-4" class="q-pr-sm" />
1.2. ความสามารถในการปรบใชความรบงานในหนาท</q-item-label 1.2.
ความสามารถในการปรบใชความรบงานในหนาท</q-item-label
> >
</q-item-section> </q-item-section>
<q-item-section side> <q-item-section side>
@ -646,7 +641,8 @@ const putformData = () => {
:disable="!status" :disable="!status"
v-model="etc" v-model="etc"
@click=" @click="
(achievement_other.text = ''), (achievement_other.level = 0) (achievement_other.text = ''),
(achievement_other.level = 0)
" "
/></q-item-label> /></q-item-label>
</q-item-section> </q-item-section>
@ -654,7 +650,10 @@ const putformData = () => {
</q-list> </q-list>
</q-card> </q-card>
<q-card v-if="etc" class="text-top0 col-xs-12 col-sm-11 q-pa-xs q-pl-lg"> <q-card
v-if="etc"
class="text-top0 col-xs-12 col-sm-11 q-pa-xs q-pl-lg"
>
<q-list dense> <q-list dense>
<q-item dense tag="label" v-ripple> <q-item dense tag="label" v-ripple>
<q-item-section class="q-ml-md"> <q-item-section class="q-ml-md">
@ -707,7 +706,7 @@ const putformData = () => {
</q-card> </q-card>
<div class="text-top0 col-xs-12 col-sm-11 q-px-lg"> <div class="text-top0 col-xs-12 col-sm-11 q-px-lg">
<div class="row col-12 justify-between q-pa-sm "> <div class="row col-12 justify-between q-pa-sm">
<div class="text-black">คะแนนรวมผลสมฤทธของการทดลองฯ</div> <div class="text-black">คะแนนรวมผลสมฤทธของการทดลองฯ</div>
<div class="text-weight-bold text-black">{{ score1 }}</div> <div class="text-weight-bold text-black">{{ score1 }}</div>
</div> </div>
@ -932,10 +931,9 @@ const putformData = () => {
</q-item> </q-item>
</q-list> </q-list>
</q-card> </q-card>
</div> </div>
<div class="text-top0 col-xs-12 col-sm-11 q-pt-sm q-px-md q-my-none"> <div class="text-top0 col-xs-12 col-sm-11 q-pt-sm q-px-md q-my-none">
<div class="row col-12 justify-between q-py-sm "> <div class="row col-12 justify-between q-py-sm">
<div class="text-black">คะแนนรวมพฤตกรรมการปฎราชการ</div> <div class="text-black">คะแนนรวมพฤตกรรมการปฎราชการ</div>
<div class="text-weight-bold text-black">{{ score2 }}</div> <div class="text-weight-bold text-black">{{ score2 }}</div>
</div> </div>
@ -958,7 +956,8 @@ const putformData = () => {
<q-item-section> <q-item-section>
<q-item-label> <q-item-label>
<q-icon name="mdi-label" color="grey-4" class="q-pr-sm" /> <q-icon name="mdi-label" color="grey-4" class="q-pr-sm" />
3.1. ผลสมฤทธของการทดลองปฏหนาทราชการ</q-item-label 3.1.
ผลสมฤทธของการทดลองปฏหนาทราชการ</q-item-label
> >
</q-item-section> </q-item-section>
<q-item-section> <q-item-section>
@ -1061,7 +1060,7 @@ const putformData = () => {
flat flat
bordered bordered
class="col-xs-12 col-sm-11 col-md-11 q-pa-sm bg-grey-1" class="col-xs-12 col-sm-11 col-md-11 q-pa-sm bg-grey-1"
> >
<div class="col-xs-12 col-sm-11 col-md-11 q-my-sm"> <div class="col-xs-12 col-sm-11 col-md-11 q-my-sm">
<div class="row q-gutter-md q-pl-md"> <div class="row q-gutter-md q-pl-md">
<div class="col-8 text-weight-medium">วข</div> <div class="col-8 text-weight-medium">วข</div>
@ -1105,7 +1104,7 @@ const putformData = () => {
</div> </div>
<div class="col"> <div class="col">
<q-input <q-input
outlined outlined
dense dense
type="number" type="number"
:disable="!status" :disable="!status"
@ -1162,7 +1161,9 @@ const putformData = () => {
<q-separator class="q-my-xs" /> <q-separator class="q-my-xs" />
<div class="col-xs-12 col-sm-11 col-md-11 q-my-sm"> <div class="col-xs-12 col-sm-11 col-md-11 q-my-sm">
<div class="row q-gutter-md q-pl-sm"> <div class="row q-gutter-md q-pl-sm">
<div class="col-8 text-weight-medium"><q-item-label> ผลคะแนนรวม</q-item-label></div> <div class="col-8 text-weight-medium">
<q-item-label> ผลคะแนนรวม</q-item-label>
</div>
<div class="col q-pl-md">{{ score4 }}</div> <div class="col q-pl-md">{{ score4 }}</div>
<div class="col q-pl-md">{{ score5 }}</div> <div class="col q-pl-md">{{ score5 }}</div>
</div> </div>
@ -1271,7 +1272,7 @@ const putformData = () => {
</div> </div>
<div class="row col-12 q-gutter-lg no-margin justify-center"> <div class="row col-12 q-gutter-lg no-margin justify-center">
<div class=" col-xs-12 col-sm-11 row justify-center"> <div class="col-xs-12 col-sm-11 row justify-center">
<div class="col-12 text-top0 items-center"> <div class="col-12 text-top0 items-center">
<!-- <q-avatar class="bg-grey-2 q-mr-sm" size="28px">5</q-avatar> --> <!-- <q-avatar class="bg-grey-2 q-mr-sm" size="28px">5</q-avatar> -->
สรปผลการพฒนา สรปผลการพฒนา
@ -1321,167 +1322,169 @@ const putformData = () => {
<!-- Footer --> <!-- Footer -->
<!-- <Footer /> --> <!-- <Footer /> -->
<div class="row col-12 q-gutter-lg no-margin justify-center"> <div class="row col-12 q-gutter-lg no-margin justify-center">
<div class="col-xs-12 col-sm-11 "> <div class="col-xs-12 col-sm-11">
<div class="col-12 text-top2 row items-center">งคบบญชาผมอบหมายงาน</div> <div class="col-12 text-top2 row items-center">
งคบบญชาผมอบหมายงาน
</div>
<div class="col-12 row q-col-gutter-md"> <div class="col-12 row q-col-gutter-md">
<q-select <q-select
class="col-xs-12 col-sm-8" class="col-xs-12 col-sm-8"
dense dense
v-model="commander.name" v-model="commander.name"
outlined outlined
label="ผู้บังคับบัญชา" label="ผู้บังคับบัญชา"
disable disable
/> />
<div class="col-xs-12 col-sm-4"> <div class="col-xs-12 col-sm-4">
<datepicker <datepicker
menu-class-name="modalfix" menu-class-name="modalfix"
v-model="dateAutherise" v-model="dateAutherise"
:locale="'th'" :locale="'th'"
autoApply autoApply
borderless borderless
:readonly="!status" :readonly="!status"
:enableTimePicker="false" :enableTimePicker="false"
week-start="0" week-start="0"
> >
<template #year="{ year }"> <template #year="{ year }">
{{ year + 543 }} {{ year + 543 }}
</template> </template>
<template #year-overlay-value="{ value }"> <template #year-overlay-value="{ value }">
{{ parseInt(value + 543) }} {{ parseInt(value + 543) }}
</template> </template>
<template #trigger> <template #trigger>
<q-input <q-input
outlined outlined
dense dense
:disable="!status" :disable="!status"
hide-bottom-space hide-bottom-space
class="full-width datepicker col-3" class="full-width datepicker col-3"
:model-value=" :model-value="
dateAutherise != null ? date2Thai(dateAutherise) : null dateAutherise != null ? date2Thai(dateAutherise) : null
" "
:label="`${'ลงวันที่'}`" :label="`${'ลงวันที่'}`"
:rules="[(val) => !!val || `${'กรุณาเลือกลงวันที่'}`]" :rules="[(val) => !!val || `${'กรุณาเลือกลงวันที่'}`]"
> >
<template v-slot:prepend> <template v-slot:prepend>
<q-icon <q-icon
name="event" name="event"
class="cursor-pointer" class="cursor-pointer"
style="color: var(--q-primary)" style="color: var(--q-primary)"
> >
</q-icon> </q-icon>
</template> </template>
</q-input> </q-input>
</template> </template>
</datepicker> </datepicker>
</div> </div>
<q-select <q-select
class="col-xs-12 col-sm-8" class="col-xs-12 col-sm-8"
dense dense
v-model="mentors[0].name" v-model="mentors[0].name"
outlined outlined
label="ผู้บังคับบัญชา" label="ผู้บังคับบัญชา"
disable disable
/> />
<div class="col-xs-12 col-sm-4"> <div class="col-xs-12 col-sm-4">
<datepicker <datepicker
menu-class-name="modalfix" menu-class-name="modalfix"
v-model="dateAutherise" v-model="dateAutherise"
:locale="'th'" :locale="'th'"
autoApply autoApply
borderless borderless
:readonly="!status" :readonly="!status"
:enableTimePicker="false" :enableTimePicker="false"
week-start="0" week-start="0"
> >
<template #year="{ year }"> <template #year="{ year }">
{{ year + 543 }} {{ year + 543 }}
</template> </template>
<template #year-overlay-value="{ value }"> <template #year-overlay-value="{ value }">
{{ parseInt(value + 543) }} {{ parseInt(value + 543) }}
</template> </template>
<template #trigger> <template #trigger>
<q-input <q-input
outlined outlined
:disable="!status" :disable="!status"
dense dense
class="full-width datepicker col-3" class="full-width datepicker col-3"
hide-bottom-space hide-bottom-space
:model-value=" :model-value="
dateAutherise != null ? date2Thai(dateAutherise) : null dateAutherise != null ? date2Thai(dateAutherise) : null
" "
:label="`${'ลงวันที่'}`" :label="`${'ลงวันที่'}`"
:rules="[(val) => !!val || `${'กรุณาเลือกลงวันที่'}`]" :rules="[(val) => !!val || `${'กรุณาเลือกลงวันที่'}`]"
> >
<template v-slot:prepend> <template v-slot:prepend>
<q-icon <q-icon
name="event" name="event"
class="cursor-pointer" class="cursor-pointer"
style="color: var(--q-primary)" style="color: var(--q-primary)"
> >
</q-icon> </q-icon>
</template> </template>
</q-input> </q-input>
</template> </template>
</datepicker> </datepicker>
</div> </div>
<q-select <q-select
class="col-xs-12 col-sm-8" class="col-xs-12 col-sm-8"
dense dense
v-model="mentors[1].name" v-model="mentors[1].name"
outlined outlined
label="ผู้บังคับบัญชา" label="ผู้บังคับบัญชา"
disable disable
/> />
<div class="col-xs-12 col-sm-4"> <div class="col-xs-12 col-sm-4">
<datepicker <datepicker
menu-class-name="modalfix" menu-class-name="modalfix"
v-model="dateAutherise" v-model="dateAutherise"
:locale="'th'" :locale="'th'"
autoApply autoApply
borderless borderless
:readonly="!status" :readonly="!status"
:enableTimePicker="false" :enableTimePicker="false"
week-start="0" week-start="0"
> >
<template #year="{ year }"> <template #year="{ year }">
{{ year + 543 }} {{ year + 543 }}
</template> </template>
<template #year-overlay-value="{ value }"> <template #year-overlay-value="{ value }">
{{ parseInt(value + 543) }} {{ parseInt(value + 543) }}
</template> </template>
<template #trigger> <template #trigger>
<q-input <q-input
outlined outlined
dense dense
:disable="!status" :disable="!status"
class="full-width datepicker col-3" class="full-width datepicker col-3"
hide-bottom-space hide-bottom-space
:model-value=" :model-value="
dateAutherise != null ? date2Thai(dateAutherise) : null dateAutherise != null ? date2Thai(dateAutherise) : null
" "
:label="`${'ลงวันที่'}`" :label="`${'ลงวันที่'}`"
:rules="[(val) => !!val || `${'กรุณาเลือกลงวันที่'}`]" :rules="[(val) => !!val || `${'กรุณาเลือกลงวันที่'}`]"
> >
<template v-slot:prepend> <template v-slot:prepend>
<q-icon <q-icon
name="event" name="event"
class="cursor-pointer" class="cursor-pointer"
style="color: var(--q-primary)" style="color: var(--q-primary)"
> >
</q-icon> </q-icon>
</template> </template>
</q-input> </q-input>
</template> </template>
</datepicker> </datepicker>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="row col-12 q-gutter-lg no-margin justify-center"> <div class="row col-12 q-gutter-lg no-margin justify-center">
<div class="col-xs-12 col-sm-11"> <div class="col-xs-12 col-sm-11">
<div class="col-12 text-top2 row items-center">คณะกรรมการ</div> <div class="col-12 text-top2 row items-center">คณะกรรมการ</div>
<div class="col-12 row q-col-gutter-md"> <div class="col-12 row q-col-gutter-md">
<q-select <q-select
@ -1537,14 +1540,12 @@ const putformData = () => {
</div> </div>
</div> </div>
<q-toolbar class="text-primary" v-if="routeName == 'probationFormAddevaluascore'"> <q-toolbar
class="text-primary"
v-if="routeName == 'probationFormAddevaluascore'"
>
<q-space /> <q-space />
<q-btn <q-btn label="บันทึก" color="secondary" @click="savaForm" />
label="บันทึก"
color="secondary"
@click="savaForm"
/>
</q-toolbar> </q-toolbar>
</div> </div>
</div> </div>

View file

@ -2,9 +2,9 @@
import { ref, onMounted, watch } from "vue"; import { ref, onMounted, watch } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useProbationDataStore } from "@/modules/05_placement/store"; import { useProbationDataStore } from "@/modules/05_placement/store";
import { useCounterMixin } from "@/stores/mixin"; import { useAssignDataStore } from "@/modules/05_placement/storeAssign";
// import { formatDate } from "@fullcalendar/core"; import { useCounterMixin } from "@/stores/mixin";
import { useRouter, useRoute } from "vue-router"; import { useRouter, useRoute } from "vue-router";
import http from "@/plugins/http"; import http from "@/plugins/http";
@ -14,6 +14,9 @@ const routeName = router.currentRoute.value.name;
const $q = useQuasar(); const $q = useQuasar();
const route = useRoute(); const route = useRoute();
const probationStore = useProbationDataStore(); const probationStore = useProbationDataStore();
const assignStore = useAssignDataStore();
const { fecthAssignoutput, assign } = assignStore;
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { const {
date2Thai, date2Thai,
@ -29,8 +32,6 @@ const { ratingColors } = probationStore;
const assignId = ref<string>(route.params.form.toString()); const assignId = ref<string>(route.params.form.toString());
const personalId = ref<string>(route.params.personalId.toString()); const personalId = ref<string>(route.params.personalId.toString());
const person = ref<any>([]);
const assign = ref<any>([]);
const start_date = ref<Date>(new Date()); const start_date = ref<Date>(new Date());
const date_finish = ref<Date>(new Date()); const date_finish = ref<Date>(new Date());
const status = ref<boolean>(false); const status = ref<boolean>(false);
@ -54,13 +55,9 @@ const props = defineProps({
}); });
onMounted(async () => { onMounted(async () => {
// if (props.action == 'add') {
// fecthFormdata();
// }
if (props.tab && props.action == "edit") { if (props.tab && props.action == "edit") {
evaluate_no.value = Number(props.tab.charAt(4)); evaluate_no.value = Number(props.tab.charAt(4));
dataArr.value = await props.data; dataArr.value = await props.data;
fecthFormdata(); fecthFormdata();
} }
}); });
@ -69,7 +66,7 @@ watch(props, async () => {
if (props.tab && props.action == "edit") { if (props.tab && props.action == "edit") {
evaluate_no.value = Number(props.tab.charAt(4)); evaluate_no.value = Number(props.tab.charAt(4));
dataArr.value = await props.data; dataArr.value = await props.data;
fecthFormdata(); fectFormfull();
} }
}); });
@ -77,46 +74,55 @@ const fecthFormdata = async () => {
await http await http
.get(config.API.formevaluateRecord(assignId.value)) .get(config.API.formevaluateRecord(assignId.value))
.then(async (res: any) => { .then(async (res: any) => {
if (props.action == "add") { await fecthAssignoutput(res.data.data);
evaluate_no.value = res.data.data.evaluate_no; await fectFormfull();
start_date.value = res.data.data.start_date; // if (props.action == "add") {
date_finish.value = res.data.data.end_date; // evaluate_no.value = res.data.data.evaluate_no;
// start_date.value = res.data.data.start_date;
person.value = res.data.data.person; // date_finish.value = res.data.data.end_date;
option.value.push(res.data.data.director); // person.value = res.data.data.person;
} // option.value.push(res.data.data.director);
Autherise.value = res.data.data.director.name;
list1_1.value = res.data.data.assign_output;
evaluate_expenct_level.value = await res.data.data.assign_output.map(
(e: any) => ({
id: e.id,
labal: e.output_desc,
})
);
evaluate_ouptut.value = await res.data.data.assign_output.map(
(e: any) => ({
id: e.id,
})
);
checkArray.value = list1_1.value.length;
// if (res.data.data.evaluate_no > round.value) {
// await fecthFormRound(assignId.value, round.value);
// } // }
// Autherise.value = res.data.data.director.name;
// list1_1.value = res.data.data.assign_output;
// evaluate_expenct_level.value = await res.data.data.assign_output.map(
// (e: any) => ({
// id: e.id,
// labal: e.output_desc,
// })
// );
// evaluate_ouptut.value = await res.data.data.assign_output.map(
// (e: any) => ({
// id: e.id,
// })
// );
// checkArray.value = list1_1.value.length;
}) })
.catch((e: any) => { .catch((e: any) => {})
})
.finally(() => { .finally(() => {
if (props.action == "edit") { if (props.action == "edit") {
fecthFormRound(); fecthFormRound();
} }
}); });
}; };
const fectFormfull = async () => {
Autherise.value = assignStore.director.name;
list1_1.value = assignStore.assignOutput;
evaluate_expenct_level.value = await assignStore.assignOutput.map(
(e: any) => ({
id: e.id,
labal: e.output_desc,
})
);
evaluate_ouptut.value = await assignStore.assignOutput.map((e: any) => ({
id: e.id,
}));
checkArray.value = list1_1.value.length;
fecthFormRound();
};
const fecthFormRound = async () => { const fecthFormRound = async () => {
showLoader(); // showLoader();
try { try {
let data = await dataArr.value; let data = await dataArr.value;
evaluate_id.value = data.id; evaluate_id.value = data.id;
@ -160,7 +166,6 @@ const fecthFormRound = async () => {
if (data.behavior_other_desc !== "" && data.behavior_other_level !== null) { if (data.behavior_other_desc !== "" && data.behavior_other_level !== null) {
etc2.value = true; etc2.value = true;
} else etc2.value = false; } else etc2.value = false;
if (data.achievements) { if (data.achievements) {
await data.achievements.map((e: any, index: number) => { await data.achievements.map((e: any, index: number) => {
evaluate_expenct_level.value[index].level = e.evaluate_expect_level; evaluate_expenct_level.value[index].level = e.evaluate_expect_level;
@ -170,21 +175,15 @@ const fecthFormRound = async () => {
} }
status.value = false; status.value = false;
setTimeout(() => { // setTimeout(() => {
hideLoader(); // hideLoader();
}, 1000); // }, 1000);
} catch (error) { } catch (error) {
hideLoader(); hideLoader();
} }
}; };
const list1_1 = ref<any>([]); const list1_1 = ref<any>([]);
// { id: "1", label: " 1" },
// { id: "2", label: " 2" },
// { id: "3", label: " 3" },
// { id: "4", label: " 4" },
// { id: "5", label: " 5" },
const list1_2 = [ const list1_2 = [
{ id: "", label: "" }, { id: "", label: "" },
{ id: "", label: "" }, { id: "", label: "" },
@ -244,10 +243,6 @@ const list2_3 = [
]; ];
const option = ref<any>([]); const option = ref<any>([]);
const dateToday = ref<Date>(new Date("10-10-2023"));
const dateEnd = ref<Date>(new Date("12-10-2023"));
const period = ref<number>(1);
// part 1 // part 1
const evaluate_expenct_level = ref<any>([ const evaluate_expenct_level = ref<any>([
{ id: "1", label: "ผลผลิตของงานที่คาดหวัง 1", level: 0 }, { id: "1", label: "ผลผลิตของงานที่คาดหวัง 1", level: 0 },
@ -268,11 +263,8 @@ const skill_level = ref<number>(0);
const competency_level = ref<number>(0); const competency_level = ref<number>(0);
const learn_level = ref<number>(0); const learn_level = ref<number>(0);
const apply_level = ref<number>(0); const apply_level = ref<number>(0);
const success_level = ref<number>(0);
const etc = ref<any>(false); // checkBox 1.8 const etc = ref<any>(false); // checkBox 1.8
const achievement_other = ref<any>({ text: "", level: 0 }); const achievement_other = ref<any>({ text: "", level: 0 });
// const etc_text = ref<string>("");
// const ext_value = ref<number>(0);
const achievement_strength_desc = ref<string>(""); const achievement_strength_desc = ref<string>("");
const achievement_improve_desc = ref<string>(""); const achievement_improve_desc = ref<string>("");
// part 2 // part 2
@ -281,8 +273,6 @@ const moral_level = ref<any>([]);
const discipline_level = ref<any>([]); const discipline_level = ref<any>([]);
const etc2 = ref<any>(false); // checkBox 2.4 const etc2 = ref<any>(false); // checkBox 2.4
const behavio_orther = ref<any>({ text: "", level: 0 }); const behavio_orther = ref<any>({ text: "", level: 0 });
// const etc_text2 = ref<string>("");
// const ext_value2 = ref<number>(0);
const behavior_strength_desc = ref<string>(""); const behavior_strength_desc = ref<string>("");
const behavior_improve_desc = ref<string>(""); const behavior_improve_desc = ref<string>("");
// part 3 // part 3
@ -303,17 +293,11 @@ const achievement_strengthRules = [
(val: any) => (val && val.length > 0) || "กรุณากรอกข้อมูลจุดเด่น", (val: any) => (val && val.length > 0) || "กรุณากรอกข้อมูลจุดเด่น",
]; ];
const achievement_inproveRef = ref<any>(null); const achievement_inproveRef = ref<any>(null);
// const achievement_inproveRules = [
// (val: any) => (val && val.length > 0) || "",
// ];
const behavio_strengthRef = ref<any>(null); const behavio_strengthRef = ref<any>(null);
const behavio_strengthRules = [ const behavio_strengthRules = [
(val: any) => (val && val.length > 0) || "กรุณากรอกข้อมูลจุดเด่น", (val: any) => (val && val.length > 0) || "กรุณากรอกข้อมูลจุดเด่น",
]; ];
const behavio_inproveRef = ref<any>(null); const behavio_inproveRef = ref<any>(null);
// const behavio_inproveRules = [
// (val: any) => (val && val.length > 0) || "",
// ];
const savaForm = () => { const savaForm = () => {
achievement_strengthRef.value.validate(); achievement_strengthRef.value.validate();
@ -322,16 +306,7 @@ const savaForm = () => {
behavio_inproveRef.value.validate(); behavio_inproveRef.value.validate();
let hasError = false; let hasError = false;
// const filterlevel1_1 = evaluate_expenct_level.value.filter(
// (e: any) => e.level == 0
// );
// const filter_ouptut1_2 = evaluate_ouptut.value.filter(
// (e: any) => e.level == 0 || e.text == ""
// );
if ( if (
// filterlevel1_1.length != 0 ||
// filter_ouptut1_2.length != 0 ||
knowledge_level.value === 0 || knowledge_level.value === 0 ||
skill_level.value === 0 || skill_level.value === 0 ||
competency_level.value === 0 || competency_level.value === 0 ||
@ -492,7 +467,9 @@ const editData = async (data: any) => {
</div> </div>
<div class="col-12 text-top0 row items-center"> <div class="col-12 text-top0 row items-center">
<q-icon name="mdi-label" color="grey-4" class="q-pr-sm" /> <q-icon name="mdi-label" color="grey-4" class="q-pr-sm" />
<span class="text-primary q-pr-sm">{{ "ครั้งที่ " + evaluate_no }}</span> <span class="text-primary q-pr-sm">{{
"ครั้งที่ " + evaluate_no
}}</span>
ระหวางวนท ระหวางวนท
<span class="text-black q-px-sm">{{ date2Thai(start_date) }}</span> <span class="text-black q-px-sm">{{ date2Thai(start_date) }}</span>
งวนท งวนท
@ -785,7 +762,8 @@ const editData = async (data: any) => {
<q-item-section> <q-item-section>
<q-item-label> <q-item-label>
<q-icon name="mdi-label" color="grey-4" class="q-pr-sm" /> <q-icon name="mdi-label" color="grey-4" class="q-pr-sm" />
1.6. ความสามารถในการปรบใชความรบงานในหนาท</q-item-label 1.6.
ความสามารถในการปรบใชความรบงานในหนาท</q-item-label
> >
</q-item-section> </q-item-section>
<q-item-section side> <q-item-section side>
@ -870,7 +848,8 @@ const editData = async (data: any) => {
dense dense
v-model="etc" v-model="etc"
@click=" @click="
(achievement_other.text = ''), (achievement_other.level = 0) (achievement_other.text = ''),
(achievement_other.level = 0)
" "
:disable="!status" :disable="!status"
/></q-item-label> /></q-item-label>
@ -879,7 +858,10 @@ const editData = async (data: any) => {
</q-list> </q-list>
</q-card> </q-card>
<q-card v-if="etc" class="text-top0 col-xs-12 col-sm-11 q-pa-xs q-pl-lg"> <q-card
v-if="etc"
class="text-top0 col-xs-12 col-sm-11 q-pa-xs q-pl-lg"
>
<q-list dense> <q-list dense>
<q-item dense tag="label" v-ripple> <q-item dense tag="label" v-ripple>
<q-item-section class="q-ml-md"> <q-item-section class="q-ml-md">
@ -1424,13 +1406,12 @@ const editData = async (data: any) => {
</div> </div>
</div> </div>
</div> </div>
<q-toolbar class="text-primary" v-if="routeName == 'probationFormAddresult'"> <q-toolbar
class="text-primary"
v-if="routeName == 'probationFormAddresult'"
>
<q-space /> <q-space />
<q-btn <q-btn label="บันทึก" color="secondary" @click="savaForm" />
label="บันทึก"
color="secondary"
@click="savaForm"
/>
</q-toolbar> </q-toolbar>
</div> </div>
</div> </div>

View file

@ -1,13 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, watch, onMounted } from "vue"; import { ref, watch } from "vue";
import { useRoute, useRouter } from "vue-router";
const route = useRoute();
const tabHead = ref<string>("save1"); const tabHead = ref<string>("save1");
const props = defineProps({ const props = defineProps({
FileDownload:{ FileDownload: {
type:Function, type: Function,
default() { default() {
return "Default function"; return "Default function";
}, },
@ -28,23 +25,26 @@ const props = defineProps({
}, },
}, },
}); });
const downloadFile = (type:string) =>{ const downloadFile = (type: string) => {
props.FileDownload(type) props.FileDownload(type);
} };
watch(tabHead, () => { watch(tabHead, () => {
props.changeTab(tabHead.value); props.changeTab(tabHead.value);
}); });
const nextPage = () => { const nextPage = () => {
props.addData(); if (props.loop !== undefined) {
if (props.loop < 3) {
props.addData();
}
}
}; };
</script> </script>
<template> <template>
<q-header class="bg-grey-1"> <q-header class="bg-grey-1">
<div class="bg-grey-1"> <div class="bg-grey-1">
<!-- |{{ tabHead }}| -->
<div class="col-12 row q-gutter-x-md items-center"> <div class="col-12 row q-gutter-x-md items-center">
<q-tabs <q-tabs
dense dense
@ -53,9 +53,9 @@ const nextPage = () => {
indicator-color="grey-1" indicator-color="grey-1"
class="text-grey-7" class="text-grey-7"
> >
<q-tab v-for="(i,j) in loop" :name="`save${i}`" :key="j" > <q-tab v-for="(i, j) in loop" :name="`save${i}`" :key="j">
<div class="row col-12 items-center"> <div class="row col-12 items-center">
<div class="q-mr-sm">ครงท{{i}}</div> <div class="q-mr-sm">ครงท{{ i }}</div>
<q-btn <q-btn
size="12px" size="12px"
flat flat
@ -67,13 +67,21 @@ const nextPage = () => {
<q-tooltip>ดาวนโหลด</q-tooltip> <q-tooltip>ดาวนโหลด</q-tooltip>
<q-menu> <q-menu>
<q-list style="min-width: 150px"> <q-list style="min-width: 150px">
<q-item clickable v-close-popup @click="downloadFile('pdf')"> <q-item
clickable
v-close-popup
@click="downloadFile('pdf')"
>
<q-item-section avatar <q-item-section avatar
><q-icon color="red" name="mdi-file-pdf" ><q-icon color="red" name="mdi-file-pdf"
/></q-item-section> /></q-item-section>
<q-item-section>ไฟล .PDF</q-item-section> <q-item-section>ไฟล .PDF</q-item-section>
</q-item> </q-item>
<q-item clickable v-close-popup @click="downloadFile('docx')"> <q-item
clickable
v-close-popup
@click="downloadFile('docx')"
>
<q-item-section avatar <q-item-section avatar
><q-icon color="blue" name="mdi-file-word" ><q-icon color="blue" name="mdi-file-word"
/></q-item-section> /></q-item-section>

View file

@ -3,6 +3,7 @@ import { ref, defineAsyncComponent, watch, onMounted, onUpdated } from "vue";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from "vue-router";
import { useAssignDataStore } from "@/modules/05_placement/storeAssign";
const Header = defineAsyncComponent( const Header = defineAsyncComponent(
() => () =>
import( import(
@ -18,31 +19,28 @@ const FormSaveResult = defineAsyncComponent(
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
const router = useRouter(); const router = useRouter();
const route = useRoute(); const route = useRoute();
const $q = useQuasar(); const $q = useQuasar();
const assignStore = useAssignDataStore();
const { fecthdataAssign } = assignStore;
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { showLoader, hideLoader, messageError, success } = mixin; const { showLoader, hideLoader, messageError } = mixin;
const assignId = ref<string>(route.params.form.toString()); const assignId = ref<string>(route.params.form.toString());
const personalId = ref<string>(route.params.personalId.toString()); const personalId = ref<string>(route.params.personalId.toString());
const fullname = ref<string>(""); const fullname = ref<string>("");
const evaluate = ref<any>([]);
const tabs = ref<any>([]);
const tab = ref<string>("save1"); const tab = ref<string>("save1");
const dataArrayNumber = ref<number>(); const dataArrayNumber = ref<number>();
const dataRole = ref<string>("mentor"); const dataRole = ref<string>("mentor");
onMounted(async () => { onMounted(async () => {
await fecthAssign(assignId.value); await fecthAssign(assignId.value);
}); });
const fecthAssign = async (id: string) => { const fecthAssign = async (id: string) => {
showLoader(); showLoader();
await http await http
.get(config.API.formevaluate(id)) .get(config.API.formevaluate(id))
.then(async (res: any) => { .then(async (res: any) => {
evaluate.value = res.data.data.evaluate; await fecthdataAssign(res.data.data);
tabs.value = evaluate.value;
fullname.value = res.data.data.person.name; fullname.value = res.data.data.person.name;
dataArrayNumber.value = 1; dataArrayNumber.value = 1;
}) })
@ -53,7 +51,6 @@ const fecthAssign = async (id: string) => {
hideLoader(); hideLoader();
}); });
}; };
const changeTab = (tabVal: string) => { const changeTab = (tabVal: string) => {
tab.value = tabVal; tab.value = tabVal;
dataArrayNumber.value = Number(tabVal.charAt(4)); dataArrayNumber.value = Number(tabVal.charAt(4));
@ -67,9 +64,10 @@ const downloadFile = (response: any, filename: string) => {
link.click(); link.click();
document.body.removeChild(link); document.body.removeChild(link);
}; };
const FileDownload = async (type: string) => { const FileDownload = async (type: string) => {
let numTab = evaluate.value.find((e: any) => e.no === dataArrayNumber.value); let numTab = assignStore.evaluate.find(
(e: any) => e.no === dataArrayNumber.value
);
// //
if (dataRole.value == "mentor") { if (dataRole.value == "mentor") {
showLoader(); showLoader();
@ -119,20 +117,44 @@ const addData = () => {
<template> <template>
<Header <Header
v-if="tabs.length > 0" v-if="assignStore.tabs.length > 0"
:change-tab="changeTab" :change-tab="changeTab"
:add-data="addData" :add-data="addData"
:loop="tabs.length" :loop="assignStore.tabs.length"
:FileDownload="FileDownload" :FileDownload="FileDownload"
/> />
<q-page-container v-if="tabs.length > 0"> <q-tab-panels
<FormSaveResult v-model="tab"
:tab="tab" animated
:data="evaluate.find((x: any) => x.no === dataArrayNumber)" swipeable
action="edit" vertical
/> transition-prev="jump-up"
</q-page-container> transition-next="jump-up"
<div class="q-gutter-md" v-else-if="tabs.length == 0"> v-if="assignStore.tabs.length > 0"
class="mt"
>
<q-tab-panel
v-for="item in assignStore.evaluate"
:name="`save${item.no}`"
:key="item.no"
>
<FormSaveResult
:tab="tab"
:data="assignStore.evaluate.find((x: any) => x.no === dataArrayNumber)"
action="edit"
/>
</q-tab-panel>
<!-- <q-page-container>
<FormSaveResult
:tab="tab"
:data="assignStore.evaluate.find((x: any) => x.no === dataArrayNumber)"
action="edit"
/>
</q-page-container> -->
</q-tab-panels>
<div class="q-gutter-md" v-else-if="assignStore.tabs.length == 0">
<div class="flex justify-center items-center q-my-md q-gutter-md"> <div class="flex justify-center items-center q-my-md q-gutter-md">
<q-btn <q-btn
outline outline
@ -140,7 +162,11 @@ const addData = () => {
label="สร้างแบบบันทึกผล" label="สร้างแบบบันทึกผล"
@click="addData" @click="addData"
/> />
</div> </div>
</div> </div>
</template> </template>
<style lang="scss" scoped>
.mt {
margin-top: 25px;
}
</style>

View file

@ -5,6 +5,7 @@ import config from "@/app.config";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useAssignDataStore } from "@/modules/05_placement/storeAssign";
const Header = defineAsyncComponent( const Header = defineAsyncComponent(
() => () =>
@ -23,10 +24,12 @@ const router = useRouter();
const route = useRoute(); const route = useRoute();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const $q = useQuasar(); const $q = useQuasar();
const { showLoader, hideLoader, messageError, success } = mixin; const { showLoader, hideLoader, messageError } = mixin;
const assignStore = useAssignDataStore();
const { fecthdataAssign } = assignStore;
const assignId = ref<string>(route.params.form.toString()); const assignId = ref<string>(route.params.form.toString());
const personalId = ref<string>(route.params.personalId.toString()); const personalId = ref<string>(route.params.personalId.toString());
const fullname = ref<string>("") const fullname = ref<string>("");
const tab = ref<string>("save1"); const tab = ref<string>("save1");
const tabs = ref<any>([]); const tabs = ref<any>([]);
const dataArrayNumber = ref<number>(1); const dataArrayNumber = ref<number>(1);
@ -45,10 +48,11 @@ const fecthAssign = async (id: string) => {
showLoader(); showLoader();
await http await http
.get(config.API.createformCommader(id)) .get(config.API.createformCommader(id))
.then((res: any) => { .then(async (res: any) => {
evaluate.value = res.data.data.evaluate; await fecthdataAssign(res.data.data);
fullname.value = res.data.data.person.name; evaluate.value = assignStore.evaluate;
tabs.value = evaluate.value; tabs.value = evaluate.value;
fullname.value = res.data.data.person.name;
dataArrayNumber.value = 1; dataArrayNumber.value = 1;
}) })
.catch((e: any) => { .catch((e: any) => {
@ -76,7 +80,10 @@ const FileDownload = async (type: string) => {
responseType: "blob", responseType: "blob",
}) })
.then(async (res) => { .then(async (res) => {
downloadFile(res, `แบบประเมินผล(ผู้บังคับบัญชา)_${fullname.value}_ครั้งที่${numTab.no}.${type}`); downloadFile(
res,
`แบบประเมินผล(ผู้บังคับบัญชา)_${fullname.value}_ครั้งที่${numTab.no}.${type}`
);
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
@ -101,13 +108,35 @@ const addData = () => {
:FileDownload="FileDownload" :FileDownload="FileDownload"
/> />
<q-page-container v-if="tabs.length > 0"> <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 assignStore.evaluate"
:name="`save${item.no}`"
:key="item.no"
>
<FormEvaluate
:tab="tab"
:data="assignStore.evaluate.find((x: any) => x.no === dataArrayNumber)"
action="edit"
/>
</q-tab-panel>
</q-tab-panels>
<!-- <q-page-container v-if="tabs.length > 0">
<FormEvaluate <FormEvaluate
:tab="tab" :tab="tab"
:data="evaluate.find((x: any) => x.no === dataArrayNumber)" :data="evaluate.find((x: any) => x.no === dataArrayNumber)"
action="edit" action="edit"
/> />
</q-page-container> </q-page-container> -->
<div v-else class="q-gutter-md"> <div v-else class="q-gutter-md">
<div class="flex justify-center items-center q-my-md q-gutter-md"> <div class="flex justify-center items-center q-my-md q-gutter-md">
@ -115,3 +144,8 @@ const addData = () => {
</div> </div>
</div> </div>
</template> </template>
<style lang="scss" scoped>
.mt {
margin-top: 25px;
}
</style>

View file

@ -5,9 +5,22 @@ import config from "@/app.config";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useAssignDataStore } from "@/modules/05_placement/storeAssign";
const assignStore = useAssignDataStore();
const { fecthdataAssign } = assignStore;
const Header = defineAsyncComponent(() => import("@/modules/05_placement/components/probation/FormEvaluation/Header.vue")); const Header = defineAsyncComponent(
const FormEvaluateScore = defineAsyncComponent(() => import("@/modules/05_placement/components/probation/FormEvaluation/FormEvaluateScore.vue")); () =>
import(
"@/modules/05_placement/components/probation/FormEvaluation/Header.vue"
)
);
const FormEvaluateScore = defineAsyncComponent(
() =>
import(
"@/modules/05_placement/components/probation/FormEvaluation/FormEvaluateScore.vue"
)
);
const router = useRouter(); const router = useRouter();
const route = useRoute(); const route = useRoute();
@ -17,7 +30,7 @@ const { showLoader, hideLoader, messageError, success } = mixin;
const assignId = ref<string>(route.params.form.toString()); const assignId = ref<string>(route.params.form.toString());
const personalId = ref<string>(route.params.personalId.toString()); const personalId = ref<string>(route.params.personalId.toString());
const fullname = ref<string>("") const fullname = ref<string>("");
const tab = ref<string>("save1"); const tab = ref<string>("save1");
const tabs = ref<any>([]); const tabs = ref<any>([]);
const dataArrayNumber = ref<number>(1); const dataArrayNumber = ref<number>(1);
@ -31,8 +44,9 @@ const fecthAssign = async (id: string) => {
showLoader(); showLoader();
await http await http
.get(config.API.createformChairman(id)) .get(config.API.createformChairman(id))
.then((res: any) => { .then(async (res: any) => {
evaluate.value = res.data.data.evaluate; await fecthdataAssign(res.data.data);
evaluate.value = assignStore.evaluate;
fullname.value = res.data.data.person.name; fullname.value = res.data.data.person.name;
tabs.value = evaluate.value; tabs.value = evaluate.value;
dataArrayNumber.value = 1; dataArrayNumber.value = 1;
@ -62,7 +76,10 @@ const FileDownload = async (type: string) => {
responseType: "blob", responseType: "blob",
}) })
.then(async (res) => { .then(async (res) => {
downloadFile(res, `แบบประเมินผล(คณะกรรมการ)_${fullname.value}_ครั้งที่${numTab.no}.${type}`); downloadFile(
res,
`แบบประเมินผล(คณะกรรมการ)_${fullname.value}_ครั้งที่${numTab.no}.${type}`
);
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
@ -84,11 +101,42 @@ const changeTab = (tabVal: string) => {
</script> </script>
<template> <template>
<Header v-if="tabs.length > 0" :change-tab="changeTab" :loop="tabs.length" :add-data="addData" :FileDownload="FileDownload"/> <Header
v-if="tabs.length > 0"
:change-tab="changeTab"
:loop="tabs.length"
:add-data="addData"
:FileDownload="FileDownload"
/>
<q-page-container v-if="tabs.length > 0"> <q-tab-panels
<FormEvaluateScore :tab="tab" :data="evaluate.find((x: any) => x.no === dataArrayNumber)" action="edit" /> v-model="tab"
</q-page-container> 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 assignStore.evaluate"
:name="`save${item.no}`"
:key="item.no"
>
<FormEvaluateScore
:tab="tab"
:data="evaluate.find((x: any) => x.no === dataArrayNumber)"
action="edit"
/>
</q-tab-panel>
</q-tab-panels>
<!-- <q-page-container v-if="tabs.length > 0">
<FormEvaluateScore
:tab="tab"
:data="evaluate.find((x: any) => x.no === dataArrayNumber)"
action="edit"
/>
</q-page-container> -->
<div class="q-gutter-md" v-if="tabs.length === 0"> <div class="q-gutter-md" v-if="tabs.length === 0">
<div class="flex justify-center items-center q-my-md q-gutter-md"> <div class="flex justify-center items-center q-my-md q-gutter-md">
@ -96,3 +144,9 @@ const changeTab = (tabVal: string) => {
</div> </div>
</div> </div>
</template> </template>
<style lang="scss" scoped>
.mt {
margin-top: 25px;
}
</style>

View file

@ -0,0 +1,32 @@
import { defineStore } from "pinia";
import { ref } from "vue";
export const useAssignDataStore = defineStore("assign", () => {
const assign = ref<any>([])
const evaluate = ref<any>([])
const tabs = ref<any>([]);
const assignOutput = ref<any>([])
const director = ref<any>([])
const fecthdataAssign = async (data: any) => {
assign.value = await data.assign
evaluate.value = await data.evaluate
tabs.value = await data.evaluate
}
const fecthAssignoutput = (data: any) => {
assignOutput.value = data.assign_output
director.value = data.director
}
return {
fecthdataAssign,
fecthAssignoutput,
assign,
evaluate,
tabs,
assignOutput,
director,
};
});