<template>
  <section class="dm-store clearfix">
    <el-select v-model="leftValue" placeholder="请选择" class="w200 fl">
      <el-option v-for="(v,i) in leftList" :key="i" :label="v.label" :value="v.value"></el-option>
    </el-select>
    <com-type v-show="leftValue === 1" ref="typeRef" :checked="typeList" @get-emit="emitTypeList"></com-type>
    <com-area v-show="leftValue === 3"></com-area>

    <el-checkbox :indeterminate="true" v-model="checkAll">全选</el-checkbox>
    <el-checkbox :indeterminate="false" v-model="checkAll">全选</el-checkbox>
    <el-checkbox :indeterminate="false" v-model="checkTrue">全选</el-checkbox>

  </section>
</template>
<script>
import comType from './com-type';
import comArea from './com-area';
export default {
  name:'dm-store',
  components:{
    'com-type':comType,
    'com-area':comArea
  },
  data() {
    return {
      leftValue:3, // 一级选择值
      leftList:[ // 一级列表
        {label:'所有门店',value:0},
        {label:'门店类型',value:1},
        {label:'门店标签',value:2},
        {label:'门店区域',value:3},
        {label:'门店分组',value:4},
        {label:'部分门店',value:5}
      ],
      typeList:[0,1], // 选中的门店类型
      isIndeterminate:true,
      checkAll:false,
      checkTrue:true
    }
  },
  created() {
    setTimeout(v => {
       this.typeList = [
        0,1,2,3
      ]
      this.$nextTick(_ => {
        this.$refs.typeRef.init();
      })
    },3000)
  },
  methods:{
    emitTypeList(val) {
      console.log(val)
      // this.typeList = val;
    },
    test() {
      this.checkAll = !this.checkAll
    }
  }
}
</script>


<style lang="scss">
@import url('./index.scss');
</style>
