agilebuilder-ui 1.1.43 → 1.1.45-ai1
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-f2a9b546.js → 401-107d48d8.js} +1 -1
- package/lib/{404-746481cf.js → 404-e8eba234.js} +1 -1
- package/lib/{iframe-page-d2b594c4.js → iframe-page-fbb9c06b.js} +1 -1
- package/lib/index-e5d8483d.js +93084 -0
- package/lib/super-ui.css +1 -1
- package/lib/super-ui.js +33 -32
- package/lib/super-ui.umd.cjs +168 -136
- package/lib/{tab-content-iframe-index-ecc72989.js → tab-content-iframe-index-db42a784.js} +1 -1
- package/lib/{tab-content-index-6a314fc4.js → tab-content-index-2c2f41d9.js} +1 -1
- package/lib/{tache-subprocess-history-4a760e68.js → tache-subprocess-history-f40e7165.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 +420 -0
- package/packages/chat-embed/src/recommendation-message.vue +37 -0
- package/packages/chat-embed/src/util.ts +33 -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/super-grid.vue +29 -6
- package/src/assets/chat-embed/avatar.png +0 -0
- package/src/i18n/langs/cn.js +14 -2
- package/src/i18n/langs/en.js +13 -1
- package/src/store/modules/chat-ai-store.ts +78 -0
- package/src/store/modules/tab-content.js +9 -3
- package/src/styles/index.scss +17 -0
- package/src/utils/chat-ai-util.ts +31 -0
- package/src/utils/common-util.js +50 -25
- package/src/utils/util.js +37 -7
- package/src/views/layout/components/Menubar/Item.vue +1 -1
- package/lib/index-9787409e.js +0 -73554
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:style="{
|
|
4
|
+
width: '100%'
|
|
5
|
+
}"
|
|
6
|
+
ref="cfCodemirrorJsonViewRef"
|
|
7
|
+
id="cf-codemirror-view-json"
|
|
8
|
+
></div>
|
|
9
|
+
</template>
|
|
10
|
+
<script lang="ts" setup>
|
|
11
|
+
import { ref, defineProps, defineOptions, watch, nextTick, onMounted } from 'vue'
|
|
12
|
+
defineOptions({
|
|
13
|
+
name: 'JsonView',
|
|
14
|
+
inheritAttrs: false
|
|
15
|
+
})
|
|
16
|
+
import { basicSetup, EditorView } from 'codemirror'
|
|
17
|
+
import { jsonLanguage } from '@codemirror/lang-json'
|
|
18
|
+
import { EditorState, Facet } from '@codemirror/state'
|
|
19
|
+
|
|
20
|
+
const props = defineProps({
|
|
21
|
+
jsonObject: {
|
|
22
|
+
type: Object,
|
|
23
|
+
default: () => {}
|
|
24
|
+
},
|
|
25
|
+
height: {
|
|
26
|
+
type: Number,
|
|
27
|
+
default: 0
|
|
28
|
+
},
|
|
29
|
+
theme: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: null
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
const editor = ref<any>(null)
|
|
35
|
+
const cfCodemirrorJsonViewRef = ref()
|
|
36
|
+
const codemirrorHeight = ref('400px')
|
|
37
|
+
watch(
|
|
38
|
+
() => props.jsonObject,
|
|
39
|
+
(newVal) => {
|
|
40
|
+
if (editor.value) {
|
|
41
|
+
// 更新 CodeMirror 中的值
|
|
42
|
+
loadEditor()
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
{ deep: true }
|
|
46
|
+
)
|
|
47
|
+
onMounted(() => {
|
|
48
|
+
nextTick(() => {
|
|
49
|
+
loadEditor()
|
|
50
|
+
})
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
function loadEditor() {
|
|
54
|
+
if (editor.value) {
|
|
55
|
+
editor.value.destroy()
|
|
56
|
+
}
|
|
57
|
+
const jsonStr = props.jsonObject ? JSON.stringify(props.jsonObject, null, 2) : ''
|
|
58
|
+
if (props.height) {
|
|
59
|
+
codemirrorHeight.value = props.height + 'px'
|
|
60
|
+
} else {
|
|
61
|
+
if (cfCodemirrorJsonViewRef.value) {
|
|
62
|
+
const rect = cfCodemirrorJsonViewRef.value.getBoundingClientRect()
|
|
63
|
+
if (rect.y || rect.y === 0) {
|
|
64
|
+
console.log('window.innerHeight - rect.y', window.innerHeight, rect.y)
|
|
65
|
+
codemirrorHeight.value = window.innerHeight - rect.y - 100 + 'px'
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const state = getEditorState(jsonStr)
|
|
70
|
+
let element: Element | null = document.getElementById('cf-codemirror-view-json')
|
|
71
|
+
if (element) {
|
|
72
|
+
editor.value = new EditorView({
|
|
73
|
+
state,
|
|
74
|
+
parent: element
|
|
75
|
+
})
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
// 获取编辑器状态
|
|
79
|
+
function getEditorState(jsonStr: string) {
|
|
80
|
+
// 获取主题
|
|
81
|
+
const mytheme = getTheme()
|
|
82
|
+
// 基本主题样式,主要设置字体大小和高度
|
|
83
|
+
const baseTheme = EditorView.theme({
|
|
84
|
+
'.cm-content, .cm-gutter': { minHeight: codemirrorHeight.value },
|
|
85
|
+
'&': {
|
|
86
|
+
height: codemirrorHeight.value,
|
|
87
|
+
maxHeight: codemirrorHeight.value,
|
|
88
|
+
fontSize: '12px'
|
|
89
|
+
}
|
|
90
|
+
})
|
|
91
|
+
return EditorState.create({
|
|
92
|
+
doc: jsonStr,
|
|
93
|
+
extensions: [
|
|
94
|
+
EditorState.tabSize.of(16),
|
|
95
|
+
basicSetup,
|
|
96
|
+
jsonLanguage,
|
|
97
|
+
mytheme,
|
|
98
|
+
baseTheme,
|
|
99
|
+
readOnlyFacet.of(true),
|
|
100
|
+
preventChanges
|
|
101
|
+
]
|
|
102
|
+
})
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// 创建一个新的 Facet
|
|
106
|
+
const readOnlyFacet = Facet.define<boolean, boolean>({ combine: (values) => values.some((a) => a) })
|
|
107
|
+
|
|
108
|
+
// 创建一个新的 StateField 来监听更改
|
|
109
|
+
const preventChanges = EditorState.transactionFilter.of((tr: any) => {
|
|
110
|
+
if (tr.isUserEvent && tr.docChanged && tr.state.facet(readOnlyFacet)) {
|
|
111
|
+
return {
|
|
112
|
+
changes: {
|
|
113
|
+
from: tr.changes.from,
|
|
114
|
+
to: tr.changes.to,
|
|
115
|
+
insert: tr.startState.doc.sliceString(tr.changes.from, tr.changes.to)
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return tr
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
function getTheme() {
|
|
123
|
+
return EditorView.theme({})
|
|
124
|
+
}
|
|
125
|
+
</script>
|
|
126
|
+
<style scoped></style>
|
|
@@ -226,7 +226,7 @@ import { checkPermission } from '../../../src/utils/permission'
|
|
|
226
226
|
import { getGuId } from '../../../src/utils/guid.js'
|
|
227
227
|
// import resizeMixin from '../../../src/mixins/resizeMixin.js';
|
|
228
228
|
import storeVuex from '../../../src/store'
|
|
229
|
-
|
|
229
|
+
import { setPageDataToChatAiStore, setPageInfoToChatStore } from '../../../src/utils/chat-ai-util.ts'
|
|
230
230
|
export default {
|
|
231
231
|
components: {
|
|
232
232
|
IndexColumn,
|
|
@@ -460,7 +460,7 @@ export default {
|
|
|
460
460
|
// 限制高度最低值
|
|
461
461
|
hasMaxHeight() {
|
|
462
462
|
if (this.maxHeight) {
|
|
463
|
-
return this.maxHeight <= 100 ? 100 : this.maxHeight + this.heightOffset
|
|
463
|
+
return this.maxHeight <= 100 ? 100 : this.maxHeight + (this.heightOffset!==0?this.heightOffset:30)
|
|
464
464
|
}
|
|
465
465
|
return undefined
|
|
466
466
|
},
|
|
@@ -468,7 +468,7 @@ export default {
|
|
|
468
468
|
// 是指固定高度最低值
|
|
469
469
|
hasTableHeight() {
|
|
470
470
|
if (this.tableHeight) {
|
|
471
|
-
return this.tableHeight <= 100 ? 100 : this.tableHeight + this.heightOffset
|
|
471
|
+
return this.tableHeight <= 100 ? 100 : this.tableHeight + (this.heightOffset!==0?this.heightOffset:30)
|
|
472
472
|
}
|
|
473
473
|
return undefined
|
|
474
474
|
},
|
|
@@ -523,6 +523,8 @@ export default {
|
|
|
523
523
|
// 表示不显示“序号”列
|
|
524
524
|
return false
|
|
525
525
|
}
|
|
526
|
+
// 存储有默认值的字段集合
|
|
527
|
+
this.storeHasDefaultValueColumns(column, gridParams)
|
|
526
528
|
let isVisible
|
|
527
529
|
if (column.show === undefined || column.show) {
|
|
528
530
|
isVisible = true
|
|
@@ -547,8 +549,6 @@ export default {
|
|
|
547
549
|
} else {
|
|
548
550
|
isVisible = false
|
|
549
551
|
}
|
|
550
|
-
// 存储有默认值的字段集合
|
|
551
|
-
this.storeHasDefaultValueColumns(column, gridParams)
|
|
552
552
|
return isVisible
|
|
553
553
|
})
|
|
554
554
|
)
|
|
@@ -924,6 +924,16 @@ export default {
|
|
|
924
924
|
deep: true
|
|
925
925
|
}
|
|
926
926
|
)
|
|
927
|
+
if (!this.isFormSubTable) {
|
|
928
|
+
setPageInfoToChatStore(this.pageContext.menuCode, {
|
|
929
|
+
listRefs: [
|
|
930
|
+
{
|
|
931
|
+
ref: this
|
|
932
|
+
}
|
|
933
|
+
],
|
|
934
|
+
pageType: 'list'
|
|
935
|
+
})
|
|
936
|
+
}
|
|
927
937
|
})
|
|
928
938
|
},
|
|
929
939
|
beforeDestroy() {
|
|
@@ -1288,7 +1298,11 @@ export default {
|
|
|
1288
1298
|
if (gridParams.defaultValueColumns === undefined || gridParams.defaultValueColumns === null) {
|
|
1289
1299
|
gridParams.defaultValueColumns = []
|
|
1290
1300
|
}
|
|
1291
|
-
|
|
1301
|
+
// 放到defaultValueColumns前要根据column.prop判断是否已经存在
|
|
1302
|
+
const hasColumn = gridParams.defaultValueColumns.find((item) => item.prop === column.prop)
|
|
1303
|
+
if (!hasColumn) {
|
|
1304
|
+
gridParams.defaultValueColumns.push(column)
|
|
1305
|
+
}
|
|
1292
1306
|
}
|
|
1293
1307
|
},
|
|
1294
1308
|
// 判断是不是表单子表的使用
|
|
@@ -3218,6 +3232,9 @@ export default {
|
|
|
3218
3232
|
// this.$refs.superGrid?.toggleRowSelection(newSelection[newSelection.length - 1], false)
|
|
3219
3233
|
// }
|
|
3220
3234
|
}
|
|
3235
|
+
if (!this.isFormSubTable) {
|
|
3236
|
+
setPageDataToChatAiStore(newSelection)
|
|
3237
|
+
}
|
|
3221
3238
|
this.selectionChange(newSelection)
|
|
3222
3239
|
},
|
|
3223
3240
|
// 显示移动端查询区域
|
|
@@ -3402,11 +3419,17 @@ export default {
|
|
|
3402
3419
|
this.$refs.superGrid.setCurrentRow(this.tableDatas[rowIndex])
|
|
3403
3420
|
},
|
|
3404
3421
|
getSuperGridRef() {
|
|
3422
|
+
return this
|
|
3423
|
+
},
|
|
3424
|
+
getSuperGridTableRef() {
|
|
3405
3425
|
return this.$refs.superGrid
|
|
3406
3426
|
},
|
|
3407
3427
|
getColumns() {
|
|
3408
3428
|
return this.columns
|
|
3409
3429
|
},
|
|
3430
|
+
getTableData() {
|
|
3431
|
+
return this.tableDatas
|
|
3432
|
+
},
|
|
3410
3433
|
handRowKeyToUpperCase(row) {
|
|
3411
3434
|
// 把row对象的所有key都转成大写
|
|
3412
3435
|
if (row) {
|
|
Binary file
|
package/src/i18n/langs/cn.js
CHANGED
|
@@ -84,7 +84,7 @@ const cn = {
|
|
|
84
84
|
uploadFileTip: '上传的文件不超过{fileSize}M',
|
|
85
85
|
asyncExportJumpMsg: '或点击我跳转到下载页面',
|
|
86
86
|
mustFill: '{label} 必须填写',
|
|
87
|
-
filePathNotFound: '文件UUID未找到,请检查配置'
|
|
87
|
+
filePathNotFound: '文件UUID未找到,请检查配置'
|
|
88
88
|
},
|
|
89
89
|
// 列表组件
|
|
90
90
|
superGrid: {
|
|
@@ -136,7 +136,7 @@ const cn = {
|
|
|
136
136
|
prevRow: '上一行',
|
|
137
137
|
nextRow: '下一行',
|
|
138
138
|
detail: '详情',
|
|
139
|
-
searchEmpty:'查询空值'
|
|
139
|
+
searchEmpty: '查询空值'
|
|
140
140
|
},
|
|
141
141
|
// 部门树组件
|
|
142
142
|
departmentTree: {},
|
|
@@ -299,6 +299,18 @@ const cn = {
|
|
|
299
299
|
},
|
|
300
300
|
imatrixUIPromptMessage: {
|
|
301
301
|
NoContent: '暂无内容'
|
|
302
|
+
},
|
|
303
|
+
chatEmbed: {
|
|
304
|
+
name: '小助手',
|
|
305
|
+
history: '历史记录',
|
|
306
|
+
minimize: '缩小',
|
|
307
|
+
fullscreen: '全屏',
|
|
308
|
+
close: '关闭',
|
|
309
|
+
regenerate: '重新生成',
|
|
310
|
+
copy: '复制',
|
|
311
|
+
newChat: '新建会话',
|
|
312
|
+
copySuccess: '复制成功',
|
|
313
|
+
requestFailed: '请求会话失败!'
|
|
302
314
|
}
|
|
303
315
|
}
|
|
304
316
|
export default cn
|
package/src/i18n/langs/en.js
CHANGED
|
@@ -136,7 +136,7 @@ const en = {
|
|
|
136
136
|
prevRow: 'Prev Row',
|
|
137
137
|
nextRow: 'Next Row',
|
|
138
138
|
detail: 'Detail',
|
|
139
|
-
searchEmpty:'Search Empty'
|
|
139
|
+
searchEmpty: 'Search Empty'
|
|
140
140
|
},
|
|
141
141
|
departmentTree: {},
|
|
142
142
|
departmentTreeInline: {
|
|
@@ -298,6 +298,18 @@ const en = {
|
|
|
298
298
|
},
|
|
299
299
|
imatrixUIPromptMessage: {
|
|
300
300
|
NoContent: 'No content'
|
|
301
|
+
},
|
|
302
|
+
chatEmbed: {
|
|
303
|
+
name: 'Assistant',
|
|
304
|
+
history: 'History',
|
|
305
|
+
minimize: 'Minimize',
|
|
306
|
+
fullscreen: 'Full Screen',
|
|
307
|
+
close: 'Close',
|
|
308
|
+
regenerate: 'Regenerate',
|
|
309
|
+
copy: 'Copy',
|
|
310
|
+
newChat: 'New Chat',
|
|
311
|
+
copySuccess: 'Copy successful',
|
|
312
|
+
requestFailed: 'Request failed!'
|
|
301
313
|
}
|
|
302
314
|
}
|
|
303
315
|
export default en
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { ref, computed, reactive } from 'vue'
|
|
2
|
+
import { defineStore } from 'pinia'
|
|
3
|
+
|
|
4
|
+
type Menu = {
|
|
5
|
+
menuCode: string
|
|
6
|
+
menuName: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export default defineStore('ChatAiStore', () => {
|
|
10
|
+
const currentTabName = ref('chat')
|
|
11
|
+
const activeMenu = ref<Menu>({
|
|
12
|
+
menuCode: '',
|
|
13
|
+
menuName: ''
|
|
14
|
+
})
|
|
15
|
+
const pageInfo = ref<any>({})
|
|
16
|
+
|
|
17
|
+
// 最后操作的表格实例
|
|
18
|
+
const pageRef = ref<any>(null)
|
|
19
|
+
const pageData = ref<any[]>([])
|
|
20
|
+
|
|
21
|
+
function setCurrentTabName(name: string) {
|
|
22
|
+
currentTabName.value = name
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function getCurrentTabName() {
|
|
26
|
+
return currentTabName.value
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function setPageInfoToChatStore(menuCode: string, info: any) {
|
|
30
|
+
pageInfo.value[menuCode] = info
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function getPageInfo(menuCode: string) {
|
|
34
|
+
return pageInfo.value[menuCode] || null
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function getActiveMenuPageInfo() {
|
|
38
|
+
return pageInfo.value[activeMenu.value.menuCode] || null
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function setPageData(newSelection: any[]) {
|
|
42
|
+
pageData.value = JSON.parse(JSON.stringify(newSelection))
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function getPageData() {
|
|
46
|
+
return pageData.value
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function clearPageData() {
|
|
50
|
+
pageData.value = []
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function setActiveMenu(menu: any) {
|
|
54
|
+
activeMenu.value = menu
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function getActiveMenu() {
|
|
58
|
+
return activeMenu.value
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function getPageType() {}
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
setCurrentTabName,
|
|
65
|
+
getCurrentTabName,
|
|
66
|
+
setPageData,
|
|
67
|
+
getPageData,
|
|
68
|
+
clearPageData,
|
|
69
|
+
getActiveMenu,
|
|
70
|
+
setActiveMenu,
|
|
71
|
+
getPageType,
|
|
72
|
+
setPageInfoToChatStore,
|
|
73
|
+
getPageInfo,
|
|
74
|
+
getActiveMenuPageInfo,
|
|
75
|
+
pageData,
|
|
76
|
+
activeMenu
|
|
77
|
+
}
|
|
78
|
+
})
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { setActiveMenuToChatAiStore } from '../../utils/chat-ai-util.ts'
|
|
1
2
|
const tabContent = {
|
|
2
3
|
state: {
|
|
3
4
|
openTab: [], // 所有打开的路由
|
|
4
|
-
activeIndex: null
|
|
5
|
+
activeIndex: null // 激活状态
|
|
5
6
|
},
|
|
6
7
|
mutations: {
|
|
7
8
|
// 添加tabs
|
|
@@ -21,6 +22,11 @@ const tabContent = {
|
|
|
21
22
|
},
|
|
22
23
|
// 设置当前激活的tab
|
|
23
24
|
set_active_index(state, index) {
|
|
25
|
+
const activeTab = state.openTab.find((item) => item.code === index)
|
|
26
|
+
setActiveMenuToChatAiStore({
|
|
27
|
+
menuCode: index,
|
|
28
|
+
menuName: activeTab?.name || ''
|
|
29
|
+
})
|
|
24
30
|
state.activeIndex = index
|
|
25
31
|
},
|
|
26
32
|
// 清空tabs
|
|
@@ -28,9 +34,9 @@ const tabContent = {
|
|
|
28
34
|
if (state.openTab.length > 0) {
|
|
29
35
|
state.openTab.splice(0, state.openTab.length)
|
|
30
36
|
}
|
|
31
|
-
}
|
|
37
|
+
}
|
|
32
38
|
},
|
|
33
|
-
actions: {}
|
|
39
|
+
actions: {}
|
|
34
40
|
}
|
|
35
41
|
|
|
36
42
|
export default tabContent
|
package/src/styles/index.scss
CHANGED
|
@@ -227,6 +227,23 @@ body .el-table colgroup.gutter {
|
|
|
227
227
|
flex-direction: column
|
|
228
228
|
}
|
|
229
229
|
|
|
230
|
+
.amb-chart-container {
|
|
231
|
+
display: flex;
|
|
232
|
+
flex-direction: column;
|
|
233
|
+
height: 100%;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.amb-chart-header {
|
|
237
|
+
flex-shrink: 0;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.amb-chart-content {
|
|
241
|
+
/* 图表区域占据剩余空间 */
|
|
242
|
+
flex: 1;
|
|
243
|
+
/* 允许内容缩小 */
|
|
244
|
+
min-height: 0;
|
|
245
|
+
}
|
|
246
|
+
|
|
230
247
|
.amb-widget-chart-header {
|
|
231
248
|
border-bottom: 1px solid var(--el-card-border-color);
|
|
232
249
|
padding: 6px 10px;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
function setPageDataToChatAiStore(ref, newSelection, type = 'list') {
|
|
2
|
+
try {
|
|
3
|
+
if (window.top.ChatAiStore) {
|
|
4
|
+
window.top.ChatAiStore.setPageData(ref, newSelection, type)
|
|
5
|
+
}
|
|
6
|
+
} catch (error) {
|
|
7
|
+
console.error('ChatAiStore not found', error)
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function setActiveMenuToChatAiStore(activeMenu) {
|
|
12
|
+
try {
|
|
13
|
+
if (window.top.ChatAiStore) {
|
|
14
|
+
window.top.ChatAiStore.setActiveMenu(activeMenu)
|
|
15
|
+
}
|
|
16
|
+
} catch (error) {
|
|
17
|
+
console.error('ChatAiStore not found', error)
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function setPageInfoToChatStore(menuCode, info) {
|
|
22
|
+
try {
|
|
23
|
+
if (window.top.ChatAiStore) {
|
|
24
|
+
window.top.ChatAiStore.setPageInfoToChatStore(menuCode, info)
|
|
25
|
+
}
|
|
26
|
+
} catch (error) {
|
|
27
|
+
console.error('ChatAiStore not found', error)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { setPageDataToChatAiStore, setActiveMenuToChatAiStore, setPageInfoToChatStore }
|
package/src/utils/common-util.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as Vue from 'vue'
|
|
2
|
-
import
|
|
3
|
-
import { getToken, getLanguage, getAllLanguages, setAllLanguages, removeToken } from './auth'
|
|
2
|
+
import { getToken, getLanguage, getAllLanguages, setAllLanguages } from './auth'
|
|
4
3
|
import { v4 as uuidv4 } from 'uuid'
|
|
5
4
|
import { getCookieCache } from './auth'
|
|
6
5
|
import i18nUtil from './i18n-util'
|
|
@@ -231,7 +230,11 @@ export function isPlateSys(systemCode) {
|
|
|
231
230
|
|
|
232
231
|
export function getServerConfigUtil(http) {
|
|
233
232
|
return new Promise((resolve, reject) => {
|
|
234
|
-
|
|
233
|
+
let timestamp = '1'
|
|
234
|
+
if(__BUILD_TIME__) {
|
|
235
|
+
timestamp = __BUILD_TIME__
|
|
236
|
+
}
|
|
237
|
+
http.get('./server-config.json?t='+timestamp).then((result) => {
|
|
235
238
|
const config = result
|
|
236
239
|
for (const key in config) {
|
|
237
240
|
window.$vueApp.config.globalProperties[key] = config[key]
|
|
@@ -245,10 +248,10 @@ export function getServerConfigUtil(http) {
|
|
|
245
248
|
localStorage.setItem('_baseAPI_', window.$vueApp.config.globalProperties.baseAPI)
|
|
246
249
|
localStorage.setItem('_amb_projectModel_', window.$vueApp.config.globalProperties.projectModel)
|
|
247
250
|
if (config.fontIconAddress && window.insertCssFile) {
|
|
248
|
-
window.insertCssFile(`${config.fontIconAddress}/iconfont.css`)
|
|
251
|
+
window.insertCssFile(`${config.fontIconAddress}/iconfont.css?t=${timestamp}`)
|
|
249
252
|
}
|
|
250
253
|
if (config.fontIconAddress && window.insertCssFile) {
|
|
251
|
-
window.insertCssFile(`${config.fontIconAddress}-color/iconfont.css`)
|
|
254
|
+
window.insertCssFile(`${config.fontIconAddress}-color/iconfont.css?t=${timestamp}`)
|
|
252
255
|
}
|
|
253
256
|
resolve()
|
|
254
257
|
})
|
|
@@ -557,27 +560,49 @@ async function handlePlateSysLang(currentLanguage) {
|
|
|
557
560
|
}
|
|
558
561
|
}
|
|
559
562
|
}
|
|
563
|
+
// 缓存项目设值信息
|
|
564
|
+
export function cacheProjectSetting() {
|
|
565
|
+
return new Promise((resolve,reject)=>{
|
|
566
|
+
const projectSettingCache = localStorage.getItem('PROJECT_SETTINGS')
|
|
567
|
+
let projectSettings = null
|
|
568
|
+
if(projectSettingCache && projectSettingCache === '_EMPTY_VALUE') {
|
|
569
|
+
resolve(projectSettings)
|
|
570
|
+
} else if (projectSettingCache) {
|
|
571
|
+
projectSettings = JSON.parse(projectSettingCache)
|
|
572
|
+
setBrowserFavicon(projectSettings)
|
|
573
|
+
resolve(projectSettings)
|
|
574
|
+
} else {
|
|
575
|
+
window.$vueApp.config.globalProperties.$http.get(window.$vueApp.config.globalProperties.baseAPI + '/cfg/project-settings').then((data) => {
|
|
576
|
+
if(data){
|
|
577
|
+
localStorage.setItem('PROJECT_SETTINGS', JSON.stringify(data))
|
|
578
|
+
projectSettings = data
|
|
579
|
+
setBrowserFavicon(projectSettings)
|
|
580
|
+
} else {
|
|
581
|
+
localStorage.setItem('PROJECT_SETTINGS', '_EMPTY_VALUE')
|
|
582
|
+
}
|
|
583
|
+
resolve(projectSettings)
|
|
584
|
+
}).catch((error)=>{
|
|
585
|
+
reject(error)
|
|
586
|
+
})
|
|
587
|
+
}
|
|
588
|
+
})
|
|
589
|
+
}
|
|
560
590
|
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
// if (linkElement) {
|
|
577
|
-
// linkElement.href = window.$vueApp.config.globalProperties.baseAPI + '/cfg/project/icon/browserIcon'
|
|
578
|
-
// }
|
|
579
|
-
// }
|
|
580
|
-
// }
|
|
591
|
+
function setBrowserFavicon(projectSettings){
|
|
592
|
+
const linkElement = document.getElementById('ambBrowserIcon')
|
|
593
|
+
if(!linkElement){
|
|
594
|
+
return
|
|
595
|
+
}
|
|
596
|
+
if (projectSettings) {
|
|
597
|
+
const browserIconUrl = window.$vueApp.config.globalProperties.baseAPI + '/cfg/project/icon/browserIcon?t='+__BUILD_TIME__
|
|
598
|
+
if(projectSettings.browserImageUuid && (!linkElement.href || linkElement.href !== browserIconUrl) ){
|
|
599
|
+
linkElement.href = browserIconUrl
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
if(!linkElement.href) {
|
|
603
|
+
linkElement.href = 'favicon.svg?t='+__BUILD_TIME__
|
|
604
|
+
}
|
|
605
|
+
}
|
|
581
606
|
|
|
582
607
|
// 动态加载css
|
|
583
608
|
export function loadCSS() {
|
package/src/utils/util.js
CHANGED
|
@@ -259,15 +259,30 @@ function parseCondition(
|
|
|
259
259
|
// 再获取属于那张表
|
|
260
260
|
const propDbNameArr = propDbName.split('_+_')
|
|
261
261
|
propDbName = propDbNameArr[1]
|
|
262
|
-
|
|
262
|
+
if (pageContext && propDbName && propDbName.indexOf('${')>=0) {
|
|
263
|
+
leftValue = getPropValueNew(propDbName, pageContext, entity)
|
|
264
|
+
} else {
|
|
265
|
+
leftValue = getValue(parentFormData, propDbName, isSql)
|
|
266
|
+
}
|
|
267
|
+
// leftValue = getValue(parentFormData, propDbName, isSql)
|
|
263
268
|
} else {
|
|
264
|
-
|
|
269
|
+
if (pageContext && propDbName && propDbName.indexOf('${')>=0) {
|
|
270
|
+
leftValue = getPropValueNew(propDbName, pageContext, entity)
|
|
271
|
+
} else {
|
|
272
|
+
leftValue = getValue(entity, propDbName, isSql)
|
|
273
|
+
}
|
|
274
|
+
// leftValue = getValue(entity, propDbName, isSql)
|
|
265
275
|
}
|
|
266
276
|
if (leftValue === undefined || leftValue === null) {
|
|
267
277
|
if (tableName && propDbName.toLowerCase().startsWith(tableName.toLowerCase() + '.')) {
|
|
268
278
|
// 表示是当前表的字段
|
|
269
279
|
const myProp = propDbName.substring(propDbName.indexOf('.'))
|
|
270
|
-
|
|
280
|
+
if (pageContext && myProp && myProp.indexOf('${')>=0) {
|
|
281
|
+
leftValue = getPropValueNew(myProp, pageContext, entity)
|
|
282
|
+
} else {
|
|
283
|
+
leftValue = getValue(entity, myProp, isSql)
|
|
284
|
+
}
|
|
285
|
+
// leftValue = getValue(entity, myProp, isSql)
|
|
271
286
|
}
|
|
272
287
|
}
|
|
273
288
|
} else {
|
|
@@ -275,12 +290,27 @@ function parseCondition(
|
|
|
275
290
|
propName = propName.replace('parent_+_', '')
|
|
276
291
|
const propNameArr = propName.split('_+_')
|
|
277
292
|
propName = propNameArr[1]
|
|
278
|
-
|
|
293
|
+
if (pageContext && propName && propName.indexOf('${')>=0) {
|
|
294
|
+
leftValue = getPropValueNew(propName, pageContext, entity)
|
|
295
|
+
} else {
|
|
296
|
+
leftValue =getValue(parentFormData, propName, isSql)
|
|
297
|
+
}
|
|
298
|
+
// leftValue = getValue(parentFormData, propName, isSql)
|
|
279
299
|
} else {
|
|
280
|
-
|
|
300
|
+
if (pageContext && propName && propName.indexOf('${')>=0) {
|
|
301
|
+
leftValue = getPropValueNew(propName, pageContext, entity)
|
|
302
|
+
} else {
|
|
303
|
+
leftValue = getValue(entity, propName, isSql)
|
|
304
|
+
}
|
|
305
|
+
// leftValue = getValue(entity, propName, isSql)
|
|
281
306
|
}
|
|
282
307
|
if (propDbName && (leftValue === undefined || leftValue === null)) {
|
|
283
|
-
|
|
308
|
+
if (pageContext && propDbName && propDbName.indexOf('${')>=0) {
|
|
309
|
+
leftValue = getPropValueNew(propDbName, pageContext, entity)
|
|
310
|
+
} else {
|
|
311
|
+
leftValue = getValue(entity, propDbName, isSql)
|
|
312
|
+
}
|
|
313
|
+
// leftValue = getValue(entity, propDbName, isSql)
|
|
284
314
|
}
|
|
285
315
|
}
|
|
286
316
|
const operator = condition.operator
|
|
@@ -291,7 +321,7 @@ function parseCondition(
|
|
|
291
321
|
// 判断value类型
|
|
292
322
|
let value
|
|
293
323
|
if (pageContext) {
|
|
294
|
-
value = getPropValueNew(propValue, pageContext)
|
|
324
|
+
value = getPropValueNew(propValue, pageContext, entity)
|
|
295
325
|
} else {
|
|
296
326
|
value = getPropValue(propValue, entity, additionalParamMap, contextParameterMap)
|
|
297
327
|
}
|