ปรับ โค้ด ทดลองงาน

This commit is contained in:
STW_TTTY\stwtt 2024-08-16 14:42:11 +07:00
parent 51707646e7
commit 46af20233f
16 changed files with 167 additions and 339 deletions

View file

@ -8,12 +8,12 @@ import http from "@/plugins/http";
import config from "@/app.config";
import criterion from "@/modules/05_placement/components/Other/Criterion.vue";
import type { ListDataText } from "@/modules/05_placement/interface/index/Main";
const router = useRouter();
const routeName = router.currentRoute.value.name;
const $q = useQuasar();
const probationStore = useProbationDataStore();
const { ratingColors } = probationStore;
const mixin = useCounterMixin();
const {
date2Thai,
@ -30,7 +30,6 @@ const route = useRoute();
const checkRoutePermisson = ref<boolean>(route.name == "probationFormDetail");
const assignId = ref<string>(route.params.form.toString());
const { assign } = probationStore;
const personalId = ref<string>(route.params.personalId.toString());
const Autherise = ref<any>(null);
const dateAutherise = ref<any>(new Date());
const option = ref<any>([]);

View file

@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, defineAsyncComponent, onMounted, watch, computed } from "vue";
import { ref, onMounted, watch, computed } from "vue";
import { useQuasar } from "quasar";
import { useProbationDataStore } from "@/modules/05_placement/storeProbation";
import { useCounterMixin } from "@/stores/mixin";
@ -11,11 +11,9 @@ import type { ListDataText } from "@/modules/05_placement/interface/index/Main";
const $q = useQuasar();
const probationStore = useProbationDataStore();
const { ratingColors } = probationStore;
const mixin = useCounterMixin();
const {
date2Thai,
notifyError,
messageError,
showLoader,
hideLoader,
@ -78,32 +76,6 @@ const list2_1 = probationStore.behavior_no1;
const list2_2 = probationStore.behavior_no2;
const list2_3 = probationStore.behavior_no3;
/**
* get ประเม
* @param id
*/
async function fecthAssign(id: string) {
showLoader();
await http
.get(config.API.evaluateCreate(id))
.then(async (res: any) => {
person.value = res.data.data.person;
assign.value = res.data.data.assign;
// option.value.push(res.data.data.commander);
Autherise.value = res.data.data.director;
evaluate_no.value = res.data.data.evaluate_no;
start_date.value = res.data.data.start_date;
date_finish.value = res.data.data.end_date;
round.value = res.data.data.evaluate_no;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
/** part 3 */
const alerts = Array(20)
.fill(null)
@ -128,9 +100,6 @@ const behavio_inproveRules = [
(val: any) => (val && val.length > 0) || "กรุณากรอกข้อมูลสิ่งที่ควรปรับปรุง",
];
const knowledge_level = ref<number>(0);
const knowledge_levelRules = [
(val: any) => (val && val.length > 0) || "กรุณากรอกข้อมูลสิ่งที่ควรปรับปรุง",
];
const ArrayCountbotton = [orientation, self_learning, training_seminar];
const variablesToWatch = [
knowledge_level,
@ -140,7 +109,8 @@ const variablesToWatch = [
apply_level,
success_level,
];
const savaForm = () => {
function savaForm(){
let hasError = false;
behavio_strengthRef.value.validate();
if (
@ -198,6 +168,31 @@ const savaForm = () => {
}
};
/**
* get ประเม
* @param id
*/
async function fecthAssign(id: string) {
showLoader();
await http
.get(config.API.evaluateCreate(id))
.then(async (res: any) => {
person.value = res.data.data.person;
assign.value = res.data.data.assign;
Autherise.value = res.data.data.director;
evaluate_no.value = res.data.data.evaluate_no;
start_date.value = res.data.data.start_date;
date_finish.value = res.data.data.end_date;
round.value = res.data.data.evaluate_no;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
/** ฟังชั่น post data*/
function putformData() {
const data = {

View file

@ -21,7 +21,6 @@ const router = useRouter();
const routeName = router.currentRoute.value.name;
const $q = useQuasar();
const probationStore = useProbationDataStore();
const { ratingColors } = probationStore;
const { assign } = probationStore;
const mixin = useCounterMixin();
const {
@ -45,9 +44,6 @@ const evaluate_id = ref<string>("");
const start_date = ref<Date>(new Date());
const date_finish = ref<Date>(new Date());
const status = ref<boolean>(true);
// const chairman = ref<any>([]);
// const commander = ref<any>([]);
// const mentors = ref<any>([{ name: "" }, { name: "" }]);
const dataArr = ref<any>();
const props = defineProps({
tab: String,
@ -98,105 +94,6 @@ const develop_result_option = ref<any>([
{ name: "ไม่ผ่าน (ต่ำกว่าร้อยละ 60)", value: 0 },
]);
/**set true */
function edit() {
status.value = true;
}
/** set false */
function cancel() {
status.value = false;
fecthAssign();
}
/** get ข้อมูล */
async function fecthAssign() {
showLoader();
await http
.get(config.API.evaluateChairman(assignId.value))
.then(async (res: any) => {
// if (props.action == "add") {
assign.value = res.data.data.assign;
evaluate_no.value = res.data.data.evaluate_no;
start_date.value = res.data.data.start_date;
date_finish.value = res.data.data.end_date;
// chairman.value = res.data.data.chairman;
// commander.value = res.data.data.commander;
// mentors.value = res.data.data.mentors;
// }
director_id.value = res.data.data.chairman;
director_id2.value = res.data.data.commander;
if (res.data.data.mentors.length != 0) {
director_id3.value = res.data.data.mentors[0];
}
// dateAutherise.value = res.data.data.chairman_dated;
// director1_dated.value = res.data.data.director1_dated;
// director2_dated.value = res.data.data.director2_dated;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
if (props.action == "edit") {
fetchEvaluate();
}
hideLoader();
});
}
/** เอาค่าจ่าก ดาต้า เก็บไว้ที่ตัวเเปร */
async function fetchEvaluate() {
try {
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;
dateAutherise.value = data.chairman_dated;
director1_dated.value = data.director1_dated;
director2_dated.value = data.director2_dated;
if (
data.achievement_other_desc !== "" &&
data.achievement_other_level !== null
) {
etc.value = true;
} else etc.value = false;
if (data.behavior_other_desc !== "" && data.behavior_other_level !== null) {
etc2.value = true;
} else etc2.value = false;
status.value = false;
} catch (error) {}
}
// score
const score1 = computed(() => {
if (
@ -304,6 +201,96 @@ const score5 = computed(() => {
);
});
/**set true */
function edit() {
status.value = true;
}
/** set false */
function cancel() {
status.value = false;
fecthAssign();
}
/** get ข้อมูล */
async function fecthAssign() {
showLoader();
await http
.get(config.API.evaluateChairman(assignId.value))
.then(async (res: any) => {
assign.value = res.data.data.assign;
evaluate_no.value = res.data.data.evaluate_no;
start_date.value = res.data.data.start_date;
date_finish.value = res.data.data.end_date;
director_id.value = res.data.data.chairman;
director_id2.value = res.data.data.commander;
if (res.data.data.mentors.length != 0) {
director_id3.value = res.data.data.mentors[0];
}
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
if (props.action == "edit") {
fetchEvaluate();
}
hideLoader();
});
}
/** เอาค่าจ่าก ดาต้า เก็บไว้ที่ตัวเเปร */
async function fetchEvaluate() {
try {
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;
dateAutherise.value = data.chairman_dated;
director1_dated.value = data.director1_dated;
director2_dated.value = data.director2_dated;
if (
data.achievement_other_desc !== "" &&
data.achievement_other_level !== null
) {
etc.value = true;
} else etc.value = false;
if (data.behavior_other_desc !== "" && data.behavior_other_level !== null) {
etc2.value = true;
} else etc2.value = false;
status.value = false;
} catch (error) {}
}
/** ฟังชั่นเช็คค่าไม่ว่าง */
function savaForm() {
let hasError = false;

View file

@ -1,4 +1,5 @@
<script setup lang="ts">
import { ref, defineAsyncComponent, computed, onMounted, watch } from "vue";
import { useQuasar, QForm } from "quasar";
import { useProbationDataStore } from "@/modules/05_placement/storeProbation";

View file

@ -42,7 +42,6 @@ const reson52 = ref<string>("");
const chairman_dated = ref<Date>();
const director1_dated = ref<any>("");
const director2_dated = ref<any>("");
// const fullname = ref<string>("");
const director_id = ref<any>(null);
const director_id2 = ref<any>(null);
const director_id3 = ref<any>(null);

View file

@ -352,7 +352,6 @@ onMounted(async () => {
if (props.tab && props.action == "edit") {
evaluate_no.value = Number(props.tab.charAt(4));
dataArr.value = await props.data;
console.log("🚀 ~ onMounted ~ props.data:", props.data);
fecthFormdata();
}
});

View file

@ -27,7 +27,6 @@ const {
dialogMessageNotify,
} = mixin;
const { ratingColors } = probationStore;
const assignId = ref<string>(route.params.form.toString());
const personalId = ref<string>(route.params.id.toString());
@ -46,12 +45,7 @@ const list2_3 = probationStore.behavior_no3;
const option = ref<any>([]);
const achievement_strengthRef = ref<any>(null);
const achievement_inproveRef = ref<any>(null);
const behavio_strengthRef = ref<any>(null);
const behavio_inproveRef = ref<any>(null);
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
const evaluate_expenct_level = ref<any>([]);

View file

@ -32,7 +32,7 @@ const {
hideLoader,
dialogConfirm,
} = mixin;
const { ratingColors } = probationStore;
const assignId = ref<string>(route.params.form.toString());
const personalId = ref<string>(route.params.personalId.toString());

View file

@ -30,7 +30,7 @@ const mixin = useCounterMixin();
const { showLoader, hideLoader, messageError } = mixin;
const assignId = ref<string>(route.params.form.toString());
const personalId = ref<string>(route.params.personalId.toString());
// const fullname = ref<string>("");
const tab = ref<string>("save1");
const dataArrayNumber = ref<number>();
const dataRole = ref<string>("mentor");
@ -44,9 +44,6 @@ async function fecthAssign(id: string) {
.get(config.API.formevaluate(id))
.then(async (res: any) => {
await fecthdataAssign(res.data.data);
// fullname.value = res.data.data.experimentee
// ? res.data.data.experimentee.name
// : "";
dataArrayNumber.value = 1;
})
.catch((e: any) => {

View file

@ -30,15 +30,10 @@ const mixin = useCounterMixin();
const { showLoader, hideLoader, messageError } = mixin;
const assignId = ref<string>(route.params.form.toString());
const personalId = ref<string>(route.params.personalId.toString());
// const fullname = ref<string>("");
const tab = ref<string>("save1");
const dataArrayNumber = ref<number>();
const dataRole = ref<string>("mentor");
onMounted(async () => {
await fecthAssign(assignId.value);
});
/**
* get data
* @param id person id
@ -135,6 +130,10 @@ function addData() {
`/probation/detail/addevaluacommander/${personalId.value}/${assignId.value}`
);
}
onMounted(async () => {
await fecthAssign(assignId.value);
});
</script>
<template>

View file

@ -30,7 +30,6 @@ const probationStore = useProbationDataStore();
const { fecthdataAssign } = probationStore;
const assignId = ref<string>(route.params.form.toString());
const personalId = ref<string>(route.params.personalId.toString());
// const fullname = ref<string>("");
const tab = ref<string>("save1");
const tabs = ref<any>([]);
const dataArrayNumber = ref<number>(1);
@ -45,10 +44,6 @@ function changeTab(tabVal: string) {
dataArrayNumber.value = Number(tabVal.charAt(4));
}
onMounted(() => {
fecthAssign(assignId.value);
});
/**
* get data
* @param id person id
@ -114,6 +109,10 @@ function addData() {
`/probation/detail/addevalua/${personalId.value}/${assignId.value}`
);
}
onMounted(() => {
fecthAssign(assignId.value);
});
</script>
<template>
@ -147,17 +146,16 @@ function addData() {
/>
</q-tab-panel>
</q-tab-panels>
<!-- <q-page-container v-if="tabs.length > 0">
<FormEvaluate
:tab="tab"
:data="evaluate.find((x: any) => x.no === dataArrayNumber)"
action="edit"
/>
</q-page-container> -->
<div v-else class="q-gutter-md">
<div class="flex justify-center items-center q-my-md q-gutter-md">
<q-btn v-if="!checkRoutePermisson" outline color="primary" label="สร้างแบบประเมิน" @click="addData" />
<q-btn
v-if="!checkRoutePermisson"
outline
color="primary"
label="สร้างแบบประเมิน"
@click="addData"
/>
</div>
</div>
</template>

View file

@ -131,13 +131,6 @@ const changeTab = (tabVal: string) => {
/>
</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="flex justify-center items-center q-my-md q-gutter-md">