three-trees-ui 1.0.11 → 1.0.13

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.11",
3
+ "version": "1.0.13",
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,36 +112,62 @@
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
- :format="condition.config.inputFormat"
120
- :valueFormat="condition.config.inputFormat"
124
+ :format="
125
+ condition.config.inputFormat.includes('mm:ss')
126
+ ? 'yyyy-MM-dd HH:mm:ss'
127
+ : condition.config.inputFormat
128
+ "
129
+ :valueFormat="
130
+ condition.config.inputFormat.includes('mm:ss')
131
+ ? 'yyyy-MM-dd HH:mm:ss'
132
+ : condition.config.inputFormat
133
+ "
121
134
  ></ht-date>
122
135
 
123
136
  <ht-date
124
137
  v-model="queryParams[index].endDate"
125
- :format="condition.config.inputFormat"
126
- :valueFormat="condition.config.inputFormat"
138
+ :format="
139
+ condition.config.inputFormat.includes('mm:ss')
140
+ ? 'yyyy-MM-dd HH:mm:ss'
141
+ : condition.config.inputFormat
142
+ "
143
+ :valueFormat="
144
+ condition.config.inputFormat.includes('mm:ss')
145
+ ? 'yyyy-MM-dd HH:mm:ss'
146
+ : condition.config.inputFormat
147
+ "
127
148
  ></ht-date>
128
149
  </div>
129
150
  <ht-date
130
151
  v-model="queryParams[index][condition.field]"
131
152
  v-else
132
- :format="condition.config.inputFormat"
133
- :valueFormat="condition.config.inputFormat"
153
+ :format="
154
+ condition.config.inputFormat.includes('mm:ss')
155
+ ? 'yyyy-MM-dd HH:mm:ss'
156
+ : condition.config.inputFormat
157
+ "
158
+ :valueFormat="
159
+ condition.config.inputFormat.includes('mm:ss')
160
+ ? 'yyyy-MM-dd HH:mm:ss'
161
+ : condition.config.inputFormat
162
+ "
134
163
  ></ht-date>
135
164
  </div>
136
165
  <!-- 选择器 -->
137
166
  <div
138
167
  v-if="condition.controllerType == '7'"
139
- style="margin-right: 10px"
168
+ class="search-item_main"
140
169
  >
141
170
  <ht-user-selector-input
142
- v-model="queryParams[index].selectName"
143
171
  v-if="condition.config.alias == 'user'"
144
172
  append-to-body
145
173
  @change="
@@ -149,7 +177,6 @@
149
177
  "
150
178
  ></ht-user-selector-input>
151
179
  <ht-org-selector-input
152
- v-model="queryParams[index].selectName"
153
180
  v-if="condition.config.alias == 'org'"
154
181
  append-to-body
155
182
  @change="
@@ -159,7 +186,6 @@
159
186
  "
160
187
  ></ht-org-selector-input>
161
188
  <ht-role-selector-input
162
- v-model="queryParams[index].selectName"
163
189
  v-if="condition.config.alias == 'role'"
164
190
  append-to-body
165
191
  @change="
@@ -169,7 +195,6 @@
169
195
  "
170
196
  ></ht-role-selector-input>
171
197
  <ht-job-selector-input
172
- v-model="queryParams[index].selectName"
173
198
  v-if="condition.config.alias == 'job'"
174
199
  append-to-body
175
200
  @change="
@@ -179,7 +204,6 @@
179
204
  "
180
205
  ></ht-job-selector-input>
181
206
  <ht-post-selector-input
182
- v-model="queryParams[index].selectName"
183
207
  v-if="condition.config.alias == 'post'"
184
208
  append-to-body
185
209
  @change="
@@ -189,7 +213,6 @@
189
213
  "
190
214
  ></ht-post-selector-input>
191
215
  <ht-dimension-selector-input
192
- v-model="queryParams[index].selectName"
193
216
  v-if="condition.config.alias == 'dimension'"
194
217
  append-to-body
195
218
  @change="
@@ -202,7 +225,7 @@
202
225
  <!-- 对话框 -->
