<template>
|
<!--UI上下文的展示器-->
|
<div style="height:calc(100% - 4px);" >
|
<el-header v-if="uiDefineVO.northAreas && uiDefineVO.northAreas.length>0">
|
<UIContentArea :key="'northArea-'+uiDefineVO.oid"
|
:uiBtmType="btmType"
|
:uiContext="context"
|
:areasData="uiDefineVO.northAreas"
|
:dataStore="checkedData.northAreaInDialog.data"
|
:paramVOS="paramVOS"
|
:inDialog="inDialog"
|
:canEdit="canEdit"
|
:actionType="actionType"
|
:sourceData="sourceData"
|
:sourceBtmType="btmType"
|
areas-name="northAreaInDialog"
|
@setData="setData"
|
@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"
|
:uiBtmType="btmType"
|
:uiContext="context"
|
:areasData="uiDefineVO.westAreas"
|
:dataStore="checkedData.westAreaInDialog.data"
|
:paramVOS="paramVOS"
|
:inDialog="inDialog"
|
:canEdit="canEdit"
|
:actionType="actionType"
|
:sourceData="sourceData"
|
:sourceBtmType="btmType"
|
areas-name="westAreaInDialog"
|
cradStyle=""
|
@setData="setData"
|
@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: 200px;height: '+centerHeight">
|
<UIContentArea :key="'centerArea-'+uiDefineVO.oid"
|
:uiBtmType="btmType"
|
:uiContext="context"
|
:areasData="uiDefineVO.centerAreas"
|
:dataStore="checkedData.centerAreaInDialog.data"
|
:paramVOS="paramVOS"
|
:inDialog="inDialog"
|
:canEdit="canEdit"
|
:actionType="actionType"
|
:sourceData="(uiDefineVO.westAreas && uiDefineVO.westAreas.length>0)?checkedData.westAreaInDialog.data[checkedData.westAreaInDialog.data.length-1]:sourceData"
|
:sourceBtmType="(uiDefineVO.westAreas && uiDefineVO.westAreas.length>0)?checkedData.westAreaInDialog.DefineVOBtmType:btmType"
|
areas-name="centerAreaInDialog"
|
cradStyle=""
|
@setData="setData"
|
@setDataStore="setDataStore">
|
</UIContentArea>
|
</el-main>
|
<el-footer v-if="uiDefineVO.southAreas && uiDefineVO.southAreas.length>0" height="35%"
|
style="min-height: 100px;">
|
<UIContentArea :key="'southArea-'+uiDefineVO.oid"
|
:uiBtmType="btmType"
|
:uiContext="context"
|
:areasData="uiDefineVO.southAreas"
|
:dataStore="checkedData.southAreaInDialog.data"
|
:paramVOS="paramVOS"
|
:inDialog="inDialog"
|
:canEdit="canEdit"
|
:actionType="actionType"
|
:sourceData="checkedData.centerAreaInDialog.data[checkedData.centerAreaInDialog.data.length-1]"
|
:sourceBtmType="checkedData.centerAreaInDialog.DefineVOBtmType"
|
areas-name="southAreaInDialog"
|
cradStyle=""
|
@setData="setData"
|
@setDataStore="setDataStore">
|
</UIContentArea>
|
</el-footer>
|
</el-container>
|
</el-container>
|
</div>
|
</template>
|
|
<script>
|
import UIContentArea from "@/views/base/UIContentArea"
|
import {verifyNull} from "@/util/validate";
|
import {getUIContext} from '@/api/base/ui'
|
|
export default {
|
name: "UIContentViewerInDialog",
|
components:{UIContentArea},
|
props:{
|
btmType:{
|
type: String,
|
},
|
context:{
|
type: String,
|
},
|
inDialog: {
|
type: Boolean,
|
default: false
|
},
|
canEdit:{
|
//内容是否可编辑
|
type:Boolean,
|
default:false
|
},
|
actionType:{
|
//按钮操作类型
|
default:"add"
|
},
|
sourceData:{
|
//所属区域的上一区域选中数据
|
type:Object,
|
default: {}
|
},
|
dataStore:{
|
//弹窗时按钮所属区域选中数据
|
type:Array,
|
default: []
|
},
|
paramVOS:{
|
type:Object,
|
default: {}
|
}
|
},
|
data() {
|
return {
|
//各区域的选中数据
|
checkedData:{
|
northAreaInDialog:{
|
DefineVOBtmType:'',
|
data:[{}]
|
},
|
westAreaInDialog:{
|
DefineVOBtmType:'',
|
data:[{}]
|
},
|
centerAreaInDialog:{
|
DefineVOBtmType:'',
|
data:[{}]
|
},
|
southAreaInDialog:{
|
DefineVOBtmType:'',
|
data:[{}]
|
}
|
},
|
//各区域数据
|
data:{
|
northAreaInDialog:{
|
type:'',
|
DefineVO:null,
|
data:null
|
},
|
westAreaInDialog:{
|
type:'',
|
DefineVO:null,
|
data:null
|
},
|
centerAreaInDialog:{
|
type:'',
|
DefineVO:null,
|
data:null
|
},
|
southAreaInDialog:{
|
type:'',
|
DefineVO:null,
|
data:null
|
}
|
},
|
uiDefineVO: {},
|
centerHeight:'100%'
|
}
|
},
|
watch: {
|
typeAndContext:{
|
handler(newV,oldV){
|
if(oldV!=newV && !verifyNull(newV)){
|
this.initUI();
|
}
|
},
|
immediate: true,
|
}
|
},
|
computed: {
|
typeAndContext(){
|
return this.btmType+this.context;
|
}
|
},
|
created() {
|
if (verifyNull(this.btmType) || verifyNull(this.context) ) {
|
this.$message.error("自定义组件配置的信息错误,请参考”?type=xxx&context=yyy¶m=zzz“这种形式。其中type是业务类型(或链接类型),context是UI上下文的名称");
|
return false;
|
}
|
},
|
methods: {
|
initUI() {
|
getUIContext({btmType: this.btmType, id: this.context}).then(res => {
|
this.uiDefineVO = res.data.obj;
|
this.initContext();
|
})
|
},
|
initContext() {
|
if (this.uiDefineVO.southAreas && this.uiDefineVO.southAreas.length > 0) {
|
this.centerHeight = '65%';
|
} else {
|
this.centerHeight = '100%';
|
}
|
if(this.uiDefineVO.westAreas && this.uiDefineVO.westAreas.length>0){
|
this.checkedData.westAreaInDialog.data=this.dataStore;
|
}else if(this.uiDefineVO.centerAreas && this.uiDefineVO.centerAreas.length>0){
|
this.checkedData.centerAreaInDialog.data=this.dataStore;
|
}else {
|
this.checkedData.southAreaInDialog.data=this.dataStore;
|
}
|
},
|
setData(value) {
|
this.data[value.area].DefineVO = value.currentDefineVO;
|
this.data[value.area].data = value.data;
|
this.data[value.area].type = value.type;
|
},
|
setDataStore(value) {
|
this.checkedData[value.area].DefineVOBtmType = value.btmType;
|
this.checkedData[value.area].data = 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>
|