diff --git a/src/api/data/risk.ts b/src/api/data/risk.ts index f9156c4..6bed636 100644 --- a/src/api/data/risk.ts +++ b/src/api/data/risk.ts @@ -6,94 +6,36 @@ export function totalStatistics(times) { }); } -export function areaRiskStatistics(times, type) { +export function cityNegative(query) { return request.get({ - url: `/datav/risk/area/risk/statistics?beginTime=${times[0]}&endTime=${times[1]}&type=${type}` + url: `/datav/risk/negative/city`, + query }); } - -export function orgRiskStatistics(times, type) { - return request.get({ - url: `/datav/risk/risk/org/statistics?beginTime=${times[0]}&endTime=${times[1]}&type=${type}` - }); -} - -export function orgCarRiskStatistics(times, type) { +export function threeNegative(query) { return request.get({ - url: `/datav/risk/risk/org/car/statistics?beginTime=${times[0]}&endTime=${times[1]}&type=${type}` + url: `/datav/risk/negative/three`, + query }); } -export function policeARiskStatistics(times, type) { +export function leadNegative(query) { return request.get({ - url: `/datav/risk/risk/police/a/statistics?beginTime=${times[0]}&endTime=${times[1]}&type=${type}` + url: `/datav/risk/negative/lead`, + query }); } -export function policeBRiskStatistics(times, type) { +export function policeNegative(query) { return request.get({ - url: `/datav/risk/risk/police/b/statistics?beginTime=${times[0]}&endTime=${times[1]}&type=${type}` + url: `/datav/risk/negative/police`, + query }); } -export function leaderRiskStatistics(times, type) { +export function auxNegative(query) { return request.get({ - url: `/datav/risk/risk/leader/statistics?beginTime=${times[0]}&endTime=${times[1]}&type=${type}` + url: `/datav/risk/negative/aux`, + query }); } -// ******************************************* -export function areaNegativeStatistics(times, type) { - return request.get({ - url: `/datav/risk/area/negative/statistics?beginTime=${times[0]}&endTime=${times[1]}&type=${type}` - }); -} - -export function orgNegativeStatistics(times, type) { - return request.get({ - url: `/datav/risk/org/negative/statistics?beginTime=${times[0]}&endTime=${times[1]}&type=${type}` - }); -} - -export function orgCarNegativeStatistics(times, type) { - return request.get({ - url: `/datav/risk/org/car/negative/statistics?beginTime=${times[0]}&endTime=${times[1]}&type=${type}` - }); -} - -export function policeANegativeStatistics(times, type) { - return request.get({ - url: `/datav/risk/police/a/negative/statistics?beginTime=${times[0]}&endTime=${times[1]}&type=${type}` - }); -} - -export function policeBNegativeStatistics(times, type) { - return request.get({ - url: `/datav/risk/police/b/negative/statistics?beginTime=${times[0]}&endTime=${times[1]}&type=${type}` - }); -} - -export function policeLeaderNegativeStatistics(times, type) { - return request.get({ - url: `/datav/risk/police/leader/negative/statistics?beginTime=${times[0]}&endTime=${times[1]}&type=${type}` - }); -} - -// ******************************************* -export function areaRateStatistics(times, type) { - return request.get({ - url: `/datav/risk/area/rate/statistics?beginTime=${times[0]}&endTime=${times[1]}&type=${type}` - }); -} - -export function orgRateStatistics(times, type) { - return request.get({ - url: `/datav/risk/org/rate/statistics?beginTime=${times[0]}&endTime=${times[1]}&type=${type}` - }); -} - -export function orgCarRateStatistics(times, type) { - return request.get({ - url: `/datav/risk/org/car/rate/statistics?beginTime=${times[0]}&endTime=${times[1]}&type=${type}` - }); -} - diff --git a/src/views/datav/Lmgz.vue b/src/views/datav/Lmgz.vue index a721ba8..a7fb1c5 100644 --- a/src/views/datav/Lmgz.vue +++ b/src/views/datav/Lmgz.vue @@ -52,41 +52,41 @@
分县市局
- - - - + + + +
- + - + - + 派出所
- - - - + + + +
- + - + - + 交警大队
- - - - + + + +
- + - + - + 领导
- - - + + +
@@ -216,17 +216,7 @@ - - - - - @@ -240,9 +230,9 @@
民警
- - - + + +
@@ -254,17 +244,7 @@ - - - - - @@ -278,9 +258,9 @@
协辅警
- - - + + +
@@ -292,7 +272,7 @@ @@ -309,30 +289,25 @@ import { totalStatistics, - areaRiskStatistics, - leaderRiskStatistics, - policeARiskStatistics, - policeBRiskStatistics, - orgCarRiskStatistics, - orgRiskStatistics, - areaNegativeStatistics, - orgNegativeStatistics, - orgCarNegativeStatistics, - policeANegativeStatistics, - policeBNegativeStatistics, - policeLeaderNegativeStatistics, - areaRateStatistics, - orgRateStatistics, - orgCarRateStatistics + cityNegative, + threeNegative, + leadNegative, + policeNegative, + auxNegative } from '@/api/data/risk'; import moment from "moment"; -let selectedMetric = ref('problemNumber'); -let selectedMetricPCS = ref('problemNumber'); -let selectedMetricJJDD = ref('problemNumber'); -let selectedMetricLD = ref('paichusuo'); -let selectedMetricMJ = ref('paichusuo'); -let selectedMetricXFJ = ref('paichusuo'); +let type1 = ref('涉及问题数'); +let type2 = ref('涉及问题数'); +let type3 = ref('涉及问题数'); + +const groupId1 = ref('23') +const groupId2 = ref('17') +const groupId3 = ref('20') +const groupId4 = ref('10'); +const groupId5 = ref('10'); +const groupId6 = ref('10'); + let statisticsTotal = ref({ caseTotal: 0, aTotal: 0, @@ -340,241 +315,140 @@ let statisticsTotal = ref({ peopleCount: 0, avgPeople: 0.0 }) -let areaRiskList = ref([]) -let pcsRiskList = ref([]) -let carRiskList = ref([]) -let policeARiskList = ref([]) -let policeBRiskList = ref([]) -let leaderRiskList = ref([]) - -let areaNegativeList = ref([]) -let orgNegativeList = ref([]) -let orgCarNegativeList = ref([]) -let policeANegativeList = ref([]) -let policeBNegativeList = ref([]) -let leaderNegativeList = ref([]) - -let areaRateList = ref([]) -let orgRateList = ref([]) -let orgCarRateList = ref([]) const time = ref([ moment().startOf("year").format("YYYY-MM-DD"), moment().format("YYYY-MM-DD"), ]); -// -- 分县市局 -watch(selectedMetric,()=>{ - - getAreaRiskData(selectedMetric.value); // 【分县市局 高业务量】 - getAreaNegativeData(selectedMetric.value);// 分县 /area/negative/statistics 【分县市局 中业务量】 - getAreaRateData(selectedMetric.value);// /area/rate/statistics 【分县市局 低业务量】 -},{deep:true}) -// 派出所 -watch(selectedMetricPCS,()=>{ - console.log('-----12------') - getPCSRiskData(selectedMetricPCS.value);//分机构统计风险分 派出所 /risk/org/statistics 【派出所 高业务量】 - getOrgNegativeData(selectedMetricPCS.value);// 派出所 /org/negative/statistics 【派出所 中业务量】 - getOrgRateData(selectedMetricPCS.value);// 派出所 /org/rate/statistics 【派出所 低业务量】 -}) - -//交警大队 -watch(selectedMetricJJDD,()=>{ - getCarRiskData(selectedMetricJJDD.value);//分机构统计风险分 交警大队 【交警大队 高业务量】 - getCarOrgNegativeData(selectedMetricJJDD.value);// /org/car/negative/statistics 【交警大队 中业务量】 - getCarOrgRateData(selectedMetricJJDD.value);// 交警人均率 /org/car/rate/statistics 【交警大队 低业务量】 -}) -//领导 -watch(selectedMetricLD,()=>{ - getLeaderNegativeData(selectedMetricLD.value);// 【领导 问题数】 - getLeaderRiskData(selectedMetricLD.value);// 【领导 问题涉及人数】 -}) - -//民警 -watch(selectedMetricMJ,()=>{ - getPoliceANegativeData(selectedMetricMJ.value);// 【民警 问题数】 - getPoliceARiskData(selectedMetricMJ.value);// 【民警 问题发生率】 -}) - -watch(selectedMetricXFJ,()=>{ - getPoliceBNegativeData(selectedMetricXFJ.value);//【辅警/协警 问题数】 - getPoliceBRiskData(selectedMetricXFJ.value);//【辅警/协警 问题发生率】 -}) - - -watch(time, () => { - getTotalData();//数量统计 /total/statistics - getAreaRiskData(selectedMetric.value); // 【分县市局 高业务量】 - getAreaNegativeData(selectedMetric.value);// 分县 /area/negative/statistics 【分县市局 中业务量】 - getAreaRateData(selectedMetric.value);// /area/rate/statistics 【分县市局 低业务量】 - - getPCSRiskData(selectedMetricPCS.value);//分机构统计风险分 派出所 /risk/org/statistics 【派出所 高业务量】 - getOrgNegativeData(selectedMetricPCS.value);// 派出所 /org/negative/statistics 【派出所 中业务量】 - getOrgRateData(selectedMetricPCS.value);// 派出所 /org/rate/statistics 【派出所 低业务量】 - - getCarRiskData(selectedMetricJJDD.value);//分机构统计风险分 交警大队 【交警大队 高业务量】 - getCarOrgNegativeData(selectedMetricJJDD.value);// /org/car/negative/statistics 【交警大队 中业务量】 - getCarOrgRateData(selectedMetricJJDD.value);// 交警人均率 /org/car/rate/statistics 【交警大队 低业务量】 - - getLeaderNegativeData(selectedMetricLD.value);// 【领导 问题数】 - getLeaderRiskData(selectedMetricLD.value);// 【领导 问题涉及人数】 - getPoliceANegativeData(selectedMetricMJ.value);// 【民警 问题数】 - getPoliceARiskData(selectedMetricMJ.value);// 【民警 问题发生率】 - getPoliceBNegativeData(selectedMetricXFJ.value);//【辅警/协警 问题数】 - getPoliceBRiskData(selectedMetricXFJ.value);//【辅警/协警 问题发生率】 -},{deep:true}); -onMounted(() => { - Promise.all([ - getTotalData(),//数量统计 /total/statistics - getAreaRiskData(selectedMetric.value),// 【分县市局 高业务量】 - getAreaNegativeData(selectedMetric.value),// 分县 /area/negative/statistics 【分县市局 中业务量】 - getAreaRateData(selectedMetric.value),// /area/rate/statistics 【分县市局 低业务量】 - getPCSRiskData(selectedMetricPCS.value),//分机构统计风险分 派出所 /risk/org/statistics 【派出所 高业务量】 - getOrgNegativeData(selectedMetricPCS.value),// 派出所 /org/negative/statistics 【派出所 中业务量】 - getOrgRateData(selectedMetricPCS.value),// 派出所 /org/rate/statistics 【派出所 低业务量】 - getCarRiskData(selectedMetricJJDD.value),//分机构统计风险分 交警大队 【交警大队 高业务量】 - getCarOrgNegativeData(selectedMetricJJDD.value),// /org/car/negative/statistics 【交警大队 中业务量】 - getCarOrgRateData(selectedMetricJJDD.value),// 交警人均率 /org/car/rate/statistics 【交警大队 低业务量】 - getLeaderNegativeData(selectedMetricLD.value),// 【领导 问题数】 - getLeaderRiskData(selectedMetricLD.value),// 【领导 问题涉及人数】 - getPoliceANegativeData(selectedMetricMJ.value),// 【民警 问题数】 - getPoliceARiskData(selectedMetricMJ.value),// 【民警 问题发生率】 - getPoliceBNegativeData(selectedMetricXFJ.value),//【辅警/协警 问题数】 - getPoliceBRiskData(selectedMetricXFJ.value)//【辅警/协警 问题发生率】 - ]) -}); - -const getTotalData = async () => { - const res = await totalStatistics(time.value); - statisticsTotal.value.aTotal = res.atotal == undefined ? 0 : res.atotal; - statisticsTotal.value.caseTotal = res.caseTotal == undefined ? 0 : res.caseTotal; - statisticsTotal.value.negativeTotal = res.negativeTotal == undefined ? 0 : res.negativeTotal; - statisticsTotal.value.peopleCount = res.peopleCount == undefined ? 0 : res.peopleCount; - statisticsTotal.value.avgPeople = res.avgPeople == undefined ? 0.0 : res.avgPeople; +const list1 = ref([]) +const list2 = ref([]) +const list3 = ref([]) +const list4 = ref([]) +const list5 = ref([]) +const list6 = ref([]) +function getData() { + totalStatistics(time.value).then(res => { + statisticsTotal.value.aTotal = res.atotal; + statisticsTotal.value.caseTotal = res.caseTotal; + statisticsTotal.value.negativeTotal = res.negativeTotal; + statisticsTotal.value.peopleCount = res.peopleCount; + statisticsTotal.value.avgPeople = res.avgPeople; + }) + getData1() + getData2() + getData3() + getData4() + getData5() + getData6() } -const getAreaRiskData =async (type) => { - const res =await areaRiskStatistics(time.value, type); - areaRiskList.value = eachData(res) +function getData1() { + cityNegative({ + beginTime: time.value[0], + endTime: time.value[1], + groupId: groupId1.value, + type: type1.value + }).then(data => { + list1.value = data + }); } -const getPCSRiskData =async (type) => { - const res =await orgRiskStatistics(time.value, type); - pcsRiskList.value = eachData(res) +function getData2() { + threeNegative({ + beginTime: time.value[0], + endTime: time.value[1], + groupId: groupId2.value, + type: type2.value + }).then(data => { + list2.value = data + }); } -const getCarRiskData =async (type) => { - const res =await orgCarRiskStatistics(time.value, type); - carRiskList.value = eachData(res) +function getData3() { + threeNegative({ + beginTime: time.value[0], + endTime: time.value[1], + groupId: groupId3.value, + type: type3.value + }).then(data => { + list3.value = data + }); } -const getPoliceARiskData =async (type) => { - const res = await policeARiskStatistics(time.value, type); - policeARiskList.value = eachData(res) +function getData4() { + leadNegative({ + beginTime: time.value[0], + endTime: time.value[1], + groupId: groupId4.value + }).then(data => { + list4.value = data + }); } -const getPoliceBRiskData =async (type) => { - const res = await policeBRiskStatistics(time.value, type) - policeBRiskList.value = eachData(res); +function getData5() { + policeNegative({ + beginTime: time.value[0], + endTime: time.value[1], + groupId: groupId5.value + }).then(data => { + list5.value = data + }); } -const getLeaderRiskData =async (type) => { - const res = await leaderRiskStatistics(time.value, type); - leaderRiskList.value = eachData(res); -} -const getAreaNegativeData =async (type) => { - const res=await areaNegativeStatistics(time.value, type); - areaNegativeList.value = eachData(res) +function getData6() { + auxNegative({ + beginTime: time.value[0], + endTime: time.value[1], + groupId: groupId6.value + }).then(data => { + list6.value = data + }); } -const getOrgNegativeData = async (type) => { - const res = await orgNegativeStatistics(time.value, type); - orgNegativeList.value = eachData(res); -} +onMounted(() => { + getData() +}); -const getCarOrgNegativeData =async (type) => { - const res = await orgCarNegativeStatistics(time.value, type) - orgCarNegativeList.value = eachData(res); -} +watch(time, () => { + getData() +}) -const getPoliceANegativeData =async (type) => { - // const res = await policeANegativeStatistics(time.value, type); - // policeANegativeList.value = eachData(res) - setTimeout(() => { - policeANegativeList.value = [ - { - label: '星沙派出所', - value: 55 - }, - { - label: '坡子街派出所', - value: 44 - }, - { - label: '井湾子派出所', - value: 41 - }, - { - label: '圭塘派出所', - value: 40 - }, - { - label: '湘龙派出所', - value: 37 - }, - { - label: '定王台派出所', - value: 34 - }, - { - label: '洞井派出所', - value: 33 - }, - { - label: '集里派出所', - value: 32 - } - - ] - }, 1000) - -} +watch(groupId1, () => { + getData1() +}) -const getPoliceBNegativeData =async (type) => { - const res = await policeBNegativeStatistics(time.value, type) - policeBNegativeList.value = eachData(res) -} +watch(type1, () => { + getData1() +}) -const getLeaderNegativeData =async (type) => { - const res = await policeLeaderNegativeStatistics(time.value, type); - leaderNegativeList.value = eachData(res) -} +watch(groupId2, () => { + getData2() +}) -const getAreaRateData =async (type) => { - const res = await areaRateStatistics(time.value, type); - areaRateList.value = eachData(res) -} +watch(type2, () => { + getData1() +}) -const getOrgRateData =async (type) => { - const res =await orgRateStatistics(time.value, type); - orgRateList.value = eachData(res) -} +watch(groupId3, () => { + getData3() +}) -const getCarOrgRateData =async (type) => { - const res = await orgCarRateStatistics(time.value, type); - orgCarRateList.value = eachData(res) -} +watch(type3, () => { + getData3() +}) -const eachData = (data) => { - let arr = []; - data.forEach(item => { - arr.push({ - label: item.label, - value: item['score'] != null ? Number(item.score) : Number(item.value) - }); - }); - return arr; -} +watch(groupId4, () => { + getData4() +}) + +watch(groupId5, () => { + getData5() +}) + +watch(groupId6, () => { + getData6() +}) const colors = [ { @@ -591,119 +465,20 @@ const colors = [ }, ]; + -// region 动画 -const rxsjTabs = ref(null); -const pcsTabs = ref(null); -const jjddTabs = ref(null); -const ldTabs = ref(null); -const mjTabs = ref(null); -const xfjTabs = ref(null); -const selectedFxsjTabs = ref("1"); -const selectedPcsTabs = ref("1"); -const selectedJjddTabs = ref("1"); -const selectedLdTabs = ref("1"); -const selectedMjTabs = ref("1"); -const selectedXfjTabs = ref("1"); -let rxsjTabsIntervalId; -let pcsTabsIntervalId; -let jjddTabsIntervalId; -let ldTabsIntervalId; -let mjTabsIntervalId; -let xfjTabsIntervalId; -const rxsjTabsAnimation = () => { - selectedFxsjTabs.value = (parseInt(selectedFxsjTabs.value) % 3 + 1).toString(); -}; -rxsjTabsIntervalId = setInterval(rxsjTabsAnimation, 3000); - -const pcsTabsAnimation = () => { - selectedPcsTabs.value = (parseInt(selectedPcsTabs.value) % 3 + 1).toString(); -}; -pcsTabsIntervalId = setInterval(pcsTabsAnimation, 3000); - -const jjddTabsAnimation = () => { - selectedJjddTabs.value = (parseInt(selectedJjddTabs.value) % 3 + 1).toString(); -}; -jjddTabsIntervalId = setInterval(jjddTabsAnimation, 3000); - -const ldTabsAnimation = () => { - selectedLdTabs.value = (parseInt(selectedLdTabs.value) % 2 + 1).toString(); -}; -ldTabsIntervalId = setInterval(ldTabsAnimation, 3000); - -const mjTabsAnimation = () => { - selectedMjTabs.value = (parseInt(selectedMjTabs.value) % 2 + 1).toString(); -}; -mjTabsIntervalId = setInterval(mjTabsAnimation, 3000); -// endregion - -// region 监听鼠标事件 -onMounted(() => { - setupEventListeners(); -}); -const setupEventListeners = () => { - new Promise.all([ - rxsjTabsAnimationStop(), - pcsTabsAnimationStop(), - jjddTabsAnimationStop(), - ldTabsAnimationStop(), - mjTabsAnimationStop(), - ]) -}; -const rxsjTabsAnimationStop = () => { - const temp = rxsjTabs.value?.$el; - temp.addEventListener('mouseenter', () => { - clearInterval(rxsjTabsIntervalId) - }); - temp.addEventListener('mouseleave', () => { - rxsjTabsIntervalId = setInterval(rxsjTabsAnimation, 3000); - }); -} - -const pcsTabsAnimationStop = () => { - const temp = pcsTabs.value?.$el; - temp.addEventListener('mouseenter', () => { - clearInterval(pcsTabsIntervalId) - }); - temp.addEventListener('mouseleave', () => { - pcsTabsIntervalId = setInterval(pcsTabsAnimation, 3000); - }); -} - -const jjddTabsAnimationStop = () => { - const temp = jjddTabs.value?.$el; - temp.addEventListener('mouseenter', () => { - clearInterval(jjddTabsIntervalId) - }); - temp.addEventListener('mouseleave', () => { - jjddTabsIntervalId = setInterval(jjddTabsAnimation, 3000); - }); -} - -const ldTabsAnimationStop = () => { - const temp = ldTabs.value?.$el; - temp.addEventListener('mouseenter', () => { - clearInterval(ldTabsIntervalId) - }); - temp.addEventListener('mouseleave', () => { - ldTabsIntervalId = setInterval(ldTabsAnimation, 3000); - }); -} - -const mjTabsAnimationStop = () => { - const temp = mjTabs.value?.$el; - temp.addEventListener('mouseenter', () => { - clearInterval(mjTabsIntervalId) - }); - temp.addEventListener('mouseleave', () => { - mjTabsIntervalId = setInterval(mjTabsAnimation, 3000); - }); +