three-trees-ui 1.1.2 → 1.1.3

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": "three-trees-ui",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "publicPath": "/ui",
5
5
  "author": "hotent",
6
6
  "private": false,
@@ -1,8 +1,8 @@
1
1
  <template>
2
2
  <el-collapse
3
3
  ref="collapse"
4
+ v-model="openDefaultArr"
4
5
  :accordion="accordion"
5
- :value="openDefaultArr"
6
6
  @change="handleChange"
7
7
  >
8
8
  <slot></slot>
@@ -15,6 +15,7 @@
15
15
  name: 'HtCollapse',
16
16
  mixins: [regionValidator],
17
17
  props: {
18
+ value: Array,
18
19
  accordion: {
19
20
  type: Boolean,
20
21
  default: false,
@@ -40,6 +41,8 @@
40
41
  openDefaultArr: {
41
42
  handler(val) {
42
43
  this.$root.$emit('collapse-active-names', val)
44
+ console.log('zlc val', val)
45
+ this.$emit('input', val)
43
46
  },
44
47
  deep: true,
45
48
  },
@@ -363,7 +363,7 @@
363
363
  </div>
364
364
  <el-scrollbar
365
365
  v-if="selectsCount > 0"
366
- class="selector-selected__scroll"
366
+ class="selector-selected-height"
367
367
  >
368
368
  <draggable
369
369
  v-model="selects"
@@ -2678,12 +2678,21 @@
2678
2678
  display: flex;
2679
2679
  align-items: center;
2680
2680
  justify-content: center;
2681
+ .el-dialog {
2682
+ height: calc(100vh - 60px);
2683
+ }
2681
2684
  .el-dialog__body {
2682
2685
  overflow: hidden;
2683
2686
  }
2684
2687
  .hotent-custom-scrollbar {
2685
2688
  height: 100%;
2686
- display: flex;
2689
+ .el-scrollbar__view {
2690
+ display: flex;
2691
+ height: 100%;
2692
+ }
2693
+ }
2694
+ .el-container {
2695
+ flex-basis: min-content;
2687
2696
  }
2688
2697
 
2689
2698
  #container {
@@ -2707,13 +2716,21 @@
2707
2716
  }
2708
2717
  #right {
2709
2718
  order: 2;
2710
- width: 250px;
2711
- padding-left: 24px;
2712
- }
2713
- .el-card__body {
2714
- height: calc(var(--customHeight) - 130px - 48px - 25px - 24px);
2715
- overflow: auto;
2716
- @include base-scrollbar;
2719
+ width: 310px;
2720
+ padding: 24px;
2721
+ height: auto;
2722
+ box-sizing: border-box;
2723
+ .el-card {
2724
+ height: 100%;
2725
+ margin: 0;
2726
+ }
2727
+ .el-card__body {
2728
+ box-sizing: border-box;
2729
+ height: calc(100% - 48px);
2730
+ }
2731
+ .selector-selected-height {
2732
+ height: 100%;
2733
+ }
2717
2734
  }
2718
2735
  .el-card__header {
2719
2736
  height: 48px;
@@ -12,62 +12,51 @@
12
12
  <div
13
13
  v-if="inputWriteable"
14
14
  style="width: 100%"
15
- class="el-select"
16
- :class="{ 'has-value': value }"
15
+ :class="{ 'has-value': value, 'custom-selector-mobile': isMobile }"
16
+ @click="showEditInput"
17
17
  >
18
- <div
19
- ref="tagSpans"
20
- class="el-select__tags"
21
- :style="{ width: 'calc(100% - 10px - ' + inputSuffixWidth + 'px)' }"
22
- @click="showEditInput"
23
- >
24
- <span class="tag-wrap">
25
- <span
18
+ <div v-if="value && isSrcColor && !isMobile" class="custom-jump">
19
+ <span v-for="(item, index) in inputVal" :key="index">
20
+ <span class="src-color" @click.stop="jumpUrl(item)">
21
+ {{ item.value }}
22
+ </span>
23
+ <span v-if="index != inputVal.length - 1">,</span>
24
+ </span>
25
+ </div>
26
+ <div class="el-input el-input--suffix">
27
+ <div v-if="isMobile" class="custom-selector-mobile-box">
28
+ <div
26
29
  v-for="(item, index) in inputVal"
27
- :key="item.value"
28
- class="el-tag el-tag--info el-tag--small no-background"
29
- @click.stop="jumpUrl(item)"
30
+ :key="index"
31
+ class="common-selector-tag"
30
32
  >
31
33
  <span
32
- class="el-select__tags-text"
33
34
  :class="{ 'src-color': isSrcColor }"
35
+ @click.stop="jumpUrl(item)"
34
36
  >
35
37
  {{ item.value }}
36
38
  </span>
37
- <i
38
- class="el-tag__close el-icon-close"
39
- @click.stop="removeSelectOrg(index)"
40
- ></i>
41
- </span>
42
- </span>
43
- </div>
44
- <div class="el-input el-input--suffix">
39
+ <i class="el-icon-error" @click.stop="removeSelectOrg(index)"></i>
40
+ </div>
41
+ </div>
45
42
  <input
46
43
  ref="inputEl"
47
- v-model="inputVal"
44
+ v-model="calcInputValue"
48
45
  v-validate="inputValidate"
49
46
  type="text"
50
- readonly="readonly"
47
+ readonly
51
48
  :name="inputName"
52
49
  autocomplete="off"
53
50
  class="el-input__inner"
54
- :placeholder="placeholder"
55
- :style="{ height: inputSuffixHeight + 'px' }"
56
- @click="showEditInput"
51
+ :placeholder="placeholder || '请选择'"
57
52
  />
58
53
  <!-- 允许手动输入时 -->
59
54
  <el-input
60
55
  v-if="isAllowCustom && isEditInputShow"
61
56
  ref="editInputRef"
62
57
  v-model="customValue"
63
- clearable
64
58
  class="edit-input"
65
59
  size="mini"
66
- :style="{
67
- right: inputSuffixWidth - 1 + 'px',
68
- width: 'auto!important',
69
- height: inputSuffixHeight - 4 + 'px',
70
- }"
71
60
  @blur="editInputBlur"
