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..259f2598e 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 @@
-
-
-
-
-
-
- ไม่มีข้อมูล
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+ ไม่มีข้อมูล
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ หมายเหตุ: ค้นหาจากเรื่องร้องเรียน ประเภทวินัย ประเภทของเรื่อง
+ หน่วนงาน/ส่วนราชการ หรือปีงบประมาณ
+
+
+
+
+
+
+
+
+
+
+
- หมายเหตุ: ค้นหาจากเรื่องร้องเรียน ประเภทวินัย ประเภทของเรื่อง
- หน่วนงาน/ส่วนราชการ หรือปีงบประมาณ
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+ รายละเอียด
+
+
+ แก้ไขข้อมูล
+
+
+
+
+ {{ props.rowIndex + 1 }}
+
+
+
+ {{ col.value ?? "-" }}
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
- รายละเอียด
-
-
- แก้ไขข้อมูล
-
-
-
-
- {{
- (pagination.page - 1) * pagination.rowsPerPage +
- props.rowIndex +
- 1
- }}
-
-
- {{ props.row.title ?? "-" }}
-
-
- {{ col.value ?? "-" }}
-
-
-
-
-
- ทั้งหมด {{ total }} รายการ
-
-
-
-
+
diff --git a/src/modules/11_discipline/store/ResultStore.ts b/src/modules/11_discipline/store/ResultStore.ts
index 54406a2fc..b7b4020c6 100644
--- a/src/modules/11_discipline/store/ResultStore.ts
+++ b/src/modules/11_discipline/store/ResultStore.ts
@@ -42,7 +42,7 @@ export const useDisciplineResultStore = defineStore(
"offenseDetails",
"disciplinaryFaultLevel",
"disciplinaryCaseFault",
- "disciplinaryDate",
+ "disciplinaryDateStart",
"resultDisciplineType",
"resultTitleType",
"resultOc",
@@ -77,8 +77,6 @@ export const useDisciplineResultStore = defineStore(
field: "respondentType",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
- sort: (a: string, b: string) =>
- a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "offenseDetails",
@@ -88,8 +86,6 @@ export const useDisciplineResultStore = defineStore(
field: "offenseDetails",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
- sort: (a: string, b: string) =>
- a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "disciplinaryFaultLevel",
@@ -99,8 +95,6 @@ export const useDisciplineResultStore = defineStore(
field: "disciplinaryFaultLevel",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
- sort: (a: string, b: string) =>
- a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "disciplinaryCaseFault",
@@ -110,11 +104,9 @@ export const useDisciplineResultStore = defineStore(
field: "disciplinaryCaseFault",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
- sort: (a: string, b: string) =>
- a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
- name: "disciplinaryDate",
+ name: "disciplinaryDateStart",
align: "left",
label: "วันที่สอบสวน",
sortable: true,
@@ -162,7 +154,7 @@ export const useDisciplineResultStore = defineStore(
name: "status",
align: "left",
label: "สถานะ",
- sortable: true,
+ sortable: false,
field: "status",
headerStyle: "font-size: 14px",
style: "font-size: 14px",