Browse Source

1. 解决冲突

hongrunxia 5 months ago
parent
commit
d182505c3d

+ 2 - 0
src/views/vent/deviceManager/configurationTable/types.ts

@@ -219,6 +219,8 @@ export interface ModuleDataComplexList {
   type: 'A' | 'B';
   /** 读取数据时的基础路径,如果配置了 header,应接着 Config.deviceType 配取值路径,反之应配置详尽路径 */
   readFrom: string;
+  /** 是否需要根据数据来决定所展示的项目数量,需要确保 items 至少有一项,且 readFrom 指向数组 */
+  mapFromData: boolean;
   /** 核心配置,每个列表项对应一项 */
   items: {
     /** 列表项标题,formatter 格式 */

+ 42 - 0
src/views/vent/gas/gasReport/gas-report.data.ts

@@ -38,6 +38,13 @@ export const columns: BasicColumn[] = [
                                 align: 'center'
                             },
                             {
+                                title: '温度',
+                                dataIndex: 'tEarly1',
+                                key: 'tEarly1',
+                                width: 100,
+                                align: 'center'
+                            },
+                            {
                                 title: '便携仪',
                                 dataIndex: 'bxySdzEarly1',
                                 key: 'bxySdzEarly1',
@@ -100,6 +107,13 @@ export const columns: BasicColumn[] = [
                                 align: 'center'
                             },
                             {
+                                title: '温度',
+                                dataIndex: 'tEarly2',
+                                key: 'tEarly2',
+                                width: 100,
+                                align: 'center'
+                            },
+                            {
                                 title: '便携仪',
                                 dataIndex: 'bxySdzEarly2',
                                 key: 'bxySdzEarly2',
@@ -189,6 +203,13 @@ export const columns: BasicColumn[] = [
                                 align: 'center'
                             },
                             {
+                                title: '温度',
+                                dataIndex: 'tNoon1',
+                                key: 'tNoon1',
+                                width: 100,
+                                align: 'center'
+                            },
+                            {
                                 title: '便携仪',
                                 dataIndex: 'bxySdzNoon1',
                                 key: 'bxySdzNoon1',
@@ -251,6 +272,13 @@ export const columns: BasicColumn[] = [
                                 align: 'center'
                             },
                             {
+                                title: '温度',
+                                dataIndex: 'tNoon2',
+                                key: 'tNoon2',
+                                width: 100,
+                                align: 'center'
+                            },
+                            {
                                 title: '便携仪',
                                 dataIndex: 'bxySdzNoon2',
                                 key: 'bxySdzNoon2',
@@ -340,6 +368,13 @@ export const columns: BasicColumn[] = [
                                 align: 'center'
                             },
                             {
+                                title: '温度',
+                                dataIndex: 'tNight1',
+                                key: 'tNight1',
+                                width: 100,
+                                align: 'center'
+                            },
+                            {
                                 title: '便携仪',
                                 dataIndex: 'bxySdzNight1',
                                 key: 'bxySdzNight1',
@@ -402,6 +437,13 @@ export const columns: BasicColumn[] = [
                                 align: 'center'
                             },
                             {
+                                title: '温度',
+                                dataIndex: 'tNight2',
+                                key: 'tNight2',
+                                width: 100,
+                                align: 'center'
+                            },
+                            {
                                 title: '便携仪',
                                 dataIndex: 'bxySdzNight2',
                                 key: 'bxySdzNight2',

+ 37 - 17
src/views/vent/home/configurable/components/content.vue

@@ -16,7 +16,7 @@
       Not Supportted Link Or Browser
     </video>
     <div class="flex w-full h-full" :style="{ flexDirection: slice.direction }">
-      <div v-for="(config, i) in layoutConfig" :key="config.key" :style="{ flexBasis: slice.basis[i] }">
+      <div v-for="(config, i) in layoutConfig" :key="config.key" :style="{ flexBasis: slice.basis[i], overflow: 'auto' }">
         <!-- 告示板部分 -->
         <template v-if="config.key === 'board'">
           <div class="content__module flex flex-justify-around pt-10px pb-10px">
@@ -185,22 +185,42 @@
           if (!cfg) break;
           const data = getData(refData, cfg.readFrom);
 
-          arr.push({
-            ...cfg,
-            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),
-                  };
-                }),
-              };
-            }),
-          });
+          if (cfg.mapFromData) {
+            const item = cfg.items[0];
+            arr.push({
+              ...cfg,
+              key,
+              items: (data || []).map((d) => {
+                return {
+                  title: getFormattedText(d, item.title),
+                  contents: item.contents.map((e) => {
+                    return {
+                      ...e,
+                      label: getFormattedText(d, e.label),
+                      value: getFormattedText(d, e.value),
+                    };
+                  }),
+                };
+              }),
+            });
+          } else {
+            arr.push({
+              ...cfg,
+              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': {

+ 1 - 1
src/views/vent/home/configurable/components/detail/ComplexList.vue

@@ -5,7 +5,7 @@
     <!-- 部分类型的列表需要加一张图片 -->
     <div :class="`list__image_${type}`"></div>
     <!-- 剩下的部分填充剩余宽度 -->
-    <div class="flex-grow" :class="`list__wrapper_${type}`">
+    <div class="flex-grow h-full" :class="`list__wrapper_${type}`">
       <div v-for="(item, i) in listConfig" :key="`vvhccdcl${i}`" :class="`list-item_${type}`">
         <!-- 列表项前面的图标 -->
         <div :class="`list-item__title_${type}`">{{ item.title }}</div>

+ 41 - 45
src/views/vent/home/configurable/components/detail/CustomGallery.vue

@@ -35,8 +35,6 @@
 </script>
 <style lang="less" scoped>
   @import '@/design/vent/color.less';
-  /* Timeline 相关的样式 */
-
   .gallery {
     position: relative;
     width: 100%;
@@ -152,7 +150,6 @@
     display: flex;
     align-items: center;
     justify-content: center;
-    height: 100px;
   }
   .gallery-item_center_D {
     background: url(/@/assets/images/home-container/configurable/firehome/img-2.png) no-repeat;
@@ -184,7 +181,7 @@
     width: 200px;
     height: 200px;
     left: calc(50% - 100px);
-    top: calc(50% - 110px);
+    top: calc(50% - 100px);
     position: absolute;
     background-size: 100% auto;
   }
@@ -206,29 +203,31 @@
     }
   }
   .gallery > .gallery-item_E:nth-child(2) {
-    top: 20px;
-    left: 80px;
+    top: calc(50% - 100px);
+    // top: 20px;
+    left: calc(50% - 150px);
+    // left: 80px;
     .gallery-item__label {
       background-image: url(/@/assets/images/home-container/configurable/dusthome/sbzs.png);
     }
   }
   .gallery > .gallery-item_E:nth-child(3) {
-    top: 20px;
-    right: 80px;
+    top: calc(50% - 100px);
+    right: calc(50% - 150px);
     .gallery-item__label {
       background-image: url(/@/assets/images/home-container/configurable/dusthome/pwkqs.png);
     }
   }
   .gallery > .gallery-item_E:nth-child(4) {
-    bottom: 20px;
-    left: 80px;
+    bottom: calc(50% - 100px);
+    left: calc(50% - 150px);
     .gallery-item__label {
       background-image: url(/@/assets/images/home-container/configurable/dusthome/lwsl.png);
     }
   }
   .gallery > .gallery-item_E:nth-child(5) {
-    bottom: 20px;
-    right: 80px;
+    bottom: calc(50% - 100px);
+    right: calc(50% - 150px);
     .gallery-item__label {
       background-image: url(/@/assets/images/home-container/configurable/dusthome/dwsl.png);
     }
@@ -242,6 +241,7 @@
     position: absolute;
     text-align: center;
     padding-left: 20px;
+    padding-top: 5px;
     background-size: 100% 100%;
     background-repeat: no-repeat;
     background-position: center;
@@ -252,11 +252,11 @@
     }
   }
   .gallery > .gallery-item_F:nth-child(2) {
-    top: 10px;
-    left: 30px;
-    width: 130px;
-    height: 130px;
-    line-height: 130px;
+    top: calc(50% - 60px);
+    left: calc(50% - 180px);
+    width: 120px;
+    height: 120px;
+    line-height: 120px;
     padding: 0;
     background-image: url(/@/assets/images/home-container/configurable/dusthome/img-7.png);
 
@@ -265,24 +265,20 @@
     }
   }
   .gallery > .gallery-item_F:nth-child(3) {
-    top: 15px;
-    left: 160px;
-    padding-top: 5px;
+    top: calc(50% - 62px);
+    left: calc(50% - 60px);
   }
   .gallery > .gallery-item_F:nth-child(4) {
-    top: 15px;
-    left: 280px;
-    padding-top: 5px;
+    top: calc(50% - 62px);
+    left: calc(50% + 60px);
   }
   .gallery > .gallery-item_F:nth-child(5) {
-    top: 80px;
-    left: 160px;
-    padding-top: 5px;
+    bottom: calc(50% - 62px);
+    left: calc(50% - 60px);
   }
   .gallery > .gallery-item_F:nth-child(6) {
-    top: 80px;
-    left: 280px;
-    padding-top: 5px;
+    bottom: calc(50% - 62px);
+    left: calc(50% + 60px);
   }
 
   .gallery > .gallery-item_G {
@@ -306,33 +302,33 @@
   }
   .gallery > .gallery-item_G:nth-child(3) {
     top: calc(50% - 60px);
-    left: 60px;
-    transform: scale(0.7);
+    left: calc(50% - 160px);
+    transform: scale(0.8);
   }
   .gallery > .gallery-item_G:nth-child(4) {
     top: calc(50% - 60px);
-    right: 60px;
-    transform: scale(0.7);
+    right: calc(50% - 160px);
+    transform: scale(0.8);
   }
   .gallery > .gallery-item_G:nth-child(5) {
-    top: 10px;
-    left: 0px;
-    transform: scale(0.5);
+    top: calc(50% - 110px);
+    left: calc(50% - 230px);
+    transform: scale(0.7);
   }
   .gallery > .gallery-item_G:nth-child(6) {
-    bottom: 10px;
-    left: 0px;
-    transform: scale(0.5);
+    bottom: calc(50% - 110px);
+    left: calc(50% - 230px);
+    transform: scale(0.7);
   }
   .gallery > .gallery-item_G:nth-child(7) {
-    top: 10px;
-    right: 0px;
-    transform: scale(0.5);
+    top: calc(50% - 110px);
+    right: calc(50% - 230px);
+    transform: scale(0.7);
   }
   .gallery > .gallery-item_G:nth-child(8) {
-    bottom: 10px;
-    right: 0px;
-    transform: scale(0.5);
+    bottom: calc(50% - 110px);
+    right: calc(50% - 230px);
+    transform: scale(0.7);
   }
 
   .gallery-item__value_red {

+ 3 - 3
src/views/vent/home/configurable/components/detail/CustomTable.vue

@@ -31,7 +31,7 @@
       type: 'B',
       columns: () => [],
       data: () => [],
-      defaultValue: '/',
+      defaultValue: '-',
     }
   );
 
