Commit aa518835 by 高源

外部图表功能添加

parent d506034a
<!doctype html>
<html lang="zh-cmn-Hans">
<head>
<meta name="buildTime" content="2025-03-06 10:17:29">
<meta name="buildTime" content="2025-03-17 14:02:13">
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="color-scheme" content="light dark" />
<title>VueDashboard</title>
<script type="module" crossorigin src="/Content/VueDashboardUi/VueDashboard1/assets/index-ClligkOZ.js"></script>
<script type="module" crossorigin src="/Content/VueDashboardUi/VueDashboard1/assets/index-vhyBwSMe.js"></script>
<link rel="stylesheet" crossorigin href="/Content/VueDashboardUi/VueDashboard1/assets/index-9k_B1ZU8.css">
</head>
<body>
......
......@@ -76,7 +76,7 @@ function getActivePathIndex() {
function handleEnter() {
if (resultOptions.value?.length === 0 || activePath.value === '') return;
handleClose();
console.log('activePath', activePath.value);
// console.log('activePath', activePath.value);
// const activePathValue = formatString(activePath.value);
// router.push(activePathValue);
router.push(activePath.value);
......
......@@ -149,7 +149,7 @@ async function handleContextMenu(e: MouseEvent, tabId: string) {
function init() {
tabStore.initTabStore(route);
console.log(tabStore);
// console.log(tabStore);
}
function removeFocus() {
......
......@@ -195,7 +195,7 @@ const { data: menus } = await getRootMenu(
const MenuThree = await getMenuThree(menus?.MenusMain?.Results);
const MenuRoot = menus?.MenuRoot;
console.log(MenuRoot);
// console.log(MenuRoot);
// 存储 MenuRoot 到 store
if (MenuRoot) {
......
......@@ -360,12 +360,12 @@ export const useRouteStore = defineStore(SetupStoreId.Route, () => {
/** 设置MenuRoot 如果数据不包含Kvid字段则返回不存储 */
function setMenuRoot(data: Api.Menu.MenuRoot) {
if (!data.Kvid) {
console.log('MenuRoot数据不包含Kvid字段,不进行存储');
// console.log('MenuRoot数据不包含Kvid字段,不进行存储');
return;
}
menuRoot.value = data;
console.log('MenuRoot数据:', data);
// console.log('MenuRoot数据:', data);
}
return {
......
......@@ -35,7 +35,7 @@ const tabCloseEventBus = useEventBus('tab-close');
// 清理所有资源的函数
const cleanupResources = () => {
console.log('清理iframe-page资源');
// console.log('清理iframe-page资源');
// 清理webview (iframe)
if (webviewRef.value && typeof webviewRef.value.cleanup === 'function') {
......@@ -112,7 +112,7 @@ const loadExternalComponent = async (url: string) => {
loadModule(url, options)
.then(component => {
asyncComponent.value = component;
console.log('Component loaded:', asyncComponent.value);
// console.log('Component loaded:', asyncComponent.value);
})
.catch(error => {
console.error('Error loading component:', error);
......@@ -127,7 +127,7 @@ const handleMenuAccess = async () => {
// 确保 DOM 已准备好
await nextTick();
console.log('Processing:', { url, kvid, type });
// console.log('Processing:', { url, kvid, type });
const origin = window.location.origin;
// 创建后端地址 - 假设后端在80端口
const backendOrigin = origin.replace(':8080', ':80');
......
......@@ -44,7 +44,7 @@ function updateExtComponent(newUrl: string) {
// 清理函数 - 完全销毁ExtJS组件
function cleanup() {
console.log('清理ExtJS资源');
// console.log('清理ExtJS资源');
if (extComponent) {
try {
......@@ -57,7 +57,7 @@ function cleanup() {
container.innerHTML = '';
}
} catch (e) {
console.error('清理ExtJS组件时出错:', e);
// console.error('清理ExtJS组件时出错:', e);
}
// 清空引用
......
......@@ -12,7 +12,10 @@ import {
import { NConfigProvider, darkTheme } from 'naive-ui';
import * as naive from 'naive-ui';
import axios from 'axios';
import * as echarts from 'echarts/core';
import { useThemeStore } from '@/store/modules/theme';
// 引入echarts相关
import { useEcharts } from '@/hooks/common/echarts';
defineOptions({ name: 'VueComponent' });
......@@ -41,16 +44,22 @@ Object.keys(naive).forEach(key => {
declare global {
interface Window {
$axios: typeof axios;
$echarts: typeof echarts;
$useEcharts: typeof useEcharts;
$themeStore: typeof themeStore;
}
}
// 全局注入axios
(window as any).$axios = axios;
// 全局注入echarts和useEcharts
(window as any).$echarts = echarts;
(window as any).$useEcharts = useEcharts;
// 全局注入主题存储
(window as any).$themeStore = themeStore;
// 清理函数 - 完全销毁Vue组件
function cleanup() {
console.log('清理Vue组件资源');
try {
// 清空组件引用
asyncComponent.value = null;
......@@ -61,7 +70,7 @@ function cleanup() {
container.innerHTML = '';
}
} catch (e) {
console.error('清理Vue组件时出错:', e);
// console.error('清理Vue组件时出错:', e);
}
}
......@@ -75,7 +84,7 @@ onMounted(async () => {
asyncComponent.value = props.url;
isActive.value = true;
} catch (err) {
console.error('组件加载错误:', err);
// console.error('组件加载错误:', err);
error.value = true;
} finally {
loading.value = false;
......
......@@ -40,7 +40,7 @@ function updateExtComponent(newUrl: string) {
// 清理函数 - 完全销毁iframe
function cleanup() {
console.log('清理webview资源');
// console.log('清理webview资源');
if (iframeEl) {
try {
......@@ -53,7 +53,7 @@ function cleanup() {
container.removeChild(iframeEl);
}
} catch (e) {
console.error('清理iframe时出错:', e);
// console.error('清理iframe时出错:', e);
}
// 清空引用
......
<script setup lang="ts">
import { onActivated,onDeactivated,computed, watch, ref, onMounted, onUnmounted } from 'vue';
import { onActivated, onDeactivated, computed, watch, ref, onMounted, onUnmounted } from 'vue';
import { useAppStore } from '@/store/modules/app';
import { useRouteStore } from '@/store/modules/route';
import HeaderBanner from './modules/header-banner.vue';
......@@ -51,12 +51,12 @@ onDeactivated(() => {
});
// 监听 MenuRoot 变化
watch(menuRoot, async (newValue) => {
console.log('MenuRoot updated:', newValue);
// console.log('MenuRoot updated:', newValue);
if (newValue) {
const { data } = await getDefaultMenu(
`/Restful/Kivii.Basic.Entities.Menu/Query.json?ParentKvid=${newValue.Kvid}&isRelateFunction=true`
);
console.log('Menu data:', data);
// console.log('Menu data:', data);
if (data?.Results && data?.Results.length > 0) {
const autoStartItem = data?.Results.find(item => {
......@@ -64,7 +64,7 @@ watch(menuRoot, async (newValue) => {
const params = JSON.parse(item.Parameters || '{}');
return params.AutoStartup === 'true';
} catch (error) {
console.error('Parameters parse error:', error);
// console.error('Parameters parse error:', error);
return false;
}
});
......@@ -76,7 +76,7 @@ watch(menuRoot, async (newValue) => {
kvid: autoStartItem.Kvid,
url: ''
};
console.log('autoStartProps:', autoStartProps.value);
// console.log('autoStartProps:', autoStartProps.value);
}
}
}
......@@ -98,14 +98,10 @@ const gap = computed(() => (appStore.isMobile ? 0 : 16));
</NGi>
</NGrid>
<!-- 添加 IframePage 组件,增加 isExtjsRootReady 检查 -->
<template v-if="isExtjsRootReady" >
<template v-if="isExtjsRootReady">
<div v-show="isActive" :id="extjsContainerId" style="width: 100%; height: 100%">
<IframePage
v-if="autoStartProps.type"
:type="autoStartProps.type"
:kvid="autoStartProps.kvid"
:url="autoStartProps.url"
/>
<IframePage v-if="autoStartProps.type" :type="autoStartProps.type" :kvid="autoStartProps.kvid"
:url="autoStartProps.url" />
</div>
</template>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment