diff --git a/src/modules/10_order/components/step/step01.vue b/src/modules/10_order/components/step/step01.vue index ca6487576..f6d49eecb 100644 --- a/src/modules/10_order/components/step/step01.vue +++ b/src/modules/10_order/components/step/step01.vue @@ -127,6 +127,10 @@ const result = ref(""); const refRaw = ref(""); const complaintId = ref(""); +// C-PM-40 +const actStartDate = ref(null); +const actEndDate = ref(null); + const typeOrderFilter = ref({ typeOrderOption: [], }); @@ -155,6 +159,34 @@ watch(nameCommand, async () => { positionCommand.value = nameCommand.value.positionName; } }); +const mainCommandCodes = ref([ + "C-PM-01", + "C-PM-02", + "C-PM-03", + "C-PM-04", + "C-PM-05", + "C-PM-06", + "C-PM-07", + "C-PM-08", + "C-PM-09", + "C-PM-10", + "C-PM-11", + "C-PM-12", + "C-PM-13", + "C-PM-14", + "C-PM-15", + "C-PM-16", + "C-PM-17", + "C-PM-18", + "C-PM-21", + "C-PM-22", + "C-PM-23", + "C-PM-24", + "C-PM-38", + "C-PM-39", + "C-PM-40", + "C-PM-41", +]); const commandCodes = ref([ "C-PM-19", @@ -180,11 +212,14 @@ const fecthTypeOption = async (actions: string) => { const filterRes = response.filter((e: any) => commandCodes.value.includes(e.commandCode) ); + const mainFilterRes = response.filter((e: any) => + mainCommandCodes.value.includes(e.commandCode) + ); const data = orderId_paramsName === "OrderDetail" || orderId_paramsName === "OrderAdd" - ? response + ? mainFilterRes : filterRes; typeOrderOption.value = data.map((e: OrederResult) => ({ @@ -254,6 +289,7 @@ const fetchdetailOrder = async () => { book.value = data.militaryCommandNo; bookDate.value = data.militaryCommanDate; //10 + if (data.orderTypeCode === "c-pm-10") { nodeTree(); } @@ -296,6 +332,9 @@ const fetchdetailOrder = async () => { result.value = data.result; refRaw.value = data.refRaw; complaintId.value = data.complaintId; + + actStartDate.value = data.actStartDate; + actEndDate.value = data.actEndDate; }) .catch((e) => { messageError($q, e); @@ -443,6 +482,10 @@ const selectCMP = async (selectOrder: OrederResult) => { refRaw.value = ""; complaintId.value = ""; + + // 40 + actStartDate.value = null; + actEndDate.value = null; }; // เรียกรอบการสอบ @@ -622,6 +665,11 @@ const onSubmit = async () => { result: result.value, refRaw: refRaw.value, }); + } else if (typeOrder.value.commandCode == "C-PM-40") { + Object.assign(formdata, { + actStartDate: actStartDate.value, + actEndDate: actEndDate.value, + }); } // เช็คค่าว่าง @@ -2374,6 +2422,100 @@ const getClass = (val: boolean) => { /> + + +
+
+ + + + + +
+ +
+ + + + + +
+
diff --git a/src/modules/10_order/components/step/step04.vue b/src/modules/10_order/components/step/step04.vue index 91bd9a60e..3ea8363da 100644 --- a/src/modules/10_order/components/step/step04.vue +++ b/src/modules/10_order/components/step/step04.vue @@ -77,23 +77,8 @@ const attachmentStatus = computed(() => { code.value != "c-pm-30" && code.value != "c-pm-31" && code.value != "c-pm-32" && - code.value != "c-pm-38" - ? true - : false; -}); - -// เช็คว่าต้องไป gen report ที่ server เพิ่มไหม code ที่เพิ่มคือคำสั่งใหม่ที่ต้องไป gen report อีกรอบ -const genReportStatus = computed(() => { - return code.value == "c-pm-19" || - code.value == "c-pm-20" || - code.value == "c-pm-25" || - code.value == "c-pm-26" || - code.value == "c-pm-27" || - code.value == "c-pm-28" || - code.value == "c-pm-29" || - code.value == "c-pm-30" || - code.value == "c-pm-31" || - code.value == "c-pm-32" + code.value != "c-pm-38" && + code.value != "c-pm-41" ? true : false; }); @@ -127,20 +112,20 @@ const downloadCover = async (type: string) => { }; // โหลด เอกสารแนบท้าย -const downloadAttachment = async (type: string) => { - // if (type === "xlsx") { - // genReportXLSX( - // dataAttachmentxlxs.value, - // `เอกสารแนบท้าย คำสั่ง ${orderName.value}`, - // type - // ); - // } else { - genReport( - dataAttachment.value, - `เอกสารแนบท้าย คำสั่ง ${orderName.value}`, - type - ); - // } +const downloadAttachment = async (type: string, sub: string = "docx") => { + if (sub === "xlsx") { + genReportXLSX( + dataAttachment.value, + `เอกสารแนบท้าย คำสั่ง ${orderName.value}`, + type + ); + } else { + genReport( + dataAttachment.value, + `เอกสารแนบท้าย คำสั่ง ${orderName.value}`, + type + ); + } }; const dataCover = ref(); @@ -167,7 +152,7 @@ const fetchReportAttachment = async (type: string, orderId: string) => { await http .get(config.API.reportOrderAttachment(type, orderId, code.value)) .then(async (res) => { - genPDf(res.data.result); + genPDf(res.data.result, code.value == "c-pm-40" ? "xlsx" : "docx"); dataAttachment.value = res.data.result; }) .catch(async (e) => { @@ -187,9 +172,9 @@ const fetchReportAttachment = async (type: string, orderId: string) => { // }); }; -function genPDf(data: any) { +function genPDf(data: any, type: string = "docx") { axios - .post(config.API.reportTemplate + `/docx`, data, { + .post(config.API.reportTemplate + `/${type}`, data, { headers: { accept: "application/pdf", "content-Type": "application/json", @@ -539,7 +524,12 @@ const viewFileUpload = async (url: string) => { - - ไฟล์ .docx + + + + + ไฟล์ + {{ + code == "c-pm-40" ? ".xlsx" : ".docx" + }}