<template lang="html">
  <ifbp-page>
    <ifbp-breadcrumb name="页面配置"></ifbp-breadcrumb>
    <div class="page-customization-main">
      <div class="page-customization-left fl">
        <el-tree :data="pageCustomizationTreeData" :props="idDefaultProps" @node-click="handleNodeClick"></el-tree>
      </div>
      <div class="page-customization-right fr">
        <!-- <el-tabs v-model="activeName" @tab-click="handleClick"> -->
        <!-- <el-tab-pane label="按钮注册" name="first"> -->
          <!-- <button-register :busicode="pageTreeCode" ref="buttonPage"></button-register> -->
        <!-- </el-tab-pane> -->
        <!-- <el-tab-pane label="配置化页面" name="second"> -->
          <configuration-page :busicode="pageTreeCode" ref="configurationPage"></configuration-page>
        <!-- </el-tab-pane> -->
        <!-- </el-tabs> -->
      </div>
    </div>
  </ifbp-page>
</template>

<script>
// import buttonRegister from './buttonRegister.vue';
import configurationPage from './configurationPage.vue';
export default {
  data() {
    return {
      pageCustomizationTreeData: [],
      idDefaultProps: {
        children: 'children',
        label: 'name'
      },
      pageTreeCode: '',
      // activeName: 'first'
    };
  },
  components: {
    // buttonRegister,
    configurationPage
  },
  methods: {
    // handleClick(tab, event) {
    //   // debugger;
    //   console.log(tab, event);
    //
    // },
    handleNodeClick(data) {
      if(data.children && data.children.length > 0) {
        return;
      }
      this.pageTreeCode = data.code;

    },
    pageCustomizationTreeRequest() {
      this.$http({
        url: "/ifbp-app-sm/buz/display",
        method: 'GET',
        dataType: 'json',
        contentType: 'application/json',
      }).then((res) => {
        if (res.data.success === true) {
          this.pageCustomizationTreeData = res.data.data;
        } else {
          this.$message({
            message: res.data.msg,
            type: 'error'
          });
        }
      }).catch(() => {
        this.$message({
          message: 'Network error',
          type: 'error'
        });
      });

    },

  },
  mounted() {
    this.pageCustomizationTreeRequest();
  },
  created() {

  }
}
</script>

<style lang="css">
</style>
