guoshilong
2023-01-15 85489ac5e1be73b5ee016202efe125807e31334d
户籍人口柱状图接口对接
3 files modified
366 ■■■■■ changed files
src/api/dept/index.js 41 ●●●●● patch | view | raw | blame | history
src/views/home/components/leftContainer.vue 258 ●●●●● patch | view | raw | blame | history
src/views/home/index.vue 67 ●●●● patch | view | raw | blame | history
src/api/dept/index.js
@@ -4,9 +4,9 @@
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2022-12-05 15:23:32
 * @FilePath: \srs-police-affairs\src\api\dept\index.js
 * @Description:
 *
 * Copyright (c) 2022 by shuishen 1109946754@qq.com, All Rights Reserved.
 * @Description:
 *
 * Copyright (c) 2022 by shuishen 1109946754@qq.com, All Rights Reserved.
 */
import request from "@/router/axios.js"
@@ -205,4 +205,37 @@
            resBusId
        }
    })
}
}
// 获取各个派出所的人口数量,以及人口总数和重点人员数量
export const getVillagePersonStatisticInfo = () => {
    return request({
        url: `/api/villagePersonInfo/villagePersonInfo/getVillagePersonStatisticInfo`,
        method: 'get',
    })
}
// 获取对应id下的派出所的责任区人口
export const getVillagePersonStatisticInfoByPoliceStationId = (name,id) => {
    return request({
        url: `/api/villagePersonInfo/villagePersonInfo/getVillagePersonStatisticInfoByPoliceStationId`,
        method: 'get',
        params: {
            name,
            id
        }
    })
}
// 获取该责任区下的人员列表信息
export const getAreaPage = (current,size,areaId) => {
    return request({
        url: `/api/policeStationInfo/policeStationInfo/getAreaPage`,
        method: 'get',
        params: {
            current,
            size,
            areaId
        }
    })
}
src/views/home/components/leftContainer.vue
@@ -20,7 +20,7 @@
                        @click="personTabClick(0)"
                    >
                        <div class="tab-title-small">户籍人口:</div>
                        <div class="tab-title-small">164.57万人</div>
                        <div class="tab-title-small">{{policeStationPersonInfo.total}}人</div>
                    </div>
                    <div
                        class="tab"
@@ -28,7 +28,7 @@
                        @click="personTabClick(1)"
                    >
                        <div class="tab-title-small">重点人员:</div>
                        <div class="tab-title-small">1人</div>
                        <div class="tab-title-small">{{policeStationPersonInfo.emphasisNum}}人</div>
                    </div>
                    <!-- <div class="tab3" :class="{ 'select-on-tab': tabType == 2 }" @click="personTabClick(2)">
                        <div class="num">91995人</div>
@@ -189,6 +189,7 @@
<script>
import { fontSize } from '@/utils/fontSize.js'
import { getAreaStatisticInfo } from "@/api/home/index.js"
import {getVillagePersonStatisticInfo, getVillagePersonStatisticInfoByPoliceStationId} from "@/api/dept";
let homePersonmyChart
let houseMyChart
@@ -309,6 +310,8 @@
            villageNum: '',
            areaOptionData: [],
            villageOptionData: [],
            policeStationPersonInfo:{},
            villagePersonStatisticInfoList:[],
        }
    },
