fix: chang API orgPosAct To pagination
This commit is contained in:
parent
5fbb76690c
commit
5cf1d7836b
1 changed files with 19 additions and 11 deletions
|
|
@ -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<Array<string>>([]);
|
||||
const filter = ref<string>("");
|
||||
|
|
@ -166,14 +169,17 @@ const keyword = ref<string>("");
|
|||
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);
|
||||
|
|
@ -186,10 +192,12 @@ 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();
|
||||
}
|
||||
|
|
@ -293,11 +301,8 @@ async function getWorkFlow() {
|
|||
}
|
||||
|
||||
function onSearchRowPosition() {
|
||||
rowPosition.value = onSearchDataTable(
|
||||
keyword.value,
|
||||
dataPosition.value,
|
||||
columns.value ? columns.value : []
|
||||
);
|
||||
pagination.value.page = 1;
|
||||
fetchPosMaster();
|
||||
}
|
||||
|
||||
function onSearchListPerson() {
|
||||
|
|
@ -523,16 +528,19 @@ onMounted(async () => {
|
|||
</q-toolbar>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<d-table
|
||||
<p-table
|
||||
ref="table"
|
||||
:columns="columns"
|
||||
:rows="rowPosition"
|
||||
:paging="true"
|
||||
row-key="id"
|
||||
flat
|
||||
bordered
|
||||
:paging="true"
|
||||
dense
|
||||
:rows-per-page-options="[10, 25, 50, 100]"
|
||||
class="custom-header-table"
|
||||
@request="onRequest"
|
||||
v-model:pagination="pagination"
|
||||
>
|
||||
<template v-slot:header="props">
|
||||
<q-tr :props="props">
|
||||
|
|
@ -582,7 +590,7 @@ onMounted(async () => {
|
|||
</q-td>
|
||||
</q-tr>
|
||||
</template>
|
||||
</d-table>
|
||||
</p-table>
|
||||
</div>
|
||||
</div>
|
||||
</q-scroll-area>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue