<template>
  <!-- 左右结构，左侧菜单，右侧内容 -->
  <div class="page-header-index-wide">
    <a-card :bordered="false" :bodyStyle="{ padding: '16px 0', height: '100%' }" :style="{ height: '100%' }">
      <div class="account-settings-info-main" :class="device" :style=" 'height:'+ mainInfoHeight ">
        <div class="account-settings-info-left">
          <a-menu :mode="device == 'mobile' ? 'horizontal' : 'inline'" :default-selected-keys="['settings']"
            :style="{ border: '0', width: device == 'mobile' ? '560px' : 'auto'}" type="inner"
            @openChange="onOpenChange">
            <a-menu-item key="settings">
              <a class="_menu_selected" @click="settingsClick(1,'结构化数据源')">
                结构化数据源
              </a>
            </a-menu-item>
          </a-menu>
        </div>
        <div class="account-settings-info-right">
          <div class="account-settings-info-title">
            <span>{{ title }}</span>
          </div>
          <SysDataSourceListVue v-if="num==1"></SysDataSourceListVue>
        </div>
      </div>
    </a-card>
  </div>
</template>

<script>
import PageLayout from '@/components/page/PageLayout'
import RouteView from "@/components/layouts/RouteView"
import { mixinDevice } from '@/utils/mixin.js'
import SysDataSourceListVue from './SysDataSourceList.vue'
export default {
  name: 'SysDataSourceManage',
  data () {
    return {
      mode: 'inline',
      mainInfoHeight: "100%",
      openKeys: [],
      defaultSelectedKeys: [],
      num: 1,
      // cropper
      preview: {},
      option: {
        img: '/avatar2.jpg',
        info: true,
        size: 1,
        outputType: 'jpeg',
        canScale: false,
        autoCrop: true,
        // 只有自动截图开启 宽度高度才生效
        autoCropWidth: 180,
        autoCropHeight: 180,
        fixedBox: true,
        // 开启宽度和高度比例
        fixed: true,
        fixedNumber: [1, 1]
      },

      pageTitle: '',
      title: "结构化数据源",
      security: false,
      baseSetting: true,
      custom: false,
      notification: false,
      binding: false
    }
  },
  components: {
    RouteView,
    PageLayout,
    SysDataSourceListVue
  },
  mixins: [mixinDevice],
  created () {
    this.mounted();
  },
  mounted () {
    this.mainInfoHeight = (window.innerHeight - 155) + "px";
  },
  methods: {
    onOpenChange (openKeys) {
      this.openKeys = openKeys
    },
    updateMenu () {
      let routes = this.$route.matched.concat()
      this.defaultSelectedKeys = [routes.pop().path]
    },
    //update-begin--Author:wangshuai  Date:20200729 for：聚合路由错误 issues#1441--------------------
    settingsClick (_val, _name) {
      this.num = _val
      this.title = _name
    }
  }
}
</script>
<style lang="less" scoped>
.account-settings-info-main {
  width: 100%;
  display: flex;
  height: 100%;
  overflow: auto;

  &.mobile {
    display: block;

    .account-settings-info-left {
      border-right: unset;
      border-bottom: 1px solid #e8e8e8;
      width: 100%;
      height: 50px;
      overflow-x: auto;
      overflow-y: scroll;
      background: #001529;
    }
    .account-settings-info-right {
      padding: 20px 40px;
    }
  }

  .account-settings-info-left {
    border-right: 1px solid #e8e8e8;
    background: #001529;
    width: 224px;
  }

  .account-settings-info-right {
    flex: 1 1;
    padding: 8px 40px;

    .account-settings-info-title {
      color: rgba(0, 0, 0, 0.85);
      font-size: 20px;
      font-weight: 500;
      line-height: 28px;
      margin-bottom: 12px;
    }
    .account-settings-info-view {
      padding-top: 12px;
    }
  }
}

.ant-menu-item-selected {
  
}
._menu_selected {
  color: white !important;
}

.ant-menu-light {
  background: #001529 !important;
  text-align: center;
}

// .ant-menu-item{
//   padding-left: 15px!important;
// }
</style>