three-trees-ui 1.0.60 → 1.0.62
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/lib/three-trees-ui.common.js +142 -136
- package/lib/three-trees-ui.umd.js +142 -136
- package/lib/three-trees-ui.umd.min.js +1 -1
- package/package.json +1 -1
- package/packages/CustomDialog/src/customDialog.vue +66 -4
- package/packages/DataLists/src/main.vue +2 -3
- package/packages/Subtable/src/SubExportDialog.vue +90 -1
- package/packages/Subtable/src/SubImportDialog.vue +169 -8
- package/packages/TableSearchField/src/main.vue +5 -0
- package/src/directive/formulas.js +1 -1
- package/src/mixins/onlineSubtable.js +301 -0
- package/src/mixins/querySqlPreview.js +270 -60
- package/src/mixins/templatePreview.js +436 -38
- package/src/services/SubPagination.js +40 -1
- package/src/utils.js +32 -1
|
@@ -27,7 +27,7 @@ const SubPagination = {
|
|
|
27
27
|
return `${path}:VueComponent`
|
|
28
28
|
},
|
|
29
29
|
// 导入数据
|
|
30
|
-
importData: (path, importRows, mode, mergeMethod) => {
|
|
30
|
+
importData: (path, importRows, mode, mergeMethod, conditionConfig) => {
|
|
31
31
|
return new Promise((resolve, reject) => {
|
|
32
32
|
if (SubPagination._map.has(path)) {
|
|
33
33
|
const instKey = SubPagination._vueComponentKey(path)
|
|
@@ -58,6 +58,45 @@ const SubPagination = {
|
|
|
58
58
|
utils.setValueByPath(inst, path, newRows)
|
|
59
59
|
break
|
|
60
60
|
}
|
|
61
|
+
case 'condition': {
|
|
62
|
+
importRows.forEach((item) => {
|
|
63
|
+
let index = array.findIndex((sub) => {
|
|
64
|
+
let orArr = conditionConfig.conditionArr.filter((condition) => {
|
|
65
|
+
return condition.relation == 'or'
|
|
66
|
+
})
|
|
67
|
+
let andArr = conditionConfig.conditionArr.filter(
|
|
68
|
+
(condition) => {
|
|
69
|
+
return condition.relation == 'and'
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
let orFlag = true
|
|
73
|
+
let andFlag = true
|
|
74
|
+
if (orArr.length) {
|
|
75
|
+
orFlag = orArr.some((j) => {
|
|
76
|
+
return sub[j.subField] == item[j.exportField]
|
|
77
|
+
})
|
|
78
|
+
}
|
|
79
|
+
if (andArr.length) {
|
|
80
|
+
andFlag = andArr.every((j) => {
|
|
81
|
+
return sub[j.subField] == item[j.exportField]
|
|
82
|
+
})
|
|
83
|
+
}
|
|
84
|
+
return orFlag && andFlag
|
|
85
|
+
})
|
|
86
|
+
if (index != -1) {
|
|
87
|
+
let updateArr = conditionConfig.backField.split(',')
|
|
88
|
+
updateArr.forEach((field) => {
|
|
89
|
+
array[index][field] = item[field]
|
|
90
|
+
})
|
|
91
|
+
} else {
|
|
92
|
+
// 未匹配到时是否新增
|
|
93
|
+
if (conditionConfig.conditionType == 'add') {
|
|
94
|
+
array.push(item)
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
})
|
|
98
|
+
utils.setValueByPath(inst, path, array)
|
|
99
|
+
}
|
|
61
100
|
}
|
|
62
101
|
obj.rows = utils.getValueByPath(inst, path)
|
|
63
102
|
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)
|
|
959
959
|
// 获取当前组件是否在子表中的某一行
|
|
960
960
|
const { subScopeEl, index, subname } = utils.getSubScopeElAndIndex(inst.$el)
|
|
961
961
|
if (subScopeEl) {
|
|
@@ -1256,4 +1256,35 @@ 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
|
+
|
|
1259
1290
|
export default utils
|