vue2-client 1.8.267 → 1.8.269

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-client",
3
- "version": "1.8.267",
3
+ "version": "1.8.269",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -22,7 +22,12 @@
22
22
  <a-menu-divider />
23
23
  <a-menu-item key="split" :disabled="determineLevel(treeKey) !== 'item'"><a-icon type="fullscreen" />&nbsp;&nbsp;拆分</a-menu-item>
24
24
  <a-menu-item key="add" :disabled="determineLevel(treeKey) === 'item'"><a-icon type="plus-square" />&nbsp;&nbsp;添加</a-menu-item>
25
- <a-menu-item key="rename" :disabled="treeKey.length > 2 && treeKey.length <= 5"><a-icon type="italic" />&nbsp;&nbsp;重命名</a-menu-item>
25
+ <a-menu-item key="rename" :disabled="determineLevel(treeKey) !== 'item' && determineLevel(treeKey) !== 'page'"><a-icon type="italic" />&nbsp;&nbsp;重命名</a-menu-item>
26
+ <!-- <a-menu-divider />-->
27
+ <!-- <a-sub-menu title="添加组件">-->
28
+ <!-- <a-menu-item key="addComponent_111">111</a-menu-item>-->
29
+ <!-- <a-menu-item key="addComponent_222">222</a-menu-item>-->
30
+ <!-- </a-sub-menu>-->
26
31
  <a-menu-divider />
27
32
  <a-menu-item key="delete"><a-icon type="delete" />&nbsp;&nbsp;删除</a-menu-item>
28
33
  </a-menu>
@@ -62,6 +67,7 @@ export default {
62
67
  type: Object,
63
68
  required: true,
64
69
  },
70
+ // 可以由外侧控制哪个节点被选中
65
71
  selectTreeNode: {
66
72
  type: String,
67
73
  default: undefined
@@ -86,6 +92,7 @@ export default {
86
92
  return 'item'
87
93
  }
88
94
  },
