three-trees-ui 1.0.61 → 1.0.63
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 +17286 -16186
- package/lib/three-trees-ui.css +1 -1
- package/lib/three-trees-ui.umd.js +17286 -16186
- 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 +238 -20
- package/src/mixins/templatePreview.js +436 -38
- package/src/services/SubPagination.js +40 -1
- package/src/utils.js +32 -1
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import SubPagination from '../services/SubPagination.js'
|
|
2
|
+
import utils from '../utils.js'
|
|
2
3
|
|
|
3
4
|
export default {
|
|
4
5
|
data() {
|
|
5
6
|
return {
|
|
7
|
+
searchVal: '', //搜索关键字
|
|
6
8
|
fillOrg: {},
|
|
7
9
|
fillOrgConfMap: {},
|
|
8
10
|
transitionIndex: -1,
|
|
@@ -52,6 +54,305 @@ export default {
|
|
|
52
54
|
}
|
|
53
55
|
},
|
|
54
56
|
methods: {
|
|
57
|
+
//合计计算
|
|
58
|
+
getSummaries(param, list) {
|
|
59
|
+
let CancelTheCalculation = sessionStorage.getItem(
|
|
60
|
+
'Cancel_The_Calculation'
|
|
61
|
+
)
|
|
62
|
+
? JSON.parse(sessionStorage.getItem('Cancel_The_Calculation'))
|
|
63
|
+
: {}
|
|
64
|
+
//
|
|
65
|
+
let listChange = JSON.parse(Base64.decode(list, 'utf-8'))
|
|
66
|
+
|
|
67
|
+
//
|
|
68
|
+
|
|
69
|
+
if (listChange.length < 1) {
|
|
70
|
+
return
|
|
71
|
+
}
|
|
72
|
+
const { columns, data } = param
|
|
73
|
+
this.tableData = data
|
|
74
|
+
const sums = []
|
|
75
|
+
let calcProp = []
|
|
76
|
+
let columnsDep = _.cloneDeep(columns)
|
|
77
|
+
listChange.forEach((item, idex) => {
|
|
78
|
+
if (item.addFunc == 'calcFunc') {
|
|
79
|
+
columnsDep.forEach((column, index) => {
|
|
80
|
+
if (
|
|
81
|
+
item.mathExp &&
|
|
82
|
+
item.mathExp.indexOf('.' + column.property) > -1
|
|
83
|
+
) {
|
|
84
|
+
calcProp.push(column.property)
|
|
85
|
+
}
|
|
86
|
+
})
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
columnsDep.forEach((column, index) => {
|
|
90
|
+
if (item.columnField == column.property) {
|
|
91
|
+
column.combinedOption = item
|
|
92
|
+
}
|
|
93
|
+
})
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
columnsDep.forEach((column, index) => {
|
|
97
|
+
if (index === 0 && columnsDep[0].type == 'index') {
|
|
98
|
+
sums[index] = ''
|
|
99
|
+
return
|
|
100
|
+
}
|
|
101
|
+
//当有需要才合计
|
|
102
|
+
if (column.combinedOption) {
|
|
103
|
+
let {
|
|
104
|
+
addFunc,
|
|
105
|
+
columnField,
|
|
106
|
+
name,
|
|
107
|
+
unit,
|
|
108
|
+
showType,
|
|
109
|
+
num,
|
|
110
|
+
tag,
|
|
111
|
+
mainTarget,
|
|
112
|
+
} = column.combinedOption
|
|
113
|
+
|
|
114
|
+
let Bol =
|
|
115
|
+
tag &&
|
|
116
|
+
CancelTheCalculation &&
|
|
117
|
+
CancelTheCalculation[tag] &&
|
|
118
|
+
CancelTheCalculation[tag].length > 0
|
|
119
|
+
const values = data.map((item) => Number(item[column.property]))
|
|
120
|
+
let depValues = _.cloneDeep(values)
|
|
121
|
+
if (Bol) {
|
|
122
|
+
let delMin = []
|
|
123
|
+
depValues.forEach((item, i) => {
|
|
124
|
+
if (!CancelTheCalculation[tag].includes(i)) {
|
|
125
|
+
delMin.push(item)
|
|
126
|
+
}
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
depValues = delMin
|
|
130
|
+
}
|
|
131
|
+
let units = unit ? unit : ''
|
|
132
|
+
//求和
|
|
133
|
+
if (addFunc === 'add') {
|
|
134
|
+
if (!depValues.every((value) => isNaN(value))) {
|
|
135
|
+
sums[index] = depValues.reduce((prev, curr) => {
|
|
136
|
+
const value = Number(curr)
|
|
137
|
+
if (!isNaN(value)) {
|
|
138
|
+
return prev + curr
|
|
139
|
+
} else {
|
|
140
|
+
return prev
|
|
141
|
+
}
|
|
142
|
+
}, 0)
|
|
143
|
+
|
|
144
|
+
sums[index] = this.dealWithDataHtml(
|
|
145
|
+
name,
|
|
146
|
+
sums[index],
|
|
147
|
+
showType,
|
|
148
|
+
num,
|
|
149
|
+
units,
|
|
150
|
+
mainTarget
|
|
151
|
+
)
|
|
152
|
+
} else {
|
|
153
|
+
sums[index] = this.dealWithDataHtml(
|
|
154
|
+
name,
|
|
155
|
+
0,
|
|
156
|
+
showType,
|
|
157
|
+
num,
|
|
158
|
+
units,
|
|
159
|
+
mainTarget
|
|
160
|
+
)
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
//计数
|
|
164
|
+
if (addFunc === 'count') {
|
|
165
|
+
let numCount = values.length
|
|
166
|
+
|
|
167
|
+
if (Bol) {
|
|
168
|
+
numCount = values.length - CancelTheCalculation[tag].length
|
|
169
|
+
}
|
|
170
|
+
sums[index] = this.dealWithDataHtml(
|
|
171
|
+
name,
|
|
172
|
+
numCount,
|
|
173
|
+
showType,
|
|
174
|
+
num,
|
|
175
|
+
units,
|
|
176
|
+
mainTarget
|
|
177
|
+
)
|
|
178
|
+
}
|
|
179
|
+
//平均值
|
|
180
|
+
if (addFunc === 'average') {
|
|
181
|
+
let sum = 0
|
|
182
|
+
var average = 0
|
|
183
|
+
|
|
184
|
+
for (var i = 0; i < depValues.length; i++) {
|
|
185
|
+
sum += depValues[i]
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
depValues.length > 0
|
|
189
|
+
? (average = sum / depValues.length)
|
|
190
|
+
: (average = 0)
|
|
191
|
+
|
|
192
|
+
sums[index] = this.dealWithDataHtml(
|
|
193
|
+
name,
|
|
194
|
+
average,
|
|
195
|
+
showType,
|
|
196
|
+
num,
|
|
197
|
+
units,
|
|
198
|
+
mainTarget
|
|
199
|
+
)
|
|
200
|
+
}
|
|
201
|
+
//最大值
|
|
202
|
+
if (addFunc === 'max') {
|
|
203
|
+
let maxNum = Math.max.apply(
|
|
204
|
+
null,
|
|
205
|
+
depValues.length > 0 ? depValues : [0]
|
|
206
|
+
)
|
|
207
|
+
|
|
208
|
+
sums[index] = this.dealWithDataHtml(
|
|
209
|
+
name,
|
|
210
|
+
maxNum,
|
|
211
|
+
showType,
|
|
212
|
+
num,
|
|
213
|
+
units,
|
|
214
|
+
mainTarget
|
|
215
|
+
)
|
|
216
|
+
}
|
|
217
|
+
//最小值
|
|
218
|
+
if (addFunc === 'min') {
|
|
219
|
+
let minNum = Math.min.apply(
|
|
220
|
+
null,
|
|
221
|
+
depValues.length > 0 ? depValues : [0]
|
|
222
|
+
)
|
|
223
|
+
sums[index] = this.dealWithDataHtml(
|
|
224
|
+
name,
|
|
225
|
+
minNum,
|
|
226
|
+
showType,
|
|
227
|
+
num,
|
|
228
|
+
units,
|
|
229
|
+
mainTarget
|
|
230
|
+
)
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
//公式计算
|
|
234
|
+
if (addFunc === 'calcFunc') {
|
|
235
|
+
const calcVal = this.dealCustomCalc(data, column.combinedOption)
|
|
236
|
+
sums[index] = this.dealWithDataHtml(
|
|
237
|
+
name,
|
|
238
|
+
calcVal,
|
|
239
|
+
showType,
|
|
240
|
+
num,
|
|
241
|
+
units,
|
|
242
|
+
mainTarget
|
|
243
|
+
)
|
|
244
|
+
}
|
|
245
|
+
} else if (calcProp.indexOf(column.property) > -1) {
|
|
246
|
+
const values = data.map((item) => Number(item[column.property]))
|
|
247
|
+
}
|
|
248
|
+
})
|
|
249
|
+
|
|
250
|
+
return sums
|
|
251
|
+
},
|
|
252
|
+
//合计行
|
|
253
|
+
handleSummary(summary) {
|
|
254
|
+
return summary && !this.searchVal ? true : false
|
|
255
|
+
},
|
|
256
|
+
dealCustomCalc(data, calc) {
|
|
257
|
+
let exp = calc.mathExp
|
|
258
|
+
if (!exp) return null
|
|
259
|
+
var reg = /([\[|\{]).*?\((.*?)\)[\}|\]]/g
|
|
260
|
+
exp = exp.replace(reg, function() {
|
|
261
|
+
var symbol = arguments[1],
|
|
262
|
+
name = arguments[2]
|
|
263
|
+
const prop = name.split('.')[1]
|
|
264
|
+
const values = data.map((item) => Number(item[prop]))
|
|
265
|
+
return values.join(',')
|
|
266
|
+
})
|
|
267
|
+
exp = exp.replace(/[|\[|\]]/g, '')
|
|
268
|
+
exp = eval(`(${exp})`)
|
|
269
|
+
if (exp === Infinity || isNaN(exp)) {
|
|
270
|
+
exp = null
|
|
271
|
+
}
|
|
272
|
+
return exp
|
|
273
|
+
},
|
|
274
|
+
dealWithDataHtml(name, type, showType, num, units, mainTarget) {
|
|
275
|
+
let { data, monCap } = this.dealWithData(type, showType, num, mainTarget)
|
|
276
|
+
if (monCap) {
|
|
277
|
+
return name + ':' + data + units + '\n' + monCap
|
|
278
|
+
}
|
|
279
|
+
return name + ':' + data + units
|
|
280
|
+
},
|
|
281
|
+
//处理数据
|
|
282
|
+
dealWithData(data, showType, numfix = 0, mainTarget) {
|
|
283
|
+
data = Number(data)
|
|
284
|
+
|
|
285
|
+
let list = showType
|
|
286
|
+
let num = {
|
|
287
|
+
data: 0,
|
|
288
|
+
monCap: '',
|
|
289
|
+
}
|
|
290
|
+
// 保留小数位
|
|
291
|
+
if (list.includes('keepSmall')) {
|
|
292
|
+
const fixData = data.toFixedRound(numfix)
|
|
293
|
+
num.data = fixData
|
|
294
|
+
if (mainTarget) {
|
|
295
|
+
mainTarget = !mainTarget.startsWith('data.')
|
|
296
|
+
? 'data.' + mainTarget
|
|
297
|
+
: mainTarget
|
|
298
|
+
utils.setValueByConfigKey(this, { trget: mainTarget }, 'trget', data)
|
|
299
|
+
}
|
|
300
|
+
} else {
|
|
301
|
+
if (mainTarget && data != null) {
|
|
302
|
+
mainTarget = !mainTarget.startsWith('data.')
|
|
303
|
+
? 'data.' + mainTarget
|
|
304
|
+
: mainTarget
|
|
305
|
+
utils.setValueByConfigKey(
|
|
306
|
+
this,
|
|
307
|
+
{ trget: mainTarget },
|
|
308
|
+
'trget',
|
|
309
|
+
data.toFixedRound(4)
|
|
310
|
+
)
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
//百分比
|
|
315
|
+
if (list.includes('percentage')) {
|
|
316
|
+
num.data = Number(data * 100) + '%'
|
|
317
|
+
}
|
|
318
|
+
// 千分位
|
|
319
|
+
if (list.includes('Micrometer')) {
|
|
320
|
+
num.data = utils.thousandBit(data)
|
|
321
|
+
}
|
|
322
|
+
if (
|
|
323
|
+
list.includes('keepSmall') &&
|
|
324
|
+
list.includes('percentage') &&
|
|
325
|
+
list.includes('Micrometer')
|
|
326
|
+
) {
|
|
327
|
+
num.data =
|
|
328
|
+
utils.thousandBit(Number(data * 100).toFixedRound(numfix)) + '%'
|
|
329
|
+
|
|
330
|
+
return num
|
|
331
|
+
}
|
|
332
|
+
if (list.includes('keepSmall') && list.includes('percentage')) {
|
|
333
|
+
num.data = Number(data * 100).toFixedRound(numfix) + '%'
|
|
334
|
+
|
|
335
|
+
return num
|
|
336
|
+
}
|
|
337
|
+
if (list.includes('Micrometer') && list.includes('percentage')) {
|
|
338
|
+
num.data = utils.thousandBit(Number(data * 100)) + '%'
|
|
339
|
+
return num
|
|
340
|
+
}
|
|
341
|
+
if (list.includes('keepSmall') && list.includes('Micrometer')) {
|
|
342
|
+
num.data = utils.thousandBit(data.toFixedRound(numfix))
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
// 货币大写
|
|
346
|
+
if (list.includes('monCap')) {
|
|
347
|
+
num = {
|
|
348
|
+
data: data,
|
|
349
|
+
monCap: utils.convertCurrency(data),
|
|
350
|
+
}
|
|
351
|
+
return num
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
return num
|
|
355
|
+
},
|
|
55
356
|
getExpandArr(data, type) {
|
|
56
357
|
if (type === 'expand' && data) {
|
|
57
358
|
let arr = []
|
|
@@ -7,9 +7,12 @@ import { decode } from '@/util/base64'
|
|
|
7
7
|
import Vue from 'vue'
|
|
8
8
|
import $ from 'jquery'
|
|
9
9
|
import _ from 'lodash'
|
|
10
|
+
import moment from 'moment'
|
|
10
11
|
export default {
|
|
11
12
|
data() {
|
|
12
13
|
return {
|
|
14
|
+
defaultQuerys: [],
|
|
15
|
+
isInit: true,
|
|
13
16
|
bpmRunTime: this.$requestConfig.flowUrl,
|
|
14
17
|
fileList: [],
|
|
15
18
|
tableData: { selectRows: [], querys: '' },
|
|
@@ -77,6 +80,7 @@ export default {
|
|
|
77
80
|
pageSize: 30,
|
|
78
81
|
total: 0,
|
|
79
82
|
},
|
|
83
|
+
total: 0,
|
|
80
84
|
rows: [],
|
|
81
85
|
queryParam: {},
|
|
82
86
|
allSummaryConfig: {},
|
|
@@ -84,15 +88,16 @@ export default {
|
|
|
84
88
|
summaryTableData: [],
|
|
85
89
|
needRequestTotal: false, // 需不需要后端统计列表全部数据
|
|
86
90
|
tableDataTotal: {},
|
|
91
|
+
loadingTotal: false //统计按钮加载中
|
|
87
92
|
}
|
|
88
93
|
},
|
|
89
94
|
watch: {
|
|
90
|
-
formKey: function
|
|
95
|
+
formKey: function(newVal) {
|
|
91
96
|
if (newVal) {
|
|
92
97
|
this.init()
|
|
93
98
|
}
|
|
94
99
|
},
|
|
95
|
-
'tableData.selectRows': function
|
|
100
|
+
'tableData.selectRows': function(newVal) {
|
|
96
101
|
if (newVal.length > 0) {
|
|
97
102
|
let me_ = this
|
|
98
103
|
me_.uploadParams.id = []
|
|
@@ -160,7 +165,29 @@ export default {
|
|
|
160
165
|
deep: true,
|
|
161
166
|
},
|
|
162
167
|
},
|
|
168
|
+
created() {
|
|
169
|
+
if (this.queryView.jsScript) {
|
|
170
|
+
// 执行js脚本
|
|
171
|
+
this.handleDiyScript(this.queryView.jsScript)
|
|
172
|
+
}
|
|
173
|
+
},
|
|
163
174
|
methods: {
|
|
175
|
+
handleDiyScript(scriptValue) {
|
|
176
|
+
//执行前置脚本内容
|
|
177
|
+
const _this = this
|
|
178
|
+
// 用户信息
|
|
179
|
+
const account = this.$requestConfig.getAccount()
|
|
180
|
+
const userId = this.$requestConfig.getUserId()
|
|
181
|
+
const userName = this.$requestConfig.getUsername()
|
|
182
|
+
const preScript = `const scriptFunction = function(_this, account, userId, userName){
|
|
183
|
+
${scriptValue}
|
|
184
|
+
};`
|
|
185
|
+
try {
|
|
186
|
+
eval(`${preScript}scriptFunction(_this, account, userId, userName);`)
|
|
187
|
+
} catch (err) {
|
|
188
|
+
this.$message.error(`脚本事件执行错误:${err}`)
|
|
189
|
+
}
|
|
190
|
+
},
|
|
164
191
|
handelBindFiledValua() {
|
|
165
192
|
//数据视图控件
|
|
166
193
|
let _me = this
|
|
@@ -209,7 +236,7 @@ export default {
|
|
|
209
236
|
selectList[i].selectValue = value
|
|
210
237
|
|
|
211
238
|
//添加监听
|
|
212
|
-
pInst.$watch(path, function
|
|
239
|
+
pInst.$watch(path, function(newVal, oldVal) {
|
|
213
240
|
_.debounce(() => {
|
|
214
241
|
if (newVal !== oldVal) {
|
|
215
242
|
_me.queryViewOptions.selectList[i].selectValue = newVal
|
|
@@ -353,7 +380,7 @@ export default {
|
|
|
353
380
|
this.$router.push(url)
|
|
354
381
|
},
|
|
355
382
|
|
|
356
|
-
handleSizeChange: function
|
|
383
|
+
handleSizeChange: function(size) {
|
|
357
384
|
//每页下拉显示数据
|
|
358
385
|
this.pagination.pageSize = size
|
|
359
386
|
if (this.$refs.queryViewList) {
|
|
@@ -362,7 +389,7 @@ export default {
|
|
|
362
389
|
this.search()
|
|
363
390
|
}
|
|
364
391
|
},
|
|
365
|
-
handleCurrentChange: function
|
|
392
|
+
handleCurrentChange: function(currentPage) {
|
|
366
393
|
//点击第几页
|
|
367
394
|
this.pagination.page = currentPage
|
|
368
395
|
if (this.$refs.queryViewList) {
|
|
@@ -372,14 +399,112 @@ export default {
|
|
|
372
399
|
}
|
|
373
400
|
},
|
|
374
401
|
//回车查询
|
|
375
|
-
searchEnterFun: function
|
|
402
|
+
searchEnterFun: function(e) {
|
|
376
403
|
let keyCode = window.event ? e.keyCode : e.which
|
|
377
404
|
if (keyCode == 13) {
|
|
378
405
|
this.pagination.page = 1
|
|
379
406
|
this.search()
|
|
380
407
|
}
|
|
381
408
|
},
|
|
382
|
-
|
|
409
|
+
getQueryDataViewOperation(key) {
|
|
410
|
+
switch (key) {
|
|
411
|
+
case 'EQ':
|
|
412
|
+
return 'EQUAL'
|
|
413
|
+
case 'NE':
|
|
414
|
+
return 'NOT_EQUAL'
|
|
415
|
+
case 'LK':
|
|
416
|
+
return 'LIKE'
|
|
417
|
+
case 'LFK':
|
|
418
|
+
return 'LEFT_LIKE'
|
|
419
|
+
case 'RHK':
|
|
420
|
+
return 'RIGHT_LIKE'
|
|
421
|
+
case 'BETWEEN':
|
|
422
|
+
return 'BETWEEN'
|
|
423
|
+
default:
|
|
424
|
+
return 'LIKE'
|
|
425
|
+
}
|
|
426
|
+
},
|
|
427
|
+
async buildDefaultQuerys() {
|
|
428
|
+
let querys = []
|
|
429
|
+
let conditions = JSON.parse(this.queryView.conditions)
|
|
430
|
+
//条件字段默认值判断
|
|
431
|
+
for (let i = 0; i < conditions.length; i++) {
|
|
432
|
+
let condition = conditions[i]
|
|
433
|
+
if (condition.defaultValue) {
|
|
434
|
+
let defaultValue = condition.isScriptDefault
|
|
435
|
+
? await this.getScriptDefaultValue(condition.defaultValue)
|
|
436
|
+
: condition.defaultValue
|
|
437
|
+
if (condition.dataType == 'number') {
|
|
438
|
+
defaultValue = parseFloat(defaultValue)
|
|
439
|
+
}
|
|
440
|
+
this.$set(this.searchForm, condition.fieldName, defaultValue)
|
|
441
|
+
|
|
442
|
+
querys.push({
|
|
443
|
+
property: condition.fieldName,
|
|
444
|
+
value: defaultValue,
|
|
445
|
+
group: 'main',
|
|
446
|
+
operation: this.getQueryDataViewOperation(condition.operate),
|
|
447
|
+
relation: 'AND',
|
|
448
|
+
})
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
this.defaultQuerys = querys
|
|
452
|
+
return querys
|
|
453
|
+
},
|
|
454
|
+
getScriptDefaultValue(scriptValue) {
|
|
455
|
+
return new Promise((resolve) => {
|
|
456
|
+
//执行前置脚本内容
|
|
457
|
+
const _this = this
|
|
458
|
+
// 用户信息
|
|
459
|
+
const account = this.$requestConfig.getAccount()
|
|
460
|
+
const userId = this.$requestConfig.getUserId()
|
|
461
|
+
const userName = this.$requestConfig.getUsername()
|
|
462
|
+
const _moment = moment
|
|
463
|
+
const preScript = `const scriptFunction = function(_this, account, userId, userName, _moment){
|
|
464
|
+
${scriptValue}
|
|
465
|
+
};`
|
|
466
|
+
let result = ''
|
|
467
|
+
try {
|
|
468
|
+
result = eval(
|
|
469
|
+
`${preScript}scriptFunction(_this, account, userId, userName, _moment);`
|
|
470
|
+
)
|
|
471
|
+
if (result && result.then && typeof result.then === 'function') {
|
|
472
|
+
result.then(
|
|
473
|
+
(t) => {
|
|
474
|
+
resolve(t)
|
|
475
|
+
},
|
|
476
|
+
(fail) => {
|
|
477
|
+
//接口返回失败则终止按钮操作,并输出错误信息
|
|
478
|
+
resolve('')
|
|
479
|
+
}
|
|
480
|
+
)
|
|
481
|
+
} else {
|
|
482
|
+
resolve(result)
|
|
483
|
+
}
|
|
484
|
+
} catch (err) {
|
|
485
|
+
resolve('')
|
|
486
|
+
this.$message.error(`查询值默认脚本事件执行错误:${err}`)
|
|
487
|
+
}
|
|
488
|
+
})
|
|
489
|
+
},
|
|
490
|
+
validateSearchRequired(querys) {
|
|
491
|
+
let errorMsg = ''
|
|
492
|
+
let conditions = JSON.parse(this.queryView.conditions)
|
|
493
|
+
if (conditions && querys) {
|
|
494
|
+
conditions.forEach((item) => {
|
|
495
|
+
if (item.isRequired) {
|
|
496
|
+
let index = querys.findIndex((k) => {
|
|
497
|
+
return k.property == item.fieldName
|
|
498
|
+
})
|
|
499
|
+
if (index == -1) {
|
|
500
|
+
errorMsg = `字段【${item.fieldDesc}】为必填查询字段,不能为空!`
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
})
|
|
504
|
+
}
|
|
505
|
+
return errorMsg
|
|
506
|
+
},
|
|
507
|
+
async search(param, cb, isSearchBtn, needRequestTotal = false) {
|
|
383
508
|
// 不需要请求后端接口统计列表数据
|
|
384
509
|
this.needRequestTotal = needRequestTotal
|
|
385
510
|
!param && (param = {})
|
|
@@ -387,6 +512,35 @@ export default {
|
|
|
387
512
|
const dataTemplateQueryVo = {
|
|
388
513
|
queryFilter: param,
|
|
389
514
|
}
|
|
515
|
+
//初始化时,把查询字段的默认值加进去
|
|
516
|
+
if (this.isInit) {
|
|
517
|
+
this.isInit = false
|
|
518
|
+
let querys = await this.buildDefaultQuerys()
|
|
519
|
+
dataTemplateQueryVo.queryFilter.querys =
|
|
520
|
+
dataTemplateQueryVo.queryFilter.querys || []
|
|
521
|
+
dataTemplateQueryVo.queryFilter.querys = dataTemplateQueryVo.queryFilter.querys.concat(
|
|
522
|
+
querys
|
|
523
|
+
)
|
|
524
|
+
}
|
|
525
|
+
// 非高级查询时,将默认值带上
|
|
526
|
+
if (!isSearchBtn) {
|
|
527
|
+
dataTemplateQueryVo.queryFilter.querys =
|
|
528
|
+
dataTemplateQueryVo.queryFilter.querys || []
|
|
529
|
+
dataTemplateQueryVo.queryFilter.querys = dataTemplateQueryVo.queryFilter.querys.concat(
|
|
530
|
+
this.defaultQuerys
|
|
531
|
+
)
|
|
532
|
+
}
|
|
533
|
+
// 查询字段 校验是否必填,如果是必填没数据,需返回提示
|
|
534
|
+
if (isSearchBtn) {
|
|
535
|
+
let errorMsg = this.validateSearchRequired(
|
|
536
|
+
dataTemplateQueryVo.queryFilter.querys
|
|
537
|
+
)
|
|
538
|
+
if (errorMsg) {
|
|
539
|
+
this.$message.warning(errorMsg)
|
|
540
|
+
cb && cb()
|
|
541
|
+
return
|
|
542
|
+
}
|
|
543
|
+
}
|
|
390
544
|
//保存查询参数,用于作为导出的查询参数
|
|
391
545
|
if (this.queryViewOptions) {
|
|
392
546
|
//关联查询字段
|
|
@@ -419,13 +573,17 @@ export default {
|
|
|
419
573
|
})
|
|
420
574
|
}
|
|
421
575
|
this.$requestConfig
|
|
422
|
-
.
|
|
576
|
+
.getQueryViewDataListWithoutTotal(param)
|
|
423
577
|
.then((response) => {
|
|
424
578
|
this.rows = response.rows
|
|
425
|
-
this.pagination.total = response.total
|
|
579
|
+
// this.pagination.total = response.total
|
|
426
580
|
this.pagination.page = response.page
|
|
427
581
|
this.pagination.pageSize = response.pageSize
|
|
428
582
|
this.filterOldSummaryValByType('currentPage')
|
|
583
|
+
//每次请求后不再统计总数,而是在统计按钮中去统计,当数量统计过一次后,再重新设置到当前页
|
|
584
|
+
if (this.total) {
|
|
585
|
+
this.$set(this.pagination, 'total', this.total)
|
|
586
|
+
}
|
|
429
587
|
this.summaryTableData.push({
|
|
430
588
|
project: '当前页汇总',
|
|
431
589
|
key: 'currentPage',
|
|
@@ -445,12 +603,31 @@ export default {
|
|
|
445
603
|
cb && cb()
|
|
446
604
|
})
|
|
447
605
|
},
|
|
606
|
+
getQuerySqlViewByPaginationTotal(param, cb) {
|
|
607
|
+
this.loadingTotal = true
|
|
608
|
+
this.$requestConfig
|
|
609
|
+
.getQueryViewDataListWithTotal(param)
|
|
610
|
+
.then((response) => {
|
|
611
|
+
this.total = response.value
|
|
612
|
+
//每次请求后不再统计总数,而是在统计按钮中去统计,当数量统计过一次后,再重新设置到当前页
|
|
613
|
+
if (this.total) {
|
|
614
|
+
this.$set(this.pagination, 'total', this.total)
|
|
615
|
+
}
|
|
616
|
+
this.loadingTotal = false
|
|
617
|
+
this.$nextTick(() => {
|
|
618
|
+
this.$refs.queryViewList && this.$refs.queryViewList.doLayout()
|
|
619
|
+
})
|
|
620
|
+
})
|
|
621
|
+
.finally(() => {
|
|
622
|
+
this.loadingTotal = false
|
|
623
|
+
cb && cb()
|
|
624
|
+
})
|
|
625
|
+
},
|
|
448
626
|
getQueryFilter() {
|
|
449
627
|
let operationMap = this.getSearchItems() //查询条件类型
|
|
450
628
|
// let fieldQueryMap = this.getFieldQuery() //查询条件字段
|
|
451
629
|
let specialMap = this.getSpecialMap() //获取特殊查询情况(自定义对话框)
|
|
452
630
|
let querys = [] //查询条件
|
|
453
|
-
let queryFilter = {}
|
|
454
631
|
let pageBean = { pageBean: this.pagination }
|
|
455
632
|
let params = {
|
|
456
633
|
sqlAlias: this.sqlAlias || this.queryView.sqlAlias,
|
|
@@ -458,6 +635,10 @@ export default {
|
|
|
458
635
|
}
|
|
459
636
|
params.pagination = pageBean
|
|
460
637
|
if ($.isEmptyObject(this.searchForm)) {
|
|
638
|
+
if (this.$refs.queryViewList && this.$refs.queryViewList.querys) {
|
|
639
|
+
querys.push(...this.$refs.queryViewList.querys)
|
|
640
|
+
}
|
|
641
|
+
params = { pageBean: this.pagination, querys }
|
|
461
642
|
return params
|
|
462
643
|
} else {
|
|
463
644
|
for (var key in this.searchForm) {
|
|
@@ -522,9 +703,10 @@ export default {
|
|
|
522
703
|
}
|
|
523
704
|
}
|
|
524
705
|
}
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
706
|
+
if (this.$refs.queryViewList && this.$refs.queryViewList.querys) {
|
|
707
|
+
querys.push(...this.$refs.queryViewList.querys)
|
|
708
|
+
}
|
|
709
|
+
return { pageBean: this.pagination, querys }
|
|
528
710
|
}
|
|
529
711
|
},
|
|
530
712
|
//获取查询条件类型
|
|
@@ -778,15 +960,22 @@ export default {
|
|
|
778
960
|
let loadingInstance = Loading.service({ fullscreen: true }) //开始
|
|
779
961
|
this.$requestConfig
|
|
780
962
|
.querySqlViewExport(data)
|
|
781
|
-
.then(({ data, headers }) => {
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
963
|
+
// .then(({ data, headers }) => {
|
|
964
|
+
// const fileName = decodeURIComponent(
|
|
965
|
+
// headers['content-disposition'].split(';')[1].split('filename=')[1]
|
|
966
|
+
// )
|
|
967
|
+
// const blob = new Blob([data])
|
|
968
|
+
// saveAs(blob, fileName)
|
|
969
|
+
// })
|
|
970
|
+
// .finally(() => {
|
|
971
|
+
// loadingInstance.close() // 结束
|
|
972
|
+
// this.dialogExportVisible = false
|
|
973
|
+
// })
|
|
974
|
+
.then(() => {
|
|
975
|
+
this.$message.success('正在导出,请稍后前往报表附件管理查看')
|
|
787
976
|
})
|
|
788
977
|
.finally(() => {
|
|
789
|
-
loadingInstance.close()
|
|
978
|
+
loadingInstance.close()
|
|
790
979
|
this.dialogExportVisible = false
|
|
791
980
|
})
|
|
792
981
|
},
|
|
@@ -1097,5 +1286,34 @@ export default {
|
|
|
1097
1286
|
this.search()
|
|
1098
1287
|
})
|
|
1099
1288
|
},
|
|
1289
|
+
countPageTotal() {
|
|
1290
|
+
this.searchCountTotal(this.getQueryFilter())
|
|
1291
|
+
},
|
|
1292
|
+
searchCountTotal(param, cb, isSearchBtn, needRequestTotal = false) {
|
|
1293
|
+
// 不需要请求后端接口统计列表数据
|
|
1294
|
+
this.needRequestTotal = needRequestTotal
|
|
1295
|
+
!param && (param = {})
|
|
1296
|
+
param.pageBean = this.pagination
|
|
1297
|
+
const dataTemplateQueryVo = {
|
|
1298
|
+
queryFilter: param,
|
|
1299
|
+
}
|
|
1300
|
+
//保存查询参数,用于作为导出的查询参数
|
|
1301
|
+
if (this.queryViewOptions) {
|
|
1302
|
+
//关联查询字段
|
|
1303
|
+
if (
|
|
1304
|
+
this.queryViewOptions.selectList &&
|
|
1305
|
+
this.queryViewOptions.selectList.length > 0
|
|
1306
|
+
) {
|
|
1307
|
+
dataTemplateQueryVo.selectList = this.queryViewOptions.selectList
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
this.queryParam = { ...param }
|
|
1311
|
+
let obj = {
|
|
1312
|
+
sqlAlias: this.sqlAlias || this.queryView.sqlAlias,
|
|
1313
|
+
alias: this.alias || this.queryView.alias,
|
|
1314
|
+
param: dataTemplateQueryVo,
|
|
1315
|
+
}
|
|
1316
|
+
this.getQuerySqlViewByPaginationTotal(obj, cb)
|
|
1317
|
+
},
|
|
1100
1318
|
},
|
|
1101
1319
|
}
|