<template>
  <el-cascader v-model="value" :options="options" :props="props" clearable></el-cascader>
</template>
<script>
import { buildingQuery } from "@/api/scan/request";
export default {
  data() {
    return {
      value: [],
      props: {
        multiple: true,
        value: 'BuildID',
        label: 'BuildLocalName',
        children: 'Floor'
      },
      options: []
    }
  },
  props: {
    FloorID: {
      default: ''
    }
  },
  created() { },
  methods: {
    getCascader() {
      let param = {
        Cascade: [
          { Name: "floor", Orders: "FloorSequenceID desc" }
        ],
        Orders: "BuildLocalName asc",
        PageNumber: 1,
        PageSize: 50
      }
      buildingQuery(param, res => {
        res.Content.map(t => {
          if (t.Floor && t.Floor.length) {
            t.Floor = t.Floor.map(item => {
              if (item.FloorID == this.FloorID) return
              item.BuildID = item.FloorID
              item.BuildLocalName = item.FloorLocalName || item.FloorName
              return item
            }).filter(it => it)
          }
        })
        this.options = res.Content
      })
    },
  }
}
</script>
<style lang="less" scoped>
.el-cascader {
  width: 100%;
}
</style>