@@ -40,8 +40,8 @@
   });
 
   function get(o, p) {
-    const d = _.get(o, p, props.defaultValue);
-    return d === null ? props.defaultValue : d;
+    const d = _.get(o, p);
+    return _.isNil(d) ? props.defaultValue : d === '' ? props.defaultValue : d;
   }
 </script>
 <style lang="less" scoped>

+ 55 - 109
src/views/vent/home/configurable/configurable.data.ts

@@ -1361,13 +1361,28 @@ const BDdustMock = {
       {
         sysNamme: '工作面名称1', //工作面名称
         warnLevel: '低风险', //预警级别
-        maxVal: '1.88', //最高粉尘浓度
+        maxVal: 0.1, //最高粉尘浓度
       },
       {
         sysNamme: '工作面名称2', //工作面名称
         warnLevel: '低风险', //预警级别
         maxVal: '1.88', //最高粉尘浓度
       },
+      {
+        sysNamme: '工作面名称3', //工作面名称
+        warnLevel: '低风险', //预警级别
+        maxVal: 0, //最高粉尘浓度
+      },
+      {
+        sysNamme: '工作面名称4', //工作面名称
+        warnLevel: '低风险', //预警级别
+        maxVal: '1.88', //最高粉尘浓度
+      },
+      {
+        sysNamme: '工作面名称5', //工作面名称
+        warnLevel: '低风险', //预警级别
+        maxVal: '1.88', //最高粉尘浓度
+      },
     ],
   },
   dustDustGraph: [
@@ -1409,60 +1424,40 @@ const BDdustMock = {
     atomOpenNum: '1', //喷雾设备开启数
   },
   dustRelArray: [
-    //粉尘关联指标
-    {
-      strinstallpos: '81202工作面', //安装位置
-      temp: '23.3', //温度
-      windSpeed: '10.5', //风速
-      atomState: '打开', //喷雾状态
-    },
-    {
-      strinstallpos: '81202工作面', //安装位置
-      temp: '23.3', //温度
-      windSpeed: '10.5', //风速
-      atomState: '打开', //喷雾状态
-    },
-    {
-      strinstallpos: '81202工作面', //安装位置
-      temp: '23.3', //温度
-      windSpeed: '10.5', //风速
-      atomState: '打开', //喷雾状态
-    },
-    {
-      strinstallpos: '81202工作面', //安装位置
-      temp: '23.3', //温度
-      windSpeed: '10.5', //风速
-      atomState: '打开', //喷雾状态
-    },
     {
-      strinstallpos: '81202工作面', //安装位置
-      temp: '23.3', //温度
-      windSpeed: '10.5', //风速
-      atomState: '打开', //喷雾状态
+      temp: '15.80',
+      atomState: '',
+      strinstallpos: '81205胶运掘进面粉尘',
+      id: 1834606303323583700,
+      windSpeed: '0.09',
     },
     {
-      strinstallpos: '81202工作面', //安装位置
-      temp: '23.3', //温度
-      windSpeed: '10.5', //风速
-      atomState: '打开', //喷雾状态
+      temp: '18.60',
+      atomState: '',
+      strinstallpos: '81203采面粉尘',
+      id: 1834606303324389400,
+      windSpeed: '2.13',
     },
     {
-      strinstallpos: '81202工作面', //安装位置
-      temp: '23.3', //温度
-      windSpeed: '10.5', //风速
-      atomState: '打开', //喷雾状态
+      temp: '15.20',
+      atomState: '',
+      strinstallpos: '81206胶运掘进面粉尘',
+      id: 1834606303328583700,
+      windSpeed: '',
     },
     {
-      strinstallpos: '81202工作面', //安装位置
-      temp: '23.3', //温度
-      windSpeed: '10.5', //风速
-      atomState: '打开', //喷雾状态
+      temp: '19.60',
+      atomState: '',
+      strinstallpos: '81207辅运掘进面粉尘',
+      id: 1834606303328583700,
+      windSpeed: '',
     },
     {
-      strinstallpos: '81202工作面', //安装位置
-      temp: '23.3', //温度
-      windSpeed: '10.5', //风速
-      atomState: '打开', //喷雾状态
+      temp: '13.90',
+      atomState: '',
+      strinstallpos: '81206辅运掘进面粉尘',
+      id: 1834606303328583700,
+      windSpeed: '3.53',
     },
   ],
 };
