Commit 70990881 by User

AI聊天集成

parent 083691ba
# backend service base url, prod environment # backend service base url, prod environment
VITE_SERVICE_BASE_URL='http://localhost:80' VITE_SERVICE_BASE_URL=''
# other backend service base url, prod environment # other backend service base url, prod environment
VITE_OTHER_SERVICE_BASE_URL= `{ VITE_OTHER_SERVICE_BASE_URL= `{
......
# backend service base url, test environment # backend service base url, test environment
VITE_SERVICE_BASE_URL='http://localhost:80' VITE_SERVICE_BASE_URL=''
# other backend service base url, test environment # other backend service base url, test environment
VITE_OTHER_SERVICE_BASE_URL= `{ VITE_OTHER_SERVICE_BASE_URL= `{
......
<!doctype html> <!doctype html>
<html lang="zh-cmn-Hans"> <html lang="zh-cmn-Hans">
<head> <head>
<meta name="buildTime" content="2025-06-10 15:32:11"> <meta name="buildTime" content="2025-06-10 20:28:50">
<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-BV5IaHCk.js"></script> <script type="module" crossorigin src="/Content/VueDashboardUi/VueDashboard1/assets/index-B_dt3SP8.js"></script>
<link rel="stylesheet" crossorigin href="/Content/VueDashboardUi/VueDashboard1/assets/index-BFEuYhFr.css"> <link rel="stylesheet" crossorigin href="/Content/VueDashboardUi/VueDashboard1/assets/index-BLjiwC98.css">
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>
......
...@@ -13,49 +13,49 @@ import { transformElegantRoutesToVueRoutes } from '../elegant/transform'; ...@@ -13,49 +13,49 @@ import { transformElegantRoutesToVueRoutes } from '../elegant/transform';
* @link https://github.com/soybeanjs/elegant-router?tab=readme-ov-file#custom-route * @link https://github.com/soybeanjs/elegant-router?tab=readme-ov-file#custom-route
*/ */
const customRoutes: CustomRoute[] = [ const customRoutes: CustomRoute[] = [
{ // {
name: 'exception', // name: 'exception',
path: '/exception', // path: '/exception',
component: 'layout.base', // component: 'layout.base',
meta: { // meta: {
title: 'exception', // title: 'exception',
i18nKey: 'route.exception', // i18nKey: 'route.exception',
icon: 'ant-design:exception-outlined', // icon: 'ant-design:exception-outlined',
order: 7 // order: 7
}, // },
children: [ // children: [
{ // {
name: 'exception_403', // name: 'exception_403',
path: '/exception/403', // path: '/exception/403',
component: 'view.403', // component: 'view.403',
meta: { // meta: {
title: 'exception_403', // title: 'exception_403',
i18nKey: 'route.exception_403', // i18nKey: 'route.exception_403',
icon: 'ic:baseline-block' // icon: 'ic:baseline-block'
} // }
}, // },
{ // {
name: 'exception_404', // name: 'exception_404',
path: '/exception/404', // path: '/exception/404',
component: 'view.404', // component: 'view.404',
meta: { // meta: {
title: 'exception_404', // title: 'exception_404',
i18nKey: 'route.exception_404', // i18nKey: 'route.exception_404',
icon: 'ic:baseline-web-asset-off' // icon: 'ic:baseline-web-asset-off'
} // }
}, // },
{ // {
name: 'exception_500', // name: 'exception_500',
path: '/exception/500', // path: '/exception/500',
component: 'view.500', // component: 'view.500',
meta: { // meta: {
title: 'exception_500', // title: 'exception_500',
i18nKey: 'route.exception_500', // i18nKey: 'route.exception_500',
icon: 'ic:baseline-wifi-off' // icon: 'ic:baseline-wifi-off'
} // }
} // }
] // ]
}, // },
// 以下是iframe-page的示例 // 以下是iframe-page的示例
...@@ -194,82 +194,82 @@ const customRoutes: CustomRoute[] = [ ...@@ -194,82 +194,82 @@ const customRoutes: CustomRoute[] = [
// 以下是获取菜单的示例 // 以下是获取菜单的示例
// ${window.uiGlobalConfig.InternalCode} // ${window.uiGlobalConfig.InternalCode}
// const { data: menus } = await getRootMenu(`/Restful/Kivii.Basic.Entities.Menu/Show.json?RootInternalCode=dashboard`); // const { data: menus } = await getRootMenu(`/Restful/Kivii.Basic.Entities.Menu/Show.json?RootInternalCode=dashboard`);
// // const { data: menus } = await getRootMenu( const { data: menus } = await getRootMenu(
// // `/Restful/Kivii.Basic.Entities.Menu/Show.json?RootInternalCode=${window.uiGlobalConfig.InternalCode}` `/Restful/Kivii.Basic.Entities.Menu/Show.json?RootInternalCode=${window.uiGlobalConfig.InternalCode}`
// // ); );
// 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) {
// setTimeout(() => { setTimeout(() => {
// const routeStore = useRouteStore(); const routeStore = useRouteStore();
// routeStore.setMenuRoot(MenuRoot); routeStore.setMenuRoot(MenuRoot);
// }, 1000); }, 1000);
// } }
// const MenuThree2 = generateRoutes(MenuThree); const MenuThree2 = generateRoutes(MenuThree);
// if (MenuThree2.length > 0) { if (MenuThree2.length > 0) {
// for (let i = 0; i < MenuThree2.length; i++) { for (let i = 0; i < MenuThree2.length; i++) {
// customRoutes.push(MenuThree2[i]); customRoutes.push(MenuThree2[i]);
// } }
// } }
// function getMenuThree(data: any) { function getMenuThree(data: any) {
// const cloneData = JSON.parse(JSON.stringify(data)); // 对源数据深度克隆 const cloneData = JSON.parse(JSON.stringify(data)); // 对源数据深度克隆
// return cloneData.filter((father: { Kvid: any; children: any; ParentKvid: undefined }) => { return cloneData.filter((father: { Kvid: any; children: any; ParentKvid: undefined }) => {
// const branchArr = cloneData.filter((child: { ParentKvid: any }) => father.Kvid === child.ParentKvid); const branchArr = cloneData.filter((child: { ParentKvid: any }) => father.Kvid === child.ParentKvid);
// // eslint-disable-next-line no-unused-expressions // eslint-disable-next-line no-unused-expressions
// branchArr.length > 0 ? (father.children = branchArr) : ''; branchArr.length > 0 ? (father.children = branchArr) : '';
// // eslint-disable-next-line eqeqeq // eslint-disable-next-line eqeqeq
// return father.ParentKvid == undefined; return father.ParentKvid == undefined;
// }); });
// } }
// function generateRoutes(data: any[]) { function generateRoutes(data: any[]) {
// return data.map(item => { return data.map(item => {
// const route: any = { const route: any = {
// name: item.Type === 'System' ? `${item.Type}` : item.Kvid, name: item.Type === 'System' ? `${item.Type}` : item.Kvid,
// path: item.Type === 'System' ? `/${item.Type}` : `/${item.Kvid}`, path: item.Type === 'System' ? `/${item.Type}` : `/${item.Kvid}`,
// component: 'layout.base', component: 'layout.base',
// meta: { meta: {
// title: item.DisplayName, title: item.DisplayName,
// icon: 'mdi:file-document-multiple-outline', icon: 'mdi:file-document-multiple-outline',
// order: item.SortId, order: item.SortId,
// keepAlive: true keepAlive: true
// }, },
// children: [] children: []
// }; };
// if (item.children && item.children.length > 0) { if (item.children && item.children.length > 0) {
// route.children = item.children.map( route.children = item.children.map(
// (child: { Remark: string; Type: string; Kvid: any; DisplayName: any; Icon: any; SortId: any }) => { (child: { Remark: string; Type: string; Kvid: any; DisplayName: any; Icon: any; SortId: any }) => {
// const sanitizedRemark = const sanitizedRemark =
// child.Remark && child.Remark.startsWith('/') ? child.Remark.replace(/^\//, '') : child.Remark; child.Remark && child.Remark.startsWith('/') ? child.Remark.replace(/^\//, '') : child.Remark;
// return { return {
// name: child.Type === 'System' ? `${item.Type}_${sanitizedRemark}` : `${item.Kvid}_${child.Kvid}`, name: child.Type === 'System' ? `${item.Type}_${sanitizedRemark}` : `${item.Kvid}_${child.Kvid}`,
// path: child.Type === 'System' ? `/${item.Type}/${sanitizedRemark}` : `/${item.Kvid}/${child.Kvid}`, path: child.Type === 'System' ? `/${item.Type}/${sanitizedRemark}` : `/${item.Kvid}/${child.Kvid}`,
// component: 'view.iframe-page', component: 'view.iframe-page',
// props: { props: {
// url: child.Type === 'System' ? sanitizedRemark : '', url: child.Type === 'System' ? sanitizedRemark : '',
// kvid: child.Kvid, kvid: child.Kvid,
// type: child.Type type: child.Type
// }, },
// meta: { meta: {
// title: child.DisplayName, title: child.DisplayName,
// icon: child.Icon, icon: child.Icon,
// order: child.SortId, order: child.SortId,
// keepAlive: true, keepAlive: true,
// type: 'iframe' type: 'iframe'
// } }
// }; };
// } }
// ); );
// } }
// return route; return route;
// }); });
// } }
export function createStaticRoutes() { export function createStaticRoutes() {
const constantRoutes: ElegantRoute[] = []; const constantRoutes: ElegantRoute[] = [];
......
...@@ -7,6 +7,7 @@ import { loadModule } from 'vue3-sfc-loader'; ...@@ -7,6 +7,7 @@ import { loadModule } from 'vue3-sfc-loader';
import { getSelectMenu } from '@/service/api'; import { getSelectMenu } from '@/service/api';
import NotFound from '@/views/_builtin/404/index.vue'; // 引入 404 组件 import NotFound from '@/views/_builtin/404/index.vue'; // 引入 404 组件
import { useTabStore } from '@/store/modules/tab'; import { useTabStore } from '@/store/modules/tab';
import ChatComponent from '@/views/chat/chat-component.vue'; // 导入聊天组件
import ExtJsComponent from './extJs.vue'; import ExtJsComponent from './extJs.vue';
import WebviewComponent from './webview.vue'; import WebviewComponent from './webview.vue';
import VueComponent from './vueComponent.vue'; // 添加新组件导入 import VueComponent from './vueComponent.vue'; // 添加新组件导入
...@@ -62,19 +63,22 @@ const cleanupResources = () => { ...@@ -62,19 +63,22 @@ const cleanupResources = () => {
hasError.value = false; hasError.value = false;
}; };
// 监听标签关闭事件 // 监听函数引用
tabCloseEventBus.on(closedTabId => { const tabCloseHandler = (closedTabId: string) => {
// 只有当关闭的是当前标签时才清理资源 // 只有当关闭的是当前标签时才清理资源
if (closedTabId === tabStore.activeTabId) { if (closedTabId === tabStore.activeTabId) {
cleanupResources(); cleanupResources();
} }
}); };
// 监听标签关闭事件
tabCloseEventBus.on(tabCloseHandler);
// 组件卸载前清理 // 组件卸载前清理
onBeforeUnmount(() => { onBeforeUnmount(() => {
cleanupResources(); cleanupResources();
// 移除事件监听 // 移除事件监听
tabCloseEventBus.off(); tabCloseEventBus.off(tabCloseHandler);
}); });
// 修复console[type]的类型错误 // 修复console[type]的类型错误
...@@ -90,8 +94,22 @@ const safeConsoleLog = (type: string, ...args: any[]) => { ...@@ -90,8 +94,22 @@ const safeConsoleLog = (type: string, ...args: any[]) => {
} }
}; };
// 定义加载外部组件的函数 // 内部组件映射表
const internalComponents: Record<string, any> = {
'chat-component.vue': ChatComponent
};
// 定义加载组件的函数(优先加载内部组件)
const loadExternalComponent = async (url: string) => { const loadExternalComponent = async (url: string) => {
// 首先检查是否为内部组件
const componentName = url.split('/').pop() || url;
if (internalComponents[componentName]) {
asyncComponent.value = internalComponents[componentName];
console.log('Loaded internal component:', componentName);
return;
}
// 如果不是内部组件,则从服务端加载
const options = { const options = {
moduleCache: { moduleCache: {
vue: await import('vue') vue: await import('vue')
......
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