diff --git a/src/api/11_discipline/api.discipline.ts b/src/api/11_discipline/api.discipline.ts index 4bb3f94a2..d8b2ff9d2 100644 --- a/src/api/11_discipline/api.discipline.ts +++ b/src/api/11_discipline/api.discipline.ts @@ -7,6 +7,7 @@ const appeal = `${env.API_URI}/discipline/complaint_appeal`; const disciplineReport = `${env.API_URI}/discipline/report`; export default { + directorListMain: `${disciplineMain}/director/`, directorList: ( page: number, pageSize: number, @@ -82,13 +83,8 @@ export default { `${discipline}/director/${disciplineId}/${id}`, /** ผู้ถูกพักราชการ */ - suspendMain: ( - page: number, - pageSize: number, - keyword: string, - type: string - ) => - `${suspend}?page=${page}&pageSize=${pageSize}&keyword=${keyword}&profileType=${type}`, + suspendMain: suspend, + suspendById: (id: string) => `${suspend}/${id}`, suspendReport: () => `${suspend}/report`, @@ -101,15 +97,7 @@ export default { deleteFileResult: (id: string, docId: string) => `${disciplineMain}/result/file/${id}/${docId}`, - appealMainList: ( - status: string, - type: string, - year: number, - page: number, - pageSize: number, - keyword: string - ) => - `${appeal}/admin?status=${status}&type=${type}&year=${year}&page=${page}&pageSize=${pageSize}&keyword=${keyword}`, + appealMainList: `${appeal}/admin?`, appealAdd: () => `${appeal}`, appealByID: (id: string) => `${appeal}/${id}`, appealByIDGet: (id: string) => `${appeal}/admin/${id}`, diff --git a/src/modules/11_discipline/components/1_Complaint/MainPage.vue b/src/modules/11_discipline/components/1_Complaint/MainPage.vue index c7fab72c0..baf855b80 100644 --- a/src/modules/11_discipline/components/1_Complaint/MainPage.vue +++ b/src/modules/11_discipline/components/1_Complaint/MainPage.vue @@ -11,6 +11,7 @@ import { checkPermission } from "@/utils/permissions"; import { useCounterMixin } from "@/stores/mixin"; import { useComplainstDataStore } from "@/modules/11_discipline/store/ComplaintsStore"; import { useDisciplineMainStore } from "@/modules/11_discipline/store/Main"; +import { usePagination } from "@/composables/usePagination"; import type { DataOption } from "@/modules/11_discipline/interface/index/Main"; @@ -25,51 +26,51 @@ const mixin = useCounterMixin(); const complainstStore = useComplainstDataStore(); const { fetchComplainst } = complainstStore; const { showLoader, messageError, hideLoader, convertDateToAPI } = mixin; +const { pagination, params, onRequest } = usePagination("", getList); -const filterRef = ref(null); -const filterTable = ref(""); const filterKeyword = ref(""); - -const toptitle = ref(0); const statusFilter = ref("NEW"); const option = ref(complainstStore.statusOptions); -const total = ref(0); -const totalList = ref(1); -const pagination = ref({ - sortBy: "createdAt", - descending: true, - page: 1, - rowsPerPage: 10, -}); - /** ดึงข้อมูล เรื่องร้องเรียน */ -async function getList(page?: number) { +async function getList() { const body = { - page: page ? page : pagination.value.page, - pageSize: pagination.value.rowsPerPage, + ...params.value, keyword: filterKeyword.value.trim(), status: statusFilter.value, - ...(store.formComplaint.dateReceived?.[0] && { dateReceivedStart: convertDateToAPI(store.formComplaint.dateReceived[0])}), - ...(store.formComplaint.dateReceived?.[1] && { dateReceivedEnd: convertDateToAPI(store.formComplaint.dateReceived[1])}), - ...(store.formComplaint.respondentType && { respondentType: store.formComplaint.respondentType}), - ...(store.formComplaint.offenseDetails && { offenseDetails: store.formComplaint.offenseDetails}), - ...(store.formComplaint.levelConsideration && { levelConsideration: store.formComplaint.levelConsideration}), - ...(store.formComplaint.dateConsideration?.[0] && { dateConsiderationStart: convertDateToAPI( store.formComplaint.dateConsideration[0])}), - ...(store.formComplaint.dateConsideration?.[1] && { dateConsiderationEnd: convertDateToAPI( store.formComplaint.dateConsideration[1])}), + ...(store.formComplaint.dateReceived?.[0] && { + dateReceivedStart: convertDateToAPI(store.formComplaint.dateReceived[0]), + }), + ...(store.formComplaint.dateReceived?.[1] && { + dateReceivedEnd: convertDateToAPI(store.formComplaint.dateReceived[1]), + }), + ...(store.formComplaint.respondentType && { + respondentType: store.formComplaint.respondentType, + }), + ...(store.formComplaint.offenseDetails && { + offenseDetails: store.formComplaint.offenseDetails, + }), + ...(store.formComplaint.levelConsideration && { + levelConsideration: store.formComplaint.levelConsideration, + }), + ...(store.formComplaint.dateConsideration?.[0] && { + dateConsiderationStart: convertDateToAPI( + store.formComplaint.dateConsideration[0] + ), + }), + ...(store.formComplaint.dateConsideration?.[1] && { + dateConsiderationEnd: convertDateToAPI( + store.formComplaint.dateConsideration[1] + ), + }), }; showLoader(); await http .post(config.API.complaintList(), body) - // .then(async (res) => { - totalList.value = Math.ceil( - res.data.result.total / pagination.value.rowsPerPage - ); - total.value = res.data.result.total; - toptitle.value = res.data.result.total; - const data = res.data.result.data; - await fetchComplainst(data); + const result = res.data.result; + pagination.value.rowsNumber = result.total; + await fetchComplainst(result.data); }) .catch((e) => { messageError($q, e); @@ -102,13 +103,6 @@ function getSearch() { getList(); } -watch( - () => pagination.value.rowsPerPage, - async () => { - getSearch(); - } -); - /** เรียกใช้งาน ฟังชั่น ตอนเริ่มโหลดหน้า */ onMounted(async () => { await getList(); @@ -119,99 +113,120 @@ onMounted(async () => {
รายการเรื่องร้องเรียน
- -
- - - - + +
+
+
+
+
+
+ + + + +
-
- เพิ่มเรื่องร้องเรียน +
+ เพิ่มเรื่องร้องเรียน +
+
+
+ + + +
+
+
+ +
+
+ + + +
+ +
+ +
+
+
+
- - - - - - -
- -
- +
+ +
diff --git a/src/modules/11_discipline/components/1_Complaint/TableComplaint.vue b/src/modules/11_discipline/components/1_Complaint/TableComplaint.vue index ff67a7b59..a0bccc8fd 100644 --- a/src/modules/11_discipline/components/1_Complaint/TableComplaint.vue +++ b/src/modules/11_discipline/components/1_Complaint/TableComplaint.vue @@ -1,28 +1,24 @@ diff --git a/src/modules/11_discipline/components/2_InvestigateFacts/MainPage.vue b/src/modules/11_discipline/components/2_InvestigateFacts/MainPage.vue index 7f4027ef5..088b511ca 100644 --- a/src/modules/11_discipline/components/2_InvestigateFacts/MainPage.vue +++ b/src/modules/11_discipline/components/2_InvestigateFacts/MainPage.vue @@ -9,39 +9,30 @@ import { useCounterMixin } from "@/stores/mixin"; import { useInvestigateFactStore } from "@/modules/11_discipline/store/InvestigateFactStore"; import { useDisciplineMainStore } from "@/modules/11_discipline/store/Main"; import { checkPermission } from "@/utils/permissions"; +import { usePagination } from "@/composables/usePagination"; import DialogSearchAdvanced from "@/modules/11_discipline/components/DialogSearchAdvanced.vue"; +import type { DataOption } from "@/modules/11_discipline/interface/index/Main"; + const $q = useQuasar(); //ใช้ noti quasar const store = useDisciplineMainStore(); const mixin = useCounterMixin(); const dataInvestigate = useInvestigateFactStore(); const { messageError, showLoader, hideLoader, convertDateToAPI } = mixin; +const { pagination, params, onRequest } = usePagination("", getList); -const option = ref(dataInvestigate.statusOptions); +const attrs = ref(useAttrs()); +const option = ref(dataInvestigate.statusOptions); /** ค้นหาข้อมูลในตาราง */ const filterKeyword = ref(""); -const filterRef = ref(null); const statusFilter = ref("NEW"); -const toptitle = ref(0); - -const total = ref(0); -const totalList = ref(1); -const pagination = ref({ - sortBy: "createdAt", - descending: true, - page: 1, - rowsPerPage: 10, -}); - -const attrs = ref(useAttrs()); /** ดึงข้อมูลบสวน */ -async function getList(page?: number) { +async function getList() { const body = { - page: page ? page : pagination.value.page, - pageSize: pagination.value.rowsPerPage, + ...params.value, keyword: filterKeyword.value.trim(), status: statusFilter.value, ...(store.formInvestigateFacts.respondentType && { @@ -82,14 +73,9 @@ async function getList(page?: number) { await http .post(config.API.investigateMain(), body) .then(async (res) => { - totalList.value = Math.ceil( - res.data.result.total / pagination.value.rowsPerPage - ); - total.value = res.data.result.total; - toptitle.value = res.data.result.total; - - const data = res.data.result.data; - await dataInvestigate.fecthList(data); + const result = res.data.result; + pagination.value.rowsNumber = result.total; + await dataInvestigate.fecthList(result.data); }) .catch((e) => { messageError($q, e); @@ -104,7 +90,7 @@ async function getList(page?: number) { * @param id ไอดีเฉพาะ รายบุคคล */ async function editPage(id: string) { - dataInvestigate.tabMenu = await "investigatefacts"; + dataInvestigate.tabMenu = "investigatefacts"; router.push(`/discipline/investigatefacts/${id}`); } /** @@ -112,7 +98,7 @@ async function editPage(id: string) { * @param id ไอดีเฉพาะ รายบุคคล */ async function detailPage(id: string) { - dataInvestigate.tabMenu = await "investigatefacts"; + dataInvestigate.tabMenu = "investigatefacts"; router.push(`/discipline-detail/investigatefacts/${id}`); } @@ -129,27 +115,12 @@ function filterOptionFn(val: string, update: Function) { }); } -function updatePagination(newPagination: any) { - pagination.value.page = 1; - pagination.value.rowsPerPage = newPagination.rowsPerPage; -} - -function getSerach() { +function getSearch() { pagination.value.page = 1; getList(); } -watch( - () => pagination.value.rowsPerPage, - async () => { - getSerach(); - } -); - -/**เมื่อเริ่มโหลดหน้า - * ส่งข้อมูลจำลองไปยัง store - */ -onMounted(async () => { +onMounted(() => { getList(); }); @@ -158,173 +129,175 @@ onMounted(async () => {
รายการสืบสวนข้อเท็จจริง
- -
- - - - - - - - - - - -
- -
- - - + + +
+ + +
+
+
+ +
+ +
+ + + +
+ +
+ +
+
+
+
+
+ +
+ + + - - + {{ props.row.active }} + + + + +
diff --git a/src/modules/11_discipline/components/3_InvestigateDisciplinary/MainPage.vue b/src/modules/11_discipline/components/3_InvestigateDisciplinary/MainPage.vue index 143cc3487..71d45e603 100644 --- a/src/modules/11_discipline/components/3_InvestigateDisciplinary/MainPage.vue +++ b/src/modules/11_discipline/components/3_InvestigateDisciplinary/MainPage.vue @@ -2,25 +2,16 @@ import { onMounted, ref, watch } from "vue"; import { useQuasar } from "quasar"; +import http from "@/plugins/http"; +import config from "@/app.config"; import { useRouter } from "vue-router"; import { useCounterMixin } from "@/stores/mixin"; import { useInvestigateDisStore } from "@/modules/11_discipline/store/InvestigateDisStore"; import { useDisciplineMainStore } from "@/modules/11_discipline/store/Main"; - -import http from "@/plugins/http"; -import config from "@/app.config"; +import { usePagination } from "@/composables/usePagination"; import Table from "@/modules/11_discipline/components/3_InvestigateDisciplinary/Table.vue"; -const total = ref(0); -const totalList = ref(1); -const pagination = ref({ - sortBy: "createdAt", - descending: true, - page: 1, - rowsPerPage: 10, -}); - const $q = useQuasar(); //ใช้ noti quasar const router = useRouter(); const mixin = useCounterMixin(); @@ -28,14 +19,18 @@ const store = useDisciplineMainStore(); const dataInvestigateDis = useInvestigateDisStore(); const { showLoader, hideLoader, messageError, convertDateToAPI } = mixin; const { fetchList } = dataInvestigateDis; +const { pagination, params, onRequest } = usePagination( + "", + fetchListDisciplinary +); const filter = ref(""); //search data table const status = ref("NEW"); -async function fetchListDisciplinary(page?: number) { + +async function fetchListDisciplinary() { const body = { - page: page ? page : pagination.value.page, - pageSize: pagination.value.rowsPerPage, + ...params.value, keyword: filter.value.trim(), status: status.value, ...(store.formInvestigateDisciplinary.respondentType && { @@ -77,12 +72,9 @@ async function fetchListDisciplinary(page?: number) { await http .post(config.API.disciplineDisciplinary(), body) .then(async (res) => { - const data = res.data.result.data; - totalList.value = Math.ceil( - res.data.result.total / pagination.value.rowsPerPage - ); - total.value = res.data.result.total; - await fetchList(data); + const result = res.data.result; + pagination.value.rowsNumber = result.total; + await fetchList(result.data); }) .catch((e) => { messageError($q, e); @@ -112,18 +104,11 @@ function filterStatus(statusReturn: string) { getSearch(); } -function getSearch(page?: number) { +function getSearch() { pagination.value.page = 1; - fetchListDisciplinary(page); + fetchListDisciplinary(); } -watch( - () => pagination.value.rowsPerPage, - async () => { - getSearch(); - } -); - /**เมื่อเริ่มโหลดหน้า * ส่งข้อมูลจำลองไปยัง store */ @@ -136,29 +121,26 @@ onMounted(async () => {
รายการสอบสวนความผิดทางวินัย
- -
- -
-
+ + +
diff --git a/src/modules/11_discipline/components/3_InvestigateDisciplinary/Table.vue b/src/modules/11_discipline/components/3_InvestigateDisciplinary/Table.vue index a6d5db40a..04ae6b6ac 100644 --- a/src/modules/11_discipline/components/3_InvestigateDisciplinary/Table.vue +++ b/src/modules/11_discipline/components/3_InvestigateDisciplinary/Table.vue @@ -1,23 +1,22 @@ - + diff --git a/src/modules/11_discipline/components/4_Result/MainPage.vue b/src/modules/11_discipline/components/4_Result/MainPage.vue index 7e25a0d71..3483b5e62 100644 --- a/src/modules/11_discipline/components/4_Result/MainPage.vue +++ b/src/modules/11_discipline/components/4_Result/MainPage.vue @@ -8,7 +8,7 @@ import config from "@/app.config"; import { useCounterMixin } from "@/stores/mixin"; import { useDisciplineResultStore } from "@/modules/11_discipline/store/ResultStore"; import { useDisciplineMainStore } from "@/modules/11_discipline/store/Main"; -import type { Pagination } from "@/modules/03_recruiting/interface/index/Main"; +import { usePagination } from "@/composables/usePagination"; import Table from "@/modules/11_discipline/components/4_Result/Table.vue"; @@ -19,23 +19,15 @@ const storeResult = useDisciplineResultStore(); const store = useDisciplineMainStore(); const { showLoader, hideLoader, messageError, convertDateToAPI } = mixin; const { fetchList } = storeResult; +const { pagination, params, onRequest } = usePagination("", fetchListResult); const filter = ref(""); const status = ref("DONE"); -const total = ref(0); -const totalList = ref(1); -const pagination = ref({ - sortBy: "createdAt", - descending: true, - page: 1, - rowsPerPage: 10, -}); /** function เรียกรายการสรุปผลการพิจารณาทางวินัย*/ -async function fetchListResult(page?: number) { +async function fetchListResult() { const body = { - page: page ? page : pagination.value.page, - pageSize: pagination.value.rowsPerPage, + ...params.value, keyword: filter.value.trim(), status: status.value, ...(store.formResult.respondentType && { @@ -77,12 +69,9 @@ async function fetchListResult(page?: number) { await http .post(config.API.listResult(), body) .then(async (res) => { - const data = res.data.result.data; - totalList.value = Math.ceil( - res.data.result.total / pagination.value.rowsPerPage - ); - total.value = res.data.result.total; - await fetchList(data); + const result = res.data.result; + pagination.value.rowsNumber = result.total; + await fetchList(result.data); }) .catch((err) => { messageError($q, err); @@ -112,18 +101,11 @@ function filterStatus(statusReturn: string) { getSearch(); } -function getSearch(page?: number) { +function getSearch() { pagination.value.page = 1; - fetchListResult(page); + fetchListResult(); } -watch( - () => pagination.value.rowsPerPage, - async () => { - getSearch(); - } -); - /**เมื่อเริ่มโหลดหน้า * ส่งข้อมูลจำลองไปยัง store */ @@ -136,29 +118,25 @@ onMounted(async () => {
รายการสรุปผลการพิจารณาความผิดทางวินัย
- -
- -
-
+ + diff --git a/src/modules/11_discipline/components/4_Result/Table.vue b/src/modules/11_discipline/components/4_Result/Table.vue index 40efc64f6..bb6ea694b 100644 --- a/src/modules/11_discipline/components/4_Result/Table.vue +++ b/src/modules/11_discipline/components/4_Result/Table.vue @@ -1,22 +1,23 @@ - + diff --git a/src/modules/11_discipline/components/6_BasicInformation/Director/AddPage.vue b/src/modules/11_discipline/components/6_BasicInformation/Director/AddPage.vue index 8c2dcd239..6fbc4ecb0 100644 --- a/src/modules/11_discipline/components/6_BasicInformation/Director/AddPage.vue +++ b/src/modules/11_discipline/components/6_BasicInformation/Director/AddPage.vue @@ -19,32 +19,31 @@ const router = useRouter(); * @param id ระบุ บุคคล */ function onSubmit(formData: FormDataPost) { - dialogConfirm($q, () => addData(formData)); -} - -function addData(formData: FormDataPost) { - showLoader(); - http - .post(config.API.director(), { - personalId: formData.personalId ?? "", - prefix: formData.prefix, - firstName: formData.firstname, - lastName: formData.lastname, - position: formData.position, - email: formData.email, - phone: formData.phone, - qualification: formData.qualification, - rootDnaId: formData.rootDnaId, - }) - .then((res) => { - success($q, "บันทึกข้อมูลสำเร็จ"); - }) - .catch((e) => { - messageError($q, e); - }) - .finally(async () => { - router.push(`/discipline/director`); - }); + dialogConfirm($q, async () => { + showLoader(); + await http + .post(config.API.director(), { + personalId: formData.personalId ?? "", + prefix: formData.prefix, + firstName: formData.firstname, + lastName: formData.lastname, + position: formData.position, + email: formData.email, + phone: formData.phone, + qualification: formData.qualification, + rootDnaId: formData.rootDnaId, + }) + .then(async () => { + await success($q, "บันทึกข้อมูลสำเร็จ"); + await router.push(`/discipline/director`); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); + }); }