203
226
  <div
204
227
  v-if="condition.controllerType == '5'"
205
- style="margin-right: 10px"
228
+ class="search-item_main"
206
229
  >
207
230
  <ht-custom-dialog
208
231
  v-model="queryParams[index][condition.field]"
@@ -1653,9 +1676,16 @@
1653
1676
  (this.modelName.includes('item.') &&
1654
1677
  con['target'][0].endsWith(this.modelName.split('.')[1])))
1655
1678
  ) {
1679
+ // 需根据key 找到对应 返回数据的返回名称
1680
+ let returnMap = returnStr.find((k) => {
1681
+ return (
1682
+ k.field.toLowerCase() == this.jumpParamKey.toLowerCase()
1683
+ )
1684
+ })
1685
+ let returnMapKey = returnMap ? returnMap.comment : ''
1656
1686
  val += `${decodeURIComponent(item[from])}¯${
1657
1687
  this.jumpParamKey
1658
- }:${item[this.jumpParamKey]},`
1688
+ }:${decodeURIComponent(item[returnMapKey])},`
1659
1689
  } else {
1660
1690
  val += decodeURIComponent(item[from]) + ','
1661
1691
  }
@@ -2050,19 +2080,56 @@
2050
2080
  margin-top: 10px;
2051
2081
  }
2052
2082
 
2053
- .middle-header {
2083
+ ::v-deep .middle-header {
2054
2084
  height: unset !important;
2055
2085
  display: flex;
2056
2086
  flex-direction: row;
2057
2087
  flex-wrap: wrap;
2088
+ padding-top: 15px;
2058
2089
  .search-item {
2059
2090
  display: flex;
2060
2091
  // width: 33.33%;
2061
- margin-right: 12px;
2092
+ margin-right: 10px;
2062
2093
  align-items: center;
2063
- }
2064
- .btn-wrap {
2065
- line-height: 50px;
2094
+ width: 374px;
2095
+ margin-bottom: 15px;
2096
+ > p {
2097
+ margin: 0;
2098
+ padding: 0;
2099
+ width: 100px;
2100
+ overflow: hidden;
2101
+ white-space: nowrap;
2102
+ text-overflow: ellipsis;
2103
+ text-align: right;
2104
+ margin-right: 5px;
2105
+ font-size: 14px;
2106
+ }
2107
+ .search-item_main {
2108
+ flex: 1;
2109
+ overflow: hidden;
2110
+ .inputs.ht-form-inputs__inline {
2111
+ width: 100%;
2112
+ .inputs.ht-form-inputs__inline {
2113
+ width: 100%;
2114
+ }
2115
+ }
2116
+
2117
+ > .el-input {
2118
+ width: 100%;
2119
+ }
2120
+ .search-item_date {
2121
+ display: flex;
2122
+ align-items: center;
2123
+ width: 100%;
2124
+ .inputs.ht-form-inputs__inline {
2125
+ flex: 1;
2126
+ }
2127
+ }
2128
+ .el-date-editor.el-input,
2129
+ .el-date-editor.el-input__inner {
2130
+ width: 100%;
2131
+ }
2132
+ }
2066
2133
  }
2067
2134
  }
2068
2135
 
@@ -113,7 +113,6 @@
113
113
  <!-- 选择器 -->
114
114
  <div v-if="condition.controllerType == '7'">
115
115
  <ht-user-selector-input
116
- v-model="queryParams[index].selectName"
117
116
  v-if="condition.config.alias == 'user'"
118
117
  append-to-body
119
118
  @change="
@@ -123,7 +122,6 @@
123
122
  "
124
123
  ></ht-user-selector-input>
125
124
  <ht-org-selector-input
126
- v-model="queryParams[index].selectName"
127
125
  v-if="condition.config.alias == 'org'"
128
126
  append-to-body
129
127
  @change="
@@ -133,7 +131,6 @@
133
131
  "
134
132
  ></ht-org-selector-input>
135
133
  <ht-role-selector-input
136
- v-model="queryParams[index].selectName"
137
134
  v-if="condition.config.alias == 'role'"
138
135
  append-to-body
139
136
  @change="
@@ -143,7 +140,6 @@
143
140
  "
144
141
  ></ht-role-selector-input>
145
142
  <ht-job-selector-input
146
- v-model="queryParams[index].selectName"
147
143
  v-if="condition.config.alias == 'job'"
148
144
  append-to-body
149
145
  @change="
@@ -153,7 +149,6 @@
153
149
  "
154
150
  ></ht-job-selector-input>
155
151
  <ht-post-selector-input
156
- v-model="queryParams[index].selectName"
157
152
  v-if="condition.config.alias == 'post'"
158
153
  append-to-body
159
154
  @change="
@@ -163,7 +158,6 @@
163
158
  "
164
159
  ></ht-post-selector-input>
165
160
  <ht-dimension-selector-input
166
- v-model="queryParams[index].selectName"
167
161
  v-if="condition.config.alias == 'dimension'"
168
162
  append-to-body
169
163
  @change="
@@ -1471,9 +1465,16 @@
1471
1465
  (this.modelName.includes('item.') &&
1472
1466
  con['target'][0].endsWith(this.modelName.split('.')[1])))
1473
1467
  ) {
1468
+ // 需根据key 找到对应 返回数据的返回名称
1469
+ let returnMap = returnStr.find((k) => {
1470
+ return (
1471
+ k.field.toLowerCase() == this.jumpParamKey.toLowerCase()
1472
+ )
1473
+ })
1474
+ let returnMapKey = returnMap ? returnMap.comment : ''
1474
1475
  val += `${decodeURIComponent(item[from])}¯${
1475
1476
  this.jumpParamKey
1476
- }:${item[this.jumpParamKey]},`
1477
+ }:${decodeURIComponent(item[returnMapKey])},`
1477
1478
  } else {
1478
1479
  val += decodeURIComponent(item[from]) + ','
1479
1480
  }
