<template>
<div>
  <div class="mrg-b">
    <div class="mrg-head">
      <!-- <el-input class="inline" v-model="query.ldNo"  @keyup.enter.native="handleSearch" placeholder="快捷查询(装车单号)"></el-input> -->
      <el-button class="mrg-l" v-auth="50910030102" type="primary" @click="handleMoreSearch">更多</el-button>
      <el-button v-auth="50910030101" icon="el-icon-refresh" class="query__item" type="primary" @click="handleGetList" plain circle></el-button>
      <el-button
      v-if="false"
        icon="el-icon-download"
        type="primary"
        @click="handleExcel"
        plain
        circle
      ></el-button>
    </div>
    <more-query
    :moreQueryVisible="moreQueryVisible"
    @toGetList="toGetList"
    @close="moreQueryVisible=false"></more-query>
  </div>
   <div class="inputBox">
      <el-form inline :model="formData" ref="formData" label-position="left">
         <!-- <el-form-item
          label="装车单号"
          prop="ldNo">
          <el-input v-model="formData.ldNo"  @keyup.enter.native="handleSearch" placeholder="快捷查询(装车单号)"></el-input>
        </el-form-item> -->
         <el-form-item
          label="状态"
          prop="headerStatus">
          <el-select multiple v-model="headerStatus" @change="val => handleStatus(val)">
            <el-option label="创建" value="10"></el-option>
            <el-option label="部分装车" value="30"></el-option>
            <el-option label="完全装车" value="40"></el-option>
            <el-option label="部分交接" value="50"></el-option>
            <el-option label="完全交接" value="60"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item
          label="车型"
          prop="vehicleType">
          <el-select multiple v-model="vehicleType" @change="val => handleVehicleType(val)">
            <el-option label="牵引车" value="TR"></el-option>
            <el-option label="大型车辆" value="VE"></el-option>
            <el-option label="小型车辆" value="HI"></el-option>
          </el-select>
        </el-form-item>
      </el-form>
  </div>
  </div>
</template>
<script>
import MoreQuery from './more-query'
export default {
  components: {
    MoreQuery
  },
  data () {
    return {
      query: {},
      moreQueryVisible: false,
      formData: {},
      headerStatus: [],
      vehicleType: [],
      moreData: {}
    }
  },
  methods: {
    handleVehicleType (val) {
      this.formData.vehicleType = val.join(',')
      this.$emit('getList', this.formData)
    },
    handleStatus (val) {
      this.formData.headerStatus = val.join(',')
      this.$emit('getList', this.formData)
    },
    handleGetList () {
      this.headerStatus = []
      this.vehicleType = []
      this.$refs.formData.resetFields()
      this.$emit('getList')
    },
    // 更多搜索
    handleMoreSearch () {
      this.moreQueryVisible = true
    },

    toGetList (query) {
      this.moreQueryVisible = false
      this.moreData = query
      this.$emit('getList', query)
    },

    handleExcel () {
      const url = this.$API.storageTasks.ReportLdDetailList.getList
      const options = this.moreData
      this.$exportExcel(url, options)
    },
  }
}
</script>
<style lang="scss" scoped>
.mrg-head {
  float: right;
}
.inputBox {
    width: 100%;
    border: 1px solid #d1d5db;
    margin-top: 10px;
    margin-bottom: 10px;
    border-radius: 10px;
    padding-bottom: 10px;
    padding-left: 10px;
    .el-form-item {
      margin-bottom: 0px;
      margin-top: 10px;
    }
  }
  .mrg-b{
        margin-bottom: 20px;
        overflow: hidden;
    }
    .mrg-l{
        margin-left:10px;
    }
  .inline{
    width: 15%
  }
   .query {
    &__operations {
      float: left;
    }
    &__retrieve {
      float: right;
      .el-input {
        max-width: 180px;
      }
    }
    &__item {
      margin-left: 10px;
    }
  }
</style>
