<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <div v-if="crud.props.searchToggle">
        <!-- 搜索 -->
        <label class="el-form-item-label">车辆类型</label>
        <el-input v-model="query.mthtype" clearable placeholder="车辆类型" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <label class="el-form-item-label">车牌号</label>
        <el-input v-model="query.plateNumber" clearable placeholder="车牌号" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <label class="el-form-item-label">入场车道名称</label>
        <el-input v-model="query.ingatename" clearable placeholder="入场车道名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <label class="el-form-item-label">出场车道名称</label>
        <el-input v-model="query.outgatename" clearable placeholder="出场车道名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <!-- <label class="el-form-item-label">通行时间</label>
        <date-range-picker
          v-model="buildDate"
          start-placeholder="开始时间"
          end-placeholder="结束时间"
          style="width: 300px;"
          class="filter-item"
          valueFormat="yyyy/MM/dd HH:mm:ss"
          @keyup.enter.native="crud.toQuery"
        /> -->
        <!-- <el-button class="filter-item" size="mini" type="success" icon="el-icon-refresh-left" @click="changeDate">搜索</el-button>
        <el-button class="filter-item" size="mini" type="warning" icon="el-icon-refresh-left" @click="resetDate">重置</el-button> -->
        <rrOperation :crud="crud" />
      </div>
      <!--如果想在工具栏加入更多按钮，可以使用插槽方式， slot = 'left' or 'right'-->
      <crudOperation :permission="permission" />
      <!--表格渲染-->
      <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
        <el-table-column type="selection" width="55" />
        <el-table-column prop="mthtype" label="车辆类型" />
        <el-table-column prop="plateNumber" label="车牌号" />
        <el-table-column prop="intime" label="入场时间" />
        <el-table-column prop="outtime" label="出场时间" />
        <el-table-column prop="ingatename" label="入场车道名称" />
        <el-table-column prop="outgatename" label="出场车道名称" />
        <el-table-column prop="ysje" label="应收金额" />
        <el-table-column prop="sfje" label="收费金额" />
      </el-table>
      <!--分页组件-->
      <pagination />
    </div>
  </div>
</template>

<script>
import crudDmPlateTraffic from '@/api/dmPlateTraffic'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import pagination from '@crud/Pagination'
// import DateRangePicker from '@/components/DateRangePicker/index'

const defaultForm = { id: null, userNumber: null, plateNumber: null, roomDevice: null, comeGoOut: null, buildAddress: null, accessTime: null }
const optShow = {
  add: false,
  edit: false,
  del: false,
  download: true,
  reset: true
}
export default {
  name: 'DmPlateTraffic',
  dicts: ['traffic_status', 'user_type'],
  components: { pagination, crudOperation, rrOperation }, //, DateRangePicker
  mixins: [presenter(), header(), form(defaultForm), crud()],
  cruds() {
    return CRUD({ title: 'api/dmPlateTraffic', url: 'api/dmPlateTraffic', idField: 'id', sort: 'id,desc', crudMethod: { ...crudDmPlateTraffic }, optShow })
  },
  data() {
    return {
      // buildDate: [],
      permission: {
        add: ['admin', 'dmPlateTraffic:add'],
        edit: ['admin', 'dmPlateTraffic:edit'],
        del: ['admin', 'dmPlateTraffic:del']
      },
      rules: {
      }}
  },
  methods: {
    // 钩子：在获取表格数据之前执行，false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      return true
    }
    // changeDate() {
    //   this.crud.query.intime = this.buildDate[0] || ''
    //   this.crud.query.outtime = this.buildDate[1] || ''
    //   this.crud.query.plateNumber = this.query.plateNumber
    //   this.crud.toQuery()
    // },
    // resetDate() {
    //   this.buildDate = []
    //   this.query.plateNumber = ''
    //   this.changeDate()
    // }
  }
}
</script>

<style scoped>

</style>
