อัตรากำลังลูกจ้างประจำ ฯ ==> ปรับ โครงสร้าง

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-09-16 09:53:09 +07:00
parent c5262bf04d
commit d7af620b4a
3 changed files with 18 additions and 56 deletions

View file

@ -1,8 +1,10 @@
<script setup lang="ts">
import { ref, reactive, onMounted, watch } from "vue";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import { useStructureTree } from "@/stores/structureTree";
/** importType*/
import type {
@ -27,6 +29,8 @@ const store = usePositionEmp();
const $q = useQuasar();
const { showLoader, hideLoader, messageError } = useCounterMixin();
const route = useRoute();
const { fetchStructureTree } = useStructureTree();
const storeStructureTree = useStructureTree();
const nodeTree = ref<OrgTree[]>([]); // Tree
const nodeId = ref<string>(""); // id Tree
@ -54,24 +58,16 @@ const shortName = ref<string>("");
* function fetch อมลของ Tree
* @param id id โครงสราง
*/
function fetchDataTree(id: string) {
async function fetchDataTree() {
isLoadTree.value = false;
showLoader();
http
.get(config.API.orgByIdSystem(id, route.meta.Key as string))
.then((res) => {
const data = res.data.result;
nodeTree.value = data;
selected.value = "";
nodeId.value = "";
store.treeId = "";
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
const dataTree = await fetchStructureTree(route.meta.Key as string, true);
store.activeId = storeStructureTree.activeId;
if (dataTree) {
nodeTree.value = dataTree;
selected.value = "";
nodeId.value = "";
store.treeId = "";
}
}
/**
@ -186,9 +182,10 @@ function searchAndReplaceOrgName(data: any, targetId: string) {
* lifecycle Hook
*/
onMounted(() => {
setTimeout(async () => {
store.activeId && (await fetchDataTree(store.activeId));
}, 200);
fetchDataTree();
// setTimeout(async () => {
// store.activeId && (await );
// }, 200);
});
/**