| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677 |
- <!-- eslint-disable vue/multi-word-component-names -->
- <template>
- <!-- 主体内容部分 -->
- <div class="content">
- <!-- 背景 -->
- <img v-if="background.show && background.type === 'image'" class="content__background" :src="background.link" />
- <video
- v-if="background.show && background.type === 'video' && background.isBoard"
- class="content__background"
- width="100%"
- autoplay
- loop
- muted
- disablepictureinpicture
- playsinline
- >
- <source :src="background.link" />
- Not Supportted Link Or Browser
- </video>
- <video
- v-if="background.show && background.type === 'video' && !background.isBoard"
- class="content__background_1"
- width="100%"
- autoplay
- loop
- muted
- disablepictureinpicture
- playsinline
- >
- <source :src="background.link" />
- Not Supportted Link Or Browser
- </video>
- <div class="flex w-full h-full" :style="{ flexDirection: layout.direction }">
- <div v-for="config in layoutConfig" :key="config.name" :style="{ flexBasis: config.basis, overflow: config.overflow ? 'auto' : 'hidden' }">
- <!-- 告示板部分 -->
- <template v-if="config.name === 'board'">
- <div
- v-if="config.pageType == 'vent_New'"
- style="padding-top: 11%"
- class="content__module content__module1 flex flex-justify-around flex-items-center flex-wrap"
- >
- <MiniBoard
- v-for="item in config.items"
- :key="item.prop"
- :label="item.label"
- :value="item.value"
- :type="config.type"
- :layout="config.layout"
- />
- </div>
- <div v-else-if="config.pageType == 'New_fire'" class="content__module flex flex-justify-around flex-items-center flex-wrap">
- <MiniBoardNew
- v-for="item in config.items"
- :key="item.prop"
- :label="item.label"
- :value="item.value"
- :type="config.type"
- :layout="config.layout"
- />
- </div>
- <div v-else class="content__module flex flex-justify-around flex-items-center flex-wrap">
- <MiniBoard
- v-for="item in config.items"
- :key="item.prop"
- :label="item.label"
- :value="item.value"
- :unit="item.unit"
- :type="config.type"
- :layout="config.layout"
- />
- </div>
- </template>
- <!-- 图表部分,这部分通常需要填充,有告示板、Header等内容需要填充父级 -->
- <template v-if="config.name === 'chart'">
- <CustomChart v-if="config.pageType == 'New_dust'" class="content__module_dust" :chart-config="config.config" :chart-data="config.data" />
- <CustomChart v-else class="content__module" :chart-config="config.config" :chart-data="config.data" />
- </template>
- <!-- 通常列表部分 -->
- <template v-if="config.name === 'list'">
- <template v-if="config.type === 'timeline'">
- <TimelineList class="content__module" :list-config="config.items" />
- </template>
- <template v-else-if="config.type === 'timelineNew'">
- <TimelineListNew class="content__module" :list-config="config.items" />
- </template>
- <template v-else>
- <CustomList class="content__module" :type="config.type" :list-config="config.items" />
- </template>
- </template>
- <template v-if="config.name === 'fireList'">
- <CustomList class="content__module" :type="config.type" :list-config="config.items" />
- </template>
- <!-- 画廊部分 -->
- <template v-if="config.name === 'gallery'">
- <CustomGallery class="content__module" :type="config.type" :gallery-config="config.items" />
- </template>
- <!-- 复杂列表部分 -->
- <template v-if="config.name === 'gallery_list'">
- <GalleryList class="content__module" :type="config.type" :list-config="config.items" :gallery-config="config.galleryItems" />
- </template>
- <!-- 复杂列表部分 -->
- <template v-if="config.name === 'complex_list'">
- <ComplexList class="content__module" :type="config.type" :list-config="config.items" />
- </template>
- <!-- 表格部分,这部分通常是占一整个模块的 -->
- <template v-if="config.name === 'table'">
- <CustomTable
- class="content__module text-center overflow-auto"
- :type="config.type"
- :columns="config.columns"
- :auto-scroll="config.autoScroll"
- :data="config.data"
- />
- </template>
- <template v-if="config.name === 'tabs'">
- <CustomTabs class="content__module" :type="config.type" :tab-config="config.items" :overflow="config.overflow" />
- </template>
- <template v-if="config.name === 'blast_delta'">
- <BlastDelta
- v-if="config.pageType === 'New_fire'"
- class="content__moduleFire"
- :pos-monitor="config.data"
- :canvasSize="{ width: 250, height: 200 }"
- />
- <BlastDelta v-else class="content__module" :pos-monitor="config.data" :canvasSize="{ width: 250, height: 200 }" />
- </template>
- <template v-if="config.name === 'qh_curve'">
- <QHCurve class="content__module" :mainfan="config.data" :fan1-prop="config.config.fan1Prop" :fan2-prop="config.config.fan2Prop" />
- </template>
- <template v-if="config.name === 'ai_chat'">
- <AIChat class="content__module" />
- </template>
- <template v-if="config.name === 'device_alarm'">
- <DeviceAlarm class="content__module" :devicedata="config.data" :config="config.config" />
- </template>
- <!-- lxh -->
- <template v-if="config.name === 'select_cs'">
- <SelectCs :devicedata="config.data" :config="config.config" />
- </template>
- <template v-if="config.name === 'measure_detail'">
- <MeasureDetail
- class="content__module"
- :show-title="false"
- :composite-data="config.data"
- :topconfig="config.config.topconfig"
- :btnconfig="config.config.btnconfig"
- />
- </template>
- <template v-if="config.name === 'partition'">
- <Partition class="content__module" :type="config.type" :label="config.label" :icon="config.icon" />
- </template>
- <template v-if="config.name === 'selector_dual_chart'">
- <SelectorDualChart :data="config.data" :moduleData="props.moduleData" :config="config" />
- </template>
- <template v-if="config.name === 'radio_label'">
- <RadioLabel class="content__module" :type="config.config.type" :config="config.config" />
- </template>
- <template v-if="config.name === 'button_list'">
- <ButtonList class="content__module" :type="config.config.type" :config="config.config" :buttonList="config.config.buttonList" />
- </template>
- <template v-if="config.name === 'card_list'">
- <cardList class="content__module" :cardData="config.data" />
- </template>
- <template v-else-if="config.name === 'generalist'">
- <generalList class="content__module" :generalData="config.data" />
- </template>
- <template v-else-if="config.name === 'jk-video'">
- <cameraModal class="content__module" :deviceId="config.data" />
- </template>
- <template v-if="config.name === 'gallery_new'">
- <CustomGalleryNew class="content__module" :type="config.config.type" :option="config.config.items" :galleryData="config.data" />
- </template>
- <template v-if="config.name === 'card_new'">
- <ImageCardNew :option="config.config.items" :cardData="config.data"></ImageCardNew>
- </template>
- <template v-if="config.name === 'btn_new'">
- <BtnListNew :option="config.config.items" :data="config.data"></BtnListNew>
- </template>
- <template v-if="config.name === 'oerate_new'">
- <OperateNew :option="config.config.items" :btnOption="config.config.option" :data="config.data"></OperateNew>
- </template>
- <template v-if="config.name === 'long_list'">
- <LongList></LongList>
- </template>
- <template v-if="config.name === 'long_list1'">
- <LongList1></LongList1>
- </template>
- <template v-if="config.name === 'long_list2'">
- <LongList2></LongList2>
- </template>
- <template v-if="config.name === 'search_table'">
- <SearchTable></SearchTable>
- </template>
- <template v-if="config.name === 'mixed_warn'">
- <MixedWarn></MixedWarn>
- </template>
- <template v-if="config.name === 'rule_list'">
- <RuleList></RuleList>
- </template>
- <template v-if="config.name === 'echart_bar_new'">
- <EchartBarNew></EchartBarNew>
- </template>
- <template v-if="config.name === 'user_list'">
- <UserList></UserList>
- </template>
- <template v-if="config.name === 'log_audit'">
- <LogAudit></LogAudit>
- </template>
- <template v-if="config.name === 'user_edit'">
- <UserEdit></UserEdit>
- </template>
- <template v-if="config.name === 'permission_info'">
- <PermissionManager></PermissionManager>
- </template>
- <template v-if="config.name === 'permission_set'">
- <PermissionSet></PermissionSet>
- </template>
- <template v-if="config.name === 'statistic_day'">
- <StatisticDay></StatisticDay>
- </template>
- <template v-if="config.name === 'system_view'">
- <SystemView></SystemView>
- </template>
- <template v-if="config.name === 'rule_table'">
- <RuleTable :config="config.config" :data="config.data" :selected-row="selectRuleRow" @row-change="onRowClick"></RuleTable>
- </template>
- <template v-if="config.name === 'link_log'"> <LinkLog></LinkLog> </template>
- <template v-if="config.name === 'rule_num'"> <RuleNum></RuleNum> </template>
- <template v-if="config.name === 'link_edit'"> <LinkRuleEdit :selected-row="selectRuleRow"> </LinkRuleEdit></template>
- </div>
- </div>
- </div>
- </template>
- <script lang="ts" setup>
- import { computed, reactive, watch, ref } from 'vue';
- import {
- CommonItem,
- Config,
- // ModuleDataBoard,
- // ModuleDataChart,
- // ModuleDataList,
- // ModuleDataPreset,
- // ModuleDataTable,
- } from '../../../deviceManager/configurationTable/types';
- import MiniBoard from './detail/MiniBoard.vue';
- import TimelineList from './detail/TimelineList.vue';
- import TimelineListNew from './detail/TimelineListNew.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 { clone } from 'lodash-es';
- import { getData, getFormattedText } from '../hooks/helper';
- import BlastDelta from '../../../monitorManager/deviceMonitor/components/device/modal/blastDelta.vue';
- import QHCurve from './preset/QHCurve.vue';
- import MeasureDetail from './preset/MeasureDetail.vue';
- import CustomTabs from './preset/CustomTabs.vue';
- import AIChat from '/@/components/AIChat/MiniChat.vue';
- import DeviceAlarm from './preset/DeviceAlarm.vue';
- import SelectCs from './preset/SelectCs.vue';
- import MiniBoardNew from './detail/MiniBoard-New.vue';
- import Partition from './preset/partition.vue';
- import SelectorDualChart from './preset/selectorDualChart.vue';
- import RadioLabel from './preset/radioLabel.vue';
- import ButtonList from './preset/buttonList.vue';
- import cardList from './preset/cardList.vue';
- import generalList from './preset/generalList.vue';
- import cameraModal from './preset/cameraModal.vue';
- import CustomGalleryNew from './preset/CustomGalleryNew.vue';
- import ImageCardNew from './preset/ImageCardNew.vue';
- import BtnListNew from './preset/BtnListNew.vue';
- import OperateNew from './preset/OperateNew.vue';
- import LongList from './preset/LongList.vue';
- import LongList1 from './preset/LongList1.vue';
- import LongList2 from './preset/LongList2.vue';
- import SearchTable from './preset/SearchTable.vue';
- import MixedWarn from './preset/MixedWarn.vue';
- import RuleList from './preset/RuleList.vue';
- import EchartBarNew from './preset/EchartBarNew.vue';
- import UserList from './preset/UserList.vue';
- import LogAudit from './preset/LogAudit.vue';
- import UserEdit from './preset/UserEdit.vue';
- import PermissionManager from './preset/PermissionManager.vue';
- import PermissionSet from './preset/PermissionSet.vue';
- import StatisticDay from './preset/StatisticDay.vue';
- import SystemView from './preset/SystemView.vue';
- import RuleTable from './preset/ruleTable.vue';
- import LinkLog from './preset/linkLog.vue';
- import RuleNum from './preset/ruleNum.vue';
- import LinkRuleEdit from './preset/linkRuleEdit.vue';
- // import FIreWarn from './preset/FIreWarn.vue';
- // import FIreControl from './preset/FIreControl.vue';
- const props = defineProps<{
- data: any;
- moduleData: Config['moduleData'];
- chartData: any;
- }>();
- const { background, layout } = props.moduleData;
- // 存储当前选中行
- const selectRuleRow = ref<null | Record<string, any>>(null);
- const onRowClick = (singleRow) => {
- selectRuleRow.value = singleRow;
- };
- // 获取当原始配置带 items 项时的最终 items 配置
- function getItems(raw, items: CommonItem[]) {
- return items.map((i) => {
- return {
- ...i,
- label: getFormattedText(raw, i.label, i.trans),
- value: getFormattedText(raw, i.value, i.trans),
- };
- });
- }
- // 获取当 List 组件配置带 items 项时的最终 items 配置
- function getListItems(raw: any, items: CommonItem[], mapFromData?: boolean) {
- if (mapFromData && Array.isArray(raw)) {
- return raw.map((data) => {
- const item = items[0];
- return {
- ...item,
- label: getFormattedText(data, item.label, item.trans),
- value: getFormattedText(data, item.value, item.trans),
- };
- });
- }
- return getItems(raw, items);
- }
- /** 根据配置里的layout将配置格式化为带 key 的具体配置,例如:[{ key: 'list', value: any, ...ModuleDataList }] */
- const layoutConfig = computed(() => {
- 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 tabs = clone(props.moduleData.tabs) || [];
- const chart = clone(props.moduleData.chart) || [];
- const table = clone(props.moduleData.table) || [];
- const preset = clone(props.moduleData.preset) || [];
- const partition = clone(props.moduleData.partition) || [];
- const mockData = clone(props.chartData) || [];
- return layout.items.reduce((arr: any[], item) => {
- switch (item.name) {
- case 'board': {
- const cfg = board.shift();
- if (!cfg) break;
- const data = getData(refData, cfg.readFrom, cfg.parser);
- arr.push({
- overflow: true,
- ...item,
- ...cfg,
- items: getItems(data, cfg.items),
- });
- break;
- }
- case 'list': {
- const cfg = list.shift();
- if (!cfg) break;
- const data = getData(refData, cfg.readFrom, cfg.parser);
- arr.push({
- overflow: true,
- ...item,
- ...cfg,
- items: getListItems(data, cfg.items, cfg.mapFromData),
- });
- break;
- }
- case 'gallery': {
- const cfg = gallery.shift();
- if (!cfg) break;
- const data = getData(refData, cfg.readFrom, cfg.parser);
- arr.push({
- overflow: true,
- ...item,
- ...cfg,
- items: getItems(data, cfg.items),
- });
- break;
- }
- case 'complex_list': {
- const cfg = complex_list.shift();
- if (!cfg) break;
- const data = getData(refData, cfg.readFrom, cfg.parser);
- if (cfg.mapFromData) {
- const firstListItem = cfg.items[0];
- arr.push({
- overflow: true,
- ...item,
- ...cfg,
- items: (data || []).map((d) => {
- return {
- title: getFormattedText(d, firstListItem.title, firstListItem.trans),
- contents: firstListItem.contents.map((e) => {
- return {
- ...e,
- label: getFormattedText(d, e.label, e.trans),
- value: getFormattedText(d, e.value, e.trans),
- };
- }),
- };
- }),
- });
- } else {
- arr.push({
- overflow: true,
- ...item,
- ...cfg,
- items: cfg.items.map((i) => {
- return {
- title: getFormattedText(data, i.title, i.trans),
- contents: i.contents.map((e) => {
- return {
- ...e,
- label: getFormattedText(data, e.label, e.trans),
- value: getFormattedText(data, e.value, e.trans),
- };
- }),
- };
- }),
- });
- }
- break;
- }
- case 'gallery_list': {
- const cfg = gallery_list.shift();
- if (!cfg) break;
- const data = getData(refData, cfg.readFrom, cfg.parser);
- arr.push({
- overflow: true,
- ...item,
- ...cfg,
- items: getItems(data, cfg.items),
- galleryItems: getItems(data, cfg.galleryItems),
- });
- break;
- }
- case 'tabs': {
- const cfg = tabs.shift();
- if (!cfg) break;
- const data = getData(refData, cfg.readFrom, cfg.parser);
- if (cfg.mapFromData) {
- const firstListItem = cfg.items[0];
- arr.push({
- overflow: true,
- ...item,
- ...cfg,
- items: (data || []).map((d) => {
- return {
- title: getFormattedText(d, firstListItem.title, firstListItem.trans),
- contents: firstListItem.contents.map((e) => {
- return {
- ...e,
- label: getFormattedText(d, e.label, e.trans),
- value: getFormattedText(d, e.value, e.trans),
- };
- }),
- };
- }),
- });
- } else {
- arr.push({
- overflow: true,
- ...item,
- ...cfg,
- items: cfg.items.map((i) => {
- return {
- title: getFormattedText(data, i.title, i.trans),
- contents: i.contents.map((e) => {
- return {
- ...e,
- label: getFormattedText(data, e.label, e.trans),
- value: getFormattedText(data, e.value, e.trans),
- };
- }),
- };
- }),
- });
- }
- break;
- }
- case 'chart': {
- const cfg = chart.shift();
- if (cfg?.type == 'scatter') {
- if (!cfg) break;
- const data = getData(mockData, cfg.readFrom, cfg.parser);
- arr.push({
- ...item,
- config: cfg,
- data,
- });
- break;
- } else {
- if (!cfg) break;
- const data = getData(refData, cfg.readFrom, cfg.parser);
- arr.push({
- ...item,
- config: cfg,
- data,
- });
- break;
- }
- }
- case 'table': {
- const cfg = table.shift();
- if (!cfg) break;
- const data = getData(refData, cfg.readFrom, cfg.parser);
- arr.push({
- ...cfg,
- ...item,
- columns: cfg.columns,
- data,
- });
- break;
- }
- case 'partition': {
- const cfg = partition.shift();
- if (!cfg) break;
- const data = getData(refData, cfg.readFrom, cfg.parser);
- arr.push({
- overflow: true,
- ...item,
- data,
- ...cfg,
- });
- break;
- }
- default: {
- const cfg = preset.shift();
- if (!cfg) break;
- const data = getData(refData, cfg.readFrom, cfg.parser);
- arr.push({
- ...item,
- data,
- config: cfg,
- });
- break;
- }
- }
- // console.log(arr,'arr---')
- return arr;
- }, []);
- });
- </script>
- <style lang="less" scoped>
- @import '@/design/theme.less';
- .content {
- height: calc(100% - 30px);
- position: relative;
- // z-index: -2;
- display: flex;
- flex-direction: column;
- overflow-y: auto; // 这里会导致样式无故添加滚动条
- overflow-x: hidden;
- }
- .content__background {
- width: 100%;
- // height: 100%;
- height: calc(100% - 65px);
- position: absolute;
- top: 65px;
- left: 0;
- z-index: 0;
- object-fit: fill;
- padding: 5px;
- box-sizing: border-box;
- }
- .content__background_1 {
- width: 100%;
- height: 100%;
- position: absolute;
- top: 0px;
- left: 0;
- z-index: 0;
- object-fit: fill;
- }
- .image__background {
- width: 35%;
- height: 61%;
- left: 30%;
- }
- .content__module {
- // margin-top: 5px;
- // margin-bottom: 5px;
- width: 100%;
- height: 100%;
- }
- .content__module1 {
- background: url('@/assets/images/vent/homeNew/databg/4.png');
- background-repeat: no-repeat;
- background-size: 100% 100%;
- height: 129px;
- margin-top: 20%;
- }
- .content__moduleFire {
- width: 100%;
- height: 100%;
- margin-left: -24% !important;
- }
- .content__module_dust {
- background: url('@/assets/images/vent/homeNew/bottomBg.png');
- background-repeat: no-repeat;
- background-size: 100% 100%;
- width: 100%;
- height: 100%;
- }
- // .content__module:first-of-type {
- // margin-top: 0;
- // }
- // .content__module:last-of-type {
- // margin-bottom: 0;
- // }
- ::-webkit-scrollbar {
- width: 5px !important;
- }
- ::-webkit-scrollbar-thumb {
- width: 5px !important;
- }
- :deep(.zxm-select:not(.zxm-select-customize-input) .zxm-select-selector) {
- /* background-color: transparent; */
- color: #fff;
- }
- :deep(.zxm-select-arrow) {
- color: #fff;
- }
- :deep(.zxm-select-selection-item) {
- color: #fff !important;
- }
- :deep(.zxm-select-selection-placeholder) {
- color: #fff !important;
- }
- :deep(.dialog-overlay) {
- width: 100%;
- height: 100%;
- position: unset;
- box-shadow: unset;
- }
- ::-webkit-scrollbar {
- width: 5px !important;
- }
- ::-webkit-scrollbar-thumb {
- width: 5px !important;
- }
- </style>
|