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
| <template>
| <!--Action 查看Tab的实现-->
| <component :is="currentComponent"
| ref="uiViewRef"
| key="ViewTab"
| :btmType="paramVOS.type"
| :context="paramVOS.context"
| :inDialog="false"
| :canEdit="false"
| actionType="view"
| :sourceData="sourceData"
| :dataStore="dataStore"
| :paramVOS="paramVOS"></component>
| </template>
|
| <script>
| import {validatenull} from "@/util/validate";
| import { getStore } from "@/util/store.js";
|
| export default {
| name: "ViewTab",
| components:{},
| data(){
| return {
| sourceData:{},
| dataStore:[],
| paramVOS:{},
| currentComponent: null,
| }
| },
| computed:{
| title(){
| return this.paramVOS.title || "查看详情"
| }
| },
| created() {
| let config = {};
| if (!validatenull(this.$store.state.viewtabparams)) {
| config = this.$store.state.viewtabparams;
| } else {
| config = getStore('viewtabparams');
| }
| this.sourceData = config.options.sourceData;
| this.dataStore = config.options.dataStore;
| this.paramVOS = config.paramVOS;
| },
| mounted() {
| this.loadCompoent();
| },
| methods: {
| loadCompoent(){
| // 动态导入组件
| import(`@/views/${this.paramVOS.component}.vue`).then((module) => {
| // 成功导入后,将组件注册到Vue实例中
| this.currentComponent = module.default;
| }).catch((error) => {
| // 处理导入失败的情况
| console.log('组件加载失败:', error);
| });
| }
| }
| }
| </script>
|
| <style scoped>
|
| </style>
|
|