three-trees-ui 1.0.85 → 1.0.87

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.87",
4
4
  "publicPath": "/ui",
5
5
  "author": "hotent",
6
6
  "private": false,
@@ -693,7 +693,7 @@
693
693
  })
694
694
  this.$nextTick(() => {
695
695
  if (this.value && !this.isReadOnly) {
696
- this.showDialog(true)
696
+ // this.showDialog(true)
697
697
  }
698
698
  })
699
699
  },
@@ -1137,7 +1137,7 @@
1137
1137
  }
1138
1138
  const pInst = utils.getOnlineFormInstance(this)
1139
1139
  this.selectOrgs = this.convertComment2Field(str, field)
1140
- this.custdialog.custDialog.mappingConf.forEach((con) => {
1140
+ this.custdialog.custDialog.mappingConf.forEach((con) => {
1141
1141
  let val = ''
1142
1142
  let bindValue = ''
1143
1143
  //改造,绑定值,表单列表查询字段绑定对话框时,新增的绑定字段选项
@@ -1176,19 +1176,29 @@
1176
1176
  thisIndex
1177
1177
  )
1178
1178
  } else if (this.modelName == 'searchForm.' + con['target'][0]) {
1179
- const bInst = pInst['searchForm'] ? pInst: pInst.data
1179
+ const bInst = pInst['searchForm'] ? pInst : pInst.data
1180
1180
  const currentValue = val.substring(0, val.length - 1)
1181
1181
  if (this.modelName && this.modelName.endsWith(con['target'][0])) {
1182
- this.$emit('updateInput', currentValue);
1182
+ this.$emit('updateInput', currentValue)
1183
1183
  }
1184
- utils.setValueByPath(bInst, 'searchForm.' + con['target'][0], currentValue, thisIndex)
1184
+ utils.setValueByPath(
1185
+ bInst,
1186
+ 'searchForm.' + con['target'][0],
1187
+ currentValue,
1188
+ thisIndex
1189
+ )
1185
1190
  //绑定字段值处理,bindValue: {target: {id: xxx}}, bindKey: {target: id }
1186
1191
  if (bindValue && bindValueField) {
1187
1192
  const bindValueObj = {}
1188
1193
  //显示value对象
1189
- bindValueObj[bindValueField] = bindValue.substring(0, bindValue.length - 1)
1194
+ bindValueObj[bindValueField] = bindValue.substring(
1195
+ 0,
1196
+ bindValue.length - 1
1197
+ )
1190
1198
 
1191
- const anInst = pInst['searchForm'] ? pInst['searchForm'] : pInst.data.searchForm
1199
+ const anInst = pInst['searchForm']
1200
+ ? pInst['searchForm']
1201
+ : pInst.data.searchForm
1192
1202
  //若bindKey不存在,则默认空对象,若存在,则取出bindKey
1193
1203
  anInst.bindKey = anInst.bindKey || {}
1194
1204
  //格式 {target: id }
@@ -1222,7 +1232,11 @@
1222
1232
  }
1223
1233
  utils.setValueByPath(
1224
1234
  pInst,
1225
- `${pInst.data ? 'data.' : 'model.'}${this.modelName.includes('searchForm') ? `searchForm.${path}` : path}`,
1235
+ `${pInst.data ? 'data.' : 'model.'}${
1236
+ this.modelName.includes('searchForm')
1237
+ ? `searchForm.${path}`
1238
+ : path
1239
+ }`,
1226
1240
  _val,
1227
1241
  thisIndex
1228
1242
  )
@@ -1230,9 +1244,14 @@
1230
1244
  if (bindValue && bindValueField) {
1231
1245
  const bindValueObj = {}
1232
1246
  //显示value对象
1233
- bindValueObj[bindValueField] = bindValue.substring(0, bindValue.length - 1)
1247
+ bindValueObj[bindValueField] = bindValue.substring(
1248
+ 0,
1249
+ bindValue.length - 1
1250
+ )
1234
1251
 
1235
- const anInst = pInst['searchForm'] ? pInst['searchForm'] : pInst.data.searchForm
1252
+ const anInst = pInst['searchForm']
1253
+ ? pInst['searchForm']
1254
+ : pInst.data.searchForm
1236
1255
  //若bindKey不存在,则默认空对象,若存在,则取出bindKey
1237
1256
  anInst.bindKey = anInst.bindKey || {}
1238
1257
  //格式 {target: id }
@@ -1948,17 +1967,27 @@
1948
1967
  ) {
1949
1968
  const currentValue = val.substring(0, val.length - 1)
1950
1969
  if (this.modelName && this.modelName.endsWith(con['target'][0])) {
1951
- this.$emit('updateInput', currentValue);
1970
+ this.$emit('updateInput', currentValue)
1952
1971
  }
1953
1972
  let prePath = pInst['searchForm'] ? '' : 'data.'
1954
- utils.setValueByPath(pInst, prePath + 'searchForm.' + con['target'][0], currentValue, thisIndex)
1973
+ utils.setValueByPath(
1974
+ pInst,
1975
+ prePath + 'searchForm.' + con['target'][0],
1976
+ currentValue,
1977
+ thisIndex
1978
+ )
1955
1979
  //绑定字段值处理,bindValue: {target: {id: xxx}}, bindKey: {target: id }
1956
1980
  if (bindValue && bindValueField) {
1957
1981
  const bindValueObj = {}
1958
1982
  //显示value对象
1959
- bindValueObj[bindValueField] = bindValue.substring(0, bindValue.length - 1)
1983
+ bindValueObj[bindValueField] = bindValue.substring(
1984
+ 0,
1985
+ bindValue.length - 1
1986
+ )
1960
1987
 
1961
- const anInst = pInst['searchForm'] ? pInst['searchForm'] : pInst.data.searchForm
1988
+ const anInst = pInst['searchForm']
1989
+ ? pInst['searchForm']
1990
+ : pInst.data.searchForm
1962
1991
  //若bindKey不存在,则默认空对象,若存在,则取出bindKey
1963
1992
  anInst.bindKey = anInst.bindKey || {}
1964
1993
  //格式 {target: id }
@@ -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) {