Commit 4be32cc7 by zhouzy

取消横向滚动条,图片自适应

1 parent 83d24569
......@@ -2153,8 +2153,8 @@
},
"async-validator": {
"version": "1.8.5",
"resolved": "https://registry.npmjs.org/async-validator/-/async-validator-1.8.5.tgz",
"integrity": "sha512-tXBM+1m056MAX0E8TL2iCjg8WvSyXu0Zc8LNtYqrVeyoL3+esHRZ4SieE9fKQyyU09uONjnMEjrNBMqT0mbvmA==",
"resolved": "https://registry.npm.taobao.org/async-validator/download/async-validator-1.8.5.tgz?cache=0&sync_timestamp=1605749896979&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fasync-validator%2Fdownload%2Fasync-validator-1.8.5.tgz",
"integrity": "sha1-3D4I7B/Q3dtn5ghC8CwM0c7G1/A=",
"requires": {
"babel-runtime": "6.x"
}
......@@ -2332,8 +2332,8 @@
},
"babel-helper-vue-jsx-merge-props": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-2.0.3.tgz",
"integrity": "sha512-gsLiKK7Qrb7zYJNgiXKpXblxbV5ffSwR0f5whkPAaBAR4fhi6bwRZxX9wBlIc5M/v8CCkXUbXZL4N/nSE97cqg=="
"resolved": "https://registry.npm.taobao.org/babel-helper-vue-jsx-merge-props/download/babel-helper-vue-jsx-merge-props-2.0.3.tgz",
"integrity": "sha1-Iq69OzOQIyjlEyk6jkmSs4T58bY="
},
"babel-helpers": {
"version": "6.24.1",
......@@ -4916,6 +4916,15 @@
"safer-buffer": "^2.1.0"
}
},
"echarts": {
"version": "5.0.0",
"resolved": "https://registry.npm.taobao.org/echarts/download/echarts-5.0.0.tgz",
"integrity": "sha1-ZuwOpH48k7Kq37stcZhpkyrRPOA=",
"requires": {
"tslib": "1.10.0",
"zrender": "5.0.1"
}
},
"editorconfig": {
"version": "0.15.3",
"resolved": "https://registry.npmjs.org/editorconfig/-/editorconfig-0.15.3.tgz",
......@@ -4971,9 +4980,9 @@
"dev": true
},
"element-ui": {
"version": "2.11.1",
"resolved": "https://registry.npmjs.org/element-ui/-/element-ui-2.11.1.tgz",
"integrity": "sha512-PACNMHPWqm+/Wc2f/q93pLNzbNyVbpMCXCrYe81czengSWj7IBku7F3zccybkxtWn5qdCmMDBCpG5BzGJL4rKA==",
"version": "2.14.1",
"resolved": "https://registry.npm.taobao.org/element-ui/download/element-ui-2.14.1.tgz",
"integrity": "sha1-i1dFxzZsHBpgO7bAIShupxh+KqI=",
"requires": {
"async-validator": "~1.8.1",
"babel-helper-vue-jsx-merge-props": "^2.0.0",
......@@ -6631,7 +6640,8 @@
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"aproba": {
"version": "1.2.0",
......@@ -6652,12 +6662,14 @@
"balanced-match": {
"version": "1.0.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
......@@ -6672,17 +6684,20 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"core-util-is": {
"version": "1.0.2",
......@@ -6799,7 +6814,8 @@
"inherits": {
"version": "2.0.3",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"ini": {
"version": "1.3.5",
......@@ -6811,6 +6827,7 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
......@@ -6825,6 +6842,7 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
......@@ -6832,12 +6850,14 @@
"minimist": {
"version": "0.0.8",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"minipass": {
"version": "2.3.5",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
......@@ -6856,6 +6876,7 @@
"version": "0.5.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
......@@ -6936,7 +6957,8 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"object-assign": {
"version": "4.1.1",
......@@ -6948,6 +6970,7 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"wrappy": "1"
}
......@@ -7033,7 +7056,8 @@
"safe-buffer": {
"version": "5.1.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"safer-buffer": {
"version": "2.1.2",
......@@ -7069,6 +7093,7 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
......@@ -7088,6 +7113,7 @@
"version": "3.0.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
......@@ -7131,12 +7157,14 @@
"wrappy": {
"version": "1.0.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"yallist": {
"version": "3.0.3",
"bundled": true,
"dev": true
"dev": true,
"optional": true
}
}
},
......@@ -10671,7 +10699,7 @@
},
"normalize-wheel": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/normalize-wheel/-/normalize-wheel-1.0.1.tgz",
"resolved": "https://registry.npm.taobao.org/normalize-wheel/download/normalize-wheel-1.0.1.tgz",
"integrity": "sha1-rsiGr/2wRQcNhWRH32Ls+GFG7EU="
},
"npm-run-path": {
......@@ -12697,8 +12725,8 @@
},
"resize-observer-polyfill": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz",
"integrity": "sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg=="
"resolved": "https://registry.npm.taobao.org/resize-observer-polyfill/download/resize-observer-polyfill-1.5.1.tgz",
"integrity": "sha1-DpAg3T0hAkRY1OvSfiPkAmmBBGQ="
},
"resolve": {
"version": "1.12.0",
......@@ -12820,7 +12848,8 @@
"version": "4.0.8",
"resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-4.0.8.tgz",
"integrity": "sha1-Cx4Rr4vESDbwSmQH6S2kJGe3lEQ=",
"dev": true
"dev": true,
"optional": true
},
"rx-lite-aggregates": {
"version": "4.0.8",
......@@ -14437,8 +14466,8 @@
},
"throttle-debounce": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/throttle-debounce/-/throttle-debounce-1.1.0.tgz",
"integrity": "sha512-XH8UiPCQcWNuk2LYePibW/4qL97+ZQ1AN3FNXwZRBNPPowo/NRU5fAlDCSNBJIYCKbioZfuYtMhG4quqoJhVzg=="
"resolved": "https://registry.npm.taobao.org/throttle-debounce/download/throttle-debounce-1.1.0.tgz?cache=0&sync_timestamp=1604313832516&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fthrottle-debounce%2Fdownload%2Fthrottle-debounce-1.1.0.tgz",
"integrity": "sha1-UYU9o3vmihVctugns1FKPEIuic0="
},
"through": {
"version": "2.3.8",
......@@ -14632,8 +14661,7 @@
"tslib": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
"integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==",
"dev": true
"integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ=="
},
"tty-browserify": {
"version": "0.0.0",
......@@ -15952,6 +15980,14 @@
"dev": true
}
}
},
"zrender": {
"version": "5.0.1",
"resolved": "https://registry.npm.taobao.org/zrender/download/zrender-5.0.1.tgz?cache=0&sync_timestamp=1605884134992&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fzrender%2Fdownload%2Fzrender-5.0.1.tgz",
"integrity": "sha1-zDdxNqnQDQoXfKf2XDKu0pAZKNo=",
"requires": {
"tslib": "1.10.0"
}
}
}
}
......@@ -11,6 +11,7 @@
</div>
</el-row>
</div> -->
<div class="show-num">
<div class="num-block">
<p>{{ TopNumberData.customerCount || 0 }}</p>
......@@ -30,276 +31,220 @@
</div>
</div>
<el-row :gutter="50">
<el-row :gutter="40">
<div class="charts">
<el-col :span="12">
<div class="grid-content bg-purple">
<div
class="chart"
id="decivceType"
></div>
<div class="chart" id="decivceType"></div>
</div>
</el-col>
<el-col :span="12">
<div class="grid-content bg-purple">
<div
class="chart"
id="serviceType"
></div>
<div class="chart" id="serviceType"></div>
</div>
</el-col>
</div>
</el-row>
<p class="Trend">设备接入趋势</p>
<div
id="AccessTrend"
style="width: 100%; height: 400px"
></div>
<div id="AccessTrend" style="width: 100%; height: 400px"></div>
<p class="Trend">服务调用趋势</p>
<div
id="CallTrend"
style="width: 100%; height: 400px"
></div>
<div id="CallTrend" style="width: 100%; height: 400px"></div>
</d2-container>
</template>
<script>
import _ from 'lodash'
import echarts from 'echarts'
import { getStatisticData, getGraphData, getPolylineData } from '@api/api'
import _ from "lodash";
import echarts from "echarts";
import { getStatisticData, getGraphData, getPolylineData } from "@api/api";
export default {
name: 'index',
name: "index",
data() {
return {
// myChart = '',
radio: '全部',
radio: "全部",
TopNumberData: {},
message: '',
// chartData:{
// apiCallGraphData:[{
// num:'',
// apiClassification: ''
// }],
message: "",
// deviceGraphData:[{
// deviceType: "",
// num: ''
// }],
// },
// 绘图
option: {
title: {
top: '20',
top: "20",
text: "",
subtext: "",
left: "20",
text: '',
subtext: '',
left: '20'
},
tooltip: {
trigger: 'item',
formatter: '{a} <br/>{b} : {c} ({d}%)'
trigger: "item",
formatter: "{a} <br/>{b} : {c} ({d}%)",
},
legend: {
orient: 'vertical',
left: 'right',
data: []
orient: "vertical",
left: "right",
data: [],
},
series: [
{
name: '访问来源',
type: 'pie',
radius: '55%',
center: ['50%', '60%'],
name: "访问来源",
type: "pie",
radius: "55%",
center: ["50%", "60%"],
data: [],
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
shadowColor: "rgba(0, 0, 0, 0.5)",
},
},
},
],
},
Trendoption: {
xAxis: {
type: 'category',
data: []
type: "category",
data: [],
},
yAxis: {
type: 'value'
type: "value",
},
series: [
{
data: [],
type: 'line'
}
]
}
// option2 : {
// xAxis: {
// type: 'category',
// data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
// },
// yAxis: {
// type: 'value'
// },
// series: [{
// data: [820, 932, 901, 934, 1290, 1330, 1320],
// type: 'line'
// }]
// }
// totalOptions: {
// title: [{
// text: '标题',
// x: '49.5%',
// y: '8%',
// textAlign: 'center'
// }],
// tooltip: {},
// series: [{
// name: '在网情况',
// type: 'pie',
// radius: ['35%', '55%'],
// label: {
// normal: {
// fontSize: 16,
// formatter: '{b}: {c}'
// }
// },
// data: [{
// name: '在网',
// value: 0,
// itemStyle: {
// color: '#00b639'
// }
// }, {
// name: '离网',
// value: 0,
// itemStyle: {
// color: '#999999'
// }
// }]
// }],
// },
}
type: "line",
},
],
},
};
},
mounted() {
// 初始化各表实例
this.$echarts = echarts
this.totalECharts = this.$echarts.init(document.getElementById('decivceType'))
this.totalEChart2 = this.$echarts.init(document.getElementById('serviceType'))
this.trendCharts = this.$echarts.init(document.getElementById('AccessTrend'))
this.apiCallCharts = this.$echarts.init(document.getElementById('CallTrend'))
this.$echarts = echarts;
this.totalECharts = this.$echarts.init(document.getElementById("decivceType"));
this.totalEChart2 = this.$echarts.init(document.getElementById("serviceType"));
this.trendCharts = this.$echarts.init(document.getElementById("AccessTrend"));
this.apiCallCharts = this.$echarts.init(document.getElementById("CallTrend"));
// this.getPie()
// 获取顶部数据
getStatisticData({}).then((res) => {
this.TopNumberData = res
this.TopNumberData = res;
// console.log( this.TopNumberData)
this.TopNumberData.customerCount = this.formatNumber(res.customerCount)
this.TopNumberData.deviceCount = this.formatNumber(res.deviceCount)
this.TopNumberData.userCount = this.formatNumber(res.userCount)
this.TopNumberData.apiCallCount = this.formatNumber(res.apiCallCount)
})
this.TopNumberData.customerCount = this.formatNumber(res.customerCount);
this.TopNumberData.deviceCount = this.formatNumber(res.deviceCount);
this.TopNumberData.userCount = this.formatNumber(res.userCount);
this.TopNumberData.apiCallCount = this.formatNumber(res.apiCallCount);
});
// 获取饼状图数据
getGraphData({}).then((res) => {
this.chartData = res
this.chartData = res;
// console.log(res)
// 修改特定的数值,注意数组和对象的区别
// 左图
var option1 = _.cloneDeep(this.option)
option1.legend.padding = [50, 50, 50, 0]
option1.title.text = '设备接入类型分布'
option1.legend.data = res.deviceGraphData.map((item) => item.deviceType)
var option1 = _.cloneDeep(this.option);
option1.legend.padding = [50, 50, 50, 0];
option1.title.text = "设备接入类型分布";
option1.legend.data = res.deviceGraphData.map((item) => item.deviceType);
option1.series[0].data = res.deviceGraphData.map((item) => {
return {
value: item.num,
name: item.deviceType
}
})
name: item.deviceType,
};
});
//无数据显示
// if( option1.legend.data =="" || option1.series[0].data=="" ){
// option1.title.text = "暂无数据"
// option1.legend.data = ['none']
// option1.series[0].data = ['暂无数据']
// console.log( option1.title.text)
// }
// 右图
var option2 = _.cloneDeep(this.option)
option2.title.text = '调用服务类型分布'
var option2 = _.cloneDeep(this.option);
option2.title.text = "调用服务类型分布";
// option2.legend.data=res.apiCallGraphData.map(item => item.apiClassification)
var formatData = res.apiCallGraphData.map((item) => {
return {
1: '授权管理',
2: '设备管理',
3: '数据服务'
}[item.apiClassification]
})
1: "授权管理",
2: "设备管理",
3: "数据服务",
}[item.apiClassification];
});
// formatData == '1' ? formatData = '授权管理' : (formatData== '2' ? formatData= '设备管理' : formatData = '数据服务')
// console.log(formatData)
option2.legend.data = formatData
option2.legend.padding = [50, 50, 50, 0]
option2.legend.data = formatData;
option2.legend.padding = [50, 50, 50, 0];
option2.series[0].data = res.apiCallGraphData.map((item) => {
return {
value: item.num,
name: {
1: '授权管理',
2: '设备管理',
3: '数据服务'
}[item.apiClassification]
}
})
1: "授权管理",
2: "设备管理",
3: "数据服务",
}[item.apiClassification],
};
});
// console.log(option2.series[0].data)
// 渲染
this.totalEChart2.setOption(option2)
this.totalECharts.setOption(option1)
})
this.totalEChart2.setOption(option2);
window.onresize = this.totalEChart2.resize;
this.totalECharts.setOption(option1);
window.onresize = this.totalECharts.resize;
});
// 折线图数据获取
getPolylineData({}).then((res) => {
var trendData = res
console.log(trendData)
var trendData = res;
console.log(trendData);
// 接入设备折线图
var option3 = _.cloneDeep(this.Trendoption)
var option3 = _.cloneDeep(this.Trendoption);
option3.grid = {
x: 30,
y: 50,
x2: 10,
y2: 50
}
option3.xAxis.data = res.deviceAccessTrendList.map(item => item.activatTime)
option3.series[0].data = res.deviceAccessTrendList.map(item => item.num)
y2: 50,
};
option3.xAxis.data = res.deviceAccessTrendList.map((item) => item.activatTime);
option3.series[0].data = res.deviceAccessTrendList.map((item) => item.num);
// console.log(option3)
// 服务调用趋势
var option4 = _.cloneDeep(this.Trendoption)
option4.xAxis.data = res.apiCallTrendList.map(item => item.createTime)
option4.series[0].data = res.apiCallTrendList.map(item => item.num)
var option4 = _.cloneDeep(this.Trendoption);
option4.xAxis.data = res.apiCallTrendList.map((item) => item.createTime);
option4.series[0].data = res.apiCallTrendList.map((item) => item.num);
option4.grid = {
x: 30,
y: 50,
x2: 10,
y2: 50
}
y2: 50,
};
this.trendCharts.setOption(option3)
this.apiCallCharts.setOption(option4)
})
this.trendCharts.setOption(option3);
this.apiCallCharts.setOption(option4);
});
// 渲染
......@@ -335,20 +280,55 @@ export default {
// 每隔三位加一个逗号
formatNumber(n) {
var b = parseInt(n).toString()
var len = b.length
var b = parseInt(n).toString();
var len = b.length;
if (len <= 3) {
return b
return b;
}
var r = len % 3
var r = len % 3;
return r > 0
? b.slice(0, r) + ',' + b.slice(r, len).match(/\d{3}/g).join(',')
: b.slice(r, len).match(/\d{3}/g).join(',')
}
}
}
? b.slice(0, r) + "," + b.slice(r, len).match(/\d{3}/g).join(",")
: b.slice(r, len).match(/\d{3}/g).join(",");
},
},
};
</script>
<style>
/* html {
overflow-y: scroll;
}
:root {
overflow-y: auto;
overflow-x: hidden;
}
:root body {
position: absolute;
}
body {
width: 100vw;
overflow: hidden;
} */
.indexPage{
overflow-y: scroll;
}
:root {
overflow-y: auto;
overflow-x: hidden;
}
:root body.indexPage {
position: absolute;
}
body.indexPage{
width: 100vw;
overflow: hidden;
}
.show-num {
display: flex;
}
......@@ -385,6 +365,8 @@ export default {
.grid-content {
border-radius: 4px;
min-height: 36px;
min-width: 100px;
}
.row-bg {
padding: 10px 0;
......@@ -400,10 +382,14 @@ export default {
}
.charts {
display: flex;
}
.chart {
border: 1px solid #999999;
width: 100%;
height: 400px;
min-width: 100px;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!