Blame view

src/components/weekAndDay/uDay.vue 6.15 KB
22fb20b3   songchongxian   城市停车运营监控
1
  <template>
e52cf1d6   liuqimichale   添加丹阳
2
3
4
5
6
7
8
9
      <div class="app-uDayBox">
          <div class="theme-card2">
              <div class="title"><span>今日车流量</span></div>
              <div class="content" style="padding: 10px;box-sizing:border-box;padding-left: 0px;">
                  <div class="contentBox">
                      <div class="lineChart"></div>
                  </div>
              </div>
22fb20b3   songchongxian   城市停车运营监控
10
          </div>
22fb20b3   songchongxian   城市停车运营监控
11
      </div>
22fb20b3   songchongxian   城市停车运营监控
12
13
14
  </template>
  
  <script>
e52cf1d6   liuqimichale   添加丹阳
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
  import echarts from 'echarts'
  import {dayAddress, dayAddressDY} from '../../api/api'
  
  export default {
    name: "uDay",
    data() {
      return {
        name: '进出场折线图',
        lineChart: {},
      }
    },
    /*
     * 进出场折线图
     * */
    mounted() {
      this.onLoad()
    },
    methods: {
      onLoad() {
        // dayAddress({
        //   orgIds: this.GLOBAL.paramsvariables
        // }).then((response)=>{
        //   let  data = response.data.data
        //   let  xData=[],inNum=[],outNum=[]
        //   for(let i=0;i<data.length;i++){
        //     xData.push(data[i].queryDate)
        //     inNum.push(data[i].inNum)
        //     outNum.push(data[i].outNum)
        //   }
        //
        //   this.lineChart=this.createLine(xData,inNum,outNum);
        //   window.addEventListener('resize', function() {
        //     this.lineChart.resize()
        //   }.bind(this));
        // }).catch((response)=>{
        //   console.log(response);
        // })
  
        this.$axios.all(
          [
            dayAddress({ orgIds: this.GLOBAL.paramsvariables }),
1bc516df   liuqimichale   地图点击事件
56
            dayAddressDY({ orgIds: this.GLOBAL.variables })
e52cf1d6   liuqimichale   添加丹阳
57
58
59
60
61
62
          ]
        )
        .then(this.$axios.spread((acctWX, acctDY) => {
          let WXdata = acctWX.data.data
          let DYdata = acctDY.data.data
          let xData = [], inNum = [], outNum = []
a6301da7   liuqimichale   去掉丹阳
63
64
65
66
67
68
69
          // for (let i = 0; i < WXdata.length; i++) {
          //   xData.push(WXdata[i].queryDate)
          //   inNum.push(WXdata[i].inNum + DYdata[i].inNum)
          //   outNum.push(WXdata[i].outNum + DYdata[i].outNum)
          //   //lastInNum = WXdata[WXdata.length-1].inNum+DYdata[WXdata.length-1].inNum
          // }
  
e52cf1d6   liuqimichale   添加丹阳
70
71
          for (let i = 0; i < WXdata.length; i++) {
            xData.push(WXdata[i].queryDate)
a6301da7   liuqimichale   去掉丹阳
72
73
            inNum.push(WXdata[i].inNum )
            outNum.push(WXdata[i].outNum )
e52cf1d6   liuqimichale   添加丹阳
74
            //lastInNum = WXdata[WXdata.length-1].inNum+DYdata[WXdata.length-1].inNum
22fb20b3   songchongxian   城市停车运营监控
75
          }
a6301da7   liuqimichale   去掉丹阳
76
77
78
79
  
  
  
  
e52cf1d6   liuqimichale   添加丹阳
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
          this.weekChart = this.createLine(xData, inNum, outNum);
          window.addEventListener('resize', function () {
            this.weekChart.resize()
          }.bind(this));
        }))
      },
      createLine(xAxis_data, series_in, series_out) {
        // 基于准备好的dom,初始化echarts实例
        let lineChart = echarts.init(document.querySelector('.lineChart'));
        let axisLineColor = "#10377c";
        let axisLabelColor = "#7c8799";
        let legend_data = ['进场', '出场'];
        // let xAxis_data=['06:00', '07:00', '08:00', '09:00', '10:00', '11:00', '12:00'];
        // let series_in=[220, 182, 191, 134, 150, 120,100];
        // let series_out=[120, 82, 125, 145, 122, 191,150];
        const option = {
          grid: {
            top: 13, left: 10,
            right: 10, bottom: 20,
            containLabel: true
          },
          tooltip: {
            trigger: 'axis',
            axisPointer: {
              lineStyle: {
                color: '#072d6e',
                fontSize: 12,
1eee9ca9   liuqimichale   api 接口封装 地图
107
              }
e52cf1d6   liuqimichale   添加丹阳
108
109
            },
            formatter: this._formatTooltip
1eee9ca9   liuqimichale   api 接口封装 地图
110
          },
e52cf1d6   liuqimichale   添加丹阳
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
          legend: {
            itemWidth: 15, itemHeight: 8,
            itemGap: 13,
            data: legend_data, bottom: 0,
            textStyle: { fontSize: 12, color: '#59AAF7' }
          },
          xAxis: [{
            type: "category",
            boundaryGap: true,
            axisTick: { show: false },
            axisLine: {
              lineStyle: { color: axisLineColor }
            },
            axisLabel: {
              margin: 5,
              textStyle: {
                color: axisLabelColor, fontSize: 12
              }
            },
            splitLine: {
              lineStyle: { color: '#57617B' }
            },
            data: xAxis_data
          }],
          yAxis: [{
            type: 'value',
            //name: '单位(%)',
            axisTick: { show: false },
            axisLine: { lineStyle: { color: axisLineColor } },
            axisLabel: {
              margin: 5,
              textStyle: { color: axisLabelColor, fontSize: 12 }
            },
            splitLine: { lineStyle: { color: '#10377c' } }
          }],
          series: [
            {
              name: '进场', type: 'line', symbol: 'circle', symbolSize: 5,
              // smooth: true,// showSymbol: false,
              lineStyle: { normal: { width: 0.8 } },
              itemStyle: {
                normal: {
                  color: 'rgb(255,177,48)',
                  borderColor: 'rgba(216,152,57,0.17)',
                  borderWidth: 8
                }
22fb20b3   songchongxian   城市停车运营监控
157
              },
e52cf1d6   liuqimichale   添加丹阳
158
159
160
161
162
163
164
165
166
167
168
              data: series_in//[220, 182, 191, 134, 150, 120]
            },
            {
              name: '出场', type: 'line', symbol: 'circle', symbolSize: 5,
              // showSymbol: false, // smooth: true,
              lineStyle: { normal: { width: 0.8 } },
              itemStyle: {
                normal: {
                  color: 'rgb(8,185,252)',
                  borderColor: 'rgba(8,185,252,0.2)',
                  borderWidth: 8
22fb20b3   songchongxian   城市停车运营监控
169
                }
e52cf1d6   liuqimichale   添加丹阳
170
171
              },
              data: series_out
22fb20b3   songchongxian   城市停车运营监控
172
            }
e52cf1d6   liuqimichale   添加丹阳
173
174
175
176
177
178
179
180
181
182
183
184
185
          ]
        };
        lineChart.setOption(option);
        return lineChart;
      },
      _formatTooltip: function (ticket, html) {
        //debugger;
        let tmpHtml = ticket[0].name;
        for (let i = 0; i < ticket.length; i++) {
          let tmpObj = ticket[i];
          tmpHtml += "<br />" + tmpObj.seriesName + " : " + tmpObj.data + " (辆)";
        }
        return tmpHtml;
22fb20b3   songchongxian   城市停车运营监控
186
      }
e52cf1d6   liuqimichale   添加丹阳
187
188
189
    },
  
  }
22fb20b3   songchongxian   城市停车运营监控
190
191
  </script>
  
e52cf1d6   liuqimichale   添加丹阳
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
  <style scoped lang="scss">
      .app-uDayBox {
          width: 100%;
          .theme-card2 {
              height: 100%;
          }
          .lineChart {
              position: absolute;
              margin: auto;
              top: 0;
              bottom: 0;
              left: 0;
              width: 100%;
              height: 100%;
          }
          .contentBox {
              background: url(../../images/com/border.svg) no-repeat;
              background-size: 100% 100%;
              width: 100%;
              height: 100%;
              position: relative;
          }
22fb20b3   songchongxian   城市停车运营监控
214
      }
22fb20b3   songchongxian   城市停车运营监控
215
  </style>