From 1c573748682d9962e3c4881f29f33c6df6df685a Mon Sep 17 00:00:00 2001 From: AnandaTon Date: Tue, 19 Sep 2023 17:42:17 +0700 Subject: [PATCH] =?UTF-8?q?fix=20=E0=B8=8A=E0=B8=B7=E0=B9=88=E0=B8=AD-?= =?UTF-8?q?=E0=B8=99=E0=B8=B2=E0=B8=A1=E0=B8=AA=E0=B8=81=E0=B8=B8=E0=B8=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/MainTreeEmployee.vue | 2 +- .../components/Discharged/dischargedMain.vue | 4 +- .../components/DismissOrder/DismissOrder.vue | 4 +- .../components/ExitInterview/exitMain.vue | 27 + .../components/Expulsion/expulsionMain.vue | 4 +- .../components/resign/Deceased.vue | 24 +- .../components/resign/DetailByidDeceased.vue | 79 +- .../components/resign/DetailDeceased.vue | 165 +- .../components/resign/Resign.vue | 48 +- .../components/resign/ResignByid.vue | 119 +- .../components/resign/ResignOrder.vue | 1438 ++++++++--------- .../interface/response/exitInterview.ts | 1 + 12 files changed, 833 insertions(+), 1082 deletions(-) diff --git a/src/modules/02_organizational/views/MainTreeEmployee.vue b/src/modules/02_organizational/views/MainTreeEmployee.vue index 67b2cdab7..a45c1a3ea 100644 --- a/src/modules/02_organizational/views/MainTreeEmployee.vue +++ b/src/modules/02_organizational/views/MainTreeEmployee.vue @@ -970,6 +970,7 @@ onMounted(async () => { await fetchOrganizationAgencyCode(); await fetchPosition(); await fetchData(); + await nodeTree(); }); const onSelected = async (id: string) => { @@ -1647,7 +1648,6 @@ const clickAdd = async () => { isActive.value = false; isCondition.value = false; conditionNote.value = ""; - await nodeTree(); }; /**เมื่อเลือกใหม่ diff --git a/src/modules/06_retirement/components/Discharged/dischargedMain.vue b/src/modules/06_retirement/components/Discharged/dischargedMain.vue index f307bfc5a..56507f4c7 100644 --- a/src/modules/06_retirement/components/Discharged/dischargedMain.vue +++ b/src/modules/06_retirement/components/Discharged/dischargedMain.vue @@ -231,9 +231,7 @@ const getData = async () => { salary: r.salary ? r.salary : 0, status: r.status ?? "", statustext: statusText(r.status ?? ""), - fullname: `${r.prefix ?? ""} ${r.firstName ?? ""} ${ - r.lastName ?? "" - }`, + fullname: `${r.prefix ?? ""}${r.firstName ?? ""} ${r.lastName ?? ""}`, }); }); rows.value = list; diff --git a/src/modules/06_retirement/components/DismissOrder/DismissOrder.vue b/src/modules/06_retirement/components/DismissOrder/DismissOrder.vue index faa59df51..d9a8e1330 100644 --- a/src/modules/06_retirement/components/DismissOrder/DismissOrder.vue +++ b/src/modules/06_retirement/components/DismissOrder/DismissOrder.vue @@ -221,9 +221,7 @@ const getData = async () => { salary: r.salary ? r.salary : 0, status: r.status ?? "", statustext: statusText(r.status ?? ""), - fullname: `${r.prefix ?? ""} ${r.firstName ?? ""} ${ - r.lastName ?? "" - }`, + fullname: `${r.prefix ?? ""}${r.firstName ?? ""} ${r.lastName ?? ""}`, }); }); rows.value = list; diff --git a/src/modules/06_retirement/components/ExitInterview/exitMain.vue b/src/modules/06_retirement/components/ExitInterview/exitMain.vue index a1bd4991b..2a927a9e7 100644 --- a/src/modules/06_retirement/components/ExitInterview/exitMain.vue +++ b/src/modules/06_retirement/components/ExitInterview/exitMain.vue @@ -41,6 +41,17 @@ const columns = ref([ sort: (a: string, b: string) => a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), }, + { + name: "fullname", + align: "left", + label: "ชื่อ-นามสกุล", + sortable: true, + field: "fullname", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + sort: (a: string, b: string) => + a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), + }, { name: "realReason", align: "left", @@ -148,6 +159,7 @@ onMounted(async () => { } }); +//นำข้อมูลจาก API มาแสดง const fecthlist = async () => { showLoader(); await http @@ -158,6 +170,7 @@ const fecthlist = async () => { data.map((r: ResponseItems) => { list.push({ datetext: r.createdAt !== null ? date2Thai(r.createdAt) : "-", + fullname: r.fullname ?? "", createdAt: new Date(r.createdAt), futureWork: !!r.futureWork, futureWorkReason: r.futureWorkReason ?? "", @@ -184,6 +197,8 @@ const fecthlist = async () => { hideLoader(); }); }; + +//เซฟเพื่อส่งไปออกคำสั่ง const saveAppoint = async () => { await myForm.value!.validate().then(async (result: boolean) => { if (result) { @@ -218,6 +233,8 @@ const validationDate = (thaiDate: string | null) => { } } }; + +//แปลงเดือนจากตัวเลขเป็นภาษาอ่าน const convertThaiDateToNumeric = (thaiDate: string) => { const parts = thaiDate.split(" "); if (parts.length !== 3) return null; @@ -326,6 +343,15 @@ const openModalCalendar = (rows: any) => { > {{ props.rowIndex + 1 }} + + {{ props.row.fullname }} + { + diff --git a/src/modules/06_retirement/components/Expulsion/expulsionMain.vue b/src/modules/06_retirement/components/Expulsion/expulsionMain.vue index f88ce7586..cdc7e1c33 100644 --- a/src/modules/06_retirement/components/Expulsion/expulsionMain.vue +++ b/src/modules/06_retirement/components/Expulsion/expulsionMain.vue @@ -228,9 +228,7 @@ const getData = async () => { salary: r.salary ? r.salary : 0, status: r.status ?? "", statustext: statusText(r.status ?? ""), - fullname: `${r.prefix ?? ""} ${r.firstName ?? ""} ${ - r.lastName ?? "" - }`, + fullname: `${r.prefix ?? ""}${r.firstName ?? ""} ${r.lastName ?? ""}`, }); }); rows.value = list; diff --git a/src/modules/06_retirement/components/resign/Deceased.vue b/src/modules/06_retirement/components/resign/Deceased.vue index f0cae6c40..763c15975 100644 --- a/src/modules/06_retirement/components/resign/Deceased.vue +++ b/src/modules/06_retirement/components/resign/Deceased.vue @@ -9,18 +9,20 @@ import config from "@/app.config"; const router = useRouter(); const $q = useQuasar(); const mixin = useCounterMixin(); -const { showLoader, hideLoader, messageError, success ,date2Thai} = mixin; +const { showLoader, hideLoader, messageError, success, date2Thai } = mixin; const rows = ref([]); const columns = ref([ { - name: "prefix", + name: "no", align: "left", - label: "คำนำหน้า", + label: "ลำดับ", sortable: true, - field: "prefix", + field: "no", headerStyle: "font-size: 14px", style: "font-size: 14px", + sort: (a: string, b: string) => + a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), }, { name: "fullname", @@ -87,6 +89,7 @@ const columns = ref([ }, ]); const visibleColumns = ref([ + "no", "prefix", "fullname", "positionType", @@ -104,17 +107,15 @@ const fectListDecased = async () => { await http .get(config.API.listDeceased()) .then((res) => { - console.log(res); rows.value = res.data.result.map((e: any) => ({ personalId: e.id, - prefix: e.prefix, - fullname: e.firstName + " " + e.lastName, + fullname: `${e.prefix ?? ""}${e.firstName ?? ""} ${e.lastName ?? ""}`, positionType: e.positionType, position: e.positionLine, positionLevel: e.positionLevel, positionExecutive: e.positionExecutive, oc: e.organization, - createdAt:date2Thai(e.createdAt), + createdAt: date2Thai(e.createdAt), })); }) .catch((e) => { @@ -125,8 +126,6 @@ const fectListDecased = async () => { }); }; - - //ค้นหา คอลัมน์ คอลัมน์ที่แสดง const filterKeyword = ref(""); const filterRef = ref(null); @@ -219,11 +218,8 @@ const pagination = ref({ class="cursor-pointer" @click="nextPage(props.row.personalId)" > - - - {{ props.row.prefix }} {{ props.row.fullname }} diff --git a/src/modules/06_retirement/components/resign/DetailByidDeceased.vue b/src/modules/06_retirement/components/resign/DetailByidDeceased.vue index f5ec7f42f..920e5cfda 100644 --- a/src/modules/06_retirement/components/resign/DetailByidDeceased.vue +++ b/src/modules/06_retirement/components/resign/DetailByidDeceased.vue @@ -10,7 +10,11 @@ import http from "@/plugins/http"; import config from "@/app.config"; import type { QTableProps } from "quasar"; -import type { requestSendNoti,DataCopyOrder,ResponseOrganiz } from "@/modules/06_retirement/interface/response/Deceased"; +import type { + requestSendNoti, + DataCopyOrder, + ResponseOrganiz, +} from "@/modules/06_retirement/interface/response/Deceased"; import { useRouter, useRoute } from "vue-router"; const router = useRouter(); const route = useRoute(); @@ -26,14 +30,11 @@ const props = defineProps({ }); const profileId = ref(route.params.id.toString()); const next = () => props.next(); -const previous = () => props.previous(); const $q = useQuasar(); const mixin = useCounterMixin(); //เรียกฟังก์ชันกลาง const { dialogRemove, messageError, showLoader, hideLoader, success } = mixin; - - const myForm = ref(null); const filterRef = ref(); const filter = ref(""); @@ -157,23 +158,22 @@ const editRows = ref([]); onMounted(async () => { await getData(); - // await getList(); }); const getList = async () => { showLoader(); - await http.get(config.API.detailByidDeceased(profileId.value)) - .then((res) => { - const data = res.data.result - console.log(data) - }).catch((e) => { + await http + .get(config.API.detailByidDeceased(profileId.value)) + .then((res) => { + const data = res.data.result; + }) + .catch((e) => { messageError($q, e); }) .finally(async () => { hideLoader(); }); - -} +}; const listModal = async (id: string) => { showLoader(); await http @@ -203,14 +203,12 @@ const listModal = async (id: string) => { }); }; - const getData = async () => { showLoader(); await http .get(config.API.detailByidDeceased(profileId.value)) .then((res) => { const data = res.data.result; - // console.log(data); let list: DataCopyOrder[] = []; data.map((r: any) => { let selectCopyOrder = []; @@ -222,9 +220,9 @@ const getData = async () => { } list.push({ - id:r.id, + id: r.id, personalId: r.profileId ?? "", - name:`${r.prefix}${r.firstName} ${r.lastName}`, + name: `${r.prefix}${r.firstName} ${r.lastName}`, idCard: r.citizenId ?? "", position: r.positionName ?? "", unit: r.organizationName ?? "-", @@ -252,22 +250,22 @@ const getData = async () => { }; const saveData = async () => { - showLoader(); - const persons = selectedModal.value.map(item => ({ profileId: item.profileId })); - const dataToSend = { Persons: persons }; - await http - .put(config.API.detailByidDeceased(profileId.value), dataToSend) - .then((res) => { - - }) - .catch((e) => { - messageError($q, e); - }) - .finally(async () => { - clickClose(); - getData(); - hideLoader(); - }); + showLoader(); + const persons = selectedModal.value.map((item) => ({ + profileId: item.profileId, + })); + const dataToSend = { Persons: persons }; + await http + .put(config.API.detailByidDeceased(profileId.value), dataToSend) + .then((res) => {}) + .catch((e) => { + messageError($q, e); + }) + .finally(async () => { + clickClose(); + getData(); + hideLoader(); + }); }; const resetFilter = () => { @@ -299,11 +297,7 @@ const clickAdd = async () => { }; const clickDelete = (id: string) => { - console.log(id) - dialogRemove( - $q, - () => deleteData(id), - ); + dialogRemove($q, () => deleteData(id)); }; const nodeTree = async () => { @@ -339,7 +333,6 @@ const deleteData = async (id: string) => { messageError($q, e); }) .finally(async () => { - // hideLoader(); await getData(); }); }; @@ -367,7 +360,7 @@ const fetchSaveCopyOrder = async () => { showLoader(); await http - .put(config.API.notiDeceased(profileId.value), {Persons:list}) + .put(config.API.notiDeceased(profileId.value), { Persons: list }) .then((res: any) => { success($q, "บันทึกข้อมูลสำเร็จ"); next(); @@ -377,7 +370,7 @@ const fetchSaveCopyOrder = async () => { }) .finally(() => { hideLoader(); - getData() + getData(); }); }; @@ -387,7 +380,7 @@ const updateData = (row: DataCopyOrder) => {