three-trees-ui 1.0.10 → 1.0.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": "three-trees-ui",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "publicPath": "/ui",
5
5
  "author": "hotent",
6
6
  "private": false,
@@ -7,7 +7,7 @@
7
7
  :before-close="dialogCancel"
8
8
  append-to-body
9
9
  top="6vh"
10
- width="60%"
10
+ width="75%"
11
11
  @opened="afterOpen"
12
12
  >
13
13
  <el-container :style="style" style="overflow: auto">
@@ -46,13 +46,15 @@
46
46
  :key="index"
47
47
  class="search-item"
48
48
  >
49
- <p style="font-size: 14px">{{ condition.comment }}:</p>
49
+ <p :title="condition.comment">{{ condition.comment }}:</p>
50
50
  <!-- input输入框 -->
51
- <div v-if="condition.controllerType == '1'">
51
+ <div
52
+ v-if="condition.controllerType == '1'"
53
+ class="search-item_main"
54
+ >
52
55
  <el-input
53
56
  v-model="queryParams[index][condition.field]"
54
57
  size="small"
55
- style="width: 180px; padding: 10px 0; margin: 0 5px 0 5px"
56
58
  clearable
57
59
  :placeholder="placeholders[index]"
58
60
  prefix-icon="el-icon-search"
@@ -62,7 +64,7 @@
62
64
  <!-- 单选按钮 -->
63
65
  <div
64
66
  v-if="condition.controllerType == '2'"
65
- style="margin-right: 10px"
67
+ class="search-item_main"
66
68
  >
67
69
  <el-radio
68
70
  v-for="(itemR, $index1) in condition.config.options"
@@ -75,8 +77,8 @@
75
77
  </div>
76
78
  <!-- 下拉框 -->
77
79
  <div
80
+ class="search-item_main"
78
81
  v-if="condition.controllerType == '3'"
79
- style="margin-right: 10px"
80
82
  >
81
83
  <!-- 静态选项 -->
82
84
  <ht-select
@@ -97,7 +99,7 @@
97
99
  <!-- 标签 -->
98
100
  <div
99
101
  v-if="condition.controllerType == '4'"
100
- style="margin-right: 10px"
102
+ class="search-item_main"
101
103
  >
102
104
  <eip-tag
103
105
  v-model="queryParams[index][condition.field]"
@@ -110,10 +112,13 @@
110
112
  <!-- 日期 -->
111
113
  <div
112
114
  v-if="condition.controllerType == '6'"
113
- style="margin-right: 10px"
115
+ class="search-item_main"
114
116
  >
115
117
  <!-- 根据日期的条件类型来判断展示单个日期还是日期范围 -->
116
- <div v-if="condition.condition == 'BETWEEN'">
118
+ <div
119
+ v-if="condition.condition == 'BETWEEN'"
120
+ class="search-item_date"
121
+ >
117
122
  <ht-date
118
123
  v-model="queryParams[index].startDate"
119
124
  :format="condition.config.inputFormat"
@@ -136,7 +141,7 @@
136
141
  <!-- 选择器 -->
137
142
  <div
138
143
  v-if="condition.controllerType == '7'"
139
- style="margin-right: 10px"
144
+ class="search-item_main"
140
145
  >
141
146
  <ht-user-selector-input
142
147
  v-model="queryParams[index].selectName"
@@ -202,7 +207,7 @@
202
207
  <!-- 对话框 -->
203
208
  <div
204
209
  v-if="condition.controllerType == '5'"
205
- style="margin-right: 10px"
210
+ class="search-item_main"
206
211
  >
207
212
  <ht-custom-dialog
208
213
  v-model="queryParams[index][condition.field]"
@@ -986,7 +991,9 @@
986
991
  if (
987
992
  this.jumpParamKey &&
988
993
  this.isHaveJumpUrl &&
989
- this.modelName == 'data.' + con['target'][0]
994
+ (this.modelName == 'data.' + con['target'][0] ||
995
+ (this.modelName.includes('item.') &&
996
+ con['target'][0].endsWith(this.modelName.split('.')[1])))
990
997
  ) {
991
998
  val += `${item[con.from]}¯${this.jumpParamKey}:${
992
999
  this.selectOrgs[index][this.jumpParamKey]
@@ -1647,11 +1654,17 @@
1647
1654
  if (
1648
1655
  this.jumpParamKey &&
1649
1656
  this.isHaveJumpUrl &&
1650
- this.modelName == 'data.' + con['target'][0]
1657
+ (this.modelName == 'data.' + con['target'][0] ||
1658
+ (this.modelName.includes('item.') &&
1659
+ con['target'][0].endsWith(this.modelName.split('.')[1])))
1651
1660
  ) {
1661
+ // 需根据key 找到对应 返回数据的返回名称
1662
+ let returnMapKey = returnStr.find((k) => {
1663
+ return k.field == this.jumpParamKey
1664
+ }).comment
1652
1665
  val += `${decodeURIComponent(item[from])}¯${
1653
1666
  this.jumpParamKey
1654
- }:${item[this.jumpParamKey]},`
1667
+ }:${item[returnMapKey]},`
1655
1668
  } else {
1656
1669
  val += decodeURIComponent(item[from]) + ','
1657
1670
  }
