content-FireNew.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465
  1. <!-- eslint-disable vue/multi-word-component-names -->
  2. <template>
  3. <!-- 主体内容部分 -->
  4. <div class="content">
  5. <!-- 背景 -->
  6. <img v-if="background.show && background.type === 'image'" class="content__background image__background" :src="background.link" />
  7. <video
  8. v-if="background.show && background.type === 'video'"
  9. class="content__background content__background_video"
  10. width="100%"
  11. autoplay
  12. loop
  13. muted
  14. disablepictureinpicture
  15. playsinline
  16. >
  17. <source :src="background.link" />
  18. Not Supportted Link Or Browser
  19. </video>
  20. <div class="flex w-full h-full" :style="{ flexDirection: layout.direction }">
  21. <div v-for="config in layoutConfig" :key="config.name" :style="{ flexBasis: config.basis, overflow: config.overflow ? 'auto' : 'none' }">
  22. <!-- 告示板部分 -->
  23. <template v-if="config.name === 'board'">
  24. <div class="content__module flex flex-justify-around flex-items-center flex-wrap">
  25. <MiniBoard
  26. v-for="item in config.items"
  27. :key="item.prop"
  28. :label="item.label"
  29. :value="item.value"
  30. :type="config.type"
  31. :layout="config.layout"
  32. />
  33. </div>
  34. </template>
  35. <!-- 图表部分,这部分通常需要填充,有告示板、Header等内容需要填充父级 -->
  36. <template v-if="config.name === 'chart'">
  37. <CustomChart v-if="config.pageType == 'New_dust'" class="content__module_dust" :chart-config="config.config" :chart-data="config.data" />
  38. <CustomChart v-else class="content__module" :chart-config="config.config" :chart-data="config.data" />
  39. </template>
  40. <!-- 通常列表部分 -->
  41. <template v-if="config.name === 'list'">
  42. <template v-if="config.type === 'timeline'">
  43. <TimelineList class="content__module" :list-config="config.items" />
  44. </template>
  45. <template v-else-if="config.type === 'timelineNew'">
  46. <TimelineListNew class="content__module" :list-config="config.items" />
  47. </template>
  48. <template v-else>
  49. <CustomList class="content__module" :type="config.type" :list-config="config.items" />
  50. </template>
  51. </template>
  52. <template v-if="config.name === 'fireList'">
  53. <CustomList class="content__module" :type="config.type" :list-config="config.items" />
  54. </template>
  55. <!-- 画廊部分 -->
  56. <template v-if="config.name === 'gallery'">
  57. <CustomGallery class="content__module" :type="config.type" :gallery-config="config.items" />
  58. </template>
  59. <!-- 复杂列表部分 -->
  60. <template v-if="config.name === 'gallery_list'">
  61. <GalleryList class="content__module" :type="config.type" :list-config="config.items" :gallery-config="config.galleryItems" />
  62. </template>
  63. <!-- 复杂列表部分 -->
  64. <template v-if="config.name === 'complex_list'">
  65. <ComplexList class="content__module" :type="config.type" :list-config="config.items" />
  66. </template>
  67. <!-- 表格部分,这部分通常是占一整个模块的 -->
  68. <template v-if="config.name === 'table'">
  69. <CustomTable class="content__module text-center overflow-auto" :type="config.type" :columns="config.columns" :data="config.data" />
  70. </template>
  71. <template v-if="config.name === 'tabs'">
  72. <CustomTabs class="content__module" :type="config.type" :tab-config="config.items" :overflow="config.overflow" />
  73. </template>
  74. <template v-if="config.name === 'blast_delta'">
  75. <BlastDelta
  76. v-if="config.pageType === 'New_fire'"
  77. class="content__moduleFire"
  78. :pos-monitor="config.data"
  79. :canvasSize="{ width: 250, height: 200 }"
  80. />
  81. <BlastDelta v-else class="content__module" :pos-monitor="config.data" :canvasSize="{ width: 250, height: 200 }" />
  82. </template>
  83. <template v-if="config.name === 'qh_curve'">
  84. <QHCurve class="content__module" :mainfan="config.data" :fan1-prop="config.config.fan1Prop" :fan2-prop="config.config.fan2Prop" />
  85. </template>
  86. <template v-if="config.name === 'ai_chat'">
  87. <AIChat class="content__module" />
  88. </template>
  89. <template v-if="config.name === 'device_alarm'">
  90. <DeviceAlarm class="content__module" :devicedata="config.data" />
  91. </template>
  92. <template v-if="config.name === 'measure_detail'">
  93. <MeasureDetail
  94. class="content__module"
  95. :show-title="false"
  96. :composite-data="config.data"
  97. :topconfig="config.config.topconfig"
  98. :btnconfig="config.config.btnconfig"
  99. />
  100. </template>
  101. <!-- <template v-if="config.key === 'fire_control'">
  102. <FIreControl class="content__module" />
  103. </template>
  104. <template v-if="config.key === 'fire_warn'">
  105. <FIreWarn class="content__module" />
  106. </template> -->
  107. </div>
  108. </div>
  109. </div>
  110. </template>
  111. <script lang="ts" setup>
  112. import { computed } from 'vue';
  113. import {
  114. CommonItem,
  115. Config,
  116. // ModuleDataBoard,
  117. // ModuleDataChart,
  118. // ModuleDataList,
  119. // ModuleDataPreset,
  120. // ModuleDataTable,
  121. } from '../../../deviceManager/configurationTable/types';
  122. import MiniBoard from './detail/MiniBoard-FireNew.vue';
  123. import TimelineList from './detail/TimelineList.vue';
  124. import TimelineListNew from './detail/TimelineListNew.vue';
  125. import CustomList from './detail/CustomList-fire.vue';
  126. import ModuleTopFire from './originalNew/moduleTopFire.vue';
  127. import CustomGallery from './detail/CustomGallery.vue';
  128. import ComplexList from './detail/ComplexList-FireNew.vue';
  129. import GalleryList from './detail/GalleryList.vue';
  130. import CustomTable from './detail/CustomTable-fire.vue';
  131. import CustomChart from './detail/CustomChart.vue';
  132. import { clone } from 'lodash-es';
  133. import { getData, getFormattedText } from '../hooks/helper';
  134. import BlastDelta from '../../../monitorManager/deviceMonitor/components/device/modal/blastDelta.vue';
  135. import QHCurve from './preset/QHCurve.vue';
  136. import MeasureDetail from './preset/MeasureDetail.vue';
  137. import CustomTabs from './preset/CustomTabs.vue';
  138. import AIChat from '/@/components/AIChat/MiniChat.vue';
  139. import DeviceAlarm from './preset/DeviceAlarm.vue';
  140. import MiniBoardNew from './detail/MiniBoard-New.vue';
  141. // import FIreWarn from './preset/FIreWarn.vue';
  142. // import FIreControl from './preset/FIreControl.vue';
  143. const props = defineProps<{
  144. data: any;
  145. moduleData: Config['moduleData'];
  146. }>();
  147. const { background, layout } = props.moduleData;
  148. // 获取当原始配置带 items 项时的最终 items 配置
  149. function getItems(raw, items: CommonItem[]) {
  150. return items.map((i) => {
  151. return {
  152. ...i,
  153. label: getFormattedText(raw, i.label, i.trans),
  154. value: getFormattedText(raw, i.value, i.trans),
  155. };
  156. });
  157. }
  158. // 获取当 List 组件配置带 items 项时的最终 items 配置
  159. function getListItems(raw: any, items: CommonItem[], mapFromData?: boolean) {
  160. if (mapFromData && Array.isArray(raw)) {
  161. return raw.map((data) => {
  162. const item = items[0];
  163. return {
  164. ...item,
  165. label: getFormattedText(data, item.label, item.trans),
  166. value: getFormattedText(data, item.value, item.trans),
  167. };
  168. });
  169. }
  170. return getItems(raw, items);
  171. }
  172. /** 根据配置里的layout将配置格式化为带 key 的具体配置,例如:[{ key: 'list', value: any, ...ModuleDataList }] */
  173. const layoutConfig = computed(() => {
  174. const refData = props.data;
  175. const board = clone(props.moduleData.board) || [];
  176. const list = clone(props.moduleData.list) || [];
  177. const gallery = clone(props.moduleData.gallery) || [];
  178. const complex_list = clone(props.moduleData.complex_list) || [];
  179. const gallery_list = clone(props.moduleData.gallery_list) || [];
  180. const tabs = clone(props.moduleData.tabs) || [];
  181. const chart = clone(props.moduleData.chart) || [];
  182. const table = clone(props.moduleData.table) || [];
  183. const preset = clone(props.moduleData.preset) || [];
  184. return layout.items.reduce((arr: any[], item) => {
  185. switch (item.name) {
  186. case 'board': {
  187. const cfg = board.shift();
  188. if (!cfg) break;
  189. const data = getData(refData, cfg.readFrom, cfg.parser);
  190. arr.push({
  191. overflow: true,
  192. ...item,
  193. ...cfg,
  194. items: getItems(data, cfg.items),
  195. });
  196. break;
  197. }
  198. case 'list': {
  199. const cfg = list.shift();
  200. if (!cfg) break;
  201. const data = getData(refData, cfg.readFrom, cfg.parser);
  202. arr.push({
  203. overflow: true,
  204. ...item,
  205. ...cfg,
  206. items: getListItems(data, cfg.items, cfg.mapFromData),
  207. });
  208. break;
  209. }
  210. case 'gallery': {
  211. const cfg = gallery.shift();
  212. if (!cfg) break;
  213. const data = getData(refData, cfg.readFrom, cfg.parser);
  214. arr.push({
  215. overflow: true,
  216. ...item,
  217. ...cfg,
  218. items: getItems(data, cfg.items),
  219. });
  220. break;
  221. }
  222. case 'complex_list': {
  223. const cfg = complex_list.shift();
  224. if (!cfg) break;
  225. const data = getData(refData, cfg.readFrom, cfg.parser);
  226. if (cfg.mapFromData) {
  227. const firstListItem = cfg.items[0];
  228. arr.push({
  229. overflow: true,
  230. ...item,
  231. ...cfg,
  232. items: (data || []).map((d) => {
  233. return {
  234. title: getFormattedText(d, firstListItem.title, firstListItem.trans),
  235. contents: firstListItem.contents.map((e) => {
  236. return {
  237. ...e,
  238. label: getFormattedText(d, e.label, e.trans),
  239. value: getFormattedText(d, e.value, e.trans),
  240. };
  241. }),
  242. };
  243. }),
  244. });
  245. } else {
  246. arr.push({
  247. overflow: true,
  248. ...item,
  249. ...cfg,
  250. items: cfg.items.map((i) => {
  251. return {
  252. title: getFormattedText(data, i.title, i.trans),
  253. contents: i.contents.map((e) => {
  254. return {
  255. ...e,
  256. label: getFormattedText(data, e.label, e.trans),
  257. value: getFormattedText(data, e.value, e.trans),
  258. };
  259. }),
  260. };
  261. }),
  262. });
  263. }
  264. break;
  265. }
  266. case 'gallery_list': {
  267. const cfg = gallery_list.shift();
  268. if (!cfg) break;
  269. const data = getData(refData, cfg.readFrom, cfg.parser);
  270. arr.push({
  271. overflow: true,
  272. ...item,
  273. ...cfg,
  274. items: getItems(data, cfg.items),
  275. galleryItems: getItems(data, cfg.galleryItems),
  276. });
  277. break;
  278. }
  279. case 'tabs': {
  280. const cfg = tabs.shift();
  281. if (!cfg) break;
  282. const data = getData(refData, cfg.readFrom, cfg.parser);
  283. if (cfg.mapFromData) {
  284. const firstListItem = cfg.items[0];
  285. arr.push({
  286. overflow: true,
  287. ...item,
  288. ...cfg,
  289. items: (data || []).map((d) => {
  290. return {
  291. title: getFormattedText(d, firstListItem.title, firstListItem.trans),
  292. contents: firstListItem.contents.map((e) => {
  293. return {
  294. ...e,
  295. label: getFormattedText(d, e.label, e.trans),
  296. value: getFormattedText(d, e.value, e.trans),
  297. };
  298. }),
  299. };
  300. }),
  301. });
  302. } else {
  303. arr.push({
  304. overflow: true,
  305. ...item,
  306. ...cfg,
  307. items: cfg.items.map((i) => {
  308. return {
  309. title: getFormattedText(data, i.title, i.trans),
  310. contents: i.contents.map((e) => {
  311. return {
  312. ...e,
  313. label: getFormattedText(data, e.label, e.trans),
  314. value: getFormattedText(data, e.value, e.trans),
  315. };
  316. }),
  317. };
  318. }),
  319. });
  320. }
  321. break;
  322. }
  323. case 'chart': {
  324. const cfg = chart.shift();
  325. if (!cfg) break;
  326. const data = getData(refData, cfg.readFrom, cfg.parser);
  327. arr.push({
  328. ...item,
  329. config: cfg,
  330. data,
  331. });
  332. break;
  333. }
  334. case 'table': {
  335. const cfg = table.shift();
  336. if (!cfg) break;
  337. const data = getData(refData, cfg.readFrom, cfg.parser);
  338. arr.push({
  339. ...cfg,
  340. ...item,
  341. columns: cfg.columns,
  342. data,
  343. });
  344. break;
  345. }
  346. default: {
  347. const cfg = preset.shift();
  348. if (!cfg) break;
  349. const data = getData(refData, cfg.readFrom, cfg.parser);
  350. arr.push({
  351. ...item,
  352. data,
  353. config: cfg,
  354. });
  355. break;
  356. }
  357. }
  358. return arr;
  359. }, []);
  360. });
  361. </script>
  362. <style lang="less" scoped>
  363. @import '@/design/theme.less';
  364. .content {
  365. height: calc(100% - 30px);
  366. position: relative;
  367. // z-index: -2;
  368. display: flex;
  369. flex-direction: column;
  370. }
  371. .content__background {
  372. width: 100%;
  373. height: 100%;
  374. position: absolute;
  375. top: 0;
  376. left: 0;
  377. z-index: 0;
  378. object-fit: fill;
  379. }
  380. .image__background {
  381. width: 35%;
  382. height: 61%;
  383. left: 30%;
  384. }
  385. .content__module {
  386. // margin-top: 5px;
  387. // margin-bottom: 5px;
  388. width: 100%;
  389. height: 100%;
  390. }
  391. .content__module1 {
  392. background: url('@/assets/images/vent/homeNew/databg/4.png');
  393. background-repeat: no-repeat;
  394. background-size: 100% 100%;
  395. height: 129px;
  396. margin-top: 20%;
  397. }
  398. .content__moduleFire {
  399. width: 100%;
  400. height: 100%;
  401. margin-left: -24% !important;
  402. }
  403. .content__module_dust {
  404. background: url('@/assets/images/vent/homeNew/bottomBg.png');
  405. background-repeat: no-repeat;
  406. background-size: 100% 100%;
  407. width: 100%;
  408. height: 100%;
  409. }
  410. // .content__module:first-of-type {
  411. // margin-top: 0;
  412. // }
  413. // .content__module:last-of-type {
  414. // margin-bottom: 0;
  415. // }
  416. ::-webkit-scrollbar {
  417. width: 5px !important;
  418. }
  419. ::-webkit-scrollbar-thumb {
  420. width: 5px !important;
  421. }
  422. :deep(.zxm-select:not(.zxm-select-customize-input) .zxm-select-selector) {
  423. /* background-color: transparent; */
  424. color: #fff;
  425. }
  426. :deep(.zxm-select-arrow) {
  427. color: #fff;
  428. }
  429. :deep(.zxm-select-selection-item) {
  430. color: #fff !important;
  431. }
  432. :deep(.zxm-select-selection-placeholder) {
  433. color: #fff !important;
  434. }
  435. :deep(.dialog-overlay) {
  436. width: 100%;
  437. height: 100%;
  438. position: unset;
  439. box-shadow: unset;
  440. }
  441. ::-webkit-scrollbar {
  442. width: 5px !important;
  443. }
  444. ::-webkit-scrollbar-thumb {
  445. width: 5px !important;
  446. }
  447. </style>