@@ -319,9 +322,8 @@
    mounted () {
        this.initLandEcharts()
        this.initPersonEcharts()
        this.getPoliceStationInfo()
        this.inithouseEcharts()
        this.clickPeopleChart()
        this.clickLandChart()
        this.$nextTick(() => {
@@ -339,7 +341,19 @@
        initPersonEcharts () {
            var chartDom = document.getElementById('PersonEcharts')
            homePersonmyChart = this.$echarts.init(chartDom)
            homePersonmyChart.setOption(this.initPersonOptions(['车站所', '沙溪所', '灵溪所', '北门所', '江光所', '江光所', '水南所', '秦峰所', '茅家岭所', '西市所', '朝阳所'], [881, 2211, 6414, 4321, 1232, 881, 2211, 6414, 4321, 1232], ['#06B5D7', '#44C0C1', '#71C8B1']))
            var xDate = [],yDate=[]
            //传入x,y轴数据
            this.policeStationPersonInfo.data.forEach(e=>{
              xDate.push(e.name)
              yDate.push({
                value:e.num,
                id:e.id,
                type:'policeStation',
                name:e.name
              })
            })
            homePersonmyChart.setOption(this.initPersonOptions(xDate, yDate, ['#06B5D7', '#44C0C1', '#71C8B1']))
        },
        initPersonOptions (xDate, yDate, colors) {
@@ -433,10 +447,10 @@
                this.initPersonEcharts()
                homePersonmyChart.off('click')
                this.clickPeopleChart()
                xDate = ['车站所', '沙溪所', '灵溪所', '北门所', '江光所', '水南所', '秦峰所', '茅家岭所', '西市所', '朝阳所']
                yDate = [881, 2211, 6414, 4321, 1232, 881, 2211, 6414, 4321, 1232]
                colors = ['#06B5D7', '#44C0C1', '#71C8B1']
                homePersonmyChart.setOption(this.initPersonOptions(xDate, yDate, colors), true)
                // xDate = ['车站所', '沙溪所', '灵溪所', '北门所', '江光所', '水南所', '秦峰所', '茅家岭所', '西市所', '朝阳所']
                // yDate = [881, 2211, 6414, 4321, 1232, 881, 2211, 6414, 4321, 1232]
                // colors = ['#06B5D7', '#44C0C1', '#71C8B1']
                // homePersonmyChart.setOption(this.initPersonOptions(xDate, yDate, colors), true)
            } else if (type == 1) {
                this.peopleTabClick(type)
            }
@@ -523,7 +537,7 @@
                    //     show: true,
                    //     type: 'bar',
                    //     barGap: '-100%',
                    //     barWidth: '35%', //统计条宽度
                    //     barWidth: '35%', //统计条宽度
                    //     itemStyle: {
                    //         normal: {
                    //             color: 'rgba(102, 102, 102,0.5)'
@@ -651,7 +665,7 @@
                //         end: 40,
                //         zoomOnMouseWheel: false,  // 关闭滚轮缩放
                //         moveOnMouseWheel: true, // 开启滚轮平移
                //         moveOnMouseMove: true  // 鼠标移动能触发数据窗口平移
                //         moveOnMouseMove: true  // 鼠标移动能触发数据窗口平移
                //     }
                // ]
            }
@@ -693,84 +707,90 @@
            homePersonmyChart.on('click', params => {
                let xDate, yDate, colors
                this.dataDeep = 2
                if (params.name == '车站所') {
                    xDate = ['责任区1', '责任区2', '责任区3', '责任区4', '责任区5']
                    yDate = [88, 221, 641, 432, 123]
                    colors = ['#ccf9d0', '#f9d888', '#f7857e']
                    homePersonmyChart.setOption(this.initPersonOptions(xDate, yDate, colors), true)
                } else if (params.name == '沙溪所') {
                    xDate = ['责任区1', '责任区2', '责任区3', '责任区4', '责任区5']
                    yDate = [641, 423, 221, 123, 88]
                    colors = ['#102129', '#1f3942', '#2a4f5f']
                    homePersonmyChart.setOption(this.initPersonOptions(xDate, yDate, colors), true)
                } else if (params.name == '灵溪所') {
                    xDate = ['责任区1', '责任区2', '责任区3', '责任区4', '责任区5']
                    yDate = [111, 531, 211, 431, 64]
                    colors = ['#23b9e9', '#c76ee0', '#f05265']
                    homePersonmyChart.setOption(this.initPersonOptions(xDate, yDate, colors), true)
                } else if (params.name == '北门所') {
                    xDate = ['责任区1', '责任区2', '责任区3', '责任区4', '责任区5']
                    yDate = [887, 234, 452, 321, 154]
                    colors = ['#b22d2b', '#614976', '#4c3042']
                    homePersonmyChart.setOption(this.initPersonOptions(xDate, yDate, colors), true)
                } else if (params.name == '江光所') {
                    xDate = ['责任区1', '责任区2', '责任区3', '责任区4', '责任区5']
                    yDate = [400, 500, 200, 450, 245]
                    colors = ['#3089bf', '#77d8f9', '#f4fcfe']
                    homePersonmyChart.setOption(this.initPersonOptions(xDate, yDate, colors), true)
                } else if (params.name == '湖北') {
                    xDate = ['武汉市', '黄石市', '宜昌市', '鄂州市', '荆门市']
                    yDate = [88, 221, 641, 432, 123]
                    colors = ['#2b5144', '#5a987f', '#94ebc1']
                    homePersonmyChart.setOption(this.initPersonOptions(xDate, yDate, colors), true)
                } else if (params.name == '上海') {
                    xDate = ['黄浦区', '长宁区', '静安区', '虹口区', '闵行区']
                    yDate = [641, 423, 221, 123, 88]
                    colors = ['#f750c2', '#d6369a', '#bc1f76']
                    homePersonmyChart.setOption(this.initPersonOptions(xDate, yDate, colors), true)
                } else if (params.name == '北京') {
                    xDate = ['东城区', '西城区', '海淀区', '昌平区', '大兴区']
                    yDate = [111, 531, 211, 431, 64]
                    colors = ['#7e81d5', '#86abe6', '#8fe5e3']
                    homePersonmyChart.setOption(this.initPersonOptions(xDate, yDate, colors), true)
                } else if (params.name == '广东') {
                    xDate = ['珠海市', '东菀市', '佛山市', '中山市', '惠州市']
                    yDate = [887, 234, 452, 321, 154]
                    colors = ['#ba1432', '#6b0e33', '#2a0b35']
                    homePersonmyChart.setOption(this.initPersonOptions(xDate, yDate, colors), true)
                } else if (params.name == '浙江') {
                    xDate = ['杭州市', '舟山市', '宁波市', '嘉兴市', '绍兴市']
                    yDate = [400, 300, 200, 450, 245]
                    colors = ['#f12e10', '#f36c15', '#f4a818']
                    homePersonmyChart.setOption(this.initPersonOptions(xDate, yDate, colors), true)
                } else if (params.name == '日本') {
                    xDate = ['东京都', '北海道', '大阪府', '京都府', '43县']
                    yDate = [88, 221, 641, 432, 123]
                    colors = ['#6e978f', '#ad885a', '#e97b27']
                    homePersonmyChart.setOption(this.initPersonOptions(xDate, yDate, colors), true)
                } else if (params.name == '美国') {
                    xDate = ['加利福尼亚州', '德克萨斯州', '纽约州', '俄亥俄州']
                    yDate = [641, 423, 221, 123, 88]
                    colors = ['#d54956', '#9f976e', '#73d781']
                    homePersonmyChart.setOption(this.initPersonOptions(xDate, yDate, colors), true)
                } else if (params.name == '俄罗斯') {
                    xDate = ['西北联邦', '中央联邦', '南方联邦', '伏尔加联邦']
                    yDate = [111, 531, 211, 431, 64]
                    colors = ['#7d65c0', '#a47db4', '#e0a8c5']
                    homePersonmyChart.setOption(this.initPersonOptions(xDate, yDate, colors), true)
                } else if (params.name == '英国') {
                    xDate = ['英格兰', '威尔士', '苏格兰', '北爱尔兰']
                    yDate = [887, 234, 452, 321, 154]
                    colors = ['#584d7b', '#9b836a', '#f8ce52']
                    homePersonmyChart.setOption(this.initPersonOptions(xDate, yDate, colors), true)
                } else if (params.name == '印度') {
                    xDate = ['德里', '哈里亚纳邦', '旁遮普邦', '喜马偕尔邦', '北方邦']
                    yDate = [400, 300, 200, 450, 245]
                    colors = ['#0f97f2', '#7d629d', '#e1344f']
                    homePersonmyChart.setOption(this.initPersonOptions(xDate, yDate, colors), true)
                } else {
                    this.$emit('showpeopledetail', params.name)
                if (params.data.type == 'policeStation'){
                  this.getVillagePersonStatisticInfoByPoliceStationId(params.data.name,params.data.id)
                }else {
                  this.$emit('showpeopledetail', params.data.id,params.data.name)
                }
                // if (params.name == '车站所') {
                //     xDate = ['责任区1', '责任区2', '责任区3', '责任区4', '责任区5']
                //     yDate = [88, 221, 641, 432, 123]
                //     colors = ['#ccf9d0', '#f9d888', '#f7857e']
                //     homePersonmyChart.setOption(this.initPersonOptions(xDate, yDate, colors), true)
                // } else if (params.name == '沙溪所') {
                //     xDate = ['责任区1', '责任区2', '责任区3', '责任区4', '责任区5']
                //     yDate = [641, 423, 221, 123, 88]
                //     colors = ['#102129', '#1f3942', '#2a4f5f']
                //     homePersonmyChart.setOption(this.initPersonOptions(xDate, yDate, colors), true)
                // } else if (params.name == '灵溪所') {
                //     xDate = ['责任区1', '责任区2', '责任区3', '责任区4', '责任区5']
                //     yDate = [111, 531, 211, 431, 64]
                //     colors = ['#23b9e9', '#c76ee0', '#f05265']
                //     homePersonmyChart.setOption(this.initPersonOptions(xDate, yDate, colors), true)
                // } else if (params.name == '北门所') {
                //     xDate = ['责任区1', '责任区2', '责任区3', '责任区4', '责任区5']
                //     yDate = [887, 234, 452, 321, 154]
                //     colors = ['#b22d2b', '#614976', '#4c3042']
                //     homePersonmyChart.setOption(this.initPersonOptions(xDate, yDate, colors), true)
                // } else if (params.name == '江光所') {
                //     xDate = ['责任区1', '责任区2', '责任区3', '责任区4', '责任区5']
                //     yDate = [400, 500, 200, 450, 245]
                //     colors = ['#3089bf', '#77d8f9', '#f4fcfe']
                //     homePersonmyChart.setOption(this.initPersonOptions(xDate, yDate, colors), true)
                // } else if (params.name == '湖北') {
                //     xDate = ['武汉市', '黄石市', '宜昌市', '鄂州市', '荆门市']
                //     yDate = [88, 221, 641, 432, 123]
                //     colors = ['#2b5144', '#5a987f', '#94ebc1']
                //     homePersonmyChart.setOption(this.initPersonOptions(xDate, yDate, colors), true)
                // } else if (params.name == '上海') {
                //     xDate = ['黄浦区', '长宁区', '静安区', '虹口区', '闵行区']
                //     yDate = [641, 423, 221, 123, 88]
                //     colors = ['#f750c2', '#d6369a', '#bc1f76']
                //     homePersonmyChart.setOption(this.initPersonOptions(xDate, yDate, colors), true)
                // } else if (params.name == '北京') {
                //     xDate = ['东城区', '西城区', '海淀区', '昌平区', '大兴区']
                //     yDate = [111, 531, 211, 431, 64]
                //     colors = ['#7e81d5', '#86abe6', '#8fe5e3']
                //     homePersonmyChart.setOption(this.initPersonOptions(xDate, yDate, colors), true)
                // } else if (params.name == '广东') {
                //     xDate = ['珠海市', '东菀市', '佛山市', '中山市', '惠州市']
                //     yDate = [887, 234, 452, 321, 154]
                //     colors = ['#ba1432', '#6b0e33', '#2a0b35']
                //     homePersonmyChart.setOption(this.initPersonOptions(xDate, yDate, colors), true)
                // } else if (params.name == '浙江') {
                //     xDate = ['杭州市', '舟山市', '宁波市', '嘉兴市', '绍兴市']
                //     yDate = [400, 300, 200, 450, 245]
                //     colors = ['#f12e10', '#f36c15', '#f4a818']
                //     homePersonmyChart.setOption(this.initPersonOptions(xDate, yDate, colors), true)
                // } else if (params.name == '日本') {
                //     xDate = ['东京都', '北海道', '大阪府', '京都府', '43县']
                //     yDate = [88, 221, 641, 432, 123]
                //     colors = ['#6e978f', '#ad885a', '#e97b27']
                //     homePersonmyChart.setOption(this.initPersonOptions(xDate, yDate, colors), true)
                // } else if (params.name == '美国') {
                //     xDate = ['加利福尼亚州', '德克萨斯州', '纽约州', '俄亥俄州']
                //     yDate = [641, 423, 221, 123, 88]
                //     colors = ['#d54956', '#9f976e', '#73d781']
                //     homePersonmyChart.setOption(this.initPersonOptions(xDate, yDate, colors), true)
                // } else if (params.name == '俄罗斯') {
                //     xDate = ['西北联邦', '中央联邦', '南方联邦', '伏尔加联邦']
                //     yDate = [111, 531, 211, 431, 64]
                //     colors = ['#7d65c0', '#a47db4', '#e0a8c5']
                //     homePersonmyChart.setOption(this.initPersonOptions(xDate, yDate, colors), true)
                // } else if (params.name == '英国') {
                //     xDate = ['英格兰', '威尔士', '苏格兰', '北爱尔兰']
                //     yDate = [887, 234, 452, 321, 154]
                //     colors = ['#584d7b', '#9b836a', '#f8ce52']
                //     homePersonmyChart.setOption(this.initPersonOptions(xDate, yDate, colors), true)
                // } else if (params.name == '印度') {
                //     xDate = ['德里', '哈里亚纳邦', '旁遮普邦', '喜马偕尔邦', '北方邦']
                //     yDate = [400, 300, 200, 450, 245]
                //     colors = ['#0f97f2', '#7d629d', '#e1344f']
                //     homePersonmyChart.setOption(this.initPersonOptions(xDate, yDate, colors), true)
                // } else {
                //     this.$emit('showpeopledetail', params.name)
                // }
            })
        },
@@ -923,21 +943,22 @@
        backBegin () {
            this.dataDeep = 1
            let xDate, yDate, colors
            if (this.tabType == 0) {
                xDate = ['车站所', '沙溪所', '灵溪所', '北门所', '江光所', '水南所', '秦峰所', '茅家岭所', '西市所', '朝阳所']
                yDate = [881, 2211, 6414, 4321, 1232, 881, 2211, 6414, 4321, 1232]
                colors = ['#06B5D7', '#44C0C1', '#71C8B1']
            } else if (this.tabType == 1) {
                xDate = ['湖北', '上海', '北京', '广东', '浙江']
                yDate = [6414, 4231, 2211, 1231, 881]
                colors = ['#ef9faa', '#f7bfc6', '#fedade']
            } else if (this.tabType == 2) {
                xDate = ['日本', '美国', '俄罗斯', '英国', '印度']
                yDate = [881, 1231, 2211, 4321, 6414]
                colors = ['#7d65c0', '#a47db4', '#e0a8c5']
            }
            homePersonmyChart.setOption(this.initPersonOptions(xDate, yDate, colors), true)
            this.initPersonEcharts()
            // let xDate, yDate, colors
            // if (this.tabType == 0) {
            //     xDate = ['车站所', '沙溪所', '灵溪所', '北门所', '江光所', '水南所', '秦峰所', '茅家岭所', '西市所', '朝阳所']
            //     yDate = [881, 2211, 6414, 4321, 1232, 881, 2211, 6414, 4321, 1232]
            //     colors = ['#06B5D7', '#44C0C1', '#71C8B1']
            // } else if (this.tabType == 1) {
            //     xDate = ['湖北', '上海', '北京', '广东', '浙江']
            //     yDate = [6414, 4231, 2211, 1231, 881]
            //     colors = ['#ef9faa', '#f7bfc6', '#fedade']
            // } else if (this.tabType == 2) {
            //     xDate = ['日本', '美国', '俄罗斯', '英国', '印度']
            //     yDate = [881, 1231, 2211, 4321, 6414]
            //     colors = ['#7d65c0', '#a47db4', '#e0a8c5']
            // }
            // homePersonmyChart.setOption(this.initPersonOptions(xDate, yDate, colors), true)
        },
        getKeyPersonCount (arr) {
@@ -1020,7 +1041,36 @@
            })
        },
        //获取各个派出所的人口数量
        getPoliceStationInfo(){
          getVillagePersonStatisticInfo().then(res=>{
            if (res.data.code == 200){
              this.policeStationPersonInfo = res.data.data
              //异步,因此放进接口方法内部
              this.initPersonEcharts()
              this.clickPeopleChart()
            }
          })
        },
        //获取该派出所下的辖区
        getVillagePersonStatisticInfoByPoliceStationId(name,policeStationId){
          getVillagePersonStatisticInfoByPoliceStationId(name,policeStationId).then(res=>{
            if (res.data.code == 200){
              this.villagePersonStatisticInfoList = res.data.data
              var xDate = [],yDate = [],colors = ['#ccf9d0', '#f9d888', '#f7857e']
              this.villagePersonStatisticInfoList.forEach(e=>{
                  xDate.push(e.name)
                  yDate.push({
                    value:e.num,
                    name:e.name,
                    id:e.id
                  })
              })
              homePersonmyChart.setOption(this.initPersonOptions(xDate, yDate, colors), true)
            }
          })
        }