72
61
  ></el-input>
73
62
  <span ref="inputSuffix" class="el-input__suffix" @click="showDialog">
@@ -76,23 +65,11 @@
76
65
  :class="{ 'has-clear-all': value }"
77
66
  >
78
67
  <i
68
+ v-if="value"
79
69
  class="el-icon-circle-close clear-icon"
80
70
  @click.stop="clear"
81
71
  ></i>
82
- <el-button slot="append" type="info" size="mini">
83
- <i
84
- :class="
85
- custdialog.icon
86
- ? 'el-input__icon ' + custdialog.icon
87
- : 'el-input__icon icon-duihuakuang'
88
- "
89
- :style="{
90
- fontSize: '17px',
91
- lineHeight: inputSuffixHeight + 'px',
92
- }"
93
- ></i>
94
- {{ custdialog.name }}
95
- </el-button>
72
+ <i class="el-icon-search"></i>
96
73
  </span>
97
74
  </span>
98
75
  </div>
@@ -106,49 +83,52 @@
106
83
  style="margin-right: 8px"
107
84
  @click.stop="jumpUrl(item)"
108
85
  >
109
- <span class="el-select__tags-text" :class="{ 'src-color': isSrcColor }">
86
+ <span class="el-select__tags-text">
110
87
  {{ item.value }}
111
88
  </span>
112
89
  </span>
113
90
  </span>
114
- <custom-mobile-dialog
115
- v-if="isMobile"
116
- ref="customMobileDialogRef"
117
- :model-name="modelName"
118
- :custdialog="custdialog"
119
- :sub-index="subIndex"
120
- :sun-index="sunIndex"
121
- :sub-path="subPath"
122
- :current-sub-data="currentSubData"
123
- :dialog-config="dialogConfig"
124
- :dialog-type="dialogType"
125
- @calacInputSuffixHeight="calacInputSuffixHeight"
126
- @updateInput="updateInput"
127
- ></custom-mobile-dialog>
128
- <custom-dialog
129
- v-else
130
- ref="customDialogRef"
131
- v-model="value"
132
- :model-name="modelName"
133
- :custdialog="custdialog"
134
- :sub-index="subIndex"
135
- :sun-index="sunIndex"
136
- :sub-path="subPath"
137
- :current-sub-data="currentSubData"
138
- :is-read-only="!inputWriteable"
139
- :dialog-config="dialogConfig"
140
- :dialog-type="dialogType"
141
- @calacInputSuffixHeight="calacInputSuffixHeight"
142
- @updateInput="updateInput"
143
- ></custom-dialog>
91
+ <template v-if="isDialogShow">
92
+ <custom-mobile-dialog
93
+ v-if="isMobile"
94
+ ref="customMobileDialogRef"
95
+ :model-name="modelName"
96
+ :custdialog="custdialog"
97
+ :sub-index="subIndex"
98
+ :sun-index="sunIndex"
99
+ :sub-path="subPath"
100
+ :current-sub-data="currentSubData"
101
+ :dialog-config="dialogConfig"
102
+ :dialog-type="dialogType"
103
+ @calacInputSuffixHeight="calacInputSuffixHeight"
104
+ @updateInput="updateInput"
105
+ ></custom-mobile-dialog>
106
+ <custom-dialog
107
+ v-else
108
+ ref="customDialogRef"
109
+ v-model="value"
110
+ :model-name="modelName"
111
+ :custdialog="custdialog"
112
+ :sub-index="subIndex"
113
+ :sun-index="sunIndex"
114
+ :sub-path="subPath"
115
+ :current-sub-data="currentSubData"
116
+ :is-read-only="!inputWriteable"
117
+ :dialog-config="dialogConfig"
118
+ :dialog-type="dialogType"
119
+ @calacInputSuffixHeight="calacInputSuffixHeight"
120
+ @updateInput="updateInput"
121
+ ></custom-dialog>
122
+ </template>
123
+
144
124
  <span style="display: none">
