Browse Source

[Wip 0000] 公司端首页添加数据源模式切换按钮,通风看板再对接

houzekong 2 months ago
parent
commit
a8b355218a

BIN
src/assets/images/company/monitor-doc.png


BIN
src/assets/images/company/monitor-realtime.png


+ 6 - 3
src/views/vent/home/billboard/billboard.data.ts

@@ -358,17 +358,20 @@ export const FILE_OVERVIEW_CONFIG = [
 export const VENTILATION_STATUS_HEADER_CONFIG = [
   {
     label: '总进风量(m³/min)',
-    prop: 'zongjinfeng',
+    prop: 'totalIntM3',
+    // prop: 'zongjinfeng',
     type: 'blue-to-left',
   },
   {
     label: '总回风量(m³/min)',
-    prop: 'zonghuifeng',
+    prop: 'totalRetM3',
+    // prop: 'zonghuifeng',
     type: 'green-to-right',
   },
   {
     label: '总需风量(m³/min)',
-    prop: 'xufengliang',
+    prop: 'totalPlanM3',
+    // prop: 'xufengliang',
     type: 'green-to-left',
   },
   {

+ 51 - 15
src/views/vent/home/clique/index.vue

@@ -23,6 +23,12 @@
               <iconLight @show-detail="showDetail" :warningList="warningList" />
             </div>
           </div>
+          <img
+            :src="isDataRealTime ? '/@/assets/images/company/monitor-realtime.png' : '/@/assets/images/company/monitor-doc.png'"
+            alt="切换数据模式"
+            class="w-34px h-34px pos-absolute right-5px bottom-30% z-5"
+            @click="switchDataMode"
+          />
           <!-- 榆家梁矿 -->
           <!-- <div class="area-card2">
             
@@ -62,6 +68,8 @@
   import iconLight from './components/icon-light.vue';
   import dialogModal from './components/dialog-modal.vue';
   import { getHomeData, getList } from './clique.api';
+  import { EllipsisOutlined } from '@ant-design/icons-vue';
+
   const dialogModalRef = ref();
   let mainTitle = ref('国能神东一通三防管控平台');
   // let mainTitle = ref('国家能源神东煤炭集团');
@@ -95,6 +103,9 @@
 
   let orgcode = ref('');
 
+  /** 数据是否使用实时数据,使用实时数据/报表数据对应某些数据的不同字段 */
+  const isDataRealTime = ref(true);
+
   // https获取监测数据
   let timer: null | NodeJS.Timeout = null;
   function getMonitor() {
@@ -120,29 +131,49 @@
       roadData.data1.length = 0;
       airKjStatus.length = 0;
       const warningListTemp: { orgcode: string; isWarning: boolean }[] = [];
-      res.forEach((el) => {
-        airKjStatus.push({
-          deviceName: el.sys_data.deviceName,
-          jf: el.sys_data.zongjinfeng,
-          xf: el.sys_data.xufengliang,
-          hf: el.sys_data.zonghuifeng,
-          isWarning: Number(el.sys_data.zongjinfeng) < Number(el.sys_data.xufengliang),
-        });
+      res.forEach(({ sys_data, orgcode }) => {
+        const air = {
+          deviceName: sys_data.deviceName,
+          jf: isDataRealTime.value ? sys_data.zongjinfeng : sys_data.totalIntM3,
+          xf: isDataRealTime.value ? sys_data.xufengliang : sys_data.totalPlanM3,
+          hf: isDataRealTime.value ? sys_data.zonghuifeng : sys_data.totalRetM3,
+          isWarning: false,
+        };
+        air.isWarning = Number(air.jf) < Number(air.xf);
+        airKjStatus.push(air);
 
         //临时添加,前端判断,后期后端加上预警再处理
-        if (Number(el.sys_data.zongjinfeng) < Number(el.sys_data.xufengliang)) {
-          warningListTemp.push({ orgcode: el.orgcode, isWarning: true });
+        if (air.isWarning) {
+          warningListTemp.push({ orgcode: orgcode, isWarning: true });
         } else {
-          warningListTemp.push({ orgcode: el.orgcode, isWarning: false });
+          warningListTemp.push({ orgcode: orgcode, isWarning: false });
         }
 
-        roadData.data.push(el.sys_data.flength);
-        // roadData.data.push(el.sys_data.totallength);
-        roadData.data1.push(el.sys_data.deviceName);
+        roadData.data.push(sys_data.flength);
+        // roadData.data.push(sys_data.totallength);
+        roadData.data1.push(sys_data.deviceName);
       });
       warningList.value = warningListTemp;
       compositeData.value = res.reduce((arr, e) => {
-        return [...arr, ...e.majorpath_data];
+        if (isDataRealTime.value) {
+          return [...arr, ...e.majorpath_data];
+        } else {
+          return [
+            ...arr,
+            ...e.majorpath_data.map(({ majorpath, readData }) => {
+              // 报表数据只有总数据,按实时数据计算比例然后乘以报表数据
+              return {
+                majorpath: {
+                  drag_1: Math.round((majorpath.drag_1 / majorpath.drag_total) * parseInt(readData.fy_merge.value)),
+                  drag_2: Math.round((majorpath.drag_2 / majorpath.drag_total) * parseInt(readData.fy_merge.value)),
+                  drag_3: Math.round((majorpath.drag_3 / majorpath.drag_total) * parseInt(readData.fy_merge.value)),
+                  drag_total: readData.fy_merge.value,
+                  m3_total: readData.retM3_merge.value,
+                },
+              };
+            }),
+          ];
+        }
       }, []);
       centerDetail.value = res.filter((v) => v.orgcode == orgcode.value)[0];
     }
@@ -175,6 +206,11 @@
     isShowDialog.value = false;
   }
 
+  function switchDataMode() {
+    isDataRealTime.value = !isDataRealTime.value;
+    getHomeDataList();
+  }
+
   onMounted(() => {
     getHomeDataList();
     getLists();