diff --git a/src/modules/05_placement/components/probation/FormEvaluation/FormEvaluate.vue b/src/modules/05_placement/components/probation/FormEvaluation/FormEvaluate.vue index c9e40bc45..fad5971fd 100644 --- a/src/modules/05_placement/components/probation/FormEvaluation/FormEvaluate.vue +++ b/src/modules/05_placement/components/probation/FormEvaluation/FormEvaluate.vue @@ -82,11 +82,11 @@ const list2_3 = [ }, ]; onMounted(async () => { - fecthAssign(assignId.value); if (props.tab !== undefined) { round.value = props.tab.charAt(4); - fetchEvaluate(assignId.value, round.value); + // fetchEvaluate(assignId.value, round.value); } + fecthAssign(assignId.value); // console.log(round.value); // console.log(assignId.value); }); @@ -94,8 +94,7 @@ const fecthAssign = async (id: string) => { showLoader(); await http .get(config.API.evaluateCreate(id)) - .then((res: any) => { - // console.log(res); + .then(async (res: any) => { person.value = res.data.data.person; assign.value = res.data.data.assign; commander.value = res.data.data.commander; @@ -104,6 +103,11 @@ const fecthAssign = async (id: string) => { evaluate_no.value = res.data.data.evaluate_no; start_date.value = res.data.data.start_date; date_finish.value = res.data.data.end_date; + console.log(props.tab, res.data.data.evaluate_no); + + if (res.data.data.evaluate_no > round.value) { + await fetchEvaluate(assignId.value, round.value); + } }) .catch((e) => { messageError($q, e); @@ -113,11 +117,11 @@ const fecthAssign = async (id: string) => { }); }; const fetchEvaluate = async (id: string, round: string) => { - // showLoader(); + showLoader(); await http .get(config.API.evaluatecommader(id, round)) .then((res: any) => { - // console.log(res); + console.log(res); let data = res.data.data.evaluate; console.log(data); start_date.value = data.date_start; @@ -165,11 +169,14 @@ const fetchEvaluate = async (id: string, round: string) => { status.value = false; }) .catch((e) => { - messageError($q, e); console.log(e); + + if (e.data.message !== "Data not found!") { + messageError($q, e); + } }) .finally(() => { - // hideLoader(); + hideLoader(); }); }; diff --git a/src/modules/05_placement/components/probation/FormEvaluation/FormEvaluateAdd.vue b/src/modules/05_placement/components/probation/FormEvaluation/FormEvaluateAdd.vue new file mode 100644 index 000000000..ec8e93ca7 --- /dev/null +++ b/src/modules/05_placement/components/probation/FormEvaluation/FormEvaluateAdd.vue @@ -0,0 +1,1094 @@ + + + + + diff --git a/src/modules/05_placement/components/probation/FormEvaluation/FormEvaluateScore.vue b/src/modules/05_placement/components/probation/FormEvaluation/FormEvaluateScore.vue index f3bc20646..5e5fe6e53 100644 --- a/src/modules/05_placement/components/probation/FormEvaluation/FormEvaluateScore.vue +++ b/src/modules/05_placement/components/probation/FormEvaluation/FormEvaluateScore.vue @@ -39,20 +39,18 @@ const props = defineProps({ tab: String, }); onMounted(() => { - console.log(props); - console.log(assignId.value); - fecthAssign(assignId.value); if (props.tab !== undefined) { round.value = props.tab.charAt(4); - fetchEvaluate(assignId.value, round.value); + // fetchEvaluate(assignId.value, round.value); } + fecthAssign(assignId.value); }); const fecthAssign = async (id: string) => { showLoader(); await http .get(config.API.evaluateChairman(id)) - .then((res: any) => { - console.log(res); + .then(async (res: any) => { + // console.log(res); assign.value = res.data.data.assign; evaluate_no.value = res.data.data.evaluate_no; start_date.value = res.data.data.start_date; @@ -60,7 +58,10 @@ const fecthAssign = async (id: string) => { chairman.value = res.data.data.chairman; commander.value = res.data.data.commander; mentors.value = res.data.data.mentors; - console.log(mentors.value[0].name); + + if (res.data.data.evaluate_no > round.value) { + await fetchEvaluate(assignId.value, round.value); + } }) .catch((e) => { messageError($q, e); @@ -122,7 +123,9 @@ const fetchEvaluate = async (id: string, round: string) => { status.value = false; }) .catch((e) => { - console.log(e); + if (e.data.message !== "Data not found!") { + messageError($q, e); + } }) .finally(() => { hideLoader(); diff --git a/src/modules/05_placement/components/probation/FormEvaluation/FormEvaluateScoreAdd.vue b/src/modules/05_placement/components/probation/FormEvaluation/FormEvaluateScoreAdd.vue new file mode 100644 index 000000000..1273a3578 --- /dev/null +++ b/src/modules/05_placement/components/probation/FormEvaluation/FormEvaluateScoreAdd.vue @@ -0,0 +1,1462 @@ + + + + + diff --git a/src/modules/05_placement/components/probation/FormEvaluation/FormSaveResult.vue b/src/modules/05_placement/components/probation/FormEvaluation/FormSaveResult.vue index 65b2ce444..a3e1ed7b7 100644 --- a/src/modules/05_placement/components/probation/FormEvaluation/FormSaveResult.vue +++ b/src/modules/05_placement/components/probation/FormEvaluation/FormSaveResult.vue @@ -40,18 +40,19 @@ const props = defineProps({ }); onMounted(async () => { - console.log("tab===>",props.tab) + console.log("tab===>", props.tab); - await fecthFormdata(assignId.value); if (props.tab !== undefined) { round.value = props.tab.charAt(4); - await fecthFormRound(assignId.value, round.value); + + // await fecthFormRound(assignId.value, round.value); } + await fecthFormdata(assignId.value); }); const fecthFormdata = async (id: string) => { await http .get(config.API.formevaluateRecord(id)) - .then((res: any) => { + .then(async (res: any) => { console.log(res); evaluate_no.value = res.data.data.evaluate_no; start_date.value = res.data.data.start_date; @@ -70,6 +71,12 @@ const fecthFormdata = async (id: string) => { id: e.id, })); checkArray.value = list1_1.value.length; + + console.log(res.data.data.evaluate_no, round.value); + + if (res.data.data.evaluate_no > round.value) { + await fecthFormRound(assignId.value, round.value); + } }) .catch((e: any) => { console.log(e); @@ -1321,8 +1328,7 @@ const saveformdata = async (data: any) => { - - + diff --git a/src/modules/05_placement/components/probation/FormEvaluation/FormSaveResultAdd.vue b/src/modules/05_placement/components/probation/FormEvaluation/FormSaveResultAdd.vue index d665e8273..5dfe426c7 100644 --- a/src/modules/05_placement/components/probation/FormEvaluation/FormSaveResultAdd.vue +++ b/src/modules/05_placement/components/probation/FormEvaluation/FormSaveResultAdd.vue @@ -25,6 +25,8 @@ const start_date = ref(new Date()); const date_finish = ref(new Date()); const round = ref(); +const checkArray = ref(0); + onMounted(async () => { await fecthFormdata(assignId.value); }); @@ -42,19 +44,30 @@ const fecthFormdata = async (id: string) => { assign.value = res.data.data.assign; 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 = res.data.data.assign_output.map((e) => ({ + id: e.id, + labal: e.output_desc, + })); + evaluate_ouptut.value = res.data.data.assign_output.map((e) => ({ + id: e.id, + text: "", + })); + checkArray.value = list1_1.value.length; }) .catch((e: any) => { console.log(e); }); }; -const list1_1 = [ - { id: "1", label: "ผลผลิตของงานที่คาดหวัง 1" }, - { id: "2", label: "ผลผลิตของงานที่คาดหวัง 2" }, - { id: "3", label: "ผลผลิตของงานที่คาดหวัง 3" }, - { id: "4", label: "ผลผลิตของงานที่คาดหวัง 4" }, - { id: "5", label: "ผลผลิตของงานที่คาดหวัง 5" }, -]; +const list1_1 = ref([ + // { id: "1", label: "ผลผลิตของงานที่คาดหวัง 1" }, + // { id: "2", label: "ผลผลิตของงานที่คาดหวัง 2" }, + // { id: "3", label: "ผลผลิตของงานที่คาดหวัง 3" }, + // { id: "4", label: "ผลผลิตของงานที่คาดหวัง 4" }, + // { id: "5", label: "ผลผลิตของงานที่คาดหวัง 5" }, +]); const list1_2 = [ { id: "1", label: "ผลผลิตของงานที่เกิดขึ้น 1" }, { id: "2", label: "ผลผลิตของงานที่เกิดขึ้น 2" }, @@ -115,18 +128,18 @@ const period = ref(1); // part 1 const evaluate_expenct_level = ref([ - { id: "1", label: "ผลผลิตของงานที่คาดหวัง 1", level: 0 }, - { id: "2", label: "ผลผลิตของงานที่คาดหวัง 2", level: 0 }, - { id: "3", label: "ผลผลิตของงานที่คาดหวัง 3", level: 0 }, - { id: "4", label: "ผลผลิตของงานที่คาดหวัง 4", level: 0 }, - { id: "5", label: "ผลผลิตของงานที่คาดหวัง 5", level: 0 }, + // { id: "1", label: "ผลผลิตของงานที่คาดหวัง 1", level: 0 }, + // { id: "2", label: "ผลผลิตของงานที่คาดหวัง 2", level: 0 }, + // { id: "3", label: "ผลผลิตของงานที่คาดหวัง 3", level: 0 }, + // { id: "4", label: "ผลผลิตของงานที่คาดหวัง 4", level: 0 }, + // { id: "5", label: "ผลผลิตของงานที่คาดหวัง 5", level: 0 }, ]); const evaluate_ouptut = ref([ - { level: 0, text: "" }, - { level: 0, text: "" }, - { level: 0, text: "" }, - { level: 0, text: "" }, - { level: 0, text: "" }, + // { level: 0, text: "" }, + // { level: 0, text: "" }, + // { level: 0, text: "" }, + // { level: 0, text: "" }, + // { level: 0, text: "" }, ]); const knowledge_level = ref(0); const skill_level = ref(0); @@ -187,16 +200,16 @@ const savaForm = () => { behavio_inproveRef.value.validate(); 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 == "" - ); + // 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 ( - filterlevel1_1.length != 0 || - filter_ouptut1_2.length != 0 || + // filterlevel1_1.length != 0 || + // filter_ouptut1_2.length != 0 || knowledge_level.value === 0 || skill_level.value === 0 || competency_level.value === 0 || @@ -350,9 +363,7 @@ const saveformdata = async (data: any) => {
- {{ - "ครั้งที่" + round - }} + {{ "ครั้งที่" + round }} ระหว่างวันที่ {{ date2Thai(start_date) @@ -387,7 +398,7 @@ const saveformdata = async (data: any) => { - {{ list.label }} + {{ list.output_desc }} { class="col-xs-12 col-sm-11 col-md-10 offset-md-1 q-pa-sm bg-grey-1" > - + { }; const addData = () => { router.push( - `/probation/detail/add/${personalId.value}/${assignId.value}` + `/probation/detail/addresult/${personalId.value}/${assignId.value}` ); }; diff --git a/src/modules/05_placement/components/probation/FormEvaluation/Template2.vue b/src/modules/05_placement/components/probation/FormEvaluation/Template2.vue index 8c7ac36af..16d721f29 100644 --- a/src/modules/05_placement/components/probation/FormEvaluation/Template2.vue +++ b/src/modules/05_placement/components/probation/FormEvaluation/Template2.vue @@ -1,21 +1,74 @@ + () => + import( + "@/modules/05_placement/components/probation/FormEvaluation/FormEvaluate.vue" + ) +); + +const router = useRouter(); +const route = useRoute(); +const mixin = useCounterMixin(); +const $q = useQuasar(); +const { showLoader, hideLoader, messageError, success } = mixin; +const assignId = ref(route.params.form.toString()); +const personalId = ref(route.params.personalId.toString()); + +const tab = ref("save1"); +const tabs = ref([]); +const activeTab = ref("tab2"); + +const changeTab = (tabVal: string) => { + tab.value = tabVal; +}; + +onMounted(() => { + fecthAssign(assignId.value); +}); + +const fecthAssign = async (id: string) => { + showLoader(); + await http + .get(config.API.evaluateCreate(id)) + .then((res: any) => { + if (res.data.data.evaluate_no > 2) { + tabs.value = res.data.data.evaluate; + } else tabs.value.push({ no: 1 }, { no: 2 }); + }) + .catch((e: any) => { + console.log(e); + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); +}; +const addData = () => { + router.push(`/probation/detail/addevalua/${personalId.value}/${assignId.value}`); +}; + \ No newline at end of file + diff --git a/src/modules/05_placement/components/probation/FormEvaluation/Template2Format2.vue b/src/modules/05_placement/components/probation/FormEvaluation/Template2Format2.vue index 85be758b1..e655c7f8d 100644 --- a/src/modules/05_placement/components/probation/FormEvaluation/Template2Format2.vue +++ b/src/modules/05_placement/components/probation/FormEvaluation/Template2Format2.vue @@ -1,9 +1,10 @@ diff --git a/src/modules/05_placement/router.ts b/src/modules/05_placement/router.ts index 7596d1944..adc8da847 100644 --- a/src/modules/05_placement/router.ts +++ b/src/modules/05_placement/router.ts @@ -27,6 +27,18 @@ const transfer = () => import("@/modules/05_placement/components/Transfer/transferMain.vue"); const transferbyId = () => import("@/modules/05_placement/components/Transfer/transferRegistry.vue"); +const FormSaveResultAdd = () => + import( + "@/modules/05_placement/components/probation/FormEvaluation/FormSaveResultAdd.vue" + ); +const FormEvaluateAdd = () => + import( + "@/modules/05_placement/components/probation/FormEvaluation/FormEvaluateAdd.vue" + ); +const FormEvaluateScoreAdd = () => + import( + "@/modules/05_placement/components/probation/FormEvaluation/FormEvaluateScoreAdd.vue" + ); // คำสั่งช่วยราชการ/ส่งตัวกลับ const RepatriationOrder = () => @@ -49,10 +61,7 @@ const receiveDetail2 = () => import("@/modules/05_placement/components/Receive/receiveDetail2.vue"); const ReceiveAdd = () => import("@/modules/05_placement/components/Receive/FormAdd.vue"); -const FormSaveResultAdd = () => - import( - "@/modules/05_placement/components/probation/FormEvaluation/FormSaveResultAdd.vue" - ); + //แต่งตั้ง-เลื่อน const AppointmentMain = () => import("@/modules/05_placement/components/AppointMent/Main.vue"); const AppointmentDetail = () => import("@/modules/05_placement/components/AppointMent/Detail.vue"); @@ -122,8 +131,8 @@ export default [ }, }, { - path: "/probation/detail/add/:id/:form", - name: "probationFormAdd", + path: "/probation/detail/addresult/:id/:form", + name: "probationFormAddresult", component: FormSaveResultAdd, meta: { Auth: true, @@ -131,6 +140,26 @@ export default [ Role: "placement", }, }, + { + path: "/probation/detail/addevalua/:id/:form", + name: "probationFormAddevalua", + component: FormEvaluateAdd, + meta: { + Auth: true, + Key: [6.3], + Role: "placement", + }, + }, + { + path: "/probation/detail/addevaluascore/:id/:form", + name: "probationFormAddevaluascore", + component: FormEvaluateScoreAdd, + meta: { + Auth: true, + Key: [6.3], + Role: "placement", + }, + }, { path: "/probation/work/add", name: "probationWorkAdd",