<template>
  <el-select v-model="LocationFlag" multiple collapse-tags placeholder="全部" filterable @change="changeType">
    <el-option v-for="item in LocFlagList" :key="item" :label="item" :value="item"></el-option>
  </el-select>
</template>
<script>
import { dynamicLocFlagList } from "@/api/scan/request";
import { mapGetters, mapActions } from "vuex";
export default {
  data() {
    return {
      LocFlagList: [],
      timer: null,
      LocationFlag: []
    };
  },
  props: {
    Related: {},
    typeName: {}
  },
  created() {
    this.init();
  },
  computed: {
    ...mapGetters("layout", ["projectId"])
  },
  methods: {
    init() {
      this.Datasource = [];
      let param = { Related: this.Related, TypeName: this.typeName };
      // 位置标签
      dynamicLocFlagList(param, res => {
        if (res.Result == "success") {
          this.LocFlagList = 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>
</style>

