three-trees-ui 1.0.63 → 1.0.65
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 +15283 -16391
- package/lib/three-trees-ui.css +1 -1
- package/lib/three-trees-ui.umd.js +15283 -16391
- package/lib/three-trees-ui.umd.min.js +1 -1
- package/package.json +1 -1
- package/packages/CustomDialog/src/customDialog.vue +4 -66
- package/packages/DataLists/src/main.vue +3 -2
- package/packages/Subtable/src/SubExportDialog.vue +1 -90
- package/packages/Subtable/src/SubImportDialog.vue +12 -172
- package/packages/Subtable/src/SubPagination.vue +8 -3
- package/packages/TableSearchField/src/main.vue +0 -5
- package/src/directive/formulas.js +1 -1
- package/src/mixins/onlineSubtable.js +0 -301
- package/src/mixins/querySqlPreview.js +20 -238
- package/src/mixins/templatePreview.js +38 -436
- package/src/services/SubPagination.js +18 -51
- package/src/utils.js +1 -32
|
@@ -13,7 +13,9 @@ const SubPagination = {
|
|
|
13
13
|
},
|
|
14
14
|
// 销毁path对象的数据
|
|
15
15
|
clear: (path) => {
|
|
16
|
-
|
|
16
|
+
const pInst = utils.getOnlineFormInstance(this)
|
|
17
|
+
let formUid = pInst && pInst._uid ? pInst._uid : ''
|
|
18
|
+
SubPagination._map.delete(path + formUid)
|
|
17
19
|
SubPagination._map.delete(SubPagination._vueComponentKey(path))
|
|
18
20
|
},
|
|
19
21
|
// 消化子表数据变化,触发视图层渲染
|
|
@@ -27,16 +29,18 @@ const SubPagination = {
|
|
|
27
29
|
return `${path}:VueComponent`
|
|
28
30
|
},
|
|
29
31
|
// 导入数据
|
|
30
|
-
importData: (path, importRows, mode, mergeMethod
|
|
32
|
+
importData: (path, importRows, mode, mergeMethod) => {
|
|
31
33
|
return new Promise((resolve, reject) => {
|
|
32
|
-
|
|
34
|
+
const pInst = utils.getOnlineFormInstance(this)
|
|
35
|
+
let formUid = pInst && pInst._uid ? pInst._uid : ''
|
|
36
|
+
if (SubPagination._map.has(path + formUid)) {
|
|
33
37
|
const instKey = SubPagination._vueComponentKey(path)
|
|
34
38
|
|
|
35
39
|
if (!SubPagination._map.has(instKey)) {
|
|
36
40
|
reject(`未找到${path}所对应的数据实例,无法导入数据。`)
|
|
37
41
|
}
|
|
38
42
|
|
|
39
|
-
const obj = SubPagination._map.get(path),
|
|
43
|
+
const obj = SubPagination._map.get(path + formUid),
|
|
40
44
|
inst = SubPagination._map.get(instKey),
|
|
41
45
|
array = obj.rows
|
|
42
46
|
switch (mode) {
|
|
@@ -58,45 +62,6 @@ const SubPagination = {
|
|
|
58
62
|
utils.setValueByPath(inst, path, newRows)
|
|
59
63
|
break
|
|
60
64
|
}
|
|
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
|
-
}
|
|
100
65
|
}
|
|
101
66
|
obj.rows = utils.getValueByPath(inst, path)
|
|
102
67
|
SubPagination._digest(obj.rows)
|
|
@@ -110,11 +75,12 @@ const SubPagination = {
|
|
|
110
75
|
exportData: (path, type, pInst, subtablePagination) => {
|
|
111
76
|
return new Promise((resolve, reject) => {
|
|
112
77
|
if (subtablePagination) {
|
|
113
|
-
|
|
78
|
+
let formUid = pInst && pInst._uid ? pInst._uid : ''
|
|
79
|
+
if (SubPagination._map.has(path + formUid)) {
|
|
114
80
|
if (type == 'current') {
|
|
115
|
-
resolve(SubPagination.pagingByPath(path))
|
|
81
|
+
resolve(SubPagination.pagingByPath(path, pInst))
|
|
116
82
|
} else if (type == 'all') {
|
|
117
|
-
const obj = SubPagination._map.get(path)
|
|
83
|
+
const obj = SubPagination._map.get(path + formUid)
|
|
118
84
|
resolve(obj.rows)
|
|
119
85
|
} else {
|
|
120
86
|
reject(`未知的导出类型:${type}`)
|
|
@@ -134,10 +100,10 @@ const SubPagination = {
|
|
|
134
100
|
// 将子表数据所属的VueComponent对象实例存储(用于数据导入)
|
|
135
101
|
SubPagination._map.set(instKey, inst)
|
|
136
102
|
}
|
|
137
|
-
|
|
103
|
+
let formUid = inst && inst._uid ? inst._uid : ''
|
|
138
104
|
// 如果有该子表路径的对象,则进行前端分页
|
|
139
|
-
if (SubPagination._map.has(path)) {
|
|
140
|
-
const obj = SubPagination._map.get(path),
|
|
105
|
+
if (SubPagination._map.has(path + formUid)) {
|
|
106
|
+
const obj = SubPagination._map.get(path + formUid),
|
|
141
107
|
array = obj.rows,
|
|
142
108
|
pageSize = obj.pageSize,
|
|
143
109
|
offset = (obj.currentPage - 1) * pageSize
|
|
@@ -157,9 +123,10 @@ const SubPagination = {
|
|
|
157
123
|
// 将子表数据所属的VueComponent对象实例存储(用于数据导入)
|
|
158
124
|
SubPagination._map.set(instKey, inst)
|
|
159
125
|
}
|
|
126
|
+
let formUid = inst && inst._uid ? inst._uid : ''
|
|
160
127
|
// 如果有该子表路径的对象,则进行前端分页
|
|
161
|
-
if (SubPagination._map.has(path)) {
|
|
162
|
-
const { pageSize, currentPage } = SubPagination._map.get(path)
|
|
128
|
+
if (SubPagination._map.has(path + formUid)) {
|
|
129
|
+
const { pageSize, currentPage } = SubPagination._map.get(path + formUid)
|
|
163
130
|
if (pageSize && currentPage) {
|
|
164
131
|
pageOffset = (currentPage - 1) * pageSize
|
|
165
132
|
}
|
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
|