vue2-client 1.8.16 → 1.8.18

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.
@@ -15,14 +15,19 @@
15
15
  :rules="rules"
16
16
  :wrapper-col="wrapperCol"
17
17
  >
18
- <a-form-model-item label="参数组名称" prop="group">
19
- <a-input v-model="form.group" placeholder="设置表单项的组名,如:设置上报参数" />
20
- </a-form-model-item>
21
- <a-form-model-item label="参数组描述" prop="describe">
22
- <a-input v-model="form.describe" placeholder="简单描述参数组,如:用于配置物联网设备的上报参数" />
23
- </a-form-model-item>
18
+ <template v-if="asAParamsGroup">
19
+ <a-form-model-item label="参数组名称" prop="group">
20
+ <a-input v-model="form.group" placeholder="设置表单项的组名,如:设置上报参数" />
21
+ </a-form-model-item>
22
+ <a-form-model-item label="参数组描述" prop="describe">
23
+ <a-input v-model="form.describe" placeholder="简单描述参数组,如:用于配置物联网设备的上报参数" />
24
+ </a-form-model-item>
25
+ </template>
24
26
  <a-form-model-item label="数据字段" prop="column">
25
- <a-button type="primary" @click="addColumnItem()">增加</a-button>
27
+ <a-space>
28
+ <a-button type="primary" @click="addColumnItem()">增加</a-button>
29
+ <a-button icon="import" @click="$message.warn('从创意库中选择并引用高质量的通用表单项配置,敬请期待')">从创意库引入</a-button>
30
+ </a-space>
26
31
  <a-row :gutter="24">
27
32
  <a-col :span="11">
28
33
  <span style="font-weight: bold">
@@ -44,7 +49,6 @@
44
49
  <div
45
50
  v-for="(columnItem, index) in form.column"
46
51
  :key="index"
47
- class="column_item"
48
52
  draggable="true"
49
53
  @dragend="handleDragEnd($event, columnItem)"
50
54
  @dragenter="handleDragEnter($event, columnItem)"
@@ -53,7 +57,7 @@
53
57
  <a-row v-if="ending && dragging && columnItem.key === ending.key && dragging.key !== ending.key" class="dragTipsWarp">
54
58
  <span class="dragTips">拖到此处放置</span>
55
59
  </a-row>
56
- <a-row :gutter="24">
60
+ <a-row :gutter="24" class="column_item">
57
61
  <a-col :span="11">
58
62
  <span style="font-weight: bold">
59
63
  {{ columnItem.title }}
@@ -73,41 +77,9 @@
73
77
  </a-row>
74
78
  </div>
75
79
  </a-form-model-item>
76
- <!-- 暂时不需要 -->
77
- <!-- <a-form-model-item label="接口插槽" prop="apiSlot">
78
- <a-popover placement="right" title="说明">
79
- <template slot="content">
80
- <p>通过插槽,你可以轻松扩展查询配置的默认业务,配置的插槽会根据类型在默认业务的前后执行,类似于切面</p>
81
- <p><span style="color: #FF0000">注意:插槽不应改变默认的业务行为</span></p>
82
- <p>如果配置了业务执行前插槽,<br/>执行默认业务前会先执行设置的插槽logic,传给插槽的参数为data本身</p>
83
- <p>如果配置了业务执行后插槽,<br/>执行默认业务后会执行设置的插槽logic,传给插槽的参数为默认业务的返回值</p>
84
- <img src="@vue2-client/assets/img/querySlotDemo.svg" style="zoom:0.5">
85
- </template>
86
- <a-button type="primary" @click="addApiSlot()">增加</a-button>
87
- </a-popover>
88
- <div
89
- v-for="(columnItem, index) in form.apiSlotView"
90
- :key="index"
91
- >
92
- <a-input v-model="columnItem.slotName" placeholder="插槽logic名称">
93
- <a-select slot="addonBefore" v-model="columnItem.slotType" style="width: 10rem" placeholder="选择插槽类型">
94
- <a-select-option
95
- v-for="item in apiSlotData"
96
- :key="item.value"
97
- :value="item.value">
98
- {{ item.label }}
99
- </a-select-option>
100
- </a-select>
101
- <a-icon slot="addonAfter" type="close" @click="removeApiSlotItem(index)"/>
102
- </a-input>
103
- </div>
104
- </a-form-model-item> -->
105
80
  </a-form-model>
106
81
  <create-simple-form-query-item ref="queryItem" @getColumn="getColumn" @itemHandle="itemHandle"/>
107
- <a-space>
108
- <a-button type="default" @click="view">预览</a-button>
109
- <a-button type="primary" @click="submit">保存</a-button>
110
- </a-space>
82
+ <a-button type="primary" @click="view">操作</a-button>
111
83
  </a-col>