145
125
  <slot name="labeldesc">{{ inputName }}</slot>
146
126
  </span>
147
127
  <ht-field-tail :field-name="inputName" :input-value="value" />
148
128
  <el-dialog
129
+ v-if="isDialogFormShow"
149
130
  title="表单详情"
150
131
  :visible.sync="isDialogFormShow"
151
- v-if="isDialogFormShow"
152
132
  width="100%"
153
133
  custom-class="custom-dialog-form"
154
134
  fullscreen
@@ -206,6 +186,7 @@
206
186
  },
207
187
  data() {
208
188
  return {
189
+ isDialogShow: false,
209
190
  mobileSrc: '',
210
191
  isDialogFormShow: false,
211
192
  dialogConfig: null, // 对话框配置信息
@@ -238,6 +219,17 @@
238
219
  }
239
220
  },
240
221
  computed: {
222
+ calcInputValue: function() {
223
+ let name = ''
224
+ if (this.inputVal) {
225
+ name = this.inputVal
226
+ .map((k) => {
227
+ return k.value
228
+ })
229
+ .join(',')
230
+ }
231
+ return name
232
+ },
241
233
  inputVal: function() {
242
234
  if (!this.value || this.value == '||[]') {
243
235
  return null
@@ -310,10 +302,10 @@
310
302
  }
311
303
  }
312
304
  //获取对话框按钮名称宽度
313
- this.calacInputSuffixWidth()
314
- if (this.value && this.inputWriteable) {
315
- this.calacInputSuffixHeight()
316
- }
305
+ // this.calacInputSuffixWidth()
306
+ // if (this.value && this.inputWriteable) {
307
+ // this.calacInputSuffixHeight()
308
+ // }
317
309
  }, 50)
318
310
  },
