<template>
|
<el-dialog v-dialogDrag
|
:title="title"
|
:visible.sync="visible"
|
:width="width"
|
:fullscreen="fullscreen"
|
:append-to-body="true"
|
top="0"
|
class="avue-dialog"
|
:destroy-on-close="true"
|
@close="dialogClose">
|
<component :is="currentComponent"
|
ref="uiViewRef"
|
key="ViewDialog"
|
:style="fullscreen?'':'height:'+height"
|
:btmType="paramVOS.type"
|
:context="paramVOS.context"
|
:inDialog="true"
|
:canEdit="false"
|
actionType="viewDialog"
|
:sourceData="sourceData"
|
:dataStore="dataStore"
|
:paramVOS="paramVOS"></component>
|
<!--<ui-view ref="uiViewRef"
|
key="ViewDialog"
|
:style="fullscreen?'':'height:'+height"
|
:btmType="paramVOS.type"
|
:context="paramVOS.context"
|
:inDialog="true"
|
:canEdit="false"
|
actionType="view"
|
:sourceData="sourceData"
|
:dataStore="dataStore"
|
:paramVOS="paramVOS"
|
></ui-view>-->
|
|
</el-dialog>
|
</template>
|
|
<script>
|
import {validatenull} from "@/util/validate";
|
|
export default {
|
name: "ViewDialog",
|
components:{},
|
props: {
|
sourceData: {
|
//所属区域的上一区域选中数据
|
type: Object,
|
default: {}
|
},
|
dataStore: {
|
//弹窗时按钮所属区域选中数据
|
type: Array,
|
default: []
|
},
|
paramVOS: {
|
type: Object,
|
default: {}
|
}
|
},
|
data(){
|
return {
|
visible:false,
|
currentComponent: null,
|
}
|
},
|
computed:{
|
title(){
|
return this.paramVOS.title || "查看详情"
|
},
|
width() {
|
if (!validatenull(this.paramVOS.width)) {
|
if (this.paramVOS.width.includes("px") || this.paramVOS.width.includes("%")) {
|
return this.paramVOS.width;
|
} else {
|
return this.paramVOS.width + "px";
|
}
|
} else {
|
return "60%";
|
}
|
},
|
height(){
|
if (!validatenull(this.paramVOS.height)) {
|
if (this.paramVOS.height.includes("px") || this.paramVOS.height.includes("%")) {
|
return this.paramVOS.height;
|
} else {
|
return this.paramVOS.height + "px";
|
}
|
} else {
|
return "auto"
|
}
|
},
|
fullscreen(){
|
if(this.paramVOS.width || this.paramVOS.height){
|
return false;
|
}else if(this.paramVOS.form){
|
return false;
|
}
|
return true;
|
}
|
},
|
created() {
|
this.sourceData = this.paramVOS.usesourcedata == "true" ? this.dataStore[0] : this.sourceData;
|
this.dataStore = this.paramVOS.usesourcedata == "true" ? [] : this.dataStore;
|
},
|
mounted() {
|
this.loadCompoent();
|
},
|
methods: {
|
loadCompoent(){
|
// 动态导入组件
|
import(`@/views/${this.paramVOS.component}.vue`).then((module) => {
|
// 成功导入后,将组件注册到Vue实例中
|
this.currentComponent = module.default;
|
}).catch((error) => {
|
// 处理导入失败的情况
|
console.log('组件加载失败:', error);
|
});
|
},
|
dialogClose() {
|
this.visible = false;
|
},
|
}
|
}
|
</script>
|
|
<style scoped>
|
|
</style>
|