Commit 0dcaefb2 authored by 沈翠玲's avatar 沈翠玲

大屏增加动态变化

parent 847ba784
...@@ -19,12 +19,18 @@ ...@@ -19,12 +19,18 @@
const load = ref(false); const load = ref(false);
const timer1 = ref(); const timer1 = ref();
const datas = ref({}); const datas = ref({});
const getRandomIntInclusive = (min, max) => {
const minCeiled = Math.ceil(min);
const maxFloored = Math.floor(max);
return Math.floor(Math.random() * (maxFloored - minCeiled + 1) + minCeiled);
}
const query = () => { const query = () => {
load.value = true; load.value = true;
getSecurityTotal().then(res=> { getSecurityTotal().then(res=> {
load.value = false; load.value = false;
if (res.success && res.result && res.result.length) { if (res.success && res.result && res.result.length) {
datas.value = res.result[0] datas.value.securityDays = (datas.value.securityDays || res.result[0].securityDays) + getRandomIntInclusive(0, 1)
datas.value.interceptAttackDays = (datas.value.interceptAttackDays || res.result[0].interceptAttackDays) + getRandomIntInclusive(0, 3)
} }
}) })
} }
......
<template> <template>
<div class="echarts"> <div class="echarts">
<ECharts :option="option" :resize="false" :onClick="onClick" /> <ECharts :option="option" :resize="false" :onClick="onClick" @mousemove="onMousemove" @mouseleave="onMouseleave" />
</div> </div>
</template> </template>
...@@ -297,6 +297,26 @@ ...@@ -297,6 +297,26 @@
} }
}); });
}; };
const onMousemove = () => {
if (timer.value) {
clearInterval(timer.value);
timer.value = null;
}
}
const onMouseleave = () => {
if (timer.value) {
clearInterval(timer.value);
timer.value = null;
}
timer.value = setInterval(() => {
dataZoom.value.startValue++;
if (dataZoom.value.endValue++ >= salvProName.value.length - 1) {
dataZoom.value.startValue = 0;
dataZoom.value.endValue = 3;
}
// chart?.setOption(option);
}, 1000);
}
query(); query();
timer1.value = setInterval(() => { timer1.value = setInterval(() => {
if (!load.value) { if (!load.value) {
......
<template> <template>
<div class="echarts"> <div class="echarts">
<ECharts :option="option" :resize="false" /> <ECharts :option="option" :resize="false" @mousemove="onMousemove" @mouseleave="onMouseleave"/>
</div> </div>
</template> </template>
...@@ -283,6 +283,26 @@ ...@@ -283,6 +283,26 @@
} }
}); });
}; };
const onMousemove = () => {
if (timer.value) {
clearInterval(timer.value);
timer.value = null;
}
}
const onMouseleave = () => {
if (timer.value) {
clearInterval(timer.value);
timer.value = null;
}
timer.value = setInterval(() => {
dataZoom.value.startValue++;
if (dataZoom.value.endValue++ >= salvProName.value.length - 1) {
dataZoom.value.startValue = 0;
dataZoom.value.endValue = 3;
}
// chart?.setOption(option);
}, 1000);
}
query(); query();
timer1.value = setInterval(() => { timer1.value = setInterval(() => {
if (!load.value) { if (!load.value) {
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
</template> </template>
<script setup> <script setup>
import ECharts from '@/components/ECharts/index.vue'; import ECharts from '@/components/ECharts/index.vue';
import echarts from '@/components/ECharts/config'; import echarts from '@/components/ECharts/config';
import { getAISecurityTotal } from '@/api/dataScreenMock'; import { getAISecurityTotal } from '@/api/dataScreenMock';
...@@ -13,11 +14,22 @@ ...@@ -13,11 +14,22 @@
const load = ref(false); const load = ref(false);
const timer1 = ref(); const timer1 = ref();
const datas = ref([]); const datas = ref([]);
const getRandomIntInclusive = (min, max) => {
const minCeiled = Math.ceil(min);
const maxFloored = Math.floor(max);
return Math.floor(Math.random() * (maxFloored - minCeiled + 1) + minCeiled);
}
const query = () => { const query = () => {
load.value = true; load.value = true;
getAISecurityTotal().then(res=> { getAISecurityTotal().then(res=> {
load.value = false; load.value = false;
if (res.success) { if (res.success) {
res.result.forEach(v => {
const num = (v.total + getRandomIntInclusive(-10, 20))
v.total = num < 0 ? 0 : num
const num1 = (v.newTotal + getRandomIntInclusive(-10, 50))
v.newTotal = num1 < 0 ? 0 : num1
})
datas.value = res.result datas.value = res.result
} }
}) })
......
...@@ -21,11 +21,20 @@ ...@@ -21,11 +21,20 @@
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAoCAYAAAAhf6DEAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAA6SURBVEhLY2x8/vY/A4mg3zwcTDOBSTLBqGYSwahmEsGoZhLBqGYSwahmEsGoZhLBqGYSwZDUzMAAAJldBMF2UASmAAAAAElFTkSuQmCC'; 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAoCAYAAAAhf6DEAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAA6SURBVEhLY2x8/vY/A4mg3zwcTDOBSTLBqGYSwahmEsGoZhLBqGYSwahmEsGoZhLBqGYSwZDUzMAAAJldBMF2UASmAAAAAElFTkSuQmCC';
var g_cellBarImg0_y = new Image(); var g_cellBarImg0_y = new Image();
g_cellBarImg0_y.src = g_cellBar0_y; g_cellBarImg0_y.src = g_cellBar0_y;
const getRandomIntInclusive = (min, max) => {
const minCeiled = Math.ceil(min);
const maxFloored = Math.floor(max);
return Math.floor(Math.random() * (maxFloored - minCeiled + 1) + minCeiled);
}
const query = () => { const query = () => {
load.value = true; load.value = true;
getNetTypeTotal().then(res=> { getNetTypeTotal().then(res=> {
load.value = false; load.value = false;
if (res.success) { if (res.success) {
res.result.forEach(v => {
const num = (v.value + getRandomIntInclusive(-3, 6))
v.value = num > 100 ? 100 : num < 0 ? 0 : num
})
datas.value = res.result datas.value = res.result
} }
}) })
......
...@@ -19,12 +19,18 @@ ...@@ -19,12 +19,18 @@
const load = ref(false); const load = ref(false);
const timer1 = ref(); const timer1 = ref();
const datas = ref({}); const datas = ref({});
const getRandomIntInclusive = (min, max) => {
const minCeiled = Math.ceil(min);
const maxFloored = Math.floor(max);
return Math.floor(Math.random() * (maxFloored - minCeiled + 1) + minCeiled);
}
const query = () => { const query = () => {
load.value = true; load.value = true;
getSecurityTotal().then(res=> { getSecurityTotal().then(res=> {
load.value = false; load.value = false;
if (res.success && res.result && res.result.length) { if (res.success && res.result && res.result.length) {
datas.value = res.result[0] datas.value.securityDays = (datas.value.securityDays || res.result[0].securityDays) + getRandomIntInclusive(0, 1)
datas.value.interceptAttackDays = (datas.value.interceptAttackDays || res.result[0].interceptAttackDays) + getRandomIntInclusive(0, 3)
} }
}) })
} }
......
<template> <template>
<div class="echarts"> <div class="echarts">
<ECharts :option="option" :resize="false" :onClick="onClick" /> <ECharts :option="option" :resize="false" :onClick="onClick" @mousemove="onMousemove" @mouseleave="onMouseleave" />
</div> </div>
</template> </template>
...@@ -297,6 +297,26 @@ ...@@ -297,6 +297,26 @@
} }
}); });
}; };
const onMousemove = () => {
if (timer.value) {
clearInterval(timer.value);
timer.value = null;
}
}
const onMouseleave = () => {
if (timer.value) {
clearInterval(timer.value);
timer.value = null;
}
timer.value = setInterval(() => {
dataZoom.value.startValue++;
if (dataZoom.value.endValue++ >= salvProName.value.length - 1) {
dataZoom.value.startValue = 0;
dataZoom.value.endValue = 3;
}
// chart?.setOption(option);
}, 1000);
}
query(); query();
timer1.value = setInterval(() => { timer1.value = setInterval(() => {
if (!load.value) { if (!load.value) {
......
<template> <template>
<div class="echarts"> <div class="echarts">
<ECharts :option="option" :resize="false" /> <ECharts :option="option" :resize="false" @mousemove="onMousemove" @mouseleave="onMouseleave"/>
</div> </div>
</template> </template>
...@@ -283,6 +283,26 @@ ...@@ -283,6 +283,26 @@
} }
}); });
}; };
const onMousemove = () => {
if (timer.value) {
clearInterval(timer.value);
timer.value = null;
}
}
const onMouseleave = () => {
if (timer.value) {
clearInterval(timer.value);
timer.value = null;
}
timer.value = setInterval(() => {
dataZoom.value.startValue++;
if (dataZoom.value.endValue++ >= salvProName.value.length - 1) {
dataZoom.value.startValue = 0;
dataZoom.value.endValue = 3;
}
// chart?.setOption(option);
}, 1000);
}
query(); query();
timer1.value = setInterval(() => { timer1.value = setInterval(() => {
if (!load.value) { if (!load.value) {
......
...@@ -13,11 +13,22 @@ ...@@ -13,11 +13,22 @@
const load = ref(false); const load = ref(false);
const timer1 = ref(); const timer1 = ref();
const datas = ref([]); const datas = ref([]);
const getRandomIntInclusive = (min, max) => {
const minCeiled = Math.ceil(min);
const maxFloored = Math.floor(max);
return Math.floor(Math.random() * (maxFloored - minCeiled + 1) + minCeiled);
}
const query = () => { const query = () => {
load.value = true; load.value = true;
getAISecurityTotal().then(res=> { getAISecurityTotal().then(res=> {
load.value = false; load.value = false;
if (res.success) { if (res.success) {
res.result.forEach(v => {
const num = (v.total + getRandomIntInclusive(-10, 20))
v.total = num < 0 ? 0 : num
const num1 = (v.newTotal + getRandomIntInclusive(-10, 50))
v.newTotal = num1 < 0 ? 0 : num1
})
datas.value = res.result datas.value = res.result
} }
}) })
......
...@@ -21,11 +21,20 @@ ...@@ -21,11 +21,20 @@
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAoCAYAAAAhf6DEAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAA6SURBVEhLY2x8/vY/A4mg3zwcTDOBSTLBqGYSwahmEsGoZhLBqGYSwahmEsGoZhLBqGYSwZDUzMAAAJldBMF2UASmAAAAAElFTkSuQmCC'; 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAoCAYAAAAhf6DEAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAA6SURBVEhLY2x8/vY/A4mg3zwcTDOBSTLBqGYSwahmEsGoZhLBqGYSwahmEsGoZhLBqGYSwZDUzMAAAJldBMF2UASmAAAAAElFTkSuQmCC';
var g_cellBarImg0_y = new Image(); var g_cellBarImg0_y = new Image();
g_cellBarImg0_y.src = g_cellBar0_y; g_cellBarImg0_y.src = g_cellBar0_y;
const getRandomIntInclusive = (min, max) => {
const minCeiled = Math.ceil(min);
const maxFloored = Math.floor(max);
return Math.floor(Math.random() * (maxFloored - minCeiled + 1) + minCeiled);
}
const query = () => { const query = () => {
load.value = true; load.value = true;
getNetTypeTotal().then(res=> { getNetTypeTotal().then(res=> {
load.value = false; load.value = false;
if (res.success) { if (res.success) {
res.result.forEach(v => {
const num = (v.value + getRandomIntInclusive(-3, 6))
v.value = num > 100 ? 100 : num < 0 ? 0 : num
})
datas.value = res.result datas.value = res.result
} }
}) })
......
...@@ -108,8 +108,12 @@ ...@@ -108,8 +108,12 @@
tooltip: { tooltip: {
trigger: 'axis', trigger: 'axis',
confine: true, confine: true,
hideDelay: 200, // 浮层隐藏的延迟 // showDelay: 1000, // 浮层隐藏的延迟
hideDelay: 10000000, // 浮层隐藏的延迟
enterable: true, enterable: true,
// triggerOn: 'click',
renderMode: 'html',
transitionDuration: 0.9,
formatter: (params) => { formatter: (params) => {
let tipData = params[0]; let tipData = params[0];
let html = `<div style="height: auto;max-height: 170px;overflow-y: auto;">${tipData.name}${props.dayActiveName === '日' ? ':00' : ''} <i >${tipData.value}</i> 个<br/>`; let html = `<div style="height: auto;max-height: 170px;overflow-y: auto;">${tipData.name}${props.dayActiveName === '日' ? ':00' : ''} <i >${tipData.value}</i> 个<br/>`;
...@@ -126,9 +130,12 @@ ...@@ -126,9 +130,12 @@
} }
return html; return html;
}, },
position: (point) => {
return [point[0], '10%'];
},
// backgroundColor: "transparent", // backgroundColor: "transparent",
// borderColor: "transparent", // borderColor: "transparent",
axisPointer: { lineStyle: { type: 'dashed' }, snap: true }, axisPointer: { lineStyle: { type: 'dashed' } },
// extraCssText: "box-shadow: none;padding:0" // extraCssText: "box-shadow: none;padding:0"
}, },
grid: { grid: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment