three-trees-ui 1.0.70 → 1.0.71
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 +15530 -16780
- package/lib/three-trees-ui.css +1 -1
- package/lib/three-trees-ui.umd.js +15530 -16780
- package/lib/three-trees-ui.umd.min.js +1 -1
- package/package.json +1 -1
- package/packages/CustomDialog/src/customDialog.vue +12 -74
- package/packages/DataLists/src/main.vue +3 -2
- package/packages/QuerySqlPreview/src/QuerySqlPreview.vue +1 -43
- package/packages/Subtable/src/SubExportDialog.vue +1 -92
- package/packages/Subtable/src/SubImportDialog.vue +11 -174
- package/packages/Subtable/src/SubPagination.vue +3 -3
- package/packages/TableSearchField/src/main.vue +0 -5
- package/packages/TemplatePreview/src/TemplatePreview.vue +0 -43
- package/src/directive/formulas.js +1 -1
- package/src/mixins/onlineSubtable.js +0 -301
- package/src/mixins/querySqlPreview.js +21 -299
- package/src/mixins/templatePreview.js +42 -518
- package/src/services/SubPagination.js +1 -40
- package/src/utils.js +1 -32
|
@@ -7,12 +7,9 @@ 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'
|
|
11
10
|
export default {
|
|
12
11
|
data() {
|
|
13
12
|
return {
|
|
14
|
-
defaultQuerys: [],
|
|
15
|
-
isInit: true,
|
|
16
13
|
bpmRunTime: this.$requestConfig.flowUrl,
|
|
17
14
|
fileList: [],
|
|
18
15
|
tableData: { selectRows: [], querys: '' },
|
|
@@ -80,8 +77,6 @@ export default {
|
|
|
80
77
|
pageSize: 30,
|
|
81
78
|
total: 0,
|
|
82
79
|
},
|
|
83
|
-
lastPage: 1, //上一次输入的分页数、默认为1
|
|
84
|
-
total: 0,
|
|
85
80
|
rows: [],
|
|
86
81
|
queryParam: {},
|
|
87
82
|
allSummaryConfig: {},
|
|
@@ -89,54 +84,15 @@ export default {
|
|
|
89
84
|
summaryTableData: [],
|
|
90
85
|
needRequestTotal: false, // 需不需要后端统计列表全部数据
|
|
91
86
|
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
|
-
],
|
|
131
87
|
}
|
|
132
88
|
},
|
|
133
89
|
watch: {
|
|
134
|
-
formKey: function(newVal) {
|
|
90
|
+
formKey: function (newVal) {
|
|
135
91
|
if (newVal) {
|
|
136
92
|
this.init()
|
|
137
93
|
}
|
|
138
94
|
},
|
|
139
|
-
'tableData.selectRows': function(newVal) {
|
|
95
|
+
'tableData.selectRows': function (newVal) {
|
|
140
96
|
if (newVal.length > 0) {
|
|
141
97
|
let me_ = this
|
|
142
98
|
me_.uploadParams.id = []
|
|
@@ -204,29 +160,7 @@ export default {
|
|
|
204
160
|
deep: true,
|
|
205
161
|
},
|
|
206
162
|
},
|
|
207
|
-
created() {
|
|
208
|
-
if (this.queryView.jsScript) {
|
|
209
|
-
// 执行js脚本
|
|
210
|
-
this.handleDiyScript(this.queryView.jsScript)
|
|
211
|
-
}
|
|
212
|
-
},
|
|
213
163
|
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
|
-
},
|
|
230
164
|
handelBindFiledValua() {
|
|
231
165
|
//数据视图控件
|
|
232
166
|
let _me = this
|
|
@@ -275,7 +209,7 @@ export default {
|
|
|
275
209
|
selectList[i].selectValue = value
|
|
276
210
|
|
|
277
211
|
//添加监听
|
|
278
|
-
pInst.$watch(path, function(newVal, oldVal) {
|
|
212
|
+
pInst.$watch(path, function (newVal, oldVal) {
|
|
279
213
|
_.debounce(() => {
|
|
280
214
|
if (newVal !== oldVal) {
|
|
281
215
|
_me.queryViewOptions.selectList[i].selectValue = newVal
|
|
@@ -419,7 +353,7 @@ export default {
|
|
|
419
353
|
this.$router.push(url)
|
|
420
354
|
},
|
|
421
355
|
|
|
422
|
-
handleSizeChange: function(size) {
|
|
356
|
+
handleSizeChange: function (size) {
|
|
423
357
|
//每页下拉显示数据
|
|
424
358
|
this.pagination.pageSize = size
|
|
425
359
|
if (this.$refs.queryViewList) {
|
|
@@ -428,9 +362,9 @@ export default {
|
|
|
428
362
|
this.search()
|
|
429
363
|
}
|
|
430
364
|
},
|
|
431
|
-
handleCurrentChange: function(currentPage) {
|
|
365
|
+
handleCurrentChange: function (currentPage) {
|
|
432
366
|
//点击第几页
|
|
433
|
-
this.pagination.page = currentPage
|
|
367
|
+
this.pagination.page = currentPage
|
|
434
368
|
if (this.$refs.queryViewList) {
|
|
435
369
|
this.$refs.queryViewList.load()
|
|
436
370
|
} else {
|
|
@@ -438,112 +372,14 @@ export default {
|
|
|
438
372
|
}
|
|
439
373
|
},
|
|
440
374
|
//回车查询
|
|
441
|
-
searchEnterFun: function(e) {
|
|
375
|
+
searchEnterFun: function (e) {
|
|
442
376
|
let keyCode = window.event ? e.keyCode : e.which
|
|
443
377
|
if (keyCode == 13) {
|
|
444
378
|
this.pagination.page = 1
|
|
445
379
|
this.search()
|
|
446
380
|
}
|
|
447
381
|
},
|
|
448
|
-
|
|
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) {
|
|
382
|
+
search(param, cb, isSearchBtn, needRequestTotal = false) {
|
|
547
383
|
// 不需要请求后端接口统计列表数据
|
|
548
384
|
this.needRequestTotal = needRequestTotal
|
|
549
385
|
!param && (param = {})
|
|
@@ -551,35 +387,6 @@ export default {
|
|
|
551
387
|
const dataTemplateQueryVo = {
|
|
552
388
|
queryFilter: param,
|
|
553
389
|
}
|
|
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
|
-
}
|
|
583
390
|
//保存查询参数,用于作为导出的查询参数
|
|
584
391
|
if (this.queryViewOptions) {
|
|
585
392
|
//关联查询字段
|
|
@@ -612,17 +419,13 @@ export default {
|
|
|
612
419
|
})
|
|
613
420
|
}
|
|
614
421
|
this.$requestConfig
|
|
615
|
-
.
|
|
422
|
+
.getQueryViewDataList(param)
|
|
616
423
|
.then((response) => {
|
|
617
424
|
this.rows = response.rows
|
|
618
|
-
|
|
425
|
+
this.pagination.total = response.total
|
|
619
426
|
this.pagination.page = response.page
|
|
620
427
|
this.pagination.pageSize = response.pageSize
|
|
621
428
|
this.filterOldSummaryValByType('currentPage')
|
|
622
|
-
//每次请求后不再统计总数,而是在统计按钮中去统计,当数量统计过一次后,再重新设置到当前页
|
|
623
|
-
if (this.total) {
|
|
624
|
-
this.$set(this.pagination, 'total', this.total)
|
|
625
|
-
}
|
|
626
429
|
this.summaryTableData.push({
|
|
627
430
|
project: '当前页汇总',
|
|
628
431
|
key: 'currentPage',
|
|
@@ -642,31 +445,12 @@ export default {
|
|
|
642
445
|
cb && cb()
|
|
643
446
|
})
|
|
644
447
|
},
|
|
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
|
-
},
|
|
665
448
|
getQueryFilter() {
|
|
666
449
|
let operationMap = this.getSearchItems() //查询条件类型
|
|
667
450
|
// let fieldQueryMap = this.getFieldQuery() //查询条件字段
|
|
668
451
|
let specialMap = this.getSpecialMap() //获取特殊查询情况(自定义对话框)
|
|
669
452
|
let querys = [] //查询条件
|
|
453
|
+
let queryFilter = {}
|
|
670
454
|
let pageBean = { pageBean: this.pagination }
|
|
671
455
|
let params = {
|
|
672
456
|
sqlAlias: this.sqlAlias || this.queryView.sqlAlias,
|
|
@@ -674,10 +458,6 @@ export default {
|
|
|
674
458
|
}
|
|
675
459
|
params.pagination = pageBean
|
|
676
460
|
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 }
|
|
681
461
|
return params
|
|
682
462
|
} else {
|
|
683
463
|
for (var key in this.searchForm) {
|
|
@@ -742,10 +522,9 @@ export default {
|
|
|
742
522
|
}
|
|
743
523
|
}
|
|
744
524
|
}
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
return { pageBean: this.pagination, querys }
|
|
525
|
+
queryFilter = { pageBean: this.pagination, querys }
|
|
526
|
+
params.pagination = queryFilter
|
|
527
|
+
return params
|
|
749
528
|
}
|
|
750
529
|
},
|
|
751
530
|
//获取查询条件类型
|
|
@@ -999,22 +778,15 @@ export default {
|
|
|
999
778
|
let loadingInstance = Loading.service({ fullscreen: true }) //开始
|
|
1000
779
|
this.$requestConfig
|
|
1001
780
|
.querySqlViewExport(data)
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
// })
|
|
1009
|
-
// .finally(() => {
|
|
1010
|
-
// loadingInstance.close() // 结束
|
|
1011
|
-
// this.dialogExportVisible = false
|
|
1012
|
-
// })
|
|
1013
|
-
.then(() => {
|
|
1014
|
-
this.$message.success('正在导出,请稍后前往报表附件管理查看')
|
|
781
|
+
.then(({ data, headers }) => {
|
|
782
|
+
const fileName = decodeURIComponent(
|
|
783
|
+
headers['content-disposition'].split(';')[1].split('filename=')[1]
|
|
784
|
+
)
|
|
785
|
+
const blob = new Blob([data])
|
|
786
|
+
saveAs(blob, fileName)
|
|
1015
787
|
})
|
|
1016
788
|
.finally(() => {
|
|
1017
|
-
loadingInstance.close()
|
|
789
|
+
loadingInstance.close() // 结束
|
|
1018
790
|
this.dialogExportVisible = false
|
|
1019
791
|
})
|
|
1020
792
|
},
|
|
@@ -1325,55 +1097,5 @@ export default {
|
|
|
1325
1097
|
this.search()
|
|
1326
1098
|
})
|
|
1327
1099
|
},
|
|
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
|
-
},
|
|
1378
1100
|
},
|
|
1379
1101
|
}
|