@@ -1242,4 +1292,4 @@
        stroke-dashoffset: 888;
    }
}
</style>
</style>
src/views/home/index.vue
@@ -83,22 +83,28 @@
        <el-dialog :title="peopleTitle" :modal="true" :visible.sync="peopleVisible" :before-close="peopleBeforeClose"
            :close-on-click-modal="true" class="area-details-box">
            <div class="item">
                <div>责任区负责人:</div>
                <div>王某某</div>
            </div>
            <div class="item">
                <div>责任区人口:</div>
                <div>10000</div>
            </div>
            <div class="item">
                <div>男女比例:</div>
                <div>0.92:1</div>
            </div>
            <div class="item">
                <div>所在地址:</div>
                <div>XXXXXXX</div>
            </div>
          <el-table
              :data="peopleInfoList"
              style="width: 100%"
              :header-cell-style="{ 'text-align': 'center', 'background-color': '#203c60', 'borderColor': '#324e75' }"
              :cell-style="{ 'text-align': 'center', 'borderColor': '#324e75', 'cursor': 'pointer' }"
          >
            <el-table-column prop="name" label="责任区名称"></el-table-column>
            <el-table-column prop="policeName" label="负责人"></el-table-column>
            <el-table-column prop="phone" label="联系电话"></el-table-column>
          </el-table>
          <div class="pages" ref="tablePagination">
            <el-pagination
                @current-change="handlePeopleCurrentChange"
                :page-size="peoplePage.pageSize"
                layout="total, pager"
                :total="peoplePage.count">
            </el-pagination>
          </div>
        </el-dialog>
        <el-dialog :title="equimentTitle" :modal="true" :visible.sync="equimentVisible"
