vue2-client 1.7.10 → 1.7.12

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.7.10",
3
+ "version": "1.7.12",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
@@ -96,7 +96,6 @@
96
96
  <div
97
97
  v-for="(columnItem, index) in form.column"
98
98
  :key="index"
99
- class="column_item"
100
99
  draggable="true"
101
100
  @dragend="handleDragEnd($event, columnItem)"
102
101
  @dragenter="handleDragEnter($event, columnItem)"
@@ -105,8 +104,8 @@
105
104
  <a-row v-if="ending && dragging && columnItem.key === ending.key && dragging.key !== ending.key" class="dragTipsWarp">
106
105
  <span class="dragTips">拖到此处放置</span>
107
106
  </a-row>
108
- <a-row :gutter="24">
109
- <a-col :span="8">
107
+ <a-row :gutter="24" class="column_item">
108
+ <a-col :span="7">
110
109
  <span style="font-weight: bold">
111
110
  {{ columnItem.title }}
112
111
  </span>
@@ -116,7 +115,7 @@
116
115
  {{ columnItem.key }}
117
116
  </span>
118
117
  </a-col>
119
- <a-col :span="7">
118
+ <a-col :span="8">
120
119
  <a-tooltip>
121
120
  <template slot="title">
122
121
  查询表单项
@@ -147,6 +146,12 @@
147
146
  </template>
148
147
  <a-tag :color="columnItem.dataModeArray.includes('sqlQueryCondition') ? 'purple' : 'rgba(0, 0, 0, 0.25)'"><a-icon type="search" /></a-tag>
149
148
  </a-tooltip>
149
+ <a-tooltip>
150
+ <template slot="title">
151
+ 字段组存储
152
+ </template>
153
+ <a-tag :color="columnItem.dataModeArray.includes('group') ? '#82A0D8' : 'rgba(0, 0, 0, 0.25)'"><a-icon type="crown" /></a-tag>
154
+ </a-tooltip>
150
155
  </a-col>
151
156
  <a-col :span="1">
152
157
  <a-icon type="edit" @click="editColumnItem(columnItem.key,index)"/>
@@ -655,7 +660,7 @@ export default {
655
660
  }
656
661
  </script>
657
662
  <style lang="less" scoped>
