From 3da536acb0d06d495b7535d70538c17fc1a2f583 Mon Sep 17 00:00:00 2001 From: waruneeta Date: Wed, 20 Sep 2023 00:58:45 +0700 Subject: [PATCH] =?UTF-8?q?-=20fix=20bug=20generate=20=E0=B9=81=E0=B8=99?= =?UTF-8?q?=E0=B8=9A=E0=B8=97=E0=B9=89=E0=B8=B2=E0=B8=A2=E0=B9=84=E0=B8=A1?= =?UTF-8?q?=E0=B9=88=20generate=20=E0=B9=83=E0=B8=AB=E0=B8=A1=E0=B9=88=20-?= =?UTF-8?q?=20=E0=B8=9B=E0=B8=B4=E0=B8=94=20log?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/10_order/components/Detail.vue | 2 - src/modules/10_order/components/Main.vue | 12 - .../10_order/components/PopupHistory.vue | 2 - .../10_order/components/step/step01.vue | 16 - .../10_order/components/step/step02.vue | 23 - .../10_order/components/step/step03.vue | 8 - .../10_order/components/step/step04.vue | 548 +++++------------- 7 files changed, 132 insertions(+), 479 deletions(-) diff --git a/src/modules/10_order/components/Detail.vue b/src/modules/10_order/components/Detail.vue index 735d88888..8b0b2e143 100644 --- a/src/modules/10_order/components/Detail.vue +++ b/src/modules/10_order/components/Detail.vue @@ -64,7 +64,6 @@ const destroyLocalStorage = () => { localStorage.clear(); }; onMounted(() => { - // console.log("route query===>", route.query) if (route.query.step) { step.value = Number(route.query.step); localStorage.setItem("currentStep", step.value.toString()); @@ -79,7 +78,6 @@ onMounted(() => { if (orderId_params !== undefined) { orderId.value = orderId_params.toString(); - // console.log("orderId.value"); } }); diff --git a/src/modules/10_order/components/Main.vue b/src/modules/10_order/components/Main.vue index d98e57fe6..270f95849 100644 --- a/src/modules/10_order/components/Main.vue +++ b/src/modules/10_order/components/Main.vue @@ -141,7 +141,6 @@ const OriginalDataFetch = async () => { await http .get(config.API.listOrder()) .then((res: any) => { - // console.log("list", res); rows.value = res.data.result.map((e: any) => ({ orderId: e.orderId, Order: e.orderName, @@ -234,7 +233,6 @@ const fiscalyearOP = reactive([{ id: 0, name: "ทั้งหม const addedfiscalYearValues: number[] = []; const fiscalYearFilter = async () => { await http.get(config.API.yearOptionsOrder()).then((res) => { - // console.log(res); const response = res.data.result; fiscalyearOP.push(...response); }); @@ -247,7 +245,6 @@ const OrderTypeFilter = async () => { await http .get(config.API.typeOrder()) .then((res) => { - // console.log(res.data); const response = res.data.result; OrderTypeOption.push(...response); }) @@ -275,8 +272,6 @@ const OrderStatusFilter = async () => { } if (!addedOrderStatusValues.includes(OrderStatusValue)) { - // console.log(OrderStatusValue); - OrderStatusOption.push({ // id: OrderStatusValue, id: OrderStatusOption.length.toString(), @@ -303,12 +298,6 @@ const searchFilterTable = async () => { if (OrderStatus.value == "ทั้งหมด") { OrderStatus.value = ""; } - console.log( - "Input value changed:", - OrderType.value, - OrderStatus.value, - fiscalyear.value - ); await DataStore.DataUpdateOrder( OrderType.value, @@ -316,7 +305,6 @@ const searchFilterTable = async () => { fiscalyear.value ); UpdataData.value = DataStore.DataMainUpdateOrder; - // console.log(UpdataData.value); }; const paging = ref(true); diff --git a/src/modules/10_order/components/PopupHistory.vue b/src/modules/10_order/components/PopupHistory.vue index 719ad2ec1..d07e7b3fd 100644 --- a/src/modules/10_order/components/PopupHistory.vue +++ b/src/modules/10_order/components/PopupHistory.vue @@ -93,13 +93,11 @@ const clickSearch = async () => { year: reportYear.value, posno: reportNo.value, }; - // console.log(body); showLoader(); http .post(config.API.searchOrderprofile(), body) .then((res) => { let data = res.data.result; - console.log(data); if (data.length !== 0) { rows.value = data.map((e: any) => ({ diff --git a/src/modules/10_order/components/step/step01.vue b/src/modules/10_order/components/step/step01.vue index d1f11eff7..9ec441d60 100644 --- a/src/modules/10_order/components/step/step01.vue +++ b/src/modules/10_order/components/step/step01.vue @@ -178,7 +178,6 @@ watch(byOrder, async () => { .get(config.API.approverOC(byOrder.value)) .then((res: any) => { CommandOption.value = res.data.result; - // console.log(CommandOption.value); }) .catch((e: any) => { console.log(e); @@ -220,10 +219,8 @@ const fetchdetailOrder = async () => { await http .get(config.API.detailOrder(orderIdString)) .then((res: any) => { - // console.log(res); const data = res.data.result; - // console.log(data); typeOrder.value = typeOrderOption.value.find( (e) => e.id === data.orderTypeValue ); @@ -234,7 +231,6 @@ const fetchdetailOrder = async () => { byOrder.value = data.orderBy; nameCommand.value = data.signatoryBy; positionCommand.value = data.signatoryPosition; - // console.log("nameCommand===>",nameCommand.value); examRound.value = data.examRound; conclusionRegisterNo.value = data.conclusionRegisterNo; @@ -309,8 +305,6 @@ const fecthCommand = async () => { await http .get(config.API.organizationsOrder()) .then((res: any) => { - console.log(res); - byOrderOption.value = res.data.result; }) .catch((e: any) => { @@ -319,7 +313,6 @@ const fecthCommand = async () => { }; const nameOrderFilter = (selectOrder: any) => { - console.log(selectOrder); switch (selectOrder) { case "C-PM-01": return "บรรจุและแต่งตั้งผู้สอบแข่งขันได้"; @@ -434,9 +427,6 @@ const fecthExamRoundOption = async (commandCode: string) => { }; const submit = async () => { - // console.log(nameCommand.value); - // console.log(CommandOption.value); - let signBy = null; if (!nameCommand.value.length) { signBy = await nameCommand.value.name; @@ -447,9 +437,7 @@ const submit = async () => { (x: any) => x.name == nameCommand.value ); signBy = await name2?.name; - console.log("signBy", signBy); } - console.log(signBy); const orderByOrganizationName = await byOrderOption.value.find( (x: any) => x.id == byOrder.value @@ -553,8 +541,6 @@ const submit = async () => { }); } - // console.log(formdata); - await myForm.value!.validate().then((result: boolean) => { if (result) { dialogConfirm($q, () => { @@ -591,8 +577,6 @@ const updateOrder = async (formData: Object, orderId: string, type: string) => { await http .put(config.API.orderCPMUpdate(type, orderId), formData) .then((res) => { - console.log(res); - next(); success($q, "บันทึกข้อมูลสำเร็จ"); }) diff --git a/src/modules/10_order/components/step/step02.vue b/src/modules/10_order/components/step/step02.vue index b276f74cc..959eb6294 100644 --- a/src/modules/10_order/components/step/step02.vue +++ b/src/modules/10_order/components/step/step02.vue @@ -118,7 +118,6 @@ const getData = async (id: string) => { .get(config.API.personsselectedOrder(id)) .then((res) => { const data = res.data.result; - // console.log(data); let list: ResponseData[] = []; data.map((r: ResponseData) => { list.push({ @@ -134,7 +133,6 @@ const getData = async (id: string) => { monthSalaryAmount: r.monthSalaryAmount, }); }); - // console.log("list", list); rows.value = list; selected.value = rows.value; }) @@ -182,8 +180,6 @@ const deleteData = async (id: string) => { await http .delete(config.API.personsOrder(id)) .then((res) => { - // const data = res.data.result; - // console.log(res); success($q, "ลบข้อมูลสำเร็จ"); }) .catch((e) => { @@ -199,10 +195,6 @@ const swapUp = async (id: string) => { // id = personalId await http .put(config.API.swapUpOrder(id)) - .then((res) => { - // const data = res.data.result; - // console.log(res); - }) .catch((e) => { messageError($q, e); }) @@ -216,10 +208,6 @@ const swapDown = async (id: string) => { // id = personalId await http .put(config.API.swapDownOrder(id)) - .then((res) => { - // const data = res.data.result; - // console.log(res); - }) .catch((e) => { messageError($q, e); }) @@ -249,7 +237,6 @@ const saveModal = () => { }; const personalId = ref(""); const selectModal = (e: any) => { - // console.log(e); titleName.value = e.name; personalId.value = e.personalId; modalOpenClose(e.personalId); @@ -265,12 +252,10 @@ const modalOpenClose = async (personalId: string) => { myForm.value?.reset(); }; const fetchSalary = async (personalId: string) => { - // console.log(personalId); showLoader(); await http .get(config.API.salaryOrder(personalId)) .then((res: any) => { - console.log(res); const data = res.data.result; modalData.value = { salaryAmount: @@ -292,10 +277,8 @@ const fetchSalary = async (personalId: string) => { ? null : data.monthSalaryAmount, }; - // console.log("data", modalData.value); }) .catch((e) => { - // console.log(e); messageError($q, e); }) .finally(() => { @@ -318,11 +301,9 @@ const putSalary = async (salary: any) => { await http .put(config.API.salaryOrder(personalId.value), modalData.value) .then((res: any) => { - // console.log(res); success($q, "บันทึกข้อมูลสำเร็จ"); }) .catch((e) => { - // console.log(e); messageError($q, e); }) .finally(async () => { @@ -353,7 +334,6 @@ const fetchaddlist = async (id: string) => { .get(config.API.personsOrder(id)) .then((res) => { const data = res.data.result; - console.log(data); let list = []; list = data.map((r: ResponseData) => ({ education: r.education ?? "", @@ -408,7 +388,6 @@ const addlist = async (data: Object) => { success($q, "บันทึกสำเร็จ"); }) .catch((e: any) => { - console.log(e); messageError($q, e); }) .finally(() => { @@ -418,8 +397,6 @@ const addlist = async (data: Object) => { }; const save = async () => { - // console.log("save===>", rows.value); - // console.log(statuscode.value); const check = rows.value.find((x: any) => x.salaryAmount == 0); if ( (selected.value.length > 0 && !check) || diff --git a/src/modules/10_order/components/step/step03.vue b/src/modules/10_order/components/step/step03.vue index 2206141e8..860ba41a0 100644 --- a/src/modules/10_order/components/step/step03.vue +++ b/src/modules/10_order/components/step/step03.vue @@ -207,7 +207,6 @@ const getData = async (id: string) => { .get(config.API.copyOrderId(id)) .then((res) => { const data = res.data.result; - // console.log(data); let list: DataCopyOrder[] = []; data.map((r: ResponseCopyOrder) => { let selectCopyOrder = []; @@ -248,7 +247,6 @@ const getData = async (id: string) => { }; const saveData = async () => { - // console.log("select", selectedModal.value); const id = route.params.orderid ? route.params.orderid.toString() : localStorage.getItem("orderId") @@ -258,10 +256,6 @@ const saveData = async () => { showLoader(); await http .post(config.API.copyOrderPersonsId(id), selectedModal.value) - .then((res) => { - // const data = res.data.result; - // console.log(res); - }) .catch((e) => { messageError($q, e); }) @@ -332,8 +326,6 @@ const deleteData = async (id: string) => { await http .delete(config.API.copyOrderId(id)) .then((res) => { - // const data = res.data.result; - // console.log(res); success($q, "ลบข้อมูลสำเร็จ"); }) .catch((e) => { diff --git a/src/modules/10_order/components/step/step04.vue b/src/modules/10_order/components/step/step04.vue index 7bad552c2..d2c1d305f 100644 --- a/src/modules/10_order/components/step/step04.vue +++ b/src/modules/10_order/components/step/step04.vue @@ -65,7 +65,6 @@ const getCommandDetail = async () => { code.value = orderTypeCode ?? ""; orderName.value = res.data.result.orderTitle; orderStatusName.value = data.orderStatusName; - // console.log(orderStatusName.value); fetchReportCover("pdf", orderId.value); @@ -211,7 +210,6 @@ const viewPDFUpload = async (pdf: string) => { }; watch(tab, () => { - // console.log(tab.value); if (tab.value === "main") { viewPDF(orderCoverPdf.value); } @@ -244,7 +242,6 @@ const props = defineProps({ const previous = () => props.previous(); const onchangePage = (val: any) => { - // console.log(val); if (vuePDFRef !== null) { vuePDFRef.value.reload(); } @@ -260,6 +257,7 @@ const downloadFile = (response: any, filename: string) => { document.body.removeChild(link); }; +// การอัพโหลดไฟล์คำสั่งและเอกสารแนบท้าย const saveUpload = () => { if (myFormUpload.value !== null) { myFormUpload.value!.validate().then((success: Boolean) => { @@ -288,32 +286,41 @@ const saveUpload = () => { } }; +// แก้ไขรายละเอียดคำสั่ง const saveDetail = () => { - console.log(tab.value); - if (myForm.value !== null) { myForm.value!.validate().then((success: Boolean) => { if (success) { + // ยืนยันการบันทึก dialogConfirm($q, async () => { showLoader(); - await putOrderData(); - if (tab.value == "main") { - await fetchReportCover("pdf", orderId.value); - } else { - if ( - code.value != "c-pm-10" && - code.value != "c-pm-11" && - code.value != "c-pm-12" && - code.value != "c-pm-16" && - code.value != "c-pm-18" && - code.value != "c-pm-19" && - code.value != "c-pm-20" && - code.value != "c-pm-21" - ) { - await fetchReportAttachment("pdf", orderId.value); - await viewPDF(orderAttachmentPdf.value); + + await putOrderData(); // บันทึกข้อมูลในส่วนของรายละเอียด + await fetchReportCover("pdf", orderId.value); // ดึงรายงานคำสั่งใหม่ + + // เช็คประเภทคำสั่งถ้าไม่ใช่ type เหล่านี้จะมีแนบท้าย + if ( + code.value != "c-pm-10" && + code.value != "c-pm-11" && + code.value != "c-pm-12" && + code.value != "c-pm-16" && + code.value != "c-pm-18" && + code.value != "c-pm-19" && + code.value != "c-pm-20" && + code.value != "c-pm-21" + ) { + // ดึงรายงานในส่วนของแนบท้ายมาใหม่ + await fetchReportAttachment("pdf", orderId.value); + + // เช็คว่าถ้าอยู่ใน tab ของแนบท้ายไหมถ้าอยู่เข้าเงื่อนไขนี้ + if (tab.value == "second") { + // แสดงผลส่วนของแนบท้ายใหม่ + await viewPDF(orderAttachmentPdf.value); } + } + + // ดึงข้อมูลสถานะการออกคำสั่ง (Y = ออกคำสั่งได้แล้ว, N = เงื่อนไขยังไม่ครบไม่สามารถกดออกคำสั่งได้) await fecthstatusOrder(); hideLoader(); @@ -323,6 +330,7 @@ const saveDetail = () => { } }; +// ฟังก์ชั่นการบันทึกข้อมูลในส่วนของรายละเอียด const putOrderData = async () => { const orderData = { orderNo: order.value, @@ -438,108 +446,61 @@ const viewFileUpload = async (url: string) => {