diff --git a/src/api/06_retirement/api.retirement.ts b/src/api/06_retirement/api.retirement.ts index 7cf8a8057..6f9b42c5a 100644 --- a/src/api/06_retirement/api.retirement.ts +++ b/src/api/06_retirement/api.retirement.ts @@ -4,9 +4,11 @@ const retirement = `${env.API_URI}/retirement` export default { profile: (type: string, year: string) => `${retirement}/profile/${type}/${year}`, - profileRetire: (retireProfileId: string) => `${retirement}/profile/${retireProfileId}`, + // profileRetire: (retireProfileId: string) => `${retirement}/profile/${retireProfileId}`, listRetire: (retireId: string) => `${retirement}/${retireId}`, - createnote: () => `${retirement}/reason`, - reasonId: (retireId:string) => `${retirement}/reason/${retireId}`, - retirement:(type:string,year:string) => `${retirement}/${type}/${year}` + createnote: () => `${retirement}/edit`, + removeProfile: () => `${retirement}/remove`, + reasonId: (retireId: string) => `${retirement}/reason/${retireId}`, + retirement: (type: string, year: string) => `${retirement}/${type}/${year}`, + createProfile: () => `${retirement}/profile`, }; diff --git a/src/modules/06_retirement/components/ListRetirement/TableList.vue b/src/modules/06_retirement/components/ListRetirement/TableList.vue index 33ef58904..740e7ad9e 100644 --- a/src/modules/06_retirement/components/ListRetirement/TableList.vue +++ b/src/modules/06_retirement/components/ListRetirement/TableList.vue @@ -4,18 +4,18 @@ import AddList from "../ListRetirement/AddList.vue"; import { useCounterMixin } from "@/stores/mixin"; import { useQuasar } from "quasar"; import { useRoute } from "vue-router"; +import { useRouter } from "vue-router"; import http from "@/plugins/http"; import config from "@/app.config"; -import { useRouter } from "vue-router"; -const router = useRouter(); const route = useRoute(); +const router = useRouter(); const $q = useQuasar(); const mixin = useCounterMixin(); const { showLoader, hideLoader, messageError, success } = mixin; -const type_params = route.params.type; -const year_params = route.params.year; -const retireld_params = route.params.id; +// const type_params = route.params.type; +// const year_params = route.params.year; +const retireld_params = route.params.retirementId; const modalNote = ref(false); const note = ref(""); @@ -159,22 +159,25 @@ const visibleColumns = ref([ "bureau", ]); +const action = ref(""); + onMounted(() => { - // console.log(route.params); - if (retireld_params === undefined) { - fecthlistprofile(type_params, year_params); - } else { - fecthlist(retireld_params); - } + retireld.value = retireld_params.toString(); + console.log(retireld_params); + + fecthlistprofile(retireld.value); }); +const round = ref(); +const typeReport = ref(""); // fecthlist -const fecthlistprofile = async (type: any, year: any) => { +const fecthlistprofile = async (id: string) => { showLoader(); await http - .get(config.API.profile(type, year)) - .then((res: any) => { - // console.log(res); - retireld.value = res.data.result.id; + .get(config.API.listRetire(id)) + .then((res) => { + console.log(res); + round.value = res.data.result.round; + typeReport.value = res.data.result.typeReport; rows.value = res.data.result.profile.map((e: any) => ({ id: e.id, profileId: e.profileId, @@ -187,37 +190,11 @@ const fecthlistprofile = async (type: any, year: any) => { positionNumber: e.posNoEmployee, positionLavel: e.positionEmployeeLevel, bureau: e.oc, + reason: e.reason, + remove: e.remove, })); }) - .catch((e: any) => { - messageError($q, e); - }) - .finally(() => { - hideLoader(); - }); -}; -const fecthlist = async (retireld: any) => { - showLoader(); - await http - .get(config.API.listRetire(retireld)) - .then((res: any) => { - // retireld.value = res.data.result.id; - rows.value = res.data.result.map((e: any) => ({ - id: e.id, - profileId: e.profileId, - order: e.order, - fixname: e.prefix, - name: e.fullName, - organizationOrganization: e.organizationOrganization, - positionType: e.positionType, - position: e.position, - positionNumber: e.posNoEmployee, - positionLavel: e.positionEmployeeLevel, - bureau: e.oc, - })); - // console.log(rows.value); - }) - .catch((e: any) => { + .catch((e) => { messageError($q, e); }) .finally(() => { @@ -225,10 +202,7 @@ const fecthlist = async (retireld: any) => { }); }; // DelProfile -const clickDelete = (prop: any) => { - console.log(prop); - - let retireProfileId = prop.profileId; +const clickDelete = () => { $q.dialog({ title: "ยืนยันการลบข้อมูล", message: "ต้องการลบข้อมูลนี้ใช่หรือไม่?", @@ -240,7 +214,10 @@ const clickDelete = (prop: any) => { }) .onOk(async () => { await http - .delete(config.API.profileRetire(retireProfileId)) + .post(config.API.removeProfile(), { + retireProfileId: retireProfileId.value, + reason: note.value, + }) .then(() => { success($q, "ลบข้อมูลสำเร็จ"); }) @@ -248,29 +225,30 @@ const clickDelete = (prop: any) => { messageError($q, e); }) .finally(async () => { - if (retireld_params === undefined) { - await fecthlistprofile(type_params, year_params); - } else await fecthlist(retireld_params); + retireld.value = retireld_params.toString(); + await fecthlistprofile(retireld.value); + modalNote.value = false; }); }) - .onCancel(() => { }) - .onDismiss(() => { }); + .onCancel(() => {}) + .onDismiss(() => {}); }; // note -const fetchReason = async (prop: string) => { - await http - .get(config.API.reasonId(prop)) - .then((res: any) => { - console.log(res.data.result); - note.value = res.data.result.reason; - retireProfileId.value = res.data.result.id; - }) - .catch((e: any) => { - messageError($q, e); - }); -}; - +// const fetchReason = async (prop: string) => { +// await http +// .get(config.API.reasonId(prop)) +// .then((res: any) => { +// console.log(res.data.result); +// note.value = res.data.result.reason; +// retireProfileId.value = res.data.result.id; +// }) +// .catch((e: any) => { +// messageError($q, e); +// }); +// }; const saveNote = () => { + console.log(retireProfileId.value, note.value); + $q.dialog({ title: "ยืนยันการบันทึกข้อมูลข้อมูล", message: "ต้องการบันทึกข้อมูลนี้ใช่หรือไม่?", @@ -281,7 +259,6 @@ const saveNote = () => { persistent: true, }) .onOk(async () => { - // console.log("บันทึกข้อมูล"); await http .post(config.API.createnote(), { retireProfileId: retireProfileId.value, @@ -294,17 +271,18 @@ const saveNote = () => { messageError($q, e); }) .finally(async () => { - await fecthlist(retireld_params); + retireld.value = retireld_params.toString(); + fecthlistprofile(retireld.value); modalNote.value = false; }); }) - .onCancel(() => { }) - .onDismiss(() => { }); + .onCancel(() => {}) + .onDismiss(() => {}); }; const UpdateListId = (retireld: string, pId: string) => { profileId.value = pId; - fecthlist(retireld); + fecthlistprofile(retireld); console.log("profileId", profileId.value); }; const backHistory = () => { @@ -362,13 +340,29 @@ const paginationLabel = (start: number, end: number, total: number) => { @@ -502,19 +578,46 @@ const paginationLabel = (start: number, end: number, total: number) => { - กรอกเหตุผล + กรอกเหตุผล - + - + - + + diff --git a/src/modules/06_retirement/router.ts b/src/modules/06_retirement/router.ts index bb5a3c6bf..6b92458fa 100644 --- a/src/modules/06_retirement/router.ts +++ b/src/modules/06_retirement/router.ts @@ -22,8 +22,8 @@ export default [ }, }, { - path: "/retirement/list/:type/:year", - name: "retirement/list/", + path: "/retirement/:retirementId", + name: "retirementid", component: Listretirement, meta: { Auth: true, diff --git a/src/modules/06_retirement/views/Main.vue b/src/modules/06_retirement/views/Main.vue index 335f4f591..5f5a24245 100644 --- a/src/modules/06_retirement/views/Main.vue +++ b/src/modules/06_retirement/views/Main.vue @@ -175,6 +175,93 @@ + + + + +
เพิ่มประกาศ
+
+ + + เลือกประกาศที่ต้องการเพิ่มข้อมูล + + +
+ + + + + + + ประกาศเพิ่มผู้เกษียณ + + + + + + + + + ประกาศแก้ไขข้อมูลผู้เกษียน + + + + + + + + + + + + ประกาศยกเลิกผู้เกษียณ + + + + + +
+ + + + + + +
+
@@ -447,6 +590,9 @@ watch(type, () => { .filter-card { background-color: #f1f1f1b0; } +.q-item-custom { + padding: 0; +} .toggle-expired-account { font-size: 12px;