three-trees-ui 1.0.85 → 1.0.86

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.85",
3
+ "version": "1.0.86",
4
4
  "publicPath": "/ui",
5
5
  "author": "hotent",
6
6
  "private": false,
@@ -73,9 +73,9 @@
73
73
  }
74
74
  },
75
75
  mounted() {
76
- if (!this.data || this.data.length == 0) {
77
- this.handleLoad()
78
- }
76
+ // if (!this.data || this.data.length == 0) {
77
+ // this.handleLoad()
78
+ // }
79
79
  },
80
80
  methods: {
81
81
  getQueryFilter(page) {
@@ -80,9 +80,9 @@
80
80
  }
81
81
  },
82
82
  mounted() {
83
- if (!this.data || this.data.length == 0) {
84
- this.handleLoad()
85
- }
83
+ // if (!this.data || this.data.length == 0) {
84
+ // this.handleLoad()
85
+ // }
86
86
  },
87
87
  methods: {
88
88
  getQueryFilter(page) {
@@ -108,9 +108,9 @@
108
108
  this.initCurrentOrg(currentUserOrg)
109
109
  })
110
110
  }
111
- if (!this.data || this.data.length == 0) {
112
- this.handleLoad()
113
- }
111
+ // if (!this.data || this.data.length == 0) {
112
+ // this.handleLoad()
113
+ // }
114
114
  },
115
115
  methods: {
116
116
  handleSearch(word) {
@@ -113,9 +113,9 @@
113
113
  this.initCurrentPost(currentUserPost)
114
114
  })
115
115
  }
116
- if (!this.data || this.data.length == 0) {
117
- this.handleLoad()
118
- }
116
+ // if (!this.data || this.data.length == 0) {
117
+ // this.handleLoad()
118
+ // }
119
119
  },
120
120
  methods: {
121
121
  initCurrentPost(post) {
@@ -80,9 +80,9 @@
80
80
  }
81
81
  },
82
82
  mounted() {
83
- if (!this.data || this.data.length == 0) {
84
- this.handleLoad()
85
- }
83
+ // if (!this.data || this.data.length == 0) {
84
+ // this.handleLoad()
85
+ // }
86
86
  },
87
87
  methods: {
88
88
  getQueryFilter(page) {
@@ -150,6 +150,7 @@
150
150
  mergeFunc: null,
151
151
  mode: 'append',
152
152
  cacheDicData: {}, // 缓存字典数据
153
+ cacheImportData: [], // 缓存导入时重复的请求
153
154
  }
154
155
  },
155
156
  computed: {
@@ -272,7 +273,18 @@
272
273
  dsName: config.dataSource,
273
274
  sql: sqlStr,
274
275
  }
276
+ let cacheObj = this.cacheImportData.find((k) => {
277
+ return utils.objectEquals(k.params, params)
278
+ })
279
+ if (cacheObj) {
280
+ resolve(cacheObj.result)
281
+ return
282
+ }
275
283
  this.$requestConfig.getValueBySql(params).then((res) => {
284
+ this.cacheImportData.push({
285
+ params,
286
+ result: res,
287
+ })
276
288
  resolve(res)
277
289
  })
278
290
  })
@@ -376,6 +388,13 @@
376
388
  })
377
389
  return importRows
378
390
  },
391
+ awaitTime() {
392
+ return new Promise((resolve) => {
393
+ setTimeout(() => {
394
+ resolve()
395
+ }, 10)
396
+ })
397
+ },
379
398
  async dialogConfirm() {
380
399
  if (this.importRows.length == 0) {
381
400
  this.$message.error('请选择要导入的文件')
@@ -416,6 +435,11 @@
416
435
  }
417
436
  }
418
437
  }
438
+ const loading = this.$loading({
439
+ text: '导入中...',
440
+ })
441
+ // 先等待弹窗弹出,再执行后面代码,后面代码执行js量大,容易卡顿导致loading框不出现
442
+ await this.awaitTime()
419
443
  const pInst = utils.getOnlineFormInstance(this.$parent.$parent)
420
444
  let importRows = await this.changeDictionary(this.importRows)
421
445
  // 导入如果有数据转换的此处做转换
@@ -429,10 +453,12 @@
429
453
  pInst
430
454
  )
431
455
  .then(() => {
456
+ loading && loading.close()
432
457
  this.$message.success('导入成功!')
433
458
  this.dialogVisible = false
434
459
  })
435
460
  .catch((err) => {
461
+ loading && loading.close()
436
462
  this.$refs.selectFile.value = ''
437
463
  this.$message.error(`数据导入失败:${err}`)
438
464
  })
@@ -710,7 +710,7 @@
710
710
  const me = this
711
711
  // 防止外部没有回调,设置10秒后自动取消加载中的状态
712
712
  let waitTime = 10000
713
- if (!this._events || !this._events.load || !this._events.load.length) {
713
+ if (!this._events || (!this._events.loading && !this._events.load)) {
714
714
  // 如果没有绑定在当前组件里的load事件,即组件仅仅作展示数据用 直接取消loading
715
715
  waitTime = 0
716
716
  }
@@ -103,9 +103,9 @@
103
103
  this.initCurrentValue(currentUserDetail)
104
104
  })
105
105
  }
106
- if (!this.data || this.data.length == 0) {
107
- this.handleLoad()
108
- }
106
+ // if (!this.data || this.data.length == 0) {
107
+ // this.handleLoad()
108
+ // }
109
109
  },
110
110
  methods: {
111
111
  handleSearch(word) {