API โครงสร้าง

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-01-26 17:19:42 +07:00
parent 0fbf803a26
commit 44d9eb569a
4 changed files with 62 additions and 14 deletions

View file

@ -1,6 +1,6 @@
import env from "../index";
const organization = `${env.API_URI}/organization`;
const organization = `${env.API_URI}/org`;
export default {
/** โครงสร้างอัตรากำลัง*/

View file

@ -1,11 +1,17 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
/** importType*/
import type { DataActive } from "@/modules/02_organizationalNew/interface/response/organizational";
import TreeView from "@/modules/02_organizationalNew/components/mainTree.vue";
import TableView from "@/modules/02_organizationalNew/components/tableTree.vue";
const showData = ref<boolean>(false);
const nodeTree = ref<any>();
// defineProps<{ dataActive: DataActive }>();
async function fetchDataTree() {
const data = [
{

View file

@ -0,0 +1,8 @@
interface DataActive {
activeId: string;
activeName: string;
draftId: string;
draftName: string;
}
export type { DataActive };

View file

@ -4,6 +4,9 @@ import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
/** importType*/
import type { DataActive } from "@/modules/02_organizationalNew/interface/response/organizational";
/** importComponents*/
import ListView from "@/modules/02_organizationalNew/components/listView.vue";
import StructureView from "@/modules/02_organizationalNew/components/structureView.vue";
@ -22,6 +25,8 @@ const modalNewStructure = ref<boolean>(false);
const stroe = useOrganizational();
const isStatusData = ref<boolean>(false);
const ishasActive = ref<boolean>(false);
const ishasDraft = ref<boolean>(false);
const itemStructure = ref<any>([
{
val: "NEW",
@ -40,21 +45,48 @@ const itemStructure = ref<any>([
name: "ทำสำเนาโครงสร้าง ตำแหน่งและคนครอง",
},
]);
const dataActive = ref<DataActive>();
async function fetchOrganizationActive() {
// showLoader();
// await http
// .get(config.API.activeOrganization)
// .then((res) => {
// console.log(res);
// })
// .catch((err) => {
// messageError($q, err);
// console.log(err);
// })
// .finally(() => {
// hideLoader();
// });
const data = {
activeId: null,
activeName: "null",
draftId: null,
draftName: null,
};
// dataActive.value = data;
showLoader();
await http
.get(config.API.activeOrganization)
.then((res) => {
console.log(res);
// if (data) {
// if (data.activeName === null && data.draftName === null) {
// isStatusData.value = false;
// } else {
// isStatusData.value = true;
// }
// if (isStatusData.value) {
// if (data.activeName === null) {
// ishasActive.value = true;
// stroe.typeOrganizational = "draft";
// } else if (data.draftName === null) {
// ishasDraft.value = true;
// stroe.typeOrganizational = "current";
// }
// }
// }
})
.catch((err) => {
messageError($q, err);
console.log(err);
})
.finally(() => {
hideLoader();
});
}
const modalDateTime = ref<boolean>(false);
@ -134,12 +166,14 @@ onMounted(async () => {
color="blue"
label="ปัจจุบัน"
@click="stroe.typeOrganizational = 'current'"
:disable="ishasActive"
/>
<q-btn
:outline="stroe.typeOrganizational === 'draft' ? false : true"
color="blue"
label="แบบร่าง"
@click="stroe.typeOrganizational = 'draft'"
:disable="ishasDraft"
/>
</q-btn-group>