From 1c4776c68e4da57355093255170ec3fb95173d86 Mon Sep 17 00:00:00 2001 From: waruneeta Date: Wed, 1 Nov 2023 16:35:08 +0700 Subject: [PATCH 1/5] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B8=84?= =?UTF-8?q?=E0=B8=B3=E0=B8=9C=E0=B8=B4=E0=B8=94=20=E0=B9=81=E0=B8=A5?= =?UTF-8?q?=E0=B8=B0=E0=B8=9B=E0=B8=B4=E0=B8=94=20column=20=E0=B8=84?= =?UTF-8?q?=E0=B8=B3=E0=B8=AD=E0=B8=98=E0=B8=B4=E0=B8=9A=E0=B8=B2=E0=B8=A2?= =?UTF-8?q?=E0=B8=82=E0=B8=AD=E0=B8=87=E0=B8=A3=E0=B8=AD=E0=B8=9A=E0=B8=81?= =?UTF-8?q?=E0=B8=B2=E0=B8=A3=E0=B8=9B=E0=B8=8F=E0=B8=B4=E0=B8=9A=E0=B8=B1?= =?UTF-8?q?=E0=B8=95=E0=B8=B4=E0=B8=87=E0=B8=B2=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../09_leave/interface/response/round.ts | 2 - src/modules/09_leave/stores/RoundStores.ts | 10 --- src/modules/09_leave/views/LeaveListMain.vue | 2 +- src/modules/09_leave/views/RoundMain.vue | 79 ++++++++++--------- 4 files changed, 41 insertions(+), 52 deletions(-) diff --git a/src/modules/09_leave/interface/response/round.ts b/src/modules/09_leave/interface/response/round.ts index 56882fdf7..402b5f92e 100644 --- a/src/modules/09_leave/interface/response/round.ts +++ b/src/modules/09_leave/interface/response/round.ts @@ -10,7 +10,6 @@ interface dataRowRound { amOut: string pm: string pmOut: string - note: string status: boolean isDefault: boolean } @@ -22,7 +21,6 @@ interface roundShow { pmOut: string; amRound: string; pmRound: string; - note: string; status: boolean; isDefault: boolean; } diff --git a/src/modules/09_leave/stores/RoundStores.ts b/src/modules/09_leave/stores/RoundStores.ts index 8c8cc09be..e7e3ee335 100644 --- a/src/modules/09_leave/stores/RoundStores.ts +++ b/src/modules/09_leave/stores/RoundStores.ts @@ -45,15 +45,6 @@ export const useRoundDataStore = defineStore( headerStyle: "font-size: 14px", style: "font-size: 14px", }, - { - name: "note", - align: "left", - label: "คำอธิบาย", - sortable: true, - field: "note", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - }, { name: "status", align: "center", @@ -77,7 +68,6 @@ export const useRoundDataStore = defineStore( pmOut: e.pmOut, amRound:`${e.am}-${e.amOut}`, pmRound:`${e.pm}-${e.pmOut}`, - note: e.note === '' ? '-':e.note, status: e.status, isDefault: e.isDefault, }; diff --git a/src/modules/09_leave/views/LeaveListMain.vue b/src/modules/09_leave/views/LeaveListMain.vue index 481095986..4d2a76929 100644 --- a/src/modules/09_leave/views/LeaveListMain.vue +++ b/src/modules/09_leave/views/LeaveListMain.vue @@ -67,7 +67,7 @@ function changTab() { (false) -const detailData = ref() -const editCheck = ref('') +const modal = ref(false); +const detailData = ref(); +const editCheck = ref(""); // ค้นหาในตาราง const filterKeyword = ref(""); const filterRef = ref(null); @@ -35,17 +35,17 @@ const paginationLabel = (start: string, end: string, total: string) => { else return start + "-" + end + " ใน " + total; }; -function openModal(data:any,check:string){ - modal.value = true - editCheck.value = check - if(check === 'edit'){ - detailData.value = data - } -}; +function openModal(data: any, check: string) { + modal.value = true; + editCheck.value = check; + if (check === "edit") { + detailData.value = data; + } +} -function closeDialog(){ - modal.value = false - editCheck.value = 'add' +function closeDialog() { + modal.value = false; + editCheck.value = "add"; } onMounted(() => { dataStore.fetchData([ @@ -54,36 +54,32 @@ onMounted(() => { amOut: "12:00", pm: "13:00", pmOut: "15:30", - note: "", status: true, - isDefault:true + isDefault: true, }, { am: "08:30", amOut: "12:00", pm: "13:00", pmOut: "15:30", - note: "", status: false, - isDefault:false + isDefault: false, }, { am: "09:30", amOut: "12:00", pm: "13:00", pmOut: "15:30", - note: "", status: true, - isDefault:false + isDefault: false, }, { am: "10:30", amOut: "12:00", pm: "13:00", pmOut: "15:30", - note: "", status: true, - isDefault:false + isDefault: false, }, ]); }); @@ -97,7 +93,7 @@ onMounted(() => {
{ v-for="col in props.cols" :key="col.name" :props="props" - style="color: #000000; font-weight: 500;" + style="color: #000000; font-weight: 500" > - {{ col.label }} + {{ col.label }} @@ -182,15 +178,20 @@ onMounted(() => { - เวลา Default + v-if="props.row.isDefault === true" + name="mdi-bookmark" + size="xs" + color="primary" + > + เวลา Default - +
{
- + 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 };