Browse Source

首页屏幕动画渲染

main
parent
commit
e8c3199c88
  1. 8
      src/components/datav/chart-bar.vue
  2. 197
      src/views/datav/Gobal.vue
  3. 2
      src/views/datav/SceneInsp.vue
  4. 1
      src/views/datav/VideoInsp.vue
  5. 19
      src/views/datav/subonedatav/SubOneGlobal.vue

8
src/components/datav/chart-bar.vue

@ -107,6 +107,7 @@ function getColor(val) {
}
if (props.color instanceof Array) {
const colors = [...props.color];
// percentage
colors.sort((a, b) => b.percentage - a.percentage);
for (let i = 0; i < colors.length; i++) {
if (val > colors[i].percentage) {
@ -135,11 +136,16 @@ function getColor(val) {
.bar-item_content {
.bar-item_content-bar {
height: 13px;
}
}
}
&[size="bigNumber"] {
.bar-item_content {
width: calc(100% - var(--label-width) - 16px - 100px);
}
}
&[size="small"] {
font-size: 12px;

197
src/views/datav/Gobal.vue

@ -9,13 +9,14 @@
<datav-tabs
v-model="activeOrgTab"
type="bottom-button"
@mouseenter.native="handleMouseEnter"
@mouseleave.native="handleMouseLeave"
>
<datav-tab-item label="分县市局" name="1">
<el-scrollbar height="340px">
<datav-chart-bar
:data="fxsjlist"
size="large"
:max="11"
size="bigNumber"
:color="colors"
/>
</el-scrollbar>
@ -25,7 +26,7 @@
<datav-chart-bar
:data="jsdwlist"
:max="11"
size="large"
size="bigNumber"
:color="colors"
/>
</el-scrollbar>
@ -35,8 +36,9 @@
<datav-card title="业务类型占比">
<v-charts
style="height: 360px;"
:option="zfbaPieOption"
:option="ywlxPieOption"
autoresize
ref="ywlxzbOption"
/>
</datav-card>
</el-col>
@ -124,6 +126,7 @@
style="height: 370px;"
:option="wtlxPieOption"
autoresize
ref="wtlxzbOption"
/>
</datav-card>
@ -131,7 +134,6 @@
</el-row>
</main>
</div>
</el-scrollbar>
</template>
@ -152,10 +154,11 @@ import {
// region
const router = useRouter();
const fxsjlist = ref([{}]); //
const fxsjlist = ref([{
label: "天心分局",
value: 99999
}]); //
const jsdwlist = ref([]); //
const ywzblist = ref([]); //
const wtlxlist = ref([]); //
const tcwtlist = ref([]); //
const overview = ref({
totalPro: 0,
@ -201,50 +204,49 @@ const colors = [
const activeOrgTab = ref("1");
const globalMap = ref(null)
const globalTrend=ref(null)
const globalTrend = ref(null)
const ywlxzbOption = ref(null)
const wtlxzbOption = ref(null)
let cardIntervalId;
let wtlxPieCircularIntervalId; //
let globalMapIntervalId; //
let globalTrendIntervalId; //
let ywlxPieCircularIntervalId; //
// endregion
// region
//
const zfbaPieOption = computed(() => {
return {
tooltip: {
trigger: "item",
},
series: [
{
type: "pie",
radius: ["40%", "70%"],
label: {
color: "#fff",
},
data: ywzblist.value,
const ywlxPieOption = ref({
series: [
{
type: "pie",
radius: ["40%", "70%"],
label: {
color: "#fff",
},
],
};
data: [],
},
],
tooltip: {
trigger: "item",
},
});
//
const wtlxPieOption = computed(() => {
return {
tooltip: {
trigger: "item",
},
series: [
{
type: "pie",
radius: ["40%", "70%"],
label: {
color: "#fff",
},
data: wtlxlist.value,
const wtlxPieOption = ref({
series: [
{
type: "pie",
radius: ["40%", "70%"],
label: {
color: "#fff",
},
],
};
data: [],
},
],
tooltip: {
trigger: "item",
},
});
//
echarts.registerMap("changsha", changshaMap);
const option = ref({
geo: {
@ -415,16 +417,14 @@ const getOrganizationRankData = async (timeValue = time.value) => {
fxsjlist.value = res.fxsjlist;
jsdwlist.value = res.jsdwlist;
}
const getBusinessRateData = async (timeValue = time.value) => {
const res = await getBusinessRate(timeValue);
ywzblist.value = res.ywzblist;
ywlxPieOption.value.series[0].data = res.ywzblist;
}
const getAllGlobalCountData = async (timeValue = time.value) => {
const res = await getAllGlobalCount(timeValue);
overview.value = res.overview;
}
const getGlobalMapData = async (timeValue = time.value) => {
const res = await getGlobalMap(timeValue);
const mappedData = res.globalTempMapVoList.map(item => {
@ -471,18 +471,20 @@ const getGlobalMapData = async (timeValue = time.value) => {
value: item.totalPro,
};
});
const total = mappedData.reduce((sum, item) => sum + Number(item.value), 0);
const avg = total / mappedData.length; //
const range30Percent = avg * 0.3 //
//
const maxItem = mappedData.reduce((max, item) => (Number(item.value) > Number(max.value) ? item : max), mappedData[0]);
const range40Percent = maxItem.value * 0.4 //
const range60Percent = maxItem.value * 0.6 //
const range80Percent = maxItem.value * 0.8 //
globalTempMapVoList.value = mappedData;
option.value.series[0].data = globalTempMapVoList;
console.log(range40Percent, range60Percent, range80Percent);
option.value.visualMap.pieces = [
{gte: 0, lte: avg - range30Percent, label: "低于平均问题30%", color: "#4987F6"},
{gte: avg - range30Percent, lte: avg + range30Percent + 0.1, label: "平均问题上下浮动30%内", color: "#F6A149"},
{gte: avg + range30Percent, label: "高于平均问题30%", color: "#D34343"},
{gte: 0, lte: range40Percent, label: "低于最大问题的40%", color: "#4987F6"},
{gte: range40Percent, lte: range60Percent, label: "平均问题上下浮动30%内", color: "#F6A149"},
{gte: range80Percent, label: "高于平均问题30%", color: "#D34343"},
];
}
const getGlobalTrendData = async (year = selectedYear.value) => {
const res = await getGlobalTrend(year);
const globalRecentlyTrendList = res.globalRecentlyTrendList;
@ -496,13 +498,11 @@ const getStrongProblemRateData = async (timeValue = time.value) => {
const res = await getStrongProblemRate(timeValue);
tcwtlist.value = res.tcwtlist;
}
const getProblemBusinessRateData = async (timeValue = time.value) => {
const res = await getProblemBusinessRate(timeValue);
wtlxlist.value = res.wtlxlist;
wtlxPieOption.value.series[0].data = res.wtlxlist;
}
function getData() {
getOrganizationRankData();
getBusinessRateData();
@ -513,10 +513,26 @@ function getData() {
getProblemBusinessRateData();
}
onMounted(() => {
getData();
cardAnimation();
setupEventListeners();
});
// endregion
// region
//
const cardAnimation = () => {
activeOrgTab.value = (parseInt(activeOrgTab.value) % 2 + 1).toString();
setTimeout(cardAnimation, 3000);
cardIntervalId = setTimeout(cardAnimation, 3000);
};
const handleMouseEnter = () => {
clearInterval(cardIntervalId)
};
const handleMouseLeave = () => {
cardIntervalId = setTimeout(() => {
cardAnimation();
}, 3000);
};
//
@ -544,7 +560,7 @@ const mapAnimation = () => {
globalMapIntervalId = setInterval(mapAnimation, 2000);
//
const GlobalTrendAnimation = () => {
const globalTrendAnimation = () => {
const myGlobalTrend = globalTrend?.value?.chart;
if (!myGlobalTrend) return;
const randomNum = Math.floor(Math.random() * 12);
@ -554,18 +570,31 @@ const GlobalTrendAnimation = () => {
dataIndex: randomNum,
});
}
globalTrendIntervalId = setInterval(GlobalTrendAnimation, 2000);
onMounted(() => {
getData();
cardAnimation();
setupEventListeners();
});
globalTrendIntervalId = setInterval(globalTrendAnimation, 2000);
//
const yelxzbCircularAnimation = () => {
const ywlxzbOptionTemp = ywlxzbOption?.value?.chart;
if (!ywlxzbOptionTemp) return;
const length = ywlxPieOption.value.series[0].data.length;
const randomNum = Math.floor(Math.random() * length);
ywlxzbOptionTemp?.dispatchAction({type: 'downplay', seriesIndex: 0});
ywlxzbOptionTemp?.dispatchAction({type: 'highlight', seriesIndex: 0, dataIndex: randomNum}); //
ywlxzbOptionTemp?.dispatchAction({type: 'showTip', seriesIndex: 0, dataIndex: randomNum});
};
ywlxPieCircularIntervalId = setInterval(yelxzbCircularAnimation, 2000);
//
const wtlxzbCircularAnimation = () => {
const wtlxzbOptionTemp = wtlxzbOption?.value?.chart;
if (!wtlxzbOptionTemp) return;
const length = ywlxPieOption.value.series[0].data.length;
const randomNum = Math.floor(Math.random() * length);
wtlxzbOptionTemp?.dispatchAction({type: 'downplay', seriesIndex: 0});
wtlxzbOptionTemp?.dispatchAction({type: 'highlight', seriesIndex: 0, dataIndex: randomNum}); //
wtlxzbOptionTemp?.dispatchAction({type: 'showTip', seriesIndex: 0, dataIndex: randomNum});
};
wtlxPieCircularIntervalId = setInterval(wtlxzbCircularAnimation, 2000);
// endregion
// region ||
@ -587,22 +616,46 @@ const handleClick = (params) => {
}).href;
window.open(url, "_blank");
}
//
//
const setupEventListeners = () => {
const ywlxzbOptionTemp = ywlxzbOption?.value?.chart;
ywlxzbOptionTemp.on('mousemove', (e) => {
clearInterval(ywlxPieCircularIntervalId);
ywlxzbOptionTemp.dispatchAction({type: "downplay", seriesIndex: 0,});
ywlxzbOptionTemp.dispatchAction({type: "highlight", seriesIndex: 0, dataIndex: e.dataIndex,});
ywlxzbOptionTemp.dispatchAction({type: "showTip", seriesIndex: 0, dataIndex: e.dataIndex,});
})
ywlxzbOptionTemp.on('mouseout', () => {
clearInterval(ywlxPieCircularIntervalId);
ywlxPieCircularIntervalId = setInterval(yelxzbCircularAnimation, 2000);
});
const myGlobalMap = globalMap.value.chart;
//
myGlobalMap.on('mousemove', (e) => {
clearInterval(globalMapIntervalId);
myGlobalMap.dispatchAction({type: "downplay", seriesIndex: 0,});
myGlobalMap.dispatchAction({type: "highlight", seriesIndex: 0, dataIndex: e.dataIndex,});
myGlobalMap.dispatchAction({type: "showTip", seriesIndex: 0, dataIndex: e.dataIndex,});
});
//
myGlobalMap.on('mouseout', () => {
clearInterval(globalMapIntervalId); //
globalMapIntervalId = setInterval(mapAnimation, 2000);
});
const wtlxzbOptionTemp = wtlxzbOption?.value?.chart;
wtlxzbOptionTemp.on('mousemove', (e) => {
clearInterval(wtlxPieCircularIntervalId);
wtlxzbOptionTemp.dispatchAction({type: "downplay", seriesIndex: 0,});
wtlxzbOptionTemp.dispatchAction({type: "highlight", seriesIndex: 0, dataIndex: e.dataIndex,});
wtlxzbOptionTemp.dispatchAction({type: "showTip", seriesIndex: 0, dataIndex: e.dataIndex,});
})
wtlxzbOptionTemp.on('mouseout', () => {
clearInterval(wtlxPieCircularIntervalId);
wtlxPieCircularIntervalId = setInterval(wtlxzbCircularAnimation, 2000);
})
};
// endregion

2
src/views/datav/SceneInsp.vue

@ -1287,7 +1287,7 @@ const sceneInspMapAnimation = () => {
sceneInspMapIntervalId = setInterval(sceneInspMapAnimation, 2000);
const SceneInspTrendAnimation = () => {
const mySceneInspProTrend = sceneInspProTrend.value.chart;
const mySceneInspProTrend = sceneInspProTrend?.value?.chart;
if (!mySceneInspProTrend) return;
const randomNum = Math.floor(Math.random() * 12);
mySceneInspProTrend.dispatchAction({

1
src/views/datav/VideoInsp.vue

@ -233,6 +233,7 @@ const years = ref([currentYear.toString(), (currentYear - 1).toString(), (curren
const selectedYear = ref(currentYear); //
const videoMap = ref(null);
let videoMapIntervalId;
let sceneInspTrendIntervalId;
const colors = [
{
color: "linear-gradient( 270deg, #FB002D 0%, #822232 100%)",

19
src/views/datav/subonedatav/SubOneGlobal.vue

@ -80,6 +80,7 @@
:option="option"
autoresize
ref="subOneGlobalMap"
@click="handleClick"
/>
<div>
@ -129,6 +130,7 @@
</el-row>
</main>
</div>
<negative-info-depart-dialog v-model="show" :departId="tempDepartId" />
</el-scrollbar>
</template>
@ -149,6 +151,9 @@ import {
} from "@/api/screen/subScreen/subOneGlobal.ts";
// region
const show = ref(false); //
const tempDepartId = ref(0); // id
const router = useRouter();
const route = useRoute();
const currentMapData = ref({})
@ -191,7 +196,7 @@ const colors = [
percentage: 40,
},
];
let subOneGlobalMapIntervalId ; //
let subOneGlobalMapIntervalId ;
// endregion
@ -469,7 +474,7 @@ const cardAnimation = () => {
//
const mapAnimation = () => {
const mySubOneGlobalMap = subOneGlobalMap.value.chart;
const mySubOneGlobalMap = subOneGlobalMap?.value?.chart;
if (!mySubOneGlobalMap) return;
// 9 0~8ok
const tempNum = currentMapData?.value?.geoJson?.features?.length
@ -525,6 +530,16 @@ const setupEventListeners = () => {
subOneGlobalMapIntervalId = setInterval(mapAnimation, 2000);
});
};
const handleClick = (params) => {
const departId = params.data.departId;
show.value = true;
tempDepartId.value=2661
console.log(subOneGlobalMapIntervalId);
clearInterval(subOneGlobalMapIntervalId);
// alert(departId)
}
// endregion

Loading…
Cancel
Save