@@ -2046,19 +2059,56 @@
2046
2059
  margin-top: 10px;
2047
2060
  }
2048
2061
 
2049
- .middle-header {
2062
+ ::v-deep .middle-header {
2050
2063
  height: unset !important;
2051
2064
  display: flex;
2052
2065
  flex-direction: row;
2053
2066
  flex-wrap: wrap;
2067
+ padding-top: 15px;
2054
2068
  .search-item {
2055
2069
  display: flex;
2056
2070
  // width: 33.33%;
2057
- margin-right: 12px;
2071
+ margin-right: 10px;
2058
2072
  align-items: center;
2059
- }
2060
- .btn-wrap {
2061
- line-height: 50px;
2073
+ width: 374px;
2074
+ margin-bottom: 15px;
2075
+ > p {
2076
+ margin: 0;
2077
+ padding: 0;
2078
+ width: 100px;
2079
+ overflow: hidden;
2080
+ white-space: nowrap;
2081
+ text-overflow: ellipsis;
2082
+ text-align: right;
2083
+ margin-right: 5px;
2084
+ font-size: 14px;
2085
+ }
2086
+ .search-item_main {
2087
+ flex: 1;
2088
+ overflow: hidden;
2089
+ .inputs.ht-form-inputs__inline {
2090
+ width: 100%;
2091
+ .inputs.ht-form-inputs__inline {
2092
+ width: 100%;
2093
+ }
2094
+ }
2095
+
2096
+ > .el-input {
2097
+ width: 100%;
2098
+ }
2099
+ .search-item_date {
2100
+ display: flex;
2101
+ align-items: center;
2102
+ width: 100%;
2103
+ .inputs.ht-form-inputs__inline {
2104
+ flex: 1;
2105
+ }
2106
+ }
2107
+ .el-date-editor.el-input,
2108
+ .el-date-editor.el-input__inner {
2109
+ width: 100%;
2110
+ }
2111
+ }
2062
2112
  }
2063
2113
  }
2064
2114
 
@@ -938,7 +938,9 @@
938
938
  if (
939
939
  this.jumpParamKey &&
940
940
  this.isHaveJumpUrl &&
941
- this.modelName == 'data.' + con['target'][0]
941
+ (this.modelName == 'data.' + con['target'][0] ||
942
+ (this.modelName.includes('item.') &&
943
+ con['target'][0].endsWith(this.modelName.split('.')[1])))
942
944
  ) {
943
945
  val += `${item[con.from]}¯${this.jumpParamKey}:${
944
946
  this.selectOrgs[index][this.jumpParamKey]
@@ -1465,11 +1467,17 @@
1465
1467
  if (
1466
1468
  this.jumpParamKey &&
1467
1469
  this.isHaveJumpUrl &&
1468
- this.modelName == 'data.' + con['target'][0]
1470
+ (this.modelName == 'data.' + con['target'][0] ||
1471
+ (this.modelName.includes('item.') &&
1472
+ con['target'][0].endsWith(this.modelName.split('.')[1])))
1469
1473
  ) {
1474
+ // 需根据key 找到对应 返回数据的返回名称
1475
+ let returnMapKey = returnStr.find((k) => {
1476
+ return k.field == this.jumpParamKey
1477
+ }).comment
1470
1478
  val += `${decodeURIComponent(item[from])}¯${
1471
1479
  this.jumpParamKey
1472
- }:${item[this.jumpParamKey]},`
1480
+ }:${item[returnMapKey]},`
1473
1481
  } else {
1474
1482
  val += decodeURIComponent(item[from]) + ','
1475
1483
  }
@@ -2,9 +2,13 @@
2
2
  <div class="inputs">
3
3
  <el-tooltip
4
4
  :placement="tooltipplacement || defualtTooltipplacement"
5
- :disabled="inputWriteable && !errors.has('custom-form.' + inputName)"
5
+ :disabled="
6
+ inputWriteable && errors && !errors.has('custom-form.' + inputName)
7
+ "
6
8
  >
7
- <div slot="content">{{ errors.first('custom-form.' + inputName) }}</div>
9
+ <div v-if="errors && errors.first" slot="content">
10
+ {{ errors.first('custom-form.' + inputName) }}
11
+ </div>
8
12
  <div
9
13
  v-if="inputWriteable"
10
14
  style="width: 100%"
@@ -21,7 +25,7 @@
21
25
  <span
22
26
  v-for="(item, index) in inputVal"
23
27
  :key="item.value"
24
- class="el-tag el-tag--info el-tag--small"
28
+ class="el-tag el-tag--info el-tag--small no-background"
25
29
  @click.stop="jumpUrl(item)"
26
30
  >
27
31
  <span
@@ -93,11 +97,11 @@
93
97
  </div>
94
98
  </div>
95
99
  </el-tooltip>
96
- <span v-if="!inputWriteable">
100
+ <span v-if="!inputWriteable" class="dialog-readonly">
97
101
  <span
98
102
  v-for="item in inputVal"
99
103
  :key="item.value"
100
- class="el-tag el-tag--info el-tag--small"
104
+ class="el-tag el-tag--info el-tag--small no-background"
101
105
  style="margin-right: 8px"
102
106
  @click.stop="jumpUrl(item)"
103
107
  >
@@ -136,7 +140,7 @@
136
140
  @calacInputSuffixHeight="calacInputSuffixHeight"
137
141
  @updateInput="updateInput"
138
142
  ></custom-dialog>
139
- <span v-validate style="display: none">
143
+ <span style="display: none">
140
144
  <slot name="labeldesc">{{ inputName }}</slot>
141
145
  </span>
142
146
  <ht-field-tail :field-name="inputName" :input-value="value" />
@@ -219,10 +223,16 @@
219
223
  let result = []
220
224
  nameAry.forEach((m) => {
221
225
  // 带url跳转参数的 使用上横杆区分参数 值格式为 名称¯跳转key:跳转value
226
+ // 上横向保存数据库后 有可能被改变此处兼容写了一种上横线
222
227
  let n = {}
223
- if (m.includes('¯') && m.split('¯')[1]) {
224
- n.value = m.split('¯')[0]
225
- let jumpParamStr = m.split('¯')[1]
228
+ if (
229
+ (m.includes('¯') && m.split('¯')[1]) ||
230
+ (m.includes('ˉ') && m.split('ˉ')[1])
231
+ ) {
232
+ let val1 = m.includes('¯') ? m.split('¯')[0] : m.split('ˉ')[0]
233
+ let val2 = m.includes('¯') ? m.split('¯')[1] : m.split('ˉ')[1]
234
+ n.value = val1
235
+ let jumpParamStr = val2
226
236
  if (jumpParamStr) {
227
237
  let jumpParam = jumpParamStr.split(':')
228
238
  n.jumpParamKey = jumpParam[0]
@@ -254,26 +264,28 @@
254
264
  this.getDialogConfig()
255
265
  },
256
266
  mounted() {
257
- const { subScopeEl } = utils.getSubScopeElAndIndex(this.$el)
267
+ setTimeout(() => {
268
+ const { subScopeEl } = utils.getSubScopeElAndIndex(this.$el)
258
269
 
259
- if (subScopeEl) {
260
- if (
261
- subScopeEl.getAttribute('row_readonly') == 'true' ||
262
- subScopeEl.getAttribute('row_readonly') === true
263
- ) {
264
- this.writeable = false
265
- } else {
266
- const className = Array.prototype.find.call(
267
- subScopeEl.classList,
268
- (item) => item.startsWith('row_readonly__')
269
- )
270
- if (className && className == 'row_readonly__true') {
270
+ if (subScopeEl) {
271
+ if (
272
+ subScopeEl.getAttribute('row_readonly') == 'true' ||
273
+ subScopeEl.getAttribute('row_readonly') === true
274
+ ) {
271
275
  this.writeable = false
276
+ } else {
277
+ const className = Array.prototype.find.call(
278
+ subScopeEl.classList,
279
+ (item) => item.startsWith('row_readonly__')
280
+ )
281
+ if (className && className == 'row_readonly__true') {
282
+ this.writeable = false
283
+ }
272
284
  }
273
285
  }
274
- }
275
- //获取对话框按钮名称宽度
276
- this.calacInputSuffixWidth()
286
+ //获取对话框按钮名称宽度
287
+ this.calacInputSuffixWidth()
288
+ }, 50)
277
289
  },
278
290
  methods: {
279
291
  // 跳转url页面
@@ -598,4 +610,22 @@
598
610
  cursor: pointer;
599
611
  color: #409eff !important;
600
612
  }
613
+ .el-tag.el-tag--info.no-background {
614
+ background: none;
615
+ border: none;
616
+ }
617
+ .dialog-readonly {
618
+ & > .el-tag {
619
+ &::after {
620
+ display: inline;
621
+ content: ',';
622
+ }
623
+ }
624
+ & > .el-tag:last-child {
625
+ &::after {
626
+ display: none;
627
+ content: '';
628
+ }
629
+ }
630
+ }
601
631
  </style>
@@ -109,7 +109,7 @@
109
109
  return this.errors && this.errors.has(this.fieldScopePath)
110
110
  },
111
111
  errorMessage: function() {
112
- return this.errors.first(this.fieldScopePath)
112
+ return this.errors && this.errors.first(this.fieldScopePath)
113
113
  },
114
114
  formatInputValue() {
115
115
  let value = []
@@ -137,27 +137,31 @@
137
137
  },
138
138
  },
139
139
  mounted() {
140
- this.scopeName = utils.getSomeAttributeFromParentElement(
141
- this.$el.parentElement,
142
- 'data-vv-scope'
143
- )
144
- const { subScopeEl } = utils.getSubScopeElAndIndex(this.$el.parentElement)
145
- if (subScopeEl) {
146
- if (
147
- subScopeEl.getAttribute('row_readonly') == 'true' ||
148
- subScopeEl.getAttribute('row_readonly') === true
149
- ) {
150
- this.$emit('update:writeable', false)
151
- } else {
152
- const className = Array.prototype.find.call(
153
- subScopeEl.classList,
154
- (item) => item.startsWith('row_readonly__')
155
- )
156
- if (className && className == 'row_readonly__true') {
140
+ setTimeout(() => {
141
+ this.scopeName = utils.getSomeAttributeFromParentElement(
142
+ this.$el.parentElement,
143
+ 'data-vv-scope'
144
+ )
145
+ const { subScopeEl } = utils.getSubScopeElAndIndex(
146
+ this.$el.parentElement
147
+ )
148
+ if (subScopeEl) {
149
+ if (
150
+ subScopeEl.getAttribute('row_readonly') == 'true' ||
151
+ subScopeEl.getAttribute('row_readonly') === true
152
+ ) {
157
153
  this.$emit('update:writeable', false)
154
+ } else {
155
+ const className = Array.prototype.find.call(
156
+ subScopeEl.classList,
157
+ (item) => item.startsWith('row_readonly__')
158
+ )
159
+ if (className && className == 'row_readonly__true') {
160
+ this.$emit('update:writeable', false)
161
+ }
158
162
  }
159
163
  }
160
- }
164
+ }, 50)
161
165
  },
162
166
  created() {
163
167
  this.$validator = this.$root.$validator
@@ -72,23 +72,25 @@ export default {
72
72
  }
73
73
  },
74
74
  mounted() {
75
- const { subScopeEl } = utils.getSubScopeElAndIndex(this.$el)
76
- // 当前控件在子表行中,且配置了该行为只读
77
- if (subScopeEl) {
78
- if (
79
- subScopeEl.getAttribute('row_readonly') == 'true' ||
80
- subScopeEl.getAttribute('row_readonly') === true
81
- ) {
82
- this.writeable = false
83
- } else {
84
- const className = Array.prototype.find.call(
85
- subScopeEl.classList,
86
- (item) => item.startsWith('row_readonly__')
87
- )
88
- if (className && className == 'row_readonly__true') {
75
+ setTimeout(() => {
76
+ const { subScopeEl } = utils.getSubScopeElAndIndex(this.$el)
77
+ // 当前控件在子表行中,且配置了该行为只读
78
+ if (subScopeEl) {
79
+ if (
80
+ subScopeEl.getAttribute('row_readonly') == 'true' ||
81
+ subScopeEl.getAttribute('row_readonly') === true
82
+ ) {
89
83
  this.writeable = false
84
+ } else {
85
+ const className = Array.prototype.find.call(
86
+ subScopeEl.classList,
87
+ (item) => item.startsWith('row_readonly__')
88
+ )
89
+ if (className && className == 'row_readonly__true') {
90
+ this.writeable = false
91
+ }
90
92
  }
91
93
  }
92
- }
94
+ }, 50)
93
95
  },
94
96
  }
package/src/utils.js CHANGED
@@ -443,6 +443,9 @@ var utils = {
443
443
  },
444
444
  // 获取子表每一行所在的作用域元素及索引
445
445
  getSubScopeElAndIndex: (el) => {
446
+ if (!el || !(el instanceof HTMLElement)) {
447
+ return { subScopeEl: null, index: null, subname: null }
448
+ }
446
449
  let subScopeEl = utils.getParentElementByAttribute(el, 'data-subname')
447
450
  if (!subScopeEl) {
448
451
  subScopeEl = utils.getParentElementByClassNamePrefix(el, 'data-subname__')
@@ -549,7 +552,7 @@ var utils = {
549
552
  },
550
553
  // 获取指定dom元素的父级中具有指定属性的dom元素
551
554
  getParentElementByAttribute: (el, attribute) => {
552
- if (el === null || el === undefined) {
555
+ if (el === null || el === undefined || !(el instanceof HTMLElement)) {
553
556
  return null
554
557
  }
555
558
  if (!el.hasAttribute || typeof el.hasAttribute != 'function') {