Browse Source

Merge branch 'master' of http://182.92.126.35:3000/hrx/mky-vent-base

lxh 7 months ago
parent
commit
dcba5861dd

BIN
src/assets/images/home-container/configurable/list_bg_c.png


+ 3 - 1
src/views/vent/deviceManager/configurationTable/types.ts

@@ -22,13 +22,15 @@ export interface ModuleDataBoard {
 }
 export interface ModuleDataList {
   /** 列表项预设的背景类型 */
-  type: 'timeline' | 'A' | 'B';
+  type: 'timeline' | 'A' | 'B' | 'C';
   items: {
     /** 列表项说明内容 */
     label: string;
     formatter?: string;
     prop: string;
     color: string;
+    /** 针对列表项说明的额外信息 */
+    info: string;
   }[];
 }
 export interface ModuleDataChart {

+ 46 - 22
src/views/vent/home/configurable/components/CustomList.vue

@@ -1,16 +1,19 @@
 <!-- eslint-disable vue/multi-word-component-names -->
 <template>
-  <div class="list flex items-center" :class="`list__${type}`">
+  <!-- 基准的列表模块,通过不同的 type 展示不同的样式 -->
+  <div class="list flex items-center" :class="`list_${type}`">
     <!-- 部分类型的列表需要加一张图片 -->
-    <div :class="`list-item__image__${type}`"></div>
+    <div :class="`list-item__image_${type}`"></div>
+    <!-- 剩下的部分填充剩余宽度 -->
     <div class="flex-grow">
       <div v-for="item in listConfig" :key="item.prop" class="flex items-center list-item">
-        <div :class="`list-item__icon__${type}`"></div>
-        <div class="flex-grow" :class="`list-item__content__${type}`">
+        <!-- 列表项前面的图标 -->
+        <div :class="`list-item__icon_${type}`"></div>
+        <!-- 列表项的具体内容填充剩余宽度 -->
+        <div class="flex-grow" :class="`list-item__content_${type}`">
           <div class="list-item__label">{{ item.label }}</div>
-          <div :class="`list-item__value_${item.color}`">
-            {{ item.value }}
-          </div>
+          <div :class="`list-item__info_${item.color}`">{{ item.info }}</div>
+          <div :class="`list-item__value_${item.color}`">{{ item.value }}</div>
         </div>
       </div>
     </div>
@@ -24,6 +27,7 @@
         color: string;
         label: string;
         prop: string;
+        info: string;
       }[];
       type: string;
     }>(),
@@ -42,24 +46,35 @@
   .list-item {
     height: 20%;
   }
