Browse Source

fix--抚慰大屏重构-step3

master
buaixuexideshitongxue 3 weeks ago
parent
commit
32a03c945f
  1. 91
      src/api/screen/subScreen/subOneRightsConfort.ts
  2. 309
      src/views/datav/subonedatav/SubOneRightsComfort.vue

91
src/api/screen/subScreen/subOneRightsConfort.ts

@ -1,47 +1,88 @@
import request from "@/api/request";
/**
*
* @param body
*/
export function getSubRightsBarList(body) {
return request.post({
url: `/datav/sub1/rightsComfort/getSubRightsBarList`,
body
});
}
export function getSubOneALlComfortCount(departId, times) {
return request.get({
url: `/datav/sub1/rightsComfort/getSubOneALlComfortCount?departId=${departId}&beginTime=${times[0]}&endTime=${times[1]}`
/**
*
* @param body
*/
export function getSubComfortMoneyBarList(body) {
return request.post({
url: `/datav/sub1/rightsComfort/getSubComfortMoneyBarList`,
body
});
}
/**
*
* @param body
*/
export function getSubCaseType(body) {
return request.post({
url: `/datav/sub1/rightsComfort/getSubCaseType`,
body
});
}
export function getSubOnePoliceHurtSituationAndHurtType(departId, times) {
return request.get({
url: `/datav/sub1/rightsComfort/getSubOnePoliceHurtSituationAndHurtType?departId=${departId}&beginTime=${times[0]}&endTime=${times[1]}`
/**
*
* @param body
*/
export function getSubOneALlComfortCount(body) {
return request.post({
url: `/datav/sub1/rightsComfort/getSubOneALlComfortCount`,
body
});
}
/**
*
* @param body
*/
export function getSubHitState(body) {
return request.post({
url: `/datav/sub1/rightsComfort/getSubHitState`,
body
});
}
export function getSubOneCaseAriseSituationRate(departId, times) {
return request.get({
url: `/datav/sub1/rightsComfort/getSubOneCaseAriseSituationRate?departId=${departId}&beginTime=${times[0]}&endTime=${times[1]}`
export function getSubComfortState(body) {
return request.post({
url: `/datav/sub1/rightsComfort/getSubComfortState`,
body
});
}
//抚慰情况
export function getComfortSituation(departId,times){
return request.get({
url:`/datav/sub1/rightsComfort/getComfortSituation?departId=${departId}&beginTime=${times[0]}&endTime=${times[1]}`
})
}
//案件类别占比
export function getSubCaseType(departId,times){
return request.get({
url:`/datav/sub1/rightsComfort/getSubCaseType?departId=${departId}&beginTime=${times[0]}&endTime=${times[1]}`
})
export function getSubPoliceHurtSituationAndHurtType(body) {
return request.post({
url: `/datav/sub1/rightsComfort/getSubPoliceHurtSituationAndHurtType`,
body
});
}
//打处情况
export function getPunishmentSituation(departId,times){
return request.get({
url:`/datav/sub1/rightsComfort/getPunishmentSituation?departId=${departId}&beginTime=${times[0]}&endTime=${times[1]}`
})
export function getSubOneCaseAriseSituationRate(body) {
return request.post({
url: `/datav/sub1/rightsComfort/getSubOneCaseAriseSituationRate`,
body
});
}
//获取地图数据
export function getSubComfortMapIcon(departId,times){
return request.get({

309
src/views/datav/subonedatav/SubOneRightsComfort.vue

@ -219,12 +219,15 @@ import moment from "moment";
import {getSubOneStreetMap} from "@/api/screen/subScreen/subOneGlobal.ts";
import {
getSubOneALlComfortCount, getSubOneCaseAriseSituationRate,
getSubOnePoliceHurtSituationAndHurtType,
getComfortSituation,
getSubCaseType,
getPunishmentSituation,
getSubComfortMapIcon
getSubOneALlComfortCount,
getSubOneCaseAriseSituationRate,
getSubComfortMapIcon,
getSubRightsBarList,
getSubHitState,
getSubComfortState,
getSubPoliceHurtSituationAndHurtType,
getSubComfortMoneyBarList,
getSubCaseType
} from "@/api/screen/subScreen/subOneRightsConfort.ts";
import SubOneHeader from "@/components/datav/subOne/subOneHeader.vue";
import useUserStore from "@/stores/modules/user";
@ -355,145 +358,121 @@ const getMapJSON = async (departId) => {
}
//
const getRightsRankList = async (departId, timeValue) => {
const res = await getSubOneALlComfortCount(departId, timeValue);
const getSubRightsBarListFun = async () => {
const body = {
beginTime: time.value[0],
endTime: time.value[1],
departId: currentDepartId
}
const res = await getSubRightsBarList(body);
fxsjRightsRank.value = res.fxsjRightsRankList;
jsdwRightsRank.value = res.jsdwRightsRankList;
comfortOverview.value=res.comfortOverview;
}
//
const getSubComfortMoneyBarListFun = async ()=>{
const body = {
beginTime: time.value[0],
endTime: time.value[1],
departId: currentDepartId
}
const res = await getSubComfortMoneyBarList(body);
fxsjComfortMoneyRank.value = res.fxsjComfortMoneyRank;
jsdwComfortMoneyRank.value = res.jsdwComfortMoneyRank;
}
//
// const getComfortOverview = async (timeValue) => {
// const res = await getALlComfortCount(timeValue);
// comfortOverview.value = res.comfortOverview;
// }
//
// const getMapData = async (timeValue) => {
// const res = await getComfortMapIcon(timeValue);
// const mappedData = res.comfortMapVoList.map(item => {
// let name;
// switch (item.name) {
// case '':
// name = '';
// break;
// case '':
// name = '';
// break;
// case '':
// name = '';
// break;
// case '':
// name = '';
// break;
// case '':
// name = '';
// break;
// case '':
// name = '';
// break;
// case '':
// name = '';
// break;
// case '':
// name = '';
// break;
// case '':
// name = '';
// break;
// case '':
// name = '';
// break;
// default:
// name = item.name;
// break;
// }
// return {
// ...item,
// originalName: item.name, //
// name: name,
// value: item.totalCase,
// };
// });
// globalTempMapVoList.value = mappedData
// console.log(globalTempMapVoList)
// const total = mappedData.reduce((sum, item) => sum + Number(item.value), 0);
// const avg = total / mappedData.length; //
// const range30Percent = avg * 0.3 //
// option.value.series[0].data = mappedData;
// 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"},
// ];
// }
const getSubCaseTypeFun = async ()=>{
const body = {
beginTime: time.value[0],
endTime: time.value[1],
departId: currentDepartId
}
const res = await getSubCaseType(body);
xsajCaseTypeOption.value.series[0].data =res.crownCaseBar;
xzajCaseTypeOption.value.series[0].data =res.administrativeCase;
}
//
const getSubOneALlComfortCountFun = async ()=>{
const body = {
beginTime: time.value[0],
endTime: time.value[1],
departId: currentDepartId
}
const res = await getSubOneALlComfortCount(body);
comfortOverview.value=res.comfortOverview;
}
//
// const getPunishmentSituationList = async (timeValue) => {
// const res = await getPunishmentSituation(timeValue);
// punishmentSituationOption.series[0].data = res.punishmentSituationList;
// }
// //
// const getComfortSituationList = async (timeValue) => {
// const res = await getComfortSituation(timeValue);
// comfortSituationOption.series[0].data = res.comfortSituationList;
// }
const getSubHitStateFun = async ()=>{
const body = {
beginTime: time.value[0],
endTime: time.value[1],
departId: currentDepartId
}
const res = await getSubHitState(body);
punishmentSituationOption.value.series[0].data = res.PunishmentSituation
}
//
const getSubComfortStateFun = async ()=>{
const body = {
beginTime: time.value[0],
endTime: time.value[1],
departId: currentDepartId
}
const res = await getSubComfortState(body);
comfortSituationOption.value.series[0].data = res.comfortSituationList
}
// -
const getPoliceHurtSituationList = async (departId, timeValue) => {
const res = await getSubOnePoliceHurtSituationAndHurtType(departId, timeValue);
hurtNumOption.value.series[0].data = res.policeHurtSituationList
hurtTypeOption.value.series[0].data = res.policeHurtTypeList
//
const getSubPoliceHurtSituationAndHurtTypeFun= async ()=>{
const body = {
beginTime: time.value[0],
endTime: time.value[1],
departId: currentDepartId
}
const res = await getSubPoliceHurtSituationAndHurtType(body);
hurtTypeOption.value.series[0].data = res.policeHurtSituationList
}
const getCaseAriseSituationRateList = async (departId, timeValue) => {
const res = await getSubOneCaseAriseSituationRate(departId, timeValue);
const getSubOneCaseAriseSituationRateFun = async () => {
const body = {
beginTime: time.value[0],
endTime: time.value[1],
departId: currentDepartId
}
const res = await getSubOneCaseAriseSituationRate(body);
ariseCaseLinkOption.value.series[0].data = res.incidentLinkList
ariseCasePoliceOption.value.series[0].data = res.incidentPoliceTypeList
ariseCaseORgOption.value.series[0].data = res.incidentOrgList
}
//
const getComfortSituationFun =async (departId, timeValue)=>{
const res = await getComfortSituation(departId,timeValue);
console.log("获取抚慰情况",res)
comfortSituationOption.value.series[0].data = res.comfortSituationList;
}
//
const getSubCaseTypeFun = async (departId,timeValue)=>{
const res = await getSubCaseType(departId,timeValue);
console.log("获取案件类别占比",res)
xsajCaseTypeOption.value.series[0].data=res.crownCaseBar
xzajCaseTypeOption.value.series[0].data=res.administrativeCase
}
//
const getPunishmentSituationFun = async (departId,timeValue) =>{
const res = await getPunishmentSituation(departId,timeValue);
console.log("打处情况",res)
punishmentSituationOption.value.series[0].data = res.PunishmentSituation
}
//
const getMapData = async (departId, times) => {
const res = await getSubComfortMapIcon(departId, times);
console.log('getMapData',res)
if(res && res.comfortMapVoList){
const mappedData = res.comfortMapVoList.map(item => {
return {
//
if (res?.comfortMapVoList) {
const mappedData = res.comfortMapVoList.map(item => ({
...item,
value: item.totalPro,
};
});
const total = mappedData.reduce((sum, item) => sum + Number(item.value), 0);
const avg = total / mappedData.length; //
const range30Percent = avg * 0.3 //
value: Number(item.rightsNumber ?? 0), // rightsNumber
}));
if (!mappedData.length) {
option.value.visualMap.pieces = [];
option.value.series[0].data = [];
globalTempMapVoList.value = [];
return;
}
const total = mappedData.reduce((sum, item) => sum + item.value, 0);
const avg = total / mappedData.length;
const range30Percent = avg * 0.3;
option.value.visualMap.pieces = [
{gte: 0, lte: avg - range30Percent, label: "低于平均问题30%", color: "#4987F6"},
{gte: avg - range30Percent, lte: avg + range30Percent, label: "平均问题上下浮动30%内", color: "#F6A149"},
{gte: avg + range30Percent, label: "高于平均问题30%", color: "#D34343"},
{ gte: 0, lte: avg - range30Percent, label: "低于平均30%", color: "#4987F6" },
{ gte: avg - range30Percent, lte: avg + range30Percent, label: "平均±30%", color: "#F6A149" },
{ gte: avg + range30Percent, label: "高于平均30%", color: "#D34343" },
];
globalTempMapVoList.value = mappedData;
option.value.series[0].data = mappedData;
}
@ -503,15 +482,30 @@ const getMapData = async (departId, times) => {
// endregion
function getData() {
getRightsRankList(currentDepartId, time.value);
// getComfortOverview(time.value);
//
getSubRightsBarListFun();
//
getSubComfortMoneyBarListFun();
//
getSubCaseTypeFun();
//
getSubOneALlComfortCountFun();
//
getSubHitStateFun();
//
getSubComfortStateFun();
//
getSubPoliceHurtSituationAndHurtTypeFun();
//
getSubOneCaseAriseSituationRateFun();
//
getMapData(currentDepartId,time.value)
// getPunishmentSituationList(time.value);
getPunishmentSituationFun(currentDepartId,time.value);
getComfortSituationFun(currentDepartId,time.value)
getSubCaseTypeFun(currentDepartId,time.value);
getPoliceHurtSituationList(currentDepartId, time.value);
getCaseAriseSituationRateList(currentDepartId, time.value);
// getPunishmentSituationFun(currentDepartId,time.value);
// getComfortSituationFun(currentDepartId,time.value)
// getSubCaseTypeFun(currentDepartId,time.value);
// getPoliceHurtSituationList(currentDepartId, time.value);
}
watch(time, () => {
@ -543,6 +537,9 @@ echarts.registerMap("changsha", changshaMap);
const option = ref({
geo: {
map: "changsha",
itemStyle: {
opacity: 0,
},
},
tooltip: {
trigger: 'item',
@ -552,7 +549,7 @@ const option = ref({
if (dataItem) {
return `
<div class="tooltip">
<div class="tooltip-title">${dataItem.name}</div>
<div class="tooltip-title">${params.name}</div>
<div class="tooltip-content">
<ul class="tooltip-ul" >
<li>维权案件总数 <span>${dataItem.rightsNumber || '-'}</span></li>
@ -582,43 +579,32 @@ const option = ref({
visualMap: {
type: "piecewise",
bottom: 10,
pieces: [],
right: 10,
realtime: false,
pieces: [], // getMapData
orient: "horizontal",
textStyle: {
color: "#fff",
},
calculable: true,
inRange: {
color: ["#4987F6", "#F6A149", "#D34343",],
},
textStyle: { color: "#fff" },
},
series: [
{
name: "长沙",
type: "map",
map: "changsha",
hoverAnimation: true,
label: {
show: true,
color: "white",
},
visualMapIndex: 0,
roam: true,
label: { show: true, color: "white" },
itemStyle: {
normal: {
areaColor: "#02215E",
borderColor: "#24D2EE",
borderWidth: 1 //
},
borderWidth: 1,
opacity: 1,
},
emphasis: {
areaColor: "#FFD700", //
borderColor: "#FF0000", //
borderWidth: 4 //
areaColor: "#FFD700",
borderColor: "#FF0000",
borderWidth: 4
},
data: []
}
],
]
})
const xsajCaseTypeOption = ref({
series: [
@ -628,12 +614,7 @@ const xsajCaseTypeOption = ref({
label: {
color: "#fff",
},
data: [
{value: 32, name: "故意伤害"},
{value: 42, name: "袭警罪"},
{value: 12, name: "寻衅滋事"},
{value: 28, name: "妨碍公务"}
],
data: [],
},
],
tooltip: {
@ -649,10 +630,7 @@ const xzajCaseTypeOption = ref({
color: "#fff",
},
data: [
{value: 2, name: "故意伤害"},
{value: 42, name: "袭警罪"},
{value: 2, name: "寻衅滋事"},
{value: 28, name: "妨碍公务"}
],
},
],
@ -668,10 +646,7 @@ const punishmentSituationOption = ref({
label: {
color: "#fff",
},
data: [
// {value: 71, name: ""},
// {value: 97, name: ""},
],
data: [],
},
],
tooltip: {

Loading…
Cancel
Save