From f44399919c476e6e39637778748a18868486abb7 Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Thu, 2 Nov 2023 17:32:57 +0700 Subject: [PATCH] =?UTF-8?q?ui=20=E0=B9=80=E0=B8=9B=E0=B8=A5=E0=B8=B5?= =?UTF-8?q?=E0=B9=88=E0=B8=A2=E0=B8=99=E0=B9=81=E0=B8=9B=E0=B8=A5=E0=B8=87?= =?UTF-8?q?=E0=B8=A3=E0=B8=AD=E0=B8=9A=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B8=9B?= =?UTF-8?q?=E0=B8=8F=E0=B8=B4=E0=B8=9A=E0=B8=B1=E0=B8=95=E0=B8=B4=E0=B8=82?= =?UTF-8?q?=E0=B8=AD=E0=B8=87=E0=B8=9C=E0=B8=B9=E0=B9=89=E0=B9=83=E0=B8=8A?= =?UTF-8?q?=E0=B9=89=E0=B8=87=E0=B8=B2=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/interface/request/main/main.ts | 10 +- .../components/4_ChangeRound/DialogForm.vue | 273 ++++++++++++++++++ .../09_leave/interface/request/changeRound.ts | 21 ++ .../interface/response/changeRound.ts | 38 +++ src/modules/09_leave/router.ts | 11 + .../09_leave/stores/ChangeRoundStore.ts | 187 ++++++++++++ .../09_leave/views/ChangeRoundMain.vue | 201 +++++++++++++ 7 files changed, 739 insertions(+), 2 deletions(-) create mode 100644 src/modules/09_leave/components/4_ChangeRound/DialogForm.vue create mode 100644 src/modules/09_leave/interface/request/changeRound.ts create mode 100644 src/modules/09_leave/interface/response/changeRound.ts create mode 100644 src/modules/09_leave/stores/ChangeRoundStore.ts create mode 100644 src/modules/09_leave/views/ChangeRoundMain.vue diff --git a/src/interface/request/main/main.ts b/src/interface/request/main/main.ts index a3533531f..553a0ecdc 100644 --- a/src/interface/request/main/main.ts +++ b/src/interface/request/main/main.ts @@ -384,18 +384,24 @@ const menuList = readonly([ }, { key: 9.2, + label: "แก้ไขรอบการปฎิบัติงานผู้ใช้งาน", + path: "/change-round", + role: "leave", + }, + { + key: 9.3, label: "รายการลงเวลาปฏิบัติงาน", path: "/work-list", role: "leave", }, { - key: 9.3, + key: 9.4, label: "รายการลา", path: "/leave-list", role: "leave", }, { - key: 9.4, + key: 9.5, label: "รายงานสถิติ", path: "/statistics-report", role: "leave", diff --git a/src/modules/09_leave/components/4_ChangeRound/DialogForm.vue b/src/modules/09_leave/components/4_ChangeRound/DialogForm.vue new file mode 100644 index 000000000..f5b42673a --- /dev/null +++ b/src/modules/09_leave/components/4_ChangeRound/DialogForm.vue @@ -0,0 +1,273 @@ + + + diff --git a/src/modules/09_leave/interface/request/changeRound.ts b/src/modules/09_leave/interface/request/changeRound.ts new file mode 100644 index 000000000..2e7ab8869 --- /dev/null +++ b/src/modules/09_leave/interface/request/changeRound.ts @@ -0,0 +1,21 @@ +interface dataPost { + cardId: string + firstName: string + lastName: string +} +interface changeRoundEdit { + round: string + date: string + reson: string + effectiveDate: Date | null +} +interface MyObjectRoundChangeRef { + round: object | null + effectiveDate: object | null + [key: string]: any; +} +export type { + dataPost, + changeRoundEdit, + MyObjectRoundChangeRef +} \ No newline at end of file diff --git a/src/modules/09_leave/interface/response/changeRound.ts b/src/modules/09_leave/interface/response/changeRound.ts new file mode 100644 index 000000000..bc5a0dc4c --- /dev/null +++ b/src/modules/09_leave/interface/response/changeRound.ts @@ -0,0 +1,38 @@ +interface changeShow { + cardId: string + prefix: string + firstName: string + lastName: string + fullName: string + roundStart: string + roundEnd: string + currentRound: string + effectiveDate: string | null +} +interface dataRowChangeRound { + cardId: string + prefix: string + firstName: string + lastName: string + roundStart: string + roundEnd: string + effectiveDate: Date +} +interface dataRowChangeRoundHistory { + id: string + roundStart: string + roundEnd: string + effectiveDate: Date + reson: string | null +} +interface historyShow { + time: string + effectiveDate: string | null + reson: string | null +} +export type { + changeShow, + dataRowChangeRound, + dataRowChangeRoundHistory, + historyShow +} \ No newline at end of file diff --git a/src/modules/09_leave/router.ts b/src/modules/09_leave/router.ts index 3636190f8..932fa9ded 100644 --- a/src/modules/09_leave/router.ts +++ b/src/modules/09_leave/router.ts @@ -4,6 +4,7 @@ const leaveMain = () => import("@/modules/09_leave/views/LeaveListMain.vue"); const reportMain = () => import("@/modules/09_leave/views/ReportMain.vue") const leaveDetail = () => import("@/modules//09_leave/components/2_Leave/DetailLeave.vue") const RoundMain = () => import("@/modules/09_leave/views/RoundMain.vue") +const ChangeRoundMain = () => import("@/modules/09_leave/views/ChangeRoundMain.vue") export default [ { @@ -16,6 +17,16 @@ export default [ Role: "coin", }, }, + { + path: "/change-round", + name: "/change-round", + component: ChangeRoundMain, + meta: { + Auth: true, + Key: [9], + Role: "coin", + }, + }, { path: "/work-list", name: "/work-list", diff --git a/src/modules/09_leave/stores/ChangeRoundStore.ts b/src/modules/09_leave/stores/ChangeRoundStore.ts new file mode 100644 index 000000000..f6577f12a --- /dev/null +++ b/src/modules/09_leave/stores/ChangeRoundStore.ts @@ -0,0 +1,187 @@ +import { defineStore } from "pinia"; +import { ref, reactive } from "vue"; +import type { changeShow, dataRowChangeRound, dataRowChangeRoundHistory, historyShow } from "@/modules/09_leave/interface/response/changeRound"; +import type { QTableProps } from "quasar"; +import { useCounterMixin } from "@/stores/mixin"; + +const mixin = useCounterMixin() +const { date2Thai } = mixin +const checkCilck = ref(false) +// store ลา >> รอบการปฏิบัติงาน +export const useChangeRoundDataStore = defineStore( + "changeRoundDataStore", + () => { + //ค้นหา คอลัมน์ คอลัมน์ที่แสดง + const visibleColumns = ref([ + "cardId", + "fullName", + "currentRound", + "effectiveDate" + ]); + const visibleColumnsHistory = ref([ + "round", + "time", + "effectiveDate", + "reson" + ]); + + // หัวตาราง + const columns = ref([ + { + name: "cardId", + align: "left", + label: "เลขบัตรประชาชน", + sortable: true, + field: "cardId", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + { + name: "fullName", + align: "left", + label: "ชื่อ-นามสกุล", + sortable: true, + field: "fullName", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + { + name: "currentRound", + align: "left", + label: "รอบปัจจุบัน", + sortable: true, + field: "currentRound", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + { + name: "effectiveDate", + align: "left", + label: "วันที่มีผล", + sortable: true, + field: "effectiveDate", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + ]); + const columnsHistory = ref([ + { + name: "round", + align: "left", + label: "ครั้งที่", + sortable: true, + field: "round", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + { + name: "time", + align: "left", + label: "รอบเวลา", + sortable: true, + field: "time", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + { + name: "effectiveDate", + align: "left", + label: "วันที่มีผล", + sortable: true, + field: "effectiveDate", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + { + name: "reson", + align: "left", + label: "เหตุผล", + sortable: true, + field: "reson", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + ]); + const dataList = [ + { + cardId: '3514210651232', + prefix: "นางสาว", + firstName: "กัณฐิมา", + lastName: "กาฬสินธุ์", + roundStart: "07:00", + roundEnd: "11:00", + effectiveDate: new Date("2023-11-01T03:08:43.217"), + }, + { + cardId: '3514210651232', + prefix: "นางสาว", + firstName: "กัณฐิมา", + lastName: "กาฬสินธุ์", + roundStart: "13:00", + roundEnd: "16:00", + effectiveDate: new Date("2023-11-01T03:08:43.217"), + }, + { + cardId: '1231231231234', + prefix: "นายสาว", + firstName: "test", + lastName: "test", + roundStart: "07:00", + roundEnd: "16:00", + effectiveDate: new Date("2023-11-01T03:08:43.217"), + }, + ] + + // ข้อมูลในตาราง + const rows = ref([]); + const rowsHistory = ref([]); + function fetchDatainHistory(data: dataRowChangeRoundHistory[]) { + let datalistHistory: historyShow[] = data.map((e: dataRowChangeRoundHistory) => { + return { + id: e.id, + time: `${e.roundStart}-${e.roundEnd}`, + effectiveDate: date2Thai(e.effectiveDate), + reson: e.reson ?? '-' + + }; + }); + rowsHistory.value = datalistHistory; + } + + function fetchDataForCardId(cardId: string, check: string) { + if (cardId.length === 13) { + const data = dataList.filter((e) => e.cardId === cardId); + rows.value = data.map((e) => ({ + cardId: e.cardId, + prefix: e.prefix, + firstName: e.firstName, + lastName: e.lastName, + fullName: `${e.prefix}${e.firstName} ${e.lastName}`, + roundStart: e.roundStart, + roundEnd: e.roundEnd, + currentRound: `${e.roundStart}-${e.roundEnd}`, + effectiveDate: date2Thai(e.effectiveDate), + })); + } else if (cardId === 'null') { + rows.value = [] + checkCilck.value = false + } else if (check === 'click') { + checkCilck.value = true + } + } + + + return { + visibleColumns, + columns, + columnsHistory, + rows, + rowsHistory, + fetchDatainHistory, + visibleColumnsHistory, + dataList, + fetchDataForCardId, + checkCilck + }; + } +); diff --git a/src/modules/09_leave/views/ChangeRoundMain.vue b/src/modules/09_leave/views/ChangeRoundMain.vue new file mode 100644 index 000000000..d5820cbf2 --- /dev/null +++ b/src/modules/09_leave/views/ChangeRoundMain.vue @@ -0,0 +1,201 @@ + + +