agilebuilder-ui 1.1.46 → 1.1.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/{401-1bde8dc9.js → 401-64e37702.js} +1 -1
- package/lib/{404-48d76996.js → 404-7d89180e.js} +1 -1
- package/lib/{iframe-page-77e184a0.js → iframe-page-4c8bc1d5.js} +1 -1
- package/lib/index-5c1112e8.js +92783 -0
- package/lib/super-ui.css +1 -1
- package/lib/super-ui.js +33 -32
- package/lib/super-ui.umd.cjs +172 -133
- package/lib/{tab-content-iframe-index-39745d49.js → tab-content-iframe-index-0a36be80.js} +1 -1
- package/lib/{tab-content-index-65696e56.js → tab-content-index-9a271908.js} +1 -1
- package/lib/{tache-subprocess-history-ef943f95.js → tache-subprocess-history-93d013b2.js} +1 -1
- package/package.json +7 -2
- package/packages/chat-embed/index.ts +6 -0
- package/packages/chat-embed/src/chat-embed-message.ts +79 -0
- package/packages/chat-embed/src/chat-embed.css +117 -0
- package/packages/chat-embed/src/chat-sender.vue +240 -0
- package/packages/chat-embed/src/header.vue +50 -0
- package/packages/chat-embed/src/index.vue +425 -0
- package/packages/chat-embed/src/recommendation-message.vue +37 -0
- package/packages/chat-embed/src/util.ts +33 -0
- package/packages/fs-preview/src/fs-preview.vue +5 -1
- package/packages/fs-upload-list/src/fs-upload-list.vue +6 -1
- package/packages/fs-upload-new/src/fs-button-upload.vue +8 -1
- package/packages/fs-upload-new/src/fs-drag-upload.vue +8 -1
- package/packages/fs-upload-new/src/fs-upload-new.vue +17 -0
- package/packages/index.js +16 -13
- package/packages/json-view/index.ts +3 -0
- package/packages/json-view/json-view-dialog.vue +53 -0
- package/packages/json-view/json-view.vue +126 -0
- package/packages/super-grid/src/apis.js +11 -0
- package/packages/super-grid/src/custom-formatter.js +15 -2
- package/packages/super-grid/src/dynamic-input.vue +46 -4
- package/packages/super-grid/src/formatter.js +5 -1
- package/packages/super-grid/src/normal-column-content.vue +29 -37
- package/packages/super-grid/src/normal-column.vue +8 -1
- package/packages/super-grid/src/super-grid.vue +21 -8
- package/src/assets/chat-embed/avatar.png +0 -0
- package/src/i18n/langs/cn.js +17 -3
- package/src/i18n/langs/en.js +16 -2
- package/src/store/modules/chat-ai-store.ts +78 -0
- package/src/store/modules/tab-content.js +9 -3
- package/src/styles/index.scss +19 -0
- package/src/utils/chat-ai-util.ts +31 -0
- package/src/utils/common-util.js +56 -8
- package/src/utils/insert_css.js +14 -1
- package/src/utils/jump-page-utils.js +8 -4
- package/lib/index-465b0d69.js +0 -73558
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { openBlock as r, createElementBlock as t, createCommentVNode as o } from "vue";
|
|
2
|
-
import { _ as s } from "./index-
|
|
2
|
+
import { _ as s } from "./index-5c1112e8.js";
|
|
3
3
|
const u = ["src"], f = s({ data: () => ({ src: null }), watch: { $route(n, c) {
|
|
4
4
|
this.src = this.$route.query.src;
|
|
5
5
|
} }, mounted() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as f, c as _, g as x, b as P, s as h, m as M, M as O, i as I } from "./index-
|
|
1
|
+
import { _ as f, c as _, g as x, b as P, s as h, m as M, M as O, i as I } from "./index-5c1112e8.js";
|
|
2
2
|
import { resolveComponent as u, openBlock as l, createBlock as b, withCtx as g, createVNode as v, TransitionGroup as L, createElementBlock as p, Fragment as C, renderList as T, createElementVNode as m, toDisplayString as w, normalizeClass as S, createCommentVNode as y } from "vue";
|
|
3
3
|
const k = { class: "no-redirect" }, A = f({ name: "Breadcrumb", data: () => ({ levelList: null }), computed: { levelListWithTitle() {
|
|
4
4
|
return this.levelList.filter((e) => e.meta.title !== void 0 && e.meta.title !== null);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { resolveComponent as t, openBlock as a, createElementBlock as s, createElementVNode as y, createVNode as l, withCtx as r, createTextVNode as n, toDisplayString as p, createCommentVNode as c, createBlock as h } from "vue";
|
|
2
|
-
import { _ as I } from "./index-
|
|
2
|
+
import { _ as I } from "./index-5c1112e8.js";
|
|
3
3
|
const g = { style: { "padding-bottom": "10px" } }, k = { key: 0, class: "graphDiv" }, N = I({ name: "TacheSubprocessHistory", data: () => ({ type: "graph", workflowId: null }), created() {
|
|
4
4
|
const o = this.$route.query.workflowId;
|
|
5
5
|
o && (this.workflowId = parseInt(o));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agilebuilder-ui",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.48",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "./lib/super-ui.js",
|
|
@@ -24,14 +24,19 @@
|
|
|
24
24
|
"path-to-regexp": "6.2.1",
|
|
25
25
|
"sortablejs": "^1.15.0",
|
|
26
26
|
"tinymce": "5.8.2",
|
|
27
|
-
"uuid": "^9.0.1"
|
|
27
|
+
"uuid": "^9.0.1",
|
|
28
|
+
"vue-element-plus-x": "1.3.7"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
31
|
+
"@codemirror/lang-json": "^6.0.1",
|
|
32
|
+
"@codemirror/state": "^6.4.1",
|
|
30
33
|
"@element-plus/icons-vue": "^2.1.0",
|
|
31
34
|
"@vitejs/plugin-vue": "^4.2.3",
|
|
32
35
|
"axios": "^1.5.1",
|
|
36
|
+
"codemirror": "^6.0.1",
|
|
33
37
|
"element-plus": "^2.4.1",
|
|
34
38
|
"nprogress": "^0.2.0",
|
|
39
|
+
"pinia": "^2.1.7",
|
|
35
40
|
"rollup-plugin-terser": "^7.0.2",
|
|
36
41
|
"sass": "1.69.4",
|
|
37
42
|
"vite": "^4.4.5",
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { BubbleProps } from 'vue-element-plus-x/types/Bubble'
|
|
2
|
+
interface chatMessageType extends BubbleProps {
|
|
3
|
+
isRecommend: boolean
|
|
4
|
+
key: number
|
|
5
|
+
role: string
|
|
6
|
+
content: string
|
|
7
|
+
loading: boolean
|
|
8
|
+
isMarkdown: boolean
|
|
9
|
+
typing: boolean
|
|
10
|
+
avatar: string
|
|
11
|
+
avatarSize: string
|
|
12
|
+
noStyle: boolean
|
|
13
|
+
statusValue: string
|
|
14
|
+
recommendations: any
|
|
15
|
+
thinkingContent: string | null
|
|
16
|
+
thinkingStatus?: string
|
|
17
|
+
showThinkingContent: boolean
|
|
18
|
+
placement: 'start' | 'end'
|
|
19
|
+
additionalData: any
|
|
20
|
+
additionalDataLabel?: string
|
|
21
|
+
menuName?: string
|
|
22
|
+
}
|
|
23
|
+
function getMessageTemplate(type: string, content: string, isRecommend: boolean): chatMessageType {
|
|
24
|
+
const role = type === 'ai' ? 'ai' : 'user'
|
|
25
|
+
const placement = role === 'ai' ? 'start' : 'end'
|
|
26
|
+
const key = new Date().getTime()
|
|
27
|
+
const loading = false
|
|
28
|
+
const shape = 'corner'
|
|
29
|
+
const variant = role === 'ai' ? 'filled' : 'outlined'
|
|
30
|
+
const isMarkdown = false
|
|
31
|
+
const typing = role === 'ai' ? true : false
|
|
32
|
+
const avatar =
|
|
33
|
+
role === 'ai'
|
|
34
|
+
? 'https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png'
|
|
35
|
+
: '../../src/assets/chat-embed/avatar.png'
|
|
36
|
+
const message: chatMessageType = {
|
|
37
|
+
isRecommend: isRecommend,
|
|
38
|
+
key,
|
|
39
|
+
role,
|
|
40
|
+
placement,
|
|
41
|
+
content,
|
|
42
|
+
thinkingContent: null,
|
|
43
|
+
showThinkingContent: false,
|
|
44
|
+
loading,
|
|
45
|
+
shape,
|
|
46
|
+
variant,
|
|
47
|
+
isMarkdown,
|
|
48
|
+
typing,
|
|
49
|
+
avatar,
|
|
50
|
+
noStyle: role === 'ai' ? true : false,
|
|
51
|
+
statusValue: 'end',
|
|
52
|
+
recommendations: [],
|
|
53
|
+
avatarSize: '24px'
|
|
54
|
+
}
|
|
55
|
+
if (role === 'ai') {
|
|
56
|
+
message.maxWidth = 'calc(100% - 60px)'
|
|
57
|
+
message.thinkingContent = ''
|
|
58
|
+
message.thinkingStatus = 'thinking'
|
|
59
|
+
message.showThinkingContent = true
|
|
60
|
+
}
|
|
61
|
+
return message
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const defaultMessage = getMessageTemplate('ai', '😊 您好,我是平台小助手,您可以向我提出关于平台使用问题', true)
|
|
65
|
+
// const recommendation1 = getMessageTemplate('ai', '组件的详细介绍', true)
|
|
66
|
+
// recommendation1.thinkingStatus
|
|
67
|
+
// const recommendation2 = getMessageTemplate('ai', '如何进行前后端二次开发?', true)
|
|
68
|
+
// defaultMessage.recommendations = [
|
|
69
|
+
// recommendation1,
|
|
70
|
+
// recommendation2,
|
|
71
|
+
// recommendation1,
|
|
72
|
+
// recommendation2,
|
|
73
|
+
// recommendation1,
|
|
74
|
+
// recommendation2,
|
|
75
|
+
// recommendation1,
|
|
76
|
+
// recommendation2
|
|
77
|
+
// ]
|
|
78
|
+
|
|
79
|
+
export { chatMessageType, getMessageTemplate, defaultMessage }
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
.slide-up-enter-active,
|
|
2
|
+
.slide-up-leave-active {
|
|
3
|
+
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.slide-up-enter-from,
|
|
7
|
+
.slide-up-leave-to {
|
|
8
|
+
transform: translateY(100%);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 聊天窗口的样式设置
|
|
13
|
+
*/
|
|
14
|
+
.chat-container {
|
|
15
|
+
--header-height: 56px;
|
|
16
|
+
--chat-padding: 12px;
|
|
17
|
+
--bubble-content-max-width: 0px;
|
|
18
|
+
position: fixed;
|
|
19
|
+
right: 12px; /* 距离浏览器右边框12px */
|
|
20
|
+
bottom: 12px; /* 距离浏览器下边框12px */
|
|
21
|
+
background: white;
|
|
22
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
23
|
+
border-radius: 8px;
|
|
24
|
+
overflow: hidden;
|
|
25
|
+
z-index: 100;
|
|
26
|
+
}
|
|
27
|
+
/* 聊天窗口的头部样式设置
|
|
28
|
+
*/
|
|
29
|
+
.chat-embed__header_container {
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
background: linear-gradient(90deg, #ebf1ff 24.34%, #e5fbf8 56.18%, #f2ebfe 90.18%);
|
|
33
|
+
height: var(--header-height);
|
|
34
|
+
line-height: var(--header-height);
|
|
35
|
+
overflow: hidden;
|
|
36
|
+
position: relative;
|
|
37
|
+
}
|
|
38
|
+
/* 聊天窗口的头部图标样式设置
|
|
39
|
+
*/
|
|
40
|
+
.chat-embed__header_avatar {
|
|
41
|
+
margin-left: calc(var(--chat-padding) * 2);
|
|
42
|
+
margin-right: var(--chat-padding);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.chat-embed__header_tool_icon {
|
|
46
|
+
right: 15px;
|
|
47
|
+
position: absolute;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.chat-embed__main {
|
|
51
|
+
padding: var(--chat-padding);
|
|
52
|
+
box-sizing: border-box;
|
|
53
|
+
overflow: hidden;
|
|
54
|
+
position: relative;
|
|
55
|
+
display: flex;
|
|
56
|
+
flex-direction: column;
|
|
57
|
+
height: 100%;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.chat-embed__main_content {
|
|
61
|
+
flex: 1;
|
|
62
|
+
box-sizing: border-box;
|
|
63
|
+
min-height: 0;
|
|
64
|
+
margin-bottom: 10px; /* 与输入框保持10px间距 */
|
|
65
|
+
/* overflow-y: auto;
|
|
66
|
+
margin-bottom: 12px; */
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.chat-embed__input_container {
|
|
70
|
+
flex-shrink: 0; /* 不允许收缩 */
|
|
71
|
+
margin-bottom: 50px; /* 距离底部10px */
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.header-icon {
|
|
75
|
+
cursor: pointer;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.header-icon + .header-icon {
|
|
79
|
+
margin-left: 12px;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/* 聊天默认推荐内容样式
|
|
83
|
+
*/
|
|
84
|
+
.chat-embed__recommendation + .chat-embed__recommendation {
|
|
85
|
+
margin-top: 12px;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.content-container {
|
|
89
|
+
padding: 12px;
|
|
90
|
+
background-color: #f5f7fa;
|
|
91
|
+
border-radius: 4px;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.content-container-header {
|
|
95
|
+
font-size: 12px;
|
|
96
|
+
color: #909399;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.content-borderless-container {
|
|
100
|
+
user-select: none;
|
|
101
|
+
padding: 12px;
|
|
102
|
+
cursor: pointer;
|
|
103
|
+
transition: background-color 0.3s;
|
|
104
|
+
&:hover {
|
|
105
|
+
background-color: #ebeef5;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.footer-container {
|
|
110
|
+
:deep(.el-button + .el-button) {
|
|
111
|
+
margin-left: 8px;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.el-bubble-content-wrapper .el-bubble-content {
|
|
116
|
+
padding: 0;
|
|
117
|
+
}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-button text @click="newChatSession">
|
|
3
|
+
<el-icon><Plus /></el-icon>{{ t('chatEmbed.newChat') }}
|
|
4
|
+
</el-button>
|
|
5
|
+
|
|
6
|
+
<Sender
|
|
7
|
+
v-model="senderValue"
|
|
8
|
+
variant="updown"
|
|
9
|
+
:auto-size="{ minRows: 2, maxRows: 5 }"
|
|
10
|
+
clearable
|
|
11
|
+
allow-speech
|
|
12
|
+
placeholder=""
|
|
13
|
+
>
|
|
14
|
+
<template #prefix>
|
|
15
|
+
<div style="display: flex; align-items: center; gap: 8px; flex-wrap: wrap">
|
|
16
|
+
<!-- 是自定义 操作列表 -->
|
|
17
|
+
<!-- <el-button round plain color="#626aef">
|
|
18
|
+
<el-icon><Paperclip /></el-icon>
|
|
19
|
+
</el-button> -->
|
|
20
|
+
<el-tag type="primary" v-if="showAdditionalData">
|
|
21
|
+
<template #default>
|
|
22
|
+
<div
|
|
23
|
+
style="
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
flex-shrink: 0;
|
|
27
|
+
min-width: max-content;
|
|
28
|
+
margin-left: auto;
|
|
29
|
+
gap: 10px;
|
|
30
|
+
"
|
|
31
|
+
>
|
|
32
|
+
<el-icon><Paperclip /></el-icon>
|
|
33
|
+
{{ additionalDataLabel }}
|
|
34
|
+
<el-tooltip content="预览">
|
|
35
|
+
<super-icon iconValue="amb-color-icon-yulan" style="cursor: pointer" @click="viewJson" />
|
|
36
|
+
</el-tooltip>
|
|
37
|
+
<el-tooltip content="下载">
|
|
38
|
+
<super-icon iconValue="amb-color-icon-xiazai" style="cursor: pointer" @click="downloadJsonData" />
|
|
39
|
+
</el-tooltip>
|
|
40
|
+
<el-tooltip content="移除">
|
|
41
|
+
<super-icon iconValue="amb-color-icon-shanchu" style="cursor: pointer" @click="removeAdditionalData" />
|
|
42
|
+
</el-tooltip>
|
|
43
|
+
</div>
|
|
44
|
+
</template>
|
|
45
|
+
</el-tag>
|
|
46
|
+
</div>
|
|
47
|
+
</template>
|
|
48
|
+
<template #action-list>
|
|
49
|
+
<div style="display: flex; align-items: center">
|
|
50
|
+
<el-tooltip content="附加页面数据">
|
|
51
|
+
<el-button text circle round @click="addPageData">
|
|
52
|
+
<el-icon><Paperclip /></el-icon>
|
|
53
|
+
</el-button>
|
|
54
|
+
</el-tooltip>
|
|
55
|
+
<el-button
|
|
56
|
+
v-if="loading"
|
|
57
|
+
:disabled="!senderValue || !senderValue.trim()"
|
|
58
|
+
type="primary"
|
|
59
|
+
plain
|
|
60
|
+
circle
|
|
61
|
+
@click="handleCancel"
|
|
62
|
+
>
|
|
63
|
+
<el-icon class="is-loaidng">
|
|
64
|
+
<Loading />
|
|
65
|
+
</el-icon>
|
|
66
|
+
</el-button>
|
|
67
|
+
<el-button v-else circle :disabled="!senderValue || !senderValue.trim()" plain round @click="handleSubmit">
|
|
68
|
+
<el-icon><Promotion /></el-icon>
|
|
69
|
+
</el-button>
|
|
70
|
+
</div>
|
|
71
|
+
</template>
|
|
72
|
+
</Sender>
|
|
73
|
+
</template>
|
|
74
|
+
<script setup lang="ts">
|
|
75
|
+
import { ref, defineProps, defineEmits, onMounted, watch } from 'vue'
|
|
76
|
+
import ChatAiStore from '../../../src/store/modules/chat-ai-store.ts'
|
|
77
|
+
import { Sender } from 'vue-element-plus-x'
|
|
78
|
+
import { generateFileName, downloadJsonFile } from './util.ts'
|
|
79
|
+
import { createPinia, setActivePinia, getActivePinia } from 'pinia'
|
|
80
|
+
import { useI18n } from 'vue-i18n'
|
|
81
|
+
const { t } = useI18n()
|
|
82
|
+
|
|
83
|
+
let chataiStore: any = null
|
|
84
|
+
|
|
85
|
+
onMounted(() => {
|
|
86
|
+
initializePiniaAndStore()
|
|
87
|
+
initializeStore()
|
|
88
|
+
})
|
|
89
|
+
function initializePiniaAndStore() {
|
|
90
|
+
try {
|
|
91
|
+
// 检查是否已有 Pinia 实例
|
|
92
|
+
let pinia = getActivePinia()
|
|
93
|
+
|
|
94
|
+
if (!pinia) {
|
|
95
|
+
// 没有 Pinia 实例时创建一个
|
|
96
|
+
pinia = createPinia()
|
|
97
|
+
setActivePinia(pinia)
|
|
98
|
+
// 如果有 Vue 应用实例,也注册到应用上
|
|
99
|
+
if (window.$vueApp) {
|
|
100
|
+
window.$vueApp.use(pinia)
|
|
101
|
+
}
|
|
102
|
+
console.log('Pinia initialized in chat-sender component')
|
|
103
|
+
}
|
|
104
|
+
// 初始化 store
|
|
105
|
+
chataiStore = ChatAiStore()
|
|
106
|
+
console.log('ChatAiStore initialized successfully')
|
|
107
|
+
} catch (error) {
|
|
108
|
+
console.error('Failed to initialize Pinia or ChatAiStore:', error)
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function initializeStore() {
|
|
113
|
+
try {
|
|
114
|
+
// 确保 Store 正确挂载到全局
|
|
115
|
+
if (window.parent && window.parent !== window) {
|
|
116
|
+
// 在 iframe 中
|
|
117
|
+
window.parent.ChatAiStore = chataiStore
|
|
118
|
+
}
|
|
119
|
+
if (window.top && window.top !== window) {
|
|
120
|
+
// 挂载到顶层窗口
|
|
121
|
+
window.top.ChatAiStore = chataiStore
|
|
122
|
+
}
|
|
123
|
+
// 同时挂载到当前窗口
|
|
124
|
+
window.ChatAiStore = chataiStore
|
|
125
|
+
} catch (error) {
|
|
126
|
+
console.error('Failed to initialize ChatAiStore:', error)
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
const props = defineProps({
|
|
130
|
+
loading: {
|
|
131
|
+
type: Boolean,
|
|
132
|
+
default: false
|
|
133
|
+
}
|
|
134
|
+
})
|
|
135
|
+
const emits = defineEmits(['new-chat-session', 'submit-question', 'handle-cancel', 'view-json'])
|
|
136
|
+
const showAdditionalData = ref(false)
|
|
137
|
+
const additionalDataLabel = ref('')
|
|
138
|
+
const additionalData = ref([])
|
|
139
|
+
const senderValue = ref('')
|
|
140
|
+
|
|
141
|
+
onMounted(() => {
|
|
142
|
+
initializeStore()
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
function newChatSession() {
|
|
146
|
+
// 清空输入框
|
|
147
|
+
senderValue.value = ''
|
|
148
|
+
// Emit an event to start a new chat session
|
|
149
|
+
emits('new-chat-session')
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function handleSubmit() {
|
|
153
|
+
const question = senderValue.value.trim()
|
|
154
|
+
const activeMenu = chataiStore.getActiveMenu()
|
|
155
|
+
emits('submit-question', {
|
|
156
|
+
question: question,
|
|
157
|
+
additionalData: additionalData.value,
|
|
158
|
+
additionalDataLabel: additionalDataLabel.value,
|
|
159
|
+
menuName: activeMenu?.menuName || ''
|
|
160
|
+
})
|
|
161
|
+
senderValue.value = ''
|
|
162
|
+
removeAdditionalData()
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function handleCancel() {
|
|
166
|
+
emits('handle-cancel')
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function addPageData() {
|
|
170
|
+
const activeMenu = chataiStore.getActiveMenu()
|
|
171
|
+
const pageInfo = chataiStore.getActiveMenuPageInfo()
|
|
172
|
+
if (pageInfo.pageType === 'list') {
|
|
173
|
+
const listRef = pageInfo.listRefs[0].ref
|
|
174
|
+
debugger
|
|
175
|
+
const visibleColumns = listRef.visibleColumns
|
|
176
|
+
const listData = chataiStore.getPageData()
|
|
177
|
+
if (listData && listData.length > 0) {
|
|
178
|
+
additionalData.value = formatListData(listData, visibleColumns)
|
|
179
|
+
} else {
|
|
180
|
+
const tableDatas = listRef.tableDatas
|
|
181
|
+
if (tableDatas) {
|
|
182
|
+
additionalData.value = formatListData(tableDatas, visibleColumns)
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
if (additionalData.value?.length > 0) {
|
|
186
|
+
additionalDataLabel.value = `已附加【${activeMenu.menuName}】表格数据 (${additionalData.value.length} 条记录)`
|
|
187
|
+
showAdditionalData.value = true
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
function formatListData(data, visibleColumns) {
|
|
192
|
+
const result: any = []
|
|
193
|
+
data.forEach((item) => {
|
|
194
|
+
const formattedItem = {}
|
|
195
|
+
Object.keys(item).forEach((key) => {
|
|
196
|
+
const column = visibleColumns.find((col) => col.orgProp === key)
|
|
197
|
+
if (column) {
|
|
198
|
+
formattedItem[column.label] = item[key]
|
|
199
|
+
}
|
|
200
|
+
})
|
|
201
|
+
result.push(formattedItem)
|
|
202
|
+
})
|
|
203
|
+
return result
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function removeAdditionalData() {
|
|
207
|
+
additionalData.value = []
|
|
208
|
+
additionalDataLabel.value = ''
|
|
209
|
+
showAdditionalData.value = false
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function viewJson() {
|
|
213
|
+
emits('view-json', additionalData.value)
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function downloadJsonData() {
|
|
217
|
+
try {
|
|
218
|
+
const activeMenu = chataiStore.getActiveMenu()
|
|
219
|
+
const fileName = generateFileName(activeMenu?.menuName || 'data')
|
|
220
|
+
downloadJsonFile(additionalData.value, fileName)
|
|
221
|
+
} catch (error) {
|
|
222
|
+
console.error('下载失败:', error)
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
</script>
|
|
226
|
+
|
|
227
|
+
<style lang="scss" rel="stylesheet/scss" scoped>
|
|
228
|
+
@import url('./chat-embed.css');
|
|
229
|
+
h4 {
|
|
230
|
+
font-size: 16px;
|
|
231
|
+
margin-top: 0px;
|
|
232
|
+
margin-bottom: 0px;
|
|
233
|
+
}
|
|
234
|
+
:deep(.el-bubble-content-wrapper .el-bubble-content) {
|
|
235
|
+
padding: 0 !important;
|
|
236
|
+
}
|
|
237
|
+
:deep(.el-divider--horizontal) {
|
|
238
|
+
margin: 5px 0;
|
|
239
|
+
}
|
|
240
|
+
</style>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div ref="chatHeaderRef" class="chat-embed__header_container">
|
|
3
|
+
<el-avatar class="chat-embed__header_avatar" :src="aiAvatar" />
|
|
4
|
+
<h4>{{ $t('chatEmbed.name') }}</h4>
|
|
5
|
+
<div class="chat-embed__header_tool_icon">
|
|
6
|
+
<el-tooltip class="box-item" effect="dark" :content="$t('chatEmbed.history')">
|
|
7
|
+
<span class="header-icon"><SuperIcon iconValue="fa-history" /></span>
|
|
8
|
+
</el-tooltip>
|
|
9
|
+
<el-tooltip
|
|
10
|
+
class="box-item"
|
|
11
|
+
effect="dark"
|
|
12
|
+
:content="dialogFullScreen ? $t('chatEmbed.minimize') : $t('chatEmbed.fullscreen')"
|
|
13
|
+
>
|
|
14
|
+
<span class="header-icon">
|
|
15
|
+
<SuperIcon iconValue="fa-expand" @click="expandDialog" />
|
|
16
|
+
</span>
|
|
17
|
+
</el-tooltip>
|
|
18
|
+
<el-tooltip class="box-item" effect="dark" :content="$t('chatEmbed.close')">
|
|
19
|
+
<span class="header-icon">
|
|
20
|
+
<SuperIcon @click="showChatDialog" iconValue="fa-close" />
|
|
21
|
+
</span>
|
|
22
|
+
</el-tooltip>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
26
|
+
<script setup lang="ts">
|
|
27
|
+
import { defineProps, defineEmits } from 'vue'
|
|
28
|
+
const props = defineProps({
|
|
29
|
+
aiAvatar: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: 'https://example.com/default-avatar.png'
|
|
32
|
+
},
|
|
33
|
+
dialogFullScreen: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: false
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
const emit = defineEmits(['showChatDialog', 'expandDialog'])
|
|
39
|
+
|
|
40
|
+
function expandDialog() {
|
|
41
|
+
emit('expandDialog')
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function showChatDialog() {
|
|
45
|
+
emit('showChatDialog')
|
|
46
|
+
}
|
|
47
|
+
</script>
|
|
48
|
+
<style scoped>
|
|
49
|
+
@import url('./chat-embed.css');
|
|
50
|
+
</style>
|