Blame view

public/bigScreen/js/box1.js 2.5 KB
c89819f7   wuxw   支持跳转至物联网和商城
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
  
  let community = document.getElementById("community");
  community.innerHTML = vc.getCurrentCommunity().name;
  
  function _loadAssetRoom() {
  
      let param = {
          params: {
              communityId: vc.getCurrentCommunity().communityId
          }
      }
      vc.http.apiGet(
          '/bigScreen/getAssetsRoom',
          param,
          function (json, res) {
              //vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
              let _json = JSON.parse(json);
              if (_json.code == 0) {
                  let _data = _json.data;
                  initChart(_data.freeRoomCount,_data.sellRoomCount);
                  return;
              }
          },
          function (errInfo, error) {
              console.log('请求失败处理');
  
              vc.toast(errInfo);
  
          });
  }
  
  function initChart(_freeRoomCount,_sellRoomCount) {
      var dom = document.getElementById("box1");
      var myChart = echarts.init(dom);
      var app = {};
      option = null;
      var labelRight = {
          normal: {
              position: 'right'
          }
      };
      option = {
          title: {
              text: '',
              subtext: '',
              left: 'center'
          },
          textStyle: {//图例文字的样式
              color: '#fff',
              fontSize: 12
          },
          tooltip: {
              trigger: 'item',
              formatter: '{a} <br/>{b} : {c} ({d}%)'
          },
          legend: {
              orient: 'vertical',
              left: 'left',
              data: ['已售', '空闲']
          },
          color: ['green', 'red'],
          series: [
              {
                  name: '',
                  type: 'pie',
                  radius: '55%',
                  center: ['50%', '50%'],
                  data: [
                      { value: _sellRoomCount, name: '已售' },
                      { value: _freeRoomCount, name: '空闲' }
                  ],
                  emphasis: {
                      itemStyle: {
                          shadowBlur: 10,
                          shadowOffsetX: 0,
                          shadowColor: 'rgba(0, 0, 0, 0.5)'
                      }
                  },
                  itemStyle: {
                      normal: {
                          label: {
                              show: true,
                              formatter: '{b} : {c} '
                          },
                          labelLine: { show: true }
                      }
                  }
              }
          ]
      };
  
      if (option && typeof option === "object") {
          myChart.setOption(option, true);
      }
  }
  
  
  _loadAssetRoom();