<template>
<el-row class="query">
  <div class="query__retrieve">
    <!-- <el-input
      class="query__item"
      v-model="query.queryOwnerCode"
      placeholder="快捷查询（货主编码）"
      @keyup.enter.native="e => toGetList()"
    ></el-input>
    <el-input
      class="query__item"
      v-model="query.querySkuCode"
      placeholder="快捷查询（商品编码）"
      @keyup.enter.native="e => toGetList()"
    ></el-input> -->
    <!-- <el-button v-auth="50920070102" class="query__item" type="primary" @click="moreQuery">更多</el-button> -->
    <el-row type="flex" justify="start">
      <el-col :span="22"></el-col>
      <el-col :span="2">
        <el-button v-auth="50920070101" icon="el-icon-refresh" class="query__item" type="primary" @click="handleRefresh" plain circle></el-button>
        <el-button
        v-if="false"
          icon="el-icon-download"
          type="primary"
          @click="handleExcel"
          plain
          circle
        ></el-button>
      </el-col>
    </el-row>

    <div class="inputBox">
        <el-form inline :model="query" ref="query" label-position="left">
          <el-form-item label="货主" prop="ownerCodes">
            <PublicQuery
              title="货主"
              cfgKey="repWmsCustomer"
              baseUrl="/rep_web/repweb"
              :valueField.sync="query.ownerCodes"
            ></PublicQuery>
          </el-form-item>
          <el-form-item label="商品" prop="skuCodes">
            <PublicQuery
              title="商品"
              cfgKey="repWmsSku"
              baseUrl="/rep_web/repweb"
              :valueField.sync="query.skuCodes"
            ></PublicQuery>
          </el-form-item>

          <el-form-item label="批次号" prop="lot">
            <el-input v-model="query.lot" @keyup.enter.native="handleSearch"></el-input>
          </el-form-item>
        </el-form>
      </div>

    <!-- <MoreQuery
      :queryProp="query"
      :showMore="showMore"
      @close="showMore = false"
      @toGetList="toGetList"
    ></MoreQuery> -->
  </div>
</el-row>
</template>

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

  data () {
    return {
      query: {}, // 查询条件
      showMore: false, // 显示更多查询
      moreData: {}
    }
  },
  methods: {
    handleRefresh () {
      this.$refs.query.resetFields()
      this.$emit('getList')
    },
    // 搜索
    handleSearch () {
      const query = { ...this.query, lot: `%${this.query.lot || ''}%` }
      this.moreData = query
      this.$emit('getList', query)
    },
    // 查询
    toGetList (query = {}) {
      this.moreData = query
      this.$emit('getList', Object.assign({}, this.query, query))
    },
    // 点击更多查询
    moreQuery () {
      this.showMore = true
    },
    handleExcel () {
      const url = this.$API.summaryReport.standardWhAgeList
      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;
  }
}

</style>
