|
@@ -11,20 +11,37 @@
|
|
|
class="component-module"
|
|
|
>
|
|
|
<slot>
|
|
|
- <Header :deviceType="deviceType" :moduleData="moduleData" :data="data" @select="selectedData = $event" />
|
|
|
- <Content :style="{ height: header.show ? 'calc(100% - 30px)' : '100%' }" :moduleData="moduleData" :data="selectedData" />
|
|
|
+ <!-- <Header :deviceType="deviceType" :moduleData="moduleData" :data="data" @select="selectedData = $event" /> -->
|
|
|
+ <component
|
|
|
+ :is="getHeaderComponent(showStyle.headerPosition)"
|
|
|
+ :deviceType="deviceType"
|
|
|
+ :moduleData="moduleData"
|
|
|
+ :data="data"
|
|
|
+ @select="selectedData = $event"
|
|
|
+ />
|
|
|
+ <Content :style="{ height: header.show ? 'calc(100% - 45px)' : '100%' }" :moduleData="moduleData" :data="selectedData" />
|
|
|
</slot>
|
|
|
</component>
|
|
|
</template>
|
|
|
<script lang="ts" setup>
|
|
|
import Header from './header.vue';
|
|
|
import Content from './content.vue';
|
|
|
-import ModuleLeft from './originalNew/moduleLeft.vue';
|
|
|
+import ModuleLeftTop from './originalNew/moduleLeftTop.vue';
|
|
|
+import ModuleLeftCenter from './originalNew/moduleLeftCenter.vue';
|
|
|
+import ModuleLeftBottom from './originalNew/moduleLeftBottom.vue';
|
|
|
+import ModuleRightTop from './originalNew/moduleRightTop.vue';
|
|
|
+import ModuleRightCenter from './originalNew/moduleRightCenter.vue';
|
|
|
+import ModuleRightBottom from './originalNew/moduleRightBottom.vue';
|
|
|
import ModuleBottom from './originalNew/moduleBottom.vue';
|
|
|
import ModuleTop from './originalNew/moduleTop.vue';
|
|
|
import { computed, ref } from 'vue';
|
|
|
import { openWindow } from '/@/utils';
|
|
|
import { getFormattedText } from '../hooks/helper';
|
|
|
+import LeftHeader1 from './originalNew/leftHeader1.vue';
|
|
|
+import LeftHeader2 from './originalNew/leftHeader2.vue';
|
|
|
+import RightHeader1 from './originalNew/rightHeader1.vue';
|
|
|
+import RightHeader2 from './originalNew/rightHeader2.vue';
|
|
|
+import RightHeader3 from './originalNew/rightHeader3.vue';
|
|
|
// import { ModuleProps } from '../types';
|
|
|
|
|
|
const props = defineProps<{
|
|
@@ -47,27 +64,69 @@ const selectedData = ref();
|
|
|
const style = computed(() => {
|
|
|
const size = props.showStyle.size;
|
|
|
const position = props.showStyle.position;
|
|
|
+ // const headerPosition = props.showStyle.headerPosition;
|
|
|
return size + position;
|
|
|
});
|
|
|
|
|
|
// 根据配置里的定位判断应该使用哪个module组件
|
|
|
-function getModuleComponent({ size, position }) {
|
|
|
- const [_, width] = size.match(/width:([0-9]+)px/) || [];
|
|
|
- if (position.includes('top') && parseInt(width) > 800) {
|
|
|
+function getModuleComponent({ size, position, headerPosition }) {
|
|
|
+ // const [_, width] = size.match(/width:([0-9]+)px/) || [];
|
|
|
+ // if (position.includes('top') && parseInt(width) > 800) {
|
|
|
+ // return ModuleTop;
|
|
|
+ // }
|
|
|
+ // if (position.includes('bottom')) {
|
|
|
+ // return ModuleBottom;
|
|
|
+ // }
|
|
|
+ if (headerPosition === 'centerTop') {
|
|
|
return ModuleTop;
|
|
|
}
|
|
|
- if (position.includes('bottom')) {
|
|
|
+ if (headerPosition === 'centerBottom') {
|
|
|
return ModuleBottom;
|
|
|
}
|
|
|
- if (position.includes('left')) {
|
|
|
- return ModuleLeft;
|
|
|
+ if (headerPosition === 'leftTop') {
|
|
|
+ return ModuleLeftTop;
|
|
|
}
|
|
|
- if (position.includes('right')) {
|
|
|
- return ModuleLeft;
|
|
|
+ if (headerPosition === 'leftCenter') {
|
|
|
+ return ModuleLeftCenter;
|
|
|
}
|
|
|
+ if (headerPosition === 'leftBottom') {
|
|
|
+ return ModuleLeftBottom;
|
|
|
+ }
|
|
|
+ if (headerPosition === 'rightTop') {
|
|
|
+ return ModuleRightTop;
|
|
|
+ }
|
|
|
+ if (headerPosition === 'rightCenter') {
|
|
|
+ return ModuleRightCenter;
|
|
|
+ }
|
|
|
+ if (headerPosition === 'rightBottom') {
|
|
|
+ return ModuleRightBottom;
|
|
|
+ }
|
|
|
+ // if (position.includes('left')) {
|
|
|
+ // return ModuleLeft;
|
|
|
+ // }
|
|
|
+ // if (position.includes('right')) {
|
|
|
+ // return ModuleLeft;
|
|
|
+ // }
|
|
|
return ModuleBottom;
|
|
|
}
|
|
|
-
|
|
|
+function getHeaderComponent(headerType) {
|
|
|
+ if (headerType === 'leftTop') {
|
|
|
+ return LeftHeader1;
|
|
|
+ }
|
|
|
+ if (headerType === 'leftBottom') {
|
|
|
+ return LeftHeader2;
|
|
|
+ }
|
|
|
+ if (headerType === 'rightTop') {
|
|
|
+ return RightHeader1;
|
|
|
+ }
|
|
|
+ if (headerType === 'rightCenter') {
|
|
|
+ return RightHeader2;
|
|
|
+ }
|
|
|
+ if (headerType === 'rightBottom') {
|
|
|
+ return RightHeader3;
|
|
|
+ }
|
|
|
+ return Header; // 默认返回顶部模块
|
|
|
+}
|
|
|
function redirectTo() {
|
|
|
const { to } = props.moduleData;
|
|
|
if (!to) return;
|