three-trees-ui 1.0.99 → 1.1.1

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.
@@ -16,23 +16,48 @@
16
16
  @click="showDialog"
17
17
  >
18
18
  <div
19
- v-if="inputWriteable"
20
- class="el-input el-input--suffix"
21
- :class="{ 'custom-selector-mobile': isMobile }"
19
+ ref="tagSpans"
20
+ class="user-selector_block"
21
+ :class="{
22
+ 'el-select__tags_readonly': !inputWriteable,
23
+ 'el-select__tags': inputWriteable,
24
+ }"
22
25
  >
23
- <div v-if="isMobile" class="custom-selector-mobile-box">
24
- <div
26
+ <span class="tag-wrap">
27
+ <span
25
28
  v-for="(item, index) in selectors"
26
29
  :key="index"
27
- class="common-selector-tag"
30
+ class="el-tag el-tag--info el-tag--small"
31
+ @click.stop
28
32
  >
29
- <span>{{ item.fullname }}</span>
30
- <i class="el-icon-error" @click.stop="handleRemove(item)"></i>
31
- </div>
32
- </div>
33
+ <span class="el-select__tags-text">{{ item.fullname }}</span>
34
+ <i
35
+ v-if="inputWriteable"
36
+ class="el-tag__close el-icon-close"
37
+ @click.stop="handleRemove(item)"
38
+ ></i>
39
+ </span>
40
+ <template v-if="!selectors.length && value">
41
+ <span
42
+ v-for="(item, index) in value.split(',')"
43
+ :key="index"
44
+ class="el-tag el-tag--info el-tag--small"
45
+ @click.stop
46
+ >
47
+ <span class="el-select__tags-text">{{ item }}</span>
48
+ <i
49
+ v-if="inputWriteable"
50
+ class="el-tag__close el-icon-close"
51
+ @click.stop="handleRemoveText(index)"
52
+ ></i>
53
+ </span>
54
+ </template>
55
+ </span>
56
+ </div>
57
+ <div v-if="inputWriteable" class="el-input el-input--suffix">
33
58
  <input
34
59
  ref="inputEl"
35
- v-model="calcInputValue"
60
+ v-model="value"
36
61
  v-validate="inputValidate"
37
62
  type="text"
38
63
  readonly="readonly"
@@ -40,71 +65,66 @@
40
65
  autocomplete="off"
41
66
  class="el-input__inner"
42
67
  :placeholder="placeholder"
68
+ :style="{
69
+ height: inputSuffixHeight + 'px',
70
+ lineHeight: inputSuffixHeight + 'px',
71
+ }"
43
72
  />
44
73
  <span class="el-input__suffix">
45
74
  <span class="el-input__suffix-inner">
46
- <i
47
- v-if="value"
48
- class="el-icon-circle-close clear-icon"
49
- @click.stop="clear"
50
- ></i>
75
+ <i class="el-icon-circle-close clear-icon" @click.stop="clear"></i>
51
76
  <ht-icon name="user" class="user-icon" />
52
77
  </span>
53
78
  </span>
54
79
  </div>
55
- <div v-else class="el-select__tags_readonly">
56
- <span>{{ calcInputValue }}</span>
57
- </div>
58
80
  </div>
59
81
  <ht-field-tail :field-name="inputName" :input-value="value" />
