EipChartDialog.vue
4.21 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
<template>
<el-dialog
:title="title"
:append-to-body="appendToBody"
:visible.sync="dialogVisible"
:before-close="handleClose"
:close-on-click-modal="false"
width="60%"
>
<ht-table
@load="loadData"
:data="data"
:pageResult="pageResult"
:showCustomColumn="false"
:showExport="false"
:selection="true"
ref="chartTable"
quick-search-props="name,alias"
@row-click="rowClick"
:selectable="false"
>
<ht-table-column width="50">
<template v-slot="{row}">
<el-radio v-model="radioId" :label="row.id"></el-radio>
</template>
</ht-table-column>
<ht-table-column prop="name" label="名称" :sortable="true" />
<template v-if="chartType === 2">
<ht-table-column prop="alias" label="别名" :sortable="true" />
<ht-table-column prop="objName" label="表名称" />
<ht-table-column prop="style" label="图表类型" width="120">
<template v-slot="{row}">
<el-tag v-if="row.style === 1 || row.style === 2"
>折线图/柱状图</el-tag
>
<el-tag type="warning" v-if="row.style === 3">饼图</el-tag>
<el-tag type="danger" v-if="row.style === 4">雷达图</el-tag>
<el-tag type="info" v-if="row.style === 5">漏斗图</el-tag>
<el-tag type="success" v-if="row.style === 6">散点图</el-tag>
<el-tag type="warning" v-if="row.style === 7">热力图</el-tag>
</template>
</ht-table-column>
</template>
</ht-table>
<div slot="footer" class="dialog-footer">
<el-button @click="handleClose">取消</el-button>
<el-button type="primary" @click="onConfirm">确定</el-button>
</div>
</el-dialog>
</template>
<script>
const htSysTypeTree = () => import('@/components/common/HtSysTypeTree.vue')
import req from '@/request.js'
export default {
name: 'eip-chart-dialog',
components: {
htSysTypeTree
},
props: {
chartType: {
type: Number
},
appendToBody: {
type: Boolean,
default: false
}
},
data() {
return {
radioId: '',
radioRow: '',
pageResult: {
page: 1,
pageSize: 10,
total: 0
},
data: [],
dialogVisible: false,
selectedNode: null
}
},
computed: {
title: function() {
return this.chartType == 1 ? '统计报表选择器' : '自定义图表选择器'
}
},
methods: {
//鼠标选中行改变复选框
rowClick(row, column, event) {
this.radioId = row.id
this.radioRow = row
},
loadData(param, cb) {
let url = ''
if (this.chartType == 2) {
url = window.context.form + '/form/customChart/v1/list'
} else {
url =
window.context.bpmRunTime +
'/runtime/report/v1/listJson?isPublic=true'
}
req
.post(url, param)
.then(response => {
this.data = response.data.rows
this.pageResult = {
page: response.data.page,
pageSize: response.data.pageSize,
total: response.data.total
}
})
.finally(() => cb && cb())
},
showDialog(data) {
if (data) {
this.rowClick(JSON.parse(data))
} else {
this.radioId = ''
this.radioRow = ''
}
this.dialogVisible = true
this.$nextTick(() => {
this.$refs.chartTable.load()
})
},
handleClose() {
this.dialogVisible = false
},
handleNodeClick(node) {
this.selectedNode = node
},
onConfirm() {
let selectedList = this.radioRow ? [this.radioRow] : []
if (selectedList.length == 0) {
this.$message({message: '请选择一项!', type: 'warning'})
return
}
this.$emit('onConfirm', selectedList)
this.dialogVisible = false
}
}
}
</script>
<style lang="scss" scoped>
>>> .el-dialog {
height: 670px;
}
>>> .el-dialog__header {
border-bottom: 1px solid darkgrey;
}
>>> .el-dialog__body {
padding: 20px;
}
>>> .el-dialog__footer {
position: absolute;
text-align: right;
bottom: 0px;
left: 0px;
right: 0px;
}
>>> .el-dialog__header {
padding: 20px;
border: 1px solid #ebeef5;
}
</style>