From 376f2a7c61236c9917c3943cf6c19092aadcc68f Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Fri, 17 Nov 2023 10:55:05 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=88=E0=B8=B1=E0=B8=94=E0=B9=82=E0=B8=84?= =?UTF-8?q?=E0=B9=89=E0=B8=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FormSaveResultAddCommander.vue | 106 +++++++++++------- 1 file changed, 67 insertions(+), 39 deletions(-) diff --git a/src/modules/05_placement/components/probation/FormEvaluation/FormSaveResultAddCommander.vue b/src/modules/05_placement/components/probation/FormEvaluation/FormSaveResultAddCommander.vue index 757de2345..136c6e7d2 100644 --- a/src/modules/05_placement/components/probation/FormEvaluation/FormSaveResultAddCommander.vue +++ b/src/modules/05_placement/components/probation/FormEvaluation/FormSaveResultAddCommander.vue @@ -85,41 +85,6 @@ const alerts = Array(20) .fill(null) .map(() => ref(false)); -const fecthFormdata = async (id: string) => { - await http - .get(config.API.formevaluateRecordCommander(id)) - .then((res: any) => { - 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; - - person.value = res.data.data.person; - assign.value = res.data.data.assign; - option.value.push(res.data.data.director); - Autherise.value = - res.data.data.director.name + - ` (${res.data.data.director.PositionLineName}, ${res.data.data.director.PositionLevelName}, ${res.data.data.director.Oc})`; - - list1_1.value = res.data.data.assign_output; - res.data.data.assign_output.forEach((e: any) => { - list1_2.push({ id: "", label: "" }); - }); - evaluate_expenct_level.value = res.data.data.assign_output.map( - (e: any) => ({ - id: e.id, - labal: e.output_desc, - }) - ); - evaluate_ouptut.value = res.data.data.assign_output.map((e: any) => ({ - id: e.id, - text: "", - })); - checkArray.value = list1_1.value.length; - }) - .catch((e: any) => {}); -}; - //rules const evaluate_ouptutRules = [ (val: any) => (val && val.length > 0) || "กรุณากรอกเหตุผลที่เกิดขึ้น", @@ -242,7 +207,47 @@ const savaForm = () => { } }; -const putformData = () => { + /** + * get data เก็ฐในตัวแปร + * @param id person id + */ + async function fecthFormdata(id: string){ + await http + .get(config.API.formevaluateRecordCommander(id)) + .then((res: any) => { + 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; + + person.value = res.data.data.person; + assign.value = res.data.data.assign; + option.value.push(res.data.data.director); + Autherise.value = + res.data.data.director.name + + ` (${res.data.data.director.PositionLineName}, ${res.data.data.director.PositionLevelName}, ${res.data.data.director.Oc})`; + + list1_1.value = res.data.data.assign_output; + res.data.data.assign_output.forEach((e: any) => { + list1_2.push({ id: "", label: "" }); + }); + evaluate_expenct_level.value = res.data.data.assign_output.map( + (e: any) => ({ + id: e.id, + labal: e.output_desc, + }) + ); + evaluate_ouptut.value = res.data.data.assign_output.map((e: any) => ({ + id: e.id, + text: "", + })); + checkArray.value = list1_1.value.length; + }) + .catch((e: any) => {}); +}; + +/** ยืนยัน save ข้อมูล */ +function putformData(){ const data = { evaluate_no: evaluate_no.value, start_date: start_date.value, @@ -282,7 +287,10 @@ const putformData = () => { dialogConfirm($q, async () => await saveformdata(data)); }; -const saveformdata = async (data: any) => { +/** ฟังชั่น save + * @param data ข้อมูลที่ save + */ +async function saveformdata(data: any){ await http .post(config.API.formevaluateCommander(assignId.value), data) .then(() => { @@ -301,6 +309,7 @@ variablesToWatch.forEach((variable, index) => { } }); }); + ArrayCountbotton.forEach((variable, index) => { watch(variable, (item: any) => { if (item !== null) { @@ -308,36 +317,47 @@ ArrayCountbotton.forEach((variable, index) => { } }); }); + watch(lengthevaluate_expenct_level, (newLength) => { if (newLength === evaluate_expenct_level.value.length) { alerts[0].value = false; } }); + watch(lengthevaluate_ouptut, (newLength) => { if (newLength === evaluate_ouptut.value.length) { alerts[1].value = false; } }); + watch(lengthconduct, (newLength) => { if (newLength === 4) { alerts[8].value = false; } }); + watch(lengthmoral_level, (newLength) => { if (newLength === 3) { alerts[9].value = false; } }); + watch(lengthdiscipline_level, (newLength) => { if (newLength === 5) { alerts[10].value = false; } }); -const getBordered = (i: boolean) => { + +/** + * ฟังชั่น class + * @param i true/false + */ +function getBordered(i: boolean){ return { border_custom: i, }; }; + onMounted(async () => { await fecthFormdata(assignId.value); }); @@ -373,7 +393,6 @@ onMounted(async () => {
-
ตำแหน่งในสายงาน {{ person.PositionLineName }} @@ -401,12 +420,14 @@ onMounted(async () => { date2Thai(assign.date_finish) }}
+
บันทึกผล{{ "ครั้งที่ " + round }}
+
{
+
{
+
@@ -553,6 +576,7 @@ onMounted(async () => {
+
ผลผลิตของงานที่เกิดขึ้นจริง @@ -1054,6 +1078,7 @@ onMounted(async () => {
+
@@ -1108,6 +1133,7 @@ onMounted(async () => {
+
@@ -1162,6 +1188,7 @@ onMounted(async () => {
+
@@ -1235,6 +1262,7 @@ onMounted(async () => {
+