Merge branch 'nice' into develop

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-09-16 10:43:23 +07:00
commit 6048a46540
5 changed files with 60 additions and 1211 deletions

View file

@ -1,8 +1,13 @@
<script setup lang="ts">
import { ref, reactive, watch } from "vue";
import { onMounted, ref, watch } from "vue";
import { useQuasar } from "quasar";
import { useRoute } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import { useSelectOrgStore } from "@/modules/05_placement/stores/storeSelect";
import { useStructureTree } from "@/stores/structureTree";
/** importType*/
import type {
@ -17,15 +22,10 @@ import type { DataPositionNo } from "@/modules/05_placement/interface/index/Sele
import Header from "@/components/DialogHeader.vue";
import CardPosition from "@/modules/05_placement/components/PersonalList/CardPosition.vue";
/** importStore*/
import { useCounterMixin } from "@/stores/mixin";
import { useSelectOrgStore } from "@/modules/05_placement/stores/storeSelect";
import { useRoute } from "vue-router";
const route = useRoute();
/** use*/
const $q = useQuasar();
const storeTree = useStructureTree();
const { fetchStructureTree } = useStructureTree();
const store = useSelectOrgStore();
const {
success,
@ -73,45 +73,13 @@ const posMasterMain = ref<any[]>([]);
const orgRevisionId = ref<string>("");
/** function เรียกข้อมูลโครงสร้าง แบบปัจุบันและ แบบร่าง*/
async function fetchOrganizationActive() {
showLoader();
await http
.get(config.API.activeOrganization)
.then((res) => {
const data = res.data.result;
if (data) {
orgRevisionId.value = data.activeId;
fetchDataTree(data.activeId);
}
})
.catch((err) => {
messageError($q, err);
});
}
/**
* function fetch อมลของ Tree
* @param id id โครงสราง
*/
async function fetchDataTree(id: string) {
showLoader();
await http
.get(config.API.orgByIdSystem(id, route.meta.Key as string))
.then((res) => {
const data = res.data.result;
if (data) {
nodes.value = data;
filterItemsTaps(data);
}
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
setTimeout(() => {
hideLoader();
}, 1000);
});
async function fetchStructure() {
const dataTree = await fetchStructureTree(route.meta.Key as string);
if (dataTree) {
orgRevisionId.value = storeTree.activeId;
nodes.value = dataTree;
filterItemsTaps(dataTree);
}
}
/**
@ -291,7 +259,6 @@ watch(
() => modal.value,
async () => {
if (modal.value) {
await fetchOrganizationActive();
await fetchPositionUes();
if (props?.dataRow?.node !== null && props?.dataRow?.nodeId !== null) {
@ -327,20 +294,6 @@ function filterItemsTaps(data: TreeMain[]) {
return orgTreeIds;
}
function filterNodeFn(data: any, id: string) {
for (const child of data) {
if (child.orgTreeId === id) {
return child;
} else if (child.children) {
const result: any = filterNodeFn(child.children, id);
if (result !== null) {
return result;
}
}
}
return null;
}
watch(
() => isAll.value,
(value, oldVal) => {
@ -358,6 +311,10 @@ watch(
}
}
);
onMounted(() => {
fetchStructure();
});
</script>
<template>

View file

@ -11,7 +11,6 @@ import config from "@/app.config";
import { useRouter } from "vue-router";
import DialogHeader from "@/modules/05_placement/components/Receive/DialogHeader.vue";
// import DialogOrgTree from "@/modules/05_placement/components/Receive/receiveModal.vue";
import type { QTableProps } from "quasar";
import type {
@ -189,7 +188,7 @@ const SaveData = async () => {
const fecthlistRecevice = async () => {
showLoader();
await http
.get(config.API.receiveData()+`?keyword=`)
.get(config.API.receiveData() + `?keyword=`)
.then((res: any) => {
const response = res.data.result;

File diff suppressed because it is too large Load diff