Browse Source

fix--抚慰屏幕地图颜色

master
buaixuexideshitongxue 3 weeks ago
parent
commit
6e85343d2d
  1. 26
      src/api/datav.ts
  2. 79
      src/views/datav/RightsComfort.vue

26
src/api/datav.ts

@ -33,6 +33,32 @@ export function getRightsComfortData(times) {
}); });
} }
/**
*
* @param body
*/
export function getRightsBarList(body) {
return request.post({
url: `/datav/rightsComfort/getRightsBarList`,
body
});
}
/**
*
* @param body
*/
export function getComfortMoneyBarList(body) {
return request.post({
url: `/datav/rightsComfort/getComfortMoneyBarList`,
body
});
}
export function getRecentlyMailTrend(query) { export function getRecentlyMailTrend(query) {
// alert(days + activeMailTrend.value) // alert(days + activeMailTrend.value)
return request.get({ return request.get({

79
src/views/datav/RightsComfort.vue

@ -218,13 +218,11 @@ import * as echarts from "echarts/core";
import moment from "moment"; import moment from "moment";
import { import {
getALlComfortCount, getPoliceHurtSituationAndHurtType, getCaseAriseSituationRate, getComfortMapIcon
getPunishmentSituation,
getComfortSituation,
getRightsAndComfortRank, getPoliceHurtSituationAndHurtType, getCaseAriseSituationRate, getComfortMapIcon
} from "@/api/screen/rightsComfort.ts"; } from "@/api/screen/rightsComfort.ts";
import { import {
getRightsComfortData getRightsComfortData,
getRightsBarList, getComfortMoneyBarList
} from "@/api/datav"; } from "@/api/datav";
@ -385,21 +383,21 @@ const comfortInjuryCategory = ref(
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
function getData() { function getData() {
getRightsBarListFun();
getComfortMoneyBarListFun();
getRightsComfortData(time.value).then(data => { getRightsComfortData(time.value).then(data => {
overview.value.rightsNumber = data.rightsNumber overview.value.rightsNumber = data.rightsNumber
overview.value.victimNumber = data.victimNumber overview.value.victimNumber = data.victimNumber
overview.value.hitPersonNumber = data.hitPersonNumber overview.value.hitPersonNumber = data.hitPersonNumber
overview.value.comfortPersonNumber = data.comfortPersonNumber overview.value.comfortPersonNumber = data.comfortPersonNumber
overview.value.comfortMoney = data.comfortMoney overview.value.comfortMoney = data.comfortMoney
// countyComfortMoneyBarList.value = data.countyComfortMoneyBarList;
countyComfortMoneyBarList.value = data.countyComfortMoneyBarList; // bureauComfortMoneyBarList.value = data.bureauComfortMoneyBarList;
bureauComfortMoneyBarList.value = data.bureauComfortMoneyBarList;
punishmentSituationOption.value.series[0].data = data.punishmentSituation punishmentSituationOption.value.series[0].data = data.punishmentSituation
comfortPoliceInjurySituation.value.series[0].data = data.comfortPoliceInjurySituation comfortPoliceInjurySituation.value.series[0].data = data.comfortPoliceInjurySituation
comfortInjuryCategory.value.series[0].data = data.comfortInjuryCategory comfortInjuryCategory.value.series[0].data = data.comfortInjuryCategory
countyRightsBarList.value = data.countyRightsBarList; // countyRightsBarList.value = data.countyRightsBarList;
bureauRightsBarList.value=data.bureauRightsBarList; // bureauRightsBarList.value=data.bureauRightsBarList;
xsajCaseTypeOption.value.series[0].data = data.crownCaseBarList; xsajCaseTypeOption.value.series[0].data = data.crownCaseBarList;
xzajCaseTypeOption.value.series[0].data = data.administrativeCaseList; xzajCaseTypeOption.value.series[0].data = data.administrativeCaseList;
}) })
@ -414,6 +412,26 @@ onMounted(() => {
getData(); getData();
}); });
const getRightsBarListFun = async() =>{
const body = {
beginTime: time.value[0],
endTime: time.value[1]
}
const res = await getRightsBarList(body);
countyRightsBarList.value = res.countyRightsBarList;
bureauRightsBarList.value = res.bureauRightsBarList;
}
const getComfortMoneyBarListFun = async() =>{
const body = {
beginTime: time.value[0],
endTime: time.value[1]
}
const res = await getComfortMoneyBarList(body);
countyComfortMoneyBarList.value = res.countyComfortMoneyBarList;
bureauComfortMoneyBarList.value = res.bureauComfortMoneyBarList;
}
let globalTempMapVoList = ref([]); let globalTempMapVoList = ref([]);
@ -462,23 +480,26 @@ const getMapData = async (timeValue) => {
return { return {
...item, ...item,
originalName: setNameFun(item.name), // originalName: setNameFun(item.name), //
name: item.name, name: name,
value: item.totalCase, value: item.rightsNumber,
}; };
}); });
console.log('转换后数据:', mappedData); console.log('转换后数据:', mappedData);
globalTempMapVoList.value = mappedData globalTempMapVoList.value = mappedData
const total = mappedData.reduce((sum, item) => sum + (Number(item.rightsNumber) || 0), 0); const maxItem = mappedData.reduce(
const avg = total / mappedData.length; // (max, item) => (Number(item.rightsNumber) > Number(max.rightsNumber) ? item : max),
mappedData[0]
);
const range60Percent = maxItem.rightsNumber * 0.6;
const range80Percent = maxItem.rightsNumber * 0.8;
console.log('mappedData',mappedData) console.log('mappedData',mappedData)
const range30Percent = avg * 0.3 //
option.value.series[0].data = mappedData; option.value.series[0].data = mappedData;
console.log('option series data:', option.value.series[0].data); console.log('option series data:', option.value.series[0].data);
option.value.visualMap.pieces = [ option.value.visualMap.pieces = [
{gte: 0, lte: avg - range30Percent, label: "低于平均问题30%", color: "#4987F6"}, {gte: 0, lte: range60Percent, label: "低于最大维权案件60%", color: "#4987F6"},
{gte: avg - range30Percent, lte: avg + range30Percent + 0.1, label: `平均问题上下浮动30%内`, color: "#F6A149"}, {gte: range60Percent, lte: range80Percent, label: "介于最大维权案件60%~80%", color: "#F6A149"},
{gte: avg + range30Percent, label: "高于平均问题30%", color: "#D34343"}, {gte: range80Percent, label: "高于最大维权案件80%", color: "#D34343"},
]; ];
} }
@ -527,6 +548,9 @@ echarts.registerMap("changsha", changshaMap);
const option = ref({ const option = ref({
geo: { geo: {
map: "changsha", map: "changsha",
itemStyle: {
opacity: 0,
},
}, },
tooltip: { tooltip: {
trigger: 'item', trigger: 'item',
@ -582,22 +606,21 @@ const option = ref({
name: "长沙", name: "长沙",
type: "map", type: "map",
map: "changsha", map: "changsha",
hoverAnimation: true, roam: true,
label: { label: {
show: true, show: true,
color: "white", color: "white",
}, },
itemStyle: { itemStyle: {
normal: { areaColor: "#02215E",
areaColor: "#02215E", borderColor: "#24D2EE",
borderColor: "#24D2EE", borderWidth: 1,
borderWidth: 1 // opacity: 1,
},
}, },
emphasis: { emphasis: {
areaColor: "#FFD700", // areaColor: "#FFD700",
borderColor: "#FF0000", // borderColor: "#FF0000",
borderWidth: 4 // borderWidth: 4,
}, },
data: [] data: []
} }

Loading…
Cancel
Save