diff --git a/src/modules/07_insignia/components/2_Manage/StatCard.vue b/src/modules/07_insignia/components/2_Manage/StatCard.vue index c5c0e1e0b..5b0283228 100644 --- a/src/modules/07_insignia/components/2_Manage/StatCard.vue +++ b/src/modules/07_insignia/components/2_Manage/StatCard.vue @@ -1,9 +1,14 @@ - { :filter="filterKeyword2" row-key="fullname" class="custom-header-table" - :pagination-label="paginationLabel2" v-model:pagination="pagination2" > - - +
diff --git a/src/modules/07_insignia/components/2_Manage/Tab2.vue b/src/modules/07_insignia/components/2_Manage/Tab2.vue index 18527764f..fa33249f2 100644 --- a/src/modules/07_insignia/components/2_Manage/Tab2.vue +++ b/src/modules/07_insignia/components/2_Manage/Tab2.vue @@ -1,15 +1,22 @@ + + + - - - + > + + +
- { dense class="custom-header-table" :visible-columns="visibleColumns" - :pagination-label="paginationLabel" v-model:pagination="pagination" > - - + import { onMounted, ref, watch, reactive } from "vue"; import { useQuasar } from "quasar"; -import type { QTableProps } from "quasar"; -import { useInsigniaDataStore } from "@/modules/07_insignia/store"; import { useRouter } from "vue-router"; -import DialogInformation from "@/components/Dialogs/Information.vue"; -import { useroleUserDataStore } from "@/stores/roleUser"; +/** import Type*/ +import type { QTableProps } from "quasar"; + +/** import components*/ +import DialogInformation from "@/components/Dialogs/Information.vue"; + +/** import Stores */ +import { useInsigniaDataStore } from "@/modules/07_insignia/store"; +import { useroleUserDataStore } from "@/stores/roleUser"; +/** useStore*/ +const DataStore = useInsigniaDataStore(); const roleDataStore = useroleUserDataStore(); const { adminRole } = roleDataStore; const router = useRouter(); -const DataStore = useInsigniaDataStore(); + const props = defineProps({ tab: { type: String, @@ -31,19 +38,8 @@ const employeeClassOps = ref(DataStore.employeeClassOps); const filterOrganizationOP = ref([]); const organization = ref("1"); const organizationOptions = ref([{ id: "1", name: "ทั้งหมด" }]); -const visibleColumns = ref([ - "no", - "citizenId", - "name", - "employeeType", - "position", - "level", - "salary", - "insigniaType", - "insigniaSend", - "insigniaLevel", -]); -// หัวตาราง + +/** หัวตาราง*/ const columns = ref([ { name: "no", @@ -145,26 +141,21 @@ const columns = ref([ style: "font-size: 14px", }, ]); -onMounted(async () => { - organizationOptions.value = DataStore.optionsTypeOc; - // organization.value = await (DataStore.agency != null - // ? DataStore.agency - // : DataStore.typeOc); - organization.value = await DataStore.typeOc; - if (organization.value !== "" || organization.value !== undefined) { - if (props.fecthInsigniaByOc) { - await props.fecthInsigniaByOc( - props.roundId, - organization.value, - "officer", - props.tab - ); - DataStore.mainTab = props.tab; - } - } - filterOrganizationOP.value = organizationOptions.value; -}); -const changtypeOc = async () => { +const visibleColumns = ref([ + "no", + "citizenId", + "name", + "employeeType", + "position", + "level", + "salary", + "insigniaType", + "insigniaSend", + "insigniaLevel", +]); + +/** function เลือกหน่วยงาน */ +async function changtypeOc() { if (props.fecthInsigniaByOc) { await props.fecthInsigniaByOc( props.roundId, @@ -174,11 +165,17 @@ const changtypeOc = async () => { ); } DataStore.typeOc = organization.value; -}; -const nextPage = (id: string) => { - router.push(`/registry/${id}`); -}; +} +/** + * function redirect ทะเบียนประวัติิ + * @param id profileId + */ +function nextPage(id: string) { + router.push(`/registry/${id}`); +} + +/** ข้อมูล Table*/ const filterKeyword = ref(""); const filterRef = ref(null); const resetFilter = () => { @@ -191,24 +188,33 @@ const pagination = ref({ page: 1, rowsPerPage: 10, }); -const paging = ref(true); -const paginationLabel = (start: number, end: number, total: number) => { - if (paging.value == true) return " " + start + "-" + end + " ใน " + total; - else return start + "-" + end + " ใน " + total; -}; +/** หมายเหตุ*/ const dialogNote = ref(false); const note = ref(""); const noteTitle = ref(""); -const showNote = (row: any) => { +/** + * function openPopup แสดง หมายเหตุ + * @param row รายละเอียดข้อมูล + */ +function showNote(row: any) { note.value = row.requestNote; noteTitle.value = "เหตุผลการลบออก " + " " + row.name; dialogNote.value = true; -}; -const closeReson = () => { +} + +/** function closePopup หมายเหตุ*/ +function closeReson() { dialogNote.value = false; -}; -const filterSelector = (val: any, update: Function, name: any) => { +} + +/** + * function ค้นหาข้อมูลใน option + * @param val คำค้นหา + * @param update funtion + * @param name ชื่อ selec + */ +function filterSelector(val: any, update: Function, name: any) { update(() => { const needle = val.toLowerCase(); if (name === "typeinsigniaOptions") { @@ -227,8 +233,13 @@ const filterSelector = (val: any, update: Function, name: any) => { ); } }); -}; -const clearInsigniaFilters = (name: string) => { +} + +/** + * function clearfilter เครื่องราช + * @param name ชื่อ selec + */ +function clearInsigniaFilters(name: string) { if (name === "typeinsigniaOptions") { DataStore.typeinsignia = "all"; typeinsigniaOptions.value = DataStore.typeinsigniaOptions; @@ -236,7 +247,25 @@ const clearInsigniaFilters = (name: string) => { DataStore.employeeClass = "all"; employeeClassOps.value = DataStore.employeeClassOps; } -}; +} + +/** Hook*/ +onMounted(async () => { + organizationOptions.value = DataStore.optionsTypeOc; + organization.value = await DataStore.typeOc; + if (organization.value !== "" || organization.value !== undefined) { + if (props.fecthInsigniaByOc) { + await props.fecthInsigniaByOc( + props.roundId, + organization.value, + "officer", + props.tab + ); + DataStore.mainTab = props.tab; + } + } + filterOrganizationOP.value = organizationOptions.value; +});