fix load Table
This commit is contained in:
parent
1ec4a97538
commit
d39753fbde
56 changed files with 684 additions and 978 deletions
|
|
@ -1,5 +1,5 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, onMounted, watch } from "vue";
|
||||
import { ref, onMounted } from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
import { useQuasar } from "quasar";
|
||||
import type { QTableProps } from "quasar";
|
||||
|
|
@ -9,10 +9,7 @@ import http from "@/plugins/http";
|
|||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useKpiDataStore } from "@/modules/08_KPI/store";
|
||||
|
||||
import type {
|
||||
DataOptions,
|
||||
Pagination,
|
||||
} from "@/modules/08_KPI/interface/index/Main";
|
||||
import type { DataOptions } from "@/modules/08_KPI/interface/index/Main";
|
||||
import type {
|
||||
ResRound,
|
||||
ResEvaluatorAssessor,
|
||||
|
|
@ -24,7 +21,7 @@ import TabOther from "@/modules/08_KPI/components/Evaluator/02_TabOther.vue";
|
|||
const $q = useQuasar();
|
||||
const router = useRouter();
|
||||
const store = useKpiDataStore();
|
||||
const { showLoader, hideLoader, messageError, date2Thai } = useCounterMixin();
|
||||
const { messageError, date2Thai } = useCounterMixin();
|
||||
|
||||
const dataListMain = ref<ResEvaluatorAssessor[]>([]);
|
||||
|
||||
|
|
@ -87,7 +84,6 @@ const columns = ref<QTableProps["columns"]>([
|
|||
]);
|
||||
|
||||
const totalList = ref<number>(0);
|
||||
const maxPage = ref<number>(1);
|
||||
|
||||
/**
|
||||
* ดึงข้อมูลรายการขอรับประเมินผลการปฏิบัติราชการระดับบุคคล
|
||||
|
|
@ -121,19 +117,19 @@ async function fetchRoundOption() {
|
|||
store.formQuery.round = roundOp.value[0].id;
|
||||
await fetchList();
|
||||
}
|
||||
isLoadOp.value = false;
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
isLoadOp.value = false;
|
||||
})
|
||||
.finally(() => {});
|
||||
.finally(() => {
|
||||
isLoadOp.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
/** ดึงข้อมูล list */
|
||||
const isLoad = ref<boolean>(false)
|
||||
const isLoad = ref<boolean>(false);
|
||||
async function fetchList() {
|
||||
isLoad.value = true
|
||||
isLoad.value = true;
|
||||
const body = {
|
||||
page: store.formQuery.page,
|
||||
pageSize: store.formQuery.pageSize,
|
||||
|
|
@ -157,16 +153,15 @@ async function fetchList() {
|
|||
.post(config.API.kpiEvaluation + `/admin`, body)
|
||||
.then(async (res) => {
|
||||
const data = await res.data.result;
|
||||
maxPage.value = Math.ceil(data.total / store.formQuery.pageSize);
|
||||
totalList.value = data.total;
|
||||
dataListMain.value = data.data;
|
||||
isLoad.value = false
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
isLoad.value = false
|
||||
})
|
||||
.finally(() => {});
|
||||
.finally(() => {
|
||||
isLoad.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
/** เลือกรอบการประเมิน */
|
||||
|
|
@ -175,15 +170,6 @@ function changRound() {
|
|||
fetchList();
|
||||
}
|
||||
|
||||
/**
|
||||
* function updatePagination
|
||||
* @param newPagination ข้อมูล Pagination ใหม่
|
||||
*/
|
||||
function updatePagination(newPagination: Pagination) {
|
||||
store.formQuery.page = 1;
|
||||
store.formQuery.pageSize = newPagination.rowsPerPage;
|
||||
}
|
||||
|
||||
/** เปลี่ยน tab */
|
||||
async function onChangTab() {
|
||||
store.formQuery.page = 1;
|
||||
|
|
@ -192,13 +178,6 @@ async function onChangTab() {
|
|||
await fetchList();
|
||||
}
|
||||
|
||||
watch(
|
||||
() => store.formQuery.pageSize,
|
||||
() => {
|
||||
fetchList();
|
||||
}
|
||||
);
|
||||
|
||||
onMounted(async () => {
|
||||
await fetchRoundOption();
|
||||
});
|
||||
|
|
@ -347,8 +326,6 @@ onMounted(async () => {
|
|||
:rows="dataListMain"
|
||||
:formQuery="store.formQuery"
|
||||
:total="totalList"
|
||||
:maxPage="maxPage"
|
||||
:updatePagination="updatePagination"
|
||||
:fetchList="fetchList"
|
||||
:is-load="isLoad"
|
||||
/>
|
||||
|
|
@ -361,8 +338,6 @@ onMounted(async () => {
|
|||
:rows="dataListMain"
|
||||
:formQuery="store.formQuery"
|
||||
:total="totalList"
|
||||
:maxPage="maxPage"
|
||||
:updatePagination="updatePagination"
|
||||
:fetchList="fetchList"
|
||||
:is-load="isLoad"
|
||||
/>
|
||||
|
|
@ -375,8 +350,6 @@ onMounted(async () => {
|
|||
:rows="dataListMain"
|
||||
:formQuery="store.formQuery"
|
||||
:total="totalList"
|
||||
:maxPage="maxPage"
|
||||
:updatePagination="updatePagination"
|
||||
:fetchList="fetchList"
|
||||
:is-load="isLoad"
|
||||
/>
|
||||
|
|
@ -389,8 +362,6 @@ onMounted(async () => {
|
|||
:rows="dataListMain"
|
||||
:formQuery="store.formQuery"
|
||||
:total="totalList"
|
||||
:maxPage="maxPage"
|
||||
:updatePagination="updatePagination"
|
||||
:fetchList="fetchList"
|
||||
:is-load="isLoad"
|
||||
/>
|
||||
|
|
@ -403,8 +374,6 @@ onMounted(async () => {
|
|||
:rows="dataListMain"
|
||||
:formQuery="store.formQuery"
|
||||
:total="totalList"
|
||||
:maxPage="maxPage"
|
||||
:updatePagination="updatePagination"
|
||||
:fetchList="fetchList"
|
||||
:is-load="isLoad"
|
||||
/>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue