<template>
<div>
<el-row class="query">
  <div class="query__retrieve">
    <!-- <el-input
      v-model="query.lot"
      placeholder="快捷查询（批次号）"
      @keyup.enter.native="e => toGetList(query)"
    ></el-input> -->
    <el-button v-auth="50940050102" class="query__item" type="primary" @click="moreQuery">更多</el-button>
    <el-button v-auth="50940050101" icon="el-icon-refresh" class="query__item" type="primary" @click="e => handelGetList(query)" plain circle></el-button>
    <el-button
    v-if="false"
      icon="el-icon-download"
      type="primary"
      @click="handleExcel"
      plain
      circle
    ></el-button>
    <MoreQuery
      :showMore="showMore"
      @close="showMore = false"
      @toGetList="toGetList"
    ></MoreQuery>
  </div>
</el-row>
<div class="inputBox">
      <el-form inline :model="formData" ref="formData" label-position="left">
         <el-form-item
            label="货主"
            prop="ownerCode">
            <PublicQuery
            title="货主"
            baseUrl="/enp_web/enpweb"
            cfgKey="enpWmsCustomer"
            :valueField.sync="formData.ownerCode"
            @change="handelKitType">
            </PublicQuery>
        </el-form-item>
        <el-form-item
          label="仓库"
          prop="projectIds">
          <PublicQuery
          title="仓库"
          baseUrl="/enp_web/enpweb"
          cfgKey="enpWmsShareWareHouse"
          :valueField.sync="formData.projectIds"
          @change="handelKitType">
          </PublicQuery>
        </el-form-item>
        <el-form-item
          label="商品"
          prop="skuCode">
          <PublicQuery
          title="商品"
          baseUrl="/enp_web/enpweb"
          cfgKey="enpWmsSkuCode"
          :valueField.sync="formData.skuCode"
          @change="handelKitType">
          </PublicQuery>
        </el-form-item>
        <el-form-item label="历史时间"
          prop="tranTime">
          <el-date-picker
            v-model="formData.tranTime"
            value-format="yyyy-MM-dd 00:00:00"
            @change="handelKitType"
          ></el-date-picker>
        </el-form-item>
    </el-form>
  </div>
</div>
</template>

<script>
import MoreQuery from './MoreQuery'
export default {
  components: { MoreQuery },
  created () {
  },
  mounted () {
  },

  data () {
    return {
      query: {}, // 查询条件
      showMore: false, // 显示更多查询
      formData: {},
      dateTime: '',
      moreData: {}
    }
  },
  methods: {
    handelKitType () {
      this.$emit('getList', this.formData)
    },
    dateTimeChange () {

    },
    handelGetList () {
      this.$refs.formData.resetFields()
      this.$emit('getList')
    },
    // 查询
    toGetList (query = {}) {
      this.moreData = query
      this.$emit('getList', query)
    },
    // 点击更多查询
    moreQuery () {
      this.showMore = true
    },
    handleExcel () {
      const url = this.$API.enterprise.warehousesInventoryList
      const options = this.moreData
      this.$exportExcel(url, options)
    },
  },
}
</script>

<style lang="scss" scoped>
.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;
    }
  }
  .query {
    &__retrieve {
      float: right;
      .el-input {
        max-width: 180px;
      }
    }
    &__item {
      margin-left: 10px;
    }
  }
</style>
