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

@ -118,7 +118,7 @@ const pagination = ref({
boundary-links boundary-links
direction-links direction-links
:max-pages="5" :max-pages="5"
@update:model-value="props.fetchList" @update:model-value="props.fetchList?.()"
></q-pagination> ></q-pagination>
</template> </template>
</d-table> </d-table>

View file

@ -221,7 +221,7 @@ async function onClickApprove(type: string = "") {
boundary-links boundary-links
direction-links direction-links
:max-pages="5" :max-pages="5"
@update:model-value="props.fetchList" @update:model-value="props.fetchList?.()"
></q-pagination> ></q-pagination>
</template> </template>
</d-table> </d-table>

View file

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