vue2-client 1.8.258 → 1.8.261
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/package.json +1 -1
- package/src/base-client/components/common/LowCodeComponent/LowCodePageOrganization.vue +39 -37
- package/src/base-client/components/common/LowCodePageRender/editorPageRender.vue +3 -4
- package/src/base-client/components/common/XReport/XReportTrGroup.vue +3 -0
- package/src/base-client/components/common/XTree/XTree.vue +5 -7
- package/src/pages/lowCode/lowCodeEditor.vue +226 -245
- package/src/utils/lowcode/lowcodeUtils.js +31 -10
package/package.json
CHANGED
|
@@ -49,7 +49,6 @@
|
|
|
49
49
|
</template>
|
|
50
50
|
|
|
51
51
|
<script>
|
|
52
|
-
import { nanoid } from 'nanoid'
|
|
53
52
|
import * as lowcodeUtils from '@vue2-client/utils/lowcode/lowcodeUtils'
|
|
54
53
|
export default {
|
|
55
54
|
props: {
|
|
@@ -116,6 +115,7 @@ export default {
|
|
|
116
115
|
// 2. 高一级移动但不是新增
|
|
117
116
|
// 3. 高级组件移动到低级
|
|
118
117
|
// 4. 相差2级移动
|
|
118
|
+
// 唯一特例,行可以插入容器页面,容器页面等于模块级别,但可以被行插入
|
|
119
119
|
if (dragLevel === 'row') {
|
|
120
120
|
if (dropLevel === 'page' && dropPosition !== 0) {
|
|
121
121
|
this.$message.error('该移动不合法!')
|
|
@@ -163,7 +163,7 @@ export default {
|
|
|
163
163
|
onCancel () {},
|
|
164
164
|
})
|
|
165
165
|
} else if (targetType === 'page') {
|
|
166
|
-
const page = lowcodeUtils.
|
|
166
|
+
const page = lowcodeUtils.getPageConfigById(originalKey, this.config)
|
|
167
167
|
this.$confirm({
|
|
168
168
|
title: `确认删除此页面?`,
|
|
169
169
|
content: `所选页面:${page.title}[${lowcodeUtils.resolvePageType(page.type)}]`,
|
|
@@ -200,11 +200,11 @@ export default {
|
|
|
200
200
|
temp = lowcodeUtils.getConfig(originalKey, this.config)
|
|
201
201
|
}
|
|
202
202
|
// 复制
|
|
203
|
-
|
|
203
|
+
let copy = JSON.parse(JSON.stringify(temp))
|
|
204
204
|
console.warn('copy', copy)
|
|
205
205
|
if (targetType === 'page') {
|
|
206
206
|
// 重新修改id和title
|
|
207
|
-
copy.id = 'page_' +
|
|
207
|
+
copy.id = 'page_' + lowcodeUtils.nanoidWithoutSymbol(6)
|
|
208
208
|
copy.title = copy.title + '_副本'
|
|
209
209
|
// 复制页面自动粘贴
|
|
210
210
|
this.$emit('pasteItem', originalKey, copy, 'page')
|
|
@@ -214,15 +214,16 @@ export default {
|
|
|
214
214
|
const copyKeys = Object.keys(copy)
|
|
215
215
|
copyKeys.forEach(key => {
|
|
216
216
|
const prefix = copy[key].id.split('_')[0]
|
|
217
|
-
copy[key].id = prefix + '_' +
|
|
217
|
+
copy[key].id = prefix + '_' + lowcodeUtils.nanoidWithoutSymbol(6)
|
|
218
218
|
})
|
|
219
219
|
} else if (targetType === 'item') {
|
|
220
220
|
// 重新修改id
|
|
221
221
|
const prefix = copy.id.split('_')[0]
|
|
222
|
-
copy.id = prefix + '_' +
|
|
222
|
+
copy.id = prefix + '_' + lowcodeUtils.nanoidWithoutSymbol(6)
|
|
223
223
|
} else if (targetType === 'container_page') {
|
|
224
224
|
// 重新修改id
|
|
225
|
-
copy.id = 'container_' +
|
|
225
|
+
copy.id = 'container_' + lowcodeUtils.nanoidWithoutSymbol(6)
|
|
226
|
+
copy = lowcodeUtils.reRandomComponentId(copy)
|
|
226
227
|
}
|
|
227
228
|
this.copyCache = {
|
|
228
229
|
type: targetType,
|
|
@@ -272,37 +273,38 @@ export default {
|
|
|
272
273
|
},
|
|
273
274
|
// 处理架构树点击事件
|
|
274
275
|
handleTreeSelect (value) {
|
|
275
|
-
|
|
276
|
+
this.$emit('treeOrganizationClick', value[0])
|
|
276
277
|
// 如果选中的id只有两位证明是页面容器
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
}
|
|
278
|
+
// let isPage = false
|
|
279
|
+
// if (value[0].length === 2) {
|
|
280
|
+
// isPage = true
|
|
281
|
+
// }
|
|
282
|
+
// for (let i = 0; i < this.config.page.length; i++) {
|
|
283
|
+
// const pageTemp = this.config.page[i]
|
|
284
|
+
// if (isPage) {
|
|
285
|
+
// if (pageTemp.id === value[0]) {
|
|
286
|
+
// this.$emit('treeOrganizationClick', pageTemp.id, 'page')
|
|
287
|
+
// return
|
|
288
|
+
// } else {
|
|
289
|
+
// continue
|
|
290
|
+
// }
|
|
291
|
+
// }
|
|
292
|
+
// // 如果点击的是行,行的id就是页面id + _ + uuid
|
|
293
|
+
// if (pageTemp.id === value[0].split('_')[0]) {
|
|
294
|
+
// this.$emit('treeOrganizationClick', pageTemp.id, 'page')
|
|
295
|
+
// return
|
|
296
|
+
// }
|
|
297
|
+
// for (let j = 0; j < pageTemp.body.length; j++) {
|
|
298
|
+
// const rowTemp = pageTemp.body[j]
|
|
299
|
+
// for (let k = 0; k < rowTemp.length; k++) {
|
|
300
|
+
// const itemTemp = rowTemp[k]
|
|
301
|
+
// if (itemTemp.id === value[0]) {
|
|
302
|
+
// this.$emit('treeOrganizationClick', itemTemp.id, 'component')
|
|
303
|
+
// return
|
|
304
|
+
// }
|
|
305
|
+
// }
|
|
306
|
+
// }
|
|
307
|
+
// }
|
|
306
308
|
},
|
|
307
309
|
initTree (config, container = undefined) {
|
|
308
310
|
const result = []
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div>
|
|
2
|
+
<div style="width: 100%">
|
|
3
3
|
<template v-for="(page,pageIndex) in pageConfig.page">
|
|
4
4
|
<!-- 拖拽时显示宽度 -->
|
|
5
5
|
<template v-if="showDragSpan">
|
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
style="display: flex;align-items: center"
|
|
23
23
|
@click="clickComponentInEditor(item)">
|
|
24
24
|
<div :class="item.selected ? 'selected_container' : 'container'">
|
|
25
|
-
<h1>{{ item }}</h1>
|
|
26
25
|
<div>
|
|
27
26
|
<p style="font-size: 1.5em">宽度:{{ item.span }}</p>
|
|
28
27
|
</div>
|
|
@@ -32,7 +31,7 @@
|
|
|
32
31
|
</div>
|
|
33
32
|
<div
|
|
34
33
|
v-if="itemIndex !== row.length - 1"
|
|
35
|
-
style="width: 6px;font-size: 1em;color: rgb( 24,144,255)
|
|
34
|
+
style="width: 6px;font-size: 1em;color: rgb( 24,144,255)"
|
|
36
35
|
class="dragDiv"
|
|
37
36
|
@mousedown="dragStart($event, item.id, row)">
|
|
38
37
|
|| <br> ||
|
|
@@ -41,7 +40,7 @@
|
|
|
41
40
|
<!-- 递归显示页面容器 -->
|
|
42
41
|
<div
|
|
43
42
|
v-else-if="item.type === 'container_page'"
|
|
44
|
-
style="display: flex;align-items: center
|
|
43
|
+
style="display: flex;align-items: center">
|
|
45
44
|
<editor-page-render
|
|
46
45
|
v-if="renderSub"
|
|
47
46
|
@spanDrag="handleDrag"
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { getConfigByName, runLogic } from '@vue2-client/services/api/common'
|
|
3
|
-
import {
|
|
3
|
+
import { reactive, ref, watch, defineExpose } from 'vue'
|
|
4
4
|
import executeStrFunction from '@vue2-client/utils/runEvalFunction'
|
|
5
|
-
import store from '@vue2-client/store/modules/account'
|
|
6
5
|
import debounce from 'lodash.debounce'
|
|
7
6
|
|
|
8
7
|
const config = reactive({})
|
|
@@ -18,8 +17,6 @@ const filteredTreeData = ref([])
|
|
|
18
17
|
const deepestNodes = ref([])
|
|
19
18
|
// 替换字段
|
|
20
19
|
let _replaceFields = reactive({ children: 'children', title: 'title', key: 'key' })
|
|
21
|
-
// 当前用户信息
|
|
22
|
-
const currentUser = computed(() => store.state.user)
|
|
23
20
|
// 暂存查询信息
|
|
24
21
|
const searchInfo = ref({})
|
|
25
22
|
const props = defineProps({
|
|
@@ -91,10 +88,11 @@ function onSelect (keys, e) {
|
|
|
91
88
|
|
|
92
89
|
async function getData (param = {}) {
|
|
93
90
|
spinning.value = true
|
|
91
|
+
const currentUser = JSON.parse(localStorage.getItem(process.env.VUE_APP_USER_KEY))
|
|
94
92
|
searchInfo.value = Object.assign(param, {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
93
|
+
orgId: currentUser.orgid,
|
|
94
|
+
userId: currentUser.id,
|
|
95
|
+
depId: currentUser.f_department_id
|
|
98
96
|
})
|
|
99
97
|
await runLogic(config.treeData.substring(6), searchInfo.value, config.serviceName, props.env === 'dev').then(res => {
|
|
100
98
|
_treeData.value = res
|
|
@@ -532,7 +532,6 @@ import editorPageRender from '@vue2-client/base-client/components/common/LowCode
|
|
|
532
532
|
import * as registeredRender from '@vue2-client/utils/lowcode/registerComponentForRender'
|
|
533
533
|
import * as lowcodeUtils from '@vue2-client/utils/lowcode/lowcodeUtils'
|
|
534
534
|
import codeMirror from '@vue2-client/components/CodeMirror/inedx.vue'
|
|
535
|
-
import { nanoid } from 'nanoid'
|
|
536
535
|
import lowcodeComponentMixin from '@vue2-client/utils/lowcode/lowcodeComponentMixin'
|
|
537
536
|
// eslint-disable-next-line no-unused-vars
|
|
538
537
|
import lowcodeLog from '@vue2-client/utils/lowcode/lowcodeLog'
|
|
@@ -634,7 +633,7 @@ export default {
|
|
|
634
633
|
// 添加页面容器弹框确认
|
|
635
634
|
handleAddPageContainerModalOk () {
|
|
636
635
|
const result = {
|
|
637
|
-
id: 'page_' +
|
|
636
|
+
id: 'page_' + lowcodeUtils.nanoidWithoutSymbol(6),
|
|
638
637
|
type: this.addComponentTemp.type,
|
|
639
638
|
title: this.addComponentTemp.title,
|
|
640
639
|
width: this.addComponentTemp.width,
|
|
@@ -713,35 +712,34 @@ export default {
|
|
|
713
712
|
this.$forceUpdate()
|
|
714
713
|
},
|
|
715
714
|
// 点击架构树
|
|
716
|
-
treeOrganizationClick (id
|
|
715
|
+
treeOrganizationClick (id) {
|
|
717
716
|
// 如果类型是page证明,选中的是最外层容器
|
|
718
|
-
if (type === 'page') {
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
} else if (type === 'component') {
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
}
|
|
717
|
+
// if (type === 'page') {
|
|
718
|
+
// this.mainPageMenu[0] = id
|
|
719
|
+
// this.activeMainPage = id
|
|
720
|
+
// for (let i = 0; i < this.config.page.length; i++) {
|
|
721
|
+
// if (this.config.page[i].id === this.activeMainPage) {
|
|
722
|
+
// this.activeMainPageType = this.config.page[i].type
|
|
723
|
+
// break
|
|
724
|
+
// }
|
|
725
|
+
// }
|
|
726
|
+
// this.$forceUpdate()
|
|
727
|
+
// } else if (type === 'component') {
|
|
728
|
+
// this.config.page.forEach(page => {
|
|
729
|
+
// page.body.forEach(row => {
|
|
730
|
+
// row.forEach(item => {
|
|
731
|
+
// if (item.id === id) {
|
|
732
|
+
// this.mainPageMenu[0] = page.id
|
|
733
|
+
// this.activeMainPage = page.id
|
|
734
|
+
// this.activeMainPageType = page.type
|
|
735
|
+
// this.$forceUpdate()
|
|
736
|
+
// }
|
|
737
|
+
// })
|
|
738
|
+
// })
|
|
739
|
+
// })
|
|
740
|
+
// 将组件选中
|
|
741
|
+
const target = lowcodeUtils.getComponentConfig(id, this.config)
|
|
742
|
+
this.clickComponentInEditor(target)
|
|
745
743
|
},
|
|
746
744
|
// 架构树拖拽事件
|
|
747
745
|
handleTreeDrag (dragKey, dropKey, dropLevel, dropPosition) {
|
|
@@ -861,7 +859,8 @@ export default {
|
|
|
861
859
|
// 删除组件
|
|
862
860
|
deleteComponentInTree (id, type) {
|
|
863
861
|
if (type === 'page') {
|
|
864
|
-
|
|
862
|
+
const page = lowcodeUtils.getPageConfigById(id, this.config)
|
|
863
|
+
this.deletePage(page)
|
|
865
864
|
} else if (type === 'component') {
|
|
866
865
|
this.deleteComponent(id)
|
|
867
866
|
} else if (type === 'row') {
|
|
@@ -891,18 +890,23 @@ export default {
|
|
|
891
890
|
this.refreshOrganization()
|
|
892
891
|
},
|
|
893
892
|
// 删除页面容器
|
|
894
|
-
deletePage (
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
893
|
+
deletePage (page) {
|
|
894
|
+
console.warn('123', page)
|
|
895
|
+
page.body.forEach(row => {
|
|
896
|
+
row.forEach(item => {
|
|
897
|
+
if (item.type === 'container_page') {
|
|
898
|
+
this.deletePage(item.page)
|
|
899
|
+
} else {
|
|
900
900
|
delete this.$children[0]._provided.componentsMap[item.id]
|
|
901
|
-
}
|
|
901
|
+
}
|
|
902
|
+
})
|
|
903
|
+
})
|
|
904
|
+
for (let i = 0; i < this.config.page.length; i++) {
|
|
905
|
+
if (this.config.page[i].id === page.id) {
|
|
906
|
+
this.config.page.splice(i, 1)
|
|
902
907
|
this.targetContainer = undefined
|
|
903
908
|
this.editorPropertiesConfig = {}
|
|
904
909
|
this.refreshOrganization()
|
|
905
|
-
this.config.page.splice(i, 1)
|
|
906
910
|
return
|
|
907
911
|
}
|
|
908
912
|
}
|
|
@@ -989,42 +993,20 @@ export default {
|
|
|
989
993
|
},
|
|
990
994
|
// 容器删除
|
|
991
995
|
handleContainerDelete (id) {
|
|
992
|
-
let
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
for (let k = 0; k < row.length; k++) {
|
|
1000
|
-
const item = row[k]
|
|
1001
|
-
if (item.id === id) {
|
|
1002
|
-
target = this.config.page[i]
|
|
1003
|
-
// eslint-disable-next-line no-unused-vars
|
|
1004
|
-
pageIndex = i
|
|
1005
|
-
}
|
|
1006
|
-
}
|
|
1007
|
-
}
|
|
1008
|
-
}
|
|
1009
|
-
// 找到该page下对应的item
|
|
1010
|
-
let targetIndex
|
|
1011
|
-
let rowIndex
|
|
1012
|
-
for (let i = 0; i < target.body.length; i++) {
|
|
1013
|
-
const row = target.body[i]
|
|
1014
|
-
for (let j = 0; j < row.length; j++) {
|
|
1015
|
-
const item = row[j]
|
|
1016
|
-
if (item.id === id) {
|
|
1017
|
-
targetIndex = j
|
|
1018
|
-
rowIndex = i
|
|
1019
|
-
break
|
|
1020
|
-
}
|
|
996
|
+
let index
|
|
997
|
+
const row = lowcodeUtils.getRowConfigByComponentId(id, this.config)
|
|
998
|
+
for (let i = 0; i < row.length; i++) {
|
|
999
|
+
const item = row[i]
|
|
1000
|
+
if (item.id === id) {
|
|
1001
|
+
index = i
|
|
1002
|
+
break
|
|
1021
1003
|
}
|
|
1022
1004
|
}
|
|
1023
|
-
|
|
1005
|
+
row.splice(index, 1)
|
|
1024
1006
|
this.targetContainer = undefined
|
|
1025
1007
|
// 如果删除后只剩一个容器,将该容器span设置为24
|
|
1026
|
-
if (
|
|
1027
|
-
|
|
1008
|
+
if (row.length === 1) {
|
|
1009
|
+
row[0].span = 24
|
|
1028
1010
|
}
|
|
1029
1011
|
this.refreshOrganization()
|
|
1030
1012
|
},
|
|
@@ -1114,23 +1096,7 @@ export default {
|
|
|
1114
1096
|
addComponentToContainer (type) {
|
|
1115
1097
|
// 如果没有选中容器
|
|
1116
1098
|
if (!this.targetContainer) {
|
|
1117
|
-
|
|
1118
|
-
if (this.config.page.length === 0) {
|
|
1119
|
-
this.config.page.push({
|
|
1120
|
-
id: 'page_' + nanoid(6),
|
|
1121
|
-
type: 'page',
|
|
1122
|
-
body: [
|
|
1123
|
-
{
|
|
1124
|
-
span: 24,
|
|
1125
|
-
type: type,
|
|
1126
|
-
id: type + '_' + nanoid(6),
|
|
1127
|
-
}
|
|
1128
|
-
]
|
|
1129
|
-
})
|
|
1130
|
-
this.refreshOrganization()
|
|
1131
|
-
} else {
|
|
1132
|
-
this.$message.error('如需多个组件请先添加组件容器!')
|
|
1133
|
-
}
|
|
1099
|
+
this.$message.error('请先选择目标容器!')
|
|
1134
1100
|
this.targetContainer = undefined
|
|
1135
1101
|
return
|
|
1136
1102
|
}
|
|
@@ -1138,7 +1104,7 @@ export default {
|
|
|
1138
1104
|
const target = lowcodeUtils.getComponentConfig(this.targetContainer.id, this.config.page)
|
|
1139
1105
|
// 将容器的类型和id改变
|
|
1140
1106
|
target.type = type
|
|
1141
|
-
target.id = target.type + '_' +
|
|
1107
|
+
target.id = target.type + '_' + lowcodeUtils.nanoidWithoutSymbol(6)
|
|
1142
1108
|
this.targetContainer = undefined
|
|
1143
1109
|
this.refreshOrganization()
|
|
1144
1110
|
},
|
|
@@ -1163,21 +1129,36 @@ export default {
|
|
|
1163
1129
|
if (this.config.page[targetIndex].type === 'page') {
|
|
1164
1130
|
this.config.page[targetIndex].body.push([
|
|
1165
1131
|
{
|
|
1166
|
-
type: '
|
|
1167
|
-
span:
|
|
1168
|
-
id: 'container_' +
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1132
|
+
type: 'container_page',
|
|
1133
|
+
span: 24,
|
|
1134
|
+
id: 'container_' + lowcodeUtils.nanoidWithoutSymbol(6),
|
|
1135
|
+
page: [
|
|
1136
|
+
{
|
|
1137
|
+
id: 'container_page_' + lowcodeUtils.nanoidWithoutSymbol(6),
|
|
1138
|
+
type: 'page',
|
|
1139
|
+
body: [
|
|
1140
|
+
[
|
|
1141
|
+
{
|
|
1142
|
+
type: 'container',
|
|
1143
|
+
span: 12,
|
|
1144
|
+
id: 'container_' + lowcodeUtils.nanoidWithoutSymbol(6)
|
|
1145
|
+
},
|
|
1146
|
+
{
|
|
1147
|
+
type: 'container',
|
|
1148
|
+
span: 12,
|
|
1149
|
+
id: 'container_' + lowcodeUtils.nanoidWithoutSymbol(6)
|
|
1150
|
+
},
|
|
1151
|
+
]
|
|
1152
|
+
]
|
|
1153
|
+
}
|
|
1154
|
+
]
|
|
1174
1155
|
}
|
|
1175
1156
|
])
|
|
1176
1157
|
} else {
|
|
1177
1158
|
this.config.page[targetIndex].body.push([{
|
|
1178
1159
|
type: 'container',
|
|
1179
1160
|
span: 24,
|
|
1180
|
-
id: 'container_' +
|
|
1161
|
+
id: 'container_' + lowcodeUtils.nanoidWithoutSymbol(6)
|
|
1181
1162
|
}])
|
|
1182
1163
|
}
|
|
1183
1164
|
} else {
|
|
@@ -1194,11 +1175,11 @@ export default {
|
|
|
1194
1175
|
row.splice(targetInRowIndex, 1, {
|
|
1195
1176
|
type: 'container',
|
|
1196
1177
|
span: Math.floor(maxWidth / 2),
|
|
1197
|
-
id: 'container_' +
|
|
1178
|
+
id: 'container_' + lowcodeUtils.nanoidWithoutSymbol(6)
|
|
1198
1179
|
}, {
|
|
1199
1180
|
type: 'container',
|
|
1200
1181
|
span: Math.ceil(maxWidth / 2),
|
|
1201
|
-
id: 'container_' +
|
|
1182
|
+
id: 'container_' + lowcodeUtils.nanoidWithoutSymbol(6)
|
|
1202
1183
|
})
|
|
1203
1184
|
this.targetContainer = undefined
|
|
1204
1185
|
this.refreshOrganization()
|
|
@@ -1206,18 +1187,18 @@ export default {
|
|
|
1206
1187
|
onCancel: () => {
|
|
1207
1188
|
targetItem.type = 'container_page'
|
|
1208
1189
|
targetItem.page = [{
|
|
1209
|
-
id: 'container_page_' +
|
|
1190
|
+
id: 'container_page_' + lowcodeUtils.nanoidWithoutSymbol(6),
|
|
1210
1191
|
type: 'page',
|
|
1211
1192
|
body: [
|
|
1212
1193
|
[{
|
|
1213
1194
|
type: 'container',
|
|
1214
1195
|
span: 24,
|
|
1215
|
-
id: 'container_' +
|
|
1196
|
+
id: 'container_' + lowcodeUtils.nanoidWithoutSymbol(6)
|
|
1216
1197
|
}],
|
|
1217
1198
|
[{
|
|
1218
1199
|
type: 'container',
|
|
1219
1200
|
span: 24,
|
|
1220
|
-
id: 'container_' +
|
|
1201
|
+
id: 'container_' + lowcodeUtils.nanoidWithoutSymbol(6)
|
|
1221
1202
|
}]
|
|
1222
1203
|
]
|
|
1223
1204
|
}]
|
|
@@ -1349,148 +1330,148 @@ export default {
|
|
|
1349
1330
|
this.supportedEventType = [...lowcodeComponentMixin.supportedEventType]
|
|
1350
1331
|
// 深拷贝外侧传来的配置
|
|
1351
1332
|
this.config = JSON.parse(JSON.stringify(this.originalConfig))
|
|
1352
|
-
this.config = {
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
}
|
|
1333
|
+
// this.config = {
|
|
1334
|
+
// page: [
|
|
1335
|
+
// {
|
|
1336
|
+
// id: 'page_KBjw2i',
|
|
1337
|
+
// type: 'page',
|
|
1338
|
+
// title: '111',
|
|
1339
|
+
// body: [
|
|
1340
|
+
// [
|
|
1341
|
+
// {
|
|
1342
|
+
// type: 'XFormTable',
|
|
1343
|
+
// span: 12,
|
|
1344
|
+
// id: 'XFormTable_BV6Nwk',
|
|
1345
|
+
// selected: false,
|
|
1346
|
+
// props: {
|
|
1347
|
+
// queryParamsName: '',
|
|
1348
|
+
// serviceName: ''
|
|
1349
|
+
// },
|
|
1350
|
+
// selfEvent: [
|
|
1351
|
+
// 'action'
|
|
1352
|
+
// ]
|
|
1353
|
+
// },
|
|
1354
|
+
// {
|
|
1355
|
+
// type: 'XAddNativeForm',
|
|
1356
|
+
// span: 12,
|
|
1357
|
+
// id: 'XAddNativeForm_ekihTp',
|
|
1358
|
+
// selected: false,
|
|
1359
|
+
// props: {
|
|
1360
|
+
// configNameForLowCode: '',
|
|
1361
|
+
// systemNameForLowCode: ''
|
|
1362
|
+
// },
|
|
1363
|
+
// selfEvent: [
|
|
1364
|
+
// 'onSubmit'
|
|
1365
|
+
// ]
|
|
1366
|
+
// }
|
|
1367
|
+
// ],
|
|
1368
|
+
// [
|
|
1369
|
+
// {
|
|
1370
|
+
// type: 'XTreeOne',
|
|
1371
|
+
// span: 12,
|
|
1372
|
+
// id: 'XTreeOne_szu7Al',
|
|
1373
|
+
// selected: false
|
|
1374
|
+
// },
|
|
1375
|
+
// {
|
|
1376
|
+
// type: 'XDescriptions',
|
|
1377
|
+
// span: 12,
|
|
1378
|
+
// id: 'XDescriptions_DTkbEg',
|
|
1379
|
+
// selected: false,
|
|
1380
|
+
// props: {
|
|
1381
|
+
// title: '111',
|
|
1382
|
+
// content: {
|
|
1383
|
+
// c_f_user_phone: '2323',
|
|
1384
|
+
// c_f_total_fee: 33356,
|
|
1385
|
+
// c_f_address: '22',
|
|
1386
|
+
// c_f_meterlen: 2,
|
|
1387
|
+
// c_f_bank_card_number: '23',
|
|
1388
|
+
// c_f_create_user: '超级管理员',
|
|
1389
|
+
// c_f_customer: '23',
|
|
1390
|
+
// c_f_balance: 33356,
|
|
1391
|
+
// c_f_create_date: '2024-06-23 21:31:24',
|
|
1392
|
+
// c_f_operator_date: '2024-06-23 21:31:24',
|
|
1393
|
+
// c_f_total_times: 2,
|
|
1394
|
+
// c_f_user_name: '23',
|
|
1395
|
+
// c_f_comments: '323',
|
|
1396
|
+
// c_id: 39,
|
|
1397
|
+
// c_f_operatorid: '15',
|
|
1398
|
+
// c_f_operator: '超级管理员',
|
|
1399
|
+
// c_f_orgid: '9'
|
|
1400
|
+
// },
|
|
1401
|
+
// configName: 'Unit_Desc_Config',
|
|
1402
|
+
// serviceName: 'af-revenue',
|
|
1403
|
+
// getRealData: true
|
|
1404
|
+
// },
|
|
1405
|
+
// selfEvent: []
|
|
1406
|
+
// }
|
|
1407
|
+
// ]
|
|
1408
|
+
// ]
|
|
1409
|
+
// },
|
|
1410
|
+
// {
|
|
1411
|
+
// id: 'page_FgItf6',
|
|
1412
|
+
// type: 'page',
|
|
1413
|
+
// title: '22',
|
|
1414
|
+
// body: [
|
|
1415
|
+
// [
|
|
1416
|
+
// {
|
|
1417
|
+
// type: 'container',
|
|
1418
|
+
// span: 4,
|
|
1419
|
+
// id: 'container_ir2gR2',
|
|
1420
|
+
// selected: false
|
|
1421
|
+
// },
|
|
1422
|
+
// {
|
|
1423
|
+
// type: 'container_page',
|
|
1424
|
+
// span: 10,
|
|
1425
|
+
// id: 'container_xIRHGg',
|
|
1426
|
+
// selected: true,
|
|
1427
|
+
// page: [
|
|
1428
|
+
// {
|
|
1429
|
+
// id: 'container_page_IgYw9u',
|
|
1430
|
+
// type: 'page',
|
|
1431
|
+
// body: [
|
|
1432
|
+
// [
|
|
1433
|
+
// {
|
|
1434
|
+
// type: 'container',
|
|
1435
|
+
// span: 24,
|
|
1436
|
+
// id: 'container_tqVFCL'
|
|
1437
|
+
// }
|
|
1438
|
+
// ],
|
|
1439
|
+
// [
|
|
1440
|
+
// {
|
|
1441
|
+
// type: 'container',
|
|
1442
|
+
// span: 24,
|
|
1443
|
+
// id: 'container_i8VXCZ'
|
|
1444
|
+
// }
|
|
1445
|
+
// ]
|
|
1446
|
+
// ]
|
|
1447
|
+
// }
|
|
1448
|
+
// ]
|
|
1449
|
+
// },
|
|
1450
|
+
// {
|
|
1451
|
+
// type: 'container',
|
|
1452
|
+
// span: 10,
|
|
1453
|
+
// id: 'container_PT9n3Q',
|
|
1454
|
+
// selected: false
|
|
1455
|
+
// }
|
|
1456
|
+
// ],
|
|
1457
|
+
// [
|
|
1458
|
+
// {
|
|
1459
|
+
// type: 'container',
|
|
1460
|
+
// span: 18,
|
|
1461
|
+
// id: 'container_q04vQr',
|
|
1462
|
+
// selected: false
|
|
1463
|
+
// },
|
|
1464
|
+
// {
|
|
1465
|
+
// type: 'container',
|
|
1466
|
+
// span: 6,
|
|
1467
|
+
// id: 'container_MKwNvz',
|
|
1468
|
+
// selected: false
|
|
1469
|
+
// }
|
|
1470
|
+
// ]
|
|
1471
|
+
// ]
|
|
1472
|
+
// }
|
|
1473
|
+
// ]
|
|
1474
|
+
// }
|
|
1494
1475
|
this.refreshOrganization()
|
|
1495
1476
|
}
|
|
1496
1477
|
}
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
// eslint-disable-next-line no-unused-vars
|
|
2
2
|
import * as registeredConfig from './registerComponentForEditor'
|
|
3
|
+
import { nanoid } from 'nanoid'
|
|
4
|
+
|
|
5
|
+
// 随机id去除特定字符
|
|
6
|
+
export function nanoidWithoutSymbol (size, without = '_') {
|
|
7
|
+
let result = nanoid(size)
|
|
8
|
+
while (result.includes(without)) {
|
|
9
|
+
result = nanoid(size)
|
|
10
|
+
}
|
|
11
|
+
return result
|
|
12
|
+
}
|
|
3
13
|
|
|
4
14
|
// 根据id获取组件定义的配置(在ForEditor中注册的配置)
|
|
5
15
|
export function getEditorConfigById (componentId, config) {
|
|
@@ -77,16 +87,6 @@ export function resolvePageType (type) {
|
|
|
77
87
|
}
|
|
78
88
|
}
|
|
79
89
|
|
|
80
|
-
// 根据页面容器id获取页面容器配置
|
|
81
|
-
export function getPageByPageID (id, config) {
|
|
82
|
-
for (let i = 0; i < config.page.length; i++) {
|
|
83
|
-
const page = config.page[i]
|
|
84
|
-
if (page.id === id) {
|
|
85
|
-
return page
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
90
|
// 根据id获取配置
|
|
91
91
|
export function getComponentConfig (componentId, config) {
|
|
92
92
|
if (config.page) {
|
|
@@ -253,3 +253,24 @@ export function getComponentNameById (id, config) {
|
|
|
253
253
|
return targetConfig.id
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
|
+
|
|
257
|
+
// 重新随机容器下所有子项目的ID
|
|
258
|
+
export function reRandomComponentId (config) {
|
|
259
|
+
config.page.forEach(page => {
|
|
260
|
+
const pagePrefix = getIdPrefix(page.id)
|
|
261
|
+
page.id = pagePrefix + '_' + nanoidWithoutSymbol(2)
|
|
262
|
+
page.body.forEach(row => {
|
|
263
|
+
row.forEach(item => {
|
|
264
|
+
const itemPrefix = getIdPrefix(item.id)
|
|
265
|
+
item.id = itemPrefix + '_' + nanoidWithoutSymbol(6)
|
|
266
|
+
})
|
|
267
|
+
})
|
|
268
|
+
})
|
|
269
|
+
return config
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// 获取id前传
|
|
273
|
+
export function getIdPrefix (id) {
|
|
274
|
+
const lastIndex = id.lastIndexOf('_')
|
|
275
|
+
return id.substring(0, lastIndex)
|
|
276
|
+
}
|