From 8a472f23f7077b06d452c71c71ab5f9ac77a4420 Mon Sep 17 00:00:00 2001 From: AnandaTon Date: Thu, 2 Nov 2023 16:44:02 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88=E0=B8=A1?= =?UTF-8?q?=20ui=20=E0=B8=A5=E0=B8=87=E0=B9=80=E0=B8=A7=E0=B8=A5=E0=B8=B2?= =?UTF-8?q?=E0=B8=81=E0=B8=A3=E0=B8=93=E0=B8=B5=E0=B8=9E=E0=B8=B4=E0=B9=80?= =?UTF-8?q?=E0=B8=A8=E0=B8=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/interface/request/main/main.ts | 8 +- .../components/4_specialTime/Table.vue | 246 ++++++++++++ src/modules/09_leave/router.ts | 116 +++--- src/modules/09_leave/stores/LeaveStore.ts | 359 +++++++++--------- .../09_leave/stores/SpecialTimeStore.ts | 104 +++++ .../09_leave/views/SpecialTimeMain.vue | 150 ++++++++ .../6_BasicInformation/Director/Form.vue | 122 ++++-- .../11_discipline/interface/index/Main.ts | 4 +- .../interface/request/disciplinary.ts | 2 +- 9 files changed, 853 insertions(+), 258 deletions(-) create mode 100644 src/modules/09_leave/components/4_specialTime/Table.vue create mode 100644 src/modules/09_leave/stores/SpecialTimeStore.ts create mode 100644 src/modules/09_leave/views/SpecialTimeMain.vue diff --git a/src/interface/request/main/main.ts b/src/interface/request/main/main.ts index a3533531f..7048e30d3 100644 --- a/src/interface/request/main/main.ts +++ b/src/interface/request/main/main.ts @@ -390,12 +390,18 @@ const menuList = readonly([ }, { key: 9.3, + label: "ลงเวลากรณีพิเศษ", + path: "/special-time", + role: "leave", + }, + { + 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_specialTime/Table.vue b/src/modules/09_leave/components/4_specialTime/Table.vue new file mode 100644 index 000000000..da911aa3f --- /dev/null +++ b/src/modules/09_leave/components/4_specialTime/Table.vue @@ -0,0 +1,246 @@ + + + diff --git a/src/modules/09_leave/router.ts b/src/modules/09_leave/router.ts index 3636190f8..1a7996cc3 100644 --- a/src/modules/09_leave/router.ts +++ b/src/modules/09_leave/router.ts @@ -1,61 +1,71 @@ - -const workMain = () => import("@/modules/09_leave/views/WorkingMain.vue") +const workMain = () => import("@/modules/09_leave/views/WorkingMain.vue"); 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 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 SpecialTimeMain = () => + import("@/modules/09_leave/views/SpecialTimeMain.vue"); export default [ - { - path: "/round-time", - name: "/round-time", - component: RoundMain, - meta: { - Auth: true, - Key: [9], - Role: "coin", - }, + { + path: "/round-time", + name: "/round-time", + component: RoundMain, + meta: { + Auth: true, + Key: [9], + Role: "coin", }, - { - path: "/work-list", - name: "/work-list", - component: workMain, - meta: { - Auth: true, - Key: [9], - Role: "coin", - }, + }, + { + path: "/work-list", + name: "/work-list", + component: workMain, + meta: { + Auth: true, + Key: [9], + Role: "coin", }, - { - path: "/leave-list", - name: "/leave-list", - component: leaveMain, - meta: { - Auth: true, - Key: [9], - Role: "coin", - }, + }, + { + path: "/special-time", + name: "/special-time", + component: SpecialTimeMain, + meta: { + Auth: true, + Key: [9], + Role: "coin", }, - { - path: "/leave/detail/:id", - name: "/leave/detail", - component: leaveDetail, - meta: { - Auth: true, - Key: [9], - Role: "coin", - }, + }, + { + path: "/leave-list", + name: "/leave-list", + component: leaveMain, + meta: { + Auth: true, + Key: [9], + Role: "coin", }, - { - path: "/statistics-report", - name: "/statistics-report", - component: reportMain, - meta: { - Auth: true, - Key: [9], - Role: "coin", - }, + }, + { + path: "/leave/detail/:id", + name: "/leave/detail", + component: leaveDetail, + meta: { + Auth: true, + Key: [9], + Role: "coin", }, - - -] \ No newline at end of file + }, + { + path: "/statistics-report", + name: "/statistics-report", + component: reportMain, + meta: { + Auth: true, + Key: [9], + Role: "coin", + }, + }, +]; diff --git a/src/modules/09_leave/stores/LeaveStore.ts b/src/modules/09_leave/stores/LeaveStore.ts index 6a33dc509..f3e30f5c3 100644 --- a/src/modules/09_leave/stores/LeaveStore.ts +++ b/src/modules/09_leave/stores/LeaveStore.ts @@ -2,186 +2,195 @@ import { defineStore } from "pinia"; import { ref } from "vue"; import { useCounterMixin } from "@/stores/mixin"; -import type { DataOption } from "@/modules/09_leave/interface/index/Main" +import type { DataOption } from "@/modules/09_leave/interface/index/Main"; import type { QTableProps } from "quasar"; -import type { DataRows } from "@/modules/09_leave/interface/response/leave" - +import type { DataRows } from "@/modules/09_leave/interface/response/leave"; const mixin = useCounterMixin(); const { date2Thai, showLoader, hideLoader } = mixin; export const useLeavelistDataStore = defineStore("leave", () => { - //TABMENU - const tab = ref("1"); - const amounttab1 = ref(0) - const amounttab2 = ref(0) + //TABMENU + const tab = ref("1"); + const amounttab1 = ref(0); + const amounttab2 = ref(0); + //ข้อมูลในตาราง + const mainData = ref([]); + const rows = ref([]); + const columns = ref([]); + const visibleColumns = ref([]); + const loadTable = ref(false); + async function fetchList(data: DataRows[]) { + let datalist = data.map((e: DataRows) => ({ + leaveType: e.leaveType, + name: e.name, + Date: e.Date, + status: convertSatatus(e.status), + })); + tab.value !== "1" + ? (mainData.value = datalist) + : (mainData.value = datalist.filter( + (e) => e.status === "อยู่ระหว่างกำเนินการ" + )); + const filteramounttab1 = datalist.filter( + (e) => e.status === "อยู่ระหว่างกำเนินการ" + ); + amounttab1.value = filteramounttab1.length; + amounttab2.value = datalist.length; + await fetchOption(); + await searchDataFn(selectType.value, selectStatus.value); + } + //filter table + const selectYear = ref("all"); + const selectType = ref("all"); + const selectStatus = ref("all"); + const optionYear = ref([{ id: "all", name: "ทั้งหมด" }]); + const optionType = ref([]); + const optionStatus = ref([]); + const optionTypeMain = ref([]); + const optionStatusMain = ref([]); + const filterTable = ref(""); + function searchDataFn(type: string, status: string) { + // selectYear.value = selectYear.value || "all" + type = type || "all"; + status = status || "all"; + // showLoader() + loadTable.value = true; + if (selectYear.value == "all" && type == "all" && status == "all") { + rows.value = mainData.value; + } else if (selectYear.value !== "all" && type == "all" && status == "all") { + console.log("ค้นหาจากปี"); + } else if (selectYear.value == "all" && type !== "all" && status == "all") { + console.log("ค้นหาจากประเภท"); + rows.value = mainData.value.filter((e: any) => e.leaveType === type); + } else if (selectYear.value == "all" && type == "all" && status !== "all") { + console.log("ค้นหาจากสถานะ"); + rows.value = mainData.value.filter((e: any) => e.status === status); + } else if ( + selectYear.value !== "all" && + type !== "all" && + status == "all" + ) { + console.log("ค้นหาจากปีและประเภท"); + } else if ( + selectYear.value !== "all" && + type == "all" && + status !== "all" + ) { + console.log("ค้นหาจากปีและสถานะ"); + } else if ( + selectYear.value == "all" && + type !== "all" && + status !== "all" + ) { + console.log("ค้นหาจากประเภทและสถานะ"); + rows.value = mainData.value.filter( + (e: any) => e.leaveType === type && e.status === status + ); + } else console.log("ค้นหาจากทั้งหมด"); + setTimeout(function () { + loadTable.value = false; + }, 500); + } + function clearFilter() { + selectYear.value = "all"; + selectType.value = "all"; + selectStatus.value = "all"; + filterTable.value = ""; + } + + function fetchOption() { + let data = []; + data = mainData.value; + const double_leaveType = [ + ...new Set(data.map((item: any) => item.leaveType)), + ]; + // หา optionType + optionTypeMain.value = [{ id: "all", name: "ทั้งหมด" }]; + for (let i = 1; i <= double_leaveType.length; i++) { + const type = double_leaveType[i - 1]; + if (typeof type === "string") { + const listtype: DataOption = { + id: type, + name: type, + }; + optionTypeMain.value.push(listtype); + optionType.value = optionTypeMain.value; + } + } + // หา optionStatus + const double_status = [...new Set(data.map((item: any) => item.status))]; + optionStatusMain.value = [{ id: "all", name: "ทั้งหมด" }]; + for (let i = 1; i <= double_status.length; i++) { + const status = double_status[i - 1]; + if (typeof status === "string") { + const liststatus: DataOption = { + id: status, + name: status, + }; + optionStatusMain.value.push(liststatus); + optionStatus.value = optionStatusMain.value; + } + } + } + // filter option + function filterOption(val: string, update: any, type: string) { + let data: DataOption[] = []; + let filter: DataOption[] = []; + if (type == "type") { + data = optionTypeMain.value; + } else if (type == "status") { + data = optionStatusMain.value; + } + if (val == "") { + update(() => { + filter = data; + }); + } else { + update(() => { + filter = data.filter((e) => e.name.search(val) !== -1); + }); + } + if (filter) { + if (type == "type") { + optionType.value = filter; + } else if (type == "status") { + optionStatus.value = filter; + } + } + } + + // convertSatatus + function convertSatatus(val: string) { + switch (val) { + case "1": + return "ใหม่"; + case "2": + return "อยู่ระหว่างกำเนินการ"; + case "3": + return "อนุมัติ"; + } + } + return { + tab, + amounttab1, + amounttab2, //ข้อมูลในตาราง - const mainData = ref([]) - const rows = ref([]) - const columns = ref([]); - const visibleColumns = ref([]); - const loadTable = ref(false) - async function fetchList(data: DataRows[]) { - let datalist = data.map((e: DataRows) => ({ - leaveType: e.leaveType, - name: e.name, - Date: e.Date, - status: convertSatatus(e.status) - })) - tab.value !== "1" ? mainData.value = datalist : mainData.value = datalist.filter((e) => e.status === "อยู่ระหว่างกำเนินการ") - const filteramounttab1 = datalist.filter((e) => e.status === "อยู่ระหว่างกำเนินการ") - amounttab1.value = filteramounttab1.length - amounttab2.value = datalist.length - await fetchOption() - await searchDataFn(selectType.value, selectStatus.value) + rows, + fetchList, + loadTable, + columns, + visibleColumns, - - } //filter table - const selectYear = ref('all') - const selectType = ref('all') - const selectStatus = ref('all') - const optionYear = ref([{ id: "all", name: 'ทั้งหมด' }]) - const optionType = ref([]) - const optionStatus = ref([]) - const optionTypeMain = ref([]) - const optionStatusMain = ref([]) - const filterTable = ref('') - function searchDataFn(type: string, status: string) { - // selectYear.value = selectYear.value || "all" - type = type || "all" - status = status || "all" - // showLoader() - loadTable.value = true - if (selectYear.value == "all" && type == "all" && status == "all") { - rows.value = mainData.value - } else if (selectYear.value !== "all" && type == "all" && status == "all") { - console.log("ค้นหาจากปี"); - } else if (selectYear.value == "all" && type !== "all" && status == "all") { - console.log("ค้นหาจากประเภท"); - rows.value = mainData.value.filter((e: any) => e.leaveType === type) - } else if (selectYear.value == "all" && type == "all" && status !== "all") { - console.log("ค้นหาจากสถานะ"); - rows.value = mainData.value.filter((e: any) => e.status === status) - } else if (selectYear.value !== "all" && type !== "all" && status == "all") { - console.log("ค้นหาจากปีและประเภท"); - } else if (selectYear.value !== "all" && type == "all" && status !== "all") { - console.log("ค้นหาจากปีและสถานะ"); - } else if (selectYear.value == "all" && type !== "all" && status !== "all") { - console.log("ค้นหาจากประเภทและสถานะ"); - rows.value = mainData.value.filter((e: any) => e.leaveType === type && e.status === status) - } else (console.log("ค้นหาจากทั้งหมด")) - setTimeout(function () { - loadTable.value = false - }, 500); - - } - function clearFilter() { - selectYear.value = "all" - selectType.value = "all" - selectStatus.value = "all" - filterTable.value = '' - } - - function fetchOption() { - let data = [] - data = mainData.value - const double_leaveType = [ - ...new Set(data.map((item: any) => item.leaveType)), - ]; - // หา optionType - optionTypeMain.value = [{ id: "all", name: "ทั้งหมด" }]; - for (let i = 1; i <= double_leaveType.length; i++) { - const type = double_leaveType[i - 1]; - if (typeof type === 'string') { - const listtype: DataOption = { - id: type, - name: type, - }; - optionTypeMain.value.push(listtype) - optionType.value = optionTypeMain.value - } - } - // หา optionStatus - const double_status = [ - ...new Set(data.map((item: any) => item.status)), - ]; - optionStatusMain.value = [{ id: "all", name: "ทั้งหมด" }]; - for (let i = 1; i <= double_status.length; i++) { - const status = double_status[i - 1]; - if (typeof status === 'string') { - const liststatus: DataOption = { - id: status, - name: status, - }; - optionStatusMain.value.push(liststatus); - optionStatus.value = optionStatusMain.value - } - } - } - // filter option - function filterOption(val: string, update: any, type: string) { - let data: DataOption[] = [] - let filter: DataOption[] = [] - if (type == "type") { - data = optionTypeMain.value - } else if (type == "status") { - data = optionStatusMain.value - } - if (val == "") { - update(() => { - filter = data; - }); - } else { - update(() => { - filter = data.filter( - (e) => e.name.search(val) !== -1 - ); - }); - } - if (filter) { - if (type == "type") { - optionType.value = filter - } else if (type == "status") { - optionStatus.value = filter - } - } - } - - - // convertSatatus - function convertSatatus(val: string) { - switch (val) { - case "1": - return "ใหม่" - case "2": - return "อยู่ระหว่างกำเนินการ" - case "3": - return "อนุมัติ" - } - } - return { - tab, - amounttab1, - amounttab2, - //ข้อมูลในตาราง - rows, - fetchList, - loadTable, - columns, - visibleColumns, - - //filter table - filterTable, - selectYear, - selectType, - selectStatus, - optionYear, - optionType, - optionStatus, - clearFilter, - searchDataFn, - filterOption, - - - }; -}) + filterTable, + selectYear, + selectType, + selectStatus, + optionYear, + optionType, + optionStatus, + clearFilter, + searchDataFn, + filterOption, + }; +}); diff --git a/src/modules/09_leave/stores/SpecialTimeStore.ts b/src/modules/09_leave/stores/SpecialTimeStore.ts new file mode 100644 index 000000000..8afd5a108 --- /dev/null +++ b/src/modules/09_leave/stores/SpecialTimeStore.ts @@ -0,0 +1,104 @@ +import { defineStore } from "pinia"; +import { ref } from "vue"; +import type { QTableProps } from "quasar"; +import type { + investigateDisDataRowType, + DataOption, +} from "@/modules/11_discipline/interface/index/Main"; +import { useCounterMixin } from "@/stores/mixin"; +const mixin = useCounterMixin(); +const { date2Thai } = mixin; + +export const useSpecialTimeStore = defineStore("LeaveSpecialTime", () => { + const rows = ref([]); + async function fecthList(data: any[]) { + let datalist: any[] = data.map((e: any) => ({ + fullname: e.fullname, + date: date2Thai(new Date(e.date)), + dateFix: date2Thai(new Date(e.dateFix)), + type: e.type, + reason: e.reason, + })); + rows.value = datalist; + } + + const visibleColumns = ref([ + "no", + "fullname", + "date", + "dateFix", + "type", + "reason", + ]); + + const columns = ref([ + { + name: "no", + align: "center", + label: "ลำดับ", + sortable: false, + field: "no", + 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: "date", + align: "left", + label: "วันที่กรอก", + sortable: true, + field: "date", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + sort: (a: string, b: string) => + a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), + }, + { + name: "dateFix", + align: "left", + label: "วันที่ขอแก้ไข", + sortable: true, + field: "dateFix", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + sort: (a: string, b: string) => + a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), + }, + { + name: "type", + align: "left", + label: "ประเภท", + sortable: true, + field: "type", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + sort: (a: string, b: string) => + a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), + }, + { + name: "reason", + align: "left", + label: "เหตุผล", + sortable: true, + field: "reason", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + sort: (a: string, b: string) => + a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), + }, + ]); + return { + fecthList, + rows, + visibleColumns, + columns, + }; +}); diff --git a/src/modules/09_leave/views/SpecialTimeMain.vue b/src/modules/09_leave/views/SpecialTimeMain.vue new file mode 100644 index 000000000..3286f8c40 --- /dev/null +++ b/src/modules/09_leave/views/SpecialTimeMain.vue @@ -0,0 +1,150 @@ + + + + + diff --git a/src/modules/11_discipline/components/6_BasicInformation/Director/Form.vue b/src/modules/11_discipline/components/6_BasicInformation/Director/Form.vue index 7b0d580d9..45ed7e1c5 100644 --- a/src/modules/11_discipline/components/6_BasicInformation/Director/Form.vue +++ b/src/modules/11_discipline/components/6_BasicInformation/Director/Form.vue @@ -34,13 +34,13 @@ const formData = reactive({ watch(props.data, async () => { // console.log("data==>", props.data) - formData.prefix = props.data.prefix - formData.firstname = props.data.firstname - formData.lastname = props.data.lastname - formData.position = props.data.position - formData.phone = props.data.phone - formData.responsibilities = props.data.responsibilities - formData.email = props.data.email + formData.prefix = props.data.prefix; + formData.firstname = props.data.firstname; + formData.lastname = props.data.lastname; + formData.position = props.data.position; + formData.phone = props.data.phone; + formData.responsibilities = props.data.responsibilities; + formData.email = props.data.email; }); // เพิ่มบุคลากร @@ -93,50 +93,120 @@ function onValidate() {
- +
- +
- +
- +
- +
- +
- +
- +
- +
- + บันทึกข้อมูล
diff --git a/src/modules/11_discipline/interface/index/Main.ts b/src/modules/11_discipline/interface/index/Main.ts index 3e94e9ffc..a0eb25edb 100644 --- a/src/modules/11_discipline/interface/index/Main.ts +++ b/src/modules/11_discipline/interface/index/Main.ts @@ -15,8 +15,8 @@ interface investigateDisDataRowType { interrogated: string; fault: string | undefined; penaltyLevel: string | undefined; - caseFault: string | undefined; - dateInvestigate: string | undefined; + caseFault: string; + dateInvestigate: string | null; status: string | undefined; active: string | undefined; } diff --git a/src/modules/11_discipline/interface/request/disciplinary.ts b/src/modules/11_discipline/interface/request/disciplinary.ts index 29a27ff6b..5a131513d 100644 --- a/src/modules/11_discipline/interface/request/disciplinary.ts +++ b/src/modules/11_discipline/interface/request/disciplinary.ts @@ -43,4 +43,4 @@ interface disciplinaryRef { [key: string]: any; } -export type { FormData, disciplinaryRef }; +export type { FormData, disciplinaryRef, investigateDisDataRowType };