From c99f221c8360b9ee844ea0ea31561fd636f78fdd Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Fri, 25 Aug 2023 17:02:18 +0700 Subject: [PATCH] =?UTF-8?q?api=20=E0=B8=AD=E0=B8=AD=E0=B8=81=E0=B8=84?= =?UTF-8?q?=E0=B8=B3=E0=B8=AA=E0=B8=B1=E0=B9=88=E0=B8=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/05_placement/api.placement.ts | 10 +- .../10_order/components/step/step01.vue | 1480 +++++++++++++---- 2 files changed, 1120 insertions(+), 370 deletions(-) diff --git a/src/api/05_placement/api.placement.ts b/src/api/05_placement/api.placement.ts index f83d400c7..c8e627c3f 100644 --- a/src/api/05_placement/api.placement.ts +++ b/src/api/05_placement/api.placement.ts @@ -72,7 +72,7 @@ export default { prevStep: (orderId: string) => `${order}/order/prev/${orderId}`, executeOrder: (orderId: string) => `${order}/order/execute/${orderId}`, createOrder: () => `${order}/order/detail`, - examroundOrder: () => `${order}/order/detail/exam-round`, + examroundOrder: (commandCode: string) => `${order}/order/detail/exam-round/${commandCode}`, personsOrder: (orderId: string) => `${order}/order/persons/${orderId}`, //ข้อมูลเลือกรายชื่อออกคำสั่ง, ลบรายชื่อ personsselectedOrder: (orderId: string) => `${order}/order/persons-selected/${orderId}`, @@ -150,5 +150,11 @@ export default { otherReport: (id: string) => `${placemenOther}/report/${id}`, otherByid: (id: string) => `${placemenOther}/${id}`, - userPlacement:(id:string) => `${placement}/user/${id}` + userPlacement: (id: string) => `${placement}/user/${id}`, + + // orderForm + orderCPM: (type: string) => `${order}/order/${type}/detail`, + orderCPMUpdate: (type: string, id: string) => `${order}/order/${type}/detail/${id}`, + + }; diff --git a/src/modules/10_order/components/step/step01.vue b/src/modules/10_order/components/step/step01.vue index cca81ea63..84aa15ad2 100644 --- a/src/modules/10_order/components/step/step01.vue +++ b/src/modules/10_order/components/step/step01.vue @@ -217,15 +217,9 @@ watch(byOrder, async () => { }); watch(nameCommand, async () => { - // console.log(nameCommand.value); - // console.log(positionCommand.value); - if (positionCommand.value === "" || positionCommand.value === undefined) { positionCommand.value = nameCommand.value.positionName; } - // if (nameCommand.value === "") { - // positionCommand.value = ""; - // } }); const fecthTypeOption = async (actions: string) => { showLoader(); @@ -248,7 +242,6 @@ const fecthTypeOption = async (actions: string) => { await fetchdetailOrder(); } await fecthCommand(); - await fecthExamRoundOption(); hideLoader(); }); }; @@ -278,12 +271,12 @@ const fetchdetailOrder = async () => { conclusionRegisterDate.value = data.conclusionRegisterDate; conclusionResultNo.value = data.conclusionResultNo; conclusionResultDate.value = data.conclusionResultDate; + fecthExamRoundOption(data.orderTypeCode); }) .catch((e) => { messageError($q, e); }) .finally(async () => { - await fecthExamRoundOption(); await fecthCommand(); hideLoader(); }); @@ -299,29 +292,35 @@ const fecthCommand = async () => { console.log(e); }); }; -const fecthExamRoundOption = async () => { +const selectCMP = (selectOrder: any) => { + fecthExamRoundOption(selectOrder.commandCode); +}; +const fecthExamRoundOption = async (commandCode: string) => { await http - .get(config.API.examroundOrder()) + .get(config.API.examroundOrder(commandCode)) .then((res) => { examRoundOption.value = res.data.result; - // console.log(examRoundOption.value); }) - .catch((e) => { }); + .catch((e) => { + console.log(e); + }); }; const submit = async () => { - console.log("nameCommand ===>", nameCommand.value); - let signBy = null; if (!nameCommand.value.length) { signBy = await nameCommand.value.name; } else { - const name2 = await CommandOption.value.find((x: any) => x.id == nameCommand.value.id); + const name2 = await CommandOption.value.find( + (x: any) => x.id == nameCommand.value.id + ); signBy = await name2?.name; console.log("signBy", signBy); } - const orderByOrganizationName = await byOrderOption.value.find((x:any)=>x.id == byOrder.value)?.name; + const orderByOrganizationName = await byOrderOption.value.find( + (x: any) => x.id == byOrder.value + )?.name; const formdata = { orderTypeValue: typeOrder.value.id, @@ -336,25 +335,6 @@ const submit = async () => { signatoryBy: signBy, signatoryPosition: positionCommand.value, }; - - // { - // "orderTypeValue": "3fa85f64-5717-4562-b3fc-2c963f66afa6", - // "orderTitle": "string", - // "orderNo": "string", - // "orderYear": 0, - // "orderDate": "2023-08-21T09:46:54.354Z", - // "orderBy": "3fa85f64-5717-4562-b3fc-2c963f66afa6", - // "orderByOrganizationName": "string", - // "signatoryBy": "string", - // "signatoryPosition": "string", - // "examRound": "3fa85f64-5717-4562-b3fc-2c963f66afa6", - // "registerPosition": "string", - // "conclusionRegisterNo": "string", - // "conclusionRegisterDate": "2023-08-21T09:46:54.354Z", - // "conclusionResultNo": "string", - // "conclusionResultDate": "2023-08-21T09:46:54.354Z" - // } - if ( typeOrder.value.commandCode == "C-PM-01" || typeOrder.value.commandCode == "C-PM-02" || @@ -369,97 +349,96 @@ const submit = async () => { conclusionResultDate: conclusionResultDate.value, }); } else if ( - typeOrder.value.commandCode == "C-PM-04" || - typeOrder.value.commandCode == "C-PM-05" + typeOrder.value.commandCode == "C-PM-05" || + typeOrder.value.commandCode == "C-PM-06" ) { Object.assign(formdata, { - conclusionRegisterNo: conclusion1.value, - conclusionRegisterDate: conclusionDate1.value, - conclusionResultNo: conclusion2.value, - conclusionResultDate: conclusionDate2.value, - meeting: meeting.value, - dateMeeting: dateMeeting.value, - }); - } else if (typeOrder.value.commandCode == "C-PM-07") { - Object.assign(formdata, { - conclusionRelocation1: conclusionRelocation1.value, - conclusionRelocationDate1: conclusionRelocationDate1.value, - conclusionRelocation2: conclusionRelocation2.value, - conclusionRelocationDate2: conclusionRelocationDate2.value, + conclusionMeetingNo: meeting.value, + conclusionMeetingDate: dateMeeting.value, }); } else if (typeOrder.value.commandCode == "C-PM-08") { Object.assign(formdata, { - conclusion: conclusion.value, - conclusionDate: conclusionDate.value, - conclusionLeave: conclusionLeave.value, - conclusionLeaveDate: conclusionLeaveDate.value, - conclusionReceive: conclusionReceive.value, - conclusionReceiveDate: conclusionReceiveDate.value, + conclusionReturnNo: conclusionReceive.value, + conclusionReturnDate: conclusionReceiveDate.value, }); } else if (typeOrder.value.commandCode == "C-PM-09") { Object.assign(formdata, { - organizations: organizations.value, - order: order.value, - orderDate: orderDate.value, - book: book.value, - bookDate: bookDate.value, + sourceOrganizationName: organizations.value, + conclusionReturnNo: order.value, + conclusionReturnDate: orderDate.value, + militaryCommandNo: book.value, + militaryCommandDate: bookDate.value, }); } else if (typeOrder.value.commandCode == "C-PM-10") { Object.assign(formdata, { - organizationsOld: organizationsOld.value, - orderOld: orderOld.value, - orderOldDate: orderOldDate.value, - locationname: locationname.value, - experimentOc: experimentOc.value, - experimentformDate: experimentformDate.value, - experimenttoDate: experimenttoDate.value, - chairman: chairman.value, - director: director.value, - director2: director2.value, + placementCommandIssuer: organizationsOld.value, + placementCommandNo: orderOld.value, + placementCommandDate: orderOldDate.value, + placementPositionName: locationname.value, + placementOrganizationName: experimentOc.value, + probationStartDate: experimentformDate.value, + probationEndDate: experimenttoDate.value, + chairManFullName: chairman.value, + member1FullName: director.value, + member2FullName: director2.value, }); } else if ( typeOrder.value.commandCode == "C-PM-11" || typeOrder.value.commandCode == "C-PM-12" ) { Object.assign(formdata, { - committeeOc: committeeOc.value, - committeeOrder: committeeOrder.value, - committeeDate: committeeDate.value, + placementCommandIssuer: committeeOc.value, + placementCommandNo: committeeOrder.value, + placementCommandDate: committeeDate.value, }); } else if (typeOrder.value.commandCode == "C-PM-13") { Object.assign(formdata, { - receiveOc: receiveOc.value, + receiveOrganizationName: receiveOc.value, }); } else if (typeOrder.value.commandCode == "C-PM-14") { Object.assign(formdata, { - conclusionReceive: conclusionReceive.value, + transferOrganizationName: "", + conclusionReceiveNo: conclusionReceive.value, conclusionReceiveDate: conclusionReceiveDate.value, }); } else if (typeOrder.value.commandCode == "C-PM-16") { Object.assign(formdata, { - orderNumber: orderNumber.value, - orderNumberDate: orderNumberDate.value, + govAidCommandNo: orderNumber.value, + govAidCommandDate: orderNumberDate.value, + }); + } else if ( + typeOrder.value.commandCode == "C-PM-18" || + typeOrder.value.commandCode == "C-PM-19" || + typeOrder.value.commandCode == "C-PM-20" + ) { + Object.assign(formdata, { + fault: "", + guiltyBasis: "", + conclusionFireNo: "", + conclusionFireDate: new Date(), + conclusionFireResolution: "", }); } + console.log(formdata); await myForm.value!.validate().then((result: boolean) => { if (result) { dialogConfirm($q, () => { if (!orderId) { - createListOrder(formdata); + createListOrder(formdata, typeOrder.value.commandCode); } else { let orderIdString = orderId.toString(); - updateOrder(formdata, orderIdString); + updateOrder(formdata, orderIdString, typeOrder.value.commandCode); } }); } }); }; -const createListOrder = async (formData: Object) => { +const createListOrder = async (formData: Object, type: string) => { showLoader(); await http - .post(config.API.createOrder(), formData) + .post(config.API.orderCPM(type), formData) .then((res) => { const data = res.data.result; localStorage.setItem("orderId", data.id); @@ -474,10 +453,10 @@ const createListOrder = async (formData: Object) => { hideLoader(); }); }; -const updateOrder = async (formData: Object, orderId: string) => { +const updateOrder = async (formData: Object, orderId: string, type: string) => { showLoader(); await http - .put(config.API.detailOrder(orderId), formData) + .put(config.API.orderCPMUpdate(type, orderId), formData) .then((res) => { console.log(res); next(); @@ -508,38 +487,86 @@ const getClass = (val: boolean) => {
- +
- +
- +
- +
- +
- + @@ -547,10 +574,22 @@ const getClass = (val: boolean) => { {{ parseInt(value + 543) }}