Commit 9a5a7582 authored by huangjie's avatar huangjie

*

parent e65c8efe
...@@ -171,8 +171,24 @@ export default { ...@@ -171,8 +171,24 @@ export default {
this.initChart() this.initChart()
this.getDT(1) this.getDT(1)
}) })
window.addEventListener("resize", this.resizeEcharts);
},
beforeDestroy(){
window.removeEventListener("resize", this. resizeEcharts);
},
activated() {
this.resizeEcharts()
}, },
methods: { methods: {
resizeEcharts (){
const self = this
setTimeout(function(){ //图表跟随页面大小变化宽度
self.myChart.resize()
self.myChart1.resize()
self.myChart2.resize()
self.myChart3.resize()
}, 10)
},
initChart(){ initChart(){
//客户级别 //客户级别
this.option = { this.option = {
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
</div> </div>
</div> </div>
</el-card> </el-card>
<el-card class="box-card noborder"> <el-card class="box-card noborder" id="charts">
<div class="cardtitles i">项目经营分析 <div class="cardtitles i">项目经营分析
<div class="labels"> <div class="labels">
<div :class="{'on':datatype==1}" @click="getDT(1)">周</div> <div :class="{'on':datatype==1}" @click="getDT(1)">周</div>
...@@ -222,6 +222,13 @@ export default { ...@@ -222,6 +222,13 @@ export default {
item.createTime = this.gettime(item.createTime) item.createTime = this.gettime(item.createTime)
item.nextVisitTime = this.gettime(item.nextVisitTime) item.nextVisitTime = this.gettime(item.nextVisitTime)
}) })
window.addEventListener("resize", this.resizeEcharts);
},
beforeDestroy(){
window.removeEventListener("resize", this. resizeEcharts);
},
activated() {
this.resizeEcharts()
}, },
methods: { methods: {
getDT(type){ getDT(type){
...@@ -298,6 +305,12 @@ export default { ...@@ -298,6 +305,12 @@ export default {
} }
this.initDT(datas,labels) this.initDT(datas,labels)
}, },
resizeEcharts (){
const self = this
setTimeout(function(){
self.myChart.resize()
}, 10)
},
initDT(datas,labels){ initDT(datas,labels){
this.chartDom = document.getElementById("xmjyfx") this.chartDom = document.getElementById("xmjyfx")
this.myChart = echarts.init(this.chartDom) this.myChart = echarts.init(this.chartDom)
...@@ -436,6 +449,11 @@ export default { ...@@ -436,6 +449,11 @@ export default {
] ]
} }
this.option && this.myChart.setOption(this.option) this.option && this.myChart.setOption(this.option)
let _this = this
// document.getElementById('charts').onresize = function () {
// _this.myChart.resize() ; // 如果有多个图标变动,可写多个
//
// }
}, },
gettime(time){ gettime(time){
if(time == null || time == "") if(time == null || time == "")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment