vue2-client 1.8.278 → 1.8.280

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.278",
3
+ "version": "1.8.280",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -248,10 +248,16 @@ export default {
248
248
  } else {
249
249
  if (targetType === 'row') {
250
250
  // 将行内每个组件重新修改id
251
- const copyKeys = Object.keys(copy)
252
- copyKeys.forEach(key => {
253
- const prefix = copy[key].id.split('_')[0]
254
- copy[key].id = prefix + '_' + lowcodeUtils.nanoidWithoutSymbol(6)
251
+ const target = copy.body
252
+ copy.id = 'undefine'
253
+ target.forEach(item => {
254
+ if (item.type === 'container_page') {
255
+ item.id = 'container_' + lowcodeUtils.nanoidWithoutSymbol(6)
256
+ item = lowcodeUtils.reRandomComponentId(item)
257
+ } else {
258
+ const prefix = item.id.split('_')[0]
259
+ item.id = prefix + '_' + lowcodeUtils.nanoidWithoutSymbol(6)
260
+ }
255
261
  })
256
262
  } else if (targetType === 'item') {
257
263
  // 重新修改id
@@ -13,7 +13,7 @@
13
13
  </template>
14
14
  <!-- 渲染器主体 -->
15
15
  <template v-for="(row,rowIndex) in page.body">
16
- <a-row :key="pageIndex + '_' + rowIndex">
16
+ <a-row :key="pageIndex + '_' + rowIndex" type="flex">
17
17
  <template v-if="!showDragSpan">
18
18
  <template v-for="(item, itemIndex) in row.body">
19
19
  <a-col :span="item.span" :key="item.id">
@@ -485,8 +485,9 @@ export default {
485
485
  const logicParamFunction = eval('(' + eachEvent.logicParamFunction + ')')
486
486
  // 将需要的组件变量组织好,并传递给函数
487
487
  const componentData = {}
488
- eachEvent.logicParamTransfer.forEach(componentId => {
489
- componentData[componentId] = this.componentsMap[componentId].dataForLowCode
488
+ const allComponents = Object.keys(this.componentsMap)
489
+ allComponents.forEach(component => {
490
+ componentData[component] = this.componentsMap[component].dataForLowCode
490
491
  })
491
492
  const param = logicParamFunction(componentData, data)
492
493
  lowcodeLog(
@@ -573,7 +574,6 @@ export default {
573
574
  watch: {
574
575
  pageConfig: {
575
576
  handler (newVal) {
576
- // this.refreshSubRender()
577
577
  },
578
578
  deep: true
579
579
  }
@@ -41,10 +41,9 @@
41
41
  </a-button>
42
42
  </a-input-group>
43
43
  <a-input-number
44
- v-else-if="attr.numberInput"
44
+ v-else-if="attr.numberInput && !readOnly"
45
45
  v-model="form[attr.model]"
46
46
  :whitespace="true"
47
- :read-only="readOnly"
48
47
  :disabled="disabled && !readOnly"
49
48
  style="width:100%"
50
49
  @blur="attr.inputOnBlurFunc && emitFunc(attr.inputOnBlurFunc,attr)"
@@ -12,5 +12,17 @@ export const XFormTableConfig = {
12
12
  desc: '配置对应的命名空间'
13
13
  }
14
14
  },
15
+ selfMethods: [
16
+ {
17
+ name: 'initConfig',
18
+ desc: '初始化方法, sjahdjhashdkashdasdhkjashdashdajsdhkajshdaks',
19
+ params: 'config, data'
20
+ },
21
+ {
22
+ name: 'setFixedQueryParams',
23
+ desc: '额外条件传入, ioreqhgbuivZXBqyuu',
24
+ params: 'params'
25
+ }
26
+ ],
15
27
  selfEvent: ['action']
16
28
  }
@@ -9,6 +9,7 @@
9
9
  <XReportDesign
10
10
  @updateImg="updateImg"
11
11
  v-if="scanFinish"
12
+ :show-img-in-cell="showImgInCell"
12
13
  :img-prefix="imgPrefix"
13
14
  :use-oss-for-img="useOssForImg"
14
15
  :display-only="displayOnly"
@@ -44,6 +45,7 @@
44
45
  <XReportDesign
45
46
  v-if="scanFinish"
46
47
  @updateImg="updateImg"
48
+ :show-img-in-cell="showImgInCell"
47
49
  :img-prefix="imgPrefix"
48
50
  :use-oss-for-img="useOssForImg"
49
51
  :display-only="displayOnly"
@@ -119,6 +121,10 @@ export default {
119
121
  type: Boolean,
120
122
  default: true
121
123
  },
124
+ showImgInCell: {
125
+ type: Boolean,
126
+ default: false
127
+ },
122
128
  // 数据
123
129
  configData: {
124
130
  type: Object,
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div id="test">
2
+ <div id="test" v-if="showReport">
3
3
  <XReport
4
4
  @updateImg="updateImg"
5
5
  ref="main"
@@ -7,8 +7,10 @@
7
7
  config-name="report_ticket"
8
8
  :local-config="test"
9
9
  :config-data="test_data"
10
+ server-name="af-apply"
11
+ :show-img-in-cell="true"
12
+ :display-only="displayOnly"
10
13
  :edit-mode="false"
11
- :display-only="true"
12
14
  :show-save-button="false"
13
15
  :dont-format="true"/>
14
16
  <a-button @click="testExport">导出</a-button>
@@ -18,6 +20,7 @@
18
20
 
19
21
  <script>
20
22
  import XReport from '@vue2-client/base-client/components/common/XReport'
23
+ // eslint-disable-next-line no-unused-vars
21
24
  import { exportHTMLNodeToPDF } from '@vue2-client/utils/htmlToPDFApi'
22
25
 
23
26
  export default {
@@ -79,11 +82,154 @@ export default {
79
82
  },
80
83
  test_data: {
81
84
  serviceall: {
82
- f_signname: '/rs/image/file/6ad0dd36a7492a6b05553fed5267ab8c-valve-aofeng-check.png'
85
+ f_signname: [
86
+ {
87
+ uid: 'vc-upload-1721804393350-2',
88
+ name: '1.png',
89
+ status: 'done',
90
+ response: {
91
+ f_filetype: 'png',
92
+ f_file_size: 0.0005,
93
+ f_form_type: 'image',
94
+ f_use_type: 'Default',
95
+ f_downloadpath: '/apply-image/resource/webmeter/cs/20240724/22a6d6d151f5401eae58628a589233ec.png',
96
+ id: '52747',
97
+ f_filename: '1.png',
98
+ f_stock_id: 1,
99
+ f_realpath: 'D:\\nginx-resource\\resource\\webmeter/cs/20240724/22a6d6d151f5401eae58628a589233ec.png',
100
+ f_operator: '1',
101
+ fusetype: 'Default'
102
+ },
103
+ url: '/apply-image/resource/webmeter/cs/20240724/22a6d6d151f5401eae58628a589233ec.png',
104
+ id: '52747'
105
+ },
106
+ {
107
+ uid: 'vc-upload-1721804393350-4',
108
+ name: '2.png',
109
+ status: 'done',
110
+ response: {
111
+ f_filetype: 'png',
112
+ f_file_size: 0.0003,
113
+ f_form_type: 'image',
114
+ f_use_type: 'Default',
115
+ f_downloadpath: '/apply-image/resource/webmeter/cs/20240724/3cd3f0561edd466aa7026fbdc2c16803.png',
116
+ id: '52748',
117
+ f_filename: '2.png',
118
+ f_stock_id: 1,
119
+ f_realpath: 'D:\\nginx-resource\\resource\\webmeter/cs/20240724/3cd3f0561edd466aa7026fbdc2c16803.png',
120
+ f_operator: '1',
121
+ fusetype: 'Default'
122
+ },
123
+ url: '/apply-image/resource/webmeter/cs/20240724/3cd3f0561edd466aa7026fbdc2c16803.png',
124
+ id: '52748'
125
+ },
126
+ {
127
+ uid: 'vc-upload-1721804393350-6',
128
+ name: '3.png',
129
+ status: 'done',
130
+ response: {
131
+ f_filetype: 'png',
132
+ f_file_size: 0.0003,
133
+ f_form_type: 'image',
134
+ f_use_type: 'Default',
135
+ f_downloadpath: '/apply-image/resource/webmeter/cs/20240724/ddc49b4375284027b11ce2c86fde47b0.png',
136
+ id: '52749',
137
+ f_filename: '3.png',
138
+ f_stock_id: 1,
139
+ f_realpath: 'D:\\nginx-resource\\resource\\webmeter/cs/20240724/ddc49b4375284027b11ce2c86fde47b0.png',
140
+ f_operator: '1',
141
+ fusetype: 'Default'
142
+ },
143
+ url: '/apply-image/resource/webmeter/cs/20240724/ddc49b4375284027b11ce2c86fde47b0.png',
144
+ id: '52749'
145
+ },
146
+ {
147
+ uid: 'vc-upload-1721804393350-6',
148
+ name: '3.png',
149
+ status: 'done',
150
+ response: {
151
+ f_filetype: 'png',
152
+ f_file_size: 0.0003,
153
+ f_form_type: 'image',
154
+ f_use_type: 'Default',
155
+ f_downloadpath: '/apply-image/resource/webmeter/cs/20240724/ddc49b4375284027b11ce2c86fde47b0.png',
156
+ id: '52749',
157
+ f_filename: '3.png',
158
+ f_stock_id: 1,
159
+ f_realpath: 'D:\\nginx-resource\\resource\\webmeter/cs/20240724/ddc49b4375284027b11ce2c86fde47b0.png',
160
+ f_operator: '1',
161
+ fusetype: 'Default'
162
+ },
163
+ url: '/apply-image/resource/webmeter/cs/20240724/ddc49b4375284027b11ce2c86fde47b0.png',
164
+ id: '52749'
165
+ },
166
+ {
167
+ uid: 'vc-upload-1721804393350-6',
168
+ name: '3.png',
169
+ status: 'done',
170
+ response: {
171
+ f_filetype: 'png',
172
+ f_file_size: 0.0003,
173
+ f_form_type: 'image',
174
+ f_use_type: 'Default',
175
+ f_downloadpath: '/apply-image/resource/webmeter/cs/20240724/ddc49b4375284027b11ce2c86fde47b0.png',
176
+ id: '52749',
177
+ f_filename: '3.png',
178
+ f_stock_id: 1,
179
+ f_realpath: 'D:\\nginx-resource\\resource\\webmeter/cs/20240724/ddc49b4375284027b11ce2c86fde47b0.png',
180
+ f_operator: '1',
181
+ fusetype: 'Default'
182
+ },
183
+ url: '/apply-image/resource/webmeter/cs/20240724/ddc49b4375284027b11ce2c86fde47b0.png',
184
+ id: '52749'
185
+ },
186
+ {
187
+ uid: 'vc-upload-1721804393350-6',
188
+ name: '3.png',
189
+ status: 'done',
190
+ response: {
191
+ f_filetype: 'png',
192
+ f_file_size: 0.0003,
193
+ f_form_type: 'image',
194
+ f_use_type: 'Default',
195
+ f_downloadpath: '/apply-image/resource/webmeter/cs/20240724/ddc49b4375284027b11ce2c86fde47b0.png',
196
+ id: '52749',
197
+ f_filename: '3.png',
198
+ f_stock_id: 1,
199
+ f_realpath: 'D:\\nginx-resource\\resource\\webmeter/cs/20240724/ddc49b4375284027b11ce2c86fde47b0.png',
200
+ f_operator: '1',
201
+ fusetype: 'Default'
202
+ },
203
+ url: '/apply-image/resource/webmeter/cs/20240724/ddc49b4375284027b11ce2c86fde47b0.png',
204
+ id: '52749'
205
+ },
206
+ {
207
+ uid: 'vc-upload-1721804393350-6',
208
+ name: '3.png',
209
+ status: 'done',
210
+ response: {
211
+ f_filetype: 'png',
212
+ f_file_size: 0.0003,
213
+ f_form_type: 'image',
214
+ f_use_type: 'Default',
215
+ f_downloadpath: '/apply-image/resource/webmeter/cs/20240724/ddc49b4375284027b11ce2c86fde47b0.png',
216
+ id: '52749',
217
+ f_filename: '3.png',
218
+ f_stock_id: 1,
219
+ f_realpath: 'D:\\nginx-resource\\resource\\webmeter/cs/20240724/ddc49b4375284027b11ce2c86fde47b0.png',
220
+ f_operator: '1',
221
+ fusetype: 'Default'
222
+ },
223
+ url: '/apply-image/resource/webmeter/cs/20240724/ddc49b4375284027b11ce2c86fde47b0.png',
224
+ id: '52749'
225
+ },
226
+ ]
83
227
  }
84
228
  },
85
229
  total: 1,
86
- registerMap: []
230
+ registerMap: [],
231
+ displayOnly: false,
232
+ showReport: true
87
233
  }
88
234
  },
89
235
  methods: {
@@ -91,7 +237,19 @@ export default {
91
237
  console.warn('demo', data)
92
238
  },
93
239
  testExport () {
94
- exportHTMLNodeToPDF('123', '#test')
240
+ this.showReport = false
241
+ this.displayOnly = true
242
+ this.$nextTick(() => {
243
+ this.showReport = true
244
+ setTimeout(() => {
245
+ exportHTMLNodeToPDF('123', '#test')
246
+ this.showReport = false
247
+ this.displayOnly = false
248
+ this.$nextTick(() => {
249
+ this.showReport = true
250
+ })
251
+ }, 500)
252
+ })
95
253
  },
96
254
  testSave () {
97
255
  const result = []
@@ -54,6 +54,7 @@
54
54
  <template v-if="!forDisplay">
55
55
  <x-report-tr-group
56
56
  @updateImg="updateImg"
57
+ :show-img-in-cell="showImgInCell"
57
58
  :img-prefix="imgPrefix"
58
59
  :server-name="serverName"
59
60
  :use-oss-for-img="useOssForImg"
@@ -67,6 +68,7 @@
67
68
  <template v-else>
68
69
  <x-report-tr-group
69
70
  @updateImg="updateImg"
71
+ :show-img-in-cell="showImgInCell"
70
72
  :img-prefix="imgPrefix"
71
73
  :server-name="serverName"
72
74
  :use-oss-for-img="useOssForImg"
@@ -85,6 +87,7 @@
85
87
  <template v-if="!forDisplay">
86
88
  <x-report-tr-group
87
89
  @updateImg="updateImg"
90
+ :show-img-in-cell="showImgInCell"
88
91
  :img-prefix="imgPrefix"
89
92
  :server-name="serverName"
90
93
  :use-oss-for-img="useOssForImg"
@@ -99,6 +102,7 @@
99
102
  <template v-else>
100
103
  <x-report-tr-group
101
104
  @updateImg="updateImg"
105
+ :show-img-in-cell="showImgInCell"
102
106
  :img-prefix="imgPrefix"
103
107
  :server-name="serverName"
104
108
  :use-oss-for-img="useOssForImg"
@@ -118,6 +122,7 @@
118
122
  <template v-if="forDisplay">
119
123
  <x-report-tr-group
120
124
  @updateImg="updateImg"
125
+ :show-img-in-cell="showImgInCell"
121
126
  :img-prefix="imgPrefix"
122
127
  :server-name="serverName"
123
128
  :use-oss-for-img="useOssForImg"
@@ -134,6 +139,7 @@
134
139
  <template v-if="!forDisplay">
135
140
  <x-report-tr-group
136
141
  @updateImg="updateImg"
142
+ :show-img-in-cell="showImgInCell"
137
143
  :img-prefix="imgPrefix"
138
144
  :server-name="serverName"
139
145
  :use-oss-for-img="useOssForImg"
@@ -148,6 +154,7 @@
148
154
  <!-- 动态行交互按钮 -->
149
155
  <x-report-tr-group
150
156
  @updateImg="updateImg"
157
+ :show-img-in-cell="showImgInCell"
151
158
  :img-prefix="imgPrefix"
152
159
  :server-name="serverName"
153
160
  :use-oss-for-img="useOssForImg"
@@ -192,6 +199,10 @@ export default {
192
199
  require: true,
193
200
  default: () => {}
194
201
  },
202
+ showImgInCell: {
203
+ type: Boolean,
204
+ default: false
205
+ },
195
206
  // 是否是展示用
196
207
  forDisplay: {
197
208
  type: Boolean,
@@ -66,9 +66,19 @@
66
66
  </template>
67
67
  <template v-else>
68
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>
69
+ <div style="display: flex; align-items: end; justify-content: space-evenly; flex-wrap: wrap">
70
+ <template v-for="(img,imgIndex) in getDeepObject(configData, cell.dataIndex)">
71
+ <template v-if="showImgInCell">
72
+ <div :key="imgIndex">
73
+ <img :src="img.url" alt="图片"/>
74
+ <p>{{ img.name }}</p>
75
+ </div>
76
+ </template>
77
+ <template v-else>
78
+ <span :key="imgIndex" style="margin-right: 5%">{{ img.name }}</span>
79
+ </template>
80
+ </template>
81
+ </div>
72
82
  </template>
73
83
  <template v-else>
74
84
  <span style="margin-right: 5%">{{ formatImgStr(getDeepObject(configData, cell.dataIndex))[0].name }}</span>
@@ -366,6 +376,10 @@ export default {
366
376
  type: Array,
367
377
  required: true
368
378
  },
379
+ showImgInCell: {
380
+ type: Boolean,
381
+ default: false
382
+ },
369
383
  config: {
370
384
  type: Object,
371
385
  default: function () {
@@ -157,7 +157,20 @@
157
157
  <div v-if="editorPanelCurrent[0] === 'properties'">
158
158
  <div v-if="editorPropertiesConfig.props !== undefined">
159
159
  <div v-if="editorPropertiesConfig.span">
160
- 栅格数:<a-input :default-value="editorPropertiesConfig.span" @change="changeSpan" :key="editorPropertiesConfig.id"/>
160
+ 栅格数:
161
+ <a-row>
162
+ <a-col :span="16">
163
+ <a-slider
164
+ :id="editorPropertiesConfig.id"
165
+ :max="24"
166
+ :min="1"
167
+ v-model="editorPropertiesConfig.span"
168
+ @change="changeSpan" />
169
+ </a-col>
170
+ <a-col :span="7">
171
+ <a-input-number v-model="editorPropertiesConfig.span" :min="1" :max="24" style="margin-left: 16px; width: 100%" />
172
+ </a-col>
173
+ </a-row>
161
174
  </div>
162
175
  <template v-for="(value,key) in editorPropertiesConfig.props">
163
176
  <div :key="editorPropertiesConfig.id + '_' + key">
@@ -238,19 +251,19 @@
238
251
  <a-input v-model="eventEditorContent.customEmitType"/>
239
252
  </a-form-item>
240
253
  <!-- 事件类型 -->
241
- <a-form-item label="事件类型" v-if="eventEditorContent.emitType !== 'lifeCycle'">
254
+ <a-form-item label="事件类型" v-if="eventEditorContent.emitType && eventEditorContent.emitType !== 'lifeCycle'">
242
255
  <a-select @change="handleEventEditorEventTypeChange" :default-value="eventEditorContent.eventType">
243
- <a-select-option value="changeValue">
244
- 修改组件的值
256
+ <a-select-option value="runFunction">
257
+ 调用组件方法
245
258
  </a-select-option>
246
259
  <a-select-option value="changeProps">
247
260
  修改组件的Props
248
261
  </a-select-option>
249
262
  <a-select-option value="runLogic">
250
- 执行Logic
263
+ 发送后端请求
251
264
  </a-select-option>
252
265
  <a-select-option value="log">
253
- 打印日志
266
+ 调试日志
254
267
  </a-select-option>
255
268
  <a-select-option value="showModal" v-if="this.config.page.filter(page => page.type === 'modal').length > 0">
256
269
  修改弹框可见
@@ -258,6 +271,9 @@
258
271
  <a-select-option value="showDraw" v-if="this.config.page.filter(page => page.type === 'draw').length > 0">
259
272
  修改抽屉可见
260
273
  </a-select-option>
274
+ <a-select-option value="customJSFunction" v-if="eventEditorContent.emitType !== 'lifeCycle'">
275
+ 自定义JS
276
+ </a-select-option>
261
277
  </a-select>
262
278
  </a-form-item>
263
279
  <!-- 生命周期函数 -->
@@ -320,21 +336,9 @@
320
336
  </a-select>
321
337
  </a-form-item>
322
338
  <!-- Logic名 -->
323
- <a-form-item label="Logic名" v-if="eventEditorContent.eventType === 'runLogic'">
339
+ <a-form-item label="后端Api" v-if="eventEditorContent.eventType === 'runLogic'">
324
340
  <a-input v-model="eventEditorContent.logicName"/>
325
341
  </a-form-item>
326
- <!-- 服务名 -->
327
- <a-form-item label="服务名" v-if="eventEditorContent.eventType === 'runLogic'">
328
- <a-input v-model="eventEditorContent.serviceName"/>
329
- </a-form-item>
330
- <!-- 自定义Logic参数,由哪些组件传递 -->
331
- <a-form-item label="Logic参数取值组件" v-if="eventEditorContent.eventType === 'runLogic'">
332
- <a-transfer
333
- :data-source="logicParamTransferDataSource"
334
- :render="item => item.title"
335
- :target-keys="eventEditorContent.logicParamTransfer"
336
- @change="handleLogicParamTransferChange"/>
337
- </a-form-item>
338
342
  <!-- 自定义Logic参数 -->
339
343
  <a-form-item label="自定义Logic参数" v-if="eventEditorContent.eventType === 'runLogic'">
340
344
  <a-button type="primary" @click="openLogicParamJSEditor">
@@ -348,7 +352,7 @@
348
352
  </a-button>
349
353
  </a-form-item>
350
354
  <!-- 修改组件的值 才会显示的其余参数 -->
351
- <template v-if="eventEditorContent.eventType === 'changeValue' || eventEditorContent.eventType === 'changeProps'">
355
+ <template v-if="eventEditorContent.eventType === 'runFunction' || eventEditorContent.eventType === 'changeProps'">
352
356
  <!-- 目标组件 -->
353
357
  <a-form-item label="目标组件">
354
358
  <a-select @change="handleEventEditorTargetChange" :default-value="eventEditorContent.target">
@@ -360,21 +364,22 @@
360
364
  </a-select-option>
361
365
  </a-select>
362
366
  </a-form-item>
363
- <!-- 目标组件执行事件名 -->
364
- <a-form-item label="目标组件执行事件名" v-if="eventEditorContent.eventName === 'changeValue'">
367
+ <!-- 目标组件执行事件 -->
368
+ <a-form-item label="目标组件执行事件" v-if="eventEditorContent.eventType === 'runFunction' && eventEditorContent.target !== undefined">
365
369
  <a-select @change="handleEventEditorTargetEventTypeChange" :default-value="eventEditorContent.eventName">
366
- <a-select-option :value="eventType" v-for="(eventType,eventTypeIndex) in supportedEventType" :key="'eventType_' + eventTypeIndex">
367
- {{ eventType }}
370
+ <a-select-option :value="eventType.name" v-for="(eventType,eventTypeIndex) in targetComponentMethods" :key="'eventType_' + eventTypeIndex">
371
+ {{ eventType.str }}
368
372
  </a-select-option>
369
373
  </a-select>
374
+ <p v-if="targetComponentEventDesc !== undefined">{{ targetComponentEventDesc }}</p>
370
375
  </a-form-item>
371
376
  <!-- 目标组件修改值对应的key -->
372
- <a-form-item label="目标组件修改值对应的key" v-if="eventEditorContent.target !== undefined">
377
+ <a-form-item label="对应的key" v-if="eventEditorContent.target !== undefined && eventEditorContent.eventType === 'changeProps'">
373
378
  <a-input v-model="eventEditorContent.targetKey"/>
374
379
  </a-form-item>
375
380
  </template>
376
381
  <!-- 自定义JS方法 -->
377
- <a-form-item label="自定义JS方法" v-if="eventEditorContent.emitType !== 'lifeCycle'">
382
+ <a-form-item label="自定义JS方法" v-if="eventEditorContent.emitType !== 'lifeCycle' && eventEditorContent.eventType === 'customJSFunction'">
378
383
  <a-button type="primary" @click="openEventJSEditor">打开编辑器</a-button>
379
384
  </a-form-item>
380
385
  <!-- 自定义钩子函数 -->
@@ -625,8 +630,6 @@ export default {
625
630
  activeMainPage: undefined,
626
631
  // 保存主体中,当前激活的标签栏类型
627
632
  activeMainPageType: undefined,
628
- // 定义Logic参数从哪些组件获取
629
- logicParamTransferDataSource: [],
630
633
  // 添加页面容器参数
631
634
  addComponentTemp: { type: 'page' },
632
635
  // 控制添加页面容器弹框显隐
@@ -636,7 +639,11 @@ export default {
636
639
  // 指定架构树选中哪个节点
637
640
  selectTreeNode: undefined,
638
641
  // 禁用事件编辑
639
- disableEventEditor: false
642
+ disableEventEditor: false,
643
+ // 目标组件暴露出的事件
644
+ targetComponentMethods: [],
645
+ // 目标组件已选择的事件描述
646
+ targetComponentEventDesc: undefined
640
647
  }
641
648
  },
642
649
  provide () {
@@ -850,8 +857,10 @@ export default {
850
857
  const targetDef = propsDef[key]
851
858
  if (!targetDef.label) {
852
859
  targetDef.label = key
853
- targetDef.desc = '未配置该参数的说明!'
854
- } else if (!targetDef.desc) {
860
+ } else {
861
+ targetDef.label = targetDef.label + '(' + key + ')'
862
+ }
863
+ if (!targetDef.desc) {
855
864
  targetDef.desc = '未配置该参数的说明!'
856
865
  }
857
866
  return targetDef
@@ -872,15 +881,12 @@ export default {
872
881
  // 页面中插入行
873
882
  if (type === 'page-row') {
874
883
  const content = copyCache.content
875
- const contentKeys = Object.keys(content)
876
- const result = []
877
- contentKeys.forEach(key => {
878
- result.push(content[key])
879
- })
880
- target.body.push(result)
884
+ const pageId = target.id
885
+ content.id = pageId + '_' + target.body.length
886
+ target.body.push(content)
881
887
  } else if (type === 'row-item') {
882
888
  // 行中插入组件
883
- target.push(copyCache.content)
889
+ target.body.push(copyCache.content)
884
890
  } else if (type === 'page') {
885
891
  // 复制页面
886
892
  this.config.page.push(copyCache)
@@ -890,7 +896,7 @@ export default {
890
896
  },
891
897
  // span属性通过input框修改
892
898
  changeSpan (event) {
893
- this.editorPropertiesConfig.span = event.target.value
899
+ this.editorPropertiesConfig.span = event
894
900
  },
895
901
  // logic从组件中取值穿梭框改变事件
896
902
  handleLogicParamTransferChange (targetKeys, direction, moveKeys) {
@@ -928,7 +934,7 @@ export default {
928
934
  }
929
935
  // 将组件选中
930
936
  this.clickComponentInEditor(target)
931
- if (!id.includes('container')) {
937
+ if (!id.includes('container') && !(id.includes('page') && id.length > 11)) {
932
938
  this.twink(id)
933
939
  }
934
940
  },
@@ -992,12 +998,9 @@ export default {
992
998
  case 'row':
993
999
  // 移动行
994
1000
  // 拿到父容器和目标Index
995
- console.warn('dropKey', dropKey)
996
1001
  dropConfig = lowcodeUtils.getPageIdAndRowIndexByRowId(dropKey)
997
- console.warn('dropConfig', dropConfig)
998
1002
  target = lowcodeUtils.getPageConfigById(dropConfig.pageId, this.config)
999
1003
  // 保存目标
1000
- console.warn('target', targetCache)
1001
1004
  targetCache = target.body[dropConfig.rowIndex]
1002
1005
  // 插入
1003
1006
  if (dropPosition < 0) {
@@ -1052,6 +1055,14 @@ export default {
1052
1055
  break
1053
1056
  }
1054
1057
  }
1058
+ if (father.length === 0) {
1059
+ father.push({
1060
+ type: 'container',
1061
+ selected: false,
1062
+ span: 24,
1063
+ id: 'container_' + lowcodeUtils.nanoidWithoutSymbol(6)
1064
+ })
1065
+ }
1055
1066
  break
1056
1067
  case 'container_page':
1057
1068
  // 移动容器页面
@@ -1091,6 +1102,14 @@ export default {
1091
1102
  break
1092
1103
  }
1093
1104
  }
1105
+ if (father.length === 0) {
1106
+ father.push({
1107
+ type: 'container',
1108
+ selected: false,
1109
+ span: 24,
1110
+ id: 'container_' + lowcodeUtils.nanoidWithoutSymbol(6)
1111
+ })
1112
+ }
1094
1113
  }
1095
1114
  break
1096
1115
  case 'higher':
@@ -1119,6 +1138,14 @@ export default {
1119
1138
  break
1120
1139
  }
1121
1140
  }
1141
+ if (father.length === 0) {
1142
+ father.push({
1143
+ type: 'container',
1144
+ selected: false,
1145
+ span: 24,
1146
+ id: 'container_' + lowcodeUtils.nanoidWithoutSymbol(6)
1147
+ })
1148
+ }
1122
1149
  break
1123
1150
  case 'container_page':
1124
1151
  // 子页面插行
@@ -1131,6 +1158,14 @@ export default {
1131
1158
  break
1132
1159
  }
1133
1160
  }
1161
+ if (father.length === 0) {
1162
+ father.push({
1163
+ type: 'container',
1164
+ selected: false,
1165
+ span: 24,
1166
+ id: 'container_' + lowcodeUtils.nanoidWithoutSymbol(6)
1167
+ })
1168
+ }
1134
1169
  break
1135
1170
  }
1136
1171
  break
@@ -1227,7 +1262,14 @@ export default {
1227
1262
  const pageId = id.substring(0, id.length - 2)
1228
1263
  const rowId = id.substring(id.length - 1)
1229
1264
  const page = lowcodeUtils.getPageConfigById(pageId, this.config)
1230
- page.body.splice(rowId - 1, 1)
1265
+ page.body.splice(rowId, 1)
1266
+ // 如果该列下没有任何内容,则将该列还原为容器
1267
+ if (page.body.length === 0) {
1268
+ const outerContainer = lowcodeUtils.getContainerPageOuterByContainerPageId(page.id, this.config)
1269
+ outerContainer.type = 'container'
1270
+ outerContainer.selected = false
1271
+ delete outerContainer.page
1272
+ }
1231
1273
  this.targetContainer = undefined
1232
1274
  this.editorPropertiesConfig = {}
1233
1275
  this.refreshOrganization()
@@ -1276,6 +1318,14 @@ export default {
1276
1318
  row.body[0].span += deletedSpan
1277
1319
  }
1278
1320
  }
1321
+ if (row.body.length === 0) {
1322
+ row.body.push({
1323
+ type: 'container',
1324
+ selected: false,
1325
+ span: 24,
1326
+ id: 'container_' + lowcodeUtils.nanoidWithoutSymbol(6)
1327
+ })
1328
+ }
1279
1329
  // 从注册的全局Map中删除
1280
1330
  delete this.$children[0]._provided.componentsMap[id]
1281
1331
  this.targetContainer = undefined
@@ -1352,6 +1402,13 @@ export default {
1352
1402
  // 如果删除后只剩一个容器,将该容器span设置为24
1353
1403
  if (row.body.length === 1) {
1354
1404
  row.body[0].span = 24
1405
+ } else if (row.body.length === 0) {
1406
+ row.body.push({
1407
+ type: 'container',
1408
+ selected: false,
1409
+ span: 24,
1410
+ id: 'container_' + lowcodeUtils.nanoidWithoutSymbol(6)
1411
+ })
1355
1412
  }
1356
1413
  this.refreshOrganization()
1357
1414
  },
@@ -1382,24 +1439,42 @@ export default {
1382
1439
  ...this.eventEditorContent
1383
1440
  })
1384
1441
  }
1442
+ this.targetComponentMethods = []
1443
+ this.targetComponentEventDesc = undefined
1385
1444
  this.showEventEditor = false
1386
1445
  this.eventEditorContent = {}
1387
1446
  this.eventEditorCurrent = undefined
1388
1447
  },
1389
1448
  // 关闭事件编辑器弹框
1390
1449
  handleEventEditorCancel () {
1450
+ this.targetComponentMethods = []
1451
+ this.targetComponentEventDesc = undefined
1391
1452
  this.showEventEditor = false
1392
1453
  this.eventEditorContent = {}
1393
1454
  this.eventEditorCurrent = undefined
1394
1455
  },
1395
1456
  // 事件编辑器中,触发类型改变
1396
1457
  handleEventEditorTypeChange (type) {
1458
+ this.eventEditorContent = {}
1397
1459
  this.eventEditorContent.emitType = type
1398
1460
  this.$forceUpdate()
1399
1461
  },
1400
1462
  // 事件编辑器中,目标组件改变
1401
1463
  handleEventEditorTargetChange (target) {
1464
+ this.targetComponentMethods = []
1402
1465
  this.eventEditorContent.target = target
1466
+ // 将目标组件暴露的方法,填入单选框
1467
+ const targetType = target.split('_')[0]
1468
+ const editorConfig = lowcodeUtils.getEditorConfigByType(targetType)
1469
+ editorConfig.selfMethods.forEach(eachMethod => {
1470
+ // str用于下拉框中显示,包含函数名和形参
1471
+ const methodStr = eachMethod.name + '(' + eachMethod.params + ')'
1472
+ this.targetComponentMethods.push({
1473
+ str: methodStr,
1474
+ desc: eachMethod.desc,
1475
+ name: eachMethod.name
1476
+ })
1477
+ })
1403
1478
  this.$forceUpdate()
1404
1479
  },
1405
1480
  handleEventEditorLifeCycleChange (lifeCycleName) {
@@ -1407,25 +1482,19 @@ export default {
1407
1482
  },
1408
1483
  // 事件编辑器中,事件类型改变
1409
1484
  handleEventEditorEventTypeChange (type) {
1410
- const componentsMap = this.$children[0]._provided.componentsMap
1411
- this.eventEditorContent.eventType = type
1412
- this.logicParamTransferDataSource = []
1413
- // 如果事件为运行Logic将组件加入穿梭框
1414
- if (type === 'runLogic') {
1415
- const keys = Object.keys(componentsMap)
1416
- keys.forEach(key => {
1417
- const name = lowcodeUtils.getComponentNameById(key, this.config)
1418
- this.logicParamTransferDataSource.push({
1419
- key: key,
1420
- title: name,
1421
- })
1422
- })
1423
- this.eventEditorContent.logicParamTransfer = []
1485
+ this.eventEditorContent = {
1486
+ emitType: this.eventEditorContent.emitType
1424
1487
  }
1488
+ this.eventEditorContent.eventType = type
1425
1489
  this.$forceUpdate()
1426
1490
  },
1427
1491
  // 事件编辑器中,目标组件执行事件类型改变
1428
1492
  handleEventEditorTargetEventTypeChange (type) {
1493
+ this.targetComponentMethods.forEach(eachMethod => {
1494
+ if (eachMethod.name === type) {
1495
+ this.targetComponentEventDesc = eachMethod.desc
1496
+ }
1497
+ })
1429
1498
  this.eventEditorContent.eventName = type
1430
1499
  this.$forceUpdate()
1431
1500
  },
@@ -1686,6 +1755,13 @@ export default {
1686
1755
  }
1687
1756
  // 如果选中的是容器页面
1688
1757
  if (configItem.type === 'container_page') {
1758
+ // 选中容器页面中所有组件
1759
+ lowcodeUtils.unCheckAll(this.config)
1760
+ configItem.page.forEach(page => {
1761
+ page.body.forEach(row => {
1762
+ lowcodeUtils.checkRowAll(row)
1763
+ })
1764
+ })
1689
1765
  this.editorPropertiesConfig = configItem
1690
1766
  this.disableEventEditor = true
1691
1767
  this.editorPropertiesConfig.props = {}
@@ -1694,6 +1770,7 @@ export default {
1694
1770
 
1695
1771
  // 如果选中的是行
1696
1772
  if (configItem.type === 'row' || !configItem.type) {
1773
+ lowcodeUtils.checkRowAll(configItem, this.config)
1697
1774
  this.editorPropertiesConfig = configItem
1698
1775
  this.disableEventEditor = true
1699
1776
  this.editorPropertiesConfig.props = {}
@@ -1758,6 +1835,63 @@ export default {
1758
1835
  this.supportedEventType = [...lowcodeComponentMixin.supportedEventType]
1759
1836
  // 深拷贝外侧传来的配置
1760
1837
  this.config = JSON.parse(JSON.stringify(this.originalConfig))
1838
+ this.config = {
1839
+ page: [
1840
+ {
1841
+ id: 'page_gmSWjh',
1842
+ type: 'page',
1843
+ title: '1',
1844
+ body: [
1845
+ {
1846
+ id: 'page_gmSWjh_0',
1847
+ config: {},
1848
+ type: 'row',
1849
+ body: [
1850
+ {
1851
+ type: 'container_page',
1852
+ span: 24,
1853
+ id: 'container_LsS5uq',
1854
+ page: [
1855
+ {
1856
+ id: 'container_page_U4',
1857
+ type: 'page',
1858
+ body: [
1859
+ {
1860
+ id: 'container_page_U4_0',
1861
+ type: 'row',
1862
+ config: {},
1863
+ body: [
1864
+ {
1865
+ type: 'container',
1866
+ selected: false,
1867
+ span: 24,
1868
+ id: 'container_3xuSvW'
1869
+ }
1870
+ ]
1871
+ },
1872
+ {
1873
+ id: 'container_page_U4_1',
1874
+ type: 'row',
1875
+ config: {},
1876
+ body: [
1877
+ {
1878
+ type: 'container',
1879
+ selected: false,
1880
+ span: 24,
1881
+ id: 'container_mC-Es1'
1882
+ }
1883
+ ]
1884
+ }
1885
+ ]
1886
+ }
1887
+ ]
1888
+ }
1889
+ ]
1890
+ }
1891
+ ]
1892
+ }
1893
+ ]
1894
+ }
1761
1895
  this.refreshOrganization()
1762
1896
  }
1763
1897
  }
@@ -29,7 +29,7 @@ export function getEditorConfigByType (componentType) {
29
29
  result = registeredConfig[key]
30
30
  }
31
31
  })
32
- return result
32
+ return JSON.parse(JSON.stringify(result))
33
33
  }
34
34
 
35
35
  // 根据组件的id获取页面容器
@@ -227,22 +227,32 @@ export function getRowConfigById (id, config) {
227
227
  const rowIndex = id.substring(lastIndex + 1)
228
228
  const pageId = id.substring(0, lastIndex)
229
229
  const page = getPageConfigById(pageId, config)
230
- return page.body[rowIndex - 1]
231
- // for (let i = 0; i < config.page.length; i++) {
232
- // const page = config.page[i]
233
- // if (page.id === pageId) {
234
- // return page.body[rowIndex]
235
- // }
236
- // }
230
+ let result = page.body[rowIndex]
231
+ if (result === undefined) {
232
+ config.page.forEach(page => {
233
+ page.body.forEach(row => {
234
+ row.body.forEach(item => {
235
+ if (item.type === 'container_page') {
236
+ result = getRowConfigById(id, item)
237
+ if (result) {
238
+ return result
239
+ }
240
+ }
241
+ })
242
+ })
243
+ })
244
+ } else {
245
+ return result
246
+ }
237
247
  }
238
248
 
239
249
  // 根据id获取配置,根据id的长度自动判断类型
240
250
  export function getConfig (id, config) {
241
251
  let result
242
- if (id.startsWith('page') && id.length <= 11) {
252
+ if ((id.startsWith('page') && id.length <= 11) || (id.startsWith('container_page') && id.length <= 17)) {
243
253
  // page
244
254
  result = getPageConfigById(id, config)
245
- } else if (id.startsWith('page') && id.length > 11) {
255
+ } else if ((id.startsWith('page') && id.length > 11) || (id.startsWith('container_page') && id.length > 17)) {
246
256
  // row
247
257
  result = getRowConfigById(id, config)
248
258
  } else {
@@ -267,6 +277,24 @@ export function unCheckAll (config) {
267
277
  })
268
278
  }
269
279
 
280
+ // 取消选择所有容器
281
+ export function checkRowAll (row, config = undefined) {
282
+ if (config) {
283
+ unCheckAll(config)
284
+ }
285
+ row.body.forEach(item => {
286
+ if (item.type === 'container') {
287
+ item.selected = true
288
+ } else if (item.type === 'container_page') {
289
+ item.page.forEach(page => {
290
+ page.body.forEach(subRow => {
291
+ checkRowAll(subRow)
292
+ })
293
+ })
294
+ }
295
+ })
296
+ }
297
+
270
298
  // 根据组件id获取它的name,如果没有name则返回id
271
299
  export function getComponentNameById (id, config) {
272
300
  const targetConfig = getComponentConfig(id, config)
@@ -281,13 +309,16 @@ export function getComponentNameById (id, config) {
281
309
  export function reRandomComponentId (config) {
282
310
  config.page.forEach(page => {
283
311
  const pagePrefix = getIdPrefix(page.id)
284
- page.id = pagePrefix + '_' + nanoidWithoutSymbol(2)
285
- page.body.forEach(row => {
312
+ const pageNewId = pagePrefix + '_' + nanoidWithoutSymbol(2)
313
+ page.id = pageNewId
314
+ for (let i = 0; i < page.body.length; i++) {
315
+ const row = page.body[i]
316
+ row.id = pageNewId + '_' + i
286
317
  row.body.forEach(item => {
287
318
  const itemPrefix = getIdPrefix(item.id)
288
319
  item.id = itemPrefix + '_' + nanoidWithoutSymbol(6)
289
320
  })
290
- })
321
+ }
291
322
  })
292
323
  return config
293
324
  }
package/vue.config.js CHANGED
@@ -33,6 +33,9 @@ module.exports = {
33
33
  port: 8001,
34
34
  // If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
35
35
  proxy: {
36
+ // '/apply-image': {
37
+ // target: revenue,
38
+ // },
36
39
  '/rs': {
37
40
  target: v3Server,
38
41
  ws: false,