@@ -1535,58 +1530,25 @@ export const testConfigBDDust: Config[] = [
         {
           type: 'A',
           readFrom: 'dustManageInfo.sysList',
+          mapFromData: true,
           items: [
             {
-              title: '${[0].sysNamme}',
-              contents: [
-                {
-                  label: '风险监测',
-                  value: '${[0].warnLevel}',
-                  color: 'blue',
-                  info: '',
-                },
-                {
-                  label: '最高粉尘浓度',
-                  value: '${[0].maxVal}',
-                  color: 'blue',
-                  info: '',
-                },
-              ],
-            },
-            {
-              title: '${[1].sysNamme}',
+              title: '${sysNamme}',
               contents: [
                 {
                   label: '风险监测',
-                  value: '${[1].warnLevel}',
+                  value: '${warnLevel}',
                   color: 'blue',
                   info: '',
                 },
                 {
                   label: '最高粉尘浓度',
-                  value: '${[1].maxVal}',
+                  value: '${maxVal}',
                   color: 'blue',
                   info: '',
                 },
               ],
             },
-            // {
-            //   title: '${[2].sysNamme}',
-            //   contents: [
-            //     {
-            //       label: '风险监测',
-            //       value: '${[2].warnLevel}',
-            //       color: 'blue',
-            //       info: '',
-            //     },
-            //     {
-            //       label: '最高粉尘浓度',
-            //       value: '${[2].maxVal}',
-            //       color: 'blue',
-            //       info: '',
-            //     },
-            //   ],
-            // },
           ],
         },
       ],
