数字督察一体化平台-前端
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.
 
 
 
 

781 lines
24 KiB

<template>
<el-scrollbar height="100vh">
<div class="wrapper">
<sub-one-header :depart-id="currentDepartId"></sub-one-header>
<main>
<el-row :gutter="16">
<el-col :span="6">
<datav-card title="机构问题排名" sub-title="问题数">
<datav-tabs
v-model="activeOrgTab"
type="bottom-button"
@mouseenter.native="handleMouseEnter"
@mouseleave.native="handleMouseLeave"
ref="subOneCard"
>
<datav-tab-item label="派出所" name="1">
<el-scrollbar height="340px">
<datav-chart-bar
:data="fxsjlist"
size="large"
:max="11"
:color="colors"
/>
</el-scrollbar>
</datav-tab-item>
<datav-tab-item label="大队" name="2">
<el-scrollbar height="340px">
<datav-chart-bar
:data="jsdwlist"
:max="11"
size="large"
:color="colors"
/>
</el-scrollbar>
</datav-tab-item>
</datav-tabs>
</datav-card>
<datav-card title="业务类型占比">
<v-charts
style="height: 360px;"
:option="ywlxPieOption"
autoresize
ref="subOneYwlxzbOption"
/>
</datav-card>
</el-col>
<el-col :span="12">
<datav-date-picker v-model="time"/>
<div class="flex gap-42">
<datav-statistic
:value="overviewData.supervisionPro"
:title="`现场督察`"
style="width: 20%;"
/>
<datav-statistic
:value="overviewData.numSupervisionPro"
:title="`数字督察`"
style="width: 20%;"
/>
<datav-statistic
:value="overviewData.caseVerificationPro"
:title="`案件核查`"
style="width: 20%; margin-left: 10px"
/>
<datav-statistic
:value="overviewData.mailboxNumber"
:title="`局长信箱`"
style="width: 20%; margin-left: 10px"
/>
<datav-statistic
:value="overviewData.complaintPro"
:title="`信访投诉`"
style="width: 20%; margin-left: 10px"
/>
<datav-statistic
:value="overviewData.auditPro"
:title="`审计项目`"
style="width: 20%; margin-left: 10px"
/>
</div>
<div id="map">
<v-charts
style="height: 360px"
:option="option"
autoresize
ref="subOneGlobalMap"
@click="handleClick"
/>
</div>
<div>
<datav-card title="问题趋势">
<v-charts
style="height: 280px;"
:option="proTrend"
autoresize
ref="subOneGlobalTrend"
/>
<div class="gobal-dropdown-container">
<el-dropdown class="test" @command="handleCommand">
<span class="el-dropdown-link my-gobal-yearselect">
{{ selectedYear + " 年" }}
</span>
<template #dropdown>
<el-dropdown-menu style="width: 90px">
<el-dropdown-item v-for="year in years" :key="year" :command="year">{{ year + " 年" }}
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
</datav-card>
</div>
</el-col>
<el-col :span="6">
<datav-card title="突出问题排名" sub-title="问题数">
<el-scrollbar height="390px">
<datav-chart-bar-pro
:data="tcwtlist"
size="small"
:color="colors"
/>
</el-scrollbar>
</datav-card>
<datav-card title="问题涉及方面分布">
<v-charts
style="height: 370px;"
:option="wtlxPieOption"
autoresize
ref="subOneWtlxzbOption"
/>
</datav-card>
</el-col>
</el-row>
</main>
</div>
<negative-info-depart-dialog v-model="showDialog" :departId="tempDepartId"/>
<!-- <negative-info-police-dialog v-model="showDialog" :emp-no="tempPolice"/>-->
</el-scrollbar>
</template>
<script setup>
import vCharts from "vue-echarts";
import changshaMap from "@/assets/data/changsha.json";
import * as echarts from "echarts/core";
import moment from "moment/moment";
import {
getSubOneStreetMap,
getSubOneAllCount,
getSubOneBusinessRate,
getSubOneOrganizationRank,
getSubOneProblemBusinessRate,
getSubOneStrongProblemRate,
getSubOneGlobalTrend, getSubOneGlobalMap
} from "@/api/screen/subScreen/subOneGlobal.ts";
import SubOneHeader from "@/components/datav/subOne/subOneHeader.vue";
// region 各种变量
const showDialog = ref(false); // 负面信息弹窗显示
const tempDepartId = ref(0); // 临时部门id
const tempPolice = ref(0)
// setTimeout(() => {
// tempPolice.value = 430426
// }, 3000);
const route = useRoute();
const currentMapData = ref({})
const subOneGlobalMap = ref(null); // 地图
let currentDepartId = route.query.departId;
import useUserStore from "@/stores/modules/user";
const userStore = useUserStore();
watch(()=>route.query.departId,(newVal)=>{
debugger
console.log('newValue',newVal)
if(newVal!= null){
currentDepartId = newVal
}else{
currentDepartId=userStore.user.authDepartIds[0];
}
},{immediate:true})
const fxsjlist = ref([]); // 分县市区机构问题排名
const jsdwlist = ref([]); // 局属单位机构问题排名
const ywzblist = ref([]); // 业务类型占比
const wtlxlist = ref([]); // 问题涉及方面分布
const tcwtlist = ref([]);// 突出问题排名
let overviewData = ref({
totalPro: 0,
supervisionPro: 0,
numSupervisionPro:0,
caseVerificationPro: 0,
complaintPro: 0,
talkPro: 0,
auditPro: 0,
mailboxNumber: 0
}) // 中央的概况数据
const time = ref([
moment().startOf("year").format("YYYY-MM-DD"),
moment().format("YYYY-MM-DD"),
]);
const globalTempMapVoList = ref([]); // 地图临时数据
const currentYear = new Date().getFullYear();
const years = ref([currentYear.toString(), (currentYear - 1).toString(), (currentYear - 2).toString()]); // 年份列表
const selectedYear = ref(currentYear); // 当前选中的年份
const colors = [
{
color: "linear-gradient( 270deg, #FB002D 0%, #822232 100%)",
percentage: 80,
},
{
color: "linear-gradient( 270deg, #FFB90E 0%, #71501D 100%)",
percentage: 60,
},
{
color: "linear-gradient( 270deg, #63E700 0%, #19674C 100%)",
percentage: 0,
},
];
const activeOrgTab = ref("1");
const subOneCard = ref(null);
const globalMap = ref(null)
const subOneGlobalTrend = ref(null)
const subOneYwlxzbOption = ref(null)
const subOneWtlxzbOption = ref(null)
let subOneCardIntervalId;
let subOneYwlxPieCircularIntervalId; // 业务类型占比定时器
let subOneGlobalMapIntervalId; // 地图定时器
let subOneGlobalTrendIntervalId; // 问题趋势定时器
let subOneWtlxPieCircularIntervalId; // 问题涉及方面分布定时器
// endregion
// region 图表变量
// 业务类型占比
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,
},
],
};
});
// 地图
echarts.registerMap("changsha", changshaMap);
const option = ref({
tooltip: {
trigger: 'item',
position: 'bottom',
formatter: function (params) {
const dataItem = globalTempMapVoList.value.find(item => item.name === params.name) || {}; // 找到对应的数据项
console.log("Data item:", dataItem);
if (dataItem.name === params.name) {
return `
<div class="tooltip">
<div class="tooltip-title">${params.name.replace(/街道$/, "")}</div>
<div class="tooltip-content">
<ul class="tooltip-ul" >
<li>现场督察 <span>${dataItem.supervisePro || 0}</span></li>
<li>数字督察 <span>${dataItem.numSupervisionPro || 0}</span></li>
<li>案件核查<span>${dataItem.caseVerificationPro || 0}</span></li>
<li>局长信箱 <span>${dataItem.mailboxNumber || 0}</span></li>
<li>信访投诉 <span>${dataItem.complaintPro || 0}</span></li>
<li>审计项目 <span>${dataItem.auditPro || 0}</span></li>
</ul>
</div>
</div>
</div>`;
} else {
return `
<div class="tooltip">
<div class="tooltip-title">${params.name.replace(/街道$/, "")}</div>
<div class="tooltip-content">
<ul class="tooltip-ul" >
<li>现场督察 <span>-</span></li>
<li>数字督察 <span>-</span></li>
<li>案件核查<span>-</span></li>
<li>局长信箱 <span>-</span></li>
<li>信访投诉 <span>-</span></li>
<li>审计项目 <span>-</span></li>
</ul>
</div>
</div>
</div>`;
}
},
borderWidth: 0, // 设置边框宽度为1像素
borderRadius: 3, // 设置边框半径为3像素
shadowBlur: 0, // 设置阴影模糊程度为8像素
shadowOffsetX: 0, // 设置水平阴影位移量为0像素
shadowOffsetY: 0, // 设置垂直阴影位移量为6像素
},
visualMap: {
type: "piecewise",
bottom: 10,
pieces: [
{gte: 0, lte: 200, label: "低于平均问题30%", color: "#4987F6"},
{gte: 200, lte: 400, label: "平均问题上下浮动30%内", color: "#F6A149"},
{gte: 400, label: "高于平均问题30%", color: "#D34343"},],
right: 10,
realtime: false,
orient: "horizontal",
textStyle: {
color: "#fff",
},
calculable: true,
inRange: {
color: ["#4987F6", "#F6A149", "#D34343"],
},
},
series: [
{
name: "长沙",
type: "map",
map: "changsha",
hoverAnimation: true,
roam: true,
label: {
formatter: (params) => params.name.replace(/街道$/, ""),
show: true,
color: "white",
},
itemStyle: {
normal: {
areaColor: "#02215E",
borderColor: "#24D2EE",
borderWidth: 1, // 高亮时边框宽度
opacity: 1 // 设置透明度
},
},
emphasis: {
areaColor: "#FFD700", // 高亮时区域颜色
borderColor: "#FF0000", // 高亮时边框颜色
borderWidth: 4 // 高亮时边框宽度
},
data: []
}
],
})
// 问题趋势线状图
const proTrend = ref({
grid: {
left: '5%', // 图表距离容器左边的距离
right: '2%', // 图表距离容器右边的距离
top: '10%', // 图表距离容器上边的距离
bottom: '20%', // 图表距离容器下边的距离
containLabel: false // 是否包含坐标轴的标签
},
xAxis: {
type: "category",
data: [],
boundaryGap: true,
axisTick: {
// 去掉X轴刻度线
show: false
},
},
yAxis: {
type: "value",
splitLine: {
show: true,
lineStyle: {
color: "#193775",
},
}
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'line',
label: {
backgroundColor: '#6a7985'
}
}
},
series: [
{
type: "line",
smooth: true,
label: {
show: false
},
lineStyle: {
color: "#28E6FF",
width: 4,
},
areaStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: "rgba(40,230,255,0.47)", // 渐变起始颜色
},
{
offset: 1,
color: "rgba(40,230,255,0)", // 渐变结束颜色
},
]),
},
data: [],
},
],
});
// endregion
// region 所有函数
const getMapJSON = async (departId = currentDepartId) => {
const res = await getSubOneStreetMap(departId);
currentMapData.value = res;
echarts.registerMap("changsha", res);
subOneGlobalMap.value.chart.setOption(option.value);
}
const getOrganizationProRankData = async () => {
const body={
departId: currentDepartId,
beginTime: time.value[0],
endTime: time.value[1]
}
const res = await getSubOneOrganizationRank(body);
fxsjlist.value = res.fxsjlist;
jsdwlist.value = res.jsdwlist;
}
const getBusinessRateData = async (departId = currentDepartId, timeValue = time.value) => {
const res = await getSubOneBusinessRate(departId, timeValue);
ywlxPieOption.value.series[0].data = res.ywzblist;
}
const getAllGlobalCountData = async () => {
const body={
departId: currentDepartId,
beginTime: time.value[0],
endTime: time.value[1]
}
const res = await getSubOneAllCount(body);
overviewData.value = res.overview;
}
const getSubOneGlobalMapIcon = async () => {
const body={
departId: currentDepartId,
beginTime: time.value[0],
endTime: time.value[1]
}
const res = await getSubOneGlobalMap(body)
const mappedData = res.globalTempMapVoList.map(item => {
return {
...item,
value: item.totalPro,
};
});
const maxItem = mappedData.reduce((max, item) => (Number(item.value) > Number(max.value) ? item : max), mappedData[0]);
const range60Percent = maxItem.value * 0.6 // 不用取整,小数也可以
const range80Percent = maxItem.value * 0.8 // 不用取整,小数也可以
globalTempMapVoList.value = mappedData;
console.log('globalTempMapVoList', globalTempMapVoList.value)
option.value.series[0].data = globalTempMapVoList;
option.value.visualMap.pieces = [
{gte: 0, lte: range60Percent, label: "低于最大问题的60%", color: "#4987F6"},
{gte: range60Percent, lte: range80Percent, label: "介于最大问题的60%~80%", color: "#F6A149"},
{gte: range80Percent, label: "高于最大问题80%", color: "#D34343"},
];
}
const getSubOneGlobalTrendData = async (departId = currentDepartId, year) => {
const res = await getSubOneGlobalTrend(departId, year);
const categories = res.globalRecentlyTrendList.map(item => item.name);
const values = res.globalRecentlyTrendList.map(item => item.value);
// 更新图表数据
proTrend.value.xAxis.data = categories;
proTrend.value.series[0].data = values;
}
const getSubOneStrongProblemRateData = async (departId = currentDepartId, timeValue = time.value) => {
const res = await getSubOneStrongProblemRate(departId, timeValue);
tcwtlist.value = res.tcwtlist;
}
const getSubOneProblemBusinessRateData = async (departId = currentDepartId, timeValue = time.value) => {
const res = await getSubOneProblemBusinessRate(departId, timeValue);
wtlxlist.value = res.wtlxlist;
}
const getData = () => {
debugger
if(currentDepartId == null){
currentDepartId=userStore.user.authDepartIds[0];
console.log(userStore)
}
console.log('currentDepartId',currentDepartId)
getOrganizationProRankData();
getBusinessRateData(currentDepartId, time.value);
getAllGlobalCountData();
getSubOneGlobalMapIcon();
getSubOneGlobalTrendData(currentDepartId, selectedYear.value);
getSubOneStrongProblemRateData(currentDepartId, time.value);
getSubOneProblemBusinessRateData(currentDepartId, time.value);
getMapJSON(currentDepartId);
};
// endregion
// region 动画
// 卡片动画
const subOneCardAnimation = () => {
activeOrgTab.value = (parseInt(activeOrgTab.value) % 2 + 1).toString();
subOneCardIntervalId = setTimeout(subOneCardAnimation, 3000);
};
const handleMouseEnter = () => {
clearInterval(subOneCardIntervalId)
};
const handleMouseLeave = () => {
subOneCardIntervalId = setTimeout(() => {
subOneCardAnimation();
}, 3000);
};
//todo 业务类型占比环形图
const subOneYwlxzbCircularAnimation = () => {
const ywlxzbOptionTemp = subOneYwlxzbOption?.value?.chart;
// ywzblist.value
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});
};
subOneYwlxPieCircularIntervalId = setInterval(subOneYwlxzbCircularAnimation, 2000);
//地图动画
const subOneMapAnimation = () => {
const mySubOneGlobalMap = subOneGlobalMap?.value?.chart;
if (!mySubOneGlobalMap) return;
// 来个随机数,9个图 0~8的整数就ok
const tempNum = currentMapData?.value?.geoJson?.features?.length
const randomNum = Math.floor(Math.random() * tempNum);
mySubOneGlobalMap.dispatchAction({
type: "downplay", //downplay 取消高亮
seriesIndex: 0,
});
mySubOneGlobalMap.dispatchAction({
type: "highlight", //highLight 高亮指定的数据图形
seriesIndex: 0, //系列index
dataIndex: randomNum, //数据index
});
mySubOneGlobalMap.dispatchAction({
type: "showTip", //showTip 显示提示框
seriesIndex: 0,
dataIndex: randomNum,
});
};
// 启动定时器,每隔 2 秒执行一次
subOneGlobalMapIntervalId = setInterval(subOneMapAnimation, 2000);
// 趋势动画
const subOneGlobalTrendAnimation = () => {
const myGlobalTrend = subOneGlobalTrend?.value?.chart;
if (!myGlobalTrend) return;
const randomNum = Math.floor(Math.random() * 12);
myGlobalTrend.dispatchAction({
type: 'showTip',
seriesIndex: 0,
dataIndex: randomNum,
});
}
subOneGlobalTrendIntervalId = setInterval(subOneGlobalTrendAnimation, 2000);
// 问题涉及方面分布环形图
const subOneWtlxzbCircularAnimation = () => {
const wtlxzbOptionTemp = subOneWtlxzbOption?.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});
};
subOneWtlxPieCircularIntervalId = setInterval(subOneWtlxzbCircularAnimation, 2000);
onMounted(() => {
getData();
setupEventListeners();
selectedYear.value= currentYear.toString()
});
// endregion
// region 事件||监听
watch(time, () => {
getData();
});
const handleCommand = (year) => {
selectedYear.value = year; // 更新当前选中的年份
getSubOneGlobalTrendData(currentDepartId, selectedYear.value);
};
const setupEventListeners = () => {
const ywlxzbOptionTemp = subOneYwlxzbOption?.value?.chart;
ywlxzbOptionTemp.on('mousemove', (e) => {
clearInterval(subOneYwlxPieCircularIntervalId);
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(subOneYwlxPieCircularIntervalId);
subOneYwlxPieCircularIntervalId = setInterval(subOneYwlxzbCircularAnimation, 2000);
});
const mySubOneGlobalMap = subOneGlobalMap?.value?.chart;
mySubOneGlobalMap.on('mousemove', (e) => {
// console.log(e.dataIndex);
clearInterval(subOneGlobalMapIntervalId);
mySubOneGlobalMap.dispatchAction({type: "downplay", seriesIndex: 0,});
mySubOneGlobalMap.dispatchAction({type: "highlight", seriesIndex: 0, dataIndex: e.dataIndex,});
mySubOneGlobalMap.dispatchAction({type: "showTip", seriesIndex: 0, dataIndex: e.dataIndex,});
});
mySubOneGlobalMap.on('mouseout', () => {
// 如果有弹窗
if (showDialog.value) {
clearInterval(subOneGlobalMapIntervalId); // 确保没有多个定时器同时运行
} else {
clearInterval(subOneGlobalMapIntervalId); // 确保没有多个定时器同时运行
subOneGlobalMapIntervalId = setInterval(subOneMapAnimation, 2000);
}
});
const wtlxzbOptionTemp = subOneWtlxzbOption?.value?.chart;
wtlxzbOptionTemp.on('mousemove', (e) => {
clearInterval(subOneWtlxPieCircularIntervalId);
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(subOneWtlxPieCircularIntervalId);
subOneWtlxPieCircularIntervalId = setInterval(subOneWtlxzbCircularAnimation, 2000);
})
};
const handleClick = (params) => {
const departId = params.data.departId;
showDialog.value = true;
tempDepartId.value = departId
// tempPolice.value = 430426;
clearInterval(subOneGlobalMapIntervalId);
}
// endregion
</script>
<style lang="scss" scoped>
@import "@/style/datav.scss";
:deep() {
// 弹框整体
.tooltip {
position: relative;
width: 160px;
height: 194px;
background: linear-gradient(180deg, rgba(1, 4, 87, 0.8) 0%, rgba(3, 21, 119, 0.8) 100%);
border: 1px solid #4E8FFF;
margin: -10px -10px -10px -10px;
}
////浏阳市局
.tooltip-title {
width: 160px;
height: 43px;
background: linear-gradient(180deg, #0A2F86 0%, #04154E 100%);
box-shadow: inset 0px -1px 0px 0px #253755;
display: flex;
justify-content: center; /* 水平居中 */
align-items: center; /* 垂直居中 */
font-weight: 400;
font-size: 16px;
color: #FFFFFF;
border-bottom: 1px solid #253755; /* 设置下边框 */
}
.tooltip-content {
width: 160px;
height: 155px;
background: linear-gradient(180deg, #010457 0%, #031577 100%);
}
.tooltip-content ul {
list-style-type: none; /* 移除默认的小圆点 */
padding-left: 5px;
margin: 0;
}
.tooltip-content ul li {
display: flex;
justify-content: space-around;
height: 26px;
color: #597AE9;
font-weight: 400;
font-size: 14px;
}
.tooltip-ul span {
display: inline-block;
float: right;
color: #fff;
font-size: 14px;
//text-align: center; /* 水平居中 */
}
///* 小尖角 */
//.tooltip::before {
// content: '';
// position: absolute;
// top: 90px; /* 调整尖角的垂直位置 */
// left: -10px; /* 调整尖角的水平位置 */
// width: 0;
// height: 0;
// //border-top: 10px solid red; /* 顶边颜色 */
// //border-bottom: 10px solid green; /* 底边颜色 */
// //border-right: 10px solid blue; /* 右边颜色,与背景颜色相同 */
//}
}
.test {
width: 95px;
height: 25px;
background: #1C3472;
}
.gobal-dropdown-container {
position: absolute;
right: 20px;
top: 15px;
}
.my-gobal-yearselect {
font-size: 14px;
padding-top: 6px;
padding-left: 20px;
width: 90px;
color: #fff;
}
</style>