diff --git a/src/modules/17_acting/views/main.vue b/src/modules/17_acting/views/main.vue index 80c8f3c68..359aeba40 100644 --- a/src/modules/17_acting/views/main.vue +++ b/src/modules/17_acting/views/main.vue @@ -12,6 +12,7 @@ import { import { useCounterMixin } from "@/stores/mixin"; import { useActingStore } from "@/modules/17_acting/store/Main"; import { useStructureTree } from "@/stores/structureTree"; +import { usePagination } from "@/composables/usePagination"; /** importType*/ import type { QTableProps } from "quasar"; @@ -39,6 +40,8 @@ const { onSearchDataTable, } = useCounterMixin(); +const { pagination, params, onRequest } = usePagination("", fetchPosMaster); + /** โครงสร้าง*/ const expanded = ref>([]); const filter = ref(""); @@ -46,6 +49,8 @@ const nodeTree = ref([]); const posmasterId = ref(""); const isAll = ref(false); const modalCommand = ref(false); + +const isAllRoot = ref(false); /** * function เรียกข้อมูลโครงสร้าง แบบปัจุบัน */ @@ -78,9 +83,11 @@ const isLaod = ref(false); * @param data ข้อมูลตำแหน่ง */ async function updateSelected(data: PosMaster) { + isLaod.value = true; posmasterId.value = data.posmasterId; storeActing.rootId = data.orgTreeId; - isLaod.value = true; + pagination.value.page = 1; + pagination.value.rowsNumber = 10; // เรียกใช้ function fetch รายชื่อ ,fetch รายชื่อรักษาการ await Promise.all([fetchPosMaster(), fetchListAct()]).finally(() => { isLaod.value = false; @@ -164,13 +171,17 @@ const keyword = ref(""); async function fetchPosMaster() { await http .post(config.API.orgPosAct + `/search`, { + ...params.value, + // keyword: keyword.value.trim(), posmasterId: posmasterId.value, isAll: isAll.value, + isAllRoot: isAllRoot.value, }) .then((res) => { - const data = res.data.result; - rowPosition.value = data; - dataPosition.value = data; + const result = res.data.result; + pagination.value.rowsNumber = result.total; + rowPosition.value = result.data; + dataPosition.value = result.data; }) .catch((err) => { messageError($q, err); @@ -183,6 +194,13 @@ async function fetchPosMaster() { */ function updateIsAll(val: boolean) { isAll.value = val; + pagination.value.page = 1; + fetchPosMaster(); +} + +function updateIsAllRoot(val: boolean) { + pagination.value.page = 1; + isAllRoot.value = val; fetchPosMaster(); } @@ -285,11 +303,8 @@ async function getWorkFlow() { } function onSearchRowPosition() { - rowPosition.value = onSearchDataTable( - keyword.value, - dataPosition.value, - columns.value ? columns.value : [] - ); + pagination.value.page = 1; + fetchPosMaster(); } function onSearchListPerson() { @@ -475,6 +490,18 @@ onMounted(async () => {
+
+ + แสดงทั้งหมดภายใต้หน่วยงาน + +
+
{
- - +