speed.vue 7.38 KB
<template>
  <div class="">

    <div class="page_title">
      <h2 class="h2">
        <span>超速报警</span>
        <el-popover placement="right-start" trigger="hover">
          <div class="popover_box">
            <h3 class="h3">上点时间间隔:</h3>
            <p>默认为15s</p>
            <h3 class="h3">超速开始时间:</h3>
            <p>当连续两个上点的速度>=90km/h时,取第一个上点的上点时间作为该段超速记录的超速开始时间</p>
            <h3 class="h3">超速结束时间:</h3>
            <p>当连续两个上点的速度&lt;=90km/h时,取第一个上点的上点时间作为该段超速记录的超速结束时间</p>
            <h3 class="h3">平均车速:</h3>
            <p>即超速区间内的平均时速;平均车速 = 超速区间内所有上点的速度之和÷上点数</p>
          </div>
          <span class="title_tip_icon" slot="reference"><i class="el-icon-question"></i></span>
        </el-popover>
      </h2>
      <h3 class="h3">用于统计和展示有线设备的超速报警</h3>
    </div>

    <!-- 搜索区域 开始 -->
    <div class="search_box">
      <el-form :inline="true" size="small">
        <el-form-item label="关键字">
          <el-input v-model.trim="searchForm.keywords" class="long_input" placeholder="设备号 | 车架号 | 姓名  | 业务工单号" maxlength="20"></el-input>
        </el-form-item>
        <el-form-item label="车辆归属:">
          <el-popover v-model="filterVisible" placement="bottom-start" width="400" trigger="click">
            <div>
              <glsx-organization @change="onChange"></glsx-organization>
            </div>
            <el-input v-model="searchForm.orgName" :placeholder="searchForm.specialShopName || '所属组织'" slot="reference" readonly clearable>
            </el-input>
          </el-popover>
        </el-form-item>
        <el-form-item label="报警时间:">
          <el-date-picker v-model="searchForm.timeDate" type="daterange" class="data_picker" unlink-panels range-separator="~" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd" :picker-options="offPickerOptions">
          </el-date-picker>
        </el-form-item>
        <el-form-item>
          <el-button icon="el-icon-search" type="primary" @click="getList(1)">搜索</el-button>
        </el-form-item>
        <el-form-item>
          <el-button icon="el-icon-refresh" type="default" @click="rest()">重置</el-button>
        </el-form-item>
      </el-form>
    </div>
    <!-- 搜索区域 end -->

    <!-- 操作区域 开始 -->
    <div class="links_group">
      <span class="name">超速报警信息</span>
      <el-button type="primary" size="small" icon="el-icon-download" :loading="dloading" @click="downloadExcel()">导出excel</el-button>
    </div>
    <!-- 操作区域 end -->

    <!-- 表格区域 开始 -->
    <div class="table_box">
      <el-table class="el_table" :data="tableData" border size="small" v-loading="tloading">
        <el-table-column label="业务工单号" prop="workOrderNo" show-overflow-tooltip>
          <template slot-scope="{row}">{{row.workOrderNo||'--'}}</template>
        </el-table-column>
        <el-table-column label="姓名" prop="ownerName" show-overflow-tooltip>
          <template slot-scope="{row}">{{row.ownerName||'--'}}</template>
        </el-table-column>
        <el-table-column label="设备号" prop="sn" show-overflow-tooltip></el-table-column>
        <el-table-column label="车架号" prop="vin" show-overflow-tooltip>
          <template slot-scope="{row}">{{row.vin||'--'}}</template>
        </el-table-column>
        <el-table-column label="超速开始时间" prop="beginTime" show-overflow-tooltip>
          <template slot-scope="{row}">{{row.beginTime||'--'}}</template>
        </el-table-column>
        <el-table-column label="超速结束时间" prop="endTime" show-overflow-tooltip>
          <template slot-scope="{row}">{{row.endTime||'--'}}</template>
        </el-table-column>
        <el-table-column label="超速时长" prop="durationFormat" show-overflow-tooltip>
          <template slot-scope="{row}">{{row.durationFormat||'--'}}</template>
        </el-table-column>
        <el-table-column label="平均车速" prop="averageSpeed" show-overflow-tooltip>
          <template slot-scope="{row}">{{(row.averageSpeed||row.averageSpeed == 0)?row.averageSpeed + 'km/h':'--'}}</template>
        </el-table-column>
      </el-table>
      <div class="pagination_list">
        <el-pagination background layout="sizes, total,prev, pager, next, jumper" :total="pageTotal" :current-page.sync="currentPage" :page-size="pageSize" :page-sizes="pageSizes" @current-change="getList" @size-change="changePageSize" />
      </div>
    </div>
    <!-- 表格区域 end -->

  </div>
</template>
<script>
import { speedShortcuts } from "@/common";
import GlsxOrganization from "@/components/glsx-organization";
import {
  GET_SPEEDING_EXPORT,
  GET_SPEEDING_SEARCH,
} from "@/services/alarmCenter";
import { deepClone, showToast, downFileByPath } from "@/utils/util";
export default {
  components: {
    GlsxOrganization,
  },
  data() {
    return {
      searchForm: {},
      currentPage: 1,
      pageSizes: [10, 20, 30, 40],
      pageSize: 10,
      pageTotal: 0,
      tableData: [],
      showDialog: false,
      uploadFile: {},
      showResult: false,
      loading: false,
      offPickerOptions: {
        shortcuts: speedShortcuts,
      },
      filterVisible: false,
      orgInfo: {},
      dloading: false,
      tloading: false,
    };
  },
  created() {
    this.getList();
  },
  mounted() {},
  methods: {
    // 重置
    rest() {
      this.searchForm = {};
      this.currentPage = 1;
      this.pageSize = 10;
      this.fenceId = "";
      this.getList();
    },

    // 获取查询参数
    getParams() {
      let oParams = deepClone(this.searchForm);
      let m = oParams.timeDate;
      if (m && m.length > 0) {
        oParams.startTime = m[0];
        oParams.endTime = m[1];
      }

      delete oParams.orgName;
      delete oParams.timeDate;
      return oParams;
    },

    // 获取数据列表
    getList(current) {
      let oParams = this.getParams();
      oParams.pageSize = this.pageSize;
      oParams.pageNumber = current || this.currentPage;
      this.tloading = true;
      if (current) {
        this.currentPage = current;
      }
      GET_SPEEDING_SEARCH(oParams).then((res) => {
        this.tloading = false;
        let obj = res.data || {};
        this.tableData = obj.list || [];
        this.pageTotal = obj.totalElements;
      });
    },

    //每页展示
    changePageSize(e) {
      this.pageSize = e;
      this.getList();
    },

    // 监听树
    onChange(e) {
      this.filterVisible = false;
      console.log(e);
      if (e) {
        this.orgInfo = e.origin;
        this.searchForm.orgId = e.origin.orgId;
        this.searchForm.orgType = e.origin.type;
        this.searchForm.orgName = e.origin.orgName;
      }
    },

    // 导出excel
    downloadExcel() {
      let _this = this;
      let oParams = this.getParams();
      _this.dloading = true;

      GET_SPEEDING_EXPORT(oParams).then((res) => {
        _this.dloading = false;
        if (res.code != 200) {
          return false;
        }
        //window.open(res.data);
        downFileByPath(res.data);
      });
    },
  },
};
</script>
<style lang="scss" scoped>
@import "@/styles/hadoop.scss";
</style>