three-trees-ui 1.0.11 → 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.11",
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]"
@@ -1653,9 +1658,13 @@
1653
1658
  (this.modelName.includes('item.') &&
1654
1659
  con['target'][0].endsWith(this.modelName.split('.')[1])))
1655
1660
  ) {
1661
+ // 需根据key 找到对应 返回数据的返回名称
1662
+ let returnMapKey = returnStr.find((k) => {
1663
+ return k.field == this.jumpParamKey
1664
+ }).comment
1656
1665
  val += `${decodeURIComponent(item[from])}¯${
1657
1666
  this.jumpParamKey
1658
- }:${item[this.jumpParamKey]},`
1667
+ }:${item[returnMapKey]},`
1659
1668
  } else {
1660
1669
  val += decodeURIComponent(item[from]) + ','
1661
1670
  }
@@ -2050,19 +2059,56 @@
2050
2059
  margin-top: 10px;
2051
2060
  }
2052
2061
 
2053
- .middle-header {
2062
+ ::v-deep .middle-header {
2054
2063
  height: unset !important;
2055
2064
  display: flex;
2056
2065
  flex-direction: row;
2057
2066
  flex-wrap: wrap;
2067
+ padding-top: 15px;
2058
2068
  .search-item {
2059
2069
  display: flex;
2060
2070
  // width: 33.33%;
2061
- margin-right: 12px;
2071
+ margin-right: 10px;
2062
2072
  align-items: center;
2063
- }
2064
- .btn-wrap {
2065
- 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
+ }
2066
2112
  }
2067
2113
  }
2068
2114
 
@@ -1471,9 +1471,13 @@
1471
1471
  (this.modelName.includes('item.') &&
1472
1472
  con['target'][0].endsWith(this.modelName.split('.')[1])))
1473
1473
  ) {
1474
+ // 需根据key 找到对应 返回数据的返回名称
1475
+ let returnMapKey = returnStr.find((k) => {
1476
+ return k.field == this.jumpParamKey
1477
+ }).comment
1474
1478
  val += `${decodeURIComponent(item[from])}¯${
1475
1479
  this.jumpParamKey
1476
- }:${item[this.jumpParamKey]},`
1480
+ }:${item[returnMapKey]},`
1477
1481
  } else {
1478
1482
  val += decodeURIComponent(item[from]) + ','
1479
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" />
@@ -260,26 +264,28 @@
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
+ }, 50)
283
289
  },
284
290
  methods: {
285
291
  // 跳转url页面
@@ -604,4 +610,22 @@
604
610
  cursor: pointer;
605
611
  color: #409eff !important;
606
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
+ }
607
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') {