From 1530da36cf3925e9db412e370235003fba0c41fc Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Tue, 19 Sep 2023 14:58:16 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B8=84=E0=B8=A3=E0=B8=B7=E0=B9=88?= =?UTF-8?q?=E0=B8=AD=E0=B8=87=E0=B8=A3=E0=B8=B2=E0=B8=8A=E0=B8=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/1_Proposals/addProposals.vue | 78 ++-- .../components/1_Proposals/listProposals.vue | 38 +- .../07_insignia/components/2_Manage/Tab1.vue | 125 ++---- .../07_insignia/components/2_Manage/Tab2.vue | 2 +- .../07_insignia/components/2_Manage/Tab4.vue | 8 +- .../components/2_Manage/listManage.vue | 53 ++- .../components/3_result/DialogForm.vue | 3 - .../components/4_Allocate/DialogEdit.vue | 4 +- .../components/4_Allocate/DialogForm.vue | 1 - .../components/4_Allocate/Main.vue | 14 +- .../components/4_Allocate/OrgList.vue | 5 +- .../components/5_Borrow/DialogForm.vue | 4 +- .../07_insignia/components/5_Borrow/Main.vue | 19 +- src/modules/07_insignia/components/Coin.vue | 10 - .../07_insignia/components/VatInsignia.vue | 409 ------------------ .../components/report/ReportView.vue | 25 -- .../components/report/Report_01.vue | 22 +- .../components/report/Report_02.vue | 47 +- src/modules/07_insignia/router.ts | 24 +- src/modules/07_insignia/store.ts | 22 +- src/modules/07_insignia/storeBrrow.ts | 2 - src/modules/07_insignia/views/ResultPage.vue | 21 +- 22 files changed, 159 insertions(+), 777 deletions(-) delete mode 100644 src/modules/07_insignia/components/VatInsignia.vue diff --git a/src/modules/07_insignia/components/1_Proposals/addProposals.vue b/src/modules/07_insignia/components/1_Proposals/addProposals.vue index 23ebbdd74..d2871ab56 100644 --- a/src/modules/07_insignia/components/1_Proposals/addProposals.vue +++ b/src/modules/07_insignia/components/1_Proposals/addProposals.vue @@ -15,7 +15,7 @@ const { hideLoader, dialogConfirm, success, - dialogMessageNotify + dialogMessageNotify, } = mixin; const router = useRouter(); const route = useRoute(); @@ -34,36 +34,38 @@ const options = ref([ { label: "รอบการเสนอขอพระราชทานเครื่องราชรอบที่ 1", value: 1 }, { label: "รอบการเสนอขอพระราชทานเครื่องราชรอบที่ 2", value: 2 }, ]); + onMounted(async () => { - await fetchData(); -}); -const fetchData = async () => { if (route.params.id) { - edit.value = true; - showLoader(); - await http - .get(config.API.getRoundInsignia(id.value)) - .then((res) => { - const data = res.data.result; - id.value = data.period_id; - roundInsig.value = - options.value.filter((r: any) => r.value == data.period_round) - .length > 0 - ? options.value.filter((r: any) => r.value == data.period_round)[0] - : null; - yearly.value = data.period_year; - datelast.value = data.period_amount; - dateStart.value = new Date(data.period_start); - dateEnd.value = new Date(data.period_end); - files.value = data.period_doc; - }) - .catch((e) => { - messageError($q, e); - }) - .finally(() => { - hideLoader(); - }); + await fetchData(); } +}); + +const fetchData = async () => { + edit.value = true; + showLoader(); + await http + .get(config.API.getRoundInsignia(id.value)) + .then((res) => { + const data = res.data.result; + id.value = data.period_id; + roundInsig.value = + options.value.filter((r: any) => r.value == data.period_round).length > + 0 + ? options.value.filter((r: any) => r.value == data.period_round)[0] + : null; + yearly.value = data.period_year; + datelast.value = data.period_amount; + dateStart.value = new Date(data.period_start); + dateEnd.value = new Date(data.period_end); + files.value = data.period_doc; + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); }; const fileUploadDoc = async (files: any) => { @@ -92,11 +94,12 @@ const editData = async (id: string) => { formData.append("endDate", dateToISO(dateEnd.value)); } formData.append("file", files.value); - console.log(formData); showLoader(); await http .put(config.API.editRoundInsignia(id), formData) - .then(async () => {}) + .then(() => { + success($q, "แก้ไขข้อมูลสำเร็จ"); + }) .catch((e) => { messageError($q, e); }) @@ -104,17 +107,16 @@ const editData = async (id: string) => { hideLoader(); clickBack(); }); - console.log(formData); }; const checkSave = () => { if (myForm.value !== null) { myForm.value.validate().then(async (success) => { if (success) { dialogConfirm($q, () => SaveData()); - }else { - dialogMessageNotify($q,"กรุณาเลือกรอบการเสนอขอพระราชทานเครื่องราชฯ") + } else { + dialogMessageNotify($q, "กรุณาเลือกรอบการเสนอขอพระราชทานเครื่องราชฯ"); } - }) + }); } }; const SaveData = async () => { @@ -130,11 +132,9 @@ const updateDateRange = () => { if (roundInsig.value.value == 1) { dateStart.value = new Date(new Date().getFullYear(), 9, 1); dateEnd.value = new Date(new Date().getFullYear() + 1, 3, 29); - console.log(1); } else if (roundInsig.value.value == 2) { dateStart.value = new Date(new Date().getFullYear(), 3, 29); dateEnd.value = new Date(new Date().getFullYear(), 4, 29); - console.log(2); } }; @@ -143,7 +143,6 @@ const addData = async () => { const name = `รอบการเสนอขอพระราชทานเครื่องราชรอบที่ ${ roundInsig.value.value } ปี ${yearly.value + 543} `; - console.log(name); formData.append("name", name); formData.append("year", yearly.value.toString()); formData.append("amount", datelast.value.toString()); @@ -329,7 +328,9 @@ const clickBack = () => { outlined v-model="datelast" label="จำนวนวันแจ้งเตือนก่อนวันสิ้นสุด" + mask="###" /> + { lazy-rules accept=".pdf,.xlsx,.doc" > - diff --git a/src/modules/07_insignia/components/1_Proposals/listProposals.vue b/src/modules/07_insignia/components/1_Proposals/listProposals.vue index b5d1e46c8..a12376622 100644 --- a/src/modules/07_insignia/components/1_Proposals/listProposals.vue +++ b/src/modules/07_insignia/components/1_Proposals/listProposals.vue @@ -25,7 +25,6 @@ const visibleColumns = ref([ "period_year", "period_start", "period_end", - // "status", "statusRoyal", ]); //ค้นหา คอลัมน์ คอลัมน์ที่แสดง @@ -61,8 +60,8 @@ const columns = ref([ field: "period_start", headerStyle: "font-size: 14px", style: "font-size: 14px", - // sort: (a: string, b: string) => - // a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), + sort: (a: string, b: string) => + a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), }, { name: "period_end", @@ -72,8 +71,8 @@ const columns = ref([ field: "period_end", headerStyle: "font-size: 14px", style: "font-size: 14px", - // sort: (a: string, b: string) => - // a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), + sort: (a: string, b: string) => + a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), }, { name: "statusRoyal", @@ -95,6 +94,7 @@ onMounted(async () => { await fetchData(); }); +//เรียกจาก API รายการรอบการเสนอขอพระราชทานเครื่องราชอิสริยาภรณ์ const fetchData = async () => { showLoader(); await http @@ -114,7 +114,6 @@ const fetchData = async () => { period_doc: e.period_doc, period_status: e.period_status.result, })); - console.log(rows.value); }) .catch((e) => { messageError($q, e); @@ -145,16 +144,11 @@ const clickDelete = (id: string) => { }); }); }; - +// เพิ่มรอบการเสนอขอพระราชทานเครื่องราชอิสริยาภรณ์ const clickAdd = () => { router.push({ name: "roundAdd" }); }; -const clickProposals = (file: string) => { - if (file !== null) { - window.open(file); - } -}; const clickListInsignia = async (propsId: string) => { dialogConfirm( $q, @@ -165,6 +159,7 @@ const clickListInsignia = async (propsId: string) => { "ต้องการยืนยันการคำนวณราชชื่อผู้ได้รับเครื่องราชนี้หรือไม่ ?" ); }; +// เรียกจาก API ข้อมูลผู้ได้รับเครื่องราชฯ const getRequest = async (id: string) => { showLoader(); await http @@ -179,16 +174,6 @@ const getRequest = async (id: string) => { await fetchData(); }); }; -// const downloadFile = (response: any, name: string) => { -// const link = document.createElement("a"); -// var fileName = name; -// link.href = response; -// link.setAttribute("target", "_blank"); -// link.setAttribute("download", fileName); -// document.body.appendChild(link); -// link.click(); -// document.body.removeChild(link); -// }; // ค้นหาในตาราง const filterKeyword = ref(""); @@ -201,7 +186,7 @@ const resetFilter = () => { const attrs = ref(useAttrs()); const paging = ref(true); const pagination = ref({ - sortBy: "desc", + // sortBy: "desc", descending: false, page: 1, rowsPerPage: 10, @@ -375,7 +360,7 @@ const paginationLabel = (start: string, end: string, total: string) => { ผู้ได้รับเครื่องราชฯ - + { icon="mdi-file-download" :href="props.row.period_doc" > - - ดาวน์โหลดเอกสารประกอบ + (false); const modelPopupReject = ref(false); const modelPopupDelete = ref(false); const modalAdd = ref(false); @@ -233,6 +232,7 @@ onMounted(async () => { } } }); +// เช็คสถานนะแสดงปุ่มเพิ่ม const checkStatus = computed(() => { if ( roleDataStore.insignia1Role && @@ -241,6 +241,7 @@ const checkStatus = computed(() => { return true; } else return false; }); +// เลืแกหน่วยงาน const changtypeOc = () => { if (props.fecthInsigniaByOc) { props.fecthInsigniaByOc( @@ -252,26 +253,14 @@ const changtypeOc = () => { } DataStore.typeOc = organization.value; }; +// เพิ่มราชชื่อ const clickmodalAdd = () => { showLoader(); - fecthlistRetire(); fecthInsignia(); + fecthlistperson(DataStore.typeOc); insigniaType.value = ""; }; -// fecth profile -const fecthlistRetire = async () => { - await http - .get(config.API.profileOrganizRoot) - .then((res) => { - const id = res.data.result[0].id; - if (id !== "") { - fecthlistperson(id); - } - }) - .catch((e) => { - messageError($q, e); - }); -}; +// เรียกรายชื่อข้าราชการตามหน่วยงานที่จะเพิ่ม const fecthlistperson = async (id: string) => { let data = [{}]; data = [ @@ -295,10 +284,9 @@ const fecthlistperson = async (id: string) => { position: e.position == null ? "-" : e.position, level: e.positionEmployeeLevel == null ? "-" : e.positionEmployeeLevel, organizationOrganization: e.oc == null ? "-" : e.oc, - ocId: DataStore.convertOcid(e.oc), })); modalAdd.value = true; - rows2.value = data.filter((e: any) => e.ocId === DataStore.typeOc); + rows2.value = data; }) .catch((e) => { messageError($q, e); @@ -307,6 +295,7 @@ const fecthlistperson = async (id: string) => { hideLoader(); }); }; +// ยืนยันการเพิ่มราชชื่อ const clickAdd = async (id: string) => { if (insigniaType.value !== "") { dialogConfirm( @@ -319,7 +308,7 @@ const clickAdd = async (id: string) => { ); } else dialogMessageNotify($q, "กรุณาเลือกรายชื่อขอพระราชทานเครื่องราชฯ"); }; - +//เพิ่มราชชื่อข้าราชการ const addlistperson = async (id: string) => { showLoader(); let data = { @@ -348,14 +337,14 @@ const addlistperson = async (id: string) => { hideLoader(); }); }; - +// เปิด POP แก้ไขเครื่องราชฯ const clickmodalEdit = (props: any) => { insignia.value = props.insigniaSend; person.value = props; modalEdit.value = true; fecthInsignia(); }; - +// downloadfile รายชื่อข้าราชการสามัญฯ const downloadFile = (response: any, filename: string) => { const link = document.createElement("a"); var fileName = filename; @@ -365,6 +354,7 @@ const downloadFile = (response: any, filename: string) => { link.click(); document.body.removeChild(link); }; +// เรียก file รายชื่อข้าราชการสามัญฯ const downloadFileexcel = async () => { showLoader(); await http @@ -378,35 +368,13 @@ const downloadFileexcel = async () => { ); }) .catch((err) => { - console.log(err); messageError($q, err); }) .finally(() => { hideLoader(); }); }; -// const downloadReport = async (type: string = "pdf") => { -// showLoader(); -// await http -// .get(config.API.reportInsignia("45", type, props.roundId!), { -// responseType: "blob", -// }) -// .then(async (res) => { -// console.log(res); - -// downloadFile( -// res, -// `บัญชีแสดงรายชื่อผู้ขอพระราชทานเหรียญจักรพรรดิมาลา ${props.roundName}.${type}` -// ); -// }) -// .catch((e) => { -// messageError($q, e); -// }) -// .finally(() => { -// hideLoader(); -// }); -// }; - +// ยืนยันการแก้ไขเครื่องราช const clickSave = () => { dialogConfirm( $q, @@ -417,7 +385,7 @@ const clickSave = () => { "ต้องการยืนยันการแก้ไขเครื่องราชฯ ที่ยื่นขอนี้หรือไม่ ?" ); }; - +// แก้ไขเครื่องราช API const listEdit = async (profileId: string) => { let data: any = { insigniaId: insignia.value, @@ -442,11 +410,16 @@ const listEdit = async (profileId: string) => { } }); }; - +//เปิด POPUP ไม่ยืนขอ const clickReject = (id: string) => { modelPopupReject.value = true; rowid.value = id; }; +// ปิด POPUP ไม่ยืนขอ +const closemodelPopupReject = () => { + modelPopupReject.value = false; +}; +// ยืนยัน การไม่ยืนขอ const savaReasonReject = (reason: string) => { dialogConfirm( $q, @@ -460,10 +433,7 @@ const savaReasonReject = (reason: string) => { "ต้องการยืนยันการย้ายข้อมูลนี้หรือไม่ ?" ); }; -const closemodelPopupReject = () => { - modelPopupReject.value = false; -}; - +// ยืนยัน การไม่ยืนขอ API const listreject = async (profileId: string, reason: string) => { await http .put(config.API.insigniaReject(profileId), { reason: reason }) @@ -485,14 +455,16 @@ const listreject = async (profileId: string, reason: string) => { await closemodelPopupReject(); }); }; - +//เปิด POPUP คนที่ถูกลบ const clickDelete = (id: string) => { modelPopupDelete.value = true; rowid.value = id; }; +// ปิด POPUP คนที่ถูกลบ const closemodelPopupDelete = () => { modelPopupDelete.value = false; }; +// ยืนยัน การลบคนที่ถูกลบ const savaReasonDelete = (reason: string) => { dialogConfirm( $q, @@ -506,7 +478,7 @@ const savaReasonDelete = (reason: string) => { "ต้องการยืนยันการลบข้อมูลนี้หรือไม่ ?" ); }; - +// ยืนยัน คนที่ถูกลบ API const listdelete = async (id: string, reason: string) => { await http .put(config.API.insigniaDelete(id), { reason: reason }) @@ -532,7 +504,7 @@ const listdelete = async (id: string, reason: string) => { const insignia = ref(""); const insigniaOptions = ref([]); const insigniaType = ref(""); - +// เรียกประเภทเครื่องราชฯ const fecthInsignia = async () => { await http .get(config.API.insignia) @@ -662,30 +634,7 @@ const closeModalEdit = () => { color="primary" @click="downloadFileexcel" > - ดาวน์โหลด - { {{ props.row.dateSend }} - + - - - + auto-width + v-if="props.row.insigniaSend == 'เหรียญจักรพรรดิมาลา'" + > + + +