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

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

View file

@ -71,10 +71,9 @@ function getStatus(id: string) {
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
// .finally(() => {});
}
/** function ยืนยันการเสร็จสิ้นโครงการ*/

View file

@ -1,11 +1,14 @@
<script setup lang="ts">
import { ref, onMounted, reactive, watch } from "vue";
import { useQuasar, type QTableProps } from "quasar";
import { useRoute, useRouter } from "vue-router";
import genReportXLSX from "@/plugins/genreportxlsx";
import { useRoute, useRouter } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
import { checkPermission } from "@/utils/permissions";
import { useStructureTree } from "@/stores/structureTree";
/**importType*/
import type {
DataOption,
@ -34,6 +37,7 @@ const $q = useQuasar();
const route = useRoute();
const router = useRouter();
const store = useDevelopmentDataStore();
const { fetchStructureTree } = useStructureTree();
const {
showLoader,
hideLoader,
@ -115,9 +119,9 @@ const formQuery = reactive<FormQueryListProject>({
});
/** funciton fetch รายการโครงการ*/
function fetchListProject() {
async function fetchListProject() {
showLoader();
http
await http
.get(
config.API.developmentMain +
`?page=${formQuery.page}&pageSize=${formQuery.pageSize}&keyword=${formQuery.keyword}&year=${formQuery.year}&status=${formQuery.status}&node=${formQuery.node}&nodeId=${formQuery.nodeId}`
@ -217,36 +221,12 @@ 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) {
http
.get(config.API.orgByIdSystem(id, route.meta.Key as string))
.then((res) => {
const data = res.data.result;
node.value = data;
fetchListProject();
})
.catch((err) => {
messageError($q, err);
hideLoader();
});
async function fetchActive() {
const dataTree = await fetchStructureTree(route.meta.Key as string, true);
if (dataTree) {
await fetchListProject();
node.value = dataTree;
}
}
/**