index.vue 4.63 KB
<!-- 车辆管理 -->
<template>
  <d2-container class="reportingLogs">
    <el-form
      :inline="true"
      :model="searchForm"
      label-width="85px"
    >
      <el-form-item label="上报时间">
        <el-date-picker
                        v-model="times"
                        type="datetimerange"
                        range-separator="至"
                        start-placeholder="开始日期"
                        end-placeholder="结束日期">
                        </el-date-picker>
      </el-form-item>
      <el-form-item label="车辆编号">
          <el-input v-model="searchForm.carNum" placeholder="请输入车辆编号" clearable></el-input>
      </el-form-item>
      <el-form-item label="归属车辆段">
          <el-select v-model="searchForm.depot" placeholder="请选择" clearable filterable>
            <el-option label="111" value="1"></el-option>
            <el-option label="222" value="2"></el-option>
          </el-select>
      </el-form-item>
      <el-form-item label="子系统编号">
          <el-input v-model="searchForm.subsystemNum" placeholder="请输入子系统编号" clearable></el-input>
      </el-form-item>
      <el-form-item>
          <el-button type="primary" @click="handleSearch">查询</el-button>
      </el-form-item>
    </el-form>
    <el-row style="height: 40px; line-height: 40px">
        <el-col span="12">上报日志列表</el-col>
        <el-col span="12" style="text-align: right">
            <el-button>导出</el-button>
        </el-col>
    </el-row>
    <el-table
      :data="tableData"
      border
      style="margin: 20px 0;"
    >
      <el-table-column
        align="center"
        width="60px"
        label="序号"
        type='index'
      ></el-table-column>
      <el-table-column
        v-for="(item, index) in tableColumns"
        :key="index"
        :label="item.label"
        :prop="item.prop"
        :width="item.width"
        align="center"
      >
        <template slot-scope="scope">
          <template v-if="item.formatter">
            {{item.formatter(scope.row)}}
          </template>
          <template v-else>
            {{tableData[scope.$index][item.prop]}}
          </template>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      background
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="currentPage"
      :page-sizes="[10,20,30,40]"
      :page-size="pageSize"
      :total="total"
      layout="sizes,total,->,prev,pager,next,jumper"
    >
    </el-pagination>
  </d2-container>
</template>

<script>
export default {
  name: 'reportingLogs',
  data () {
    return {
      times: [],
      searchForm: {
          beginTime: '',
          endTime: '',
          carNum: '',
          depot: '',
          subsystemNum: '',
      },
      tableData: [{
        reportTime:'2019-08-16  14:45:21',
        carNum: 'CRH45661-5648',
        depot: '青岛',
        subsystemNum: '3#1F',
        subsystemType:'座椅',
        subsystemManufactor:'长春通富机电设备有限公司',
        reportContent: '00x4561aa'
      }, {
        reportTime:'2019-08-16  14:45:21',
        carNum: 'CRH45661-5648',
        depot: '青岛',
        subsystemNum: '3#1F',
        subsystemType:'座椅',
        subsystemManufactor:'长春通富机电设备有限公司',
        reportContent: '00x4561aa'
      }, {
        reportTime:'2019-08-16  14:45:21',
        carNum: 'CRH45661-5648',
        depot: '青岛',
        subsystemNum: '3#1F',
        subsystemType:'座椅',
        subsystemManufactor:'长春通富机电设备有限公司',
        reportContent: '00x4561aa'
      }],
      tableColumns: [{
          label: '上报时间',
          prop: 'reportTime'
      }, {
          label: '车辆编号',
          prop: 'carNum'
      }, {
          label: '归属车辆段',
          prop: 'depot'
      }, {
          label: '子系统编号',
          prop: 'subsystemNum'
      }, {
          label: '子系统类型',
          prop: 'subsystemType'
      }, {
          label: '子系统厂家',
          prop: 'subsystemManufactor'
      }, {
          label: '上报内容',
          prop: 'reportContent'
      }],
      // 页码
      currentPage: 1,
      pageSize: 10,
      total: 30
    }
  },

  methods: {
    // 搜索
    handleSearch() {
      console.log(this.searchForm)
    },

    // 页码
    handleSizeChange(value) {
      console.log(value)
      this.pageSize = value
      // 调接口
    },

    handleCurrentChange(value) {
      console.log(value)
      this.currentPage = value
      // 调接口
    }
  }
}

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