CustomDialogShowDetail.vue
28.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
<template>
<el-container class="dialog-el-container">
<el-aside
v-if="customDialog.style == 2"
style="width: 23%"
v-show="treeShow"
class="tree-aside"
>
<el-card>
<div slot="header" class="clearfix">
<span style="font-size: 16px">{{ leftTreeTitle }}</span>
</div>
<el-tree
ref="combinationTree"
:data="combinationTreeData"
:props="defaultProps"
:node-key="nodeKey"
highlight-current
@node-click="combiTreeClick"
:check-on-click-node="true"
lazy
:load="loadTree"
></el-tree>
</el-card>
</el-aside>
<el-main :class="{'combination-dialog_main': customDialog.style == 2}">
<ht-table
@load="loadData"
:data="tableData"
:pageResult="pageResult"
:selectable="selectable"
:nopagination="nopagination"
:show-export="false"
@row-click="orgRowClick"
:show-custom-column="false"
ref="htTable"
:pagerCount="5"
paginationJustify="end"
>
<template
v-slot:search
v-if="customDialog.conditionfield.length > 0 && isShowSearch"
>
<ht-table-search-panel
:divide="customDialog.style == 2 ? 2 : 3"
:isFlexLayout="false"
:label-width="100"
@submit.native.prevent
>
<ht-table-search-field
v-for="(item, $index) in customDialog.conditionfield.filter(
d => d.defaultType == '1'
)"
:type="item.type"
:key="$index"
:label="item.comment"
:value-format="item.type == 'date' ? 'yyyy-MM-dd HH:mm:ss' : ''"
:prop="item.field"
:config="item.config"
:operation="getOperation(item.condition)"
/>
</ht-table-search-panel>
</template>
<template>
<ht-table-column align="center" v-if="!selectable" width="40">
<template v-slot="{row, index}">
<el-radio
v-model="textRadio"
:label="row[customDialog.displayfield[0].field] + index"
/>
</template>
</ht-table-column>
<ht-table-column
type="index"
width="50"
align="center"
label="序号"
/>
<ht-table-column
v-for="(item, $index) in customDialog.displayfield"
:key="$index"
:prop="item.field"
:label="item.comment"
:width="item.width"
:sortable="true"
:show-overflow-tooltip="true"
></ht-table-column>
</template>
</ht-table>
</el-main>
</el-container>
</template>
<script>
import req from '@/request.js'
import hotentUiUtils from '@/hotent-ui-util.js'
export default {
name: 'custom-dialog-show-detail',
props: {
//自定义对话框的别名
alias: {
type: String,
required: true
},
//自定义对话框的配置
customDialog: {
type: Object,
required: true
}
},
mounted() {
const displayfield = JSON.stringify(
this.customDialog.displayfield
).toLowerCase()
this.customDialog.displayfield = JSON.parse(displayfield)
this.afterOpen()
},
data() {
return {
customDialogPostParam: [], //为REST接口且请求类型是POST,条件字段是固定值的参数
customDialogGetUrl: '', //为REST接口且请求类型是GET,条件字段是固定值的请求地址
selectionRadio: [], //ht-table列表单选选择的数据
textRadio: '', //ht-table列表数据的单选按钮
selectable: true, //表示ht-table列表第一列是否显示复选框
isShowSearch: false, //是否显示高级搜索
nopagination: false, //是否隐藏分页组件,false:显示,true:隐藏
tableData: [], //ht-table列表数据
pageResult: {
page: 1,
pageSize: 20,
total: 0
},
combinationTreeData: [],
treeShow: true,
leftTreeTitle: '',
defaultProps: {
childen: 'children',
label: 'label'
},
nodeKey: 'ID_',
treeList: [],
combinationTreeQuerys: [],
combineQueryLength: 0,
queryParam: {}
}
},
created() {
this.initData()
},
methods: {
//显示对话框
initData() {
this.customDialogPostParam = [] //清空为REST接口且请求类型是POST,条件字段是固定值的参数
this.customDialogGetUrl = '' //清空为REST接口且请求类型是GET,条件字段是固定值的请求地址
this.selectionRadio = [] //清空ht-table列表单选选择的数据
this.textRadio = '' //清空ht-table列表数据单选按钮的选中状态
this.isShowSearch = false //不显示高级搜索
//是否单选 1:单选;-1:多选
if (this.customDialog.selectNum == 1) {
this.selectable = false
} else {
this.selectable = true
}
//是否显示分页组件,true:显示,false:隐藏
if (this.customDialog.needPage) {
this.nopagination = false
let obj = {}
const {page, pageSize, total} = this.pageResult
this.getLastKeyByPath(obj, this.customDialog.pageKey, page)
this.getLastKeyByPath(obj, this.customDialog.pageSizeKey, pageSize)
this.getLastKeyByPath(obj, this.customDialog.totalKey, total)
const exp = hotentUiUtils.parseExp(
this.customDialog.dataParam,
obj,
true
)
if (exp) {
const params = JSON.parse(exp)
if (params.pageBean) {
this.pageResult = {
...params.pageBean
}
}
}
} else {
this.nopagination = true
}
//判断是否有条件查询,且数据来源是数据源或者数据来源是REST接口且请求类型是POST
if (
this.customDialog.conditionfield.length > 0 &&
(this.customDialog.dsType == 'dataSource' ||
(this.customDialog.dsType != 'dataSource' &&
this.customDialog.requestType == 'POST'))
) {
for (let i = this.customDialog.conditionfield.length - 1; i >= 0; i--) {
//判断条件字段是否是参数传入并控制器的类型为单行文本框 (controllerType有值就代表控制器的类型为单行文本框,defaultType:1:参数传入,2:固定值 )
if (
this.customDialog.conditionfield[i].controllerType &&
this.customDialog.conditionfield[i].defaultType == '1'
) {
this.isShowSearch = true //显示高级搜索
//如果条件字段为data类型,则控制器的类型为日期类型
if (this.customDialog.conditionfield[i].dbType == 'date') {
this.customDialog.conditionfield[i].type = 'date'
} else if (
this.customDialog.conditionfield[i].dbType == 'number' &&
this.customDialog.conditionfield[i].controllerType == '3'
) {
this.customDialog.conditionfield[i].type = 'number'
} else {
this.customDialog.conditionfield[i].type = 'text'
}
} else {
if (
this.customDialog.dsType != 'dataSource' &&
this.customDialog.requestType == 'POST'
) {
this.customDialogPostParam.push(
this.customDialog.conditionfield[i]
) //为REST接口且请求类型是POST,条件字段是固定值的参数
}
//如果是条件字段固定值就清除
/* this.customDialog.conditionfield.splice(i, 1) */
}
}
}
//判断是否有条件查询,且数据来源是REST接口且请求类型是GET
if (
this.customDialog.conditionfield.length > 0 &&
this.customDialog.dsType != 'dataSource' &&
this.customDialog.requestType == 'GET'
) {
for (let i = this.customDialog.conditionfield.length - 1; i >= 0; i--) {
//判断条件字段是否是固定值(defaultType:1:参数传入,2:固定值 )
if (this.customDialog.conditionfield[i].defaultType == '2') {
//判断请求地址是否带有 ?
if (this.customDialog.url.indexOf('?') == -1) {
//无
this.customDialog.url =
this.customDialog.url +
'?' +
this.customDialog.conditionfield[i].field +
'=' +
this.customDialog.conditionfield[i].defaultValue
} else {
//有
this.customDialog.url =
this.customDialog.url +
'&' +
this.customDialog.conditionfield[i].field +
'=' +
this.customDialog.conditionfield[i].defaultValue
}
//如果是条件字段固定值就清除
/* this.customDialog.conditionfield.splice(i, 1) */
this.customDialogGetUrl = this.customDialog.url
//判断条件字段是否是参数传入并控制器的类型为单行文本框(controllerType有值就代表控制器的类型为单行文本框,defaultType:1:参数传入,2:固定值 )
} else if (
this.customDialog.conditionfield[i].controllerType &&
this.customDialog.conditionfield[i].defaultType == '1'
) {
this.isShowSearch = true //显示高级搜索
}
}
}
},
//加载数据
async loadData(param, cb) {
//构建入参的pageBean
let obj = {}
//当前分页信息上下文
let _pageBeanCtx = {}
this.getLastKeyByPath(obj, this.customDialog.pageKey, param.pageBean.page)
this.getLastKeyByPath(
obj,
this.customDialog.pageSizeKey,
param.pageBean.pageSize
)
this.getLastKeyByPath(
obj,
this.customDialog.totalKey,
param.pageBean.total
)
if (param && param.pageBean) {
param.pageBean = obj
_pageBeanCtx = {...obj}
}
this.queryParam = param
//判断是否有来自组合对话框树型部分的查询参数
if (this.combinationTreeQuerys && this.combinationTreeQuerys.length > 0) {
if (!param.querys) {
param.querys = []
}
let searchParamLength = 0
for (var i = 0; i < param.querys.length; i++) {
if (param.querys[i].group && param.querys[i].group == 'treeGroup') {
searchParamLength = i
break
}
}
param.querys.slice(0, searchParamLength)
for (let i = 0; i < this.combinationTreeQuerys.length; i++) {
param.querys.push(this.combinationTreeQuerys[i])
}
}
// post restful接口,并且配置了post参数。则以post参数作为请求参数
if (
this.customDialog.dsType != 'dataSource' &&
this.customDialog.requestType == 'POST' &&
this.customDialog.dataParam &&
this.customDialog.dataParam.constructor == String
) {
let queryParams = []
try {
const conditionFields = this.customDialog.conditionfield
// 构建查询参数
if (
conditionFields &&
conditionFields.constructor == Array &&
conditionFields.length > 0
) {
conditionFields.forEach(c => {
// 默认按照固定值构建查询参数
if (c.defaultType == '1') {
let queryArr = []
param &&
param.querys &&
param.querys.forEach(element => {
let newobj = {
key: element.property,
value: element.value
}
queryArr.push(newobj)
})
queryParams = [...queryArr]
} else {
let obj = {
key: c.field,
value: c.defaultValue
}
queryParams.push(obj)
}
console.log(queryParams)
})
}
} catch (e) {
this.$message.error(`条件字段的JSON格式错误${e}`)
}
param = this._handlePostData(
this.customDialog,
queryParams,
_pageBeanCtx
)
let pageBean = {}
if (param && param.pageBean) {
pageBean = param.pageBean
}
param.pageBean = pageBean
}
let tempUrl = ''
//判断是否有条件查询,且数据来源是REST接口且请求类型是GET,并且判断参数传入是否填写了查询条件
if (
this.customDialog.conditionfield.length > 0 &&
this.customDialog.dsType != 'dataSource' &&
this.customDialog.requestType == 'GET'
) {
let tempQuery = {}
if(param.querys &¶m.querys.length > 0){
param.querys.forEach(query =>{
this.$set(tempQuery,query.property,query)
})
}
if(tempUrl == ''){
tempUrl = this.customDialog.url
}
//判断为REST接口且请求类型是GET,条件字段是固定值的请求地址是否为空
if(this.customDialogGetUrl != ''){
tempUrl = this.customDialogGetUrl //赋值为REST接口且请求类型是GET,条件字段是固定值的请求地址
}
for (let i = this.customDialog.conditionfield.length - 1; i >= 0; i--) {
//判断条件字段是否是参数传入并控制器的类型为单行文本框(controllerType有值就代表控制器的类型为单行文本框,defaultType:1:参数传入,2:固定值 )
if (
this.customDialog.conditionfield[i].controllerType &&
this.customDialog.conditionfield[i].defaultType == '1'
) {
//参数传入填写了查询条件
let field = this.customDialog.conditionfield[i].field
if(tempQuery && tempQuery[field]){
//判断请求地址是否带有 ?
let char = tempUrl.indexOf('?') == -1 ? '?' : '&'
tempUrl =tempUrl + char + tempQuery[field].property + '=' + tempQuery[field].value
}else{
let char = tempUrl.indexOf('?') == -1 ? '?' : '&'
tempUrl = tempUrl + char + this.customDialog.conditionfield[i].field + '='
}
}
}
} else {
//判断为REST接口且请求类型是GET,条件字段是固定值的请求地址是否为空
if (this.customDialogGetUrl != '') {
this.customDialog.url = this.customDialogGetUrl //赋值为REST接口且请求类型是GET,条件字段是固定值的请求地址
}
}
let queryUrl = tempUrl != '' ? tempUrl : this.customDialog.url
//如果自定义对话框列表查询数据不是数据源则请求方法为restful配置的请求方式
let requestMethod = this.customDialog.requestType
if (this.customDialog.dsType == 'selectedApi') {
queryUrl =
'${portal}/portal/portalInterfaceManager/v1/doQuery?alias=' +
this.customDialog.apiAlias
requestMethod = 'GET'
} else if (this.customDialog.dsType == 'dataSource') {
queryUrl =
'${form}/form/customDialog/v1/getListData?alias=' +
this.alias +
'&mapParam='
requestMethod = 'POST'
}
//非分页模式查询所有
if (this.nopagination) {
param.pageBean.page = 1
param.pageBean.pageSize = -1
}
//查询数据
let response = await req
.request({
url: queryUrl,
method: requestMethod,
data: param
})
.finally(() => cb && cb())
if (this.customDialog.dsType == 'selectedApi' && response.data) {
//字段名转小写
let rows =
response.data.constructor == Array ? response.data : [response.data]
let newRows = []
if (rows && rows.length > 0) {
for (let i = 0; i < rows.length; i++) {
let data = rows[i]
let keys = Object.keys(data)
let objRows = {}
keys.forEach(key => {
objRows[key.toLowerCase()] = data[key]
})
newRows.push(objRows)
}
}
if (newRows.length > 0) {
this.tableData = newRows
} else {
this.tableData = rows
}
return
}
//如果数据来源是REST接口,且请求类型是GET
if (
this.customDialog.dsType != 'dataSource' &&
this.customDialog.requestType == 'GET'
) {
this.tableData = response.data
this.nopagination = true //隐藏分页组件
}
//如果数据来源是REST接口且请求类型是POST 或者 是选择接口
if (
(this.customDialog.dsType != 'dataSource' &&
this.customDialog.requestType == 'POST') ||
this.customDialog.dsType == 'selectedApi'
) {
let rows = hotentUiUtils.getValueByPath(
response.data,
this.customDialog.listKey
)
let newRows = []
if (rows && rows.length > 0) {
for (let i = 0; i < rows.length; i++) {
let data = rows[i]
let keys = Object.keys(data)
let objRows = {}
keys.forEach(key => {
objRows[key.toLowerCase()] = data[key]
})
newRows.push(objRows)
}
}
if (newRows.length > 0) {
this.tableData = newRows
} else {
this.tableData = rows
}
//如果有分页
if (
hotentUiUtils.getValueByPath(
response.data,
this.customDialog.pageKey
) &&
this.customDialog.needPage
) {
this.pageResult = {
page: hotentUiUtils.getValueByPath(
response.data,
this.customDialog.pageKey
),
pageSize: hotentUiUtils.getValueByPath(
response.data,
this.customDialog.pageSizeKey
),
total: hotentUiUtils.getValueByPath(
response.data,
this.customDialog.totalKey
)
}
this.nopagination = false //显示分页组件
} else {
this.nopagination = true //隐藏分页组件
}
}
//如果数据来源是数据源
if (this.customDialog.dsType == 'dataSource') {
if (response.data && response.data.rows) {
this.tableData = response.data.rows
//如果有分页
if (response.data.page) {
this.pageResult = {
page: response.data.page,
pageSize: response.data.pageSize,
total: response.data.total
}
if (this.customDialog.needPage) {
this.nopagination = false //显示分页组件
} else {
this.nopagination = true //隐藏分页组件
}
} else {
this.nopagination = true //隐藏分页组件
}
} else {
this.tableData = []
this.nopagination = true //隐藏分页组件
}
}
},
getLastKeyByPath(obj, path, value) {
if (!obj || !path || path.constructor != String) {
return
}
if (!/^\w?.*[\w|\]]$/.test(path)) {
return
}
let pathAry = path.split('.')
if (pathAry.length == 1) {
obj[path] = value
} else {
let length = pathAry.length
obj[pathAry[length - 1]] = value
}
},
//点击列表某一条数据时触发
orgRowClick(row, column, event) {
//是否单选 1:单选;-1:多选
if (this.customDialog.selectNum === 1) {
//选中单选按钮
this.textRadio =
event.currentTarget.children[0].children[0].children[0].__vue__.$refs.radio.value
this.selectionRadio = [row]
this.$emit('orgRowClick', row)
} else {
//点击列表数据选中复选框
this.$refs.htTable.$refs.htTable.toggleRowSelection(row)
}
},
afterOpen() {
//打开对话框之后加载树
this.loadCombinationTree()
},
loadCombinationTree() {
if (this.customDialog.style != 2) {
return
}
let combinationRule = JSON.parse(this.customDialog.combinationRule)
this.combinationRule = combinationRule
let treeAlias = combinationRule.leftTree
//获取对话框数据
req
.get('${form}/form/customDialog/v1/getByAlias?alias=' + treeAlias)
.then(resp => {
console.log(resp.data, 'res.data')
let treeDialog = resp.data
this.leftTreeTitle = treeDialog.name
let reqParam = {}
let url = treeDialog.url
//如果自定义对话框列表查询数据不是数据源则请求方法为restful配置的请求方式
let requestType = treeDialog.requestType
? treeDialog.requestType
: 'POST'
if (treeDialog.dsType == 'selectedApi') {
url =
'${portal}/portal/portalInterfaceManager/v1/doQuery?alias=' +
treeDialog.apiAlias
requestType = 'GET'
} else if (treeDialog.dsType == 'dataSource') {
url =
'${form}/form/customDialog/v1/getTreeData?alias=' +
treeAlias +
'&mapParam='
requestType = 'GET'
}
let paramsObj = {}
if (treeDialog.dsType != 'dataSource') {
let templatePa = treeDialog.dataParam
if (treeDialog.conditionfield) {
let conditions = JSON.parse(treeDialog.conditionfield)
for (let i = 0; i < conditions.length; i++) {
let con = conditions[i]
if (requestType == 'POST') {
if (templatePa) {
templatePa = templatePa.replace(
new RegExp('\\{' + con.field + '\\}', 'g'),
con.defaultValue
)
} else {
paramsObj[con.field] = con.defaultValue
}
} else {
let ljChar = url.indexOf('?') == -1 ? '?' : '&'
url = url + ljChar + con.field + '=' + con.defaultValue
}
}
if (templatePa) {
paramsObj = JSON.parse(templatePa)
}
}
}
let requestParams = {}
requestParams.requestType = requestType
requestParams.url = url
requestParams.paramsObj = paramsObj
let query =
requestParams.requestType == 'POST'
? req.post(requestParams.url, requestParams.paramsObj)
: req.get(requestParams.url)
query.then(resp => {
resp = resp.data
if (treeDialog.displayfield && treeDialog.resultfield) {
let displayField = JSON.parse(treeDialog.displayfield)
let resultfield = JSON.parse(treeDialog.resultfield)
this.defaultProps.label = displayField.displayName
this.treeList = resp
this.combiTreeDisplayField = displayField
this.combinationTreeData = this.toTreeData(
resp,
displayField.id,
displayField.pid,
displayField.displayName,
displayField.pvalue ? displayField.pvalue : '0',
resultfield
)
}
})
})
},
combiTreeClick(paramObj, node, nodeComponent) {
//组合对话框点击左树
//清空旧的
this.combineQueryLength = this.combinationTreeQuerys.length
this.combinationTreeQuerys.splice(0)
let combinationRule = JSON.parse(this.customDialog.combinationRule)
if (!combinationRule.rules || combinationRule.rules.length === 0) {
return
}
let rules = combinationRule.rules
for (let i = 0; i < rules.length; i++) {
let value = paramObj[rules[i].treeField]
let property = rules[i].listField
this.combinationTreeQuerys.push({
property: property,
value: value,
group: 'treeGroup',
operation: this.getOperation(rules[i].condition),
relation: 'AND'
})
}
//this.search();
this.loadData(this.queryParam)
},
//获取运算符号
getOperation(old) {
if (!old) {
return ''
} else if (old == 'EQ') {
return 'EQUAL'
} else if (old == 'EIC') {
return 'EQUAL_IGNORE_CASE'
} else if (old == 'LT') {
return 'LESS'
} else if (old == 'GT') {
return 'GREAT'
} else if (old == 'LE') {
return 'LESS_EQUAL'
} else if (old == 'GE') {
return 'GREAT_EQUAL'
} else if (old == 'NE') {
return 'NOT_EQUAL'
} else if (old == 'LK') {
return 'LIKE'
} else if (old == 'LFK') {
return 'LEFT_LIKE'
} else if (old == 'RHK') {
return 'RIGHT_LIKE'
} else if (old == 'ISNULL') {
return 'IS_NULL'
} else if (old == 'NOTNULL') {
return 'NOTNULL'
} else if (old == 'IN') {
return 'IN'
} else if (old == 'BETWEEN') {
return 'BETWEEN'
} else {
return 'LIKE'
}
},
toggleTree() {
if (this.treeShow) {
this.treeShow = false
this.transtionWidth = '0%'
this.toggleBtn = 'el-icon-arrow-right'
} else {
this.treeShow = true
this.transtionWidth = '25%'
this.toggleBtn = 'el-icon-arrow-left'
}
},
loadTree(node, resolve) {
if (node) {
let this_ = this
let displayField =
this_.customDialog.style == 2
? this_.combiTreeDisplayField
: this_.displayField
resolve(
this.treeList.filter(
value => value[displayField.pid] === node.data[displayField.id]
)
)
if (this.showData && this.showData.length > 0) {
setTimeout(() => {
this.showData.forEach(v => {
if (v.Pid == node.key) {
this_.$refs.tree.setChecked(v, true)
} else {
this_.checkNode(v, this_)
}
})
}, 400)
}
}
},
toTreeData(data, id, pid, name, pvalue, returnStr) {
// 建立个树形结构,需要定义个最顶层的父节点,pvalue是0
// let ztree=translateDataToTree(data,pid,id,name);
// function translateDataToTree(data,pid,id,name) {
// //把树数据有子节点的数据全部过滤掉(只留父节点的数据)
let parents = data.filter(
value =>
value[id] == value[pid] ||
value[pid] == null ||
value[pid] == null ||
value[pid] == 0
)
if (!parents) {
parents = data.filter(
value =>
value[pid] !== 'undefined' &&
value[pid] != null &&
value[id] != value[pid]
)
}
return parents
},
// 处理POST请求时的参数
_handlePostData: (query, queryParams, _pageBeanCtx) => {
if (!query.dataParam || query.dataParam.constructor != String) {
return queryParams
}
// 构建上下文数据对象
let ctx = {..._pageBeanCtx}
queryParams &&
queryParams.forEach(element => {
ctx[element.key] = element.value
})
const exp = hotentUiUtils.parseExp(query.dataParam, ctx)
try {
return JSON.parse(exp)
} catch (e) {
this.$message.error(`POST参数不是有效的JSON格式${query.dataParam}`)
}
}
}
}
</script>
<style lang="scss" scoped>
.el-main {
padding-top: 0px;
::v-deep {
.is-align-right {
width: 120px !important;
padding-right: 2px;
}
.search-panel__container {
/* overflow: hidden; */
.search-btn__wrap {
width: 175px;
}
}
}
}
.combination-dialog_main {
::v-deep {
.search-panel__container {
.search-panel__row {
min-width: unset;
}
}
}
}
.dialog-el-container {
height: calc(100% - 20px);
::v-deep {
.inputs.ht-form-inputs__inline {
width: 100% !important;
position: relative;
}
}
}
.tree-aside {
margin-right: 10px;
}
</style>