diff --git a/src/modules/13_salary/components/Command/detail.vue b/src/modules/13_salary/components/Command/detail.vue new file mode 100644 index 000000000..ed7c7467e --- /dev/null +++ b/src/modules/13_salary/components/Command/detail.vue @@ -0,0 +1,158 @@ + + + + \ No newline at end of file diff --git a/src/modules/13_salary/components/Command/step01.vue b/src/modules/13_salary/components/Command/step01.vue index ac2b1ab17..60310b31a 100644 --- a/src/modules/13_salary/components/Command/step01.vue +++ b/src/modules/13_salary/components/Command/step01.vue @@ -15,7 +15,6 @@ import type { OrederResult, } from "@/modules/10_order/interface/index/Main"; -import DialogHeader from "@/modules/04_registry/components/DialogHeader.vue"; import { useOrderPlacementDataStore } from "@/modules/10_order/store"; const DataStore = useOrderPlacementDataStore(); @@ -64,67 +63,10 @@ const byOrder = ref(""); const nameCommand = ref([]); const positionCommand = ref(""); -//form C-PM-01 - 04 -const examRound = ref(""); -const examRoundOption = ref([]); -const conclusionRegisterNo = ref(""); -const conclusionRegisterDate = ref(new Date()); -const conclusionResultNo = ref(""); -const conclusionResultDate = ref(new Date()); -// C-PM-05 - 06 -const meeting = ref(""); -const dateMeeting = ref(new Date()); -// C-PM-08 -const conclusionReturnNo = ref(""); -const conclusionReturnDate = ref(new Date()); -// C-PM-09 -const organizations = ref(""); -const order = ref(""); -const orderDate = ref(new Date()); -const book = ref(""); -const bookDate = ref(new Date()); -// C-PM-10 -const dialogVisible = ref(false); -const organizationsOld = ref(""); -const orderOld = ref(""); -const orderOldDate = ref(new Date()); -const locationname = ref(""); -const experimentOc = ref(""); -const experimentformDate = ref(new Date()); -const experimenttoDate = ref(new Date()); -const chairman = ref(""); -const director = ref(""); -const director2 = ref(""); - -// C-PM-11-12 -const committeeOc = ref(""); -const committeeOrder = ref(""); -const committeeDate = ref(new Date()); -// C-PM-13 -const receiveOc = ref(""); -// C-PM-14 -const transferOrganizationName = ref(""); -const conclusionReceive = ref(""); -const conclusionReceiveDate = ref(new Date()); -// C-PM-16 -const orderNumber = ref(); -const orderNumberDate = ref(new Date()); -// C-PM-18-20 -const fault = ref(""); -const guiltyBasis = ref(""); -const conclusionFireNo = ref(""); -const conclusionFireDate = ref(new Date()); -const conclusionFireResolution = ref(""); -// C-PM-24 -const conclusionTranferNo = ref(""); -const conclusionTranferDate = ref(new Date()); - -// C-PM-25-32 -const faultLevel = ref(""); -const caseFault = ref(""); -const result = ref(""); -const refRaw = ref(""); -const complaintId = ref(""); +// 33-34-35 +const input33 = ref(""); +const input34 = ref(""); +const input35 = ref(""); const typeOrderFilter = ref({ typeOrderOption: [], @@ -155,18 +97,7 @@ watch(nameCommand, async () => { } }); -const commandCodes = ref([ - "C-PM-19", - "C-PM-20", - "C-PM-25", - "C-PM-26", - "C-PM-27", - "C-PM-28", - "C-PM-29", - "C-PM-30", - "C-PM-31", - "C-PM-32", -]); +const commandCodes = ref(["C-PM-33", "C-PM-34", "C-PM-35"]); // เรียกคำสั่ง const fecthTypeOption = async (actions: string) => { showLoader(); @@ -219,7 +150,6 @@ const fetchdetailOrder = async () => { const data = res.data.result; const orderTypeCode = await data.orderTypeCode.toUpperCase(); - await optionsData(orderTypeCode); typeOrder.value = typeOrderOption.value.find( (e) => e.id === data.orderTypeValue @@ -231,66 +161,6 @@ const fetchdetailOrder = async () => { byOrder.value = data.orderBy; nameCommand.value = data.signatoryBy; positionCommand.value = data.signatoryPosition; - examRound.value = data.examRound; - conclusionRegisterNo.value = data.conclusionRegisterNo; - conclusionRegisterDate.value = data.conclusionRegisterDate; - conclusionResultNo.value = data.conclusionResultNo; - conclusionResultDate.value = data.conclusionResultDate; - // 05 -06 - meeting.value = data.conclusionMeetingNo; - dateMeeting.value = data.conclusionMeetingDate; - // 08 - conclusionReturnNo.value = data.conclusionReturnNo; - conclusionReturnDate.value = data.conclusionReturnDate; - //09 - organizations.value = data.sourceOrganizationName; - order.value = data.conclusionReturnNo; - orderDate.value = data.conclusionReturnDate; - book.value = data.militaryCommandNo; - bookDate.value = data.militaryCommanDate; - //10 - if (data.orderTypeCode === "c-pm-10") { - nodeTree(); - } - organizationsOld.value = data.placementCommandIssuer; - orderOld.value = data.placementCommandNo; - orderOldDate.value = data.placementCommandDate; - locationname.value = data.placementPositionName; - experimentOc.value = data.placementOrganizationName; - experimentformDate.value = data.probationStartDate; - experimenttoDate.value = data.probationEndDate; - chairman.value = data.chairManFullName; - director.value = data.member1FullName; - director2.value = data.member2FullName; - //11-12 - committeeOc.value = data.placementCommandIssuer; - committeeOrder.value = data.placementCommandNo; - committeeDate.value = data.placementCommandDate; - //13 - receiveOc.value = data.receiveOrganizationName; - //14 - transferOrganizationName.value = data.transferOrganizationName; - conclusionReceive.value = data.conclusionReceiveNo; - conclusionReceiveDate.value = data.conclusionReceiveDate; - //16 - orderNumber.value = data.govAidCommandNo; - orderNumberDate.value = data.govAidCommandDate; - //18-20 - fault.value = data.fault; - guiltyBasis.value = data.guiltyBasis; - conclusionFireNo.value = data.conclusionFireNo; - conclusionFireDate.value = data.conclusionFireDate; - conclusionFireResolution.value = data.conclusionFireResolution; - // 24 - conclusionTranferNo.value = data.conclusionTranferNo; - conclusionTranferDate.value = data.conclusionTranferDate; - - // 19, 20 และ 25-32 - faultLevel.value = data.faultLevel; - caseFault.value = data.caseFault; - result.value = data.result; - refRaw.value = data.refRaw; - complaintId.value = data.complaintId; }) .catch((e) => { messageError($q, e); @@ -312,158 +182,26 @@ const fecthCommand = async () => { }); }; -const optionsData = async (commandCode: string) => { - const orderTypeCode = await commandCode.toUpperCase(); - if (orderTypeCode === "C-PM-10") { - nodeTree(); - } - nameOrder.value = DataStore.nameOrderFilter(orderTypeCode); +function casePm(val: string){ + switch (val) { + case "C-PM-33": + return "เลื่อนเงินเดือนและให้ข้าราชการกรุงเทพมหานครสามัญ ได้รับเงินเดือนสูงกว่าขั้นสูงของตำแหน่งที่ได้รับแต่งตั้ง"; + case "C-PM-34": + return "ให้ข้าราชการกรุงเทพมหานครสามัญได้รับค่าตอบแทนพิเศษ"; + case "C-PM-35": + return `เลื่อนเงินเดือนและให้ข้าราชการกรุงเทพมหานครสามัญที่เกษียณอายุราชการ ในสิ้นปีงบประมาณ พ.ศ. ${new Date().getFullYear()+543} ได้รับเงินเดือนสูงกว่าชั้นสูงของตำแหน่งที่ได้รับแต่งตั้ง`; + default: + return null; + }} - // บรรจุ แต่งตั้ง ย้าย 01 - 04 - if ( - orderTypeCode == "C-PM-01" || - orderTypeCode == "C-PM-02" || - orderTypeCode == "C-PM-03" || - orderTypeCode == "C-PM-04" - ) { - fecthExamRoundOption(orderTypeCode); - } - - // คำสั่งวินัย - if ( - route.name == "disciplineOrderDatail" || - route.name == "disciplineOrderAdd" - ) { - await getComplaint(); - } - - // console.log(DataStore.complaintLists) - DataStore.complaintOption = []; - if (orderTypeCode == "C-PM-25" || orderTypeCode == "C-PM-26") { - await DataStore.complaintLists - .filter((x: complaintLists) => x.isDisciplinary === true) - .map((val: complaintLists) => { - DataStore.complaintOption.push({ id: val.id, name: val.title }); - }); - } else if (orderTypeCode == "C-PM-32") { - await DataStore.complaintLists - .filter( - (x: complaintLists) => - x.isInvestigate === true || - x.isDisciplinary === true || - x.isResult === true - ) - .map((val: complaintLists) => { - DataStore.complaintOption.push({ id: val.id, name: val.title }); - }); - } else if ( - orderTypeCode == "C-PM-19" || - orderTypeCode == "C-PM-20" || - orderTypeCode == "C-PM-27" || - orderTypeCode == "C-PM-28" || - orderTypeCode == "C-PM-29" || - orderTypeCode == "C-PM-30" || - orderTypeCode == "C-PM-31" - ) { - await DataStore.complaintLists - .filter((x: complaintLists) => x.isResult === true) - .map((val: complaintLists) => { - DataStore.complaintOption.push({ id: val.id, name: val.title }); - }); - } -}; - -const selectCMP = async (selectOrder: OrederResult) => { +async function selectCMP(selectOrder: OrederResult) { if (selectOrder != null) { const orderTypeCode = await selectOrder.commandCode.toUpperCase(); - optionsData(orderTypeCode); + nameOrder.value = casePm(orderTypeCode) } - //01-04 - examRound.value = ""; - conclusionRegisterNo.value = ""; - conclusionRegisterDate.value = new Date(); - conclusionResultNo.value = ""; - conclusionResultDate.value = new Date(); - // 05-06 - meeting.value = ""; - dateMeeting.value = new Date(); - //08 - conclusionReceive.value = ""; - conclusionReceiveDate.value = new Date(); - //09 - organizations.value = ""; - order.value = ""; - orderDate.value = new Date(); - book.value = ""; - bookDate.value = new Date(); - //10 - organizationsOld.value, (orderOld.value = ""); - orderOldDate.value = new Date(); - locationname.value = ""; - experimentOc.value = ""; - experimentformDate.value = new Date(); - experimenttoDate.value = new Date(); - chairman.value = ""; - director.value = ""; - director2.value = ""; - //11-12 - committeeOc.value = ""; - committeeOrder.value = ""; - committeeDate.value = new Date(); - //13 - receiveOc.value = ""; - //14 - transferOrganizationName.value = ""; - conclusionReceive.value = ""; - conclusionReceiveDate.value = new Date(); - //16 - orderNumber.value = ""; - orderNumberDate.value = new Date(); - //18-20 - fault.value = ""; - guiltyBasis.value = ""; - conclusionFireNo.value = ""; - conclusionFireDate.value = new Date(); - conclusionFireResolution.value = ""; - // 24 - conclusionTranferNo.value = ""; - conclusionTranferDate.value = new Date(); - // 19, 20 & 25-32 - faultLevel.value = ""; - caseFault.value = ""; - result.value = ""; - refRaw.value = ""; - - complaintId.value = ""; -}; - -// เรียกรอบการสอบ -const fecthExamRoundOption = async (commandCode: string) => { - await http - .get(config.API.examroundOrder(commandCode)) - .then((res) => { - examRoundOption.value = res.data.result; - }) - .catch((e) => { - messageError($q, e); - }); -}; - -/** - * ดึงรายการเรื่องร้องเรียนจาก API - */ -async function getComplaint() { - await http - .get(config.API.disciplineReportList) - .then((res: any) => { - const dataArr = res.data.result; - DataStore.complaintLists = dataArr; - }) - .catch((e) => { - messageError($q, e); - }); } + // บันทึกข้อมูล const submit = async () => { let signBy = null; @@ -497,121 +235,16 @@ const submit = async () => { signatoryPosition: positionCommand.value, }; if ( - typeOrder.value.commandCode == "C-PM-01" || - typeOrder.value.commandCode == "C-PM-02" || - typeOrder.value.commandCode == "C-PM-03" || - typeOrder.value.commandCode == "C-PM-04" + typeOrder.value.commandCode == "C-PM-33" || + typeOrder.value.commandCode == "C-PM-34" || + typeOrder.value.commandCode == "C-PM-35" ) { Object.assign(formdata, { - examRound: examRound.value, - conclusionRegisterNo: conclusionRegisterNo.value, - conclusionRegisterDate: conclusionRegisterDate.value, - conclusionResultNo: conclusionResultNo.value.toString(), - conclusionResultDate: conclusionResultDate.value, - }); - } else if ( - typeOrder.value.commandCode == "C-PM-05" || - typeOrder.value.commandCode == "C-PM-06" - ) { - Object.assign(formdata, { - conclusionMeetingNo: meeting.value, - conclusionMeetingDate: dateMeeting.value, - }); - } else if (typeOrder.value.commandCode == "C-PM-08") { - Object.assign(formdata, { - conclusionReturnNo: conclusionReturnNo.value, - conclusionReturnDate: conclusionReturnDate.value, - }); - } else if (typeOrder.value.commandCode == "C-PM-09") { - Object.assign(formdata, { - 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, { - 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, { - placementCommandIssuer: committeeOc.value, - placementCommandNo: committeeOrder.value, - placementCommandDate: committeeDate.value, - }); - } else if (typeOrder.value.commandCode == "C-PM-13") { - Object.assign(formdata, { - receiveOrganizationName: receiveOc.value, - }); - } else if (typeOrder.value.commandCode == "C-PM-14") { - Object.assign(formdata, { - transferOrganizationName: transferOrganizationName.value, - conclusionReceiveNo: conclusionReceive.value, - conclusionReceiveDate: conclusionReceiveDate.value, - }); - } else if (typeOrder.value.commandCode == "C-PM-16") { - Object.assign(formdata, { - govAidCommandNo: orderNumber.value, - govAidCommandDate: orderNumberDate.value, - }); - } else if (typeOrder.value.commandCode == "C-PM-18") { - Object.assign(formdata, { - fault: fault.value, - guiltyBasis: guiltyBasis.value, - conclusionFireNo: conclusionFireNo.value, - conclusionFireDate: conclusionFireDate.value, - conclusionFireResolution: conclusionFireResolution.value, - }); - } else if ( - typeOrder.value.commandCode == "C-PM-19" || - typeOrder.value.commandCode == "C-PM-20" - ) { - Object.assign(formdata, { - complaintId: complaintId.value, - fault: "-", - guiltyBasis: "-", - conclusionFireNo: conclusionFireNo.value, - conclusionFireDate: conclusionFireDate.value, - conclusionFireResolution: conclusionFireResolution.value, - faultLevel: faultLevel.value, - caseFault: caseFault.value, - result: result.value, - refRaw: refRaw.value, - }); - } else if (typeOrder.value.commandCode == "C-PM-24") { - Object.assign(formdata, { - conclusionTranferNo: conclusionTranferNo.value, - conclusionTranferDate: conclusionTranferDate.value, - }); - } else if ( - typeOrder.value.commandCode == "C-PM-25" || - typeOrder.value.commandCode == "C-PM-26" || - typeOrder.value.commandCode == "C-PM-27" || - typeOrder.value.commandCode == "C-PM-28" || - typeOrder.value.commandCode == "C-PM-29" || - typeOrder.value.commandCode == "C-PM-30" || - typeOrder.value.commandCode == "C-PM-31" || - typeOrder.value.commandCode == "C-PM-32" - ) { - Object.assign(formdata, { - complaintId: complaintId.value, - faultLevel: faultLevel.value, - caseFault: caseFault.value, - result: result.value, - refRaw: refRaw.value, + // examRound: examRound.value, + // conclusionRegisterNo: conclusionRegisterNo.value, + // conclusionRegisterDate: conclusionRegisterDate.value, + // conclusionResultNo: conclusionResultNo.value.toString(), + // conclusionResultDate: conclusionResultDate.value, }); } @@ -640,14 +273,8 @@ const createListOrder = async (formData: Object, type: string) => { const data = res.data.result; localStorage.setItem("orderId", data.id); - if ( - route.name == "disciplineOrderDatail" || - route.name == "disciplineOrderAdd" - ) { - router.push(`/discipline-order/detail/${data.id}?step=${2}`); // สร้างเสร็จแล้วให้ไป Step 2 - } else { - router.push(`/order/detail/${data.id}?step=${2}`); // สร้างเสร็จแล้วให้ไป Step 2 - } + router.push(`/salary/command/detail/${data.id}?step=${2}`); // สร้างเสร็จแล้วให้ไป Step 2 + next(); success($q, "บันทึกข้อมูลสำเร็จ"); }) @@ -658,6 +285,7 @@ const createListOrder = async (formData: Object, type: string) => { hideLoader(); }); }; + const updateOrder = async (formData: Object, orderId: string, type: string) => { showLoader(); await http @@ -673,144 +301,25 @@ const updateOrder = async (formData: Object, orderId: string, type: string) => { hideLoader(); }); }; -// dialog 10 -const search = ref(""); -const nodesTree = ref([]); -const expanded = ref([]); -const selected = ref(""); -const selectedModal = ref([]); -const visibleColumnsModal = ref(["no", "idCard", "name", "position"]); -const columnsModal = ref([ - { - name: "no", - align: "left", - label: "ลำดับ", - field: "no", - sortable: true, - sort: (a: string, b: string) => - a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), - }, - { - name: "idCard", - align: "left", - label: "เลขประจำตัวประชาชน", - field: "idCard", - sortable: true, - sort: (a: string, b: string) => - a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), - }, - { - name: "name", - align: "left", - label: "ชื่อ-นามสกุล", - field: "name", - sortable: true, - sort: (a: string, b: string) => - a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), - }, - { - name: "position", - align: "left", - label: "ตำแหน่ง", - field: "position", - sortable: true, - sort: (a: string, b: string) => - a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), - }, -]); -const rowsModal = ref([]); -const clickAction = ref(""); -const filterModal = ref(""); -// โหลด tree -const nodeTree = async () => { - showLoader(); - await http - .get(config.API.profileOrganizRoot) - .then((res) => { - const data = res.data.result; - nodesTree.value = data; - if (data.length > 0) { - expanded.value = [data[0].id]; - } - }) - .catch((e) => { - messageError($q, e); - }) - .finally(() => { - hideLoader(); - }); -}; -// เลือกหน่วยงาน -const onSelected = async (id: string) => { - await listModal(id); -}; -// เรียกรายชื่อกรรมการ -const listModal = async (id: string) => { - showLoader(); - await http - .get(config.API.copyOrderPersonsId(id)) - .then((res) => { - const data = res.data.result; - let list: ResponseOrganiz[] = []; - data.map((r: ResponseOrganiz) => { - list.push({ - firstName: r.firstName ?? "", - idCard: r.idCard ?? "", - lastName: r.lastName ?? "", - name: r.name ?? "", - position: r.position ?? "", - prefixId: r.prefixId ?? "", - profileId: r.profileId ?? "", - unit: r.unit ?? "", - }); - }); - rowsModal.value = list; - }) - .catch((e) => { - messageError($q, e); - }) - .finally(async () => { - hideLoader(); - }); -}; -// เปิด POPUP เลือกรายชื่อตามหน่วยงาน -const openDialog = (action: string) => { - dialogVisible.value = true; - clickAction.value = action; - selectedModal.value = []; -}; -// บันทักราชชื่อกรรมการ -const clickSavelist = () => { - if (selectedModal.value.length > 0) { - if (clickAction.value === "chairman") { - chairman.value = selectedModal.value[0].name; - } else if (clickAction.value === "director") { - director.value = selectedModal.value[0].name; - } else if (clickAction.value === "director2") { - director2.value = selectedModal.value[0].name; - } - dialogVisible.value = false; - } else dialogMessageNotify($q, "โปรดเลือกรายชื่อ"); -}; -const filterSelector = (val: any, update: Function, fullname: any) => { +function filterSelector(val: any, update: Function, fullname: any) { update(() => { typeOrderOption.value = typeOrderFilter.value.filter( (v: any) => v.fullname.toLowerCase().indexOf(val.toLowerCase()) > -1 ); }); -}; +} /** * class จัดรูปแบบแสดงระหว่างข้อมูลที่แก้ไขหรือแสดงเฉยๆ * @param val ข้อมูล input สำหรับแก้ไขหรือไม่ */ -const getClass = (val: boolean) => { +function getClass(val: boolean) { return { "full-width inputgreen cursor-pointer": val, "full-width cursor-pointer": !val, }; -}; +}