<template>
  <div class="ls-search-form">
    <el-row :gutter="24" class="search-style">
      <el-col :span="6">
        <label>事项类型</label>
        <common-select :dictType="'Crm_Event_Type'" v-model="queryParam.itemType"></common-select>
      </el-col>
       <el-col :span="6">
         <label>紧要程度</label>
         <common-select :dictType="'Crm_Import_Level'" v-model="queryParam.emergencyDegree"></common-select>
       </el-col>
      <el-col :span="6">
        <label>状态</label>
        <common-select :dictType="'Crm_Task_Status'" v-model="queryParam.status"></common-select>
      </el-col>
      <el-col :span="6">
        <label>责任人</label>
        <el-input v-model="queryParam.taskUser" size="mini" placeholder="请输入"  @keyup.enter.native="doSearch" clearable ></el-input>
      </el-col>
    </el-row>

    <el-row v-show="isExtend" :gutter="20" class="search-style">
      <el-col :span="6">
        <label>客户名称</label>
        <el-input v-model="queryParam.customerName" size="mini" placeholder="请输入" @keyup.enter.native="doSearch" clearable ></el-input>
      </el-col>

      <el-col :span="12">
        <label>起止时间</label>
        <el-date-picker @change="timeData" size="mini" v-model="taskCompletedDate" style="width: 100%;" type="daterange"
          value-format="yyyy-MM-dd HH:mm:ss" clearable range-separator="至" start-placeholder="开始日期"
          end-placeholder="结束日期">
        </el-date-picker>
      </el-col>

     </el-row>
    <div class="btns-wrap">
      <el-button @click="doSearch" 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 '../../../../components/common-select.vue'
  export default {
    name: 'task-list-search',
    components: {
      commonSelect,
    },
    created: function() {

    },
    computed: {
      sid() {
        return this.$common.getUrlParams('sid');
      }
    },
    methods: {
      doSearch: function() {
        this.$emit('query', this.queryParam);
      },
      //展开搜索条件
      handleExtend(){
        this.isExtend = !this.isExtend;
      },
      //重置
      reSet: function() {
        this.taskCompletedDate = [];
        this.queryParam.startTime = '';
        this.queryParam.endTime = '';
        this.queryParam.emergencyDegree = '';//紧要程度
        this.queryParam.customerName = '';
        this.doSearch();
      },
      timeData() {
        if (this.taskCompletedDate == "" || this.taskCompletedDate == undefined) {
            this.queryParam.startTime = ""
            this.queryParam.endTime = ""
        } else {
          this.queryParam.startTime = this.taskCompletedDate[0]
          this.queryParam.endTime = this.taskCompletedDate[1]
        }

      },

    },
    data: function() {
      return {
        isExtend: true, //默认收起两行搜索条件
        personnelData: [],
        openType: '',
        users: "", //v-mdoel aws-org users
        queryParam: {
          taskId:'', //任务ID
          itemType:'',//事项类型
          emergencyDegree:'',//紧要程度
          taskTitle: '',//任务标题
          status: '',//状态
          taskUser: "",//负责人
          userNamesStr: "",
          creater: "",//创建人
          startTime: '',//要求开始时间
          endTime: '',//要求截止时间
          taskContent:"",//任务描述
          customerName:"",//客户名称
        },
        taskCompletedDate: [],
      };
    },
  }
</script>

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

</style>
