three-trees-ui 1.0.7 → 1.0.8

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.
@@ -22,9 +22,14 @@
22
22
  v-for="(item, index) in inputVal"
23
23
  :key="item.value"
24
24
  class="el-tag el-tag--info el-tag--small"
25
- @click="showEditInput"
25
+ @click.stop="jumpUrl(item)"
26
26
  >
27
- <span class="el-select__tags-text">{{ item.value }}</span>
27
+ <span
28
+ class="el-select__tags-text"
29
+ :class="{ 'src-color': isSrcColor }"
30
+ >
31
+ {{ item.value }}
32
+ </span>
28
33
  <i
29
34
  class="el-tag__close el-icon-close"
30
35
  @click.stop="removeSelectOrg(index)"
@@ -94,9 +99,11 @@
94
99
  :key="item.value"
95
100
  class="el-tag el-tag--info el-tag--small"
96
101
  style="margin-right: 8px"
97
- @click.stop
102
+ @click.stop="jumpUrl(item)"
98
103
  >
99
- <span class="el-select__tags-text">{{ item.value }}</span>
104
+ <span class="el-select__tags-text" :class="{ 'src-color': isSrcColor }">
105
+ {{ item.value }}
106
+ </span>
100
107
  </span>
101
108
  </span>
102
109
  <custom-mobile-dialog
@@ -108,6 +115,8 @@
108
115
  :sun-index="sunIndex"
109
116
  :sub-path="subPath"
110
117
  :current-sub-data="currentSubData"
118
+ :dialog-config="dialogConfig"
119
+ :dialog-type="dialogType"
111
120
  @calacInputSuffixHeight="calacInputSuffixHeight"
112
121
  @updateInput="updateInput"
113
122
  ></custom-mobile-dialog>
@@ -122,6 +131,8 @@
122
131
  :sub-path="subPath"
123
132
  :current-sub-data="currentSubData"
124
133
  :is-read-only="!inputWriteable"
134
+ :dialog-config="dialogConfig"
135
+ :dialog-type="dialogType"
125
136
  @calacInputSuffixHeight="calacInputSuffixHeight"
126
137
  @updateInput="updateInput"
127
138
  ></custom-dialog>
@@ -159,9 +170,15 @@
159
170
  sunIndex: Number,
160
171
  subPath: String,
161
172
  currentSubData: Array,
173
+ dialogType: {
174
+ // search表示在查询条件使用 form表示在表单中使用
175
+ type: String,
176
+ default: 'form',
177
+ },
162
178
  },
163
179
  data() {
164
180
  return {
181
+ dialogConfig: null, // 对话框配置信息
165
182
  isEditInputShow: false,
166
183
  customValue: '',
167
184
  defualtTooltipplacement: 'bottom',
@@ -201,7 +218,19 @@
201
218
  }
202
219
  let result = []
203
220
  nameAry.forEach((m) => {
204
- let n = { value: m }
221
+ // 带url跳转参数的 使用上横杆区分参数 值格式为 名称¯跳转key:跳转value
222
+ let n = {}
223
+ if (m.includes('¯') && m.split('¯')[1]) {
224
+ n.value = m.split('¯')[0]
225
+ let jumpParamStr = m.split('¯')[1]
226
+ if (jumpParamStr) {
227
+ let jumpParam = jumpParamStr.split(':')
228
+ n.jumpParamKey = jumpParam[0]
229
+ n.jumpParamValue = jumpParam[1]
230
+ }
231
+ } else {
232
+ n = { value: m }
233
+ }
205
234
  result.push(n)
206
235
  })
207
236
  return result
@@ -210,6 +239,19 @@
210
239
  isAllowCustom() {
211
240
  return this.custdialog && this.custdialog.allowInput
212
241
  },
242
+ // 是否展示可跳转颜色
243
+ isSrcColor() {
244
+ return (
245
+ this.dialogConfig &&
246
+ this.dialogType !== 'search' &&
247
+ ((this.isMobile && this.dialogConfig.mobileUrl) ||
248
+ (!this.isMobile && this.dialogConfig.pcUrl))
249
+ )
250
+ },
251
+ },
252
+ created() {
253
+ // 获取对话框配置,看是否有配置url跳转
254
+ this.getDialogConfig()
213
255
  },
