KPI-evaluator => Load

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-08-29 17:42:11 +07:00
parent b828b21aea
commit b1909c852a
3 changed files with 17 additions and 35 deletions

View file

@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, onMounted, reactive, watch } from "vue";
import { ref, onMounted, watch } from "vue";
import { useRouter } from "vue-router";
import { useQuasar } from "quasar";
import config from "@/app.config";
@ -89,15 +89,15 @@ const columns = ref<QTableProps["columns"]>([
const totalList = ref<number>(0);
const maxPage = ref<number>(1);
function fetchRoundOption(type: boolean = false) {
async function fetchRoundOption(type: boolean = false) {
showLoader();
http
await http
.get(
config.API.kpiPeriod +
`?page=${1}&pageSize=${10}&keyword=${""}&year=${store.yearRound}`
)
.then((res) => {
const data = res.data.result.data;
.then(async (res) => {
const data = await res.data.result.data;
const list = data.map((e: ResRound) => ({
id: e.id,
name:
@ -111,7 +111,7 @@ function fetchRoundOption(type: boolean = false) {
if (type) {
store.formQuery.round = "";
}
fetchList();
await fetchList();
})
.catch((err) => {
messageError($q, err);
@ -121,7 +121,7 @@ function fetchRoundOption(type: boolean = false) {
});
}
function fetchList() {
async function fetchList() {
showLoader();
const body = {
page: store.formQuery.page,
@ -138,19 +138,13 @@ function fetchList() {
: store.tabMainevaluator === "6"
? "SUMMARY"
: undefined,
// evaluating:
// store.tabMainevaluator === "5"
// ? true
// : store.tabMainevaluator === "6"
// ? false
// : undefined,
reqedit: store.tabMainevaluator === "3" ? "NEW" : undefined,
};
http
await http
.post(config.API.kpiEvaluation + `/admin`, body)
.then((res) => {
const data = res.data.result;
.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;
@ -186,14 +180,13 @@ watch(
async function onChangTab() {
store.formQuery.page = 1;
dataListMain.value = await [];
store.selected = await [];
fetchList();
dataListMain.value = [];
store.selected = [];
await fetchList();
}
onMounted(async () => {
fetchRoundOption();
await fetchRoundOption();
});
</script>
@ -213,18 +206,7 @@ onMounted(async () => {
/>
รายการการประเมนผลการปฏราชการระดบบคคล
</div>
<!-- <div class="toptitle text-white col-12 row items-center">
<q-btn
icon="mdi-arrow-left"
unelevated
round
dense
flat
color="primary"
class="q-mr-sm"
@click="router.push(`/`)"
/>
</div> -->
<div class="col-12">
<q-card bordered class="q-pa-md">
<div class="items-center col-12 row q-col-gutter-sm q-mb-sm">