@@ -1655,7 +1617,6 @@ export const testConfigBDDust: Config[] = [
       list: [],
       complex_list: [],
       preset: [],
-      mock: BDdustMock,
     },
     showStyle: {
       size: 'width:1000px;height:280px;',
@@ -2032,8 +1993,8 @@ export const testConfigBDFire: Config[] = [
         link: '',
       },
       slice: {
-        direction: 'row',
-        basis: ['100%', '100%'],
+        direction: 'column',
+        basis: ['30%', '70%'],
       },
       layout: ['gallery', 'complex_list'],
       board: [],
@@ -2058,36 +2019,20 @@ export const testConfigBDFire: Config[] = [
         {
           type: 'A',
           readFrom: 'fireManageInfo.sysList',
+          mapFromData: true,
           items: [
             {
-              title: '${[0].sysNamme}',
-              contents: [
-                {
-                  label: '风险监测',
-                  value: '${[0].warnLevel}',
-                  color: 'blue',
-                  info: '',
-                },
-                {
-                  label: '最高温度',
-                  value: '${[0].maxVal}',
-                  color: 'blue',
-                  info: '',
-                },
-              ],
-            },
-            {
-              title: '${[1].sysNamme}',
+              title: '${sysNamme}',
               contents: [
                 {
                   label: '风险监测',
-                  value: '${[1].warnLevel}',
+                  value: '${warnLevel}',
                   color: 'blue',
                   info: '',
                 },
                 {
                   label: '最高温度',
-                  value: '${[1].maxVal}',
+                  value: '${maxVal}',
                   color: 'blue',
                   info: '',
                 },
@@ -2225,6 +2170,7 @@ export const testConfigBDFire: Config[] = [
         {
           type: 'B',
           readFrom: 'btArray',
+          mapFromData: false,
           items: [
             {
               title: 'CO',
@@ -2700,7 +2646,7 @@ export const testConfigBDNew: Config[] = [
           readFrom: '',
         },
       ],
-      mock: BDfireMock,
+      // mock: BDfireMock,
     },
     // showStyle: {
     //   size: 'width:450px;height:760px;',
@@ -2806,7 +2752,7 @@ export const testConfigBDNew: Config[] = [
           readFrom: '',
         },
       ],
-      mock: BDfireMock,
+      // mock: BDfireMock,
     },
     showStyle: {
       size: 'width:450px;height:760px;',
@@ -2911,7 +2857,7 @@ export const testConfigBDNew: Config[] = [
       ],
       complex_list: [],
       preset: [],
-      mock: BDfireMock,
+      // mock: BDfireMock,
     },
     // showStyle: {
     //   size: 'width:450px;height:760px;',