658
- .column_item :hover {
663
+ .column_item:hover {
659
664
  background-color:rgba(64, 169, 255,0.25);
660
665
  }
661
666
  .dragTips{
@@ -66,7 +66,7 @@
66
66
  </a-form-model-item>
67
67
  </a-card>
68
68
  </a-col>
69
- <a-col :span="9">
69
+ <a-col v-show="!dataMode.group && (dataMode.queryForm || dataMode.addOrEditForm || dataMode.table || dataMode.sqlQueryCondition)" :span="9">
70
70
  <a-card v-if="dataMode.queryForm || dataMode.addOrEditForm || dataMode.table || dataMode.sqlQueryCondition" :bodyStyle="bodyStyle" title="核心配置">
71
71
  <template v-if="dataMode.queryForm || dataMode.addOrEditForm || dataMode.sqlQueryCondition">
72
72
  <a-divider style="font-size: 14px;margin-top: 0">表单配置</a-divider>
@@ -193,7 +193,7 @@
193
193
  </template>
194
194
  </a-card>
195
195
  </a-col>
196
- <a-col v-if="item.formType" :span="9">
196
+ <a-col v-if="!dataMode.group && item.formType && (((dataMode.addOrEditForm || dataMode.queryForm ) && (item.formType === 'input' || item.formType === 'select')) || (dataMode.table && item.formType !== 'file' && item.formType !== 'image') || selectDataShow)" :span="9">
197
197
  <a-card :bodyStyle="bodyStyle" title="扩展属性">
198
198
  <template v-if="(dataMode.addOrEditForm || dataMode.queryForm ) && (item.formType === 'input' || item.formType === 'select')">
199
199
  <a-divider style="font-size: 14px;margin-top: 0">提示相关</a-divider>
@@ -307,6 +307,101 @@
307
307
  </template>
308
308
  </a-card>
309
309
  </a-col>
310
+ <a-col :span="18" v-if="dataMode.group">
311
+ <a-card :bodyStyle="bodyStyle" title="数据字段">
312
+ <a-row :gutter="24">
313
+ <a-col :span="8">
314
+ <span style="font-weight: bold">
315
+ 标签名
316
+ </span>
317
+ </a-col>
318
+ <a-col :span="7">
319
+ <span style="font-weight: bold">
320
+ 字段名
321
+ </span>
322
+ </a-col>
323
+ <a-col :span="7">
324
+ <span style="font-weight: bold">
325
+ 数据模式
326
+ </span>
327
+ </a-col>
328
+ <a-col :span="2">
329
+ <span style="font-weight: bold">
330
+ 操作
331
+ </span>
332
+ </a-col>
333
+ </a-row>
334
+ <a-divider style="margin: 6px 0" />
335
+ <div
336
+ v-for="(columnItem, index) in item.column"
337
+ :key="index"
338
+ draggable="true"
339
+ @dragend="handleDragEnd($event, columnItem)"
340
+ @dragenter="handleDragEnter($event, columnItem)"
341
+ @dragstart="handleDragStart($event, columnItem)"
342
+ @dragover.prevent="handleDragOver($event, columnItem)">
343
+ <a-row v-if="ending && dragging && columnItem.key === ending.key && dragging.key !== ending.key" class="dragTipsWarp">
344
+ <span class="dragTips">拖到此处放置</span>
345
+ </a-row>
346
+ <a-row :gutter="24" class="column_item">
347
+ <a-col :span="7">
348
+ <span style="font-weight: bold">
349
+ {{ columnItem.title }}
350
+ </span>
351
+ </a-col>
352
+ <a-col :span="7">
353
+ <span style="font-weight: bold">
354
+ {{ columnItem.key }}
355
+ </span>
356
+ </a-col>
357
+ <a-col :span="8">
358
+ <a-tooltip>
359
+ <template slot="title">
360
+ 查询表单项
361
+ </template>
362
+ <a-tag :color="columnItem.dataModeArray && columnItem.dataModeArray.includes('queryForm') ? 'blue' : 'rgba(0, 0, 0, 0.25)'"><a-icon type="file-search" /></a-tag>
363
+ </a-tooltip>
364
+ <a-tooltip>
365
+ <template slot="title">
366
+ 表格列
367
+ </template>
368
+ <a-tag :color="columnItem.dataModeArray && columnItem.dataModeArray.includes('table') ? 'orange' : 'rgba(0, 0, 0, 0.25)'"><a-icon type="table" /></a-tag>
369
+ </a-tooltip>
370
+ <a-tooltip>
371
+ <template slot="title">
372
+ 新增/修改表单项
373
+ </template>
374
+ <a-tag :color="columnItem.dataModeArray && columnItem.dataModeArray.includes('addOrEditForm') ? 'green' : 'rgba(0, 0, 0, 0.25)'"><a-icon type="form" /></a-tag>
375
+ </a-tooltip>
376
+ <a-tooltip>
377
+ <template slot="title">
378
+ SQL查询项
379
+ </template>
380
+ <a-tag :color="columnItem.dataModeArray && columnItem.dataModeArray.includes('sqlQueryItem') ? 'cyan' : 'rgba(0, 0, 0, 0.25)'"><a-icon type="bars" /></a-tag>
381
+ </a-tooltip>
382
+ <a-tooltip>
383
+ <template slot="title">
384
+ SQL查询表达式
385
+ </template>
386
+ <a-tag :color="columnItem.dataModeArray && columnItem.dataModeArray.includes('sqlQueryCondition') ? 'purple' : 'rgba(0, 0, 0, 0.25)'"><a-icon type="search" /></a-tag>
387
+ </a-tooltip>
388
+ <a-tooltip>
389
+ <template slot="title">
390
+ 字段JSON存储
391
+ </template>
392
+ <a-tag :color="columnItem.dataModeArray && columnItem.dataModeArray.includes('group') ? '#82A0D8' : 'rgba(0, 0, 0, 0.25)'"><a-icon type="crown" /></a-tag>
393
+ </a-tooltip>
394
+ </a-col>
395
+ <a-col :span="1">
396
+ <a-icon type="edit" @click="editColumnItem(columnItem.key,index)"/>
397
+ </a-col>
398
+ <a-col :span="1">
399
+ <a-icon type="close" @click="removeColumnItem(columnItem.key,index)"/>
400
+ </a-col>
401
+ </a-row>
402
+ </div>
403
+ </a-card>
404
+ </a-col>
310
405
  </a-row>
311
406
  <a-alert
312
407
  v-if="dataModeArrayData.length === 0"
@@ -333,6 +428,7 @@
333
428
  style="margin-top: 5px"
334
429
  type="info"/>
335
430
  </a-form-model>
431
+ <create-query-item ref="queryItem" @getColumn="getColumnItem" @itemHandle="itemHandleItem"/>
336
432
  </a-modal>
337
433
  </template>
338
434
 
@@ -451,6 +547,7 @@ export default {
451
547
  rule: {
452
548
  required: 'false'
453
549
  },
550
+ column: [],
454
551
  queryType: '=',
455
552
  formType: 'input',
456
553
  accept: undefined,
@@ -484,7 +581,11 @@ export default {
484
581
  pathKey: [{ required: true, message: '请选择上传到的扩展目录', trigger: 'blur' }]
485
582
  },
486
583
  // 字典键集合
487
- option: []
584
+ option: [],
585
+ selectIndex: null,
586
+ ending: null,
587
+ dragging: null,
588
+ itemMap: {}
488
589
  }
489
590
  },
490
591
  mounted () {
@@ -551,6 +652,18 @@ export default {
551
652
  this.item = _item
552
653
  this.dataModeArrayData = this.item.dataModeArray
553
654
  this.flashModal()
655
+
656
+ for (const columnItem of this.item.column) {
657
+ this.itemMap[columnItem.key] = Object.assign({
658
+ key: '',
659
+ title: '',
660
+ slot: {},
661
+ rule: {
662
+ required: 'false'
663
+ },
664
+ dataModeArray: []
665
+ }, columnItem)
666
+ }
554
667
  },
555
668
  // 增加数据字段前数据处理
556
669
  addColumnItemExecute () {
@@ -720,7 +833,73 @@ export default {
720
833
  _item.slot.actionText = _item.actionText
721
834
  delete _item.actionText
722
835
  }
723
- }
836
+ },
837
+ // 拖拽事件
838
+ handleDragStart (e, item) {
839
+ this.dragging = item
840
+ },
841
+ handleDragEnd (e, item) {
842
+ if (this.ending.key === this.dragging.key) {
843
+ return
844
+ }
845
+ const newItems = [...this.item.column]
846
+ const src = newItems.indexOf(this.dragging)
847
+ const dst = newItems.indexOf(this.ending)
848
+ // newItems.splice(src, 1, ...newItems.splice(dst, 1, newItems[src])) 替换位置
849
+ // 挪移位置
850
+ newItems.splice(src, 1)
851
+ newItems.splice(dst, 0, this.dragging)
852
+ this.item.column = newItems
853
+ this.$nextTick(() => {
854
+ this.dragging = null
855
+ this.ending = null
856
+ })
857
+ },
858
+ handleDragOver (e) {
859
+ // 首先把div变成可以放置的元素,即重写dragenter/dragover
860
+ // e.dataTransfer.dropEffect="move";//在dragenter中针对放置目标来设置!
861
+ e.dataTransfer.dropEffect = 'move'
862
+ },
863
+ handleDragEnter (e, item) {
864
+ // 为需要移动的元素设置dragstart事件
865
+ e.dataTransfer.effectAllowed = 'move'
866
+ this.ending = item
867
+ },
868
+ editColumnItem (key, index) {
869
+ if (this.itemMap[key]) {
870
+ this.selectIndex = index
871
+ this.$refs.queryItem.editColumnItemExecute(this.itemMap[key])
872
+ } else {
873
+ this.$message.warn('编辑失败')
874
+ }
875
+ },
876
+ removeColumnItem (key, index) {
877
+ const _this = this
878
+ this.$confirm({
879
+ title: '您确定要删除该数据项?',
880
+ content: '删除的数据项无法恢复',
881
+ okText: '确定',
882
+ okType: 'danger',
883
+ cancelText: '取消',
884
+ onOk () {
885
+ delete _this.itemMap[key]
886
+ _this.item.column.splice(index, 1)
887
+ }
888
+ })
889
+ },
890
+ getColumnItem (callback) {
891
+ callback(JSON.parse(JSON.stringify(this.item.column)))
892
+ },
893
+ itemHandleItem (item, type) {
894
+ this.itemMap[item.key] = item
895
+ if (type === '新增') {
896
+ this.item.column.push(item)
897
+ } else {
898
+ this.$set(this.item.column, this.selectIndex, item)
899
+ }
900
+ this.$message.success(`${type}成功`)
901
+ this.$refs.queryItem.flashModal(false)
902
+ },
724
903
  }
