รักษาการในตำแหน่ง ==> ปรับโครงสร้าง
This commit is contained in:
parent
115b41c922
commit
0da3f425a7
3 changed files with 94 additions and 40 deletions
|
|
@ -1,9 +1,12 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, onMounted } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
import { checkPermission } from "@/utils/permissions";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { checkPermission } from "@/utils/permissions";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useStructureTree } from "@/stores/structureTree";
|
||||
|
||||
/** importType*/
|
||||
import type { QTableProps } from "quasar";
|
||||
|
|
@ -14,10 +17,12 @@ import type {
|
|||
} from "@/modules/17_acting/interface/response/Main";
|
||||
|
||||
/** importStore*/
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
/** use*/
|
||||
const $q = useQuasar();
|
||||
const { fetchTreeActing } = useStructureTree();
|
||||
const storeTree = useStructureTree();
|
||||
|
||||
const { showLoader, hideLoader, messageError, dialogRemove } =
|
||||
useCounterMixin();
|
||||
|
||||
|
|
@ -31,40 +36,26 @@ const isAll = ref<boolean>(false);
|
|||
/**
|
||||
* function เรียกข้อมูลโครงสร้าง แบบปัจุบัน
|
||||
*/
|
||||
function fetchOrganizationActive() {
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.activeOrganization)
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
if (data) {
|
||||
fetchOrganization(data.activeId);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* function fetch ข้อมูลโครงสร้าาง
|
||||
* @param id id โครงสร้างปัจุบัน
|
||||
*/
|
||||
function fetchOrganization(id: string) {
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.orgAct + `/${id}`)
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
nodeTree.value = data;
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
async function fetchOrganizationActive() {
|
||||
if (storeTree.dataActing.length > 0) {
|
||||
nodeTree.value = await fetchTreeActing("");
|
||||
} else {
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.activeOrganization)
|
||||
.then(async (res) => {
|
||||
const data = res.data.result;
|
||||
if (data) {
|
||||
nodeTree.value = await fetchTreeActing(data.activeId);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue