Browse Source

fix--抚慰大屏重构-step3

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

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

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

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

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

Loading…
Cancel
Save