725
904
  }
726
905
  </script>
@@ -730,4 +909,15 @@ export default {
730
909
  text-align: center;
731
910
  padding: 0 10px;
732
911
  }
912
+ .column_item:hover {
913
+ background-color:rgba(64, 169, 255,0.25);
914
+ }
915
+ .dragTips{
916
+ display:block;
917
+ text-align: center;
918
+ border:1px dashed rgba(64, 169, 255,0.55);
919
+ }
920
+ .dragTipsWarp{
921
+ padding: .5rem 2rem;
922
+ }
733
923
  </style>
@@ -19,6 +19,20 @@
19
19
  :get-data-params="getDataParams"
20
20
  />
21
21
  </a-row>
22
+ <a-row :gutter="16" v-for="(groupItem, groupIndex) in groupJsonData" :key="groupIndex">
23
+ <x-form-item
24
+ v-for="(item, index) in groupItem.groupItems"
25
+ :key="index"
26
+ :attr="item"
27
+ :disabled="itemDisabled(item)"
28
+ :files="files"
29
+ :form="form[groupItem.model]"
30
+ :images="images"
31
+ :service-name="serviceName"
32
+ mode="新增/修改"
33
+ :get-data-params="getDataParams"
34
+ />
35
+ </a-row>
22
36
  <a-row :gutter="16" v-for="(item, key) in simpleFormJsonData" :key="'row' + key">
