<template>
  <div class="pomentWrap">
    <el-row :gutter="5" type="flex" justify="space-around">
      <el-col :xs="12" :sm="12" :md="6" :lg="4" :xl="4">
        <div class="topBar">
          <el-tree
                  :data="treeData"
                  :props="treeProps"
                  ref="Tree"
                  node-key="id"
                  :highlight-current="true"
                  :default-expanded-keys="[0]"
                  :default-checked-keys="[]"
                  @node-click="nodeClick"
          >
          </el-tree>
        </div>
      </el-col>

      <el-col :xs="12" :sm="12" :md="18" :lg="20" :xl="20">
        <el-table :data="tableData.pageData" border style="width:100%;" v-loading="loading">
          <el-table-column prop="deviceName" label></el-table-column>
        </el-table>
      </el-col>
    </el-row>
  </div>
</template>
<style lang="scss" scped>
  @import '@/utils/public.scss';
</style>
<script lang="ts">
  import { Component, Vue, Provide, Watch } from "vue-property-decorator";
  import METHOD from "@/utils/methods"
  @Component({
    components: {  }
  })
  export default class VideoList extends Vue {
    @Provide() tableData: Object = { pageData: [], total: 0 };
    @Provide() PAGE: any = { page: 1, size: 100000 };
    @Provide() searchData: any = { account: "", userName: "" };
    @Provide() loading: Boolean = false;
    @Provide() treeData: any = [
      {
        enterpriseId: 0,
        name: "企业视频监控",
        level: 0,
        icon: "icon-yh",
        childList: []
      }
    ];
    @Provide() treeProps: Object = {
      children: "childList",
      label: "name"
    };
    @Provide() treecheckedObj: any = {};

    getTreeData() {
      let that = this;
      (this as any).$axios.get(`/safetyDeviceInfo/getDeviceTree`).then((res: any) => {
        if( res.code == 0 ){
          console.log(res.data);
          that.treeData[0].childList = res.data;
        }
      });
    }
    nodeClick(data: any, node: any, target: any) {
      let that = this;
      that.treecheckedObj = node.data;
    }
    created() {
      let that = this;
      that.getTreeData();
    }
  }
</script>
