first commit
This commit is contained in:
@@ -0,0 +1,161 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
<style>
|
||||
.el-select {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
<div id="app" v-cloak>
|
||||
<guava>
|
||||
<el-card shadow="never">
|
||||
<el-select @change="jdhChange" placeholder="请选择教代会" v-model="pageForm.jdhid">
|
||||
<el-option
|
||||
:key="item.id"
|
||||
:label="item.jdhallname"
|
||||
:value="item.id"
|
||||
v-for="item in JdhList">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-card>
|
||||
|
||||
<el-row class="mt20" type="flex">
|
||||
<el-col :span="18">
|
||||
<el-card shadow="never">
|
||||
<vi-title title="代表结构"></vi-title>
|
||||
<div :style="{height:db_box_height+'px'}" id="db_plot_box" ref="db_box"></div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-card shadow="never" style="height: 100%">
|
||||
<vi-title title="代表团"></vi-title>
|
||||
<el-table :data="dbt" :height="dbtTableHeight" ref="dbtTable" show-summary>
|
||||
<el-table-column label="代表团" prop="dbtname" show-overflow-tooltip>
|
||||
<template scope="{row}">
|
||||
{{row.delegationName}}{{isDisPlayCode?'('+row.delegationCode+')':null}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="代表人数" prop="num"></el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
</guava>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
let dbPlot = null
|
||||
let vue = new Vue({
|
||||
el: '#app',
|
||||
data() {
|
||||
return {
|
||||
pageForm: {
|
||||
jdhid: '',
|
||||
},
|
||||
JdhList: [],
|
||||
dbt: [],
|
||||
hyhdTableData: [],
|
||||
dbOptions: {
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: [],
|
||||
axisLabel: {
|
||||
interval: 0
|
||||
}
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: [{
|
||||
label: {
|
||||
normal: {
|
||||
show: true,
|
||||
position: 'top'
|
||||
}
|
||||
},
|
||||
data: [],
|
||||
type: 'bar',
|
||||
showBackground: true,
|
||||
itemStyle: {
|
||||
//通常情况下:
|
||||
normal: {
|
||||
//每个柱子的颜色即为colorList数组里的每一项,如果柱子数目多于colorList的长度,则柱子颜色循环使用该数组
|
||||
color: function (params) {
|
||||
var colorList = ['#CE0000', 'rgb(42,170,227)', 'rgb(42,170,227)', 'rgb(42,170,227)', '#FFDCB9', '#FFDCB9', '#FFDCB9', '#FFDCB9', '#FFDCB9', '#FFDCB9'];
|
||||
return colorList[params.dataIndex];
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
}]
|
||||
},
|
||||
dbtTableHeight: null,
|
||||
db_box_height: null
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async jdhChange(jdhid) {
|
||||
const resp_data = await $.get(base + '/platform/jdh/sjkb/getData', {jdhid})
|
||||
this.dbt = resp_data.data.dbt
|
||||
this.hyhdTableData = resp_data.data.hyhd
|
||||
const keys = Object.keys(resp_data.data.db)
|
||||
let dbData = []
|
||||
keys.map(v => {
|
||||
dbData.push({name: v, num: resp_data.data.db[v]})
|
||||
})
|
||||
if (dbPlot) {
|
||||
dbPlot.destroy()
|
||||
}
|
||||
dbPlot = new G2Plot.Column('db_plot_box', {
|
||||
data: dbData,
|
||||
xField: 'name',
|
||||
yField: 'num',
|
||||
label: {
|
||||
position: 'middle',
|
||||
style: {
|
||||
fill: '#FFFFFF',
|
||||
opacity: 0.6,
|
||||
},
|
||||
},
|
||||
xAxis: {
|
||||
label: {
|
||||
autoHide: true,
|
||||
autoRotate: false,
|
||||
},
|
||||
},
|
||||
meta: {
|
||||
name: {
|
||||
alias: '类别',
|
||||
},
|
||||
num: {
|
||||
alias: '人数',
|
||||
}
|
||||
},
|
||||
})
|
||||
dbPlot.render()
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
setTimeout(() => {
|
||||
this.db_box_height = (window.innerHeight - 20 - 20) - this.$refs.db_box.getBoundingClientRect().top - 20
|
||||
this.dbtTableHeight = (window.innerHeight - 20 - 20) - this.$refs.dbtTable.$el.getBoundingClientRect().top
|
||||
window.onresize = () => {
|
||||
this.db_box_height = (window.innerHeight - 20 - 20) - this.$refs.db_box.getBoundingClientRect().top - 20
|
||||
this.dbtTableHeight = (window.innerHeight - 20 - 20) - this.$refs.dbtTable.$el.getBoundingClientRect().top
|
||||
}
|
||||
}, 100)
|
||||
},
|
||||
async created() {
|
||||
this.JdhList = await getAllJdh()
|
||||
if (this.JdhList.length > 0) {
|
||||
this.pageForm.jdhid = this.JdhList[0].id
|
||||
this.jdhChange(this.pageForm.jdhid)
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
Reference in New Issue
Block a user