three-trees-ui 1.0.83 → 1.0.85
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 +17134 -16295
- package/lib/three-trees-ui.css +1 -1
- package/lib/three-trees-ui.umd.js +17134 -16295
- package/lib/three-trees-ui.umd.min.js +1 -1
- package/package.json +1 -1
- package/packages/CustomDialog/src/customDialog.vue +78 -17
- package/packages/DataLists/src/main.vue +2 -3
- package/packages/OrgPostDialog/src/main.vue +1 -1
- package/packages/OrgSelector/src/main.vue +1 -1
- package/packages/QuerySqlPreview/src/QuerySqlPreview.vue +43 -1
- package/packages/Subtable/src/SubPagination.vue +3 -3
- package/packages/Table/src/Table.vue +23 -3
- package/packages/TableSearchField/src/main.vue +5 -0
- package/packages/TemplatePreview/src/TemplatePreview.vue +43 -0
- package/src/mixins/querySqlPreview.js +409 -35
- package/src/mixins/templatePreview.js +577 -69
|
@@ -7,12 +7,18 @@ 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
|
+
bindKey: {},
|
|
15
|
+
bindValue: {},
|
|
16
|
+
defaultQuerys: [],
|
|
17
|
+
isInit: true,
|
|
13
18
|
bpmRunTime: this.$requestConfig.flowUrl,
|
|
14
19
|
fileList: [],
|
|
15
20
|
tableData: { selectRows: [], querys: '' },
|
|
21
|
+
exportBtnDisabled: false,
|
|
16
22
|
dialogExportVisible: false,
|
|
17
23
|
ChangeRecord: {
|
|
18
24
|
ChangeRecordVisible: false,
|
|
@@ -77,6 +83,8 @@ export default {
|
|
|
77
83
|
pageSize: 30,
|
|
78
84
|
total: 0,
|
|
79
85
|
},
|
|
86
|
+
lastPage: 1, //上一次输入的分页数、默认为1
|
|
87
|
+
total: 0,
|
|
80
88
|
rows: [],
|
|
81
89
|
queryParam: {},
|
|
82
90
|
allSummaryConfig: {},
|
|
@@ -84,15 +92,54 @@ export default {
|
|
|
84
92
|
summaryTableData: [],
|
|
85
93
|
needRequestTotal: false, // 需不需要后端统计列表全部数据
|
|
86
94
|
tableDataTotal: {},
|
|
95
|
+
loadingTotal: false, //统计按钮加载中
|
|
96
|
+
pageSizeArray: [
|
|
97
|
+
{
|
|
98
|
+
label: '10条/页',
|
|
99
|
+
value: 10,
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
label: '20条/页',
|
|
103
|
+
value: 20,
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
label: '30条/页',
|
|
107
|
+
value: 30,
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
label: '40条/页',
|
|
111
|
+
value: 40,
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
label: '50条/页',
|
|
115
|
+
value: 50,
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
label: '100条/页',
|
|
119
|
+
value: 100,
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
label: '200条/页',
|
|
123
|
+
value: 200,
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
label: '300条/页',
|
|
127
|
+
value: 300,
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
label: '500条/页',
|
|
131
|
+
value: 500,
|
|
132
|
+
},
|
|
133
|
+
],
|
|
87
134
|
}
|
|
88
135
|
},
|
|
89
136
|
watch: {
|
|
90
|
-
formKey: function
|
|
137
|
+
formKey: function(newVal) {
|
|
91
138
|
if (newVal) {
|
|
92
139
|
this.init()
|
|
93
140
|
}
|
|
94
141
|
},
|
|
95
|
-
'tableData.selectRows': function
|
|
142
|
+
'tableData.selectRows': function(newVal) {
|
|
96
143
|
if (newVal.length > 0) {
|
|
97
144
|
let me_ = this
|
|
98
145
|
me_.uploadParams.id = []
|
|
@@ -160,7 +207,29 @@ export default {
|
|
|
160
207
|
deep: true,
|
|
161
208
|
},
|
|
162
209
|
},
|
|
210
|
+
created() {
|
|
211
|
+
if (this.queryView.jsScript) {
|
|
212
|
+
// 执行js脚本
|
|
213
|
+
this.handleDiyScript(this.queryView.jsScript)
|
|
214
|
+
}
|
|
215
|
+
},
|
|
163
216
|
methods: {
|
|
217
|
+
handleDiyScript(scriptValue) {
|
|
218
|
+
//执行前置脚本内容
|
|
219
|
+
const _this = this
|
|
220
|
+
// 用户信息
|
|
221
|
+
const account = this.$requestConfig.getAccount()
|
|
222
|
+
const userId = this.$requestConfig.getUserId()
|
|
223
|
+
const userName = this.$requestConfig.getUsername()
|
|
224
|
+
const preScript = `const scriptFunction = function(_this, account, userId, userName){
|
|
225
|
+
${scriptValue}
|
|
226
|
+
};`
|
|
227
|
+
try {
|
|
228
|
+
eval(`${preScript}scriptFunction(_this, account, userId, userName);`)
|
|
229
|
+
} catch (err) {
|
|
230
|
+
this.$message.error(`脚本事件执行错误:${err}`)
|
|
231
|
+
}
|
|
232
|
+
},
|
|
164
233
|
handelBindFiledValua() {
|
|
165
234
|
//数据视图控件
|
|
166
235
|
let _me = this
|
|
@@ -209,7 +278,7 @@ export default {
|
|
|
209
278
|
selectList[i].selectValue = value
|
|
210
279
|
|
|
211
280
|
//添加监听
|
|
212
|
-
pInst.$watch(path, function
|
|
281
|
+
pInst.$watch(path, function(newVal, oldVal) {
|
|
213
282
|
_.debounce(() => {
|
|
214
283
|
if (newVal !== oldVal) {
|
|
215
284
|
_me.queryViewOptions.selectList[i].selectValue = newVal
|
|
@@ -353,7 +422,7 @@ export default {
|
|
|
353
422
|
this.$router.push(url)
|
|
354
423
|
},
|
|
355
424
|
|
|
356
|
-
handleSizeChange: function
|
|
425
|
+
handleSizeChange: function(size) {
|
|
357
426
|
//每页下拉显示数据
|
|
358
427
|
this.pagination.pageSize = size
|
|
359
428
|
if (this.$refs.queryViewList) {
|
|
@@ -362,9 +431,9 @@ export default {
|
|
|
362
431
|
this.search()
|
|
363
432
|
}
|
|
364
433
|
},
|
|
365
|
-
handleCurrentChange: function
|
|
434
|
+
handleCurrentChange: function(currentPage) {
|
|
366
435
|
//点击第几页
|
|
367
|
-
this.pagination.page = currentPage
|
|
436
|
+
this.pagination.page = currentPage ? currentPage : this.lastPage
|
|
368
437
|
if (this.$refs.queryViewList) {
|
|
369
438
|
this.$refs.queryViewList.load()
|
|
370
439
|
} else {
|
|
@@ -372,14 +441,126 @@ export default {
|
|
|
372
441
|
}
|
|
373
442
|
},
|
|
374
443
|
//回车查询
|
|
375
|
-
searchEnterFun: function
|
|
444
|
+
searchEnterFun: function(e) {
|
|
376
445
|
let keyCode = window.event ? e.keyCode : e.which
|
|
377
446
|
if (keyCode == 13) {
|
|
378
447
|
this.pagination.page = 1
|
|
379
448
|
this.search()
|
|
380
449
|
}
|
|
381
450
|
},
|
|
382
|
-
|
|
451
|
+
getQueryDataViewOperation(key) {
|
|
452
|
+
switch (key) {
|
|
453
|
+
case 'EQ':
|
|
454
|
+
return 'EQUAL'
|
|
455
|
+
case 'NE':
|
|
456
|
+
return 'NOT_EQUAL'
|
|
457
|
+
case 'LK':
|
|
458
|
+
return 'LIKE'
|
|
459
|
+
case 'LFK':
|
|
460
|
+
return 'LEFT_LIKE'
|
|
461
|
+
case 'RHK':
|
|
462
|
+
return 'RIGHT_LIKE'
|
|
463
|
+
case 'BETWEEN':
|
|
464
|
+
return 'BETWEEN'
|
|
465
|
+
default:
|
|
466
|
+
return 'LIKE'
|
|
467
|
+
}
|
|
468
|
+
},
|
|
469
|
+
async buildDefaultQuerys() {
|
|
470
|
+
let querys = []
|
|
471
|
+
let conditions = JSON.parse(this.queryView.conditions)
|
|
472
|
+
//条件字段默认值判断
|
|
473
|
+
for (let i = 0; i < conditions.length; i++) {
|
|
474
|
+
let condition = conditions[i]
|
|
475
|
+
if (condition.defaultValue) {
|
|
476
|
+
let defaultValue = condition.isScriptDefault
|
|
477
|
+
? await this.getScriptDefaultValue(condition.defaultValue)
|
|
478
|
+
: condition.defaultValue
|
|
479
|
+
if (condition.dataType == 'number') {
|
|
480
|
+
defaultValue = parseFloat(defaultValue)
|
|
481
|
+
}
|
|
482
|
+
this.$set(this.searchForm, condition.fieldName, defaultValue)
|
|
483
|
+
|
|
484
|
+
querys.push({
|
|
485
|
+
property: condition.fieldName,
|
|
486
|
+
value: defaultValue,
|
|
487
|
+
group: 'main',
|
|
488
|
+
operation: this.getQueryDataViewOperation(condition.operate),
|
|
489
|
+
relation: 'AND',
|
|
490
|
+
})
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
this.defaultQuerys = querys
|
|
494
|
+
return querys
|
|
495
|
+
},
|
|
496
|
+
getScriptDefaultValue(scriptValue) {
|
|
497
|
+
return new Promise((resolve) => {
|
|
498
|
+
//执行前置脚本内容
|
|
499
|
+
const _this = this
|
|
500
|
+
// 用户信息
|
|
501
|
+
const account = this.$requestConfig.getAccount()
|
|
502
|
+
const userId = this.$requestConfig.getUserId()
|
|
503
|
+
const userName = this.$requestConfig.getUsername()
|
|
504
|
+
const _moment = moment
|
|
505
|
+
const preScript = `const scriptFunction = function(_this, account, userId, userName, _moment){
|
|
506
|
+
${scriptValue}
|
|
507
|
+
};`
|
|
508
|
+
let result = ''
|
|
509
|
+
try {
|
|
510
|
+
result = eval(
|
|
511
|
+
`${preScript}scriptFunction(_this, account, userId, userName, _moment);`
|
|
512
|
+
)
|
|
513
|
+
if (result && result.then && typeof result.then === 'function') {
|
|
514
|
+
result.then(
|
|
515
|
+
(t) => {
|
|
516
|
+
resolve(t)
|
|
517
|
+
},
|
|
518
|
+
(fail) => {
|
|
519
|
+
//接口返回失败则终止按钮操作,并输出错误信息
|
|
520
|
+
resolve('')
|
|
521
|
+
}
|
|
522
|
+
)
|
|
523
|
+
} else {
|
|
524
|
+
resolve(result)
|
|
525
|
+
}
|
|
526
|
+
} catch (err) {
|
|
527
|
+
resolve('')
|
|
528
|
+
this.$message.error(`查询值默认脚本事件执行错误:${err}`)
|
|
529
|
+
}
|
|
530
|
+
})
|
|
531
|
+
},
|
|
532
|
+
validateSearchRequired(querys = []) {
|
|
533
|
+
let errorMsg = ''
|
|
534
|
+
let conditions = JSON.parse(this.queryView.conditions)
|
|
535
|
+
if (conditions && querys) {
|
|
536
|
+
conditions.forEach((item) => {
|
|
537
|
+
if (item.isRequired) {
|
|
538
|
+
let index = querys.findIndex((k) => {
|
|
539
|
+
return k.property == item.fieldName
|
|
540
|
+
})
|
|
541
|
+
if (index == -1) {
|
|
542
|
+
errorMsg = `字段【${item.fieldDesc}】为必填查询字段,不能为空!`
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
})
|
|
546
|
+
}
|
|
547
|
+
return errorMsg
|
|
548
|
+
},
|
|
549
|
+
checkHaveRequired() {
|
|
550
|
+
let haveRequired = false
|
|
551
|
+
try {
|
|
552
|
+
let conditions = JSON.parse(this.queryView.conditions)
|
|
553
|
+
if (conditions) {
|
|
554
|
+
haveRequired = conditions.some((item) => {
|
|
555
|
+
return item.isRequired
|
|
556
|
+
})
|
|
557
|
+
}
|
|
558
|
+
} catch (e) {
|
|
559
|
+
console.log(e)
|
|
560
|
+
}
|
|
561
|
+
return haveRequired
|
|
562
|
+
},
|
|
563
|
+
async search(param, cb, isSearchBtn, needRequestTotal = false) {
|
|
383
564
|
// 不需要请求后端接口统计列表数据
|
|
384
565
|
this.needRequestTotal = needRequestTotal
|
|
385
566
|
!param && (param = {})
|
|
@@ -387,6 +568,38 @@ export default {
|
|
|
387
568
|
const dataTemplateQueryVo = {
|
|
388
569
|
queryFilter: param,
|
|
389
570
|
}
|
|
571
|
+
//初始化时,把查询字段的默认值加进去
|
|
572
|
+
if (this.isInit) {
|
|
573
|
+
let querys = await this.buildDefaultQuerys()
|
|
574
|
+
dataTemplateQueryVo.queryFilter.querys =
|
|
575
|
+
dataTemplateQueryVo.queryFilter.querys || []
|
|
576
|
+
dataTemplateQueryVo.queryFilter.querys = dataTemplateQueryVo.queryFilter.querys.concat(
|
|
577
|
+
querys
|
|
578
|
+
)
|
|
579
|
+
}
|
|
580
|
+
// 非高级查询时,将默认值带上
|
|
581
|
+
if (!isSearchBtn) {
|
|
582
|
+
dataTemplateQueryVo.queryFilter.querys =
|
|
583
|
+
dataTemplateQueryVo.queryFilter.querys || []
|
|
584
|
+
dataTemplateQueryVo.queryFilter.querys = dataTemplateQueryVo.queryFilter.querys.concat(
|
|
585
|
+
this.defaultQuerys
|
|
586
|
+
)
|
|
587
|
+
}
|
|
588
|
+
// 检查是否有必填字段
|
|
589
|
+
if (this.checkHaveRequired() && this.isInit) {
|
|
590
|
+
this.$refs.queryViewList.showAdvancedSearch = true
|
|
591
|
+
}
|
|
592
|
+
// 查询字段 校验是否必填,如果是必填没数据,需返回提示
|
|
593
|
+
let errorMsg = this.validateSearchRequired(
|
|
594
|
+
dataTemplateQueryVo.queryFilter.querys
|
|
595
|
+
)
|
|
596
|
+
if (errorMsg) {
|
|
597
|
+
!this.isInit && this.$message.warning(errorMsg)
|
|
598
|
+
cb && cb()
|
|
599
|
+
this.isInit = false
|
|
600
|
+
return
|
|
601
|
+
}
|
|
602
|
+
this.isInit = false
|
|
390
603
|
//保存查询参数,用于作为导出的查询参数
|
|
391
604
|
if (this.queryViewOptions) {
|
|
392
605
|
//关联查询字段
|
|
@@ -403,8 +616,34 @@ export default {
|
|
|
403
616
|
alias: this.alias || this.queryView.alias,
|
|
404
617
|
param: dataTemplateQueryVo,
|
|
405
618
|
}
|
|
619
|
+
// 自定义对话框查询参数修改
|
|
620
|
+
if (isSearchBtn) {
|
|
621
|
+
obj.param = this.makeCustomDialogParam(obj.param)
|
|
622
|
+
}
|
|
406
623
|
this.getQuerySqlViewByPagination(obj, cb)
|
|
407
624
|
},
|
|
625
|
+
// 高级查询 自定义对话框查询参数修改
|
|
626
|
+
makeCustomDialogParam(data) {
|
|
627
|
+
//处理绑定字段
|
|
628
|
+
this.bindValue = this.searchForm.bindValue || this.bindValue
|
|
629
|
+
this.bindKey = this.searchForm.bindKey || this.bindKey
|
|
630
|
+
//记录后再删除
|
|
631
|
+
delete this.searchForm.bindValue
|
|
632
|
+
delete this.searchForm.bindKey
|
|
633
|
+
if (data.queryFilter && data.queryFilter.querys) {
|
|
634
|
+
data.queryFilter.querys.forEach((k) => {
|
|
635
|
+
Object.keys(this.bindKey).forEach((key) => {
|
|
636
|
+
if (key === k.property) {
|
|
637
|
+
let valueKey = this.bindKey[key]
|
|
638
|
+
if (this.bindValue[key] && this.bindValue[key][valueKey]) {
|
|
639
|
+
k.value = this.bindValue[key][valueKey]
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
})
|
|
643
|
+
})
|
|
644
|
+
}
|
|
645
|
+
return data
|
|
646
|
+
},
|
|
408
647
|
getQuerySqlViewByPagination(param, cb) {
|
|
409
648
|
if (this.needRequestTotal) {
|
|
410
649
|
// 调用后端接口更新 tableDataTotal
|
|
@@ -419,13 +658,17 @@ export default {
|
|
|
419
658
|
})
|
|
420
659
|
}
|
|
421
660
|
this.$requestConfig
|
|
422
|
-
.
|
|
661
|
+
.getQueryViewDataListWithoutTotal(param)
|
|
423
662
|
.then((response) => {
|
|
424
663
|
this.rows = response.rows
|
|
425
|
-
this.pagination.total = response.total
|
|
664
|
+
// this.pagination.total = response.total
|
|
426
665
|
this.pagination.page = response.page
|
|
427
666
|
this.pagination.pageSize = response.pageSize
|
|
428
667
|
this.filterOldSummaryValByType('currentPage')
|
|
668
|
+
//每次请求后不再统计总数,而是在统计按钮中去统计,当数量统计过一次后,再重新设置到当前页
|
|
669
|
+
if (this.total) {
|
|
670
|
+
this.$set(this.pagination, 'total', this.total)
|
|
671
|
+
}
|
|
429
672
|
this.summaryTableData.push({
|
|
430
673
|
project: '当前页汇总',
|
|
431
674
|
key: 'currentPage',
|
|
@@ -445,12 +688,31 @@ export default {
|
|
|
445
688
|
cb && cb()
|
|
446
689
|
})
|
|
447
690
|
},
|
|
691
|
+
getQuerySqlViewByPaginationTotal(param, cb) {
|
|
692
|
+
this.loadingTotal = true
|
|
693
|
+
this.$requestConfig
|
|
694
|
+
.getQueryViewDataListWithTotal(param)
|
|
695
|
+
.then((response) => {
|
|
696
|
+
this.total = response.value
|
|
697
|
+
//每次请求后不再统计总数,而是在统计按钮中去统计,当数量统计过一次后,再重新设置到当前页
|
|
698
|
+
if (this.total) {
|
|
699
|
+
this.$set(this.pagination, 'total', this.total)
|
|
700
|
+
}
|
|
701
|
+
this.loadingTotal = false
|
|
702
|
+
this.$nextTick(() => {
|
|
703
|
+
this.$refs.queryViewList && this.$refs.queryViewList.doLayout()
|
|
704
|
+
})
|
|
705
|
+
})
|
|
706
|
+
.finally(() => {
|
|
707
|
+
this.loadingTotal = false
|
|
708
|
+
cb && cb()
|
|
709
|
+
})
|
|
710
|
+
},
|
|
448
711
|
getQueryFilter() {
|
|
449
712
|
let operationMap = this.getSearchItems() //查询条件类型
|
|
450
713
|
// let fieldQueryMap = this.getFieldQuery() //查询条件字段
|
|
451
714
|
let specialMap = this.getSpecialMap() //获取特殊查询情况(自定义对话框)
|
|
452
715
|
let querys = [] //查询条件
|
|
453
|
-
let queryFilter = {}
|
|
454
716
|
let pageBean = { pageBean: this.pagination }
|
|
455
717
|
let params = {
|
|
456
718
|
sqlAlias: this.sqlAlias || this.queryView.sqlAlias,
|
|
@@ -458,8 +720,18 @@ export default {
|
|
|
458
720
|
}
|
|
459
721
|
params.pagination = pageBean
|
|
460
722
|
if ($.isEmptyObject(this.searchForm)) {
|
|
723
|
+
if (this.$refs.queryViewList && this.$refs.queryViewList.querys) {
|
|
724
|
+
querys.push(...this.$refs.queryViewList.querys)
|
|
725
|
+
}
|
|
726
|
+
params = { pageBean: this.pagination, querys }
|
|
461
727
|
return params
|
|
462
728
|
} else {
|
|
729
|
+
//处理绑定字段
|
|
730
|
+
this.bindValue = this.searchForm.bindValue || this.bindValue
|
|
731
|
+
this.bindKey = this.searchForm.bindKey || this.bindKey
|
|
732
|
+
//记录后再删除
|
|
733
|
+
delete this.searchForm.bindValue
|
|
734
|
+
delete this.searchForm.bindKey
|
|
463
735
|
for (var key in this.searchForm) {
|
|
464
736
|
if (
|
|
465
737
|
typeof this.searchForm[key] != 'undefined' &&
|
|
@@ -490,7 +762,12 @@ export default {
|
|
|
490
762
|
})
|
|
491
763
|
}
|
|
492
764
|
}
|
|
493
|
-
} else if (
|
|
765
|
+
} else if (
|
|
766
|
+
this.searchForm[key] &&
|
|
767
|
+
typeof this.searchForm[key] === 'string' &&
|
|
768
|
+
this.searchForm[key].includes(',') &&
|
|
769
|
+
!specialMap[key]
|
|
770
|
+
) {
|
|
494
771
|
let arr = this.searchForm[key].split(',')
|
|
495
772
|
for (let i = 0; i < arr.length; i++) {
|
|
496
773
|
if (
|
|
@@ -512,9 +789,20 @@ export default {
|
|
|
512
789
|
})
|
|
513
790
|
})
|
|
514
791
|
} else {
|
|
792
|
+
let value = this.searchForm[key]
|
|
793
|
+
//在表单列表的查询字段中添加的对话框控件 此处逻辑对应 packages/CustomDialog/src/customDialog.vue:1920行
|
|
794
|
+
if (
|
|
795
|
+
this.bindValue &&
|
|
796
|
+
Object.keys(this.bindValue).length &&
|
|
797
|
+
this.bindValue[key] &&
|
|
798
|
+
Object.keys(this.bindKey).length
|
|
799
|
+
) {
|
|
800
|
+
//获得绑定字段的值
|
|
801
|
+
value = this.bindValue[key][this.bindKey[key]]
|
|
802
|
+
}
|
|
515
803
|
querys.push({
|
|
516
804
|
property: key,
|
|
517
|
-
value:
|
|
805
|
+
value: value,
|
|
518
806
|
group: 'main',
|
|
519
807
|
operation: operationMap[key],
|
|
520
808
|
relation: 'AND',
|
|
@@ -522,9 +810,10 @@ export default {
|
|
|
522
810
|
}
|
|
523
811
|
}
|
|
524
812
|
}
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
813
|
+
if (this.$refs.queryViewList && this.$refs.queryViewList.querys) {
|
|
814
|
+
querys.push(...this.$refs.queryViewList.querys)
|
|
815
|
+
}
|
|
816
|
+
return { pageBean: this.pagination, querys }
|
|
528
817
|
}
|
|
529
818
|
},
|
|
530
819
|
//获取查询条件类型
|
|
@@ -554,11 +843,19 @@ export default {
|
|
|
554
843
|
? operationType[operation]
|
|
555
844
|
: operation
|
|
556
845
|
} else if (
|
|
557
|
-
typeof $(searchItems[i])
|
|
846
|
+
typeof $(searchItems[i])
|
|
847
|
+
.children()
|
|
848
|
+
.attr('ht-query') != 'undefined'
|
|
558
849
|
) {
|
|
559
850
|
//查询条件类型
|
|
560
|
-
operation = $(searchItems[i])
|
|
561
|
-
|
|
851
|
+
operation = $(searchItems[i])
|
|
852
|
+
.children()
|
|
853
|
+
.attr('operation')
|
|
854
|
+
operationMap[
|
|
855
|
+
$(searchItems[i])
|
|
856
|
+
.children()
|
|
857
|
+
.attr('ht-query')
|
|
858
|
+
] =
|
|
562
859
|
typeof operationType[operation] != 'undefined'
|
|
563
860
|
? operationType[operation]
|
|
564
861
|
: operation
|
|
@@ -580,12 +877,16 @@ export default {
|
|
|
580
877
|
searchItems[i]
|
|
581
878
|
).attr('field-query')
|
|
582
879
|
} else if (
|
|
583
|
-
typeof $(searchItems[i])
|
|
880
|
+
typeof $(searchItems[i])
|
|
881
|
+
.children()
|
|
882
|
+
.attr('ht-query') != 'undefined'
|
|
584
883
|
) {
|
|
585
884
|
//查询条件字段
|
|
586
|
-
fieldQueryMap[
|
|
587
|
-
searchItems[i]
|
|
588
|
-
|
|
885
|
+
fieldQueryMap[
|
|
886
|
+
$(searchItems[i])
|
|
887
|
+
.children()
|
|
888
|
+
.attr('ht-query')
|
|
889
|
+
] = $(searchItems[i])
|
|
589
890
|
.children()
|
|
590
891
|
.attr('field-query')
|
|
591
892
|
}
|
|
@@ -607,12 +908,19 @@ export default {
|
|
|
607
908
|
? true
|
|
608
909
|
: false
|
|
609
910
|
} else if (
|
|
610
|
-
typeof $(searchItems[i])
|
|
911
|
+
typeof $(searchItems[i])
|
|
912
|
+
.children()
|
|
913
|
+
.attr('ht-query') != 'undefined'
|
|
611
914
|
) {
|
|
612
915
|
//查询条件字段
|
|
613
|
-
fieldQueryMap[
|
|
614
|
-
|
|
615
|
-
|
|
916
|
+
fieldQueryMap[
|
|
917
|
+
$(searchItems[i])
|
|
918
|
+
.children()
|
|
919
|
+
.attr('ht-query')
|
|
920
|
+
] =
|
|
921
|
+
typeof $(searchItems[i])
|
|
922
|
+
.children()
|
|
923
|
+
.attr('special-query') != 'undefined'
|
|
616
924
|
? true
|
|
617
925
|
: false
|
|
618
926
|
}
|
|
@@ -766,6 +1074,14 @@ export default {
|
|
|
766
1074
|
dataTemplateQueryVo.selectList = this.queryViewOptions.selectList
|
|
767
1075
|
}
|
|
768
1076
|
}
|
|
1077
|
+
// 查询字段 校验是否必填,如果是必填没数据,需返回提示
|
|
1078
|
+
let errorMsg = this.validateSearchRequired(
|
|
1079
|
+
dataTemplateQueryVo.queryFilter.querys
|
|
1080
|
+
)
|
|
1081
|
+
if (errorMsg) {
|
|
1082
|
+
this.$message.warning(errorMsg)
|
|
1083
|
+
return
|
|
1084
|
+
}
|
|
769
1085
|
|
|
770
1086
|
let data = {
|
|
771
1087
|
sqlAlias: this.sqlAlias || this.queryView.sqlAlias,
|
|
@@ -774,19 +1090,26 @@ export default {
|
|
|
774
1090
|
expField: expField,
|
|
775
1091
|
query: dataTemplateQueryVo,
|
|
776
1092
|
}
|
|
777
|
-
|
|
1093
|
+
this.exportBtnDisabled = true
|
|
778
1094
|
let loadingInstance = Loading.service({ fullscreen: true }) //开始
|
|
779
1095
|
this.$requestConfig
|
|
780
1096
|
.querySqlViewExport(data)
|
|
781
|
-
.then(({ data, headers }) => {
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
1097
|
+
// .then(({ data, headers }) => {
|
|
1098
|
+
// const fileName = decodeURIComponent(
|
|
1099
|
+
// headers['content-disposition'].split(';')[1].split('filename=')[1]
|
|
1100
|
+
// )
|
|
1101
|
+
// const blob = new Blob([data])
|
|
1102
|
+
// saveAs(blob, fileName)
|
|
1103
|
+
// })
|
|
1104
|
+
// .finally(() => {
|
|
1105
|
+
// loadingInstance.close() // 结束
|
|
1106
|
+
// this.dialogExportVisible = false
|
|
1107
|
+
// })
|
|
1108
|
+
.then(() => {
|
|
1109
|
+
this.$message.success('正在导出,请稍后前往报表附件管理查看')
|
|
787
1110
|
})
|
|
788
1111
|
.finally(() => {
|
|
789
|
-
loadingInstance.close()
|
|
1112
|
+
loadingInstance.close()
|
|
790
1113
|
this.dialogExportVisible = false
|
|
791
1114
|
})
|
|
792
1115
|
},
|
|
@@ -1097,5 +1420,56 @@ export default {
|
|
|
1097
1420
|
this.search()
|
|
1098
1421
|
})
|
|
1099
1422
|
},
|
|
1423
|
+
countPageTotal() {
|
|
1424
|
+
this.searchCountTotal(this.getQueryFilter())
|
|
1425
|
+
},
|
|
1426
|
+
searchCountTotal(param, cb, isSearchBtn, needRequestTotal = false) {
|
|
1427
|
+
// 不需要请求后端接口统计列表数据
|
|
1428
|
+
this.needRequestTotal = needRequestTotal
|
|
1429
|
+
!param && (param = {})
|
|
1430
|
+
param.pageBean = this.pagination
|
|
1431
|
+
const dataTemplateQueryVo = {
|
|
1432
|
+
queryFilter: param,
|
|
1433
|
+
}
|
|
1434
|
+
//保存查询参数,用于作为导出的查询参数
|
|
1435
|
+
if (this.queryViewOptions) {
|
|
1436
|
+
//关联查询字段
|
|
1437
|
+
if (
|
|
1438
|
+
this.queryViewOptions.selectList &&
|
|
1439
|
+
this.queryViewOptions.selectList.length > 0
|
|
1440
|
+
) {
|
|
1441
|
+
dataTemplateQueryVo.selectList = this.queryViewOptions.selectList
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
this.queryParam = { ...param }
|
|
1445
|
+
let obj = {
|
|
1446
|
+
sqlAlias: this.sqlAlias || this.queryView.sqlAlias,
|
|
1447
|
+
alias: this.alias || this.queryView.alias,
|
|
1448
|
+
param: dataTemplateQueryVo,
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
this.getQuerySqlViewByPaginationTotal(obj, cb)
|
|
1452
|
+
},
|
|
1453
|
+
switchPage(type) {
|
|
1454
|
+
if (type == 'prev') this.pagination.page--
|
|
1455
|
+
if (type == 'next') this.pagination.page++
|
|
1456
|
+
this.handleCurrentChange(this.pagination.page)
|
|
1457
|
+
},
|
|
1458
|
+
handleInput(value) {
|
|
1459
|
+
if (!value) {
|
|
1460
|
+
return
|
|
1461
|
+
}
|
|
1462
|
+
// 使用正则表达式匹配正整数
|
|
1463
|
+
const regex = /^[1-9]\d*$/
|
|
1464
|
+
|
|
1465
|
+
// 如果输入的值不符合正整数的模式,则将其重置为1
|
|
1466
|
+
if (!regex.test(value)) {
|
|
1467
|
+
//如果上一次输入的页数有值,则用上一次输入的页数,否则默认为1
|
|
1468
|
+
this.pagination.page = this.lastPage ? this.lastPage : 1
|
|
1469
|
+
} else {
|
|
1470
|
+
//本次分页数,赋值给上一次分页数
|
|
1471
|
+
this.lastPage = this.pagination.page
|
|
1472
|
+
}
|
|
1473
|
+
},
|
|
1100
1474
|
},
|
|
1101
1475
|
}
|