Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
Vue-Dashboard
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
高源
Vue-Dashboard
Commits
70990881
Commit
70990881
authored
Jun 10, 2025
by
User
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AI聊天集成
parent
083691ba
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
140 additions
and
122 deletions
+140
-122
.env.prod
.env.prod
+1
-1
.env.test
.env.test
+1
-1
index.html
dist/index.html
+3
-3
index.ts
src/router/routes/index.ts
+112
-112
[url].vue
src/views/_builtin/iframe-page/[url].vue
+23
-5
chat-component.vue
src/views/chat/chat-component.vue
+0
-0
index.vue
src/views/chat/index.vue
+0
-0
No files found.
.env.prod
View file @
70990881
# backend service base url, prod environment
VITE_SERVICE_BASE_URL='
http://localhost:80
'
VITE_SERVICE_BASE_URL=''
# other backend service base url, prod environment
VITE_OTHER_SERVICE_BASE_URL= `{
...
...
.env.test
View file @
70990881
# backend service base url, test environment
VITE_SERVICE_BASE_URL
=
'
http://localhost:80
'
VITE_SERVICE_BASE_URL
=
''
# other backend service base url, test environment
VITE_OTHER_SERVICE_BASE_URL
=
`{
...
...
dist/index.html
View file @
70990881
<!doctype html>
<html
lang=
"zh-cmn-Hans"
>
<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"
/>
<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-B
V5IaHCk
.js"
></script>
<link
rel=
"stylesheet"
crossorigin
href=
"/Content/VueDashboardUi/VueDashboard1/assets/index-B
FEuYhFr
.css"
>
<script
type=
"module"
crossorigin
src=
"/Content/VueDashboardUi/VueDashboard1/assets/index-B
_dt3SP8
.js"
></script>
<link
rel=
"stylesheet"
crossorigin
href=
"/Content/VueDashboardUi/VueDashboard1/assets/index-B
LjiwC98
.css"
>
</head>
<body>
<div
id=
"app"
></div>
...
...
src/router/routes/index.ts
View file @
70990881
...
...
@@ -13,49 +13,49 @@ import { transformElegantRoutesToVueRoutes } from '../elegant/transform';
* @link https://github.com/soybeanjs/elegant-router?tab=readme-ov-file#custom-route
*/
const
customRoutes
:
CustomRoute
[]
=
[
{
name
:
'exception'
,
path
:
'/exception'
,
component
:
'layout.base'
,
meta
:
{
title
:
'exception'
,
i18nKey
:
'route.exception'
,
icon
:
'ant-design:exception-outlined'
,
order
:
7
},
children
:
[
{
name
:
'exception_403'
,
path
:
'/exception/403'
,
component
:
'view.403'
,
meta
:
{
title
:
'exception_403'
,
i18nKey
:
'route.exception_403'
,
icon
:
'ic:baseline-block'
}
},
{
name
:
'exception_404'
,
path
:
'/exception/404'
,
component
:
'view.404'
,
meta
:
{
title
:
'exception_404'
,
i18nKey
:
'route.exception_404'
,
icon
:
'ic:baseline-web-asset-off'
}
},
{
name
:
'exception_500'
,
path
:
'/exception/500'
,
component
:
'view.500'
,
meta
:
{
title
:
'exception_500'
,
i18nKey
:
'route.exception_500'
,
icon
:
'ic:baseline-wifi-off'
}
}
]
},
//
{
//
name: 'exception',
//
path: '/exception',
//
component: 'layout.base',
//
meta: {
//
title: 'exception',
//
i18nKey: 'route.exception',
//
icon: 'ant-design:exception-outlined',
//
order: 7
//
},
//
children: [
//
{
//
name: 'exception_403',
//
path: '/exception/403',
//
component: 'view.403',
//
meta: {
//
title: 'exception_403',
//
i18nKey: 'route.exception_403',
//
icon: 'ic:baseline-block'
//
}
//
},
//
{
//
name: 'exception_404',
//
path: '/exception/404',
//
component: 'view.404',
//
meta: {
//
title: 'exception_404',
//
i18nKey: 'route.exception_404',
//
icon: 'ic:baseline-web-asset-off'
//
}
//
},
//
{
//
name: 'exception_500',
//
path: '/exception/500',
//
component: 'view.500',
//
meta: {
//
title: 'exception_500',
//
i18nKey: 'route.exception_500',
//
icon: 'ic:baseline-wifi-off'
//
}
//
}
//
]
//
},
// 以下是iframe-page的示例
...
...
@@ -194,82 +194,82 @@ const customRoutes: CustomRoute[] = [
// 以下是获取菜单的示例
// ${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=${window.uiGlobalConfig.InternalCode}`
// //
);
const
{
data
:
menus
}
=
await
getRootMenu
(
`/Restful/Kivii.Basic.Entities.Menu/Show.json?RootInternalCode=
${
window
.
uiGlobalConfig
.
InternalCode
}
`
);
//
const MenuThree = await getMenuThree(menus?.MenusMain?.Results);
//
const MenuRoot = menus?.MenuRoot;
const
MenuThree
=
await
getMenuThree
(
menus
?.
MenusMain
?.
Results
);
const
MenuRoot
=
menus
?.
MenuRoot
;
// // console.log(MenuRoot);
// // 存储 MenuRoot 到 store
//
if (MenuRoot) {
//
setTimeout(() => {
//
const routeStore = useRouteStore();
//
routeStore.setMenuRoot(MenuRoot);
//
}, 1000);
//
}
if
(
MenuRoot
)
{
setTimeout
(()
=>
{
const
routeStore
=
useRouteStore
();
routeStore
.
setMenuRoot
(
MenuRoot
);
},
1000
);
}
//
const MenuThree2 = generateRoutes(MenuThree);
//
if (MenuThree2.length > 0) {
//
for (let i = 0; i < MenuThree2.length; i++) {
//
customRoutes.push(MenuThree2[i]);
//
}
//
}
//
function getMenuThree(data: any) {
//
const cloneData = JSON.parse(JSON.stringify(data)); // 对源数据深度克隆
//
return cloneData.filter((father: { Kvid: any; children: any; ParentKvid: undefined }) => {
//
const branchArr = cloneData.filter((child: { ParentKvid: any }) => father.Kvid === child.ParentKvid);
//
// eslint-disable-next-line no-unused-expressions
//
branchArr.length > 0 ? (father.children = branchArr) : '';
//
// eslint-disable-next-line eqeqeq
//
return father.ParentKvid == undefined;
//
});
//
}
//
function generateRoutes(data: any[]) {
//
return data.map(item => {
//
const route: any = {
//
name: item.Type === 'System' ? `${item.Type}` : item.Kvid,
//
path: item.Type === 'System' ? `/${item.Type}` : `/${item.Kvid}`,
//
component: 'layout.base',
//
meta: {
//
title: item.DisplayName,
//
icon: 'mdi:file-document-multiple-outline',
//
order: item.SortId,
//
keepAlive: true
//
},
//
children: []
//
};
const
MenuThree2
=
generateRoutes
(
MenuThree
);
if
(
MenuThree2
.
length
>
0
)
{
for
(
let
i
=
0
;
i
<
MenuThree2
.
length
;
i
++
)
{
customRoutes
.
push
(
MenuThree2
[
i
]);
}
}
function
getMenuThree
(
data
:
any
)
{
const
cloneData
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
// 对源数据深度克隆
return
cloneData
.
filter
((
father
:
{
Kvid
:
any
;
children
:
any
;
ParentKvid
:
undefined
})
=>
{
const
branchArr
=
cloneData
.
filter
((
child
:
{
ParentKvid
:
any
})
=>
father
.
Kvid
===
child
.
ParentKvid
);
// eslint-disable-next-line no-unused-expressions
branchArr
.
length
>
0
?
(
father
.
children
=
branchArr
)
:
''
;
// eslint-disable-next-line eqeqeq
return
father
.
ParentKvid
==
undefined
;
});
}
function
generateRoutes
(
data
:
any
[])
{
return
data
.
map
(
item
=>
{
const
route
:
any
=
{
name
:
item
.
Type
===
'System'
?
`
${
item
.
Type
}
`
:
item
.
Kvid
,
path
:
item
.
Type
===
'System'
?
`/
${
item
.
Type
}
`
:
`/
${
item
.
Kvid
}
`
,
component
:
'layout.base'
,
meta
:
{
title
:
item
.
DisplayName
,
icon
:
'mdi:file-document-multiple-outline'
,
order
:
item
.
SortId
,
keepAlive
:
true
},
children
:
[]
};
//
if (item.children && item.children.length > 0) {
//
route.children = item.children.map(
//
(child: { Remark: string; Type: string; Kvid: any; DisplayName: any; Icon: any; SortId: any }) => {
//
const sanitizedRemark =
//
child.Remark && child.Remark.startsWith('/') ? child.Remark.replace(/^\//, '') : child.Remark;
//
return {
//
name: 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',
//
props: {
//
url: child.Type === 'System' ? sanitizedRemark : '',
//
kvid: child.Kvid,
//
type: child.Type
//
},
//
meta: {
//
title: child.DisplayName,
//
icon: child.Icon,
//
order: child.SortId,
//
keepAlive: true,
//
type: 'iframe'
//
}
//
};
//
}
//
);
//
}
if
(
item
.
children
&&
item
.
children
.
length
>
0
)
{
route
.
children
=
item
.
children
.
map
(
(
child
:
{
Remark
:
string
;
Type
:
string
;
Kvid
:
any
;
DisplayName
:
any
;
Icon
:
any
;
SortId
:
any
})
=>
{
const
sanitizedRemark
=
child
.
Remark
&&
child
.
Remark
.
startsWith
(
'/'
)
?
child
.
Remark
.
replace
(
/^
\/
/
,
''
)
:
child
.
Remark
;
return
{
name
:
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'
,
props
:
{
url
:
child
.
Type
===
'System'
?
sanitizedRemark
:
''
,
kvid
:
child
.
Kvid
,
type
:
child
.
Type
},
meta
:
{
title
:
child
.
DisplayName
,
icon
:
child
.
Icon
,
order
:
child
.
SortId
,
keepAlive
:
true
,
type
:
'iframe'
}
};
}
);
}
//
return route;
//
});
//
}
return
route
;
});
}
export
function
createStaticRoutes
()
{
const
constantRoutes
:
ElegantRoute
[]
=
[];
...
...
src/views/_builtin/iframe-page/[url].vue
View file @
70990881
...
...
@@ -7,6 +7,7 @@ import { loadModule } from 'vue3-sfc-loader';
import
{
getSelectMenu
}
from
'@/service/api'
;
import
NotFound
from
'@/views/_builtin/404/index.vue'
;
// 引入 404 组件
import
{
useTabStore
}
from
'@/store/modules/tab'
;
import
ChatComponent
from
'@/views/chat/chat-component.vue'
;
// 导入聊天组件
import
ExtJsComponent
from
'./extJs.vue'
;
import
WebviewComponent
from
'./webview.vue'
;
import
VueComponent
from
'./vueComponent.vue'
;
// 添加新组件导入
...
...
@@ -62,19 +63,22 @@ const cleanupResources = () => {
hasError
.
value
=
false
;
};
// 监听
标签关闭事件
tabCloseEventBus
.
on
(
closedTabId
=>
{
// 监听
函数引用
const
tabCloseHandler
=
(
closedTabId
:
string
)
=>
{
// 只有当关闭的是当前标签时才清理资源
if
(
closedTabId
===
tabStore
.
activeTabId
)
{
cleanupResources
();
}
});
};
// 监听标签关闭事件
tabCloseEventBus
.
on
(
tabCloseHandler
);
// 组件卸载前清理
onBeforeUnmount
(()
=>
{
cleanupResources
();
// 移除事件监听
tabCloseEventBus
.
off
();
tabCloseEventBus
.
off
(
tabCloseHandler
);
});
// 修复console[type]的类型错误
...
...
@@ -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
componentName
=
url
.
split
(
'/'
).
pop
()
||
url
;
if
(
internalComponents
[
componentName
])
{
asyncComponent
.
value
=
internalComponents
[
componentName
];
console
.
log
(
'Loaded internal component:'
,
componentName
);
return
;
}
// 如果不是内部组件,则从服务端加载
const
options
=
{
moduleCache
:
{
vue
:
await
import
(
'vue'
)
...
...
src/views/chat/chat-component.vue
0 → 100644
View file @
70990881
This diff is collapsed.
Click to expand it.
src/views/chat/index.vue
View file @
70990881
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment