<template>
  <div class="ls-search-form">
   <el-row :gutter="20" class="search-style">
        <el-col :span="5" >
          <label>申请编号</label>
          <el-input v-model="queryParam.sampleLineCode" v-inputFilter:trim  @keyup.enter.native="handleQuery"
            size="mini"  placeholder="请输入" clearable></el-input>
        </el-col>
        <el-col :span="5" >
          <label>样品状态</label>
          <common-select v-model="queryParam.sampleStatus" dictType="Crm_Sample_Status"   >
          </common-select>
        </el-col>
        <el-col :span="5" >
          <label>客户名称</label>
          <el-input v-model="queryParam.customer" v-inputFilter:trim  @keyup.enter.native="handleQuery"
            size="mini"  placeholder="请输入" clearable></el-input>
        </el-col>
        <el-col :span="5" >
          <label>FW版本</label>
          <el-input v-model="queryParam.fwVersion" v-inputFilter:trim  @keyup.enter.native="handleQuery"
            size="mini"  placeholder="请输入" clearable></el-input>
        </el-col>
        <el-col :span="4">
          <label >代理商</label>
          <el-input v-model="queryParam.agentName" v-inputFilter:trim  @keyup.enter.native="handleQuery"
            size="mini"  placeholder="请输入" clearable></el-input>
        </el-col>
    </el-row>

   <el-row  :gutter="20" class="search-style">
        <el-col :span="5">
          <label >芯片平台</label>
          <common-select v-model="queryParam.platform" dictType="Crm_Application_Chip_Platform"   >
          </common-select>
        </el-col>
        <el-col :span="5" >
          <label>芯片型号</label>
          <el-select v-model="queryParam.chipModel"  size="mini"
               placeholder="请选择" filterable clearable >
             <el-option
               v-for="item in chipModelList"
               :key="item.key"
               :label="item.key"
               :value="item.key">
             </el-option>
           </el-select>
        </el-col>
        <el-col :span="5">
          <label >项目名称</label>
          <el-input v-model="queryParam.projectName" v-inputFilter:trim  @keyup.enter.native="handleQuery"
            size="mini"  placeholder="请输入" clearable></el-input>
        </el-col>
        <el-col :span="5">
          <label >标准PN</label>
          <el-input v-model="queryParam.longsysPn" v-inputFilter:trim size="mini"   @keyup.enter.native="handleQuery"
            placeholder="请输入" clearable></el-input>
        </el-col>
        <el-col :span="4" >
          <label>料号</label>
          <el-input v-model="queryParam.num" v-inputFilter:trim  @keyup.enter.native="handleQuery"
            size="mini"  placeholder="请输入" clearable></el-input>
        </el-col>
    </el-row>
    <el-row v-show="isExtend"  :gutter="20" class="search-style">
        <el-col :span="5" >
          <label>销售人员</label>
          <el-input v-model="queryParam.salesName" v-inputFilter:trim   @keyup.enter.native="handleQuery"
            size="mini"  placeholder="请输入" clearable></el-input>
        </el-col>
    </el-row>

    <div class="btns-wrap">
      <el-button @click="handleQuery"  type="warning" icon="el-icon-search" size="mini" >查询</el-button>
      <el-button @click="reSet"     type="info"  icon="el-icon-refresh-left" plain size="mini" >重置</el-button>
      <div  class="extend">
        <el-button  @click="handleExtend" type="text"  size="mini" >
          <span v-if="isExtend">收起</span>
          <span v-else>展开</span>条件
          <i :class="isExtend?'el-icon-arrow-up':'el-icon-arrow-down' "></i>
        </el-button>
      </div>
    </div>

  </div>
</template>

<script>
  import commonSelect from '@/common/commonSelectList.js'
  export default {
      name: 'search',
      created () {
        this.getSelectList();
      },
      mounted () {

      },
      methods: {
        //查询
        handleQuery () {
          this.$emit('query', 1);
        },
        //重置
        reSet () {
           for(let item in this.queryParam){
             this.queryParam[item] = '';
           }
           this.handleQuery();
        },
        //展开搜索条件
        handleExtend(){
          this.isExtend = !this.isExtend;
        },
        //获取下拉框数据
        async getSelectList(){
          this.chipModelList = await commonSelect.initDictDataPost(this, 'Crm_Main_Chip_Model');
        },

      },

      data () {
          return {
            isExtend: false,

            queryParam: {
               sampleLineCode: '', //送样编码
               customer: '', //客户名称
               agentName: '', //代理商
               projectCode: '', //项目编码
               projectName: '',
               sampleStatus: '',
               platform: '',
               chipModel: '',
               fwVersion: '',
               longsysPn: '', //标准Pn
               salesName: '', //销售人员
               salesId: '', //销售人员id

            },
            chipModelList: [], // 芯片型号

          };
      },
  }
</script>

<style type="text/css" scoped lang="scss">

</style>
