<template>
<el-row class="query">
  <el-form
    class="query__retrieve"
    inline
    ref="queryForm"
    :model="query"
    :rules="rules"
  >
    <el-form-item label="货主" prop="ownerCode">
      <PublicQuery
        single
        title="货主"
        cfgKey="enpWmsCustomer"
        :baseUrl="baseUrl"
        :valueField.sync="query.ownerCode"
        :textField.sync="query.ebcuNameCn"
        @change="selectionChange"
      />
    </el-form-item>
    <el-form-item label="仓库" prop="projectIds">
      <PublicQuery
        single
        title="仓库"
        cfgKey="enpWmsShareWareHouse"
        :baseUrl="baseUrl"
        :valueField.sync="query.projectIds"
        :textField.sync="query.cdwhName"
        @change="selectionChange"
      />
    </el-form-item>
    <el-form-item>
      <el-button v-auth="50940020101" icon="el-icon-refresh" class="query__item" type="primary" @click="e => toGetInfo()" plain circle></el-button>
    </el-form-item>
  </el-form>
</el-row>
</template>

<script>
export default {
  props: ['selectedIds'],
  created () {
  },
  mounted () {
  },

  data () {
    return {
      query: {}, // 查询条件
      baseUrl: '/enp_web/enpweb',
      rules: {
        ownerCode: [{ required: true, message: '必填', trigger: 'change' }]
      },
    }
  },
  methods: {
    // 查询
    toGetInfo (query = {}) {
      this.$emit('getInfo', this.query)
    },
    // 点击更多查询
    moreQuery () {
      this.showMore = true
    },
    // 选择了组件数据
    selectionChange (selected) {
      this.toGetInfo()
    }
  },
}
</script>

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