23
37
  <a-card :title="item.name" :bordered="false" size="small">
24
38
  <x-form-item
@@ -93,6 +107,22 @@ export default {
93
107
  return item.addOrEdit && item.addOrEdit !== 'no' && item.addOrEdit !== 'silenceAdd' && item.addOrEdit !== 'version' && !this.itemDisabled(item)
94
108
  })
95
109
  },
110
+ // 过滤出用于新增/修改场景的表单项
111
+ groupJsonData: function () {
112
+ return this.formItems.filter((item) => {
113
+ return item.type === 'group'
114
+ }).map((item) => {
115
+ item.groupItems = item.groupItems.filter((item) => {
116
+ return item.addOrEdit && item.addOrEdit !== 'no' && item.addOrEdit !== 'silenceAdd' && item.addOrEdit !== 'version' && !this.itemDisabled(item)
117
+ }).map((groupItem) => {
118
+ // 只保留第一个下划线后面的内容
119
+ groupItem.model = groupItem.model.substring(groupItem.model.indexOf('_') + 1)
120
+ return groupItem
121
+ })
122
+ return item
123
+ }
124
+ )
125
+ },
96
126
  // 过滤出用于静默新增场景的表单项
97
127
  silenceAddJsonData: function () {
98
128
  return this.formItems.filter(function (item) {
@@ -132,6 +162,15 @@ export default {
132
162
  const item = this.realJsonData[i]
133
163
  this.setFormProps(formData, item)
134
164
  }
165
+ // 设置表单分组项目相关参数
166
+ for (let i = 0; i < this.groupJsonData.length; i++) {
167
+ const groupItem = this.groupJsonData[i]
168
+ formData[groupItem.model] = {}
169
+ for (let j = 0; j < groupItem.groupItems.length; j++) {
170
+ const item = groupItem.groupItems[j]
171
+ this.setFormProps(formData[groupItem.model], item)
172
+ }
173
+ }
135
174
  // 设置动态简易表单项的相关参数
136
175
  for (const key in this.simpleFormJsonData) {
137
176
  for (const item of this.simpleFormJsonData[key].value) {
@@ -234,10 +273,6 @@ export default {
234
273
  if (!valid) {
235
274
  return false
236
275
  }
237
- if (this.viewMode) {
238
- this.$message.info('预览模式禁止新增和修改')
239
- return false
240
- }
241
276
  this.loading = true
242
277
  for (const key of Object.keys(this.form)) {
243
278
  if (this.form[key] === null || this.form[key] === '') {
@@ -293,6 +328,16 @@ export default {
293
328
  realForm[realKey] = value
294
329
  }
295
330
  }
331
+ if (this.viewMode) {
332
+ this.$message.info('预览模式禁止新增和修改')
333
+ console.log({
334
+ businessType: this.businessType,
335
+ serviceName: this.serviceName,
336
+ realForm: realForm,
337
+ currUserName: this.currUser.name
338
+ })
339
+ return false
340
+ }
296
341
  // 交由父级处理
297
342
  this.$emit('onSubmit', {
298
343
  businessType: this.businessType,
@@ -347,6 +392,16 @@ export default {
347
392
  this.form[item.model] = undefined
348
393
  }
349
394
  }
395
+ // 对分组表单进行处理
396
+ for (let i = 0; i < this.groupJsonData.length; i++) {
397
+ const item = this.groupJsonData[i]
398
+ try {
399
+ if (modifyModelData.data[item.model]) {
400
+ this.form[item.model] = JSON.parse(modifyModelData.data[item.model])
401
+ }
402
+ } catch (e) {
403
+ }
404
+ }
350
405
  // 追加版本号信息
351
406
  for (const item of this.versionJsonData) {
352
407
  if (!modifyModelData.data[item.model]) {
@@ -15,6 +15,16 @@
15
15
  :service-name="serviceName"
16
16
  :get-data-params="getDataParams"
17
17
  />
18
+ <div v-for="(groupItem, groupIndex) in groupJsonData" :key="groupIndex">
19
+ <x-form-item
20
+ v-for="(item, index) in groupItem.groupItems"
21
+ :key="index"
22
+ :attr="item"
23
+ :form="form"
24
+ :service-name="serviceName"
25
+ :get-data-params="getDataParams"
26
+ />
27
+ </div>
18
28
  <div v-show="advanced">
19
29
  <x-form-item
20
30
  v-for="(item, index) in realJsonData.slice(6)"
@@ -87,6 +97,20 @@ export default {
87
97
  realJsonData: function () {
88
98
  return this.formItems.filter(item => !item.isOnlyAddOrEdit)
89
99
  },
100
+ // 过滤出用于新增/修改场景的表单项
101
+ groupJsonData: function () {
102
+ return this.formItems.filter((item) => {
103
+ return item.type === 'group'
104
+ }).map((item) => {
105
+ item.groupItems = item.groupItems.filter(item => !item.isOnlyAddOrEdit).map((groupItem) => {
106
+ // 只保留第一个下划线后面的内容
107
+ groupItem.model = groupItem.model.substring(groupItem.model.indexOf('_') + 1)
108
+ return groupItem
109
+ })
110
+ return item
111
+ }
112
+ )
113
+ },
90
114
  },
91
115
  methods: {
92
116
  init (params) {
@@ -334,15 +334,6 @@ export default {
334
334
  */
335
335
  refreshTable (toFirstPage = true) {
336
336
  this.$refs.xTable.refresh(toFirstPage)
337
- },
338
- /**
339
- * 设置固定查询表单
340
- */
341
- setFixedQueryForm (form, isRefreshTable) {
342
- this.fixedQueryForm = form
343
- if (isRefreshTable) {
344
- this.refreshTable(true)
345
- }
346
337
  }
347
338
  }
348
339
  }
@@ -324,7 +324,9 @@ export default {
324
324
  * 如果参数为 true, 则强制刷新到第一页
325
325
  */
326
326
  refresh (bool) {
327
- this.$refs.table.refresh(bool)
327
+ this.$nextTick(() => {
328
+ this.$refs.table.refresh(bool)
329
+ })
328
330
  },
329
331
  /**
330
332
  * 格式化日期
@@ -25,6 +25,11 @@ module.exports = {
25
25
  label: 'SQL生成查询表达式',
26
26
  value: 'sqlQueryCondition',
27
27
  noMatch: ['file', 'image', 'textarea', 'personSetting']
28
+ },
29
+ {
30
+ label: '字段组存储',
31
+ value: 'group',
32
+ noMatch: ['file', 'image', 'textarea', 'personSetting']
28
33
  }
29
34
  ],
30
35
  // 表单类型
@@ -6,6 +6,7 @@ const routesConfig = [
6
6
  'login',
7
7
  'submitTicket',
8
8
  'settings',
9
+ 'createQuery',
9
10
  'root',
10
11
  {
11
12
  router: 'exp404',