| 12345678910111213141516171819202122232425262728293031323334 |
- <template>
- <component :is="getModuleComponent(showStyle.position)" :style="style" :title="moduleName" :visible="visible" @close="$emit('close')">
- <slot></slot>
- </component>
- </template>
- <script lang="ts" setup>
- import ModuleLeft from './original/moduleLeft.vue';
- import ModuleBottom from './original/moduleBottom.vue';
- import { computed } from 'vue';
- import { ShowStyle } from '../../../deviceManager/configurationTable/types';
- import { ModulePositionMap, ModuleSizeMap } from '../../../deviceManager/configurationTable/options';
- import { get } from 'lodash-es';
- const props = defineProps<{
- showStyle: ShowStyle;
- moduleName: string;
- visible: boolean;
- }>();
- defineEmits(['close']);
- const style = computed(() => {
- const size = get(ModuleSizeMap, props.showStyle.size, ModuleSizeMap['标准尺寸(450*280)']);
- const position = get(ModulePositionMap, props.showStyle.position, ModulePositionMap['不展示']);
- return size + position;
- });
- // 根据配置里的定位判断应该使用哪个module组件
- function getModuleComponent(position) {
- if (position === '中下') {
- return ModuleBottom;
- }
- return ModuleLeft;
- }
- </script>
|