index.vue 3.57 KB
<!-- 车辆管理 -->
<template>
  <d2-container class="reportingLogs">
    <el-form
      :inline="true"
      :model="searchForm"
      label-width="85px"
      slot="header"
    >
      <el-form-item label="上报时间">
        <el-date-picker
          v-model="reportTime"
          type="daterange"
          value-format="yyyy-MM-dd"
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="车辆编号">
          <el-input v-model="searchForm.trafficCode" placeholder="请输入车辆编号" clearable></el-input>
      </el-form-item>
      <el-form-item label="归属车辆段">
          <el-select v-model="searchForm.stationCode" placeholder="请选择" clearable filterable>
            <el-option v-for="(item, index) in baseData.station"
              :key="index"
              :value="item.confCode"
              :label="item.confValue"
            ></el-option>
          </el-select>
      </el-form-item>
      <el-form-item label="子系统编号">
          <el-input v-model="searchForm.subSystemCode" placeholder="请输入子系统编号" clearable></el-input>
      </el-form-item>
      <el-form-item>
          <el-button type="primary"  icon="el-icon-search" :id="tableParams.btnId">查询</el-button>
      </el-form-item>
    </el-form>
     <d2-table-header title="上报日志列表"></d2-table-header>
     <d2-table
      :searchForm="searchForm"
      :tableParams="tableParams"
      :getListApi="getListApi"
     ></d2-table>
  </d2-container>
</template>

<script>
import { getLogsApi, exportApi } from '@api/reportingLogs'
import { BaseData } from '@/common/constants'
import notice from '@/common/notice'
import util from '@/libs/util'
export default {
  name: 'FimsReportingLogs',
  data() {
    return {
      getListApi: getLogsApi,
      reportTime: '',
      searchForm: {
        startTime: '',
        endTime: '',
        trafficCode: '',
        stationCode: '',
        subSystemCode: ''
      },
      // 表格参数
      tableParams: {
        btnId: new Date().getTime() + parseInt(Math.random() * 1000),
        listName: 'loges',
        tableColumns: [{
          label: '上报时间',
          prop: 'reportTime',
          minWidth: '200'
        }, {
          label: '车辆编号',
          prop: 'trafficCode',
          width: '120'
        }, {
          label: '归属车辆段',
          prop: 'stationName',
          minWidth: '100'
        }, {
          label: '子系统编号',
          prop: 'subSystemCode',
          width: '160'
        }, {
          label: '子系统类型',
          prop: 'subSystemType',
          width: '100'
        }, {
          label: '子系统厂家',
          prop: 'merchantName',
          minWidth: '200'
        }, {
          label: '上报内容',
          prop: 'reportValue',
          minWidth: '200'
        }]
      },
      baseData: {
        station: []
      }
    }
  },

  watch: {
    'reportTime'(value) {
      Object.assign(this.searchForm, util.formatTime(this.reportTime))
    }
  },

  mounted() {
    this.loadBaseData()
  },

  methods: {
    async loadBaseData() {
      const data = await this.$store.dispatch('d2admin/base/get', BaseData.STATION.KEY)
      this.baseData.station = data
    }

    // 需求变更
    // handleExport() {
    //   exportApi(this.searchForm).then(res => {
    //     this.$open(res.url)
    //     notice.okTips()
    //   }).catch(() => {
    //     notice.errorTips()
    //   })
    // }
  }
}

</script>
<style scoped>
</style>