From 6104ca99bba7f6c7c105a1b2ee06dcbb90c07de5 Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Fri, 22 Sep 2023 10:05:48 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88=E0=B8=A1?= =?UTF-8?q?=20interface=20=E0=B9=83=E0=B8=AB=E0=B9=89=20row=20=E0=B8=A3?= =?UTF-8?q?=E0=B8=B2=E0=B8=A2=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B8=AD=E0=B8=B7?= =?UTF-8?q?=E0=B9=88=E0=B8=99=E0=B9=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../05_placement/components/Other/Detail.vue | 3 -- .../05_placement/components/Other/Main.vue | 49 ++++++++--------- .../interface/response/OhterMain.ts | 54 +++++++++++++++++++ 3 files changed, 79 insertions(+), 27 deletions(-) create mode 100644 src/modules/05_placement/interface/response/OhterMain.ts diff --git a/src/modules/05_placement/components/Other/Detail.vue b/src/modules/05_placement/components/Other/Detail.vue index 63ea51135..7f3eab35d 100644 --- a/src/modules/05_placement/components/Other/Detail.vue +++ b/src/modules/05_placement/components/Other/Detail.vue @@ -77,7 +77,6 @@ const fecthOther = async () => { title.value.organizationPositionOld = data.organizationPositionOld ?? "-"; title.value.positionLevelOld = data.positionLevelOld ?? "-"; title.value.positionTypeOld = data.positionTypeOld ?? "-"; - responseData.value.profileId = data.profileId; responseData.value.createdAt = data.createdAt; responseData.value.date = data.date !== null ? new Date(data.date) : new Date(); @@ -141,7 +140,6 @@ const saveOther = async () => { }) .catch((e) => { messageError($q, e); - console.log(e); }) .finally(async () => { await fecthOther(); @@ -156,7 +154,6 @@ const getClass = (val: boolean) => { onMounted(async () => { if (keycloak.tokenParsed != null) { roleAdmin.value = await keycloak.tokenParsed.role.includes("placement1"); - console.log("roleAdmin===>", roleAdmin.value); } await fecthOther(); }); diff --git a/src/modules/05_placement/components/Other/Main.vue b/src/modules/05_placement/components/Other/Main.vue index 2daf16387..708960ee9 100644 --- a/src/modules/05_placement/components/Other/Main.vue +++ b/src/modules/05_placement/components/Other/Main.vue @@ -5,6 +5,7 @@ import { useRouter } from "vue-router"; import { useCounterMixin } from "@/stores/mixin"; import { useTransferDataStore } from "@/modules/05_placement/store" import type { QTableProps } from "quasar"; +import type { listMain,listMainAPI,OpType } from "@/modules/05_placement/interface/response/OhterMain" import http from "@/plugins/http"; import config from "@/app.config"; @@ -18,11 +19,11 @@ const { showLoader, hideLoader, success, messageError, date2Thai, dialogRemove } const $q = useQuasar(); const router = useRouter(); -const optionsType = ref([]); +const optionsType = ref([]); const type = ref(""); const modal = ref(false); -const rows = ref([]); -const rows2 = ref([]); +const rows = ref([]); +const rows2 = ref([]); const filterKeyword = ref(""); const filterKeyword2 = ref(""); @@ -108,31 +109,31 @@ const fecthlistOthet = async () => { .get(config.API.otherMain()) .then((res) => { let response = res.data.result; - rows.value = response.map((r: any) => ({ + rows.value = response.map((r: listMainAPI) => ({ createdAt: date2Thai(r.createdAt), date: new Date(), - firstName: r.firstname ?? "", - personalId: r.id ?? "", + firstName: r.firstname ?? "-", + personalId: r.id ?? "-", isActive: r.isActive ? r.isActive : false, - lastName: r.lastname ?? "", - organization: r.organization ?? "", - organizationPositionOld: r.organizationPositionOld ?? "", - posNo: r.posNo ?? "", - position: r.position ?? "", - positionLevel: r.positionLevel ?? "", - positionLevelOld: r.positionLevelOld ?? "", - positionNumberOld: r.positionNumberOld ?? "", - positionTypeOld: r.positionTypeOld ?? "", - prefix: r.prefix ?? "", - reason: r.reason ?? "", + lastName: r.lastname ?? "-", + organization: r.organization ?? "-", + organizationPositionOld: r.organizationPositionOld ?? "-", + posNo: r.posNo ?? "-", + position: r.position ?? "-", + positionLevel: r.positionLevel ?? "-", + positionLevelOld: r.positionLevelOld ?? "-", + positionNumberOld: r.positionNumberOld ?? "-", + positionTypeOld: r.positionTypeOld ?? "-", + prefix: r.prefix ?? "-", + reason: r.reason ?? "-", salary: r.salary ? r.salary : 0, - status: r.status ?? "", + status: r.status ?? "-", statustext: statusText(r.status ?? ""), fullname: `${r.prefix ?? ""}${r.firstname ?? ""} ${r.lastname ?? ""}`, })); rows2.value = rows.value.filter( - (e: any) => - e.orgName !== null && e.status !== "REPORT" && e.status !== "DONE" + (e: listMain) => + e.status !== "REPORT" && e.status !== "DONE" ); }) .catch((e) => { @@ -150,7 +151,7 @@ const fecthTypeOption = async () => { .get(config.API.typeOrder()) .then((res) => { optionsType.value = res.data.result.filter( - (e: any) => e.commandCode === "C-PM-08" || e.commandCode === "C-PM-09" + (e: OpType) => e.commandCode === "C-PM-08" || e.commandCode === "C-PM-09" ); }) .catch((e) => { @@ -203,9 +204,9 @@ const clickDelete = (id: string) => { dialogRemove($q, () => deleteOther(id)); }; //----(เปิดหน้าถัดไป)------// -const nextPage = (row: any) => { +const nextPage = (id: string) => { router.push({ - path: `/other/detail/${row.personalId}`, + path: `/other/detail/${id}`, }); }; @@ -276,7 +277,7 @@ onMounted(() => { {{ props.rowIndex + 1 }} diff --git a/src/modules/05_placement/interface/response/OhterMain.ts b/src/modules/05_placement/interface/response/OhterMain.ts new file mode 100644 index 000000000..118176efe --- /dev/null +++ b/src/modules/05_placement/interface/response/OhterMain.ts @@ -0,0 +1,54 @@ +// ข้อมูลที่เก็บ +interface listMain { + personalId:string + fullname:string + prefix:string + firstName:string + lastName:string + date:Date + isActive:boolean + organization:string + organizationPositionOld:string + posNo:string + position:string + positionLevel:string + positionLevelOld:string + positionNumberOld:string + positionTypeOld:string + reason:string + salary:number + status:string + statustext:string + createdAt:Date +} +//ข้อมูลจาก api +interface listMainAPI { + id:string + firstname:string + prefix:string + firstName:string + lastname:string + date:Date + isActive:boolean + organization:string + organizationPositionOld:string + posNo:string + position:string + positionLevel:string + positionLevelOld:string + positionNumberOld:string + positionTypeOld:string + reason:string + salary:number + status:string + statustext:string + createdAt:Date +} +interface OpType { + commandCode:string +} +export type { + listMain, + listMainAPI, + OpType +} \ No newline at end of file