statistics_device.vue 5.58 KB
<template>
  <div class="system-container">
    <div class="container">

      <!-- 搜索区域 开始 -->
      <div class="search_box">
        <el-form :model="searchForm" :inline="true" size="small">
          <el-form-item label="关键字:">
            <el-input placeholder="业务工单|姓名|车架号|设备号" class="a_input" maxlength="20" v-model.trim="searchForm.term">
            </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>
              </el-input>
            </el-popover>
          </el-form-item>
          <el-form-item>
            <div class="pre_select_box">
              <el-select v-model="searchForm.queryTimeType" class="small_select mr5" placeholder="请选择">
                <el-option label="设备激活时间" :value="1"></el-option>
                <el-option label="定位时间" :value="2"></el-option>
              </el-select>
              <el-date-picker v-model="searchForm.timeDate" class="data_picker" value-format="yyyy-MM-dd" type="daterange" range-separator="~" start-placeholder="开始日期" end-placeholder="结束日期" unlink-panels :picker-options="dataPickerOptions">
              </el-date-picker>
            </div>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" icon="el-icon-search" size="mini" @click="searchEvent()">搜索</el-button>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" icon="el-icon-refresh" size="mini" @click="rest()">重置</el-button>
          </el-form-item>
        </el-form>
      </div>
      <!-- 搜索区域 end -->

      <!-- 按钮区域 开始 -->
      <div class="links_group">
        <span>统计列表详情-设备纬度</span>
        <el-button class="pull-right" type="primary" icon="el-icon-download" size="mini" :loading="dloading" @click="downloadExcel">导出Excel</el-button>
      </div>
      <!-- 按钮区域 end -->

      <!-- 列表 开始 -->
      <glsx-table ref="glsxTable" v-loading="loading" :params="tableParams" :request="GET_OPEREPORT_DEVICE_SEARCH" :column="columnList">
      </glsx-table>
      <!-- 列表 end -->
    </div>

  </div>
</template>

<script>
import GlsxTable from "@/components/glsx-table/table";
import {
  GET_OPEREPORT_DEVICE_SEARCH,
  GET_OPEREPORT_DEVICE_EXPORT,
} from "services/report";
import GlsxOrganization from "@/components/glsx-organization";
import { deepClone, showToast, downFileByPath } from "@/utils/util";
import GlsxDialog from "@/components/dialog";
import {staticReportCarShortcuts} from '@/common'
export default {
  name: "StatisticsDevice",
  components: {
    GlsxTable,
    GlsxOrganization,
    GlsxDialog,
  },
  data() {
    return {
      searchForm: { queryTimeType: 1 },
      tableData: [],
      columnList: [
        { label: "业务工单号", prop: "bizOrderNo" },
        { label: "设备号", prop: "sns" },
        { label: "车牌号", prop: "licensePlate" },
        { label: "姓名", prop: "ownerName" },
        { label: "车架号", prop: "vin" },
        { label: "所属组织", prop: "belongLevels" },
        { label: "设备激活时间", prop: "activateTime" },
        { label: "定位时间", prop: "gpsTime" },
        { label: "定位地点", prop: "gpsAddress" },
        { label: "工单激活时间", prop: "woActivateTime" },
      ],
      pageTotal: 0,
      pageSize: 10,
      filterVisible: false,
      dloading: false,
      showPopover: false,
      loading: false,
      GET_OPEREPORT_DEVICE_SEARCH,
      tableParams: {},
      dataPickerOptions:{
        shortcuts: staticReportCarShortcuts,
      }
    };
  },

  mounted() {},
  methods: {
    // 获取查询参数
    getParams() {
      let oParams = deepClone(this.searchForm);
      let m = oParams.timeDate;
      let startIds = {
        1: "activateBeginDate",
        2: "gpsBeginDate",
      };
      let endIds = {
        1: "activateEndDate",
        2: "gpsEndDate",
      };
      if (m && m.length > 0) {
        oParams[startIds[oParams.queryTimeType]] = m[0];
        oParams[endIds[oParams.queryTimeType]] = m[1];
      }

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

    // 搜索
    searchEvent() {
      this.$refs.glsxTable.restParams();
      this.tableParams = this.getParams();
    },

    // 监听树
    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_OPEREPORT_DEVICE_EXPORT(oParams).then((res) => {
        _this.dloading = false;
        if (res.code != 200) {
          return false;
        }
        // window.open(res.data);
        downFileByPath(res.data)
      });
    },

    // 重置
    rest() {
      this.$refs.glsxTable.restParams()
      this.tableParams = {};
      this.searchForm = {queryTimeType: 1 };
      //this.$refs.glsxTable.rest();
    },
  },
};
</script>

<style lang="scss" scoped>
@import "@/styles/offline.scss";
</style>>