<template>
  <div class="container">
    <div style="display:flex;align-items:center;margin-bottom:16px">
      <el-input
          placeholder="请输入搜索内容"
          suffix-icon="el-icon-search"
          v-model="search"
          style="width:200px"
          size="mini"
          class="input-with-select inline-16"
          @keyup.native.enter="$refs.list.listData($refs.list.params.content.where.condition=search,$refs.list.params.content.pageNumber=1)"
          @clear="$refs.list.listData($refs.list.params.content.where.condition='',$refs.list.params.content.pageNumber = 1)"
          clearable>
      </el-input>
      
    </div>
    <select-class ref="class" @onClassChange="onClassChange" @clickField="clickField" :default="true" ></select-class>
    <list ref="list" ></list>
  </div>
</template>

<script>
import list from './modules/list'
import selectClass from './modules/Select'
export default {
  data () {
    return {
      search:'',
      
    }
  },
  components:{
    list,
    selectClass,
    // selectPeople
  },
  methods:{
    selectClick (callback) {
      this.$refs['list'].params.content.pageNumber = 1
      this.$refs['list'].params.content.brandids = this.$refs['class'].brand_act?[this.$refs['class'].brand_act]:[]
      this.$refs['list'].params.content.tradefield = this.$refs['class'].field_act
      this.$refs['list'].listData()
    },
    onClassChange (n) {
      this.$refs['list'].params.content.itemclassids = n.itemclassid?[n.itemclassid]:[]
      this.selectClick()
    },
    clickField (item) {
      this.$refs['list'].params.content.tradefield = item?item.tradefield:''
      this.selectClick()
    },
  }
}

</script>
<style>
</style>