Commit be7e8a78b6f7f475d57ae44b0f9c14ca9b989c01

Authored by liuqimichale
1 parent 4439edb0

泊位

Showing 1 changed file with 31 additions and 15 deletions
src/components/berth/index.vue
... ... @@ -44,20 +44,35 @@
44 44 }
45 45 },
46 46 mounted() {
47   -// var i= 1,_self=this;
48   -// setInterval(function(){
49   -// i ++;
50   -// _self.free +=i;//动态改变值测试---通过
51   -// _self.have +=i;
52   -// },2000)
  47 + this.axios.post('urban/intelligence/berth/queryBerthStatisticByOrgIds',{
  48 + orgIds: [10003,10005]
  49 + }).then((response)=>{
  50 + let data = response.data.data
  51 + console.log(data)
  52 + this.berthTotal = common.formatNumToStr(data.allBerthNum)
  53 + this.free = data.freeBerthNum
  54 + this.have = data.isOccupyBertnNum
  55 +
  56 + this.pieChartOption.seriesData[0].value = data.isOccupyBertnNum
  57 + this.pieChartOption.seriesData[1].value = data.freeBerthNum
  58 + let pieChartOption = this.pieChartOption
  59 + //占有率
  60 + this.pieChart=this.createPie(pieChartOption);
  61 + window.addEventListener('resize', function() {
  62 + this.pieChart.resize()
  63 + }.bind(this));
  64 +
  65 + // let barChartOption = this.barChartOption
  66 + // this.barChart=this.createBar(barChartOption);
  67 + // window.addEventListener('resize', function() {
  68 + // this.barChart.resize()
  69 + // }.bind(this));
  70 + }).catch((response)=>{
  71 + console.log(response);
  72 + })
53 73 //this.createLine();
54 74 //总收入
55   - this.berthTotal=this.formatNumToStr();
56   - //占有率
57   - this.pieChart=this.createPie();
58   - window.addEventListener('resize', function() {
59   - this.pieChart.resize()
60   - }.bind(this));
  75 +
61 76 },
62 77 methods: {
63 78 /*
... ... @@ -69,12 +84,13 @@
69 84 /*
70 85 * 泊位占比
71 86 * */
72   - createPie(){
  87 + createPie(pieChartOption){
73 88 //debugger;
74   - let root=this.$options.data().pieChartOption;
  89 + let root=pieChartOption;
75 90 let pieChart = echarts.init(document.querySelector('.app-berthBox .berthPie'));
76 91 //占有率
77 92 let zyPercent= (root.seriesData[0].value / (root.seriesData[0].value + root.seriesData[1].value));//注意顺序!!!
  93 + console.log(zyPercent)
78 94 let seriesData=root.seriesData;
79 95 const option={
80 96 // grid: {
... ... @@ -115,7 +131,7 @@
115 131 value: 0,
116 132 label: {
117 133 normal: {
118   - formatter: (Math.round(zyPercent*10)/10)*100 + '%',//小数点后一位
  134 + formatter: (zyPercent*100).toFixed(1) + '%',//小数点后一位
119 135 textStyle: {
120 136 color: '#fe8b53',
121 137 fontSize: 18,
... ...