<template class="editor-workspace-el-row">
<div class="fullQuickEditor">
    <div class="layout-row-main" style="min-height:40px;max-height:50px;overflow:hidden;margin:0;">
      <div class="layout-col-tree" style="background:inherit;margin:8px 0 0 10px;overflow:hidden;line-height:40px;">
        <el-col :span="8" style="text-align:center;">维度视图：
        </el-col>
        <el-col :span="16">
          <el-select placeholder="维度视图" style="width:100%;" v-model="dimensionID" @change="changeClickHandler">
            <el-option v-for="dimension in dimensions" :key="dimension.ID" :label="dimension.name" :value="dimension.ID">
            </el-option>
          </el-select>
        </el-col>
      </div>
      <div class="layout-col-detail"></div>
    </div>
    <catalog-settings :dimension-id.sync="dimensionID"/>
</div>
</template>
<script>
import catalogSettings from './catalogSettings.vue'
export default {
  components: {
    'catalog-settings': catalogSettings
  },
  data() {
    return {
      clientHeight: 0,
      clientWidth: 0,
      dimensionID: 1,
      dimensions: [{ID: 1, code: 'default', name: '默认分类'}]
    }
  },
  created() {
    this.clientHeight = document.documentElement.clientHeight - 120
    this.clientWidth = document.documentElement.clientWidth - 340
    this.getDimensions()
  },
  methods: {
    changeClickHandler(value) {
      this.dimensionID = value
      localStorage['user_' + localStorage.userName + '_sid_' + this.$root.siteID + '_ewdid'] = value
    },
    async getDimensions() {
      let res = await axios.get('/ui/dimensions')
      this.dimensions = res.data.data
      let lsTmp = localStorage['user_' + localStorage.userName + '_sid_' + this.$root.siteID + '_ewdid']
      if (lsTmp && lsTmp !== '-1') {
        this.dimensionID = parseInt(lsTmp)
      } else {
        this.dimensionID = this.dimensions[0].ID
      }
    }
  }
}
</script>

<style scoped>
</style>
<style>

.editor-workspace-el-row {
  height: 100%;
}
.fullQuickEditor{
  /* display: flex; */
  max-width: 1280px;
  margin: auto;
  /* width: calc(100vw - 50px); */
  /* transition: all ease 0.3s; */
  /* align-items: flex-start; */
}
</style>
