checkload

This commit is contained in:
STW_TTTY\stwtt 2024-09-26 12:04:46 +07:00
parent 13317f94f2
commit 5ffc84daf3
6 changed files with 33 additions and 24 deletions

View file

@ -39,7 +39,6 @@ const modal = defineModel<boolean>("modal", { required: true });
* props
*/
const props = defineProps({
closeModal: Function,
fetchData: Function,
rows: Array,
});
@ -209,6 +208,10 @@ function filterSelectOrder() {
});
}
function closeModal() {
modal.value = false;
commandType.value = "";
}
/**
* เม props.modal เป true
*
@ -314,7 +317,7 @@ watch(
:columns="columns"
:rows="rows"
:filter="filter"
row-key="id"
row-key="personalId"
:visible-columns="visibleColumns"
selection="multiple"
v-model:selected="selected"

View file

@ -74,7 +74,7 @@ const orgRevisionId = ref<string>("");
/** function เรียกข้อมูลโครงสร้าง แบบปัจุบันและ แบบร่าง*/
async function fetchStructure() {
const dataTree = await fetchStructureTree(route.meta.Key as string);
const dataTree = await fetchStructureTree(route.meta.Key as string,false);
if (dataTree) {
orgRevisionId.value = storeTree.activeId;
nodes.value = dataTree;

View file

@ -50,6 +50,7 @@ async function getStat() {
contain: statCard.contain,
disclaim: statCard.disclaim,
};
DataStore.checkLoad(1)
})
.catch((e) => {
messageError($q, e);
@ -60,18 +61,16 @@ async function getStat() {
* get รายละเอยด ของการสอบ
*/
async function fetchPlacementData() {
showLoader();
await http
.get(config.API.MainDetail(0))
.then(async (res) => {
DataStore.DataMainOrig = res.data.result;
DataStore.DataMainOrig = await res.data.result;
DataStore.checkLoad(1)
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
.finally(() => {});
}
/** get stat
@ -96,7 +95,6 @@ onMounted(async () => {
title.value = examData.value == null ? null : examData.value.examRound;
round.value = examData.value == null ? null : examData.value.examOrder;
year.value = examData.value == null ? null : examData.value.fiscalYear;
});
</script>
<template>

View file

@ -9,7 +9,7 @@ import { useRoute, useRouter } from "vue-router";
import { checkPermission } from "@/utils/permissions";
import { useCounterMixin } from "@/stores/mixin";
import { tokenParsed } from "@/plugins/auth";
import { usePlacementDataStore } from "@/modules/05_placement/store";
import avatar from "@/assets/avatar_user.jpg";
import type { PartialTableName } from "@/modules/05_placement/interface/request/placement";
@ -24,6 +24,7 @@ import DialogHeader from "@/components/DialogHeader.vue";
import DialogOrders from "@/modules/05_placement/components/PersonalList/DialogOrders.vue"; //
const $q = useQuasar(); // show dialog
const DataStore = usePlacementDataStore();
const route = useRoute();
const router = useRouter();
const mixin = useCounterMixin(); //
@ -387,15 +388,14 @@ async function getTable() {
e.nodeName !== null &&
e.reportingDate !== null
);
DataStore.checkLoad(1);
// insertAvatar(rows.value);
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
hideLoader();
});
})
.finally(async () => {});
}
/**
@ -742,10 +742,6 @@ function openModalOrder(val: boolean) {
modalOrder.value = val;
}
function closeModal() {
modalOrder.value = false;
}
watch(containStatus, () => {
if (containStatus.value) {
rows.value = rowsAll.value.filter((x: any) => x.statusId == "CONTAIN");
@ -1594,11 +1590,7 @@ onMounted(async () => {
</q-card>
</q-dialog>
<DialogOrders
v-model:modal="modalOrder"
:close-modal="closeModal"
:rows="rowsOrder"
/>
<DialogOrders v-model:modal="modalOrder" :rows="rowsOrder" />
</template>
<style lang="scss" scoped>

View file

@ -1,5 +1,8 @@
import { defineStore } from "pinia";
import { ref } from "vue";
import { useCounterMixin } from "@/stores/mixin";
import type { FormPlacementMainData } from "@/modules/05_placement/interface/request/Main";
import type { FormOrderPlacementMainData } from "@/modules/05_placement/interface/request/Main";
@ -81,6 +84,8 @@ export const useProfileDataStore = defineStore("profilePlacenent", () => {
};
});
export const usePlacementDataStore = defineStore("placement", () => {
const mixin = useCounterMixin(); //เรียกฟังก์ชันกลาง
const { hideLoader } = mixin;
interface placement {
mappingPosition: { columns: String[] };
}
@ -180,6 +185,15 @@ export const usePlacementDataStore = defineStore("placement", () => {
}
};
let count = 0; // ตัวแปรนับจำนวนค่าที่รับ
function checkLoad(val: number) {
count += val;
if (count >= 3) {
hideLoader();
count = 0;
}
}
return {
placementData,
changePlacementColumns,
@ -189,6 +203,7 @@ export const usePlacementDataStore = defineStore("placement", () => {
DataMainYearSet,
DataMain,
DataUpdateMain,
checkLoad,
};
});
export const useOrderPlacementDataStore = defineStore("placementOrder", () => {
@ -330,6 +345,7 @@ export const useTransferDataStore = defineStore("transferDataStore", () => {
return " ";
}
};
return {
statusText,
statusProbationMain,

View file

@ -73,7 +73,7 @@ export const useStructureTree = defineStore("structureTree", () => {
} catch (err) {
messageError($q, err);
} finally {
hideLoader();
isLoad && hideLoader();
}
}