@@ -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" />
@@ -260,26 +264,31 @@
260
264
  this.getDialogConfig()
261
265
  },
262
266
  mounted() {
263
- const { subScopeEl } = utils.getSubScopeElAndIndex(this.$el)
267
+ setTimeout(() => {
268
+ const { subScopeEl } = utils.getSubScopeElAndIndex(this.$el)
264
269
 
265
- if (subScopeEl) {
266
- if (
267
- subScopeEl.getAttribute('row_readonly') == 'true' ||
268
- subScopeEl.getAttribute('row_readonly') === true
269
- ) {
270
- this.writeable = false
271
- } else {
272
- const className = Array.prototype.find.call(
273
- subScopeEl.classList,
274
- (item) => item.startsWith('row_readonly__')
275
- )
276
- if (className && className == 'row_readonly__true') {
270
+ if (subScopeEl) {
271
+ if (
272
+ subScopeEl.getAttribute('row_readonly') == 'true' ||
273
+ subScopeEl.getAttribute('row_readonly') === true
274
+ ) {
277
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
+ }
278
284
  }
279
285
  }
280
- }
281
- //获取对话框按钮名称宽度
282
- this.calacInputSuffixWidth()
286
+ //获取对话框按钮名称宽度
287
+ this.calacInputSuffixWidth()
288
+ if (this.value && this.inputWriteable) {
289
+ this.calacInputSuffixHeight()
290
+ }
291
+ }, 50)
283
292
  },
284
293
  methods: {
285
294
  // 跳转url页面
@@ -604,4 +613,22 @@
604
613
  cursor: pointer;
605
614
  color: #409eff !important;
606
615
  }
616
+ .el-tag.el-tag--info.no-background {
617
+ background: none;
618
+ border: none;
619
+ }
620
+ .dialog-readonly {
621
+ & > .el-tag {
622
+ &::after {
623
+ display: inline;
624
+ content: ',';
625
+ }
626
+ }
627
+ & > .el-tag:last-child {
628
+ &::after {
629
+ display: none;
630
+ content: '';
631
+ }
632
+ }
633
+ }
607
634
  </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') {