three-trees-ui 1.0.15 → 1.0.17

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.
@@ -25,15 +25,10 @@
25
25
  <span
26
26
  v-for="(item, index) in inputVal"
27
27
  :key="item.value"
28
- class="el-tag el-tag--info el-tag--small no-background"
29
- @click.stop="jumpUrl(item)"
28
+ class="el-tag el-tag--info el-tag--small"
29
+ @click="showEditInput"
30
30
  >
31
- <span
32
- class="el-select__tags-text"
33
- :class="{ 'src-color': isSrcColor }"
34
- >
35
- {{ item.value }}
36
- </span>
31
+ <span class="el-select__tags-text">{{ item.value }}</span>
37
32
  <i
38
33
  class="el-tag__close el-icon-close"
39
34
  @click.stop="removeSelectOrg(index)"
@@ -97,17 +92,15 @@
97
92
  </div>
98
93
  </div>
99
94
  </el-tooltip>
100
- <span v-if="!inputWriteable" class="dialog-readonly">
95
+ <span v-if="!inputWriteable">
101
96
  <span
102
97
  v-for="item in inputVal"
103
98
  :key="item.value"
104
- class="el-tag el-tag--info el-tag--small no-background"
99
+ class="el-tag el-tag--info el-tag--small"
105
100
  style="margin-right: 8px"
106
- @click.stop="jumpUrl(item)"
101
+ @click.stop
107
102
  >
108
- <span class="el-select__tags-text" :class="{ 'src-color': isSrcColor }">
109
- {{ item.value }}
110
- </span>
103
+ <span class="el-select__tags-text">{{ item.value }}</span>
111
104
  </span>
112
105
  </span>
113
106
  <custom-mobile-dialog
@@ -119,8 +112,6 @@
119
112
  :sun-index="sunIndex"
120
113
  :sub-path="subPath"
121
114
  :current-sub-data="currentSubData"
122
- :dialog-config="dialogConfig"
123
- :dialog-type="dialogType"
124
115
  @calacInputSuffixHeight="calacInputSuffixHeight"
125
116
  @updateInput="updateInput"
126
117
  ></custom-mobile-dialog>
@@ -135,8 +126,6 @@
135
126
  :sub-path="subPath"
136
127
  :current-sub-data="currentSubData"
137
128
  :is-read-only="!inputWriteable"
138
- :dialog-config="dialogConfig"
139
- :dialog-type="dialogType"
140
129
  @calacInputSuffixHeight="calacInputSuffixHeight"
141
130
  @updateInput="updateInput"
142
131
  ></custom-dialog>
@@ -144,29 +133,6 @@
144
133
  <slot name="labeldesc">{{ inputName }}</slot>
145
134
  </span>
146
135
  <ht-field-tail :field-name="inputName" :input-value="value" />
147
- <el-dialog
148
- title="表单详情"
149
- :visible.sync="isDialogFormShow"
150
- v-if="isDialogFormShow"
151
- width="100%"
152
- custom-class="custom-dialog-form"
153
- fullscreen
154
- append-to-body
155
- >
156
- <div class="iframe-box">
157
- <iframe
158
- :src="mobileSrc"
159
- width="100%"
160
- frameborder="0"
161
- style="height: 100%;"
162
- ></iframe>
163
- </div>
164
- <div class="custom-dialog-form_footer">
165
- <el-button size="smal" @click="isDialogFormShow = false">
166
- 关闭
167
- </el-button>
168
- </div>
169
- </el-dialog>
170
136
  </div>
171
137
  </template>
172
138
  <script>
@@ -197,17 +163,9 @@
197
163
  sunIndex: Number,
198
164
  subPath: String,
199
165
  currentSubData: Array,
200
- dialogType: {
201
- // search表示在查询条件使用 form表示在表单中使用
202
- type: String,
203
- default: 'form',
204
- },
205
166
  },