319
311
  methods: {
@@ -394,8 +386,9 @@
394
386
  editInputBlur() {
395
387
  this.$emit('input', this.customValue)
396
388
  this.isEditInputShow = false
389
+ this.validateInput()
397
390
  },
398
- showEditInput() {
391
+ async showEditInput() {
399
392
  if (!this.isAllowCustom) {
400
393
  this.showDialog()
401
394
  return
@@ -406,10 +399,14 @@
406
399
  this.$refs.editInputRef.focus()
407
400
  })
408
401
  },
409
- showDialog() {
402
+ async showDialog() {
410
403
  if (!this.inputWriteable) {
411
404
  return
412
405
  }
406
+ if (this.isDialogShow === false) {
407
+ this.isDialogShow = true
408
+ await this.$nextTick()
409
+ }
413
410
  if (this.isMobile) {
414
411
  this.$refs.customMobileDialogRef.showDialog()
415
412
  } else {
@@ -429,7 +426,7 @@
429
426
  this.clear()
430
427
  }
431
428
  this.$emit('input', value)
432
- this.calacInputSuffixHeight()
429
+
433
430
  if (this.isMobile) {
434
431
  this.$refs.customMobileDialogRef.removeSelectOrg(item)
435
432
  } else {
@@ -439,30 +436,38 @@
439
436
  clear() {
440
437
  this.$emit('input', '')
441
438
  this.$refs.customDialogRef.clearAll()
442
- this.calacInputSuffixHeight()
439
+ this.validateInput()
443
440
  },
444
441
  calacInputSuffixHeight() {
445
442
  setTimeout(() => {
446
- if (!this.$refs.tagSpans) return
447
- if (this.$refs.tagSpans.offsetHeight) {
448
- this.inputSuffixHeight = this.$refs.tagSpans.offsetHeight + 5
449
- } else {
450
- this.inputSuffixHeight = 30
451
- }
443
+ // if (!this.$refs.tagSpans) return
444
+ // if (this.$refs.tagSpans.offsetHeight) {
445
+ // this.inputSuffixHeight = this.$refs.tagSpans.offsetHeight + 5
446
+ // } else {
447
+ // this.inputSuffixHeight = 30
448
+ // }
452
449
  // 触发验证
453
450
  if (this.$refs.inputEl) {
454
451
  this.$validator.validate(this.inputName)
455
452
  }
456
453
  }, 0)
457
- this.calacInputSuffixWidth()
454
+ // this.calacInputSuffixWidth()
458
455
  },
459
456
  calacInputSuffixWidth() {
460
- if (this.$refs.inputSuffix) {
461
- this.inputSuffixWidth = this.$refs.inputSuffix.offsetWidth + 1
462
- }
457
+ // if (this.$refs.inputSuffix) {
458
+ // this.inputSuffixWidth = this.$refs.inputSuffix.offsetWidth + 1
459
+ // }
460
+ },
461
+ validateInput() {
462
+ setTimeout(() => {
463
+ if (this.$refs.inputEl) {
464
+ this.$validator.validate(this.inputName)
465
+ }
466
+ })
463
467
  },
464
468
  updateInput(data) {
465
469
  this.$emit('input', data)
470
+ this.validateInput()
466
471
  },
467
472
  },
468
473
  }
@@ -470,15 +475,17 @@
470
475
  <style lang="scss" scoped>
471
476
  .edit-input {
472
477
  position: absolute;
473
- left: 1px;
474
- border: none;
475
478
  top: 50%;
476
479
  transform: translateY(-50%);
477
- z-index: 50;
480
+ height: 30px;
481
+ left: 1px;
482
+ right: 34px;
483
+ border: none;
484
+ z-index: 2;
478
485
  display: flex;
479
486
  align-items: center;
487
+ width: auto !important;
480
488
  ::v-deep .el-input__inner {
481
- height: 100%;
482
489
  border: none;
483
490
  }
484
491
  }
@@ -497,20 +504,9 @@
497
504
  color: #c0c4cc;
498
505
  }
499
506
  .el-input__suffix {
500
- position: absolute;
501
- height: 100%;
502
- right: 0px !important;
503
- top: 0;
504
- text-align: center;
505
- color: #c0c4cc;
506
- -webkit-transition: all 0.3s;
507
- transition: all 0.3s;
508
- pointer-events: none;
509
- z-index: 100;
510
- .has-clear-all {
511
- display: flex;
512
- align-items: center;
513
- }
507
+ display: flex;
508
+ flex-direction: column;
509
+ justify-content: center;
514
510
  }
515
511
  .el-dialog__body {
516
512
  padding: 0;
@@ -544,6 +540,11 @@
544
540
  height: 100%;
545
541
  }
546
542
  }
543
+ .el-input__inner {
544
+ height: 32px;
545
+ line-height: 32px;
546
+ }
547
+
547
548
  .el-input__inner[aria-invalid='true'] {
548
549
  border-color: #f56c6c;
549
550
  }
@@ -644,6 +645,7 @@
644
645
  margin: 8px 0;
645
646
  }
646
647
  .src-color {
648
+ font-size: 12px;
647
649
  cursor: pointer;
648
650
  color: #409eff !important;
649
651
  }
@@ -685,4 +687,58 @@
685
687
  }
686
688
  }
687
689
  }
690
+ .el-select {
691
+ line-height: normal;
692
+ }
693
+ .custom-jump {
694
+ position: absolute;
695
+ height: 28px;
696
+ left: 15px;
697
+ top: 50%;
698
+ transform: translateY(-50%);
699
+ right: 32px;
700
+ display: flex;
701
+ align-items: center;
702
+ background-color: #fff;
703
+ z-index: 1;
704
+ }
705
+ .custom-selector-mobile {
706
+ .custom-selector-mobile-box {
707
+ display: flex;
708
+ min-height: 32px;
709
+ align-items: center;
710
+ padding: 4px 14px;
711
+ flex-wrap: wrap;
712
+ gap: 4px;
713
+ line-height: 22px;
714
+ padding-right: 40px;
715
+ box-sizing: border-box;
716
+ .el-icon-error {
717
+ color: #909399;
718
+ }
719
+ }
720
+ .el-input__inner {
721
+ position: absolute;
722
+ left: 0;
723
+ top: 0;
724
+ right: 0;
725
+ bottom: 0;
726
+ user-select: none;
727
+ background: none;
728
+ color: transparent !important;
729
+ pointer-events: none;
730
+ height: 100%;
731
+ }
732
+ .el-input__suffix-inner {
733
+ display: flex;
734
+ align-items: center;
735
+ }
736
+ .el-icon-circle-close {
737
+ margin-right: 3px;
738
+ }
739
+ .user-icon,
740
+ .el-icon-circle-close {
741
+ display: inline-block !important;
742
+ }
743
+ }
688
744
  </style>