<!-- 实体类 左侧树 -->
<template>
  <a-list item-layout="horizontal" :data-source="searchResult">
    <a-list-item slot="renderItem" slot-scope="item">
      <a-list-item-meta @click="handleChangeEntityRouter(item)">
        <p slot="title" :class="activeId === item.entClsID ? 'selected' : ''">
          <a-tooltip placement="topLeft">
            <template slot="title">
              <span>{{ item.entClsName }}</span>
            </template>
            <a class="rela-box"> {{ item.entClsName }}</a>
          </a-tooltip>
        </p>
      </a-list-item-meta>
    </a-list-item>
  </a-list>
</template>

<script>
export default {
  name: 'EntClsList',
  props: ['searchResult', 'searchValue', 'activeId'],
  data() {
    return {
      activeID: ''
    }
  },
  watch: {
    activeID: function() {
      this.activeId = this.activeID
    }
  },
  mounted() {
    this.$router.push({
      name: 'class_entity_v2',
      params: { classId: 'uknow' },
      query: {
        ...this.$route.query,
        searchValue: this.searchValue
      }
    })
  },
  methods: {
    handleChangeEntityRouter(item) {
      this.activeID = item.entClsID
      this.$emit('emitId', item.entClsID)
    }
  }
}
</script>

<style scoped></style>
