<template>
<div>
  <div class="mrg-b">
    <div class="mrg-head">
      <!-- <el-input class="inline" v-model="query.quickCondition"  @keyup.enter.native="handleSearch" placeholder="快捷查询(移动单号)"></el-input> -->
      <el-button class="mrg-l" v-auth="50910060102" type="primary" @click="handleMoreSearch">更多</el-button>
      <el-button v-auth="50910060101" icon="el-icon-refresh" class="query__item" type="primary" @click="handleSearch" 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="ownerCode">
        <PublicQuery
        title="货主"
        baseUrl="/rep_web/repweb"
        cfgKey="repWmsCustomer"
        :valueField.sync="formData.ownerCode"
        @change="handelKitType">
        </PublicQuery>
      </el-form-item>
       <el-form-item
          label="源商品"
          prop="fmSku">
          <PublicQuery
          title="商品"
          baseUrl="/rep_web/repweb"
          cfgKey="repWmsSku"
          :valueField.sync="formData.fmSku"
          @change="handelKitType">
          </PublicQuery>
        </el-form-item>
         <el-form-item
          label="转移时间">
          <el-date-picker
            v-model="date3"
            type="datetimerange"
            format="yyyy-MM-dd HH:mm"
            value-format="yyyy-MM-dd HH:mm:ss"
            :default-time="['00:00:00', '23:59:59']"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            :picker-options="pickerOptions2"
            @change="getTime3">
          </el-date-picker>
        </el-form-item>
    </el-form>
  </div>
  </div>
</template>
<script>
import MoreQuery from './more-query'
import { today, yesterday, week, month, twoMonths, threeMonths } from '@/config/shortcuts'
export default {
  components: {
    MoreQuery
  },
  data () {
    return {
      query: {},
      moreQueryVisible: false,
      formData: {},
      date3: '',
      pickerOptions2: {
        shortcuts: [today, yesterday, week, month, twoMonths, threeMonths]
      },
      moreData: {}
    }
  },
  methods: {
    getTime3 (val) {
      this.formData.fromtfTime = val ? val[0] : ''
      this.formData.totfTime = val ? val[1] : ''
      this.$emit('getList', this.formData)
    },
    handelKitType () {
      this.$emit('getList', this.formData)
    },
    handleSearch () {
      this.$refs.formData.resetFields()
      this.date3 = ''
      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.ReportTfOrderList.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>
