|
@@ -7,7 +7,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { getCameaCount } from '@/api/bigdata'
|
|
|
+import { getCameaCount,selectDeviceType} from '@/api/bigdata'
|
|
|
|
|
|
import * as echarts from 'echarts'
|
|
|
|
|
@@ -29,19 +29,20 @@ export default {
|
|
|
|
|
|
getCameaCount() {
|
|
|
let that = this
|
|
|
- getCameaCount().then(res => {
|
|
|
- console.log(res)
|
|
|
- for (let i = 0; i < res.data.deviceCount.length; i++) {
|
|
|
- that.deviceTypeCount.push({
|
|
|
- value: res.data.deviceCount[i],
|
|
|
- name: res.data.deviceType[i],
|
|
|
- itemStyle: { color: that.color16() }
|
|
|
+ selectDeviceType().then(resp => {
|
|
|
+ resp.data.forEach(item=>
|
|
|
+ {
|
|
|
+ that.deviceCount.push(item.deviceCount)
|
|
|
+ that.deviceType.push(item.deviceName)
|
|
|
+ that.deviceTypeCount.push({
|
|
|
+ value: item.deviceCount,
|
|
|
+ name: item.deviceName,
|
|
|
+ itemStyle: { color: that.color16() }
|
|
|
+ })
|
|
|
+
|
|
|
})
|
|
|
- }
|
|
|
- this.deviceCount = res.data.deviceCount
|
|
|
- this.deviceType = res.data.deviceType
|
|
|
that.myEcharts()
|
|
|
- })
|
|
|
+ })
|
|
|
},
|
|
|
color16() {//十六进制颜色随机
|
|
|
var r = Math.floor(Math.random() * 256)
|