60
- <template v-if="isDialogShow">
61
- <user-selector-dialog
62
- v-if="!isMobile"
63
- ref="userSelectorDialog"
64
- v-model="selectors"
65
- :title="title"
66
- :append-to-body="appendToBody"
67
- :data="data"
68
- :pagination="pagination"
69
- :select-label="selectLabel"
70
- :quick-search-props="quickSearchProps"
71
- :single="single"
72
- :search-placeholder="searchPlaceholder"
73
- :primary-field="primaryField"
74
- :mode="mode"
75
- @filter-type-change="(type) => $emit('filter-type-change', type)"
76
- @search="(word) => $emit('search', word)"
77
- @reset="() => $emit('reset')"
78
- @row-click="(row) => $emit('row-click', row)"
79
- @select-data="(data) => $emit('select-data', data)"
80
- @page-change="(page) => $emit('page-change', page)"
81
- @size-change="(size) => $emit('size-change', size)"
82
- @contact-group-change="(group) => $emit('contact-group-change', group)"
83
- @load-org-user="(org) => $emit('load-org-user', org)"
84
- @load-policy-user="(policy) => $emit('load-policy-user', policy)"
85
- @load-role-user="(role) => $emit('load-role-user', role)"
86
- />
87
- <user-selector-mobile-dialog
88
- v-else
89
- ref="userSelectorMobileDialog"
90
- v-model="selectors"
91
- :title="title"
92
- :append-to-body="appendToBody"
93
- :data="data"
94
- :pagination="pagination"
95
- :select-label="selectLabel"
96
- :quick-search-props="quickSearchProps"
97
- :single="single"
98
- :search-placeholder="searchPlaceholder"
99
- :primary-field="primaryField"
100
- @search="(word) => $emit('search', word)"
101
- @reset="() => $emit('reset')"
102
- @row-click="(row) => $emit('row-click', row)"
103
- @select-data="(data) => $emit('select-data', data)"
104
- @page-change="(page) => $emit('page-change', page)"
105
- @getCustomQuerys="(querys) => $emit('getCustomQuerys', querys)"
106
- />
107
- </template>
82
+ <user-selector-dialog
83
+ v-if="!isMobile"
84
+ ref="userSelectorDialog"
85
+ v-model="selectors"
86
+ :title="title"
87
+ :append-to-body="appendToBody"
88
+ :data="data"
89
+ :pagination="pagination"
90
+ :select-label="selectLabel"
91
+ :quick-search-props="quickSearchProps"
92
+ :single="single"
93
+ :search-placeholder="searchPlaceholder"
94
+ :primary-field="primaryField"
95
+ :mode="mode"
96
+ @filter-type-change="(type) => $emit('filter-type-change', type)"
97
+ @search="(word) => $emit('search', word)"
98
+ @reset="() => $emit('reset')"
99
+ @row-click="(row) => $emit('row-click', row)"
100
+ @select-data="(data) => $emit('select-data', data)"
101
+ @page-change="(page) => $emit('page-change', page)"
102
+ @size-change="(size) => $emit('size-change', size)"
103
+ @contact-group-change="(group) => $emit('contact-group-change', group)"
104
+ @load-org-user="(org) => $emit('load-org-user', org)"
105
+ @load-policy-user="(policy) => $emit('load-policy-user', policy)"
106
+ @load-role-user="(role) => $emit('load-role-user', role)"
107
+ />
108
+ <user-selector-mobile-dialog
109
+ v-else
110
+ ref="userSelectorMobileDialog"
111
+ v-model="selectors"
112
+ :title="title"
113
+ :append-to-body="appendToBody"
114
+ :data="data"
115
+ :pagination="pagination"
116
+ :select-label="selectLabel"
117
+ :quick-search-props="quickSearchProps"
118
+ :single="single"
119
+ :search-placeholder="searchPlaceholder"
120
+ :primary-field="primaryField"
121
+ @search="(word) => $emit('search', word)"
122
+ @reset="() => $emit('reset')"
123
+ @row-click="(row) => $emit('row-click', row)"
124
+ @select-data="(data) => $emit('select-data', data)"
125
+ @page-change="(page) => $emit('page-change', page)"
126
+ @getCustomQuerys="(querys) => $emit('getCustomQuerys', querys)"
127
+ />
108
128
  </div>
109
129
  </template>
110
130
  <script>
@@ -178,23 +198,11 @@
178
198
  },
179
199
  data() {
180
200
  return {
181
- isDialogShow: false,
182
201
  inputSuffixHeight: 30,
183
202
  selectors: [],
184
203
  }
185
204
  },
186
205
  computed: {
187
- calcInputValue: function() {
188
- let name = ''
189
- if (this.selectors) {
190
- name = this.selectors
191
- .map((k) => {
192
- return k.fullname
193
- })
194
- .join(',')
195
- }
196
- return name
197
- },
198
206
  primaryField: function() {
199
207
  return this.config && this.config.hasOwnProperty('id')
200
208
  ? 'id'
@@ -308,8 +316,14 @@
308
316
  // 通过valueChange事件发布值变更消息
309
317
  setTimeout(() => {
310
318
  this.$emit('valueChange', ary.join(','), newVal)
319
+ if (newVal.length > 0) {
320
+ this.calacInputSuffixHeight()
321
+ } else {
322
+ this.inputSuffixHeight = 30
323
+ }
311
324
  if (this.$refs.inputEl) {
312
- this.$validator.validate(this.inputName)
325
+ this.$refs.inputEl.focus()
326
+ this.$refs.inputEl.blur()
313
327
  }
314
328
  }, 10)
315
329
  },
@@ -447,14 +461,10 @@
447
461
  this.selectors = tmpAry
448
462
  }