@@ -404,7 +410,7 @@
import axios from "axios"
import { getPanoramaList } from "@/api/panorama"
import { getResidentialQuartersList } from '@/api/dept/index.js'
import {getAreaPage, getResidentialQuartersList} from '@/api/dept/index.js'
import monitoringList from '@/assets/data/monitoring.js'
import leftContainer from './components/leftContainer'
@@ -441,8 +447,15 @@
            phoneDetails: {},
            phoneTitle: '',
            peopleTitle: '',
            peopleId:"",
            phoneVisible: false,
            peopleVisible: false,
            peopleInfoList:[],
            peoplePage:{
              count:0,
              pageSize:5,
              currentPage:1
            },
            houseList: [],
            carList: [],
            cameraList: [],
@@ -1160,11 +1173,29 @@
            this.$refs.RegionSelect.style.left = (bodyWidth - domWidth) / 2 + 'px'
        },
        showpeopledetail (name) {
        showpeopledetail (id,name) {
            this.peopleTitle = name
            this.peopleId = id
            this.getPeopleInfoList()
            this.peopleVisible = true
        },
        getPeopleInfoList(){
          getAreaPage(this.peoplePage.currentPage,this.peoplePage.pageSize,this.peopleId).then(res=>{
            if (res.data.code == 200){
              this.peopleInfoList = res.data.data.records
              this.peoplePage.count = res.data.total
            }
          })
        },
      handlePeopleCurrentChange(currentPage){
          this.peoplePage.currentPage = currentPage
          this.getPeopleInfoList()
      },
        showlanddetail (name, type, id) {
            this.landVisible = true
            this.landTitle = name