<template>
  <div class="no-border" style="clear: both;">
    <span v-for="(item,index) in list " class="status_tree" :key=" index">
      <div style="width: 100%;margin-bottom: 10px;">
        <span style="clear: both;height: 32px;">
          <span v-if="item.isleaf===false" class="title">{{item.name}}</span>
          <a v-if="item.isleaf===false" class="btn" @click="item.isshow=!item.isshow">{{item.isshow?'-':'+'}}</a>
        </span>
        <div class="no-border" style="clear: both;display: flex; flex-wrap: wrap;" v-show="item.isshow">
          <span v-if="item.level==='last'" v-for="(item2,index2) in item.cList" class="op" :style="{backgroundColor:item2.color}">{{item2.name}}</span>
          <tree-menus v-if="item.level==='parent'" :list="item.cList"></tree-menus>
        </div>
      </div>
    </span>
  </div>
</template>
<style>
  .status_tree div {
    margin: 5px;
    margin-left: 0;
    padding: 5px 15px;
    border-radius: 3px;
    box-shadow: 0 0 3px #bbb;
    width: 100%;
  }

  .status_tree .no-border {
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: 0 0 0 0 !important;
    width: 100%;
  }

  .status_tree .title {
    width: 90px;
    height: 40px;
    font-size: 14px;
    line-height: 40px;
    overflow: hidden;
    float: left;
    display: inline-block;
  }

  .status_tree .btn {
    width: 24px;
    height: 24px;
    background-color: #347ab8;
    color: white;
    line-height: 24px;
    text-align: center;
    font-size: 14px;
    display: inline-block;
    border-radius: 4px;
    font-weight: 900;
    margin-top: 8px;
  }

  .status_tree .op {
    background-color: #5cb85c;
    color: white;
    margin: 5px;
    margin-left: 0;
    padding: 5px 15px;
    border-radius: 3px;
    -webkit-box-shadow: 0 0 3px #bbb;
    box-shadow: 0 0 3px #bbb;
    margin-right: 20px;
    width: 120px;
    overflow: hidden;
    float: left;
    line-height: 30px;
    font-size: 14px;
    font-weight: bold;
    height: 40px;
  }
</style>
<script>
export default {
    name: 'treeMenus',
    props: {
        list: Array
    },
    methods: {

    }
}
</script>
