vue2-client 1.7.8 → 1.7.10-test

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.
@@ -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>
@@ -1,210 +1,210 @@
1
- <template>
2
- <div>
3
- <a-input
4
- @click="inputClick"
5
- :value="valueView"
6
- style="cursor:pointer"
7
- readOnly/>
8
- <a-modal
9
- v-if="visible"
10
- v-model="visible"
11
- :title="placeholder"
12
- :z-index="1031"
13
- :bodyStyle="{ maxHeight: '68vh', overflowY: 'auto' }"
14
- @ok="handleOk"
15
- @close="visible=false"
16
- >
17
- <!-- 搜索框 -->
18
- <a-input-search :value="searchValue" style="margin-bottom: 8px" placeholder="搜索" @change="handleSearch"/>
19
- <!-- 树形图 -->
20
- <a-tree
21
- v-model="checkedKeys"
22
- :expanded-keys="expandedKeys"
23
- :selectable="false"
24
- checkable
25
- @expand="onExpand"
26
- >
27
- <!-- department -->
28
- <a-tree-node
29
- v-for="department in treeData"
30
- v-show="!department.hidden"
31
- :key="department.key"
32
- :title="department.title">
33
- <!-- person -->
34
- <a-tree-node v-for="person in department.children" v-show="!person.hidden" :key="person.key">
35
- <!-- 搜索关键词红色 -->
36
- <template slot="title">
37
- <span v-if="person.title.indexOf(searchValue) > -1">
38
- {{ person.title.substr(0, person.title.indexOf(searchValue)) }}
39
- <span style="color: #f50">{{ searchValue }}</span>
40
- {{ person.title.substr(person.title.indexOf(searchValue) + searchValue.length) }}
41
- </span>
42
- <span v-else>{{ person.title }}</span>
43
- </template>
44
- </a-tree-node>
45
- </a-tree-node>
46
- </a-tree>
47
- </a-modal>
48
- </div>
49
- </template>
50
-
51
- <script>
52
- import { commonApi, post } from '@vue2-client/services/api'
53
-
54
- const departments = ['运维部', '项目部', '项目一部', '项目二部', '开发部', '售后部', '办公室', '管理员', '软件工程部', 'IC卡部', '销售部']
55
-
56
- export default {
57
- name: 'PersonSetting',
58
- data () {
59
- return {
60
- searchValue: '',
61
- treeData: [],
62
- checkedKeys: [],
63
- expandedKeys: [],
64
- sourceTreeData: [],
65
- visible: false,
66
- valueView: this.placeholder
67
- }
68
- },
69
- props: {
70
- buttonText: {
71
- type: String,
72
- default: '选择人员'
73
- },
74
- placeholder: {
75
- type: String,
76
- default: '请选择人员'
77
- },
78
- value: {
79
- type: Array,
80
- default: () => []
81
- },
82
- // // 返回数据类型 String,Array 发现返回类型只能有一个
83
- // type: {
84
- // type: String,
85
- // default: 'Array'
86
- // },
87
- // 返回数据字段 name , id
88
- field: {
89
- type: String,
90
- default: 'name'
91
- },
92
- },
93
- model: {
94
- prop: 'value',
95
- event: 'onOk'
96
- },
97
- watch: {},
98
- components: {},
99
- created () {
100
- post(commonApi.getEmpTree, {}).then(res => {
101
- this.sourceTreeData = res
102
- })
103
- },
104
- methods: {
105
- inputClick () {
106
- this.visible = true
107
- this.searchValue = ''
108
- this.treeData = this.sourceTreeData
109
- if (this.value.length > 0) {
110
- this.checkedKeys = this.getCheckedKeys(this.value)
111
- }
112
- this.expandedKeys = []
113
- },
114
- // 获取选择得key
115
- getCheckedKeys (arr) {
116
- const brr = []
117
- this.treeData.forEach(item => {
118
- adaptToChildrenList(item)
119
- })
120
- function adaptToChildrenList (o) {
121
- if (arr.some(item => o.key.indexOf(item) > -1)) {
122
- brr.push(o.key)
123
- }
124
- if (o.children) {
125
- for (const c of o.children) {
126
- adaptToChildrenList(c)
127
- }
128
- }
129
- }
130
- return brr
131
- },
132
- handleOk () {
133
- this.$emit('onOk', this.allPerson())
134
- this.visible = false
135
- },
136
- onExpand (expandedKeys) {
137
- this.expandedKeys = expandedKeys
138
- },
139
- // 搜索处理
140
- handleSearch (e) {
141
- const value = e.target.value.trim()
142
- if (!value) {
143
- this.treeData = this.sourceTreeData
144
- this.expandedKeys = []
145
- this.searchValue = ''
146
- return
147
- }
148
- const expandedKeys = []
149
- const treeData = JSON.parse(JSON.stringify(this.sourceTreeData))
150
- // 过滤结果
151
- for (const department of treeData) {
152
- if (department.key.includes(value)) {
153
- continue
154
- }
155
- let hasChildren = false
156
- if (department.children) {
157
- for (const person of department.children) {
158
- if (!person.key.includes(value)) {
159
- person.hidden = true
160
- } else {
161
- hasChildren = true
162
- }
163
- }
164
- }
165
- if (!hasChildren) {
166
- department.hidden = true
167
- } else {
168
- expandedKeys.push(department.key)
169
- }
170
- }
171
- this.treeData = treeData
172
- this.expandedKeys = expandedKeys
173
- this.searchValue = value
174
- },
175
- allPerson () {
176
- const index = this.type === 'id' ? 1 : 0
177
- const _allPerson = this.checkedKeys.filter(value => !departments.includes(value)).map(item => item.split('_')[index])
178
- this.valueView = this.checkedKeys.filter(value => !departments.includes(value)).map(item => item.split('_')[0]).join(',')
179
- return _allPerson
180
- }
181
- },
182
- }
183
- </script>
184
- <style lang="less" scoped>
185
- .ant-tree-title {
186
- width: 100%;
187
- }
188
-
189
- .title {
190
- float: left;
191
- }
192
-
193
- .ant-card-body {
194
- :global {
195
- .ant-tree {
196
- line-height: 3;
197
-
198
- li {
199
- position: relative;
200
- }
201
- }
202
- }
203
- }
204
-
205
- .ant-card-body .but_type {
206
- float: right;
207
- position: absolute;
208
- right: 40px;
209
- }
210
- </style>
1
+ <template>
2
+ <div>
3
+ <a-input
4
+ @click="inputClick"
5
+ :value="valueView"
6
+ style="cursor:pointer"
7
+ readOnly/>
8
+ <a-modal
9
+ v-if="visible"
10
+ v-model="visible"
11
+ :title="placeholder"
12
+ :z-index="1031"
13
+ :bodyStyle="{ maxHeight: '68vh', overflowY: 'auto' }"
14
+ @ok="handleOk"
15
+ @close="visible=false"
16
+ >
17
+ <!-- 搜索框 -->
18
+ <a-input-search :value="searchValue" style="margin-bottom: 8px" placeholder="搜索" @change="handleSearch"/>
19
+ <!-- 树形图 -->
20
+ <a-tree
21
+ v-model="checkedKeys"
22
+ :expanded-keys="expandedKeys"
23
+ :selectable="false"
24
+ checkable
25
+ @expand="onExpand"
26
+ >
27
+ <!-- department -->
28
+ <a-tree-node
29
+ v-for="department in treeData"
30
+ v-show="!department.hidden"
31
+ :key="department.key"
32
+ :title="department.title">
33
+ <!-- person -->
34
+ <a-tree-node v-for="person in department.children" v-show="!person.hidden" :key="person.key">
35
+ <!-- 搜索关键词红色 -->
36
+ <template slot="title">
37
+ <span v-if="person.title.indexOf(searchValue) > -1">
38
+ {{ person.title.substr(0, person.title.indexOf(searchValue)) }}
39
+ <span style="color: #f50">{{ searchValue }}</span>
40
+ {{ person.title.substr(person.title.indexOf(searchValue) + searchValue.length) }}
41
+ </span>
42
+ <span v-else>{{ person.title }}</span>
43
+ </template>
44
+ </a-tree-node>
45
+ </a-tree-node>
46
+ </a-tree>
47
+ </a-modal>
48
+ </div>
49
+ </template>
50
+
51
+ <script>
52
+ import { commonApi, post } from '@vue2-client/services/api'
53
+
54
+ const departments = ['运维部', '项目部', '项目一部', '项目二部', '开发部', '售后部', '办公室', '管理员', '软件工程部', 'IC卡部', '销售部']
55
+
56
+ export default {
57
+ name: 'PersonSetting',
58
+ data () {
59
+ return {
60
+ searchValue: '',
61
+ treeData: [],
62
+ checkedKeys: [],
63
+ expandedKeys: [],
64
+ sourceTreeData: [],
65
+ visible: false,
66
+ valueView: this.placeholder
67
+ }
68
+ },
69
+ props: {
70
+ buttonText: {
71
+ type: String,
72
+ default: '选择人员'
73
+ },
74
+ placeholder: {
75
+ type: String,
76
+ default: '请选择人员'
77
+ },
78
+ value: {
79
+ type: Array,
80
+ default: () => []
81
+ },
82
+ // // 返回数据类型 String,Array 发现返回类型只能有一个
83
+ // type: {
84
+ // type: String,
85
+ // default: 'Array'
86
+ // },
87
+ // 返回数据字段 name , id
88
+ field: {
89
+ type: String,
90
+ default: 'name'
91
+ },
92
+ },
93
+ model: {
94
+ prop: 'value',
95
+ event: 'onOk'
96
+ },
97
+ watch: {},
98
+ components: {},
99
+ created () {
100
+ post(commonApi.getEmpTree, {}).then(res => {
101
+ this.sourceTreeData = res
102
+ })
103
+ },
104
+ methods: {
105
+ inputClick () {
106
+ this.visible = true
107
+ this.searchValue = ''
108
+ this.treeData = this.sourceTreeData
109
+ if (this.value.length > 0) {
110
+ this.checkedKeys = this.getCheckedKeys(this.value)
111
+ }
112
+ this.expandedKeys = []
113
+ },
114
+ // 获取选择得key
115
+ getCheckedKeys (arr) {
116
+ const brr = []
117
+ this.treeData.forEach(item => {
118
+ adaptToChildrenList(item)
119
+ })
120
+ function adaptToChildrenList (o) {
121
+ if (arr.some(item => o.key.indexOf(item) > -1)) {
122
+ brr.push(o.key)
123
+ }
124
+ if (o.children) {
125
+ for (const c of o.children) {
126
+ adaptToChildrenList(c)
127
+ }
128
+ }
129
+ }
130
+ return brr
131
+ },
132
+ handleOk () {
133
+ this.$emit('onOk', this.allPerson())
134
+ this.visible = false
135
+ },
136
+ onExpand (expandedKeys) {
137
+ this.expandedKeys = expandedKeys
138
+ },
139
+ // 搜索处理
140
+ handleSearch (e) {
141
+ const value = e.target.value.trim()
142
+ if (!value) {
143
+ this.treeData = this.sourceTreeData
144
+ this.expandedKeys = []
145
+ this.searchValue = ''
146
+ return
147
+ }
148
+ const expandedKeys = []
149
+ const treeData = JSON.parse(JSON.stringify(this.sourceTreeData))
150
+ // 过滤结果
151
+ for (const department of treeData) {
152
+ if (department.key.includes(value)) {
153
+ continue
154
+ }
155
+ let hasChildren = false
156
+ if (department.children) {
157
+ for (const person of department.children) {
158
+ if (!person.key.includes(value)) {
159
+ person.hidden = true
160
+ } else {
161
+ hasChildren = true
162
+ }
163
+ }
164
+ }
165
+ if (!hasChildren) {
166
+ department.hidden = true
167
+ } else {
168
+ expandedKeys.push(department.key)
169
+ }
170
+ }
171
+ this.treeData = treeData
172
+ this.expandedKeys = expandedKeys
173
+ this.searchValue = value
174
+ },
175
+ allPerson () {
176
+ const index = this.type === 'id' ? 1 : 0
177
+ const _allPerson = this.checkedKeys.filter(value => !departments.includes(value)).map(item => item.split('_')[index])
178
+ this.valueView = this.checkedKeys.filter(value => !departments.includes(value)).map(item => item.split('_')[0]).join(',')
179
+ return _allPerson
180
+ }
181
+ },
182
+ }
183
+ </script>
184
+ <style lang="less" scoped>
185
+ .ant-tree-title {
186
+ width: 100%;
187
+ }
188
+
189
+ .title {
190
+ float: left;
191
+ }
192
+
193
+ .ant-card-body {
194
+ :global {
195
+ .ant-tree {
196
+ line-height: 3;
197
+
198
+ li {
199
+ position: relative;
200
+ }
201
+ }
202
+ }
203
+ }
204
+
205
+ .ant-card-body .but_type {
206
+ float: right;
207
+ position: absolute;
208
+ right: 40px;
209
+ }
210
+ </style>
@@ -1,3 +1,3 @@
1
- import PersonSetting from './PersonSetting'
2
-
3
- export default PersonSetting
1
+ import PersonSetting from './PersonSetting'
2
+
3
+ export default PersonSetting