112
84
  <a-col :lg="12" :md="12" :sm="24" :xl="6" :xs="24">
113
85
  <a-card :bordered="false" size="small" style="overflow: auto" title="预览">
@@ -119,18 +91,18 @@
119
91
  </a-card>
120
92
  </a-col>
121
93
  </a-row>
122
- <x-add-form ref="xAddForm"/>
94
+ <x-add-form ref="xAddForm" @onSubmit="submit"/>
123
95
  </a-drawer>
124
96
  </template>
125
97
 
126
98
  <script>
127
- import CreateSimpleFormQueryItem from './CreateSimpleFormQueryItem'
128
- import XAddForm from '@vue2-client/base-client/components/common/XAddForm/XAddForm'
99
+ import XAddForm from '@vue2-client/base-client/components/common/XAddForm'
129
100
  import JsonViewer from 'vue-json-viewer'
130
101
  import FileSaver from 'file-saver'
131
102
  import { mapState } from 'vuex'
132
- import { post } from '@vue2-client/services/api'
103
+ import CreateSimpleFormQueryItem from './CreateSimpleFormQueryItem'
133
104
  import { parseConfigUrl } from '@vue2-client/services/api/common'
105
+ import { post } from '@vue2-client/services/api'
134
106
 
135
107
  export default {
136
108
  name: 'CreateSimpleFormQuery',
@@ -148,8 +120,8 @@ export default {
148
120
  labelCol: { span: 3 },
149
121
  wrapperCol: { span: 18 },
150
122
  form: {
151
- group: '',
152
- describe: '',
123
+ group: undefined,
124
+ describe: undefined,
153
125
  column: [],
154
126
  apiSlotView: [],
155
127
  apiSlot: {},
@@ -159,10 +131,6 @@ export default {
159
131
  selectIndex: null,
160
132
  selectType: undefined,
161
133
  joinArray: [],
162
- rules: {
163
- group: [{ required: true, message: '请输入参数组名称', trigger: 'blur' }],
164
- describe: [{ required: true, message: '请输入参数组描述', trigger: 'blur' }]
165
- },
166
134
  ending: null,
167
135
  dragging: null,
168
136
  // 操作按钮状态集合
@@ -182,20 +150,34 @@ export default {
182
150
  this.initView()
183
151
  },
184
152
  computed: {
185
- ...mapState('setting', ['isMobile'])
153
+ ...mapState('setting', ['isMobile']),
154
+ rules () {
155
+ return this.asAParamsGroup ? {
156
+ group: [{ required: true, message: '请输入参数组名称', trigger: 'blur' }],
157
+ describe: [{ required: true, message: '请输入参数组描述', trigger: 'blur' }]
158
+ } : {}
159
+ },
186
160
  },
187
161
  props: {
188
162
  visible: {
189
163
  type: Boolean,
190
164
  default: false
191
165
  },
192
- serviceName: {
193
- type: String,
194
- default: undefined
166
+ asAParamsGroup: {
167
+ type: Boolean,
168
+ default: false
195
169
  },
196
170
  toEditJson: {
197
171
  type: Object,
198
172
  default: () => {}
173
+ },
174
+ saveExportJson: {
175
+ type: Boolean,
176
+ default: false
177
+ },
178
+ serviceName: {
179
+ type: String,
180
+ default: undefined
199
181
  }
200
182
  },
201
183
  watch: {
@@ -214,8 +196,6 @@ export default {
214
196
  // 处理具体表单项
215
197
  this.form = Object.assign(
216
198
  {
217
- group: '',
218
- describe: '',
219
199
  apiSlotView: [],
220
200
  apiSlot: {},
221
201
  column: []
@@ -290,6 +270,7 @@ export default {
290
270
  this.result = {}
291
271
  },
292
272
  onClose () {
273
+ this.$emit('close')
293
274
  this.$emit('update:visible', false)
294
275
  },
295
276
  addJoinItem () {
@@ -298,7 +279,7 @@ export default {
298
279
  },
299
280
  itemHandle (item, type) {
300
281
  this.itemMap[item.key] = item
301
- if (type === '新增') {
282
+ if (this.type === '新增') {
302
283
  this.form.column.push(item)
303
284
  } else {
304
285
  this.$set(this.form.column, this.selectIndex, item)
@@ -314,6 +295,7 @@ export default {
314
295
  this.$refs.queryItem.addColumnItemExecute()
315
296
  },
316
297
  editColumnItem (key, index) {
298
+ this.type = '修改'
317
299
  if (this.itemMap[key]) {
318
300
  this.$refs.queryItem.editColumnItemExecute(this.itemMap[key])
319
301
  this.selectIndex = index
@@ -349,8 +331,6 @@ export default {
349
331
  this.form.column.splice(index, 1, itemA)
350
332
  this.form.column.splice(newIndex, 1, itemB)
351
333
  },
352
- changeJoinArray () {
353
- },
354
334
  exportJson () {
355
335
  const data = JSON.stringify(this.result, null, 2)
356
336
  const blob = new Blob([data], { type: 'application/json' })
@@ -391,22 +371,25 @@ export default {
391
371
  businessType: '新增',
392
372
  title: '效果预览',
393
373
  formItems: res.formJson,
394
- serviceName: this.serviceName,
395
- viewMode: true
374
+ serviceName: this.serviceName
396
375
  })
397
376
  })
398
377
  })
399
378
  }
400
379
  })
401
380
  },
402
- submit () {
381
+ submit (params, callback) {
403
382
  this.$refs.businessCreateForm.validate(valid => {
404
- if (valid) {
405
- this.viewHandle(() => {
406
- // saveQueryParams
383
+ this.viewHandle(() => {
384
+ if (this.saveExportJson) {
407
385
  this.exportJson()
408
- })
409
- }
386
+ } else {
387
+ this.$emit('saveQueryParams', this.result)
388
+ if (callback) {
389
+ callback()
390
+ }
391
+ }
392
+ })
410
393
  })
411
394
  },
412
395
  // 判断是否为json字符串
@@ -455,7 +438,7 @@ export default {
455
438
  }
456
439
  </script>
457
440
  <style lang="less" scoped>
458
- .column_item :hover {
441
+ .column_item:hover {
459
442
  background-color:rgba(64, 169, 255,0.25);
460
443
  }
461
444
  .dragTips{
@@ -11,7 +11,7 @@
11
11
  @onSubmit="onAddOrEditSubmit"/>
12
12
  <a-list
13
13
  :grid="{gutter: 24, lg: 4, md: 3, sm: 1, xs: 1}"
14
- :dataSource="columnJson.groups"
14
+ :dataSource="content.groups"
15
15
  >
16
16
  <a-list-item slot="renderItem" slot-scope="item">
17
17
  <a-card :hoverable="true" @click="toEdit(item)">
@@ -40,7 +40,6 @@ export default {
40
40
  return {
41
41
  // 页面宽度
42
42
  screenWidth: document.documentElement.clientWidth,
43
- columnJson: {},
44
43
  formObj: {
45
44
  groupName: '',
46
45
  formJson: []
@@ -67,6 +66,10 @@ export default {
67
66
  default: () => {
68
67
  return {}
69
68
  }
69
+ },
70
+ content: {
71
+ type: Object,
72
+ required: true
70
73
  }
71
74
  },
72
75
  watch: {
@@ -79,9 +82,6 @@ export default {
79
82
  methods: {
80
83
  // 初始化组件
81
84
  initView () {
82
- this.$emit('getColumnJson', val => {
83
- this.columnJson = val
84
- })
85
85
  },
86
86
  toEdit (item) {
87
87
  parseConfig(item, 'SIMPLE_FORM', this.serviceName).then(res => {
@@ -8,11 +8,12 @@
8
8
  >
9
9
  <create-simple-form-query
10
10
  :to-edit-json="editItem()"
11
+ :as-a-params-group="true"
11
12
  :visible.sync="createQueryVisible"
12
- @saveSimpleFormQueryParams="saveQueryParams"
13
+ @saveQueryParams="saveQueryParams"
13
14
  />
14
15
  <a-list
15
- :dataSource="columnJsonCopy()"
16
+ :dataSource="contentCopy()"
16
17
  :grid="{gutter: 24, lg: 4, md: 3, sm: 1, xs: 1}"
17
18
  >
18
19
  <a-list-item slot="renderItem" slot-scope="item, index">
@@ -39,7 +40,7 @@
39
40
 
40
41
  <script>
41
42
  import { mapState } from 'vuex'
42
- import CreateSimpleFormQuery from '@vue2-client/base-client/components/common/CreateSimpleFormQuery'
43
+ import CreateSimpleFormQuery from '../CreateSimpleFormQuery'
43
44
 
44
45
  export default {
45
46
  name: 'FormGroupQuery',
@@ -53,7 +54,6 @@ export default {
53
54
  // 是否显示生成查询配置抽屉
54
55
  createQueryVisible: false,
55
56
  targetIndex: 0,
56
- columnJson: {},
57
57
  editIndex: -1
58
58
  }
59
59
  },
@@ -67,6 +67,10 @@ export default {
67
67
  visible: {
68
68
  type: Boolean,
69
69
  default: false
70
+ },
71
+ content: {
72
+ type: Object,
73
+ required: true
70
74
  }
71
75
  },
72
76
  watch: {
@@ -80,9 +84,6 @@ export default {
80
84
  // 初始化组件
81
85
  initView () {
82
86
  this.editIndex = -1
83
- this.$emit('getColumnJson', val => {
84
- this.columnJson = val
85
- })
86
87
  },
87
88
  toCreateQuery () {
88
89
  this.editIndex = -1
@@ -101,8 +102,8 @@ export default {
101
102
  okType: 'danger',
102
103
  cancelText: '取消',
103
104
  onOk () {
104
- _this.columnJson.groups.splice(index, 1)
105
- _this.$emit('saveQueryParams', _this.columnJson)
105
+ _this.content.groups.splice(index, 1)
106
+ _this.$emit('saveQueryParams', _this.content)
106
107
  }
107
108
  })
108
109
  },
@@ -111,21 +112,21 @@ export default {
111
112
  },
112
113
  // 存储查询配置信息
113
114
  saveQueryParams (source) {
114
- if (!this.columnJson.groups) {
115
- this.columnJson.groups = []
115
+ if (!this.content.groups) {
116
+ this.content.groups = []
116
117
  }
117
118
  if (this.editIndex !== -1) {
118
- this.columnJson.groups[this.editIndex] = source
119
+ this.content.groups[this.editIndex] = source
119
120
  } else {
120
- this.columnJson.groups.push(source)
121
+ this.content.groups.push(source)
121
122
  }
122
- this.$emit('saveQueryParams', this.columnJson)
123
+ this.$emit('saveQueryParams', this.content)
123
124
  this.createQueryVisible = false
124
125
  },
125
- columnJsonCopy () {
126
+ contentCopy () {
126
127
  let groups
127
- if (this.columnJson.groups) {
128
- groups = JSON.parse(JSON.stringify(this.columnJson.groups))
128
+ if (this.content.groups) {
129
+ groups = JSON.parse(JSON.stringify(this.content.groups))
129
130
  } else {
130
131
  groups = []
131
132
  }
@@ -134,7 +135,7 @@ export default {
134
135
  },
135
136
  editItem () {
136
137
  if (this.editIndex !== -1) {
137
- return JSON.parse(JSON.stringify(this.columnJson.groups[this.editIndex]))
138
+ return JSON.parse(JSON.stringify(this.content.groups[this.editIndex]))
138
139
  } else {
139
140
  return {}
140
141
  }
@@ -1,3 +1,3 @@
1
- import PersonSetting from './PersonSetting'
2
-
3
- export default PersonSetting
1
+ import PersonSetting from './PersonSetting'
2
+
3
+ export default PersonSetting
@@ -1,3 +1,3 @@
1
- import Upload from './Upload'
2
-
3
- export default Upload
1
+ import Upload from './Upload'
2
+
3
+ export default Upload
@@ -46,7 +46,7 @@
46
46
  </template>
47
47
  <template v-else>
48
48
  <a-empty>
49
- <span slot="description"> 页面配置不存在,请联系系统管理员 </span>
49
+ <span slot="description"> 页面配置不存在请联系系统管理员, </span>
50
50
  </a-empty>
51
51
  </template>
52
52
  </div>
@@ -239,6 +239,26 @@ export default {
239
239
  return false
240
240
  }
241
241
  },
242
+ active (props) {
243
+ let num = false
244
+ for (const key in props) {
245
+ // eslint-disable-next-line no-prototype-builtins
246
+ if (this.$props.hasOwnProperty(key)) {
247
+ console.log('key', this.$props[key] instanceof Object)
248
+ if (this.$props[key] instanceof Object) {
249
+ this.$props[key] = JSON.parse(props[key])
250
+ } else {
251
+ this.$props[key] = props[key]
252
+ }
253
+ num = true
254
+ }
255
+ console.log(key, props[key])
256
+ }
257
+ console.warn('activeProps', this.$props)
258
+ if (num) {
259
+ this.initConfig()
260
+ }
261
+ },
242
262
  /**
243
263
  * 提交新增/修改表单后事件
244
264
  */
@@ -338,6 +358,22 @@ export default {
338
358
  */
339
359
  refreshTable (toFirstPage = true) {
340
360
  this.$refs.xTable.refresh(toFirstPage)
361
+ },
362
+ },
363
+ action: {
364
+ /**
365
+ * 实现doAction方法
366
+ */
367
+ doAction (actionType, args, data) {
368
+ switch (actionType) {
369
+ case 'refreshTable':
370
+ for (const item in args) {
371
+ console.log('item', item)
372
+ }
373
+ break
374
+ default:
375
+ break
376
+ }
341
377
  }
342
378
  }
343
379
  }