three-trees-ui 1.0.66 → 1.0.67

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.
@@ -29,7 +29,7 @@ const SubPagination = {
29
29
  return `${path}:VueComponent`
30
30
  },
31
31
  // 导入数据
32
- importData: (path, importRows, mode, mergeMethod, conditionConfig) => {
32
+ importData: (path, importRows, mode, mergeMethod) => {
33
33
  return new Promise((resolve, reject) => {
34
34
  const pInst = utils.getOnlineFormInstance(this)
35
35
  let formUid = pInst && pInst._uid ? pInst._uid : ''
@@ -62,45 +62,6 @@ const SubPagination = {
62
62
  utils.setValueByPath(inst, path, newRows)
63
63
  break
64
64
  }
65
- case 'condition': {
66
- importRows.forEach((item) => {
67
- let index = array.findIndex((sub) => {
68
- let orArr = conditionConfig.conditionArr.filter((condition) => {
69
- return condition.relation == 'or'
70
- })
71
- let andArr = conditionConfig.conditionArr.filter(
72
- (condition) => {
73
- return condition.relation == 'and'
74
- }
75
- )
76
- let orFlag = true
77
- let andFlag = true
78
- if (orArr.length) {
79
- orFlag = orArr.some((j) => {
80
- return sub[j.subField] == item[j.exportField]
81
- })
82
- }
83
- if (andArr.length) {
84
- andFlag = andArr.every((j) => {
85
- return sub[j.subField] == item[j.exportField]
86
- })
87
- }
88
- return orFlag && andFlag
89
- })
90
- if (index != -1) {
91
- let updateArr = conditionConfig.backField.split(',')
92
- updateArr.forEach((field) => {
93
- array[index][field] = item[field]
94
- })
95
- } else {
96
- // 未匹配到时是否新增
97
- if (conditionConfig.conditionType == 'add') {
98
- array.push(item)
99
- }
100
- }
101
- })
102
- utils.setValueByPath(inst, path, array)
103
- }
104
65
  }
105
66
  obj.rows = utils.getValueByPath(inst, path)
106
67
  SubPagination._digest(obj.rows)
package/src/utils.js CHANGED
@@ -955,7 +955,7 @@ var utils = {
955
955
  }
956
956
  const keyPath = config[key]
957
957
  // 获取当前组件所在的表单
958
- const formInst = utils.getOnlineFormInstance(inst)
958
+ const formInst = utils.getOnlineFormInstance(inst.$parent)
959
959
  // 获取当前组件是否在子表中的某一行
960
960
  const { subScopeEl, index, subname } = utils.getSubScopeElAndIndex(inst.$el)
961
961
  if (subScopeEl) {
@@ -1256,35 +1256,4 @@ Date.prototype.format = function(format) {
1256
1256
  return format
1257
1257
  }
1258
1258
 
1259
- //精确四舍五入
1260
- Number.prototype.toFixedRound = function(d) {
1261
- d = Number(d)
1262
- var s = this + ''
1263
- if (!d) d = 0
1264
- if (s.indexOf('.') == -1) s += '.'
1265
- s += new Array(d + 1).join('0')
1266
- if (new RegExp('^(-|\\+)?(\\d+(\\.\\d{0,' + (d + 1) + '})?)\\d*$').test(s)) {
1267
- var s = '0' + RegExp.$2,
1268
- pm = RegExp.$1,
1269
- a = RegExp.$3.length,
1270
- b = true
1271
- if (a == d + 2) {
1272
- a = s.match(/\d/g)
1273
- if (parseInt(a[a.length - 1]) > 4) {
1274
- for (var i = a.length - 2; i >= 0; i--) {
1275
- a[i] = parseInt(a[i]) + 1
1276
- if (a[i] == 10) {
1277
- a[i] = 0
1278
- b = i != 1
1279
- } else break
1280
- }
1281
- }
1282
- s = a.join('').replace(new RegExp('(\\d+)(\\d{' + d + '})\\d$'), '$1.$2')
1283
- }
1284
- if (b) s = s.substr(1)
1285
- return (pm + s).replace(/\.$/, '')
1286
- }
1287
- return this + ''
1288
- }
1289
-
1290
1259
  export default utils