import list from '@/mixins/list'
import routerUserMenu from '@/mixins/router-user-menu'
import breadcrumbComponent from '@/components/breadcrumb.vue'
import chartComponent from '@/components/automatic-graph-components/chart.vue'

import {kpiColors} from '@/views/Report/ReportManagement/kpi-color'
import {layerClass} from '@/views/Report/ReportManagement/layer-class'
import {echartsThemes} from '@/views/Report/ReportManagement/echarts-color-themes'
import {barLineOption,pieOption} from '@/views/Report/ReportManagement/echarts-option'
import {deepCopy} from "../../../utils/util";
/**
 * 列表页管理
 *
 *  version = "1.0.0";
 *  author = "徐飞";
 *  email = "xu.fei@data-u.com";
 * */
export default {
  name: 'report',
  components: { breadcrumbComponent, chartComponent},
  mixins: [list,routerUserMenu],
  data () {
    return {
      viewRes: {}
    }
  },
  computed: {
    chartType: {
      // getter
      get: function () {
        let {chartType} = this.viewRes
        return chartType
      },
      // setter
      set: function (newValue) {
      }
    },
    //
    id: {
      // getter
      get: function () {
        return this.$route.params.id || null
      },
      // setter
      set: function (newValue) {
      }
    },
    iframeUrl: {
      get: function () {
        let {id} = this
        let url = window.location.origin
        return url+'/#/iframe/report/'+id
      },
    },
  },
  created(){
  },
  mounted () {
    // 获取列表页
    this.init()
  },
  methods: {
    init(){
      let {id} = this
      if(id){
        this.getView()
      }
    },
    getView(){
      this.$api.chart.get({id: this.id}).then(res=>{
        if(res.code==1){
          this.viewRes=res.data
        }
      })
    },
  }
}
