zhanghua
2022-12-15 0a8e4f9371a403db92f2894a78363600e5583908
优化
3个文件已修改
151 ■■■■■ 已修改文件
src/components/map/index.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/intelligentPatrol/studyJudge/index.vue 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/intelligentPatrol/trendAnalysis/index.vue 126 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/map/index.vue
@@ -27,7 +27,7 @@
        // console.log("_zoom---", that.zoom);
        // console.log("_point---", JSON.stringify(that.point));
        that.map.setZoomAndCenter(that._zoom, [that.point.x, that.point.y]);
        that.map.setZoomAndCenter(that.zoom, [that.point.x, that.point.y]);
        if (that.mark) {
          // 创建一个 Marker 实例:
          var marker = new AMap.Marker({
src/views/intelligentPatrol/studyJudge/index.vue
@@ -249,13 +249,7 @@
  created() {
    this.getInspectionData();
    this.initEventParams();
    basecase
      .getInspectionCountData()
      .then((res) => {
        this.countData = res;
      })
      .catch((err) => this.$message.error(err));
    this.getInspectionCount();
    getStoreInfoList({ current: 1, size: 100 })
      .then(({ list }) => {
        this.storeList = list;
@@ -280,7 +274,7 @@
  },
  mounted() {
    this.timer = setInterval(() => {
      setTimeout(this.getInspectionData, 0);
      this.getInspectionCount();
    }, 1000 * 10);
  },
  data() {
@@ -374,8 +368,18 @@
    };
  },
  methods: {
    getInspectionCount() {
      basecase
        .getInspectionCountData({
          showLoading: false,
        })
        .then((res) => {
          this.countData = res;
        })
        .catch((err) => this.$message.error(err));
    },
    openDialogTable(){
      this.isShowTable = true
      this.isShowTable = true;
    },
    pageChange(type) {
      if (type === "next") {
@@ -695,7 +699,6 @@
        }
        .left-form > ::v-deep.el-form-item__label {
          font-size: 16px !important;
        }
        .img-item {
          display: flex;
src/views/intelligentPatrol/trendAnalysis/index.vue
@@ -1,10 +1,10 @@
<template>
  <div style="height: 95%">
    <div class="trend-title">趋势分析</div>
  <div class="trend-analysis">
    <!-- 侧边栏 -->
    <div class="trend-side">
      <!-- 输入区域 -->
      <div class="trend-input-area">
        <span class="trend-title">趋势分析</span>
        <el-form ref="form" :model="search" label-width="6vw">
<!--          <el-form-item label="类型查询">-->
<!--            <el-select v-model="search.type" @change="searchList" placeholder="内容信息">-->
@@ -12,8 +12,14 @@
<!--            </el-select>-->
<!--          </el-form-item>-->
          <el-form-item class="time-area" label="时间范围">
            <el-date-picker @change="searchList" start-placeholder="开始时间" end-placeholder="结束时间" v-model="search.timeRange"
                            type="datetimerange" value-format="yyyy-MM-dd HH:mm:ss">
              <el-date-picker
                @change="searchList"
                start-placeholder="开始时间"
                end-placeholder="结束时间"
                v-model="search.timeRange"
                type="datetimerange"
                value-format="yyyy-MM-dd HH:mm:ss"
              >
            </el-date-picker>
          </el-form-item>
        </el-form>
@@ -23,11 +29,18 @@
        <!-- 点位切换 -->
        <div class="trend-data-header">
          <el-button type="text" @click="tabChange(1)">高发点位</el-button>
          <el-button type="text" @click="tabChange(2)">首次违规点位</el-button>
            <el-button type="text" @click="tabChange(2)"
              >首次违规点位</el-button
            >
        </div>
        <!-- 对应数据 -->
        <div class="trend-data-main">
          <div class="point-item" v-for="item in trendAnalysisList" :key="item.id" @click="pointClick(item)">
            <div
              class="point-item"
              v-for="item in trendAnalysisList"
              :key="item.id"
              @click="pointClick(item)"
            >
            <span class="point-name">{{ item.name }}</span>
            <span>{{ item.count }}</span>
          </div>
@@ -35,25 +48,28 @@
      </div>
    </div>
    <div class="trend-main">
      <div class="map">
            <MyMap :point="point" :zoom="zoom" :mark="mark" @fatherMethod="fatherMethod"></MyMap>
          <MyMap
            :point="point"
            :zoom="zoom"
            :mark="mark"
            @fatherMethod="fatherMethod"
          ></MyMap>
      </div>
    </div>
    <el-dialog
        title="提示"
        title="趋势图"
        :visible.sync="echartsDialogVisible"
        width="30%"
        :before-close="handleClose">
      <div style="height: 500px;width: 500px;" id="echarts">
      </div>
        :before-close="handleClose"
      >
        <div style="height: 500px; width: 500px" id="echarts"></div>
    </el-dialog>
    </div>
  </div>
</template>
<script>
import * as echarts from 'echarts'
import * as echarts from "echarts";
import basecase from "@/api/operate/basecase";
import { CATEGOTY } from "@/utils/helper";
import MyMap from "@/components/map";
@@ -61,7 +77,7 @@
export default {
  components :{MyMap},
  created() {
    this.searchList()
    this.searchList();
  },
  mounted() {
@@ -71,16 +87,17 @@
  computed: {
    categoryOptions() {
      return CATEGOTY;
    }
    },
  },
  data() {
    return {
      echartsList:null,
      echartsDateList: [],
      echartsDataList: null,
      echartsDialogVisible:false,
      search: {
        type: null,
        timeRange: null
        timeRange: null,
      },
      timeRangeFlag: false,
      trendAnalysisList: [],
@@ -89,40 +106,39 @@
      pointName: null,
      point: { x: "119.27179890", y: "28.59027084" },
      mark: null,
      zoom: 15,
    }
      zoom: 13,
    };
  },
  methods: {
    fatherMethod(){
      console.log('7777')
      this.echartsDialogVisible=true
      this.echartsDialogVisible = true;
      this.$nextTick(function (){
        this.renderEchart(this.echartsList);
      })
        this.renderEchart(this.echartsDateList, this.echartsDataList);
      });
    },
    handleClose(){
      this.echartsDialogVisible = false
      this.echartsDialogVisible = false;
    },
    renderEchart(dataList) {
    renderEchart(dateTimeList, dataList) {
      if (!this.echarts) {
        this.echarts = echarts.init(document.getElementById('echarts'));
        this.echarts = echarts.init(document.getElementById("echarts"));
      }
      // 绘制图表
      this.echarts.setOption({
        xAxis: {
          name: '日/周',
          name: "日/周",
          data: dateTimeList,
        },
        yAxis: {
          name: '报警量(次)',
          name: "报警量(次)",
        },
        series: [
          {
            data: dataList,
            type: 'line',
            smooth: true
          }
        ]
            type: "line",
            smooth: true,
          },
        ],
      });
    },
    async searchList() {
@@ -130,9 +146,10 @@
      const trendAnalysisParam = {
        startTime,
        endTime,
        type: this.search.type
      }
      this.trendAnalysisList = this.highFlag ? await basecase.getTrendAnalysisData(trendAnalysisParam)
        type: this.search.type,
      };
      this.trendAnalysisList = this.highFlag
        ? await basecase.getTrendAnalysisData(trendAnalysisParam)
          : await basecase.getFirstTrendAnalysisData(trendAnalysisParam);
    },
@@ -149,22 +166,38 @@
          };
      this.zoom = 19;
      this.mark = { title: data.address };
      basecase.getPointTrendAnalysisData({ longitude: data.longitude,latitude: data.latitude })
          .then(res => {
      basecase
        .getPointTrendAnalysisData({
          longitude: data.longitude,
          latitude: data.latitude,
        })
        .then((res) => {
            // const countList = res.map(item => +item.count);
            this.echartsList= res.map(item => +item.count);
          this.echartsDataList = [];
          this.echartsDateList = [];
          res.forEach((item) => {
            this.echartsDataList.push(item.count);
            this.echartsDateList.push(item.dateTime);
          });
            // this.renderEchart(countList);
          })
          .catch(err => this.$message.error(err))
    }
        .catch((err) => this.$message.error(err));
  },
}
  },
};
</script>
<style lang="scss" scoped>
.trend-title {
  color: #4b9bb7;
  line-height: 40px;
  font-size: 26px;
  text-align: left;
  margin-left: 20px;
}
.trend-analysis {
  height: 100%;
  padding: 10vh 0vw;
  padding: 10px 0px;
  color: #4b9bb7;
  display: flex;
@@ -225,6 +258,7 @@
    flex: 1;
    border: 1px solid #09152f;
    display: flex;
    margin-left: 20px;
    .trend-main-echarts {
      width: 500px;
      height: 400px;
@@ -239,6 +273,6 @@
}
.map {
  height: 100%;
  min-width: 80%;
  width: 98%;
}
</style>