-  .list__A {
+
+  .list {
+    padding: 5px 20px;
+    position: relative;
+    background-repeat: no-repeat;
+    width: 100%;
+    height: 100%;
+    background-size: auto 100%;
+    background-image: url(/@/assets/images/home-container/configurable/list_bg_default.png);
+  }
+
+  .list_A {
     padding-left: 5px;
   }
-  .list-item__content__A {
+  .list-item__content_A {
     background-repeat: no-repeat;
     background-image: @vent-gas-list-item-bg-img;
     padding: 5px 10px;
     display: flex;
     justify-content: space-between;
   }
-  .list-item__icon__A {
+  .list-item__icon_A {
     background-repeat: no-repeat;
     width: 25px;
     height: 29px;
     background-image: url(/@/assets/images/home-container/configurable/triangle_icon.png);
   }
 
-  .list-item__content__B {
+  .list-item__content_B {
     background-repeat: no-repeat;
     padding: 5px 10px 10px 10px;
     display: flex;
@@ -68,7 +83,7 @@
     background-size: 100% auto;
     background-image: url(/@/assets/images/home-container/configurable/list_bg_b.png);
   }
-  .list-item__image__B {
+  .list-item__image_B {
     width: 77px;
     height: 77px;
     background-repeat: no-repeat;
@@ -76,6 +91,25 @@
     background-size: auto;
     margin-right: 20px;
   }
+
+  .list_C {
+    background: none;
+  }
+
+  .list-item__content_C {
+    height: 60px;
+    background-repeat: no-repeat;
+    padding: 25px 50px 0 50px;
+    display: flex;
+    background-position: center;
+    background-size: 100% 100%;
+    background-image: url(/@/assets/images/home-container/configurable/list_bg_c.png);
+    margin-bottom: 10px;
+    text-align: center;
+  }
+  .list-item__content_C > div {
+    flex-basis: 33.3%;
+  }
   // .list-item__icon_red {
   //   background-image: url('@/assets/images/home-container/configurable/warn_icon_5.png');
   // }
@@ -133,14 +167,4 @@
   .list-item__value_blue {
     color: lightblue;
   }
-
-  .list {
-    padding: 5px 20px;
-    position: relative;
-    background-repeat: no-repeat;
-    width: 100%;
-    height: 100%;
-    background-size: auto 100%;
-    background-image: url(/@/assets/images/home-container/configurable/list_bg_default.png);
-  }
 </style>

+ 114 - 0
src/views/vent/home/configurable/components/CustomTable.vue

@@ -0,0 +1,114 @@
+<template>
+  <div class="table">
+    <div class="table__content">
+      <div class="table__content_label" :class="`table__content_label_${type}`">
+        <div class="label-t" v-for="(item, index) in columns" :key="`svvhbcth-${index}`" :style="{ flexBasis }">{{ item.name }}</div>
+      </div>
+      <div class="table__content_list" :class="`table__content_list_${type}`">
+        <div class="table__content_list_row" v-for="(item, index) in data" :key="`svvhbct-${index}`">
+          <div v-for="(t, i) in columns" :key="`svvhbctr-${i}`" :style="{ flexBasis }" :class="`table__content__list_item_${type}`">
+            <slot :name="t.prop" :scope="item">
+              <span>{{ get(item, t.prop) }}</span>
+            </slot>
+          </div>
+        </div>
+      </div>
+    </div>
+  </div>
+</template>
+<script lang="ts" setup>
+  import { computed, defineProps } from 'vue';
+  import _ from 'lodash-es';
+
+  let props = withDefaults(
+    defineProps<{
+      type: string;
+      /** 列表表头配置,每个prop都有其对应的slot来提供定制化功能 */
+      columns: { prop: string; name: string }[];
+      data: any[];
+      defaultValue: string;
+    }>(),
+    {
+      type: 'B',
+      columns: () => [],
+      data: () => [],
+      defaultValue: '/',
+    }
+  );
+
+  const flexBasis = computed(() => {
+    return Math.fround(100 / props.columns.length) + '%';
+  });
+
+  function get(o, p) {
+    const d = _.get(o, p, props.defaultValue);
+    return d === null ? props.defaultValue : d;
+  }
+</script>
+<style lang="less" scoped>
+  @import '@/design/vent/color.less';
+
+  @font-face {
+    font-family: 'douyuFont';
+    src: url('@/assets/font/douyuFont.otf');
+  }
+
+  .table__content {
+    height: 100%;
+    box-sizing: border-box;
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+
+    .table__content_label {
+      width: 400px;
+      height: 32px;
+      display: flex;
+      justify-content: space-around;
+      align-items: center;
+      // background: url('@/assets/images/company/content-label.png') no-repeat;
+      .label-t {
+        // color: #3df6ff;
+        text-align: center;
+        font-size: 14px;
+      }
+    }
+    .table__content_label_B {
+      // border: 1px solid @vent-gas-tab-border;
+      background-image: linear-gradient(to top, #04698c, #04698c00);
+      background-size: 100% 100%;
+      background-repeat: no-repeat;
+      color: #31b9ef;
+    }
+
+    .table__content_list {
+      height: calc(100% - 32px);
+      width: 400px;
+      display: flex;
+      flex-direction: column;
+      // justify-content: space-around;
+      justify-content: flex-start;
+      padding: 5px 0px;
+      box-sizing: border-box;
+      overflow-y: auto;
+      .table__content_list_row {
+        width: 100%;
+        height: 28px;
+        display: flex;
+        justify-content: space-around;
+        align-items: flex-start;
+        // background: url('@/assets/images/company/content-text.png') no-repeat;
+        color: #fff;
+        margin-bottom: 5px;
+        span {
+          display: inline-block;
+          text-align: center;
+        }
+      }
+
+      // .table__content__list_item_B {
+      //   border: 1px solid @vent-gas-tab-border;
+      // }
+    }
+  }
+</style>

+ 8 - 0
src/views/vent/home/configurable/components/content.vue

@@ -83,6 +83,13 @@
           :data="tableData"
           class="mt-20px mb-10px text-center flex-grow overflow-auto"
         />
+        <CustomTable
+          v-else
+          :type="config.type"
+          :columns="config.columns"
+          :data="tableData"
+          class="mt-20px mb-10px text-center flex-grow overflow-auto"
+        />
       </template>
       <template v-if="config.key === 'blast_delta'">
         <BlastDelta class="mt-10px mb-10px" :pos-monitor="blastDeltaData" :canvas-size="{ width: 250, height: 147 }" />
@@ -112,6 +119,7 @@
   import MiniBoard from './MiniBoard.vue';
   import TimelineList from './TimelineList.vue';
   import CustomList from './CustomList.vue';
+  import CustomTable from './CustomTable.vue';
   import { getFormattedText } from '../../../deviceManager/configurationTable/adapters';
   import CustomChart from './CustomChart.vue';
   import { get, clone } from 'lodash-es';

+ 12 - 9
src/views/vent/home/configurable/configurable.data.ts

@@ -637,7 +637,7 @@ export const testConfigA: Config[] = [
     pageType: '',
     moduleData: {
       header: {
-        show: false,
+        show: true,
         showSelector: true,
         showSlot: true,
         selector: {
@@ -658,7 +658,7 @@ export const testConfigA: Config[] = [
       preset: [],
       table: [
         {
-          type: 'A',
+          type: 'B',
           readFrom: 'history',
           columns: [
             {
@@ -713,28 +713,31 @@ export const testConfigA: Config[] = [
       board: [],
       list: [
         {
-          type: 'A',
+          type: 'C',
           items: [
             {
               prop: 'total',
-              label: '设备总数',
+              label: '光纤预警',
               color: 'blue',
+              info: '个',
             },
             {
               prop: 'pwkqs',
               label: '喷雾开启数',
               color: 'blue',
+              info: '个',
             },
             {
               prop: 'online',
               label: '联网数量',
               color: 'blue',
+              info: '个',
             },
-            {
-              prop: 'offline',
-              label: '断网数量',
-              color: 'blue',
-            },
+            // {
+            //   prop: 'offline',
+            //   label: '断网数量',
+            //   color: 'blue',
+            // },
           ],
         },
       ],