<template>
  <div class="mrg-b">
    <div>
      <!-- <el-input class="inline" v-model="query.queryOwnerCode"  @keyup.enter.native="handleSearch" placeholder="快捷查询(货主编码)"></el-input>
      <el-input class="inline mrg-l" v-model="query.querySkuCode"  @keyup.enter.native="handleSearch" placeholder="快捷查询(商品编码)"></el-input> -->
      <!-- <el-button class="mrg-l" v-auth="50930050102" type="primary" @click="handleMoreSearch">更多</el-button> -->
      <el-row type="flex" justify="start">
        <el-col :span="22"></el-col>
        <el-col :span="2">
          <el-button v-auth="50930050101" 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>
    <div class="inputBox">
      <el-form inline :model="query" ref="query" label-position="left">
       <el-form-item
        label="货主"
        prop="ownerCode">
        <PublicQuery
        title="货主"
        baseUrl="/rep_web/repweb"
        cfgKey="repWmsCustomer"
        :valueField.sync="query.ownerCode"
        @change="handleSearch">
        </PublicQuery>
      </el-form-item>
      <el-form-item
        label="商品"
        prop="skuCode">
        <PublicQuery
        title="商品"
        baseUrl="/rep_web/repweb"
        cfgKey="repWmsSku"
        :valueField.sync="query.skuCode"
        @change="handleSearch">
        </PublicQuery>
      </el-form-item>
      <el-form-item
        label="是否显示零库存"
        prop="isShowZeroInv">
        <el-select v-model="isShowZeroInv" @change="handleSelected">
          <el-option label="是" value="Y"></el-option>
            <el-option label="否" value="N"></el-option>
        </el-select>
      </el-form-item>
    </el-form>
    </div>
    <more-query
    :moreQueryVisible="moreQueryVisible"
    @toGetList="toGetList"
    @close="moreQueryVisible=false"></more-query>
  </div>
</template>
<script>
import MoreQuery from './more-query'
export default {
  components: {
    MoreQuery
  },
  data () {
    return {
      query: {},
      moreQueryVisible: false,
      isShowZeroInv: '',
      moreData: {}
    }
  },
  methods: {
    handleRefresh () {
      this.$refs.query.resetFields()
      this.$emit('getList')
    },
    // 搜索
    handleSearch () {
      const query = { ...this.query }
      this.moreData = query
      this.$emit('getList', query)
    },
    handleSelected (val) {
      this.query.isShowZeroInv = val
      this.handleSearch()
    },

    // 更多搜索
    handleMoreSearch () {
      this.moreQueryVisible = true
    },

    toGetList (query) {
      this.moreQueryVisible = false
      this.moreData = query
      this.$emit('getList', query)
    },
    handleExcel () {
      const url = this.$API.Monitor.ReportInvWarnList.getList
      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;
  }
}
  .mrg-b{
        margin-bottom: 20px;
    }
    .mrg-l{
        margin-left:10px;
    }

</style>
