From 1e16bd7b2de2260a333d5dfabb2292c90fadf0e0 Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Fri, 17 Nov 2023 18:00:02 +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 --- .../FormEvaluation/FormSaveResultAdd.vue | 15 ++- .../FormSaveResultAddCommander.vue | 34 +++--- .../FormEvaluation/FormSaveResultCommader.vue | 106 +++++++++++------- .../probation/FormEvaluation/Header.vue | 9 +- .../probation/FormEvaluation/Template1.vue | 40 ++++--- .../FormEvaluation/Template1Commader.vue | 30 ++++- .../probation/FormEvaluation/Template2.vue | 26 ++++- 7 files changed, 174 insertions(+), 86 deletions(-) diff --git a/src/modules/05_placement/components/probation/FormEvaluation/FormSaveResultAdd.vue b/src/modules/05_placement/components/probation/FormEvaluation/FormSaveResultAdd.vue index eccde259d..10667dd5b 100644 --- a/src/modules/05_placement/components/probation/FormEvaluation/FormSaveResultAdd.vue +++ b/src/modules/05_placement/components/probation/FormEvaluation/FormSaveResultAdd.vue @@ -373,7 +373,9 @@ onMounted(async () => { การทดลองปฏิบัติหน้าที่ราชการของ {{ person.name }} + +
@@ -384,7 +386,6 @@ onMounted(async () => {
-
ตำแหน่งในสายงาน {{ person.PositionLineName }} @@ -412,12 +413,14 @@ onMounted(async () => { date2Thai(assign.date_finish) }}
+
บันทึกผล{{ "ครั้งที่ " + round }}
+
{
+
{
+
@@ -1346,6 +1351,7 @@ onMounted(async () => { 2. การเรียนรู้ด้วยตนเอง +
{ />
+ - { > +
{ label=" ยังไม่ได้ดำเนินการ" />
+
@@ -1430,8 +1438,6 @@ onMounted(async () => {
- -
@@ -1492,6 +1498,7 @@ onMounted(async () => {
+
diff --git a/src/modules/05_placement/components/probation/FormEvaluation/FormSaveResultAddCommander.vue b/src/modules/05_placement/components/probation/FormEvaluation/FormSaveResultAddCommander.vue index 136c6e7d2..a97fb2226 100644 --- a/src/modules/05_placement/components/probation/FormEvaluation/FormSaveResultAddCommander.vue +++ b/src/modules/05_placement/components/probation/FormEvaluation/FormSaveResultAddCommander.vue @@ -24,6 +24,7 @@ const { dialogConfirm, dialogMessageNotify, } = mixin; + const { ratingColors } = probationStore; const assignId = ref(route.params.form.toString()); const personalId = ref(route.params.id.toString()); @@ -81,6 +82,7 @@ const other_training = ref(null); const Autherise = ref(null); const dateAutherise = ref(new Date()); const checkArray = ref(0); + const alerts = Array(20) .fill(null) .map(() => ref(false)); @@ -133,7 +135,9 @@ const variablesToWatch = [ success_level, ]; const ArrayCountbotton = [orientation, self_learning, training_seminar]; -const savaForm = () => { + +/** เช็คข้อมูลก่อน save */ +function savaForm(){ achievement_strengthRef.value.validate(); behavio_strengthRef.value.validate(); @@ -207,11 +211,11 @@ const savaForm = () => { } }; - /** - * get data เก็ฐในตัวแปร - * @param id person id - */ - async function fecthFormdata(id: string){ +/** + * get data เก็ฐในตัวแปร + * @param id person id + */ +async function fecthFormdata(id: string) { await http .get(config.API.formevaluateRecordCommander(id)) .then((res: any) => { @@ -244,10 +248,10 @@ const savaForm = () => { checkArray.value = list1_1.value.length; }) .catch((e: any) => {}); -}; +} /** ยืนยัน save ข้อมูล */ -function putformData(){ +function putformData() { const data = { evaluate_no: evaluate_no.value, start_date: start_date.value, @@ -285,12 +289,12 @@ function putformData(){ assessor_dated: dateToISO(dateAutherise.value), }; dialogConfirm($q, async () => await saveformdata(data)); -}; +} /** ฟังชั่น save * @param data ข้อมูลที่ save - */ -async function saveformdata(data: any){ + */ +async function saveformdata(data: any) { await http .post(config.API.formevaluateCommander(assignId.value), data) .then(() => { @@ -300,7 +304,7 @@ async function saveformdata(data: any){ .catch((e: any) => { messageError($q, e); }); -}; +} variablesToWatch.forEach((variable, index) => { watch(variable, (item: any) => { @@ -352,11 +356,11 @@ watch(lengthdiscipline_level, (newLength) => { * ฟังชั่น class * @param i true/false */ -function getBordered(i: boolean){ +function getBordered(i: boolean) { return { border_custom: i, }; -}; +} onMounted(async () => { await fecthFormdata(assignId.value); @@ -1262,7 +1266,7 @@ onMounted(async () => { - +
diff --git a/src/modules/05_placement/components/probation/FormEvaluation/FormSaveResultCommader.vue b/src/modules/05_placement/components/probation/FormEvaluation/FormSaveResultCommader.vue index bbf583f71..b05fa45c4 100644 --- a/src/modules/05_placement/components/probation/FormEvaluation/FormSaveResultCommader.vue +++ b/src/modules/05_placement/components/probation/FormEvaluation/FormSaveResultCommader.vue @@ -84,14 +84,33 @@ const achievement_inproveRef = ref(null); const behavio_strengthRef = ref(null); const behavio_inproveRef = ref(null); -const edit = () => { - status.value = true; -}; +const list1_2 = [ + { id: "", label: "" }, + { id: "", label: "" }, + { id: "", label: "" }, + { id: "", label: "" }, + { id: "", label: "" }, + { id: "", label: "" }, + { id: "", label: "" }, + { id: "", label: "" }, + { id: "", label: "" }, + { id: "", label: "" }, +]; -const cancel = () => { - status.value = false; - props.fecthAssign?.(assignId.value); -}; +const list2_1 = probationStore.behavior_no1; +const list2_2 = probationStore.behavior_no2; +const list2_3 = probationStore.behavior_no3; + +const achievement_strengthRules = [ + (val: any) => (val && val.length > 0) || "กรุณากรอกข้อมูลจุดเด่น", +]; + +const behavio_strengthRules = [ + (val: any) => (val && val.length > 0) || "กรุณากรอกข้อมูลจุดเด่น", +]; + + +/** รับค่า props มาจากหน้าหลัก */ const props = defineProps({ tab: String, data: Object, @@ -99,7 +118,21 @@ const props = defineProps({ fecthAssign: Function, }); -const fecthFormdata = async () => { +/** ให้ status true */ +function edit(){ + status.value = true; +}; + +/** ให้ status false + * เรียกใช้ ฟังชั่น จากหน้าหลัก + */ +function cancel(){ + status.value = false; + props.fecthAssign?.(assignId.value); +}; + +/** get data */ +async function fecthFormdata(){ await http .get(config.API.formevaluateRecordCommander(assignId.value)) .then(async (res: any) => { @@ -113,7 +146,9 @@ const fecthFormdata = async () => { } }); }; -const fectFormfull = async () => { + +/** get data */ +async function fectFormfull(){ Autherise.value = probationStore.director.name + ` (${probationStore.director.PositionLineName}, ${probationStore.director.PositionLevelName}, ${probationStore.director.Oc})`; @@ -130,7 +165,9 @@ const fectFormfull = async () => { checkArray.value = list1_1.value.length; fecthFormRound(); }; -const fecthFormRound = async () => { + +/** get data */ +async function fecthFormRound(){ try { let data = await dataArr.value; evaluate_id.value = data.id; @@ -190,32 +227,8 @@ const fecthFormRound = async () => { } }; -const list1_2 = [ - { id: "", label: "" }, - { id: "", label: "" }, - { id: "", label: "" }, - { id: "", label: "" }, - { id: "", label: "" }, - { id: "", label: "" }, - { id: "", label: "" }, - { id: "", label: "" }, - { id: "", label: "" }, - { id: "", label: "" }, -]; - -const list2_1 = probationStore.behavior_no1; -const list2_2 = probationStore.behavior_no2; -const list2_3 = probationStore.behavior_no3; - -const achievement_strengthRules = [ - (val: any) => (val && val.length > 0) || "กรุณากรอกข้อมูลจุดเด่น", -]; - -const behavio_strengthRules = [ - (val: any) => (val && val.length > 0) || "กรุณากรอกข้อมูลจุดเด่น", -]; - -const savaForm = () => { +/** เช็คก่อน save */ +function savaForm(){ achievement_strengthRef.value.validate(); achievement_inproveRef.value.validate(); behavio_strengthRef.value.validate(); @@ -258,7 +271,8 @@ const savaForm = () => { } }; -const putformData = () => { +/** ยืนยัน save data */ +function putformData(){ const data = { evaluate_no: evaluate_no.value, start_date: start_date.value, @@ -300,7 +314,8 @@ const putformData = () => { ); }; -const saveformdata = async (data: any) => { +/** save data */ +async function saveformdata(data: any){ await http .post(config.API.formevaluateCommander(assignId.value), data) .then((res: any) => { @@ -312,7 +327,8 @@ const saveformdata = async (data: any) => { }); }; -const editData = async (data: any) => { +/** update data */ +async function editData(data: any){ await http .put( config.API.editEvaluateCommander(assignId.value, evaluate_id.value), @@ -334,6 +350,7 @@ watch(props, async () => { fectFormfull(); } }); + onMounted(async () => { if (props.tab && props.action == "edit") { evaluate_no.value = Number(props.tab.charAt(4)); @@ -376,6 +393,7 @@ onMounted(async () => {
+
@@ -487,6 +505,7 @@ onMounted(async () => {
+
ผลผลิตของงานที่เกิดขึ้นจริง @@ -745,6 +764,7 @@ onMounted(async () => { + @@ -920,6 +940,7 @@ onMounted(async () => {
+
@@ -968,6 +989,7 @@ onMounted(async () => {
+
@@ -1016,6 +1038,7 @@ onMounted(async () => {
+
@@ -1085,6 +1108,7 @@ onMounted(async () => {
+
@@ -1168,6 +1192,7 @@ onMounted(async () => {
+ @@ -1194,6 +1219,7 @@ onMounted(async () => {
+ @@ -1220,6 +1246,7 @@ onMounted(async () => {
+ @@ -1315,6 +1342,7 @@ onMounted(async () => {
+ ("save1"); + +/** รับค่ามาจากหน้าหลัก */ const props = defineProps({ FileDownload: { type: Function, @@ -25,7 +27,9 @@ const props = defineProps({ }, }, }); -const downloadFile = (type: string) => { + +/** เรียกใช้ฟังชั่นจากหน้าหลัก */ +function downloadFile(type: string){ props.FileDownload(type); }; @@ -33,7 +37,8 @@ watch(tabHead, () => { props.changeTab(tabHead.value); }); -const nextPage = () => { +/** ไปยัง step ต่อไป */ +function nextPage(){ if (props.loop !== undefined) { if (props.loop < 3) { props.addData(); diff --git a/src/modules/05_placement/components/probation/FormEvaluation/Template1.vue b/src/modules/05_placement/components/probation/FormEvaluation/Template1.vue index 4b5d14d7a..ccd5499f8 100644 --- a/src/modules/05_placement/components/probation/FormEvaluation/Template1.vue +++ b/src/modules/05_placement/components/probation/FormEvaluation/Template1.vue @@ -33,10 +33,11 @@ const fullname = ref(""); const tab = ref("save1"); const dataArrayNumber = ref(); const dataRole = ref("mentor"); -onMounted(async () => { - await fecthAssign(assignId.value); -}); -const fecthAssign = async (id: string) => { + +/** get ข้อมูล มอบหมาย + * @param id person id + */ +async function fecthAssign(id: string){ showLoader(); await http .get(config.API.formevaluate(id)) @@ -52,11 +53,18 @@ const fecthAssign = async (id: string) => { hideLoader(); }); }; -const changeTab = (tabVal: string) => { + +/** + * เปลี่ยน tab + * @param tabVal type + */ +function changeTab(tabVal: string){ tab.value = tabVal; dataArrayNumber.value = Number(tabVal.charAt(4)); }; -const downloadFile = (response: any, filename: string) => { + +/** convert file */ +function downloadFile(response: any, filename: string){ const link = document.createElement("a"); var fileName = filename; link.href = window.URL.createObjectURL(new Blob([response.data])); @@ -65,7 +73,9 @@ const downloadFile = (response: any, filename: string) => { link.click(); document.body.removeChild(link); }; -const FileDownload = async (type: string) => { + +/** download file */ +async function FileDownload(type: string){ let numTab = probationStore.evaluate.find( (e: any) => e.no === dataArrayNumber.value ); @@ -109,11 +119,17 @@ const FileDownload = async (type: string) => { }); } }; -const addData = () => { + +/** ไปหน้า page add */ +function addData(){ router.push( `/probation/detail/addresult/${personalId.value}/${assignId.value}` ); }; + +onMounted(async () => { + await fecthAssign(assignId.value); +});