three-trees-ui 1.0.69 → 1.0.70
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 +16707 -15963
- package/lib/three-trees-ui.css +1 -1
- package/lib/three-trees-ui.umd.js +16707 -15963
- package/lib/three-trees-ui.umd.min.js +1 -1
- package/package.json +1 -1
- package/packages/CustomDialog/src/customDialog.vue +74 -12
- package/packages/DataLists/src/main.vue +2 -3
- package/packages/QuerySqlPreview/src/QuerySqlPreview.vue +43 -1
- package/packages/TableSearchField/src/main.vue +5 -0
- package/packages/TemplatePreview/src/TemplatePreview.vue +43 -0
- package/src/mixins/querySqlPreview.js +299 -21
- package/src/mixins/templatePreview.js +518 -42
|
@@ -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,8 @@ export default {
|
|
|
77
80
|
pageSize: 30,
|
|
78
81
|
total: 0,
|
|
79
82
|
},
|
|
83
|
+
lastPage: 1, //上一次输入的分页数、默认为1
|
|
84
|
+
total: 0,
|
|
80
85
|
rows: [],
|
|
81
86
|
queryParam: {},
|
|
82
87
|
allSummaryConfig: {},
|
|
@@ -84,15 +89,54 @@ export default {
|
|
|
84
89
|
summaryTableData: [],
|
|
85
90
|
needRequestTotal: false, // 需不需要后端统计列表全部数据
|
|
86
91
|
tableDataTotal: {},
|
|
92
|
+
loadingTotal: false, //统计按钮加载中
|
|
93
|
+
pageSizeArray: [
|
|
94
|
+
{
|
|
95
|
+
label: '10条/页',
|
|
96
|
+
value: 10,
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
label: '20条/页',
|
|
100
|
+
value: 20,
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
label: '30条/页',
|
|
104
|
+
value: 30,
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
label: '40条/页',
|
|
108
|
+
value: 40,
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
label: '50条/页',
|
|
112
|
+
value: 50,
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
label: '100条/页',
|
|
116
|
+
value: 100,
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
label: '200条/页',
|
|
120
|
+
value: 200,
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
label: '300条/页',
|
|
124
|
+
value: 300,
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
label: '500条/页',
|
|
128
|
+
value: 500,
|
|
129
|
+
},
|
|
130
|
+
],
|
|
87
131
|
}
|
|
88
132
|
},
|
|
89
133
|
watch: {
|
|
90
|
-
formKey: function
|
|
134
|
+
formKey: function(newVal) {
|
|
91
135
|
if (newVal) {
|
|
92
136
|
this.init()
|
|
93
137
|
}
|
|
94
138
|
},
|
|
95
|
-
'tableData.selectRows': function
|
|
139
|
+
'tableData.selectRows': function(newVal) {
|
|
96
140
|
if (newVal.length > 0) {
|
|
97
141
|
let me_ = this
|
|
98
142
|
me_.uploadParams.id = []
|
|
@@ -160,7 +204,29 @@ export default {
|
|
|
160
204
|
deep: true,
|
|
161
205
|
},
|
|
162
206
|
},
|
|
207
|
+
created() {
|
|
208
|
+
if (this.queryView.jsScript) {
|
|
209
|
+
// 执行js脚本
|
|
210
|
+
this.handleDiyScript(this.queryView.jsScript)
|
|
211
|
+
}
|
|
212
|
+
},
|
|
163
213
|
methods: {
|
|
214
|
+
handleDiyScript(scriptValue) {
|
|
215
|
+
//执行前置脚本内容
|
|
216
|
+
const _this = this
|
|
217
|
+
// 用户信息
|
|
218
|
+
const account = this.$requestConfig.getAccount()
|
|
219
|
+
const userId = this.$requestConfig.getUserId()
|
|
220
|
+
const userName = this.$requestConfig.getUsername()
|
|
221
|
+
const preScript = `const scriptFunction = function(_this, account, userId, userName){
|
|
222
|
+
${scriptValue}
|
|
223
|
+
};`
|
|
224
|
+
try {
|
|
225
|
+
eval(`${preScript}scriptFunction(_this, account, userId, userName);`)
|
|
226
|
+
} catch (err) {
|
|
227
|
+
this.$message.error(`脚本事件执行错误:${err}`)
|
|
228
|
+
}
|
|
229
|
+
},
|
|
164
230
|
handelBindFiledValua() {
|
|
165
231
|
//数据视图控件
|
|
166
232
|
let _me = this
|
|
@@ -209,7 +275,7 @@ export default {
|
|
|
209
275
|
selectList[i].selectValue = value
|
|
210
276
|
|
|
211
277
|
//添加监听
|
|
212
|
-
pInst.$watch(path, function
|
|
278
|
+
pInst.$watch(path, function(newVal, oldVal) {
|
|
213
279
|
_.debounce(() => {
|
|
214
280
|
if (newVal !== oldVal) {
|
|
215
281
|
_me.queryViewOptions.selectList[i].selectValue = newVal
|
|
@@ -353,7 +419,7 @@ export default {
|
|
|
353
419
|
this.$router.push(url)
|
|
354
420
|
},
|
|
355
421
|
|
|
356
|
-
handleSizeChange: function
|
|
422
|
+
handleSizeChange: function(size) {
|
|
357
423
|
//每页下拉显示数据
|
|
358
424
|
this.pagination.pageSize = size
|
|
359
425
|
if (this.$refs.queryViewList) {
|
|
@@ -362,9 +428,9 @@ export default {
|
|
|
362
428
|
this.search()
|
|
363
429
|
}
|
|
364
430
|
},
|
|
365
|
-
handleCurrentChange: function
|
|
431
|
+
handleCurrentChange: function(currentPage) {
|
|
366
432
|
//点击第几页
|
|
367
|
-
this.pagination.page = currentPage
|
|
433
|
+
this.pagination.page = currentPage ? currentPage : this.lastPage
|
|
368
434
|
if (this.$refs.queryViewList) {
|
|
369
435
|
this.$refs.queryViewList.load()
|
|
370
436
|
} else {
|
|
@@ -372,14 +438,112 @@ export default {
|
|
|
372
438
|
}
|
|
373
439
|
},
|
|
374
440
|
//回车查询
|
|
375
|
-
searchEnterFun: function
|
|
441
|
+
searchEnterFun: function(e) {
|
|
376
442
|
let keyCode = window.event ? e.keyCode : e.which
|
|
377
443
|
if (keyCode == 13) {
|
|
378
444
|
this.pagination.page = 1
|
|
379
445
|
this.search()
|
|
380
446
|
}
|
|
381
447
|
},
|
|
382
|
-
|
|
448
|
+
getQueryDataViewOperation(key) {
|
|
449
|
+
switch (key) {
|
|
450
|
+
case 'EQ':
|
|
451
|
+
return 'EQUAL'
|
|
452
|
+
case 'NE':
|
|
453
|
+
return 'NOT_EQUAL'
|
|
454
|
+
case 'LK':
|
|
455
|
+
return 'LIKE'
|
|
456
|
+
case 'LFK':
|
|
457
|
+
return 'LEFT_LIKE'
|
|
458
|
+
case 'RHK':
|
|
459
|
+
return 'RIGHT_LIKE'
|
|
460
|
+
case 'BETWEEN':
|
|
461
|
+
return 'BETWEEN'
|
|
462
|
+
default:
|
|
463
|
+
return 'LIKE'
|
|
464
|
+
}
|
|
465
|
+
},
|
|
466
|
+
async buildDefaultQuerys() {
|
|
467
|
+
let querys = []
|
|
468
|
+
let conditions = JSON.parse(this.queryView.conditions)
|
|
469
|
+
//条件字段默认值判断
|
|
470
|
+
for (let i = 0; i < conditions.length; i++) {
|
|
471
|
+
let condition = conditions[i]
|
|
472
|
+
if (condition.defaultValue) {
|
|
473
|
+
let defaultValue = condition.isScriptDefault
|
|
474
|
+
? await this.getScriptDefaultValue(condition.defaultValue)
|
|
475
|
+
: condition.defaultValue
|
|
476
|
+
if (condition.dataType == 'number') {
|
|
477
|
+
defaultValue = parseFloat(defaultValue)
|
|
478
|
+
}
|
|
479
|
+
this.$set(this.searchForm, condition.fieldName, defaultValue)
|
|
480
|
+
|
|
481
|
+
querys.push({
|
|
482
|
+
property: condition.fieldName,
|
|
483
|
+
value: defaultValue,
|
|
484
|
+
group: 'main',
|
|
485
|
+
operation: this.getQueryDataViewOperation(condition.operate),
|
|
486
|
+
relation: 'AND',
|
|
487
|
+
})
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
this.defaultQuerys = querys
|
|
491
|
+
return querys
|
|
492
|
+
},
|
|
493
|
+
getScriptDefaultValue(scriptValue) {
|
|
494
|
+
return new Promise((resolve) => {
|
|
495
|
+
//执行前置脚本内容
|
|
496
|
+
const _this = this
|
|
497
|
+
// 用户信息
|
|
498
|
+
const account = this.$requestConfig.getAccount()
|
|
499
|
+
const userId = this.$requestConfig.getUserId()
|
|
500
|
+
const userName = this.$requestConfig.getUsername()
|
|
501
|
+
const _moment = moment
|
|
502
|
+
const preScript = `const scriptFunction = function(_this, account, userId, userName, _moment){
|
|
503
|
+
${scriptValue}
|
|
504
|
+
};`
|
|
505
|
+
let result = ''
|
|
506
|
+
try {
|
|
507
|
+
result = eval(
|
|
508
|
+
`${preScript}scriptFunction(_this, account, userId, userName, _moment);`
|
|
509
|
+
)
|
|
510
|
+
if (result && result.then && typeof result.then === 'function') {
|
|
511
|
+
result.then(
|
|
512
|
+
(t) => {
|
|
513
|
+
resolve(t)
|
|
514
|
+
},
|
|
515
|
+
(fail) => {
|
|
516
|
+
//接口返回失败则终止按钮操作,并输出错误信息
|
|
517
|
+
resolve('')
|
|
518
|
+
}
|
|
519
|
+
)
|
|
520
|
+
} else {
|
|
521
|
+
resolve(result)
|
|
522
|
+
}
|
|
523
|
+
} catch (err) {
|
|
524
|
+
resolve('')
|
|
525
|
+
this.$message.error(`查询值默认脚本事件执行错误:${err}`)
|
|
526
|
+
}
|
|
527
|
+
})
|
|
528
|
+
},
|
|
529
|
+
validateSearchRequired(querys) {
|
|
530
|
+
let errorMsg = ''
|
|
531
|
+
let conditions = JSON.parse(this.queryView.conditions)
|
|
532
|
+
if (conditions && querys) {
|
|
533
|
+
conditions.forEach((item) => {
|
|
534
|
+
if (item.isRequired) {
|
|
535
|
+
let index = querys.findIndex((k) => {
|
|
536
|
+
return k.property == item.fieldName
|
|
537
|
+
})
|
|
538
|
+
if (index == -1) {
|
|
539
|
+
errorMsg = `字段【${item.fieldDesc}】为必填查询字段,不能为空!`
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
})
|
|
543
|
+
}
|
|
544
|
+
return errorMsg
|
|
545
|
+
},
|
|
546
|
+
async search(param, cb, isSearchBtn, needRequestTotal = false) {
|
|
383
547
|
// 不需要请求后端接口统计列表数据
|
|
384
548
|
this.needRequestTotal = needRequestTotal
|
|
385
549
|
!param && (param = {})
|
|
@@ -387,6 +551,35 @@ export default {
|
|
|
387
551
|
const dataTemplateQueryVo = {
|
|
388
552
|
queryFilter: param,
|
|
389
553
|
}
|
|
554
|
+
//初始化时,把查询字段的默认值加进去
|
|
555
|
+
if (this.isInit) {
|
|
556
|
+
this.isInit = false
|
|
557
|
+
let querys = await this.buildDefaultQuerys()
|
|
558
|
+
dataTemplateQueryVo.queryFilter.querys =
|
|
559
|
+
dataTemplateQueryVo.queryFilter.querys || []
|
|
560
|
+
dataTemplateQueryVo.queryFilter.querys = dataTemplateQueryVo.queryFilter.querys.concat(
|
|
561
|
+
querys
|
|
562
|
+
)
|
|
563
|
+
}
|
|
564
|
+
// 非高级查询时,将默认值带上
|
|
565
|
+
if (!isSearchBtn) {
|
|
566
|
+
dataTemplateQueryVo.queryFilter.querys =
|
|
567
|
+
dataTemplateQueryVo.queryFilter.querys || []
|
|
568
|
+
dataTemplateQueryVo.queryFilter.querys = dataTemplateQueryVo.queryFilter.querys.concat(
|
|
569
|
+
this.defaultQuerys
|
|
570
|
+
)
|
|
571
|
+
}
|
|
572
|
+
// 查询字段 校验是否必填,如果是必填没数据,需返回提示
|
|
573
|
+
if (isSearchBtn) {
|
|
574
|
+
let errorMsg = this.validateSearchRequired(
|
|
575
|
+
dataTemplateQueryVo.queryFilter.querys
|
|
576
|
+
)
|
|
577
|
+
if (errorMsg) {
|
|
578
|
+
this.$message.warning(errorMsg)
|
|
579
|
+
cb && cb()
|
|
580
|
+
return
|
|
581
|
+
}
|
|
582
|
+
}
|
|
390
583
|
//保存查询参数,用于作为导出的查询参数
|
|
391
584
|
if (this.queryViewOptions) {
|
|
392
585
|
//关联查询字段
|
|
@@ -419,13 +612,17 @@ export default {
|
|
|
419
612
|
})
|
|
420
613
|
}
|
|
421
614
|
this.$requestConfig
|
|
422
|
-
.
|
|
615
|
+
.getQueryViewDataListWithoutTotal(param)
|
|
423
616
|
.then((response) => {
|
|
424
617
|
this.rows = response.rows
|
|
425
|
-
this.pagination.total = response.total
|
|
618
|
+
// this.pagination.total = response.total
|
|
426
619
|
this.pagination.page = response.page
|
|
427
620
|
this.pagination.pageSize = response.pageSize
|
|
428
621
|
this.filterOldSummaryValByType('currentPage')
|
|
622
|
+
//每次请求后不再统计总数,而是在统计按钮中去统计,当数量统计过一次后,再重新设置到当前页
|
|
623
|
+
if (this.total) {
|
|
624
|
+
this.$set(this.pagination, 'total', this.total)
|
|
625
|
+
}
|
|
429
626
|
this.summaryTableData.push({
|
|
430
627
|
project: '当前页汇总',
|
|
431
628
|
key: 'currentPage',
|
|
@@ -445,12 +642,31 @@ export default {
|
|
|
445
642
|
cb && cb()
|
|
446
643
|
})
|
|
447
644
|
},
|
|
645
|
+
getQuerySqlViewByPaginationTotal(param, cb) {
|
|
646
|
+
this.loadingTotal = true
|
|
647
|
+
this.$requestConfig
|
|
648
|
+
.getQueryViewDataListWithTotal(param)
|
|
649
|
+
.then((response) => {
|
|
650
|
+
this.total = response.value
|
|
651
|
+
//每次请求后不再统计总数,而是在统计按钮中去统计,当数量统计过一次后,再重新设置到当前页
|
|
652
|
+
if (this.total) {
|
|
653
|
+
this.$set(this.pagination, 'total', this.total)
|
|
654
|
+
}
|
|
655
|
+
this.loadingTotal = false
|
|
656
|
+
this.$nextTick(() => {
|
|
657
|
+
this.$refs.queryViewList && this.$refs.queryViewList.doLayout()
|
|
658
|
+
})
|
|
659
|
+
})
|
|
660
|
+
.finally(() => {
|
|
661
|
+
this.loadingTotal = false
|
|
662
|
+
cb && cb()
|
|
663
|
+
})
|
|
664
|
+
},
|
|
448
665
|
getQueryFilter() {
|
|
449
666
|
let operationMap = this.getSearchItems() //查询条件类型
|
|
450
667
|
// let fieldQueryMap = this.getFieldQuery() //查询条件字段
|
|
451
668
|
let specialMap = this.getSpecialMap() //获取特殊查询情况(自定义对话框)
|
|
452
669
|
let querys = [] //查询条件
|
|
453
|
-
let queryFilter = {}
|
|
454
670
|
let pageBean = { pageBean: this.pagination }
|
|
455
671
|
let params = {
|
|
456
672
|
sqlAlias: this.sqlAlias || this.queryView.sqlAlias,
|
|
@@ -458,6 +674,10 @@ export default {
|
|
|
458
674
|
}
|
|
459
675
|
params.pagination = pageBean
|
|
460
676
|
if ($.isEmptyObject(this.searchForm)) {
|
|
677
|
+
if (this.$refs.queryViewList && this.$refs.queryViewList.querys) {
|
|
678
|
+
querys.push(...this.$refs.queryViewList.querys)
|
|
679
|
+
}
|
|
680
|
+
params = { pageBean: this.pagination, querys }
|
|
461
681
|
return params
|
|
462
682
|
} else {
|
|
463
683
|
for (var key in this.searchForm) {
|
|
@@ -522,9 +742,10 @@ export default {
|
|
|
522
742
|
}
|
|
523
743
|
}
|
|
524
744
|
}
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
745
|
+
if (this.$refs.queryViewList && this.$refs.queryViewList.querys) {
|
|
746
|
+
querys.push(...this.$refs.queryViewList.querys)
|
|
747
|
+
}
|
|
748
|
+
return { pageBean: this.pagination, querys }
|
|
528
749
|
}
|
|
529
750
|
},
|
|
530
751
|
//获取查询条件类型
|
|
@@ -778,15 +999,22 @@ export default {
|
|
|
778
999
|
let loadingInstance = Loading.service({ fullscreen: true }) //开始
|
|
779
1000
|
this.$requestConfig
|
|
780
1001
|
.querySqlViewExport(data)
|
|
781
|
-
.then(({ data, headers }) => {
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
1002
|
+
// .then(({ data, headers }) => {
|
|
1003
|
+
// const fileName = decodeURIComponent(
|
|
1004
|
+
// headers['content-disposition'].split(';')[1].split('filename=')[1]
|
|
1005
|
+
// )
|
|
1006
|
+
// const blob = new Blob([data])
|
|
1007
|
+
// saveAs(blob, fileName)
|
|
1008
|
+
// })
|
|
1009
|
+
// .finally(() => {
|
|
1010
|
+
// loadingInstance.close() // 结束
|
|
1011
|
+
// this.dialogExportVisible = false
|
|
1012
|
+
// })
|
|
1013
|
+
.then(() => {
|
|
1014
|
+
this.$message.success('正在导出,请稍后前往报表附件管理查看')
|
|
787
1015
|
})
|
|
788
1016
|
.finally(() => {
|
|
789
|
-
loadingInstance.close()
|
|
1017
|
+
loadingInstance.close()
|
|
790
1018
|
this.dialogExportVisible = false
|
|
791
1019
|
})
|
|
792
1020
|
},
|
|
@@ -1097,5 +1325,55 @@ export default {
|
|
|
1097
1325
|
this.search()
|
|
1098
1326
|
})
|
|
1099
1327
|
},
|
|
1328
|
+
countPageTotal() {
|
|
1329
|
+
this.searchCountTotal(this.getQueryFilter())
|
|
1330
|
+
},
|
|
1331
|
+
searchCountTotal(param, cb, isSearchBtn, needRequestTotal = false) {
|
|
1332
|
+
// 不需要请求后端接口统计列表数据
|
|
1333
|
+
this.needRequestTotal = needRequestTotal
|
|
1334
|
+
!param && (param = {})
|
|
1335
|
+
param.pageBean = this.pagination
|
|
1336
|
+
const dataTemplateQueryVo = {
|
|
1337
|
+
queryFilter: param,
|
|
1338
|
+
}
|
|
1339
|
+
//保存查询参数,用于作为导出的查询参数
|
|
1340
|
+
if (this.queryViewOptions) {
|
|
1341
|
+
//关联查询字段
|
|
1342
|
+
if (
|
|
1343
|
+
this.queryViewOptions.selectList &&
|
|
1344
|
+
this.queryViewOptions.selectList.length > 0
|
|
1345
|
+
) {
|
|
1346
|
+
dataTemplateQueryVo.selectList = this.queryViewOptions.selectList
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
this.queryParam = { ...param }
|
|
1350
|
+
let obj = {
|
|
1351
|
+
sqlAlias: this.sqlAlias || this.queryView.sqlAlias,
|
|
1352
|
+
alias: this.alias || this.queryView.alias,
|
|
1353
|
+
param: dataTemplateQueryVo,
|
|
1354
|
+
}
|
|
1355
|
+
this.getQuerySqlViewByPaginationTotal(obj, cb)
|
|
1356
|
+
},
|
|
1357
|
+
switchPage(type) {
|
|
1358
|
+
if (type == 'prev') this.pagination.page--
|
|
1359
|
+
if (type == 'next') this.pagination.page++
|
|
1360
|
+
this.handleCurrentChange(this.pagination.page)
|
|
1361
|
+
},
|
|
1362
|
+
handleInput(value) {
|
|
1363
|
+
if (!value) {
|
|
1364
|
+
return
|
|
1365
|
+
}
|
|
1366
|
+
// 使用正则表达式匹配正整数
|
|
1367
|
+
const regex = /^[1-9]\d*$/
|
|
1368
|
+
|
|
1369
|
+
// 如果输入的值不符合正整数的模式,则将其重置为1
|
|
1370
|
+
if (!regex.test(value)) {
|
|
1371
|
+
//如果上一次输入的页数有值,则用上一次输入的页数,否则默认为1
|
|
1372
|
+
this.pagination.page = this.lastPage ? this.lastPage : 1
|
|
1373
|
+
} else {
|
|
1374
|
+
//本次分页数,赋值给上一次分页数
|
|
1375
|
+
this.lastPage = this.pagination.page
|
|
1376
|
+
}
|
|
1377
|
+
},
|
|
1100
1378
|
},
|
|
1101
1379
|
}
|