EipDataListTemplateSelector.vue
3.35 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
<template>
<ht-tree-list-dialog
:single="single"
:data="data"
:table-columns="tableColumns"
:pagination="pageResult"
:tree-data="treeData"
dialog-title="数据列表选择"
:append-to-body="true"
@load="handleLoad"
@loadListData="loadListData"
@onConfirm="onConfirm"
@reset="reset"
quickSearchProps="name,alias"
search-placeholder="名称、别名"
:destroy-on-close="destroyOnClose"
ref="htTreeListDialog"
/>
</template>
<script>
import form from '@/api/form.js'
export default {
name: 'EipDataListTemplateSelector',
props: {
value: Array,
single: {
type: Boolean,
default: true
},
defKey: {
type: String,
default: ''
},
type: {
type: String,
default: ''
},
name: String,
formType: {
type: String,
default: 'pc'
},
destroyOnClose: {
type: Boolean,
default: false
},
rightType: {
type: String,
default: ''
},
isMobile: {
type: Boolean,
default: false
}
},
data() {
return {
data: [],
treeData: null,
tableColumns: [
{prop: 'name', label: '视图名称'},
{prop: 'alias', label: '视图别名'},
{prop: 'sqlAlias', label: 'sql别名'},
{prop: 'typeName', label: '分类'}
],
querys: [],
pageResult: {
page: 1,
pageSize: 50,
total: 0
},
typeIdQuery: null
}
},
mounted() {},
methods: {
loadTreeData() {
let param = {pageBean: {page: 1, pageSize: -1}}
form.getCustomViewList(param).then(response => {
this.treeData = response.rows
})
},
showDialog(data) {
this.loadTreeData()
this.$refs.htTreeListDialog.showDialog(data)
},
handleClose() {
this.$refs.htTreeListDialog.handleClose()
},
handleLoad(param, cb) {
param.params = param.params || {}
if (this.defKey != '') {
if (this.type == 'flow') {
param.querys.push({
property: 'defId',
value: this.defKey,
operation: 'EQUAL',
relation: 'AND'
})
} else {
param.querys.push({
property: 'formKey',
value: this.defKey,
operation: 'EQUAL',
relation: 'AND'
})
}
}
// 参数说明 url requestBodyParam requestParam
form
.getViewList(param, this.typeIdQuery)
.then(response => {
this.data = response.rows
this.pageResult = {
page: response.page,
pageSize: response.pageSize,
total: response.total
}
})
.finally(() => cb())
},
loadListData(nodedata) {
let queryFilter = {
pageBean: this.pageResult,
querys: []
}
this.typeIdQuery = nodedata.alias
this.handleLoad(queryFilter, () => {})
},
onConfirm(selection) {
this.$emit('onConfirm', selection, this.name)
this.$emit('input', selection)
},
reset() {
/**
* 点击重置按钮
* 1. 清空树条件 this.typeIdQuery = "";
* 2. 清空树选中状态
* */
if (this.typeIdQuery) {
this.$refs.htTreeListDialog.$refs.tree.$refs.elTree.currentNode.node.isCurrent = false
}
this.typeIdQuery = ''
}
}
}
</script>