พัฒนาบุคลากร ==> ปรับโครงสร้าง

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-09-16 11:58:55 +07:00
parent 0da3f425a7
commit f912b7a353
3 changed files with 27 additions and 70 deletions

View file

@ -1,9 +1,11 @@
<script setup lang="ts">
import { reactive, ref, onMounted } from "vue";
import { useQuasar } from "quasar";
import { useRoute } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
import { useStructureTree } from "@/stores/structureTree";
/** importType*/
import type { FormBasicinfo } from "@/modules/15_development/interface/request/Main";
@ -16,6 +18,7 @@ import { useCounterMixin } from "@/stores/mixin";
const $q = useQuasar();
const route = useRoute();
const mixin = useCounterMixin();
const { fetchStructureTree } = useStructureTree();
const { showLoader, hideLoader, messageError, success } = mixin;
/**
@ -42,7 +45,7 @@ const formData = reactive<FormBasicinfo>({
});
const orgName = ref<string>("");
const node = ref<any>([]);
const node = ref<any[]>([]);
const filter = ref<string>("");
const expanded = ref<string[]>([]);
@ -50,9 +53,9 @@ const expanded = ref<string[]>([]);
* function fetch อมลเบองต
* @param id ProjectId
*/
function fetchData(id: string) {
async function fetchData(id: string) {
showLoader();
http
await http
.get(config.API.developmentMainTab("tab1", id))
.then(async (res) => {
const data = res.data.result;
@ -104,39 +107,14 @@ function onSubmit() {
}
/**
* function fetch หา Id หนวยงานท Active
*
*/
function fetchActive() {
showLoader();
http
.get(config.API.activeOrganization)
.then((res) => {
const data = res.data.result;
fetchTree(data.activeId);
})
.catch((err) => {
messageError($q, err);
hideLoader();
});
}
/**
* function fetch โครงสรางปจ
* @param id โครงสรางปจ
*/
function fetchTree(id: string) {
showLoader();
http
.get(config.API.orgByIdSystem(id, route.meta.Key as string))
.then((res) => {
const data = res.data.result;
node.value = data;
fetchData(projectId.value);
})
.catch((err) => {
messageError($q, err);
hideLoader();
});
async function fetchActive() {
const dataTree = await fetchStructureTree(route.meta.Key as string, true);
if (dataTree) {
node.value = dataTree;
await fetchData(projectId.value);
}
}
/** function