Commit aa518835 by 高源

外部图表功能添加

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