ComponentSimple.vue 3.41 KB
<template>
  <div class="">
    <!-- 分析层面 -->
    <div class="analysis-level-wrapper">
      <div class="analysis-left">
        <i class="el-icon-search"></i>
        <span class="analysis-level-text">{{$t('asisTab.level')}}</span>  
      </div>
      <ul class="analysis-right">
        <li :class="['analysis-item', { 'active': asisLevel === prop }]" v-for="(value, prop) in analysisList" :key="prop" @click="$emit('update:asisLevel', prop)">
          <span class="analysis-item-text">{{ $t('asisTab.' + prop) }}</span>
        </li>
      </ul>  
    </div> 
    <!-- 条件面板 -->
    <div class="component-panel" v-for="(viewList, prop) in analysisList" :key="prop" v-if="asisLevel === prop">
      <component
        v-for="(view, index) in viewList"
        :key="index"
        class="panel-content"
        :isMulti="view.isMulti"
        :filterable="view.filterable"
        :isCollapse="view.isCollapse"
        :isNeedSelectedAll="view.isNeedSelectedAll"
        :ref="`${view.name}_Ref`"
        v-bind:is="`${view.name}-select`"
      />
      <!--
        @listenerChange="changeHandle"
        @loadHandle="loadHandle"
        -->
    </div>
  </div>
</template>

<script>
import { mapState } from 'vuex'
import MallSelect from './MallSelect'
import FloorSelect from './FloorSelect'
import ZoneSelect from './ZoneSelect'
export default {
  name: 'ComponentSimple',
  props: {
    analysisList: {
      type: Object,
      required: true,
      default: () => {}
    },
    asisLevel: {
      type: String,
      default: 'mall'
    }
  },
  components: {
    'mall-select': MallSelect,
    'floor-select': FloorSelect,
    'zone-select': ZoneSelect
  },
  computed: {
    ...mapState({
      cacheConditions: state => state.app.cacheConditions,
      mallVal: state => state.app.mallVal,
      multiMallVal: state => state.app.multiMallVal
    }),
  },
  data() {
    return {}
  },
  methods: {
    // changeHandle(val) {
    //   console.log('watch change', val, this.$refs)
    //   // this.$refs.floorRef[0].updateFloor()
    // },
    // loadHandle(val) {
    //   console.log('loadHandle val', val, this.$refs)
    //   // this.$refs.floorRef[0].updateFloor()
    //   for (let [k, view] of Object.entries(this.$refs)) {
    //     console.log(k, view)
    //     let startPrefix = k.split('_')[0]
    //     if (startPrefix === val) {
    //       view.forEach(item => {
    //         console.log(item)
    //         item.reload()
    //       })
    //     }
    //   }
      
    // }
  }
}
</script>

<style scoped>
.analysis-level-wrapper {
  height: 30px;
  line-height: 30px;
  padding-left: 50px;
  background: #f9f9f9;
}
.analysis-level-wrapper:after,
.analysis-level-wrapper:before {
  content: '';
  display: table;
}
.analysis-level-wrapper:after {
  clear: both;
}
.analysis-left {
  float: left;
  font-size: 13px;
  color: #aaa;
  padding-right: 30px;
}
.analysis-right {
  float: left;
  font-size: 12px;
}
.analysis-item {
  float: left;
  list-style: none;
  font-size: 13px;
  color: #666;
  cursor: pointer;
  padding: 0 30px;
  position: relative;
}
.analysis-item.active:after {
  content: "";
  display: block;
  width: 20px;
  height: 3px;
  background: #3bb8ff;
  position: absolute;
  bottom: 0;
  left: 50%;
  margin-left: -10px;
}
/* .analysis-item-text {} */
.component-panel {
  padding: 15px 0 13px 50px;
  background: #fff;
  box-sizing: border-box;
}
.panel-content + .panel-content {
  margin-left: 20px;
}
</style>