提交 b3cd3a82 authored 作者: 邓文彬's avatar 邓文彬

fix(图表): 图表完成

上级 ac0f8ade
<template> <template>
<view class="echartsBar" id="echartsBar"></view> <view>
<view class="echartsBar" id="echartsBar"></view>
</view>
</template> </template>
<script> <script>
export default {
data() {
return {};
},
};
</script>
<script module="echarts" lang="renderjs">
import * as echarts from "echarts"; import * as echarts from "echarts";
export default { export default {
props: {}, props: {},
...@@ -90,7 +99,7 @@ export default { ...@@ -90,7 +99,7 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.echartsBar { .echartsBar {
height: 100%; height: 200px;
width: 100%; width: 100%;
} }
</style> </style>
<template> <template>
<view class="echartsBar" id="echartsLine"></view> <view>
<view canvas-id="myChart" id="myChart" class="echartsBar"></view>
</view>
</template> </template>
<script> <script>
export default {
data() {
return {
};
},
};
</script>
<script module="echarts" lang="renderjs">
import * as echarts from "echarts"; import * as echarts from "echarts";
export default { export default {
props: {},
data() { data() {
return { return {
lists: [ lists: [
...@@ -103,29 +114,34 @@ export default { ...@@ -103,29 +114,34 @@ export default {
}; };
}, },
}, },
async mounted() { mounted() {
this.$nextTick(() => { // 初始化图表
this.init(); this.initChart();
});
}, },
methods: { methods: {
init() { initChart() {
const DOM = document.getElementById("echartsLine"); // 确保ECharts已经加载
const myChart = echarts.init(DOM); if (typeof echarts === 'undefined') {
myChart.setOption(this.option); // 可以在这里动态加载ECharts库
window.addEventListener("resize", () => { return;
myChart.clear(); }
myChart.setOption(this.option);
myChart && myChart.resize(); // 基于准备好的dom,初始化echarts实例
}); const chart = echarts.init(document.getElementById('myChart'));
},
},
};
// 使用刚指定的配置项和数据显示图表。
chart.setOption(this.option);
}
}
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.echartsBar { .echartsBar {
height: 100%; height: 200px;
width: 100%; width: 100%;
} }
</style> </style>
<template> <template>
<view id="lineTendencyChart"></view> <view>
<view id="lineTendencyChart"></view>
</view>
</template> </template>
<script> <script>
export default {
data() {
return {};
},
async mounted() {
}
};
</script>
<script module="echarts" lang="renderjs">
import * as echarts from "echarts"; import * as echarts from "echarts";
export default { export default {
props: { props: {
......
<template> <template>
<view class="padding_all_16 page_box"> <view class="padding_all_16 page_box">
<!-- 态势分析研判报告 --> <!-- 态势分析研判报告 -->
<view class="margin_t_16 padding_16_24 background_white"> <view class="margin_t_16 padding_16_24 background_white">
<common-top-title <common-top-title
titletext="态势分析研判报告" titletext="态势分析研判报告"
:isTitleNormal="false" :isTitleNormal="false"
></common-top-title> ></common-top-title>
<view class="rightOne"> <view class="rightOne">
<rightPie class="margin_t_16 rightPie" :value="80" /> <rightPie class="margin_t_16 rightPie" :value="70" />
<rightItem class="rightItem" /> <rightItem class="rightItem" />
</view> </view>
</view> </view>
<!-- 本月场景告警图 --> <!-- 本月场景告警图 -->
<view class="margin_t_16 padding_16_24 background_white rightHeight"> <view class="margin_t_16 padding_16_24 background_white rightHeight">
<common-top-title <common-top-title
...@@ -37,15 +36,13 @@ ...@@ -37,15 +36,13 @@
/> />
</view> </view>
<view class="monthReport"> <view class="monthReport">
<view class="margin_t_16 padding_16_24 background_white"> <view class="margin_t_16 padding_16_24 background_white">
<common-top-title <common-top-title
titletext="本月资产监管数据" titletext="本月资产监管数据"
:isTitleNormal="false" :isTitleNormal="false"
></common-top-title> ></common-top-title>
<view :gutter="8" class="margin_t_16 flex-row "> <view :gutter="8" class="margin_t_16 flex-row">
<view :span="18" class="first-part el-col-18"> <view :span="18" class="first-part el-col-18">
<common-top-title <common-top-title
titletext="终端" titletext="终端"
...@@ -79,13 +76,13 @@ ...@@ -79,13 +76,13 @@
</view> </view>
</view> </view>
</view> </view>
<view :gutter="8" class="margin_t_16 flex-row "> <view :gutter="8" class="margin_t_16 flex-row">
<view :span="12" class="el-col-12"> <view :span="12" class="el-col-12">
<common-top-title <common-top-title
titletext="机房" titletext="机房"
:isTitleNormal="true" :isTitleNormal="true"
></common-top-title> ></common-top-title>
<view :gutter="8" class="margin_t_16 flex-row "> <view :gutter="8" class="margin_t_16 flex-row">
<view <view
v-for="item in computerData" v-for="item in computerData"
:key="item.label" :key="item.label"
...@@ -110,13 +107,12 @@ ...@@ -110,13 +107,12 @@
titletext="数据中心" titletext="数据中心"
:isTitleNormal="true" :isTitleNormal="true"
></common-top-title> ></common-top-title>
<view :gutter="8" class="margin_t_16 flex-row "> <view :gutter="8" class="margin_t_16 flex-row">
<view <view
v-for="item in dataCenter" v-for="item in dataCenter"
:key="item.label" :key="item.label"
:span="item.span" :span="item.span"
class="flex-average flex-row-gutter-8" class="flex-average flex-row-gutter-8"
> >
<view v-if="item.type == 'tem4'" class="baseFlex"> <view v-if="item.type == 'tem4'" class="baseFlex">
<template v-for="child in item.children"> <template v-for="child in item.children">
...@@ -132,15 +128,25 @@ ...@@ -132,15 +128,25 @@
</view> </view>
</view> </view>
</view> </view>
<view class="margin_t_16"> <view class="margin_t_16">
<view> <view>
<common-top-title <common-top-title
titletext="网络" titletext="网络"
:isTitleNormal="true" :isTitleNormal="true"
></common-top-title> ></common-top-title>
<view :gutter="8" class="margin_t_16 flex-row"> <view :gutter="8" class="margin_t_16 flex-row">
<view v-for="item in netData" :key="item.label" :class="`el-col-${item.span} ${item.type == 'tem3'? 'flex-row-gutter-8': ''}`"> <view
<view :gutter="8" v-if="item.type == 'tem2'" class="baseFlex flex-row "> v-for="item in netData"
:key="item.label"
:class="`el-col-${item.span} ${
item.type == 'tem3' ? 'flex-row-gutter-8' : ''
}`"
>
<view
:gutter="8"
v-if="item.type == 'tem2'"
class="baseFlex flex-row"
>
<view <view
v-for="child in item.children" v-for="child in item.children"
:key="child.label" :key="child.label"
...@@ -151,7 +157,6 @@ ...@@ -151,7 +157,6 @@
</view> </view>
<tem3 <tem3
v-else-if="item.type == 'tem3'" v-else-if="item.type == 'tem3'"
:item="item" :item="item"
style="height: 76px" style="height: 76px"
/> />
...@@ -165,14 +170,12 @@ ...@@ -165,14 +170,12 @@
titletext="用户" titletext="用户"
:isTitleNormal="true" :isTitleNormal="true"
></common-top-title> ></common-top-title>
<view :gutter="8" class="margin_t_16 flex-row"> <view :gutter="8" class="margin_t_16 flex-row">
<view <view
v-for="item in userData" v-for="item in userData"
:key="item.label" :key="item.label"
:span="item.span" :span="item.span"
class="el-col-6 flex-row-gutter-8" class="el-col-6 flex-row-gutter-8"
> >
<tem3 :item="item" style="height: 76px" /> <tem3 :item="item" style="height: 76px" />
</view> </view>
...@@ -192,7 +195,11 @@ ...@@ -192,7 +195,11 @@
:isTitleNormal="true" :isTitleNormal="true"
></common-top-title> ></common-top-title>
<view :gutter="8" class="margin_t_16 flex-row"> <view :gutter="8" class="margin_t_16 flex-row">
<view v-for="item in ywData" :key="item.label" class="el-col-8 flex-row-gutter-8"> <view
v-for="item in ywData"
:key="item.label"
class="el-col-8 flex-row-gutter-8"
>
<tem3 :item="item" style="height: 78px" /> <tem3 :item="item" style="height: 78px" />
</view> </view>
</view> </view>
...@@ -203,7 +210,11 @@ ...@@ -203,7 +210,11 @@
:isTitleNormal="true" :isTitleNormal="true"
></common-top-title> ></common-top-title>
<view :gutter="8" class="margin_t_16 flex-row"> <view :gutter="8" class="margin_t_16 flex-row">
<view v-for="item in fbData" :key="item.label" class="el-col-8 flex-row-gutter-8"> <view
v-for="item in fbData"
:key="item.label"
class="el-col-8 flex-row-gutter-8"
>
<tem3 :item="item" style="height: 78px" /> <tem3 :item="item" style="height: 78px" />
</view> </view>
</view> </view>
...@@ -211,9 +222,6 @@ ...@@ -211,9 +222,6 @@
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
...@@ -270,7 +278,6 @@ export default { ...@@ -270,7 +278,6 @@ export default {
<style lang="scss"> <style lang="scss">
.page_box { .page_box {
background: #f2f2f2; background: #f2f2f2;
.monthReport {
.rightOne { .rightOne {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
...@@ -282,12 +289,14 @@ export default { ...@@ -282,12 +289,14 @@ export default {
.rightItem { .rightItem {
width: calc(100% - 230px - 16px); width: calc(100% - 230px - 16px);
height: auto; height: auto;
} }
} }
.rightHeight { .rightHeight {
height: calc((100% - 300px - 32px) / 2); height: calc((100% - 300px - 32px) / 2);
} }
}
.baseFlex { .baseFlex {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
...@@ -321,16 +330,14 @@ export default { ...@@ -321,16 +330,14 @@ export default {
width: 75%; width: 75%;
} }
.el-col-12 { .el-col-12 {
width: 50%; width: 50%;
} }
.el-col-8 { .el-col-8 {
width: 33.33333%; width: 33.33333%;
} }
.el-col-6 { .el-col-6 {
width: 25%; width: 25%;
} }
} }
</style> </style>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论