You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
625 lines
25 KiB
625 lines
25 KiB
5 months ago
|
<template>
|
||
|
<div class="home-container layout-pd">
|
||
|
<el-row :gutter="15" class="home-card-one mb15">
|
||
|
<el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6" v-for="(v, k) in state.homeOne" :key="k" :class="{ 'home-media home-media-lg': k > 1, 'home-media-sm': k === 1 }">
|
||
|
<div class="home-card-item flex">
|
||
|
<div class="flex-margin flex w100" :class="` home-one-animation${k}`">
|
||
|
<div class="flex-auto">
|
||
|
<span class="font30">{{ v.num1 }}</span>
|
||
|
<span class="ml5 font16" :style="{ color: v.color1 }">{{ v.num2 }}%</span>
|
||
|
<div class="mt10">{{ v.num3 }}</div>
|
||
|
</div>
|
||
|
<div class="home-card-item-icon flex" :style="{ background: `var(${v.color2})` }">
|
||
|
<i class="flex-margin font32" :class="v.num4" :style="{ color: `var(${v.color3})` }"></i>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</el-col>
|
||
|
</el-row>
|
||
|
<el-row :gutter="15" class="home-card-two mb15">
|
||
|
<el-col :xs="24" :sm="14" :md="14" :lg="16" :xl="16">
|
||
|
<div class="home-card-item">
|
||
|
<div style="height: 100%" ref="homeLineRef"></div>
|
||
|
</div>
|
||
|
</el-col>
|
||
|
<el-col :xs="24" :sm="10" :md="10" :lg="8" :xl="8" class="home-media">
|
||
|
<div class="home-card-item">
|
||
|
<div style="height: 100%" ref="homePieRef"></div>
|
||
|
</div>
|
||
|
</el-col>
|
||
|
</el-row>
|
||
|
<el-row :gutter="15" class="home-card-three">
|
||
|
<el-col :xs="24" :sm="10" :md="10" :lg="8" :xl="8">
|
||
|
<div class="home-card-item">
|
||
|
<div class="home-card-item-title">快捷导航工具</div>
|
||
|
<div class="home-monitor">
|
||
|
<div class="flex-warp">
|
||
|
<div class="flex-warp-item" v-for="(v, k) in state.homeThree" :key="k">
|
||
|
<div class="flex-warp-item-box" :class="`home-animation${k}`">
|
||
|
<div class="flex-margin">
|
||
|
<i :class="v.icon" :style="{ color: v.iconColor }"></i>
|
||
|
<span class="pl5">{{ v.label }}</span>
|
||
|
<div class="mt10">{{ v.value }}</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</el-col>
|
||
|
<el-col :xs="24" :sm="14" :md="14" :lg="16" :xl="16" class="home-media">
|
||
|
<div class="home-card-item">
|
||
|
<div style="height: 100%" ref="homeBarRef"></div>
|
||
|
</div>
|
||
|
</el-col>
|
||
|
</el-row>
|
||
|
</div>
|
||
|
</template>
|
||
|
|
||
|
<script setup lang="ts" name="test">
|
||
|
import { reactive, onMounted, ref, watch, nextTick, onActivated, markRaw } from 'vue';
|
||
|
import * as echarts from 'echarts';
|
||
|
import { storeToRefs } from 'pinia';
|
||
|
import { useThemeConfig } from '/@/stores/themeConfig';
|
||
|
import { useTagsViewRoutes } from '/@/stores/tagsViewRoutes';
|
||
|
|
||
|
// 定义变量内容
|
||
|
const homeLineRef = ref();
|
||
|
const homePieRef = ref();
|
||
|
const homeBarRef = ref();
|
||
|
const storesTagsViewRoutes = useTagsViewRoutes();
|
||
|
const storesThemeConfig = useThemeConfig();
|
||
|
const { themeConfig } = storeToRefs(storesThemeConfig);
|
||
|
const { isTagsViewCurrenFull } = storeToRefs(storesTagsViewRoutes);
|
||
|
const state = reactive({
|
||
|
global: {
|
||
|
homeChartOne: null,
|
||
|
homeChartTwo: null,
|
||
|
homeCharThree: null,
|
||
|
dispose: [null, '', undefined],
|
||
|
} as any,
|
||
|
homeOne: [
|
||
|
{
|
||
|
num1: '125,12',
|
||
|
num2: '-12.32',
|
||
|
num3: '日增量',
|
||
|
num4: 'fa fa-meetup',
|
||
|
color1: '#FF6462',
|
||
|
color2: '--next-color-primary-lighter',
|
||
|
color3: '--el-color-primary',
|
||
|
},
|
||
|
{
|
||
|
num1: '653,33',
|
||
|
num2: '+42.32',
|
||
|
num3: '周增量',
|
||
|
num4: 'iconfont icon-ditu',
|
||
|
color1: '#6690F9',
|
||
|
color2: '--next-color-success-lighter',
|
||
|
color3: '--el-color-success',
|
||
|
},
|
||
|
{
|
||
|
num1: '125,65',
|
||
|
num2: '+17.32',
|
||
|
num3: '月增量',
|
||
|
num4: 'iconfont icon-zaosheng',
|
||
|
color1: '#6690F9',
|
||
|
color2: '--next-color-warning-lighter',
|
||
|
color3: '--el-color-warning',
|
||
|
},
|
||
|
{
|
||
|
num1: '520,43',
|
||
|
num2: '-10.01',
|
||
|
num3: '总量',
|
||
|
num4: 'fa fa-github-alt',
|
||
|
color1: '#FF6462',
|
||
|
color2: '--next-color-danger-lighter',
|
||
|
color3: '--el-color-danger',
|
||
|
},
|
||
|
],
|
||
|
homeThree: [
|
||
|
{
|
||
|
icon: 'iconfont icon-yangan',
|
||
|
label: '浅粉红',
|
||
|
value: '2.1%OBS/M',
|
||
|
iconColor: '#F72B3F',
|
||
|
},
|
||
|
{
|
||
|
icon: 'iconfont icon-wendu',
|
||
|
label: '深红(猩红)',
|
||
|
value: '30℃',
|
||
|
iconColor: '#91BFF8',
|
||
|
},
|
||
|
{
|
||
|
icon: 'iconfont icon-shidu',
|
||
|
label: '淡紫红',
|
||
|
value: '57%RH',
|
||
|
iconColor: '#88D565',
|
||
|
},
|
||
|
{
|
||
|
icon: 'iconfont icon-shidu',
|
||
|
label: '弱紫罗兰红',
|
||
|
value: '107w',
|
||
|
iconColor: '#88D565',
|
||
|
},
|
||
|
{
|
||
|
icon: 'iconfont icon-zaosheng',
|
||
|
label: '中紫罗兰红',
|
||
|
value: '57DB',
|
||
|
iconColor: '#FBD4A0',
|
||
|
},
|
||
|
{
|
||
|
icon: 'iconfont icon-zaosheng',
|
||
|
label: '紫罗兰',
|
||
|
value: '57PV',
|
||
|
iconColor: '#FBD4A0',
|
||
|
},
|
||
|
{
|
||
|
icon: 'iconfont icon-zaosheng',
|
||
|
label: '暗紫罗兰',
|
||
|
value: '517Cpd',
|
||
|
iconColor: '#FBD4A0',
|
||
|
},
|
||
|
{
|
||
|
icon: 'iconfont icon-zaosheng',
|
||
|
label: '幽灵白',
|
||
|
value: '12kg',
|
||
|
iconColor: '#FBD4A0',
|
||
|
},
|
||
|
{
|
||
|
icon: 'iconfont icon-zaosheng',
|
||
|
label: '海军蓝',
|
||
|
value: '64fm',
|
||
|
iconColor: '#FBD4A0',
|
||
|
},
|
||
|
],
|
||
|
myCharts: [] as EmptyArrayType,
|
||
|
charts: {
|
||
|
theme: '',
|
||
|
bgColor: '',
|
||
|
color: '#303133',
|
||
|
},
|
||
|
});
|
||
|
|
||
|
// 折线图
|
||
|
const initLineChart = () => {
|
||
|
if (!state.global.dispose.some((b: any) => b === state.global.homeChartOne)) state.global.homeChartOne.dispose();
|
||
|
state.global.homeChartOne = markRaw(echarts.init(homeLineRef.value, state.charts.theme));
|
||
|
const option = {
|
||
|
backgroundColor: state.charts.bgColor,
|
||
|
title: {
|
||
|
text: '政策补贴额度',
|
||
|
x: 'left',
|
||
|
textStyle: { fontSize: '15', color: state.charts.color },
|
||
|
},
|
||
|
grid: { top: 70, right: 20, bottom: 30, left: 30 },
|
||
|
tooltip: { trigger: 'axis' },
|
||
|
legend: { data: ['预购队列', '最新成交价'], right: 0 },
|
||
|
xAxis: {
|
||
|
data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
|
||
|
},
|
||
|
yAxis: [
|
||
|
{
|
||
|
type: 'value',
|
||
|
name: '价格',
|
||
|
splitLine: { show: true, lineStyle: { type: 'dashed', color: '#f5f5f5' } },
|
||
|
},
|
||
|
],
|
||
|
series: [
|
||
|
{
|
||
|
name: '预购队列',
|
||
|
type: 'line',
|
||
|
symbolSize: 6,
|
||
|
symbol: 'circle',
|
||
|
smooth: true,
|
||
|
data: [0, 41.1, 30.4, 65.1, 53.3, 53.3, 53.3, 41.1, 30.4, 65.1, 53.3, 10],
|
||
|
lineStyle: { color: '#fe9a8b' },
|
||
|
itemStyle: { color: '#fe9a8b', borderColor: '#fe9a8b' },
|
||
|
areaStyle: {
|
||
|
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
||
|
{ offset: 0, color: '#fe9a8bb3' },
|
||
|
{ offset: 1, color: '#fe9a8b03' },
|
||
|
]),
|
||
|
},
|
||
|
},
|
||
|
{
|
||
|
name: '最新成交价',
|
||
|
type: 'line',
|
||
|
symbolSize: 6,
|
||
|
symbol: 'circle',
|
||
|
smooth: true,
|
||
|
data: [0, 24.1, 7.2, 15.5, 42.4, 42.4, 42.4, 24.1, 7.2, 15.5, 42.4, 0],
|
||
|
lineStyle: { color: '#9E87FF' },
|
||
|
itemStyle: { color: '#9E87FF', borderColor: '#9E87FF' },
|
||
|
areaStyle: {
|
||
|
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
||
|
{ offset: 0, color: '#9E87FFb3' },
|
||
|
{ offset: 1, color: '#9E87FF03' },
|
||
|
]),
|
||
|
},
|
||
|
emphasis: {
|
||
|
itemStyle: {
|
||
|
color: {
|
||
|
type: 'radial',
|
||
|
x: 0.5,
|
||
|
y: 0.5,
|
||
|
r: 0.5,
|
||
|
colorStops: [
|
||
|
{ offset: 0, color: '#9E87FF' },
|
||
|
{ offset: 0.4, color: '#9E87FF' },
|
||
|
{ offset: 0.5, color: '#fff' },
|
||
|
{ offset: 0.7, color: '#fff' },
|
||
|
{ offset: 0.8, color: '#fff' },
|
||
|
{ offset: 1, color: '#fff' },
|
||
|
],
|
||
|
},
|
||
|
borderColor: '#9E87FF',
|
||
|
borderWidth: 2,
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
],
|
||
|
};
|
||
|
state.global.homeChartOne.setOption(option);
|
||
|
state.myCharts.push(state.global.homeChartOne);
|
||
|
};
|
||
|
// 饼图
|
||
|
const initPieChart = () => {
|
||
|
if (!state.global.dispose.some((b: any) => b === state.global.homeChartTwo)) state.global.homeChartTwo.dispose();
|
||
|
state.global.homeChartTwo = markRaw(echarts.init(homePieRef.value, state.charts.theme));
|
||
|
var getname = ['房屋及结构物', '专用设备', '通用设备', '文物和陈列品', '图书、档案'];
|
||
|
var getvalue = [34.2, 38.87, 17.88, 9.05, 2.05];
|
||
|
var data: any = [];
|
||
|
for (var i = 0; i < getname.length; i++) {
|
||
|
data.push({ name: getname[i], value: getvalue[i] });
|
||
|
}
|
||
|
const colorList = ['#51A3FC', '#36C78B', '#FEC279', '#968AF5', '#E790E8'];
|
||
|
const option = {
|
||
|
backgroundColor: state.charts.bgColor,
|
||
|
title: {
|
||
|
text: '房屋建筑工程',
|
||
|
x: 'left',
|
||
|
textStyle: { fontSize: '15', color: state.charts.color },
|
||
|
},
|
||
|
tooltip: { trigger: 'item', formatter: '{b} <br/> {c}%' },
|
||
|
graphic: {
|
||
|
elements: [
|
||
|
{
|
||
|
type: 'image',
|
||
|
z: -1,
|
||
|
style: {
|
||
|
image: themeConfig.value.isIsDark
|
||
|
? ''
|
||
|
: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAK0AAACtCAYAAADCr/9DAAAcoElEQVR4Xu19e7wcRZn28/ZM90xXzzknOYEkIAEiBAUUFyFc4wKCCAt8gHhBUEDFG8K3Iri6+3ETL0hQ9FthvYC4gAb0cwFRQcUlKiIIbpRbEBGUREJIyHWmq2e6Z+r9fjU5iQnJOWcuPV195nT/l5yq93nep57p6amueouQXV0rwMzW6tWrS4XCsFvPVQWIyAphKweR3ShUGw2EAwMIAfhE1OgacJIHoEme/7jpM3O+UgnnWFZuDpF6pQJ2JtDOBJ4JwgxmmgbwEABr3GAAM1Ah8CqAVgC8nEBLFWgJQz1Liv7sefZTRBS0EGvSNslMu9nQL1u2TEyZsv3rARygwK8nxuvIwh7McBJ0iL4T/xXgR8DW75nxcL2ef2jKFFqTIIdUQ01q02qTDg5v/wZLqSMZ9I8AtGHtFI6YAmExFO4jsu6N3Ny9Q0SrU8gzEUqTzrSrV8ud7aJ1okW54wg4jJmLiSgdL4i+Gz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++H4QtppiSIwsWyd7Xv6OxPAyoJYUqFZ5t4aKnjI4k/AfnnA2fWi2uNNWZKhPA9f1UA1cvES4zuyJWhDOgGCJQvoy+gHA/ytR0I2PA4Q/Cdd51bbvtDL6G8CvMEFM1yvwvMKnjGBnoOMq4PvV40HWD8dt2JsGrBr2zI3FVzbdadcGwWybc8/2BnPcqKpWrc8eHhZLxm2ZNTCiQHNDpAyXgshIUWcCv0WMlLjaZNogqJ+uWH3bhCIE/EII5wgT2Blm6wpIGV3N4PNb7xFfSwJ9QQi7ORW7ybS+rF8DKDO
|
||
|
width: 230,
|
||
|
height: 230,
|
||
|
},
|
||
|
left: '16.5%',
|
||
|
top: 'center',
|
||
|
},
|
||
|
],
|
||
|
},
|
||
|
legend: {
|
||
|
type: 'scroll',
|
||
|
orient: 'vertical',
|
||
|
right: '0%',
|
||
|
left: '65%',
|
||
|
top: 'center',
|
||
|
itemWidth: 14,
|
||
|
itemHeight: 14,
|
||
|
data: getname,
|
||
|
textStyle: {
|
||
|
rich: {
|
||
|
name: {
|
||
|
fontSize: 14,
|
||
|
fontWeight: 400,
|
||
|
width: 200,
|
||
|
height: 35,
|
||
|
padding: [0, 0, 0, 60],
|
||
|
color: state.charts.color,
|
||
|
},
|
||
|
rate: {
|
||
|
fontSize: 15,
|
||
|
fontWeight: 500,
|
||
|
height: 35,
|
||
|
width: 40,
|
||
|
padding: [0, 0, 0, 30],
|
||
|
color: state.charts.color,
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
series: [
|
||
|
{
|
||
|
type: 'pie',
|
||
|
radius: ['82', themeConfig.value.isIsDark ? '50' : '102'],
|
||
|
center: ['32%', '50%'],
|
||
|
itemStyle: {
|
||
|
color: function (params: any) {
|
||
|
return colorList[params.dataIndex];
|
||
|
},
|
||
|
},
|
||
|
label: { show: false },
|
||
|
labelLine: { show: false },
|
||
|
data: data,
|
||
|
},
|
||
|
],
|
||
|
};
|
||
|
state.global.homeChartTwo.setOption(option);
|
||
|
state.myCharts.push(state.global.homeChartTwo);
|
||
|
};
|
||
|
// 柱状图
|
||
|
const initBarChart = () => {
|
||
|
if (!state.global.dispose.some((b: any) => b === state.global.homeCharThree)) state.global.homeCharThree.dispose();
|
||
|
state.global.homeCharThree = markRaw(echarts.init(homeBarRef.value, state.charts.theme));
|
||
|
const option = {
|
||
|
backgroundColor: state.charts.bgColor,
|
||
|
title: {
|
||
|
text: '地热开发利用',
|
||
|
x: 'left',
|
||
|
textStyle: { fontSize: '15', color: state.charts.color },
|
||
|
},
|
||
|
tooltip: { trigger: 'axis' },
|
||
|
legend: { data: ['供温', '回温', '压力值(Mpa)'], right: 0 },
|
||
|
grid: { top: 70, right: 80, bottom: 30, left: 80 },
|
||
|
xAxis: [
|
||
|
{
|
||
|
type: 'category',
|
||
|
data: ['1km', '2km', '3km', '4km', '5km', '6km'],
|
||
|
boundaryGap: true,
|
||
|
axisTick: { show: false },
|
||
|
},
|
||
|
],
|
||
|
yAxis: [
|
||
|
{
|
||
|
name: '供回温度(℃)',
|
||
|
nameLocation: 'middle',
|
||
|
nameTextStyle: { padding: [3, 4, 50, 6] },
|
||
|
splitLine: { show: true, lineStyle: { type: 'dashed', color: '#f5f5f5' } },
|
||
|
axisLine: { show: false },
|
||
|
axisTick: { show: false },
|
||
|
axisLabel: { color: state.charts.color, formatter: '{value} ' },
|
||
|
},
|
||
|
{
|
||
|
name: '压力值(Mpa)',
|
||
|
nameLocation: 'middle',
|
||
|
nameTextStyle: { padding: [50, 4, 5, 6] },
|
||
|
splitLine: { show: false },
|
||
|
axisLine: { show: false },
|
||
|
axisTick: { show: false },
|
||
|
axisLabel: { color: state.charts.color, formatter: '{value} ' },
|
||
|
},
|
||
|
],
|
||
|
series: [
|
||
|
{
|
||
|
name: '供温',
|
||
|
type: 'line',
|
||
|
smooth: true,
|
||
|
showSymbol: true,
|
||
|
// 矢量画五角星
|
||
|
symbol: 'path://M150 0 L80 175 L250 75 L50 75 L220 175 Z',
|
||
|
symbolSize: 12,
|
||
|
yAxisIndex: 0,
|
||
|
areaStyle: {
|
||
|
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
||
|
{ offset: 0, color: 'rgba(250,180,101,0.3)' },
|
||
|
{ offset: 1, color: 'rgba(250,180,101,0)' },
|
||
|
]),
|
||
|
shadowColor: 'rgba(250,180,101,0.2)',
|
||
|
shadowBlur: 20,
|
||
|
},
|
||
|
itemStyle: { color: '#FF8000' },
|
||
|
// data中可以使用对象,value代表相应的值,另外可加入自定义的属性
|
||
|
data: [
|
||
|
{ value: 1, stationName: 's1' },
|
||
|
{ value: 3, stationName: 's2' },
|
||
|
{ value: 4, stationName: 's3' },
|
||
|
{ value: 9, stationName: 's4' },
|
||
|
{ value: 3, stationName: 's5' },
|
||
|
{ value: 2, stationName: 's6' },
|
||
|
],
|
||
|
},
|
||
|
{
|
||
|
name: '回温',
|
||
|
type: 'line',
|
||
|
smooth: true,
|
||
|
showSymbol: true,
|
||
|
symbol: 'emptyCircle',
|
||
|
symbolSize: 12,
|
||
|
yAxisIndex: 0,
|
||
|
areaStyle: {
|
||
|
color: new echarts.graphic.LinearGradient(
|
||
|
0,
|
||
|
0,
|
||
|
0,
|
||
|
1,
|
||
|
[
|
||
|
{ offset: 0, color: 'rgba(199, 237, 250,0.5)' },
|
||
|
{ offset: 1, color: 'rgba(199, 237, 250,0.2)' },
|
||
|
],
|
||
|
false
|
||
|
),
|
||
|
},
|
||
|
itemStyle: {
|
||
|
color: '#3bbc86',
|
||
|
},
|
||
|
data: [
|
||
|
{ value: 31, stationName: 's1' },
|
||
|
{ value: 36, stationName: 's2' },
|
||
|
{ value: 54, stationName: 's3' },
|
||
|
{ value: 24, stationName: 's4' },
|
||
|
{ value: 73, stationName: 's5' },
|
||
|
{ value: 22, stationName: 's6' },
|
||
|
],
|
||
|
},
|
||
|
{
|
||
|
name: '压力值(Mpa)',
|
||
|
type: 'bar',
|
||
|
barWidth: 30,
|
||
|
yAxisIndex: 1,
|
||
|
itemStyle: {
|
||
|
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
||
|
{ offset: 0, color: 'rgba(108,80,243,0.3)' },
|
||
|
{ offset: 1, color: 'rgba(108,80,243,0)' },
|
||
|
]),
|
||
|
//柱状图圆角
|
||
|
borderRadius: [30, 30, 0, 0],
|
||
|
},
|
||
|
data: [
|
||
|
{ value: 11, stationName: 's1' },
|
||
|
{ value: 34, stationName: 's2' },
|
||
|
{ value: 54, stationName: 's3' },
|
||
|
{ value: 39, stationName: 's4' },
|
||
|
{ value: 63, stationName: 's5' },
|
||
|
{ value: 24, stationName: 's6' },
|
||
|
],
|
||
|
},
|
||
|
],
|
||
|
};
|
||
|
state.global.homeCharThree.setOption(option);
|
||
|
state.myCharts.push(state.global.homeCharThree);
|
||
|
};
|
||
|
// 批量设置 echarts resize
|
||
|
const initEchartsResizeFun = () => {
|
||
|
nextTick(() => {
|
||
|
for (let i = 0; i < state.myCharts.length; i++) {
|
||
|
setTimeout(() => {
|
||
|
state.myCharts[i].resize();
|
||
|
}, i * 1000);
|
||
|
}
|
||
|
});
|
||
|
};
|
||
|
// 批量设置 echarts resize
|
||
|
const initEchartsResize = () => {
|
||
|
window.addEventListener('resize', initEchartsResizeFun);
|
||
|
};
|
||
|
// 页面加载时
|
||
|
onMounted(() => {
|
||
|
initEchartsResize();
|
||
|
});
|
||
|
// 由于页面缓存原因,keep-alive
|
||
|
onActivated(() => {
|
||
|
initEchartsResizeFun();
|
||
|
});
|
||
|
// 监听 pinia 中的 tagsview 开启全屏变化,重新 resize 图表,防止不出现/大小不变等
|
||
|
watch(
|
||
|
() => isTagsViewCurrenFull.value,
|
||
|
() => {
|
||
|
initEchartsResizeFun();
|
||
|
}
|
||
|
);
|
||
|
// 监听 pinia 中是否开启深色主题
|
||
|
watch(
|
||
|
() => themeConfig.value.isIsDark,
|
||
|
(isIsDark) => {
|
||
|
nextTick(() => {
|
||
|
state.charts.theme = isIsDark ? 'dark' : '';
|
||
|
state.charts.bgColor = isIsDark ? 'transparent' : '';
|
||
|
state.charts.color = isIsDark ? '#dadada' : '#303133';
|
||
|
setTimeout(() => {
|
||
|
initLineChart();
|
||
|
}, 500);
|
||
|
setTimeout(() => {
|
||
|
initPieChart();
|
||
|
}, 700);
|
||
|
setTimeout(() => {
|
||
|
initBarChart();
|
||
|
}, 1000);
|
||
|
});
|
||
|
},
|
||
|
{
|
||
|
deep: true,
|
||
|
immediate: true,
|
||
|
}
|
||
|
);
|
||
|
</script>
|
||
|
|
||
|
<style scoped lang="scss">
|
||
|
$homeNavLengh: 8;
|
||
|
.home-container {
|
||
|
overflow: hidden;
|
||
|
.home-card-one,
|
||
|
.home-card-two,
|
||
|
.home-card-three {
|
||
|
.home-card-item {
|
||
|
width: 100%;
|
||
|
height: 130px;
|
||
|
border-radius: 4px;
|
||
|
transition: all ease 0.3s;
|
||
|
padding: 20px;
|
||
|
overflow: hidden;
|
||
|
background: var(--el-color-white);
|
||
|
color: var(--el-text-color-primary);
|
||
|
border: 1px solid var(--next-border-color-light);
|
||
|
&:hover {
|
||
|
box-shadow: 0 2px 12px var(--next-color-dark-hover);
|
||
|
transition: all ease 0.3s;
|
||
|
}
|
||
|
&-icon {
|
||
|
width: 70px;
|
||
|
height: 70px;
|
||
|
border-radius: 100%;
|
||
|
flex-shrink: 1;
|
||
|
i {
|
||
|
color: var(--el-text-color-placeholder);
|
||
|
}
|
||
|
}
|
||
|
&-title {
|
||
|
font-size: 15px;
|
||
|
font-weight: bold;
|
||
|
height: 30px;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
.home-card-one {
|
||
|
@for $i from 0 through 3 {
|
||
|
.home-one-animation#{$i} {
|
||
|
opacity: 0;
|
||
|
animation-name: error-num;
|
||
|
animation-duration: 0.5s;
|
||
|
animation-fill-mode: forwards;
|
||
|
animation-delay: calc($i/4) + s;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
.home-card-two,
|
||
|
.home-card-three {
|
||
|
.home-card-item {
|
||
|
height: 400px;
|
||
|
width: 100%;
|
||
|
overflow: hidden;
|
||
|
.home-monitor {
|
||
|
height: 100%;
|
||
|
.flex-warp-item {
|
||
|
width: 25%;
|
||
|
height: 111px;
|
||
|
display: flex;
|
||
|
.flex-warp-item-box {
|
||
|
margin: auto;
|
||
|
text-align: center;
|
||
|
color: var(--el-text-color-primary);
|
||
|
display: flex;
|
||
|
border-radius: 5px;
|
||
|
background: var(--next-bg-color);
|
||
|
cursor: pointer;
|
||
|
transition: all 0.3s ease;
|
||
|
&:hover {
|
||
|
background: var(--el-color-primary-light-9);
|
||
|
transition: all 0.3s ease;
|
||
|
}
|
||
|
}
|
||
|
@for $i from 0 through $homeNavLengh {
|
||
|
.home-animation#{$i} {
|
||
|
opacity: 0;
|
||
|
animation-name: error-num;
|
||
|
animation-duration: 0.5s;
|
||
|
animation-fill-mode: forwards;
|
||
|
animation-delay: calc($i/10) + s;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
</style>
|