diff --git a/src/modules/05_placement/components/probation/FormAssign.vue b/src/modules/05_placement/components/probation/FormAssign.vue index 29e577f06..2242da3c3 100644 --- a/src/modules/05_placement/components/probation/FormAssign.vue +++ b/src/modules/05_placement/components/probation/FormAssign.vue @@ -650,19 +650,26 @@ const getAssign = async () => { await http.get(config.API.probationsGetAssign(assignId.value)).then((res) => { status.value = false; const data = res.data.data; + console.log(data); + fullname.value = data.profile.name; position.value = data.profile.OrganizationOrganization; date_start.value = data.assign.date_start; date_finish.value = data.assign.date_finish; date1.value = data.assign.experimenter_dated; - date2.value = data.mentors[0].dated; - date3.value = data.mentors[1].dated; + if (data.mentors.length > 1) { + date3.value = data.mentors[1].dated; + caretaker2.value = data.mentors[1]; + } else { + date2.value = data.mentors[0].dated; + caretaker1.value = data.mentors[0]; + } + date4.value = data.commander.dated; activity_desc.value = data.jobs.map((job: any) => job.activity_desc); goal_desc.value = data.jobs.map((job: any) => job.goal_desc); activityCount.value = data.jobs.length; - caretaker1.value = data.mentors[0]; - caretaker2.value = data.mentors[1]; + chairman.value = data.chairman; commander.value = data.commander; knowledge.value = data.knowledges.map((id: any) => id.id); diff --git a/src/modules/05_placement/components/probation/FormEvaluation/FormEvaluate.vue b/src/modules/05_placement/components/probation/FormEvaluation/FormEvaluate.vue index 5da05c717..fcd35cfcb 100644 --- a/src/modules/05_placement/components/probation/FormEvaluation/FormEvaluate.vue +++ b/src/modules/05_placement/components/probation/FormEvaluation/FormEvaluate.vue @@ -104,7 +104,7 @@ onMounted(async () => { if (props.tab && props.action == "edit") { evaluate_no.value = Number(props.tab.charAt(4)); dataArr.value = await props.data; - // fecthAssign(); + fecthAssign(); fetchEvaluate(); } }); @@ -113,39 +113,39 @@ watch(props, async () => { if (props.tab && props.action == "edit") { evaluate_no.value = Number(props.tab.charAt(4)); dataArr.value = await props.data; - // fecthAssign(); + fecthAssign(); fetchEvaluate(); } }); -// const fecthAssign = async () => { -// showLoader(); -// await http -// .get(config.API.evaluateCreate(assignId.value)) -// .then(async (res: any) => { -// console.log(res); - -// if (props.action == "add") { -// 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; -// evaluate_no.value = res.data.data.evaluate_no; -// start_date.value = res.data.data.start_date; -// date_finish.value = res.data.data.end_date; -// } -// }) -// .catch((e) => { -// messageError($q, e); -// }) -// .finally(() => { -// if (props.action == "edit") { -// fetchEvaluate(); -// } -// hideLoader(); -// }); -// }; +const fecthAssign = async () => { + showLoader(); + await http + .get(config.API.evaluateCreate(assignId.value)) + .then(async (res: any) => { + console.log(res); + if (props.action == "add") { + 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; + evaluate_no.value = res.data.data.evaluate_no; + start_date.value = res.data.data.start_date; + date_finish.value = res.data.data.end_date; + } + Autherise.value = res.data.data.commander.name + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + if (props.action == "edit") { + fetchEvaluate(); + } + hideLoader(); + }); +}; const fetchEvaluate = async () => { // showLoader(); try { diff --git a/src/modules/05_placement/components/probation/FormEvaluation/FormEvaluateScore.vue b/src/modules/05_placement/components/probation/FormEvaluation/FormEvaluateScore.vue index a582d92d1..273014105 100644 --- a/src/modules/05_placement/components/probation/FormEvaluation/FormEvaluateScore.vue +++ b/src/modules/05_placement/components/probation/FormEvaluation/FormEvaluateScore.vue @@ -58,6 +58,7 @@ onMounted(async () => { evaluate_no.value = Number(props.tab.charAt(4)); dataArr.value = await props.data; await fetchEvaluate(); + await fecthAssign(); } }); @@ -66,34 +67,39 @@ watch(props, async () => { evaluate_no.value = Number(props.tab.charAt(4)); dataArr.value = await props.data; await fetchEvaluate(); + await fecthAssign(); } }); -// const fecthAssign = async () => { -// 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; -// } -// }) -// .catch((e) => { -// messageError($q, e); -// }) -// .finally(() => { -// if (props.action == "edit") { -// fetchEvaluate(); -// } -// hideLoader(); -// }); -// }; +const fecthAssign = async () => { + 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; + } + chairman.value = res.data.data.chairman; + commander.value = res.data.data.commander; + mentors.value = res.data.data.mentors; + console.log(commander.value.name); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + if (props.action == "edit") { + fetchEvaluate(); + } + hideLoader(); + }); +}; const fetchEvaluate = async () => { // showLoader(); @@ -1324,7 +1330,7 @@ const putformData = () => {
- ผู้บังคับบัญชาผู้มอบหมายงาน + ผู้บังคับบัญชาผู้มอบหมายงาน {{ commander.name }}
{
{ hide-bottom-space class="full-width datepicker col-3" :model-value=" - dateAutherise != null ? date2Thai(dateAutherise) : null + commander.dated != null ? date2Thai(commander.dated) : null " :label="`${'ลงวันที่'}`" :rules="[(val) => !!val || `${'กรุณาเลือกลงวันที่'}`]" @@ -1378,15 +1384,15 @@ const putformData = () => {
- -
+ /> --> + - -
+ /> --> + + +
+
+ + + + + +
diff --git a/src/modules/05_placement/components/probation/FormEvaluation/FormEvaluateScoreAdd.vue b/src/modules/05_placement/components/probation/FormEvaluation/FormEvaluateScoreAdd.vue index 84bf55383..8f74ca528 100644 --- a/src/modules/05_placement/components/probation/FormEvaluation/FormEvaluateScoreAdd.vue +++ b/src/modules/05_placement/components/probation/FormEvaluation/FormEvaluateScoreAdd.vue @@ -34,7 +34,7 @@ const date_finish = ref(); const status = ref(true); const chairman = ref([]); const commander = ref([]); -const mentors = ref([{ name: "" }, { name: "" }]); +const mentors = ref([{ name: "", dated: "" }]); onMounted(() => { fecthAssign(assignId.value); @@ -44,6 +44,7 @@ const fecthAssign = async (id: string) => { await http .get(config.API.evaluateChairman(id)) .then(async (res: any) => { + console.log(res); person.value = await res.data.data.person; assign.value = await res.data.data.assign; evaluate_no.value = await res.data.data.evaluate_no; @@ -51,7 +52,12 @@ const fecthAssign = async (id: string) => { date_finish.value = await res.data.data.end_date; chairman.value = await res.data.data.chairman; commander.value = await res.data.data.commander; - mentors.value = await res.data.data.mentors; + mentors.value = res.data.data.mentors.map((e: any) => ({ + name: e.name, + dated: e.dated, + })); + + console.log(mentors.value); }) .catch((e) => { messageError($q, e); @@ -337,9 +343,7 @@ const putformData = () => { .post(config.API.createformChairman(assignId.value), data) .then((res: any) => { success($q, "บันทึกสำเร็จ"); - router.push( - `/probation/detail/${personalId.value}/${assignId.value}` - ); + router.push(`/probation/detail/${personalId.value}/${assignId.value}`); }) .catch((e: any) => { messageError($q, e); @@ -351,14 +355,24 @@ const putformData = () => { - -
- -
- - - - - -
- -
- - - -