|
@@ -1,42 +1,7 @@
|
|
|
<!-- eslint-disable vue/multi-word-component-names -->
|
|
|
<template>
|
|
|
- <!-- Header部分 -->
|
|
|
- <div v-if="headerConfig.show" class="w-100% flex content__header">
|
|
|
- <!-- 选择下拉框,自动填充剩余空间,这种实现是因为 Select 不支持 suffix -->
|
|
|
- <Dropdown
|
|
|
- v-if="headerConfig.showSelector"
|
|
|
- class="flex-grow-1 content__header_left"
|
|
|
- :trigger="['click']"
|
|
|
- :bordered="false"
|
|
|
- @open-change="headerVisible = $event"
|
|
|
- >
|
|
|
- <div class="w-100% flex flex-items-center" @click.prevent>
|
|
|
- <SwapOutlined class="w-30px" />
|
|
|
- <div class="flex-grow-1">
|
|
|
- {{ selectedDeviceLabel }}
|
|
|
- </div>
|
|
|
- <CaretUpOutlined class="w-30px" v-if="headerVisible" />
|
|
|
- <CaretDownOutlined class="w-30px" v-else />
|
|
|
- </div>
|
|
|
- <template #overlay>
|
|
|
- <Menu :selected-keys="[selectedDeviceID]" @click="headerSelectHandler">
|
|
|
- <MenuItem v-for="item in options" :key="item.value" :title="item.label">
|
|
|
- {{ item.label }}
|
|
|
- </MenuItem>
|
|
|
- </Menu>
|
|
|
- </template>
|
|
|
- </Dropdown>
|
|
|
- <template v-if="headerConfig.showSlot">
|
|
|
- <div class="flex flex-items-center flex-grow-1 content__header_right">
|
|
|
- <SwapOutlined class="w-30px" />
|
|
|
- <div class="flex-grow-1">
|
|
|
- {{ selectedDeviceSlot }}
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </div>
|
|
|
<!-- 主体内容部分 -->
|
|
|
- <div class="content" :class="{ content_without_header: !headerConfig.show }">
|
|
|
+ <div class="content">
|
|
|
<!-- 背景 -->
|
|
|
<img v-if="background.show && background.type === 'image'" class="content__background" :src="background.link" />
|
|
|
<video
|
|
@@ -80,8 +45,12 @@
|
|
|
<CustomGallery class="content__module" :type="config.type" :gallery-config="config.items" />
|
|
|
</template>
|
|
|
<!-- 复杂列表部分 -->
|
|
|
+ <template v-if="config.key === 'gallery_list'">
|
|
|
+ <GalleryList class="content__module" :type="config.type" :list-config="config.items" :gallery-config="config.galleryItems" />
|
|
|
+ </template>
|
|
|
+ <!-- 复杂列表部分 -->
|
|
|
<template v-if="config.key === 'complex_list'">
|
|
|
- <ComplexList class="content__module" :type="config.type" :list-config="config.items" :gallery-config="config.galleryItems" />
|
|
|
+ <ComplexList class="content__module" :type="config.type" :list-config="config.items" />
|
|
|
</template>
|
|
|
<!-- 表格部分,这部分通常是占一整个模块的 -->
|
|
|
<template v-if="config.key === 'table'">
|
|
@@ -112,7 +81,7 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script lang="ts" setup>
|
|
|
- import { computed, onMounted, ref } from 'vue';
|
|
|
+ import { computed } from 'vue';
|
|
|
import {
|
|
|
Config,
|
|
|
// ModuleDataBoard,
|
|
@@ -121,41 +90,29 @@
|
|
|
// ModuleDataPreset,
|
|
|
// ModuleDataTable,
|
|
|
} from '../../../deviceManager/configurationTable/types';
|
|
|
- import { useInitDevices } from '../hooks/useInit';
|
|
|
- import { MenuItem, Menu, Dropdown } from 'ant-design-vue';
|
|
|
- import { SwapOutlined, CaretUpOutlined, CaretDownOutlined } from '@ant-design/icons-vue';
|
|
|
- import MiniBoard from './MiniBoard.vue';
|
|
|
- import TimelineList from './TimelineList.vue';
|
|
|
- import CustomList from './CustomList.vue';
|
|
|
- import CustomGallery from './CustomGallery.vue';
|
|
|
- import ComplexList from './ComplexList.vue';
|
|
|
- import CustomTable from './CustomTable.vue';
|
|
|
- import { getFormattedText } from '../../../deviceManager/configurationTable/adapters';
|
|
|
- import CustomChart from './CustomChart.vue';
|
|
|
+ import MiniBoard from './detail/MiniBoard.vue';
|
|
|
+ import TimelineList from './detail/TimelineList.vue';
|
|
|
+ import CustomList from './detail/CustomList.vue';
|
|
|
+ import CustomGallery from './detail/CustomGallery.vue';
|
|
|
+ import ComplexList from './detail/ComplexList.vue';
|
|
|
+ import GalleryList from './detail/GalleryList.vue';
|
|
|
+ import CustomTable from './detail/CustomTable.vue';
|
|
|
+ import CustomChart from './detail/CustomChart.vue';
|
|
|
import { get, clone } from 'lodash-es';
|
|
|
+ import { getFormattedText } from '../../../deviceManager/configurationTable/adapters';
|
|
|
import CommonTable from '../../billboard/components/CommonTable.vue';
|
|
|
import BlastDelta from '../../../monitorManager/deviceMonitor/components/device/modal/blastDelta.vue';
|
|
|
- import FIreWarn from './FIreWarn.vue';
|
|
|
- import FIreControl from './FIreControl.vue';
|
|
|
+ import FIreWarn from './preset/FIreWarn.vue';
|
|
|
+ import FIreControl from './preset/FIreControl.vue';
|
|
|
|
|
|
const props = defineProps<{
|
|
|
- deviceType: Config['deviceType'];
|
|
|
+ data: any;
|
|
|
moduleData: Config['moduleData'];
|
|
|
- showStyle: Config['showStyle'];
|
|
|
}>();
|
|
|
|
|
|
- const { header: headerConfig, background, layout, mock } = props.moduleData;
|
|
|
+ const { background, layout, mock } = props.moduleData;
|
|
|
|
|
|
// 额外的 header 相关的变量
|
|
|
- const headerVisible = ref(false);
|
|
|
- function headerSelectHandler({ key }) {
|
|
|
- selectedDeviceID.value = key;
|
|
|
- }
|
|
|
-
|
|
|
- const { selectedDeviceID, selectedDevice, selectedDeviceSlot, selectedDeviceLabel, options, fetchDevices } = useInitDevices(
|
|
|
- props.deviceType,
|
|
|
- headerConfig
|
|
|
- );
|
|
|
|
|
|
function getData(raw, readFrom) {
|
|
|
if (mock) return mock;
|
|
@@ -167,11 +124,12 @@
|
|
|
|
|
|
/** 根据配置里的layout将配置格式化为带 key 的具体配置,例如:[{ key: 'list', value: any, ...ModuleDataList }] */
|
|
|
const layoutConfig = computed(() => {
|
|
|
- const refData = selectedDevice.value;
|
|
|
+ const refData = props.data;
|
|
|
const board = clone(props.moduleData.board);
|
|
|
const list = clone(props.moduleData.list);
|
|
|
const gallery = clone(props.moduleData.gallery);
|
|
|
const complex_list = clone(props.moduleData.complex_list);
|
|
|
+ const gallery_list = clone(props.moduleData.gallery_list);
|
|
|
const chart = clone(props.moduleData.chart);
|
|
|
const table = clone(props.moduleData.table);
|
|
|
const preset = clone(props.moduleData.preset);
|
|
@@ -242,6 +200,29 @@
|
|
|
key,
|
|
|
items: cfg.items.map((i) => {
|
|
|
return {
|
|
|
+ title: getFormattedText(data, i.title),
|
|
|
+ contents: i.contents.map((e) => {
|
|
|
+ return {
|
|
|
+ ...e,
|
|
|
+ label: getFormattedText(data, e.label),
|
|
|
+ value: getFormattedText(data, e.value),
|
|
|
+ };
|
|
|
+ }),
|
|
|
+ };
|
|
|
+ }),
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 'gallery_list': {
|
|
|
+ const cfg = gallery_list.shift();
|
|
|
+ if (!cfg) break;
|
|
|
+ const data = getData(refData, cfg.readFrom);
|
|
|
+
|
|
|
+ arr.push({
|
|
|
+ ...cfg,
|
|
|
+ key,
|
|
|
+ items: cfg.items.map((i) => {
|
|
|
+ return {
|
|
|
...i,
|
|
|
label: getFormattedText(data, i.label),
|
|
|
value: getFormattedText(data, i.value),
|
|
@@ -298,10 +279,6 @@
|
|
|
return arr;
|
|
|
}, []);
|
|
|
});
|
|
|
-
|
|
|
- onMounted(() => {
|
|
|
- fetchDevices();
|
|
|
- });
|
|
|
</script>
|
|
|
<style lang="less" scoped>
|
|
|
@import '@/design/vent/color.less';
|
|
@@ -331,9 +308,6 @@
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
}
|
|
|
- .content_without_header {
|
|
|
- height: 100%;
|
|
|
- }
|
|
|
.content__background {
|
|
|
width: 100%;
|
|
|
height: 100%;
|