fix loadDashbord
This commit is contained in:
parent
13110b71f4
commit
d7a450479c
1 changed files with 33 additions and 11 deletions
|
|
@ -1,25 +1,47 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, onMounted } from "vue";
|
||||
import { ref, onMounted, watch } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
import { useRoute } from "vue-router";
|
||||
import { useMenuDataStore } from "@/stores/menuList";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import env from "@/api/index";
|
||||
|
||||
import type { ListMenu } from "@/interface/response/main";
|
||||
|
||||
const storeMenu = useMenuDataStore();
|
||||
const $q = useQuasar();
|
||||
const route = useRoute();
|
||||
const storeMenu = useMenuDataStore();
|
||||
const { messageError } = useCounterMixin();
|
||||
|
||||
const panelUrl = ref<string>("");
|
||||
const title = ref<string>("");
|
||||
|
||||
onMounted(async () => {
|
||||
const menuDashboard = await storeMenu.menuList.find(
|
||||
(x: ListMenu) => x.id === "DASHBOARD"
|
||||
);
|
||||
/** function fetch รายการเมนูทั้งหมด*/
|
||||
async function fetchSys() {
|
||||
if (storeMenu.menuList.length !== 0) {
|
||||
const menuDashboard = await storeMenu.menuList.find(
|
||||
(x: ListMenu) => x.id === "DASHBOARD"
|
||||
);
|
||||
|
||||
const data = await menuDashboard?.children?.find(
|
||||
(item: ListMenu) => item.path === route.name
|
||||
);
|
||||
title.value = `สถิติ${data?.sysName}`;
|
||||
panelUrl.value = `${env.DASHBOARD_URL}/d/${data?.sysDescription}`;
|
||||
const data = await menuDashboard?.children?.find(
|
||||
(item: ListMenu) => item.path === route.name
|
||||
);
|
||||
title.value = `สถิติ${data?.sysName}`;
|
||||
panelUrl.value = `${env.DASHBOARD_URL}/d/${data?.sysDescription}`;
|
||||
}
|
||||
}
|
||||
watch(
|
||||
() => storeMenu.menuList,
|
||||
() => {
|
||||
fetchSys();
|
||||
}
|
||||
);
|
||||
|
||||
onMounted(() => {
|
||||
fetchSys();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue