ludc
2024-04-09 fecc7305a48f8ce6e283434718da33e143885c75
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<template>
  <!--UI上下文的展示器-->
  <div style="height:calc(100% - 4px);min-width:1200px" >
    <el-header v-if="uiDefineVO.northAreas && uiDefineVO.northAreas.length>0">
      <UIContentArea :key="'northArea-'+uiDefineVO.oid" :areasData="uiDefineVO.northAreas"
                     :dataStore="checkedData.northArea"
                     :inDialog="inDialog"
                     :sourceData="sourceData"
                     areas-name="northArea"
                     @setDataStore="setDataStore">
      </UIContentArea>
    </el-header>
    <el-container
      :style="'height: '+(uiDefineVO.northAreas && uiDefineVO.northAreas.length>0?'calc(100% - 70px)':'100%')">
      <el-aside v-if="uiDefineVO.westAreas && uiDefineVO.westAreas.length>0"
                :width="uiDefineVO.westAreas[0].componentVOs[0].uiComponentType=='table' || uiDefineVO.westAreas[0].componentVOs[0].uiComponentType=='TreeTable'?'420px':'320px'"
                height="100%">
        <UIContentArea :key="'westArea-'+uiDefineVO.oid" :areasData="uiDefineVO.westAreas"
                       :dataStore="checkedData.westArea"
                       :inDialog="inDialog"
                       :sourceData="sourceData"
                       areas-name="westArea"
                       cradStyle=""
                       @setDataStore="setDataStore">
        </UIContentArea>
      </el-aside>
      <el-container style="height: 100%;display: block">
        <el-main v-if="uiDefineVO.centerAreas && uiDefineVO.centerAreas.length>0" :style="'min-height: 300px;height: '+centerHeight">
          <UIContentArea :key="'centerArea-'+uiDefineVO.oid" :areasData="uiDefineVO.centerAreas"
                         :dataStore="checkedData.centerArea"
                         :inDialog="inDialog"
                         :sourceData="checkedData.westArea[checkedData.westArea.length-1]"
                         areas-name="centerArea"
                         cradStyle=""
                         @setDataStore="setDataStore">
          </UIContentArea>
        </el-main>
        <el-footer v-if="uiDefineVO.southAreas && uiDefineVO.southAreas.length>0" height="35%"
                   style="min-height: 150px;">
          <UIContentArea :key="'southArea-'+uiDefineVO.oid" :areasData="uiDefineVO.southAreas"
                         :dataStore="checkedData.southArea"
                         :inDialog="inDialog"
                         :sourceData="checkedData.centerArea[checkedData.centerArea.length-1]"
                         areas-name="southArea"
                         cradStyle=""
                         @setDataStore="setDataStore">
          </UIContentArea>
        </el-footer>
      </el-container>
    </el-container>
  </div>
</template>
 
<script>
import {verifyNull} from "@/util/validate";
import UIContentArea from "@/views/base/UIContentArea"
import {getUIContent} from '@/api/base/region'
 
export default {
  name: "UIContentViewer",
  components: {UIContentArea},
  data() {
    return {
      btmType: '',//业务类型(或链接类型)
      content: '',//UI上下文的名称
      checkedData: {
        //各区域选中数据
        northArea: [{}],
        westArea: [{}],
        centerArea: [{}],
        southArea: [{}]
      },
      uiDefineVO: {},
      centerHeight: '100%',
      inDialog: false,
      //菜单源数据
      sourceData: {},
    }
  },
  watch: {
    $route(to, from) {
      this.getTheParameters()
      this.initUI();
    }
  },
  computed: {
    typeAContent(){
      return this.btmType+this.content;
    }
  },
  created() {
    if (verifyNull(this.$route.query.type) || (verifyNull(this.$route.query.context) && verifyNull(this.$route.query.content))) {
      this.$message.error("配置的信息错误,请参考bs=组件name?type=xxx&context=yyy&param=zzz这种形式。其中type是业务类型(或链接类型),context是UI上下文的名称");
      return false;
    }
    this.getTheParameters()
    this.initUI();
  },
  methods: {
    getTheParameters(){
      this.btmType = this.$route.query.type;
      this.content = this.$route.query.context || this.$route.query.content;
      this.sourceData = this.$route.query;
    },
    initUI() {
      getUIContent({btmType: this.btmType, id: this.content}).then(res => {
        this.uiDefineVO = res.data.obj;
        this.initContent();
      })
    },
    initContent() {
      if (this.uiDefineVO.southAreas && this.uiDefineVO.southAreas.length > 0) {
        this.centerHeight = '65%';
      } else {
        this.centerHeight = '100%';
      }
    },
    setDataStore(value) {
      this.checkedData[value.area] = value.dataStore;
    }
  }
}
</script>
 
<style scoped>
.el-container {
  padding: 0 !important;
}
 
.el-header, .el-aside, .el-main, .el-footer {
  padding: 0;
}
 
.el-header {
  margin-bottom: 10px;
}
</style>