206
167
  data() {
207
168
  return {
208
- mobileSrc: '',
209
- isDialogFormShow: false,
210
- dialogConfig: null, // 对话框配置信息
211
169
  isEditInputShow: false,
212
170
  customValue: '',
213
171
  defualtTooltipplacement: 'bottom',
@@ -247,25 +205,7 @@
247
205
  }
248
206
  let result = []
249
207
  nameAry.forEach((m) => {
250
- // 带url跳转参数的 使用上横杆区分参数 值格式为 名称¯跳转key:跳转value
251
- // 上横向保存数据库后 有可能被改变此处兼容写了一种上横线
252
- let n = {}
253
- if (
254
- (m.includes('¯') && m.split('¯')[1]) ||
255
- (m.includes('ˉ') && m.split('ˉ')[1])
256
- ) {
257
- let val1 = m.includes('¯') ? m.split('¯')[0] : m.split('ˉ')[0]
258
- let val2 = m.includes('¯') ? m.split('¯')[1] : m.split('ˉ')[1]
259
- n.value = val1
260
- let jumpParamStr = val2
261
- if (jumpParamStr) {
262
- let jumpParam = jumpParamStr.split(':')
263
- n.jumpParamKey = jumpParam[0]
264
- n.jumpParamValue = jumpParam[1]
265
- }
266
- } else {
267
- n = { value: m }
268
- }
208
+ let n = { value: m }
269
209
  result.push(n)
270
210
  })
271
211
  return result
@@ -274,19 +214,6 @@
274
214
  isAllowCustom() {
275
215
  return this.custdialog && this.custdialog.allowInput
276
216
  },
277
- // 是否展示可跳转颜色
278
- isSrcColor() {
279
- return (
280
- this.dialogConfig &&
281
- this.dialogType !== 'search' &&
282
- ((this.isMobile && this.dialogConfig.mobileUrl) ||
283
- (!this.isMobile && this.dialogConfig.pcUrl))
284
- )
285
- },
286
- },
287
- created() {
288
- // 获取对话框配置,看是否有配置url跳转
289
- this.getDialogConfig()
290
217
  },
291
218
  mounted() {
292
219
  setTimeout(() => {
@@ -310,86 +237,9 @@
310
237
  }
311
238
  //获取对话框按钮名称宽度
312
239
  this.calacInputSuffixWidth()
313
- if (this.value && this.inputWriteable) {
314
- this.calacInputSuffixHeight()
315
- }
316
240
  }, 50)
317
241
  },
318
242
  methods: {
319
- // 跳转url页面
320
- jumpUrl(item) {
321
- if (!this.isSrcColor) {
322
- if (this.inputWriteable) {
323
- this.showEditInput()
324
- }
325
- return
326
- }
327
- let url = this.isMobile
328
- ? this.dialogConfig.mobileUrl
329
- : this.dialogConfig.pcUrl
330
- // 获取通用token 和 url翻译
331
- Promise.all([
332
- this.$requestConfig.getThreeTreeToken(),
333
- this.transformUrl(url),
334
- ]).then((res) => {
335
- if (res[0] && res[0].code == 200) {
336
- let token = res[0].value
337
- let endUrl = res[1]
338
- // 拼接参数 token和参数
339
- if (endUrl.indexOf('?') == -1) {
340
- endUrl += `?bnsToken=${token}&${item.jumpParamKey}=${item.jumpParamValue}`
341
- } else {
342
- endUrl += `&bnsToken=${token}&${item.jumpParamKey}=${item.jumpParamValue}`
343
- }
344
- if (this.isMobile) {
345
- this.mobileSrc = endUrl
346
- this.isDialogFormShow = true
347
- } else {
348
- window.open(endUrl)
349
- }
350
- } else {
351
- this.$message.info(res.message || '获取token失败!')
352
- }
353
- })
354
- },
355
- // 替换url中域名通配符 需要发送接口
356
- transformUrl(url) {
357
- return new Promise((resolve) => {
358
- var reg = /(\$\{(\w+)\})/
359
- var match = reg.exec(url)
360
- if (match) {
361
- let alias = match[2]
362
- if (alias) {
363
- this.$requestConfig.getHostByAlias(alias).then((res) => {
364
- if (res && res.value && res.value.rootAddress) {
365
- resolve(url.replace(match[1], res.value.rootAddress))
366
- } else {
367
- resolve(url)
368
- }
369
- })
370
- } else {
371
- resolve(url)
372
- }
373
- } else {
374
- resolve(url)
375
- }
376
- })
377
- },
378
- // 获取对话框配置
379
- getDialogConfig() {
380
- if (
381
- this.custdialog &&
382
- this.custdialog.custDialog &&
383
- this.custdialog.custDialog.alias
384
- )
385
- this.$requestConfig
386
- .getCustomDialogByAlias(this.custdialog.custDialog.alias)
387
- .then((response) => {
388
- if (response) {
389
- this.dialogConfig = response
390
- }
391
- })
392
- },
393
243
  editInputBlur() {
394
244
  this.$emit('input', this.customValue)
395
245
  this.isEditInputShow = false
@@ -514,7 +364,7 @@
514
364
  overflow-y: auto;
515
365
  }
516
366
  @media (max-width: 1280px) {
517
- .el-dialog:not(.custom-dialog-form) {
367
+ .el-dialog {
518
368
  width: 96% !important;
519
369
  margin-top: 2vh !important;
520
370
  }
@@ -527,7 +377,7 @@
527
377
  }
528
378
  }
529
379
 
530
- .el-dialog:not(.custom-dialog-form) {
380
+ .el-dialog {
531
381
  height: 90%;
532
382
  min-height: 400px;
533
383
  }
@@ -639,46 +489,4 @@
639
489
  display: block;
640
490
  margin: 8px 0;
641
491
  }
642
- .src-color {
643
- cursor: pointer;
644
- color: #409eff !important;
645
- }
646
- .el-tag.el-tag--info.no-background {
647
- background: none;
648
- border: none;
649
- }
650
- .dialog-readonly {
651
- & > .el-tag {
652
- &::after {
653
- display: inline;
654
- content: ',';
655
- }
656
- }
657
- & > .el-tag:last-child {
658
- &::after {
659
- display: none;
660
- content: '';
661
- }
662
- }
663
- }
664
- ::v-deep .custom-dialog-form {
665
- .el-dialog__header {
666
- display: none;
667
- }
668
- .el-dialog__body {
669
- height: 100%;
670
- display: flex;
671
- flex-direction: column;
672
- .iframe-box {
673
- width: 100%;
674
- flex: 1;
675
- overflow: hidden;
676
- }
677
- .custom-dialog-form_footer {
678
- text-align: center;
679
- margin-top: 10px;
680
- padding-bottom: 10px;
681
- }
682
- }
683
- }
684
492
  </style>
@@ -269,8 +269,6 @@
269
269
  demNameAry.join(',')
270
270
  )