95
+ // 将树中的key转换回原始ID
89
96
  getOriginalKey (treeKey) {
90
97
  if (treeKey.startsWith('page')) {
91
98
  return treeKey.substring('page_'.length)
@@ -97,6 +104,7 @@ export default {
97
104
  return treeKey
98
105
  }
99
106
  },
107
+ // 根据ID,返回拖拽级别和类型,便于拖拽模式判断
100
108
  determineDragLevel (id) {
101
109
  if (id.startsWith('page')) {
102
110
  return {
@@ -172,6 +180,7 @@ export default {
172
180
  // 能到这不return的证明都是非法移动
173
181
  this.$message.error('不合法的拖拽!')
174
182
  },
183
+ // 删除
175
184
  handleDelete (targetType, originalKey) {
176
185
  const _this = this
177
186
  if (targetType === 'item') {
@@ -213,8 +222,10 @@ export default {
213
222
  })
214
223
  }
215
224
  },
225
+ // 复制
216
226
  handleCopy (treeKey, targetType) {
217
227
  const originalKey = this.getOriginalKey(treeKey)
228
+ // 获取复制对象
218
229
  let temp
219
230
  if (targetType === 'container_page') {
220
231
  temp = lowcodeUtils.getContainerPageOuterByContainerPageId(originalKey, this.config)
@@ -223,7 +234,6 @@ export default {
223
234
  }
224
235
  // 复制
225
236
  let copy = JSON.parse(JSON.stringify(temp))
226
- console.warn('copy', copy)
227
237
  if (targetType === 'page') {
228
238
  // 重新修改id和title
229
239
  copy.id = 'page_' + lowcodeUtils.nanoidWithoutSymbol(6)
@@ -254,6 +264,7 @@ export default {
254
264
  this.$message.success('复制成功!')
255
265
  }
256
266
  },
267
+ // 粘贴
257
268
  handlePaste (targetType, originalKey) {
258
269
  // 同级别内容不能粘贴到另一个中
259
270
  if (targetType === this.copyCache.type) {
@@ -280,7 +291,8 @@ export default {
280
291
  // 其余操作均不合法
281
292
  this.$message.error('该操作不合法!')
282
293
  },
283
- handleRename (originalKey) {
294
+ // 重命名
295
+ handleRename (targetType, originalKey) {
284
296
  const target = lowcodeUtils.getConfig(originalKey, this.config)
285
297
  this.renameId = target.id
286
298
  if (target.title) {
@@ -292,6 +304,7 @@ export default {
292
304
  }
293
305
  this.showRenameModal = true
294
306
  },
307
+ // 拆分
295
308
  handleSplit (originalKey) {
296
309
  const _this = this
297
310
  this.$confirm({
@@ -304,6 +317,7 @@ export default {
304
317
  },
305
318
  })
306
319
  },
320
+ // 添加
307
321
  handleAdd (targetType, originalKey) {
308
322
  if (targetType === 'page' || targetType === 'container_page') {
309
323
  this.$emit('add', originalKey, 'row')
@@ -328,7 +342,7 @@ export default {
328
342
  this.handlePaste(targetType, originalKey)
329
343
  return
330
344
  case 'rename':
331
- this.handleRename(originalKey)
345
+ this.handleRename(targetType, originalKey)
332
346
  return
333
347
  case 'split':
334
348
  this.handleSplit(originalKey)
@@ -340,39 +354,18 @@ export default {
340
354
  // 处理架构树点击事件
341
355
  handleTreeSelect (value) {
342
356
  this.selectedKeys = value
357
+ // 如果是反选
358
+ if (value.length === 0) {
359
+ this.$emit('treeOrganizationClick', null)
360
+ return
361
+ }
362
+ const type = this.determineLevel(value[0])
363
+ if (type === 'row' || type === 'page') {
364
+ return
365
+ }
343
366
  this.$emit('treeOrganizationClick', this.getOriginalKey(value[0]))
344
- // 如果选中的id只有两位证明是页面容器
345
- // let isPage = false
346
- // if (value[0].length === 2) {
347
- // isPage = true
348
- // }
349
- // for (let i = 0; i < this.config.page.length; i++) {
350
- // const pageTemp = this.config.page[i]
351
- // if (isPage) {
352
- // if (pageTemp.id === value[0]) {
353
- // this.$emit('treeOrganizationClick', pageTemp.id, 'page')
354
- // return
355
- // } else {
356
- // continue
357
- // }
358
- // }
359
- // // 如果点击的是行,行的id就是页面id + _ + uuid
360
- // if (pageTemp.id === value[0].split('_')[0]) {
361
- // this.$emit('treeOrganizationClick', pageTemp.id, 'page')
362
- // return
363
- // }
364
- // for (let j = 0; j < pageTemp.body.length; j++) {
365
- // const rowTemp = pageTemp.body[j]
366
- // for (let k = 0; k < rowTemp.length; k++) {
367
- // const itemTemp = rowTemp[k]
368
- // if (itemTemp.id === value[0]) {
369
- // this.$emit('treeOrganizationClick', itemTemp.id, 'component')
370
- // return
371
- // }
372
- // }
373
- // }
374
- // }
375
367
  },
368
+ // 初始化树
376
369
  initTree (config, container = undefined) {
377
370
  const result = []
378
371
  // 从配置中,抽取组件,初始化成树的格式
@@ -417,17 +410,31 @@ export default {
417
410
  } else {
418
411
  name = item.id
419
412
  }
413
+ // 如果item进行了嵌套,递归调用
420
414
  if (item.type === 'container_page') {
421
415
  this.initTree(item, result[i].children[j])
422
416
  } else {
423
- result[i].children[j].children.push({
424
- title: name,
425
- key: item.id,
426
- children: [],
427
- slots: {
428
- icon: 'appstore',
429
- },
430
- })
417
+ // 如果是container则显示为列容器
418
+ if (item.type === 'container') {
419
+ name = '列容器'
420
+ result[i].children[j].children.push({
421
+ title: name,
422
+ key: item.id,
423
+ children: [],
424
+ slots: {
425
+ icon: 'pause',
426
+ },
427
+ })
428
+ } else {
429
+ result[i].children[j].children.push({
430
+ title: name,
431
+ key: item.id,
432
+ children: [],
433
+ slots: {
434
+ icon: 'appstore',
435
+ },
436
+ })
437
+ }
431
438
  }
432
439
  }
433
440
  }
@@ -445,20 +452,30 @@ export default {
445
452
  },
446
453
  data () {
447
454
  return {
455
+ // 树的数据
448
456
  treeData: [],
457
+ // 控制树的渲染
449
458
  showTree: false,
459
+ // 控制重命名弹框显隐
450
460
  showRenameModal: false,
461
+ // 复制的缓存
451
462
  copyCache: undefined,
463
+ // 重命名绑定变量
452
464
  pageNewName: undefined,
465
+ // 重命名对象的id
453
466
  renameId: undefined,
467
+ // 在树中已选中的key
454
468
  selectedKeys: []
455
469
  }
456
470
  },
457
471
  watch: {
472
+ // 如果外侧指定了某个节点,让树选中该节点
458
473
  selectTreeNode: {
459
474
  handler (newVal) {
460
475
  if (newVal) {
461
476
  this.selectedKeys = [newVal]
477
+ } else {
478
+ this.selectedKeys = []
462
479
  }
463
480
  }
464
481
  }
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div style="width: 100%">
3
3
  <template v-for="(page,pageIndex) in pageConfig.page">
4
- <!-- 拖拽时显示宽度 -->
4
+ <!-- 拖拽时显示的临时容器 -->
5
5
  <template v-if="showDragSpan">
6
6
  <div style="display: flex" :key="pageIndex">
7
7
  <template v-for="item in dragConfig">
@@ -11,6 +11,7 @@
11
11
  </template>
12
12
  </div>
13
13
  </template>
14
+ <!-- 渲染器主体 -->
14
15
  <template v-for="(row,rowIndex) in page.body">
15
16
  <a-row :key="pageIndex + '_' + rowIndex">
16
17
  <template v-if="!showDragSpan">
@@ -171,6 +172,7 @@ export default {
171
172
  drawVisible: {},
172
173
  // 控制递归渲染
173
174
  renderSub: true,
175
+ // 用于控制组件外框闪烁
174
176
  colClassName: ''
175
177
  }
176
178
  },
@@ -188,6 +190,7 @@ export default {
188
190
  })
189
191
  },
190
192
  methods: {
193
+ // 将钩子函数格式化成mixin的格式并传入
191
194
  resolveLifeCycleEvent (config) {
192
195
  if (!config.onEvent || !config.onEvent.lifeCycle) {
193
196
  return undefined
@@ -212,22 +215,26 @@ export default {
212
215
  }
213
216
  this.$forceUpdate()
214
217
  },
218
+ // 递归拖拽完成后的回调
215
219
  handleDrag (targetEle, nextEle) {
216
220
  this.$emit('spanDrag', targetEle, nextEle)
217
221
  },
222
+ // 递归容器删除后的回调
218
223
  handleContainerDelete (id) {
219
224
  this.$emit('containerDelete', id)
220
225
  },
226
+ // 刷新递归的渲染器
221
227
  refreshSubRender () {
222
228
  this.renderSub = false
223
229
  this.$nextTick(() => {
224
230
  this.renderSub = true
225
231
  })
226
232
  },
233
+ // 递归点击组件后的回调
227
234
  clickComponentInner (configItem) {
228
235
  this.$emit('clickComponentInEditor', configItem, this)
229
236
  },
230
- // 开始拖拽
237
+ // 拖拽改变Span
231
238
  dragStart (event, id, row) {
232
239
  // 获取目标html元素
233
240
  const targetElement = event.srcElement
@@ -439,6 +446,7 @@ export default {
439
446
  runLogic(eachEvent.logicName, param, eachEvent.serviceName)
440
447
  .then(res => { logicCallBackFunction(this.componentsMap, res) })
441
448
  } else if (eachEvent.eventType === 'changeProps') {
449
+ // 修改组件props
442
450
  const targetConfig = lowcodeUtils.getComponentConfig(eachEvent.target, this.pageConfig.page)
443
451
  targetConfig.props[eachEvent.targetKey] = data
444
452
  lowcodeLog(
@@ -448,8 +456,8 @@ export default {
448
456
  false,
449
457
  true
450
458
  )
451
- // 打印日志
452
459
  } else if (eachEvent.eventType === 'log') {
460
+ // 打印日志
453
461
  lowcodeLog(
454
462
  JSON.stringify(data),
455
463
  '打印日志',
@@ -457,8 +465,8 @@ export default {
457
465
  false,
458
466
  true
459
467
  )
460
- // 修改组件的值
461
468
  } else if (eachEvent.eventType === 'changeValue') {
469
+ // 修改组件的值
462
470
  // 寻找target
463
471
  targetComponentId = eachEvent.target
464
472
  const targetVM = this.componentsMap[targetComponentId]
@@ -481,7 +489,9 @@ export default {
481
489
  }
482
490
  })
483
491
  },
492
+ // 组件闪烁
484
493
  twink (id) {
494
+ // 定义关键帧间隔
485
495
  const frame = 400
486
496
  this.$refs[id][0].className = 'colWithBorder'
487
497
  setTimeout(() => {
@@ -8,7 +8,7 @@
8
8
  v-bind="formItemLayout"
9
9
  :layout="layout"
10
10
  :rules="rules">
11
- <a-row :gutter="16">
11
+ <a-row :gutter="16" type="flex">
12
12
  <x-form-item
13
13
  v-for="(item, index) in realJsonData"
14
14
  :key="index"
@@ -37,6 +37,7 @@
37
37
  :disabled="itemDisabled(item)"
38
38
  :readonly="readonly(item)"
39
39
  :files="files"
40
+ :style="layout ==='inline'?{marginTop:'5px'}:undefined"
40
41
  :form="form[groupItem.model]"
41
42
  :images="images"
42
43
  :service-name="serviceName"
@@ -64,6 +65,7 @@
64
65
  :disabled="itemDisabled(formItem)"
65
66
  :readonly="readonly(formItem)"
66
67
  :files="files"
68
+ :style="layout ==='inline'?{marginTop:'5px'}:undefined"
67
69
  :form="form[groupItem.model]"
68
70
  :images="images"
69
71
  :service-name="serviceName"
@@ -736,8 +738,6 @@ export default {
736
738
  } else {
737
739
  this.form[item.model] = modifyModelData.data[item.model] + ''
738
740
  }
739
- } else {
740
- this.form[item.model] = undefined
741
741
  }
742
742
  }
743
743
  // 对分组表单进行处理
@@ -19,6 +19,7 @@
19
19
  v-model="form[attr.model]"
20
20
  :read-only="readOnly"
21
21
  :disabled="disabled && !readOnly"
22
+ :whitespace="true"
22
23
  style="flex: 1; width: auto; min-width: 0;"
23
24
  :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')"/>
24
25
  <a-button
@@ -40,6 +41,7 @@
40
41
  <a-input
41
42
  v-else
42
43
  v-model="form[attr.model]"
44
+ :whitespace="true"
43
45
  :read-only="readOnly"
44
46
  :disabled="disabled && !readOnly"
45
47
  style="width:100%"
@@ -8,7 +8,7 @@
8
8
  :local-config="test"
9
9
  :config-data="test_data"
10
10
  :edit-mode="false"
11
- :display-only="false"
11
+ :display-only="true"
12
12
  :show-save-button="false"
13
13
  :dont-format="true"/>
14
14
  <a-button @click="testExport">导出</a-button>
@@ -61,7 +61,19 @@
61
61
  </template>
62
62
  <template v-else-if="cell.type === 'images'">
63
63
  <template v-if="getDeepObject(configData.images, cell.dataIndex) === undefined || getDeepObject(configData.images, cell.dataIndex).length === 0">
64
- <span>无</span>
64
+ <template v-if="getDeepObject(configData, cell.dataIndex) === undefined || getDeepObject(configData, cell.dataIndex).length === 0">
65
+ <span>无</span>
66
+ </template>
67
+ <template v-else>
68
+ <template v-if="typeof getDeepObject(configData, cell.dataIndex) === 'object'">
69
+ <template v-for="(img,imgIndex) in getDeepObject(configData, cell.dataIndex)">
70
+ <span :key="imgIndex" style="margin-right: 5%">{{ img.name }}</span>
71
+ </template>
72
+ </template>
73
+ <template v-else>
74
+ <span style="margin-right: 5%">{{formatImgStr(getDeepObject(configData, cell.dataIndex))[0].name}}</span>
75
+ </template>
76
+ </template>
65
77
  </template>
66
78
  <template v-else v-for="(img,imgIndex) in getDeepObject(configData.images, cell.dataIndex)">
67
79
  <span :key="imgIndex" style="margin-right: 5%">{{ img.name }}</span>
@@ -427,6 +439,18 @@ export default {
427
439
  updateImg (data) {
428
440
  this.$emit('updateImg', data)
429
441
  },
442
+ formatImgStr (str) {
443
+ const result = []
444
+ const arr = str.split('/')
445
+ result.push({
446
+ uid: nanoid(6),
447
+ url: str,
448
+ name: arr[arr.length - 1],
449
+ status: 'done'
450
+ })
451
+ this.uploadParams.acceptCount = 1
452
+ return result
453
+ },
430
454
  checkImg (index, type) {
431
455
  let target
432
456
  if (type === 'configData') {
@@ -435,16 +459,7 @@ export default {
435
459
  target = this.config.tempData[index]
436
460
  }
437
461
  if (typeof target !== 'object') {
438
- const result = []
439
- const arr = target.split('/')
440
- result.push({
441
- uid: nanoid(6),
442
- url: target,
443
- name: arr[arr.length - 1],
444
- status: 'done'
445
- })
446
- this.uploadParams.acceptCount = 1
447
- return result
462
+ return this.formatImgStr(target)
448
463
  }
449
464
  target.forEach(obj => {
450
465
  if (obj.uid === undefined) {
@@ -133,6 +133,7 @@
133
133
  <h3>组件ID</h3>
134
134
  <h4>{{ editorPropertiesConfig.id }}</h4>
135
135
  </template>
136
+ <h4>{{ editorPropertiesConfig.type }}</h4>
136
137
  <!-- 切换 -->
137
138
  <a-menu v-model="editorPanelCurrent" mode="horizontal" @click="() => null">
138
139
  <a-menu-item key="properties">属性</a-menu-item>
@@ -142,7 +143,7 @@
142
143
  <div v-if="editorPanelCurrent[0] === 'properties'">
143
144
  <div v-if="editorPropertiesConfig.props !== undefined">
144
145
  <div>
145
- 栅格数:<a-input :default-value="editorPropertiesConfig.span" @change="changeSpan"/>
146
+ 栅格数:<a-input :default-value="editorPropertiesConfig.span" @change="changeSpan" :key="editorPropertiesConfig.id"/>
146
147
  </div>
147
148
  <template v-for="(value,key) in editorPropertiesConfig.props">
148
149
  <div :key="editorPropertiesConfig.id + '_' + key">
@@ -616,7 +617,9 @@ export default {
616
617
  addComponentTemp: { type: 'page' },
617
618
  // 控制添加页面容器弹框显隐
618
619
  showPageContainerAddModal: false,
620
+ // 控制钩子函数编辑弹框显隐
619
621
  showLifeCycleFunctionEditor: false,
622
+ // 指定架构树选中哪个节点
620
623
  selectTreeNode: undefined
621
624
  }
622
625
  },
@@ -627,12 +630,14 @@ export default {
627
630
  }
628
631
  },
629
632
  methods: {
633
+ // 架构树新增
630
634
  handleTreeAdd (id, type) {
635
+ // 如果目标是行,则添加容器
631
636
  if (type === 'container') {
632
- const lastIndex = id.lastIndexOf('_')
633
- const pageId = id.substring(0, lastIndex)
634
- const rowIndex = id.substring(lastIndex + 1)
635
- const row = lowcodeUtils.getRowByRowId(pageId, rowIndex - 1, this.config)
637
+ // 获取行对象
638
+ const rowConfig = lowcodeUtils.getPageIdAndRowIndexByRowId(id)
639
+ const row = lowcodeUtils.getRowByRowId(rowConfig.pageId, rowConfig.rowIndex - 1, this.config)
640
+ // 如果是空行,直接添加容器
636
641
  if (row.length === 0) {
637
642
  row.push({
638
643
  type: 'container',
@@ -640,6 +645,7 @@ export default {
640
645
  id: 'container_' + lowcodeUtils.nanoidWithoutSymbol(6)
641
646
  })
642
647
  } else {
648
+ // 如果不是空行,将最后一个元素的span平分给新的容器
643
649
  const lastSpan = row[row.length - 1].span
644
650
  const firstSpan = Math.round(lastSpan / 2)
645
651
  const newSpan = lastSpan - firstSpan
@@ -651,11 +657,19 @@ export default {
651
657
  })
652
658
  }
653
659
  } else {
660
+ // 如果不是行,则添加行
654
661
  const page = lowcodeUtils.getPageConfigById(id, this.config)
655
- page.body.push([])
662
+ page.body.push([
663
+ {
664
+ type: 'container',
665
+ span: 24,
666
+ id: 'container_' + lowcodeUtils.nanoidWithoutSymbol(6)
667
+ }
668
+ ])
656
669
  }
657
670
  this.refreshOrganization()
658
671
  },
672
+ // 为架构树过滤配置,只显示当前激活的页面配置
659
673
  filterOrganizationConfig () {
660
674
  const result = { page: [] }
661
675
  this.config.page.forEach(page => {
@@ -665,7 +679,9 @@ export default {
665
679
  })
666
680
  return result
667
681
  },
682
+ // 处理拆分
668
683
  handleSplit (id, isVertical) {
684
+ // 获取目标对象,目标行和对象在行中的Index
669
685
  const target = lowcodeUtils.getComponentConfig(id, this.config)
670
686
  const row = lowcodeUtils.getRowConfigByComponentId(id, this.config)
671
687
  let index
@@ -675,8 +691,11 @@ export default {
675
691
  break
676
692
  }
677
693
  }
694
+ // 将目标对象缓存
678
695
  const cache = JSON.parse(JSON.stringify(target))
696
+ // 是否为垂直拆分
679
697
  if (isVertical) {
698
+ // 垂直拆分,嵌套page容器
680
699
  const temp = {
681
700
  type: 'container_page',
682
701
  span: cache.span,
@@ -692,7 +711,9 @@ export default {
692
711
  ]
693
712
  }
694
713
  cache.span = 24
714
+ // 第一行放缓存的原始对象
695
715
  temp.page[0].body[0].push(cache)
716
+ // 第二行新增容器
696
717
  temp.page[0].body[1] = []
697
718
  temp.page[0].body[1].push({
698
719
  type: 'container',
@@ -701,6 +722,8 @@ export default {
701
722
  })
702
723
  row.splice(index, 1, temp)
703
724
  } else {
725
+ // 如果是水平拆分
726
+ // 将原先对象span一分为二,添加容器
704
727
  const outerSpan = cache.span
705
728
  const firstSpan = Math.round(outerSpan / 2)
706
729
  const secondSpan = outerSpan - firstSpan
@@ -713,24 +736,23 @@ export default {
713
736
  }
714
737
  this.refreshOrganization()
715
738
  },
716
- refreshRender () {
717
- this.renderPreview = false
718
- this.renderModalPreview = false
719
- this.renderDrawPreview = false
720
- this.$nextTick(() => {
721
- this.renderPreview = true
722
- this.renderModalPreview = true
723
- this.renderDrawPreview = true
724
- })
725
- },
726
739
  // 添加页面容器弹框确认
727
740
  handleAddPageContainerModalOk () {
741
+ const pageId = 'page_' + lowcodeUtils.nanoidWithoutSymbol(6)
728
742
  const result = {
729
- id: 'page_' + lowcodeUtils.nanoidWithoutSymbol(6),
743
+ id: pageId,
730
744
  type: this.addComponentTemp.type,
731
745
  title: this.addComponentTemp.title,
732
746
  width: this.addComponentTemp.width,
733
- body: []
747
+ body: [
748
+ [
749
+ {
750
+ type: 'container',
751
+ span: 24,
752
+ id: 'container_' + lowcodeUtils.nanoidWithoutSymbol(6)
753
+ }
754
+ ]
755
+ ]
734
756
  }
735
757
  this.addComponentTemp = { type: 'page' }
736
758
  this.config.page.push(result)
@@ -752,6 +774,7 @@ export default {
752
774
  },
753
775
  // 通过组件类型和key解析出该key对应的中文定义
754
776
  resolveEditorPropsLabel (type, key) {
777
+ // 获取配置中的定义
755
778
  const def = lowcodeUtils.getEditorConfigByType(type)
756
779
  const propsDef = def.properties
757
780
  const targetDef = propsDef[key]
@@ -766,7 +789,7 @@ export default {
766
789
  // 架构重命名
767
790
  rename (id, newName) {
768
791
  const target = lowcodeUtils.getConfig(id, this.config)
769
- if (id.length <= 2) {
792
+ if (target.type === 'page') {
770
793
  target.title = newName
771
794
  } else {
772
795
  target.name = newName
@@ -806,30 +829,15 @@ export default {
806
829
  },
807
830
  // 点击架构树
808
831
  treeOrganizationClick (id) {
809
- // 如果类型是page证明,选中的是最外层容器
810
- // if (type === 'page') {
811
- // this.mainPageMenu[0] = id
812
- // this.activeMainPage = id
813
- // for (let i = 0; i < this.config.page.length; i++) {
814
- // if (this.config.page[i].id === this.activeMainPage) {
815
- // this.activeMainPageType = this.config.page[i].type
816
- // break
817
- // }
818
- // }
819
- // this.$forceUpdate()
820
- // } else if (type === 'component') {
821
- // this.config.page.forEach(page => {
822
- // page.body.forEach(row => {
823
- // row.forEach(item => {
824
- // if (item.id === id) {
825
- // this.mainPageMenu[0] = page.id
826
- // this.activeMainPage = page.id
827
- // this.activeMainPageType = page.type
828
- // this.$forceUpdate()
829
- // }
830
- // })
831
- // })
832
- // })
832
+ // 如果是反选
833
+ if (id === null) {
834
+ // 清除编辑框
835
+ this.editorPropertiesConfig = {}
836
+ this.targetContainer = undefined
837
+ // 清除容器select
838
+ lowcodeUtils.unCheckAll(this.config)
839
+ return
840
+ }
833
841
  let target
834
842
  if (id.includes('container_page')) {
835
843
  target = lowcodeUtils.getContainerPageOuterByContainerPageId(id, this.config)
@@ -838,7 +846,9 @@ export default {
838
846
  }
839
847
  // 将组件选中
840
848
  this.clickComponentInEditor(target)
841
- this.twink(id)
849
+ if (!id.includes('container')) {
850
+ this.twink(id)
851
+ }
842
852
  },
843
853
  // 架构树拖拽事件
844
854
  handleTreeDrag (dragKey, dropKey, dragLevel, dropLevel, dropPosition, dragType) {
@@ -905,18 +915,16 @@ export default {
905
915
  // 保存目标
906
916
  targetCache = target.body[dropConfig.rowIndex - 1]
907
917
  // 插入
908
- console.warn('temp', JSON.parse(JSON.stringify(target)))
909
- console.warn('temp', dropConfig.rowIndex - 1)
910
918
  if (dropPosition < 0) {
911
919
  target.body.splice(dropConfig.rowIndex - 1, 1, cache, targetCache)
912
920
  } else {
913
921
  target.body.splice(dropConfig.rowIndex - 1, 1, targetCache, cache)
914
922
  }
915
923
  // 清理占位
916
- for (let i = 0; i < target.body.length; i++) {
917
- const item = target.body[i]
924
+ for (let i = 0; i < father.body.length; i++) {
925
+ const item = father.body[i]
918
926
  if (item.placeHold) {
919
- target.body.splice(i, 1)
927
+ father.body.splice(i, 1)
920
928
  break
921
929
  }
922
930
  }
@@ -952,10 +960,10 @@ export default {
952
960
  target.splice(targetIndex, 1, targetCache, cache)
953
961
  }
954
962
  // 清理占位
955
- for (let i = 0; i < target.length; i++) {
956
- const item = target[i]
963
+ for (let i = 0; i < father.length; i++) {
964
+ const item = father[i]
957
965
  if (item.placeHold) {
958
- target.splice(i, 1)
966
+ father.splice(i, 1)
959
967
  break
960
968
  }
961
969
  }
@@ -991,10 +999,10 @@ export default {
991
999
  target.splice(targetIndex, 1, targetCache, cache)
992
1000
  }
993
1001
  // 清理占位
994
- for (let i = 0; i < target.length; i++) {
995
- const item = target[i]
1002
+ for (let i = 0; i < father.length; i++) {
1003
+ const item = father[i]
996
1004
  if (item.placeHold) {
997
- target.splice(i, 1)
1005
+ father.splice(i, 1)
998
1006
  break
999
1007
  }
1000
1008
  }
@@ -1057,43 +1065,21 @@ export default {
1057
1065
 
1058
1066
  this.refreshOrganization()
1059
1067
  },
1060
- cleanPlaceHolder (config) {
1061
- for (let i = 0; i < config.page.length; i++) {
1062
- const page = config.page[i]
1063
- if (page.placeHold) {
1064
- config.page.splice(i, 1)
1065
- return true
1066
- }
1067
- for (let j = 0; j < page.body.length; j++) {
1068
- const row = page.body[j]
1069
- if (row.placeHold) {
1070
- page.splice(j, 1)
1071
- return true
1072
- }
1073
- for (let k = 0; k < row.length; k++) {
1074
- const item = row[k]
1075
- if (item.placeHold) {
1076
- row.splice(k, 1)
1077
- return true
1078
- }
1079
- if (item === 'container_page') {
1080
- const flag = this.cleanPlaceHolder(item)
1081
- if (flag) {
1082
- return true
1083
- }
1084
- }
1085
- }
1086
- }
1087
- }
1088
- },
1089
1068
  // 主页面标签切换
1090
1069
  handleMainPageMenuChange (value) {
1091
- this.activeMainPage = value.key
1092
- for (let i = 0; i < this.config.page.length; i++) {
1093
- if (this.config.page[i].id === this.activeMainPage) {
1094
- this.activeMainPageType = this.config.page[i].type
1095
- this.refreshOrganization()
1096
- return
1070
+ // 如果和之前选择的不一样
1071
+ if (value.key !== this.activeMainPage) {
1072
+ // 清空属性编辑
1073
+ this.editorPropertiesConfig = {}
1074
+ this.targetContainer = undefined
1075
+ // 切换菜单
1076
+ this.activeMainPage = value.key
1077
+ for (let i = 0; i < this.config.page.length; i++) {
1078
+ if (this.config.page[i].id === this.activeMainPage) {
1079
+ this.activeMainPageType = this.config.page[i].type
1080
+ this.refreshOrganization()
1081
+ return
1082
+ }
1097
1083
  }
1098
1084
  }
1099
1085
  },
@@ -1101,11 +1087,6 @@ export default {
1101
1087
  determinePageType (type) {
1102
1088
  return lowcodeUtils.resolvePageType(type)
1103
1089
  },
1104
- // 架构添加组件后,将配置添加到config中
1105
- handleAddComponent (config) {
1106
- this.config.page.push(config)
1107
- this.refreshOrganization()
1108
- },
1109
1090
  // 打开logic回调编辑弹框
1110
1091
  openLogicCallbackEditor () {
1111
1092
  if (!this.eventEditorContent.logicCallBackFunction) {
@@ -1147,10 +1128,9 @@ export default {
1147
1128
  this.deleteContainerPage(id)
1148
1129
  }
1149
1130
  },
1131
+ // 删除容器页面
1150
1132
  deleteContainerPage (id) {
1151
- console.warn('id', id)
1152
1133
  const target = lowcodeUtils.getContainerPageOuterByContainerPageId(id, this.config)
1153
- console.warn('target', target)
1154
1134
  target.type = 'container'
1155
1135
  delete target.page
1156
1136
  this.targetContainer = undefined
@@ -1169,10 +1149,11 @@ export default {
1169
1149
  },
1170
1150
  // 删除页面容器
1171
1151
  deletePage (page) {
1172
- console.warn('123', page)
1152
+ // 清空页面下所有组件的注册信息
1173
1153
  page.body.forEach(row => {
1174
1154
  row.forEach(item => {
1175
1155
  if (item.type === 'container_page') {
1156
+ // 如果是容器页面,递归
1176
1157
  this.deletePage(item.page)
1177
1158
  } else {
1178
1159
  delete this.$children[0]._provided.componentsMap[item.id]
@@ -1223,6 +1204,7 @@ export default {
1223
1204
  }
1224
1205
  this.showJSEventEditor = true
1225
1206
  },
1207
+ // 打开钩子函数编辑器
1226
1208
  openEventLifeCycleJSEditor () {
1227
1209
  if (!this.eventEditorContent.LifeCycleFunction) {
1228
1210
  this.eventEditorContent.LifeCycleFunction = LifeCycleFunctionTemplate
@@ -1405,48 +1387,6 @@ export default {
1405
1387
  }
1406
1388
  // 如果是page类型,添加两个容器。其他类型添加一个容器
1407
1389
  if (this.config.page[targetIndex].type === 'page') {
1408
- // this.config.page[targetIndex].body.push([
1409
- // {
1410
- // type: 'container_page',
1411
- // span: 12,
1412
- // id: 'container_' + lowcodeUtils.nanoidWithoutSymbol(6),
1413
- // page: [
1414
- // {
1415
- // id: 'container_page_' + lowcodeUtils.nanoidWithoutSymbol(6),
1416
- // type: 'page',
1417
- // body: [
1418
- // [
1419
- // {
1420
- // type: 'container',
1421
- // span: 24,
1422
- // id: 'container_' + lowcodeUtils.nanoidWithoutSymbol(6)
1423
- // }
1424
- // ]
1425
- // ]
1426
- // }
1427
- // ]
1428
- // },
1429
- // {
1430
- // type: 'container_page',
1431
- // span: 12,
1432
- // id: 'container_' + lowcodeUtils.nanoidWithoutSymbol(6),
1433
- // page: [
1434
- // {
1435
- // id: 'container_page_' + lowcodeUtils.nanoidWithoutSymbol(6),
1436
- // type: 'page',
1437
- // body: [
1438
- // [
1439
- // {
1440
- // type: 'container',
1441
- // span: 24,
1442
- // id: 'container_' + lowcodeUtils.nanoidWithoutSymbol(6)
1443
- // }
1444
- // ]
1445
- // ]
1446
- // }
1447
- // ]
1448
- // }
1449
- // ])
1450
1390
  this.config.page[targetIndex].body.push([
1451
1391
  {
1452
1392
  type: 'container',
@@ -1490,6 +1430,7 @@ export default {
1490
1430
  this.refreshOrganization()
1491
1431
  },
1492
1432
  onCancel: () => {
1433
+ // 垂直拆分
1493
1434
  targetItem.type = 'container_page'
1494
1435
  targetItem.page = [{
1495
1436
  id: 'container_page_' + lowcodeUtils.nanoidWithoutSymbol(6),
@@ -1567,11 +1508,29 @@ export default {
1567
1508
  },
1568
1509
  // 选中某个组件
1569
1510
  clickComponentInEditor (configItem) {
1511
+ if (!configItem) {
1512
+ return
1513
+ }
1570
1514
  // 同步选中架构
1515
+ // 将选中的节点清空,在$nextTick再赋值,保证组件能watch到改变
1516
+ this.selectTreeNode = undefined
1571
1517
  if (configItem.type === 'container_page') {
1572
- this.selectTreeNode = 'container_page_' + configItem.page[0].id
1518
+ this.$nextTick(() => {
1519
+ this.selectTreeNode = 'container_page_' + configItem.page[0].id
1520
+ })
1573
1521
  } else {
1574
- this.selectTreeNode = configItem.id
1522
+ // 如果目标不是容器,回显架构树
1523
+ if (configItem.type !== 'container') {
1524
+ this.$nextTick(() => {
1525
+ this.selectTreeNode = configItem.id
1526
+ })
1527
+ lowcodeUtils.unCheckAll(this.config)
1528
+ } else if (!configItem.selected) {
1529
+ // 如果目标是容器,但不是反选容器,回显架构树
1530
+ this.$nextTick(() => {
1531
+ this.selectTreeNode = configItem.id
1532
+ })
1533
+ }
1575
1534
  }
1576
1535
  this.editorPropertiesConfig = {}
1577
1536
  // 如果选中的是容器
@@ -1586,6 +1545,8 @@ export default {
1586
1545
  // 将目标设置为选定
1587
1546
  configItem.selected = true
1588
1547
  this.targetContainer = configItem
1548
+ this.editorPropertiesConfig = configItem
1549
+ this.editorPropertiesConfig.props = {}
1589
1550
  }
1590
1551
  return
1591
1552
  }
@@ -1630,6 +1591,7 @@ export default {
1630
1591
  this.editorPropertiesConfig = 'unregistered'
1631
1592
  }
1632
1593
  },
1594
+ // 架构树点击某个节点后,在渲染器中,让组件闪烁
1633
1595
  twink (id) {
1634
1596
  const allRefs = Object.keys(this.$refs)
1635
1597
  allRefs.forEach(ref => {
@@ -1653,148 +1615,148 @@ export default {
1653
1615
  this.supportedEventType = [...lowcodeComponentMixin.supportedEventType]
1654
1616
  // 深拷贝外侧传来的配置
1655
1617
  this.config = JSON.parse(JSON.stringify(this.originalConfig))
1656
- this.config = {
1657
- page: [
1658
- {
1659
- id: 'page_KBjw2i',
1660
- type: 'page',
1661
- title: '111',
1662
- body: [
1663
- [
1664
- {
1665
- type: 'XFormTable',
1666
- span: 12,
1667
- id: 'XFormTable_BV6Nwk',
1668
- selected: false,
1669
- props: {
1670
- queryParamsName: '',
1671
- serviceName: ''
1672
- },
1673
- selfEvent: [
1674
- 'action'
1675
- ]
1676
- },
1677
- {
1678
- type: 'XAddNativeForm',
1679
- span: 12,
1680
- id: 'XAddNativeForm_ekihTp',
1681
- selected: false,
1682
- props: {
1683
- configNameForLowCode: '',
1684
- systemNameForLowCode: ''
1685
- },
1686
- selfEvent: [
1687
- 'onSubmit'
1688
- ]
1689
- }
1690
- ],
1691
- [
1692
- {
1693
- type: 'XTreeOne',
1694
- span: 12,
1695
- id: 'XTreeOne_szu7Al',
1696
- selected: false
1697
- },
1698
- {
1699
- type: 'XDescriptions',
1700
- span: 12,
1701
- id: 'XDescriptions_DTkbEg',
1702
- selected: false,
1703
- props: {
1704
- title: '111',
1705
- content: {
1706
- c_f_user_phone: '2323',
1707
- c_f_total_fee: 33356,
1708
- c_f_address: '22',
1709
- c_f_meterlen: 2,
1710
- c_f_bank_card_number: '23',
1711
- c_f_create_user: '超级管理员',
1712
- c_f_customer: '23',
1713
- c_f_balance: 33356,
1714
- c_f_create_date: '2024-06-23 21:31:24',
1715
- c_f_operator_date: '2024-06-23 21:31:24',
1716
- c_f_total_times: 2,
1717
- c_f_user_name: '23',
1718
- c_f_comments: '323',
1719
- c_id: 39,
1720
- c_f_operatorid: '15',
1721
- c_f_operator: '超级管理员',
1722
- c_f_orgid: '9'
1723
- },
1724
- configName: 'Unit_Desc_Config',
1725
- serviceName: 'af-revenue',
1726
- getRealData: true
1727
- },
1728
- selfEvent: []
1729
- }
1730
- ]
1731
- ]
1732
- },
1733
- {
1734
- id: 'page_FgItf6',
1735
- type: 'page',
1736
- title: '22',
1737
- body: [
1738
- [
1739
- {
1740
- type: 'container',
1741
- span: 4,
1742
- id: 'container_ir2gR2',
1743
- selected: false
1744
- },
1745
- {
1746
- type: 'container_page',
1747
- span: 10,
1748
- id: 'container_xIRHGg',
1749
- selected: true,
1750
- page: [
1751
- {
1752
- id: 'container_page_IgYw9u',
1753
- type: 'page',
1754
- body: [
1755
- [
1756
- {
1757
- type: 'container',
1758
- span: 24,
1759
- id: 'container_tqVFCL'
1760
- }
1761
- ],
1762
- [
1763
- {
1764
- type: 'container',
1765
- span: 24,
1766
- id: 'container_i8VXCZ'
1767
- }
1768
- ]
1769
- ]
1770
- }
1771
- ]
1772
- },
1773
- {
1774
- type: 'container',
1775
- span: 10,
1776
- id: 'container_PT9n3Q',
1777
- selected: false
1778
- }
1779
- ],
1780
- [
1781
- {
1782
- type: 'container',
1783
- span: 18,
1784
- id: 'container_q04vQr',
1785
- selected: false
1786
- },
1787
- {
1788
- type: 'container',
1789
- span: 6,
1790
- id: 'container_MKwNvz',
1791
- selected: false
1792
- }
1793
- ]
1794
- ]
1795
- }
1796
- ]
1797
- }
1618
+ // this.config = {
1619
+ // page: [
1620
+ // {
1621
+ // id: 'page_KBjw2i',
1622
+ // type: 'page',
1623
+ // title: '111',
1624
+ // body: [
1625
+ // [
1626
+ // {
1627
+ // type: 'XFormTable',
1628
+ // span: 12,
1629
+ // id: 'XFormTable_BV6Nwk',
1630
+ // selected: false,
1631
+ // props: {
1632
+ // queryParamsName: '',
1633
+ // serviceName: ''
1634
+ // },
1635
+ // selfEvent: [
1636
+ // 'action'
1637
+ // ]
1638
+ // },
1639
+ // {
1640
+ // type: 'XAddNativeForm',
1641
+ // span: 12,
1642
+ // id: 'XAddNativeForm_ekihTp',
1643
+ // selected: false,
1644
+ // props: {
1645
+ // configNameForLowCode: '',
1646
+ // systemNameForLowCode: ''
1647
+ // },
1648
+ // selfEvent: [
1649
+ // 'onSubmit'
1650
+ // ]
1651
+ // }
1652
+ // ],
1653
+ // [
1654
+ // {
1655
+ // type: 'XTreeOne',
1656
+ // span: 12,
1657
+ // id: 'XTreeOne_szu7Al',
1658
+ // selected: false
1659
+ // },
1660
+ // {
1661
+ // type: 'XDescriptions',
1662
+ // span: 12,
1663
+ // id: 'XDescriptions_DTkbEg',
1664
+ // selected: false,
1665
+ // props: {
1666
+ // title: '111',
1667
+ // content: {
1668
+ // c_f_user_phone: '2323',
1669
+ // c_f_total_fee: 33356,
1670
+ // c_f_address: '22',
1671
+ // c_f_meterlen: 2,
1672
+ // c_f_bank_card_number: '23',
1673
+ // c_f_create_user: '超级管理员',
1674
+ // c_f_customer: '23',
1675
+ // c_f_balance: 33356,
1676
+ // c_f_create_date: '2024-06-23 21:31:24',
1677
+ // c_f_operator_date: '2024-06-23 21:31:24',
1678
+ // c_f_total_times: 2,
1679
+ // c_f_user_name: '23',
1680
+ // c_f_comments: '323',
1681
+ // c_id: 39,
1682
+ // c_f_operatorid: '15',
1683
+ // c_f_operator: '超级管理员',
1684
+ // c_f_orgid: '9'
1685
+ // },
1686
+ // configName: 'Unit_Desc_Config',
1687
+ // serviceName: 'af-revenue',
1688
+ // getRealData: true
1689
+ // },
1690
+ // selfEvent: []
1691
+ // }
1692
+ // ]
1693
+ // ]
1694
+ // },
1695
+ // {
1696
+ // id: 'page_FgItf6',
1697
+ // type: 'page',
1698
+ // title: '22',
1699
+ // body: [
1700
+ // [
1701
+ // {
1702
+ // type: 'container',
1703
+ // span: 4,
1704
+ // id: 'container_ir2gR2',
1705
+ // selected: false
1706
+ // },
1707
+ // {
1708
+ // type: 'container_page',
1709
+ // span: 10,
1710
+ // id: 'container_xIRHGg',
1711
+ // selected: true,
1712
+ // page: [
1713
+ // {
1714
+ // id: 'container_page_IgYw9u',
1715
+ // type: 'page',
1716
+ // body: [
1717
+ // [
1718
+ // {
1719
+ // type: 'container',
1720
+ // span: 24,
1721
+ // id: 'container_tqVFCL'
1722
+ // }
1723
+ // ],
1724
+ // [
1725
+ // {
1726
+ // type: 'container',
1727
+ // span: 24,
1728
+ // id: 'container_i8VXCZ'
1729
+ // }
1730
+ // ]
1731
+ // ]
1732
+ // }
1733
+ // ]
1734
+ // },
1735
+ // {
1736
+ // type: 'container',
1737
+ // span: 10,
1738
+ // id: 'container_PT9n3Q',
1739
+ // selected: false
1740
+ // }
1741
+ // ],
1742
+ // [
1743
+ // {
1744
+ // type: 'container',
1745
+ // span: 18,
1746
+ // id: 'container_q04vQr',
1747
+ // selected: false
1748
+ // },
1749
+ // {
1750
+ // type: 'container',
1751
+ // span: 6,
1752
+ // id: 'container_MKwNvz',
1753
+ // selected: false
1754
+ // }
1755
+ // ]
1756
+ // ]
1757
+ // }
1758
+ // ]
1759
+ // }
1798
1760
  this.refreshOrganization()
1799
1761
  }
1800
1762
  }
@@ -33,8 +33,7 @@
33
33
 
34
34
  // 美化滚动条
35
35
  ::-webkit-scrollbar{
36
- height: 9px;
37
- width: 9px;
36
+ width: 7px;
38
37
  }
39
38
 
40
39
  ::-webkit-scrollbar-thumb {
@@ -54,4 +53,5 @@
54
53
 
55
54
  ::-webkit-scrollbar-thumb:hover {
56
55
  background: @primary-3;
56
+ border: 0;
57
57
  }
@@ -4,15 +4,18 @@ import lowcodeLog from '@vue2-client/utils/lowcode/lowcodeLog'
4
4
  import { uuid } from '@vue2-client/utils/util'
5
5
  export default {
6
6
  props: {
7
+ // 组件ID用于注册组件到Map中
7
8
  mixinComponentId: {
8
9
  type: String,
9
10
  required: false,
10
11
  default: uuid()
11
12
  },
13
+ // 所有Props的集合
12
14
  propsData: {
13
15
  type: Object,
14
16
  default: () => {}
15
17
  },
18
+ // 钩子函数
16
19
  lifeCycleFunction: {
17
20
  type: Array,
18
21
  default: undefined
@@ -20,6 +23,10 @@ export default {
20
23
  },
21
24
  data () {
22
25
  return {
26
+ // 组件暴露给低代码平台的变量
27
+ // 该变量由各个组件选择性暴露
28
+ // 比如XFormTable可以将点击action后,该行信息保存在此变量中,便于其他组件调用
29
+ // 使用$lowCodeSetData来修改此变量的值
23
30
  dataForLowCode: {}
24
31
  }
25
32
  },
@@ -69,6 +76,7 @@ export default {
69
76
  $lowCodeSetData (key, value) {
70
77
  this.dataForLowCode[key] = value
71
78
  },
79
+ // 解析传入的钩子函数并执行
72
80
  resolveLifeCycleFunctionAndRun (lifeCycleName) {
73
81
  if (this.lifeCycleFunction && this.lifeCycleFunction.length > 0) {
74
82
  this.lifeCycleFunction.forEach(param => {
@@ -54,6 +54,7 @@ export function getPageByComponentID (id, config) {
54
54
  }
55
55
  }
56
56
 
57
+ // 根据组件id获取当前行
57
58
  export function getRowByComponentId (id, config) {
58
59
  for (let i = 0; i < config.page.length; i++) {
59
60
  const page = config.page[i]