449
463
  },
450
- async showDialog() {
464
+ showDialog() {
451
465
  if (!this.inputWriteable) {
452
466
  return
453
467
  }
454
- if (this.isDialogShow === false) {
455
- this.isDialogShow = true
456
- await this.$nextTick()
457
- }
458
468
  if (this.isMobile) {
459
469
  this.$refs.userSelectorMobileDialog.showDialog()
460
470
  } else {
@@ -470,12 +480,12 @@
470
480
  },
471
481
  // 更新当前输入框的高度来适配已选数据的高度
472
482
  calacInputSuffixHeight() {
473
- // if (!this.$refs.tagSpans) return
474
- // if (this.$refs.tagSpans.offsetHeight) {
475
- // this.inputSuffixHeight = this.$refs.tagSpans.offsetHeight + 5
476
- // } else {
477
- // this.inputSuffixHeight = 30
478
- // }
483
+ if (!this.$refs.tagSpans) return
484
+ if (this.$refs.tagSpans.offsetHeight) {
485
+ this.inputSuffixHeight = this.$refs.tagSpans.offsetHeight + 5
486
+ } else {
487
+ this.inputSuffixHeight = 30
488
+ }
479
489
  },
480
490
  handleRemoveText(index) {
481
491
  if (!this.value) {
@@ -489,7 +499,6 @@
489
499
  }
490
500
  </script>
491
501
  <style lang="scss" scoped>
492
- @import '~@/styles/selector.scss';
493
502
  .user-selector_block {
494
503
  width: calc(100% - 25px);
495
504
  background: #fff;
@@ -500,10 +509,6 @@
500
509
  top: 50%;
501
510
  background: unset !important;
502
511
  }
503
- .el-input__inner {
504
- height: 32px;
505
- line-height: 32px;
506
- }
507
512
 
508
513
  .el-input__inner[aria-invalid='true'] {
509
514
  border-color: #f56c6c;
@@ -32,14 +32,8 @@ const formula = {
32
32
  vnode.context.$set(vnode.context.data[pathAry[1]], pathAry[2], '')
33
33
  } else if (pathAry.length == 4) {
34
34
  let key = /^(\w+)\[(\d+)\]$/.exec(pathAry[2])
35
- // 存在dialogData则是子表编辑模式,dialogData.dialogVisible为true则是打开弹窗
36
- const name = (pathAry[2] || '').substring(4).split('[')
37
- const dialogData =
38
- vnode.context.$refs[`HtSubEditModeDialog_${name[0]}`] || {}
39
35
  vnode.context.$set(
40
- dialogData.dialogVisible
41
- ? dialogData.row
42
- : vnode.context.data[pathAry[1]][key[1]][key[2]],
36
+ vnode.context.data[pathAry[1]][key[1]][key[2]],
43
37
  pathAry[3],
44
38
  ''
45
39
  )
package/src/index.js CHANGED
@@ -42,7 +42,6 @@ import HtEditor from '../packages/Editor/index'
42
42
  import HtPicture from '../packages/picture/index'
43
43
  import HtExplain from '../packages/Explain/index'
44
44
  import HtAvatarImage from '../packages/Avatar/index'
45
- import HtSubEditModeDialog from '../packages/SubEditModeDialog/index'
46
45
  import {
47
46
  HtH1,
48
47
  HtH2,
@@ -231,7 +230,6 @@ const HotentUi = {
231
230
  HtPostDialog,
232
231
  HtJobDialog,
233
232
  HtRoleDialog,
234
- HtSubEditModeDialog,
235
233
  }
236
234
 
237
235
  HotentUi.install = (Vue, opts = {}) => {
@@ -10,28 +10,13 @@ export default {
10
10
  transitionIndex: -1,
11
11
  left_image: '',
12
12
  right_image: '',
13
- collapseType: 'expand',
14
- subDataArr: [],
15
13
  }
16
14
  },
17
15
  computed: {
18
- showMobileEdit() {
19
- return (subName) => {
20
- if (this.permission && this.permission.fields[subName]) {
21
- return Object.keys(this.permission.fields[subName]).some((k) => {
22
- return (
23
- this.permission.fields[subName][k] == 'b' ||
24
- this.permission.fields[subName][k] == 'w'
25
- )
26
- })
27
- }
28
- return false
29
- }
30
- },
31
16
  // 子表前端分页过滤器
32
17
  pagingSubData() {
33
18
  const me = this
34
- return function(datapath) {
19
+ return function (datapath) {
35
20
  // 通过子表数据路径获取分页数据
36
21
  return SubPagination.pagingByPath(datapath, me)
37
22
  }
@@ -69,25 +54,6 @@ export default {
69
54
  }
70
55
  },
71
56
  methods: {
72
- getSunExpandArr(data, type) {
73
- return this.getExpandArr(data, type)
74
- },
75
- getSubEditModeData(data = {}, type) {
76
- if (type === 'edit') return
77
- this.$root.$emit(
78
- 'add-new-collapse-item',
79
- data.sub_guid,
80
- this.collapseType
81
- )
82
- this.subDataArr.push(data)
83
- },
84
- editSubRow(row, name) {
85
- this.$refs[`HtSubEditModeDialog_${name}`].showDialog({
86
- data: row,
87
- mainData: this.data,
88
- type: 'edit',
89
- })
90
- },
91
57
  //合计计算
92
58
  getSummaries(param, list) {
93
59
  let CancelTheCalculation = sessionStorage.getItem(
@@ -291,7 +257,7 @@ export default {
291
257
  let exp = calc.mathExp
292
258
  if (!exp) return null
293
259
  var reg = /([\[|\{]).*?\((.*?)\)[\}|\]]/g
294
- exp = exp.replace(reg, function() {
260
+ exp = exp.replace(reg, function () {
295
261
  var symbol = arguments[1],
296
262
  name = arguments[2]
297
263
  const prop = name.split('.')[1]
@@ -388,7 +354,6 @@ export default {
388
354
  return num
389
355
  },
390
356
  getExpandArr(data, type) {
391
- this.collapseType = type
392
357
  if (type === 'expand' && data) {
393
358
  let arr = []
394
359
  data.forEach((item) => {
@@ -403,7 +368,7 @@ export default {
403
368
  if (this.isPrint) {
404
369
  this.$router.go(-1)
405
370
  }
406
- setTimeout(function() {
371
+ setTimeout(function () {
407
372
  location.reload()
408
373
  }, 200)
409
374
  },
@@ -489,7 +454,7 @@ export default {
489
454
  this.$forceUpdate()
490
455
  },
491
456
  //子表默认值回填
492
- addSubTab(subTabPath, subEditMode, name) {
457
+ addSubTab(subTabPath) {
493
458
  let pathArr = subTabPath.split('.')
494
459
  if (pathArr.length < 3) {
495
460
  this.$message({
@@ -509,9 +474,9 @@ export default {
509
474
  //把数组里面的值为 null 转换为空字符串
510
475
  let str = JSON.stringify(subInitData).replace(/null/g, '""')
511
476
  let subData = JSON.parse(str)
512
- this.subDataArr = this.data[pathArr[1]][pathArr[2]]
477
+ const subDataArr = this.data[pathArr[1]][pathArr[2]]
513
478
  //子表添加后的长度,因为在nextTick中,子表已经添加完毕。
514
- const nextIndex = this.subDataArr.length
479
+ const nextIndex = subDataArr.length
515
480
  for (var key in subData) {
516
481
  //点添加时判断要新增子表记录中的孙表是否有值
517
482
  if (key.indexOf('sub_') == 0) {
@@ -532,16 +497,8 @@ export default {
532
497
  }
533
498
  let fillObj = this.toFillOrg(pathArr[1] + '.' + pathArr[2], subData)
534
499
  fillObj.sub_guid = this.guid()
535
- if (subEditMode == 2) {
536
- this.$refs[`HtSubEditModeDialog_${name}`].showDialog({
537
- data: fillObj,
538
- mainData: this.data,
539
- type: 'add',
540
- })
541
- return
542
- }
543
500
  this.$root.$emit('add-new-collapse-item', fillObj.sub_guid)
544
- this.subDataArr.push(fillObj)
501
+ subDataArr.push(fillObj)
545
502
  }
546
503
  },
547
504
  //子表添加头部样式
@@ -557,13 +514,14 @@ export default {
557
514
  return { '--headerBgColor': color ? color : '#f4f4f4' }
558
515
  },
559
516
  guid() {
560
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(
561
- c
562
- ) {
563
- var r = (Math.random() * 16) | 0,
564
- v = c == 'x' ? r : (r & 0x3) | 0x8
565
- return v.toString(16)
566
- })
517
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(
518
+ /[xy]/g,
519
+ function (c) {
520
+ var r = (Math.random() * 16) | 0,
521
+ v = c == 'x' ? r : (r & 0x3) | 0x8
522
+ return v.toString(16)
523
+ }
524
+ )
567
525
  },
568
526
  //孙表默认值回填
569
527
  addSunTab(subTabPath, index) {
@@ -840,17 +798,15 @@ export default {
840
798
  if (conf.code) {
841
799
  const codePath = conf.code.split('.')
842
800
  if (!this.data[paths[0]][paths[1]][0][codePath[2]]) {
843
- this.data[paths[0]][paths[1]][0][
844
- codePath[2]
845
- ] = this.fillOrg.code
801
+ this.data[paths[0]][paths[1]][0][codePath[2]] =
802
+ this.fillOrg.code
846
803
  }
847
804
  }
848
805
  if (conf.name) {
849
806
  const namePath = conf.name.split('.')
850
807
  if (!this.data[paths[0]][paths[1]][0][namePath[2]]) {
851
- this.data[paths[0]][paths[1]][0][
852
- namePath[2]
853
- ] = this.fillOrg.name
808
+ this.data[paths[0]][paths[1]][0][namePath[2]] =
809
+ this.fillOrg.name
854
810
  }
855
811
  }
856
812
  }
@@ -11,10 +11,10 @@
11
11
  .ht-selector__table {
12
12
  height: 380px;
13
13
  }
14
- .el-pagination {
14
+ .el-pagination{
15
15
  white-space: pre-wrap !important;
16
16
  }
17
- }
17
+ }
18
18
  }
19
19
 
20
20
  @media (min-width: 1400px) {
@@ -128,43 +128,3 @@
128
128
  }
129
129
  }
130
130
  }
131
-
132
- .custom-selector-mobile {
133
- .custom-selector-mobile-box {
134
- display: flex;
135
- min-height: 32px;
136
- align-items: center;
137
- padding: 4px 14px;
138
- flex-wrap: wrap;
139
- gap: 4px;
140
- line-height: 22px;
141
- padding-right: 40px;
142
- box-sizing: border-box;
143
- .el-icon-error {
144
- color: #909399;
145
- }
146
- }
147
- .el-input__inner {
148
- position: absolute;
149
- left: 0;
150
- top: 0;
151
- right: 0;
152
- bottom: 0;
153
- user-select: none;
154
- background: none;
155
- color: transparent !important;
156
- pointer-events: none;
157
- height: 100%;
158
- }
159
- .el-input__suffix-inner {
160
- display: flex;
161
- align-items: center;
162
- }
163
- .el-icon-circle-close {
164
- margin-right: 3px;
165
- }
166
- .user-icon,
167
- .el-icon-circle-close {
168
- display: inline-block !important;
169
- }
170
- }
@@ -90,17 +90,16 @@ col[width='1'] {
90
90
  cursor: pointer;
91
91
  color: #dbdbdb;
92
92
  }
93
- .el-icon-search,
94
93
  .user-icon,
95
94
  .org-icon {
96
95
  display: none;
97
96
  }
98
97
  }
99
- // .el-input {
100
- // .el-input__inner {
101
- // color: #fff;
102
- // }
103
- // }
98
+ .el-input {
99
+ .el-input__inner {
100
+ color: #fff;
101
+ }
102
+ }
104
103
  }
105
104
  .el-select__tags_readonly {
106
105
  .tag-wrap {
package/src/utils.js CHANGED
@@ -1163,13 +1163,6 @@ var utils = {
1163
1163
  return url
1164
1164
  }
1165
1165
  },
1166
- guid: () => {
1167
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
1168
- var r = (Math.random() * 16) | 0,
1169
- v = c == 'x' ? r : (r & 0x3) | 0x8
1170
- return v.toString(16)
1171
- })
1172
- },
1173
1166
  }
1174
1167
 
1175
1168
  // 在数组上扩展一个删除指定项的方法
@@ -1,7 +0,0 @@
1
- import subEditModeDialog from './src/main.vue'
2
-
3
- subEditModeDialog.install = function(Vue) {
4
- Vue.component(subEditModeDialog.name, subEditModeDialog)
5
- }
6
-
7
- export default subEditModeDialog