马宇豪
2023-07-12 e378faea25d7d71b6244ee70133877ea5ba7ec91
修改
已修改6个文件
146 ■■■■ 文件已修改
src/App.vue 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/login.js 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/Home/IndexEcharts.vue 93 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/Admin/HomeDefault.vue 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/Admin/msgRecord.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/Admin/notice.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/App.vue
@@ -15,10 +15,18 @@
  padding: 0px;
}
.inner{
    background-color: #fff;padding: 20px 10px;
    background-color: #fff;
  padding: 20px 10px;
    height: 88vh;
  overflow: hidden;
  overflow-y: scroll;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  &::-webkit-scrollbar {
    width: 0;
    background-color: transparent;
  }
}
.ftright{
    float:right;
src/api/login.js
@@ -29,4 +29,20 @@
        url:'/sys/districtInfo/all',
        method:'get',
    })
}
// 获取首页统计数据
export function getBasicData(){
    return request({
        url:'/statistics/basicData',
        method:'get',
    })
}
// 获取首页统计数据
export function getWarningData(){
    return request({
        url:'/statistics/warningIndex',
        method:'get',
    })
}
src/components/Home/IndexEcharts.vue
@@ -6,23 +6,63 @@
<script>
import * as echarts from 'echarts'
import {getBasicData, getWarningData} from "@/api/login";
export default {
  name: "index-echarts",
  data() {
    return {};
  },
  mounted() {
    this.initEchart();
    this.getData()
  },
  methods: {
    initEchart() {
    async getData(){
      const t = this
      const res = await getWarningData()
      if(res.data.code == 100){
        let data = res.data.data
        let redData = [0,0,0,0,0,0]
        let orangeData = [0,0,0,0,0,0]
        let yellowData = [0,0,0,0,0,0]
        let blueData = [0,0,0,0,0,0]
        if(data[1] && data[1].length>0){
          for(let i of data[1]){
            redData[i.disasterType - 1] = i.count
          }
        }
        if(data[2] && data[2].length>0){
          for(let i of data[2]){
            orangeData[i.disasterType - 1] = i.count
          }
        }
        if(data[3] && data[3].length>0){
          for(let i of data[3]){
            yellowData[i.disasterType - 1] = i.count
          }
        }
        if(data[4] && data[4].length>0){
          for(let i of data[4]){
            blueData[i.disasterType - 1] = i.count
          }
        }
        let whole = redData.concat(orangeData,yellowData,blueData)
        let maxNum = Math.max(...whole)
        t.initEchart(redData,orangeData,yellowData,blueData,maxNum);
      }else{
        this.$message.error(res.data.msg)
      }
    },
    initEchart(red,orange,yellow,blue,maxNum) {
      let chartDom = document.getElementById("echartsMain");
      let myChart = echarts.init(chartDom);
      myChart.setOption({
        legend: {
          data: ["红", "橙", "黄"],
          bottom: '10',
          data: ["红", "橙", "黄", "蓝"],
          bottom: 0,
          icon: 'circle'
        },
        grid:{
          bottom: "50%"
        },
        tooltip: {
          show: true,
@@ -34,12 +74,15 @@
        },
        radar: {
          shape: 'circle',
          center: ['50%','46%'],
          nameGap: 10,
          indicator: [
            { name: "地震", max: 80 },
            { name: "森林草原火灾", max: 80 },
            { name: "水旱", max: 80 },
            { name: "地质", max: 80 },
            { name: "气象", max: 80 }
            { name: "地震", max: maxNum },
            { name: "洪涝", max: maxNum },
            { name: "气象", max: maxNum },
            { name: "泥石流", max: maxNum },
            { name: "水旱", max: maxNum },
            { name: "森林草原火灾", max: maxNum }
          ],
        },
        series: [
@@ -47,35 +90,61 @@
            type: "radar",
            data: [
              {
                value: [10, 40, 20, 60, 10, 60],
                value: red,
                name: "红",
                lineStyle:{
                  color:'red'
                },
                itemStyle: {
                  color:'red'
                },
                areaStyle:{
                  color: 'red',
                  opacity: 0.2
                }
              },
              {
                value: [50, 14, 28, 26, 42, 21],
                value: orange,
                name: "橙",
                lineStyle:{
                  color:'#f66d05'
                },
                itemStyle: {
                  color:'#f66d05'
                },
                areaStyle:{
                  color: '#f66d05',
                  opacity: 0.2
                }
              },
              {
                value: [60, 20, 43, 73, 12, 80],
                value: yellow,
                name: "黄",
                lineStyle:{
                  color:'#f7ad00'
                },
                itemStyle: {
                  color:'#f7ad00'
                },
                areaStyle:{
                  color: '#f7ad00',
                  opacity: 0.2
                }
              },
              {
                value: blue,
                name: "蓝",
                lineStyle:{
                  color:'#1890ff'
                },
                itemStyle: {
                  color:'#1890ff'
                },
                areaStyle:{
                  color: '#1890ff',
                  opacity: 0.2
                }
              }
            ],
          },
        ],
src/views/Admin/HomeDefault.vue
@@ -13,17 +13,17 @@
        <div class="content-right">
          <div class="item">
            <p>本月通知数</p>
            <span>--</span>
            <span>{{basicData.notificationsThisMonthNum}}</span>
          </div>
          <a-divider type="vertical" style="height: 100%; margin: 0px 16px"/>
          <div class="item">
            <p>叫应数</p>
            <span>--</span>
            <span>{{basicData.responsesThisMonthNum}}</span>
          </div>
          <a-divider type="vertical" style="height: 100%; margin: 0px 16px"/>
          <div class="item">
            <p>叫应率</p>
            <span>--</span>
            <span>{{basicData.responsesRate}}</span>
          </div>
        </div>
      </div>
@@ -54,6 +54,8 @@
import Team from '@/components/Home/Team'
import Cookies from "js-cookie";
import {getUserInfo} from "@/util/storage";
import {getResponseRecord} from "@/api/list";
import {getBasicData, getbasicData} from "@/api/login";
export default {
  name: 'home-default',
@@ -67,11 +69,12 @@
  },
  data() {
    return {
      userInfo: getUserInfo()
      userInfo: getUserInfo(),
      basicData: {}
    };
  },
  created() {
    this.getData()
  },
  computed: {
    dateTime () {
@@ -84,6 +87,17 @@
        return '晚上好'
      }
    }
  },
  methods:{
    async getData(){
      const t = this
      const res = await getBasicData()
      if(res.data.code == 100){
        t.basicData = res.data.data
      }else{
        this.$message.error(res.data.msg)
      }
    }
  }
}
</script>
src/views/Admin/msgRecord.vue
@@ -167,6 +167,7 @@
      align-items: center !important;
      .tit{
        width: 50%;
        color: @base
      }
    }
    /deep/ .ant-card-actions{
src/views/Admin/notice.vue
@@ -369,7 +369,7 @@
              }
            }
          }
          return file;
          return file
        });
        this.fileList = fileList;
      },