<template>
  <div>
    <el-form>
      <el-form-item :label="`数据字典${typeName}类型`">
        <el-select v-model="SubTypeName" multiple collapse-tags placeholder="全部" filterable @change="changeType">
          <el-option v-for="item in DynEquipList" :key="item.SubTypeCode" :label="item.SubTypeName" :value="item.SubTypeCode"></el-option>
        </el-select>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
import { dynamicDynEquipList } from "@/api/scan/request";
import { mapGetters, mapActions } from "vuex";
export default {
  data() {
    return {
      DynEquipList: [], //数据字典设备类型
      timer: null,
      SubTypeName: []
    };
  },
  props: {
    Related: {},
    typeName: {}
  },
  created() {
    this.init();
  },
  computed: {
    ...mapGetters("layout", ["projectId"])
  },
  methods: {
    init() {
      let param = { Related: this.Related, TypeName: this.typeName };
      //数据字典
      dynamicDynEquipList(param, res => {
        if (res.Result == "success") {
          this.DynEquipList = res.Content;
        }
      });
    },
    changeType(val) {
      clearTimeout(this.timer);
      this.timer = setTimeout(() => {
        this.$emit("change", val);
      }, 500);
    }
  },
  watch: {
    projectId(n, o) {
      this.init();
    }
  }
};
</script>
<style lang="less" scoped>
/deep/ .el-form-item{
  margin-right: 0;
}
</style>

