<template>
  <div>
    <h1>资产展示</h1>

    <el-container>
      <el-aside width="400px">

        <el-tree :data="data" :props="defaultProps" @node-click="handleNodeClick"></el-tree>

      </el-aside>

      <el-main>

        <el-card class="box-card">
          <div slot="header" class="clearfix">
            <span style="font-size: xx-large"></span>
            <!--            <table>-->
            <!--           a   <tr><td>表名称:</td><td>{{ tableBasic.tableName }}</td></tr>-->
            <!--              <tr><td>表备注:</td><td>{{ tableBasic.tableRemark }}</td></tr>-->
            <!--              <tr><td>数据量:</td><td>{{ tableBasic.dataNum }}</td></tr>-->
            <!--              <tr><td>是否核心:</td><td><dict-tag :options="dict.type.sys_yes_no" :value="tableBasic.isCenter"/></td></tr>-->
            <!--            </table>-->

            <template>

              <el-descriptions class="margin-top" title="资产模型基本信息" :column="2"  border>
                <el-descriptions-item>
                  <template slot="label">表名称</template>
                  {{ tableBasic.name }}
                </el-descriptions-item>
                <el-descriptions-item>
                  <template slot="label">表备注</template>
                  {{ tableBasic.tableRemark }}
                </el-descriptions-item>
                <el-descriptions-item>
                  <template slot="label">数据量</template>
                  {{ dataNum }}
                </el-descriptions-item>
                <el-descriptions-item>
                  <template slot="label">是否核心</template>
                  <el-tag size="small" v-if="dataNum!=0">是</el-tag>
                </el-descriptions-item>
              </el-descriptions>
            </template>
          </div>
        </el-card>
<!--        v-if="dataType === 'dataTable'-->
        <el-card class="box-card"  style="margin-top: 20px">
          <div slot="header" class="clearfix">
            <span>模型数据</span>
          </div>
          <el-row :gutter="20">
<!--            -->
            <el-col :span="6" v-for="DataValue in  tableStructure" style="margin-top: 20px">
              <el-descriptions :title="测试+'.'+tableBasic.name+'.'+DataValue.field" direction="vertical"
                               border :column="1">
                <el-descriptions-item label="Type">
                  <el-tag size="small">{{ DataValue.dataMapping}}</el-tag>
                </el-descriptions-item>
                <el-descriptions-item label="Value">{{ DataValue.dataValue }}</el-descriptions-item>
              </el-descriptions>


            </el-col>
          </el-row>
        </el-card>
        <el-table
          :data="tableStructure"
          style="width: 100%">
          <el-table-column
            prop="field"
            label="key"
            width="180">
          </el-table-column>
          <el-table-column
            prop="annotation"
            label="label"
            width="180">
          </el-table-column>
          <el-table-column
            prop="type"
            label="type">
          </el-table-column>
          <el-table-column
            prop="dataValue"
            label="value">
          </el-table-column>
        </el-table>
      </el-main>
    </el-container>




  </div>
</template>

<script>
//这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）,
//例如：import 《组件名称》 from '《组件路径》,
import { findTableValue, getExtractDataTableNameList, selectBasicList } from '@/api/property/asDisplay'

export default {
  //import引入的组件需要注入到对象中才能使用"
  components: {},
  dicts: ['sys_no'],
  props: {},
  data() {
    //这里存放数据"

    return {
      data:[],
      defaultProps: {
        children: 'tableNames',
        label: 'name'
      },
      tableBasic:[],
      tableStructure:[],
      assetShowList: [
        // {key: "测试.sys_user.id", type: "String", value: 1},
        // {key: "测试.sys_user.name", type: "String", value: "张三"},
        // {key: "测试.sys_user.age", type: "Integer", value: 18},
        // {key: "测试.sys_user.email", type: "String", value: "123@136.com"},
        // {key: "测试.sys_user.sex", type: "String", value: "Y"},
      ],
      DataValue:[],
      dataNum:'',
    };
  },
  //计算属性 类似于data概念",
  computed: {},
  //监控data中的数据变化",
  watch: {},
  //方法集合",
  methods: {

    getSelectList(){
      getExtractDataTableNameList().then((res)=>{
        this.data = res.data
      })
    },

    handleNodeClick(data){
      this.tableBasic=data
      console.log(this.tableBasic)
      this.dataNum=data.tableFie.length
      this.tableStructure=data.tableFie
      console.log(this.tableStructure)
    },
  },
  //生命周期 - 创建完成（可以访问当前this实例）",
  created() {
    this.getSelectList();

  },
  //生命周期 - 挂载完成（可以访问DOM元素）",
  mounted() {
  },
  beforeCreate() {
  }, //生命周期 - 创建之前",
  beforeMount() {
  }, //生命周期 - 挂载之前",
  beforeUpdate() {
  }, //生命周期 - 更新之前",
  updated() {
  }, //生命周期 - 更新之后",
  beforeDestroy() {
  }, //生命周期 - 销毁之前",
  destroyed() {
  }, //生命周期 - 销毁完成",
  activated() {
  } //如果页面有keep-alive缓存功能，这个函数会触发",
};
</script>
<style scoped>



</style>