271
271
  }
272
- } else {
273
- this.$emit('change', newVal)
274
272
  }
275
273
  // 通过valueChange事件发布值变更消息
276
274
  this.$emit('valueChange', ary.join(','), newVal)
@@ -27,6 +27,11 @@
27
27
  if (!this.formInst) {
28
28
  this.formInst = utils.getOnlineFormInstance(this.$parent)
29
29
  }
30
+ // 如果是只读时不触发关联查询
31
+ if (this.formInst.isView === true) {
32
+ return
33
+ }
34
+
30
35
  if (this.queryJson.length > 0) {
31
36
  let _this = this
32
37
  this.queryJson.forEach((item) => {
@@ -303,6 +303,9 @@
303
303
  const _me = this
304
304
  const exp = this.mathExp
305
305
  const formVm = utils.getOnlineFormInstance(_me)
306
+ if (formVm && formVm.isView === true) {
307
+ return
308
+ }
306
309
  // 初始化流水号配置
307
310
  this.initIdentity(_me, formVm)
308
311
  // 数学运算表达式
@@ -267,18 +267,13 @@
267
267
  return (
268
268
  this.data &&
269
269
  this.data.length < 1 &&
270
- this.treeData &&
271
- this.treeData.length < 1
270
+ this.treeData && this.treeData.length < 1
272
271
  )
273
272
  },
274
273
  },
275
274
  watch: {
276
275
  filterText(val) {
277
- if (this.lazy) {
278
- this.$emit('loadALL', val)
279
- } else {
280
- this.$refs.elTree.filter(val)
281
- }
276
+ this.$refs.elTree.filter(val)
282
277
  },
283
278
  defaultCheckedKeys(val) {
284
279
  this.$refs.elTree.setCheckedKeys(val)
@@ -15,6 +15,10 @@ const conformanceJudge = (value, vnode) => {
15
15
 
16
16
  const formula = {
17
17
  bind(el, binding, vnode) {
18
+ // 如果是只读的就不执行js脚本计算
19
+ if (el && el.__vue__ && el.formIsView === true) {
20
+ return
21
+ }
18
22
  if (!conformanceJudge(binding.value.value, vnode)) {
19
23
  return
20
24
  }
@@ -46,6 +50,10 @@ const formula = {
46
50
  }
47
51
  },
48
52
  update(el, binding, vnode) {
53
+ // 如果是只读的就不执行js脚本计算
54
+ if (el && el.__vue__ && el.formIsView === true) {
55
+ return
56
+ }
49
57
  if (!conformanceJudge(binding.value.value, vnode)) {
50
58
  return
51
59
  }
@@ -69,6 +69,10 @@ export default {
69
69
  }
70
70
  if (parent) {
71
71
  this.formIsView = parent.$options.propsData.isView
72
+ // 如果是只读 第一时间将状态改为flase 避免渲染
73
+ if (this.formIsView === true) {
74
+ this.writeable = false
75
+ }
72
76
  }
73
77
  },
74
78
  mounted() {