<template>
  <div class="height_100">
    <template v-if="field.length > 0">
      <el-collapse v-model="activeNames" style="margin: 0px 5px 0px 5px;">
        <el-collapse-item v-for="(item,index) in field" :title="item.name" :name="index" :key="item.value" @click.native="clickItem(item,index)">
          <!-- 专利本身 -->
          <template>
            <div v-if="item.optionValue && item.optionValue.length>0" style="display: flex;align-items: center;">
              <el-select v-model="item.valueOne"  placeholder="请选择" size="small" clearable>
                  <el-option v-for="item in item.optionValue" :key="item.value" :label="item.label" :value="item.value"></el-option>
              </el-select>
              <el-button @click.stop="handleSearch(item)" size="small" type="primary" class="margin-left_10" icon="el-icon-search" circle></el-button>
            </div>
            <template v-else>
              <div v-if="item.children && item.children.length>0" style="margin-bottom: 10px;">
                <el-select v-model="item.select" @change="selectChange($event, item)" placeholder="请选择" size="small">
                  <el-option v-for="item in item.children" :key="item.value" :label="item.label"  :value="item.value"></el-option>
                </el-select>
              </div>
              <div style="display: flex;align-items: center;">
                <template v-if="item.type == 'DateTime'">
                  <div>
                    <el-date-picker clear-icon v-model="item.valueOne" size="small" type="year" value-format="yyyy" placeholder="请选择开始时间"></el-date-picker>
                    <div style="margin: 5px;">至</div>
                    <el-date-picker clear-icon v-model="item.valueTwo" size="small" type="year" value-format="yyyy" placeholder="请选择结束时间"></el-date-picker>
                  </div>
                  
                </template>
                <template v-else>
                  <el-input size="small" v-model="item.valueOne" placeholder="请输入内容"></el-input>
                </template>
                <el-button @click.stop="handleSearch(item)" size="small" type="primary" class="margin-left_10"  icon="el-icon-search" circle></el-button>
              </div>
            </template>
            
            <div class="content_list" v-loading="item.loading">
              <el-checkbox-group v-model="item.check">
                <div class="source-checkbox">
                  {{ item.value }}
                  <el-checkbox v-for="source in item.options" :label="source.name" :key="source.name" @change="(val)=>checkData(source.name,item,val)">
                    <myTooltip :content="source.name" placement="top" effect="light">
                      <span class="source-checkbox-label text noWrap" :title="source.name">
                        {{ getValueName(item,source.name) }}
                      </span>
                    </myTooltip>
                    <span class="source-checkbox-count">({{ source.number }})</span>
                  </el-checkbox>
                </div>
              </el-checkbox-group>
            </div>
          </template>

          <div class="patent-query-filter-search-bottom">
            <el-button type="success" size="small" @click.stop="handleSelectAll(item)">全选</el-button>
            <el-button type="danger" size="small" @click.stop="handleSelectCancel(item)">取消</el-button>
            <el-button v-if="item.isShowBtn" type="primary" size="small"
              @click.stop="handleLoading(item)">加载更多</el-button>
          </div>
        </el-collapse-item>
      </el-collapse>
    </template>
    <template v-else>
      <div>暂无数据</div>
    </template>
  </div>
</template>

<script>
import mixins from './mixins'
export default {
  components: {},
  mixins:[mixins],
  props: {},
  data() {
    return {
      
    };
  },
  watch: {},
  computed: {},
  created() {},
  mounted() {},
  methods:{}
};
</script>
<style lang="scss">
.source-checkbox {
  // margin-top: 10px;

  span {
    display: inline-block;
    font-size: 13px;
  }

  .el-checkbox {
    display: block;
  }

  .el-checkbox__label {
    position: relative;
    top: 5px;
  }

  .source-checkbox-count {
    color: #409EFF;
    position: relative;
    top: -4px;
    left: 10px;
  }

  .source-checkbox-label {
    max-width: 190px;
    padding-left: 5px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
}
</style>
<style lang="scss" scoped>
.patent-query-filter-search-bottom {
  text-align: center;
  margin-top: 10px;
}
</style>