214
256
  mounted() {
215
257
  const { subScopeEl } = utils.getSubScopeElAndIndex(this.$el)
@@ -234,6 +276,75 @@
234
276
  this.calacInputSuffixWidth()
235
277
  },
236
278
  methods: {
279
+ // 跳转url页面
280
+ jumpUrl(item) {
281
+ if (!this.isSrcColor) {
282
+ if (this.inputWriteable) {
283
+ this.showEditInput()
284
+ }
285
+ return
286
+ }
287
+ let url = this.isMobile
288
+ ? this.dialogConfig.mobileUrl
289
+ : this.dialogConfig.pcUrl
290
+ // 获取通用token 和 url翻译
291
+ Promise.all([
292
+ this.$requestConfig.getThreeTreeToken(),
293
+ this.transformUrl(url),
294
+ ]).then((res) => {
295
+ if (res[0] && res[0].code == 200) {
296
+ let token = res[0].value
297
+ let endUrl = res[1]
298
+ // 拼接参数 token和参数
299
+ if (endUrl.indexOf('?') == -1) {
300
+ endUrl += `?bnsToken=${token}&${item.jumpParamKey}=${item.jumpParamValue}`
301
+ } else {
302
+ endUrl += `&bnsToken=${token}&${item.jumpParamKey}=${item.jumpParamValue}`
303
+ }
304
+ window.open(endUrl)
305
+ } else {
306
+ this.$message.info(res.message || '获取token失败!')
307
+ }
308
+ })
309
+ },
310
+ // 替换url中域名通配符 需要发送接口
311
+ transformUrl(url) {
312
+ return new Promise((resolve) => {
313
+ var reg = /(\$\{(\w+)\})/
314
+ var match = reg.exec(url)
315
+ if (match) {
316
+ let alias = match[2]
317
+ if (alias) {
318
+ this.$requestConfig.getHostByAlias(alias).then((res) => {
319
+ if (res && res.value && res.value.rootAddress) {
320
+ resolve(url.replace(match[1], res.value.rootAddress))
321
+ } else {
322
+ resolve(url)
323
+ }
324
+ })
325
+ } else {
326
+ resolve(url)
327
+ }
328
+ } else {
329
+ resolve(url)
330
+ }
331
+ })
332
+ },
333
+ // 获取对话框配置
334
+ getDialogConfig() {
335
+ if (
336
+ this.custdialog &&
337
+ this.custdialog.custDialog &&
338
+ this.custdialog.custDialog.alias
339
+ )
340
+ this.$requestConfig
341
+ .getCustomDialogByAlias(this.custdialog.custDialog.alias)
342
+ .then((response) => {
343
+ if (response) {
344
+ this.dialogConfig = response
345
+ }
346
+ })
347
+ },
237
348
  editInputBlur() {
238
349
  this.$emit('input', this.customValue)
239
350
  this.isEditInputShow = false
@@ -483,4 +594,8 @@
483
594
  display: block;
484
595
  margin: 8px 0;
485
596
  }
597
+ .src-color {
598
+ cursor: pointer;
599
+ color: #409eff !important;
600
+ }
486
601
  </style>
@@ -269,6 +269,8 @@
269
269
  demNameAry.join(',')
270
270
  )
271
271
  }
272
+ } else {
273
+ this.$emit('change', newVal)
272
274
  }
273
275
  // 通过valueChange事件发布值变更消息
274
276
  this.$emit('valueChange', ary.join(','), newVal)
@@ -62,7 +62,12 @@
62
62
  //子表
63
63
  const triggerPath = item.triggerField.split('.')
64
64
  const triggerField = triggerPath[triggerPath.length - 1]
65
- _this.subOldValueMap[item.subPath] = []
65
+ // 修复子表初始化时会触发关联查询的问题
66
+ _this.subOldValueMap[item.subPath] =
67
+ utils.getValueByPath(
68
+ _this.formInst,
69
+ 'data.' + item.subPath
70
+ ) || []
66
71
  item.triggerPath = triggerPath
67
72
  item.triggerField = triggerField
68
73
  item.resultBind = resultBind