Browse Source

优化大经编机数据显示

liling 5 ngày trước cách đây
mục cha
commit
ff37572bb1
2 tập tin đã thay đổi với 32 bổ sung28 xóa
  1. 2 2
      src/pages/components/In02.vue
  2. 30 26
      src/pages/components/In02_device_info.vue

+ 2 - 2
src/pages/components/In02.vue

@@ -617,7 +617,7 @@ export default {
                                 ChangeModelColor(devcode, DEV_OFFLINE_COLOR);
                                 ChangeModelAlarmState2(devcode);
                                 OFFLINE_DEVS[devcode] = 1
-                                //console.log('离线设备:',devcode)
+                                console.log('离线设备:',devcode)
                             }
                         }
                     }
@@ -1577,7 +1577,7 @@ export default {
                 var color = "rgb(206,161,94)" //默认告警文本颜色
                 var typeName = AlarmType[alarmInfo];
                 if (typeName.indexOf("故障") > -1 || typeName.indexOf("掉线") > -1) color = "rgb(195,70,76)" //红色提醒
-                alarmDev[devcode]={color:color,devcode:devcode.replace(/C_/g, ""),devcode_all:devcode,typename:typeName,type:alarmInfo};
+                alarmDev[devcode]={color:color,devcode:devcode.replace(/C_/g, "").replace(/D_/g, ""),devcode_all:devcode,typename:typeName,type:alarmInfo};
                 ChangeModelAlarmState2(devcode,AlarmColorTypeCode[alarmInfo]); //"00ff00" 绿色
                 //lst.push(tpl.replace(/\{1\}/gi, devcode.replace(/C_/g, "")).replace(/\{2\}/g, typeName).replace('{COLOR}', color))
             }

+ 30 - 26
src/pages/components/In02_device_info.vue

@@ -20,11 +20,11 @@
                             <td class="littleFont">GB5</td>
                         </tr>
                         <tr>
-                            <td width="20%" class="value">{{ deviceInfo.Capacity_data_5||'-' }}</td>
-                            <td width="20%" class="value">{{ deviceInfo.Capacity_data_6||'-' }}</td>
-                            <td width="20%" class="value">{{ deviceInfo.Capacity_data_7||'-' }}</td>
-                            <td width="20%" class="value">{{ deviceInfo.Capacity_data_8||'-' }}</td>
-                            <td width="20%" class="value">{{ deviceInfo.Capacity_data_9||'-' }}</td>
+                            <td width="20%" class="value" v-html="deviceInfo.Capacity_data_5||'-'"></td>
+                            <td width="20%" class="value" v-html="deviceInfo.Capacity_data_6||'-'"></td>
+                            <td width="20%" class="value" v-html="deviceInfo.Capacity_data_7||'-'"></td>
+                            <td width="20%" class="value" v-html="deviceInfo.Capacity_data_8||'-'"></td>
+                            <td width="20%" class="value" v-html="deviceInfo.Capacity_data_9||'-'"></td>
                         </tr>
                         </tbody>
                     </table>
@@ -49,11 +49,11 @@
                             <td class="littleFont">GB5</td>
                         </tr>
                         <tr>
-                            <td width="20%" class="value">{{ deviceInfo.Capacity_data_10||'-' }}</td>
-                            <td width="20%" class="value">{{ deviceInfo.Capacity_data_11||'-' }}</td>
-                            <td width="20%" class="value">{{ deviceInfo.Capacity_data_12||'-' }}</td>
-                            <td width="20%" class="value">{{ deviceInfo.Capacity_data_13||'-' }}</td>
-                            <td width="20%" class="value">{{ deviceInfo.Capacity_data_14||'-' }}</td>
+                            <td width="20%" class="value" v-html="deviceInfo.Capacity_data_10||'-'"></td>
+                            <td width="20%" class="value" v-html="deviceInfo.Capacity_data_11||'-'"></td>
+                            <td width="20%" class="value" v-html="deviceInfo.Capacity_data_12||'-'"></td>
+                            <td width="20%" class="value" v-html="deviceInfo.Capacity_data_13||'-'"></td>
+                            <td width="20%" class="value" v-html="deviceInfo.Capacity_data_14||'-'"></td>
                         </tr>
                         </tbody>
                     </table>
@@ -78,11 +78,11 @@
                             <td class="littleFont">GB5</td>
                         </tr>
                         <tr >
-                            <td width="20%" class="value">{{ deviceInfo.Capacity_data_15||'-' }}</td>
-                            <td width="20%" class="value">{{ deviceInfo.Capacity_data_16||'-' }}</td>
-                            <td width="20%" class="value">{{ deviceInfo.Capacity_data_17||'-' }}</td>
-                            <td width="20%" class="value">{{ deviceInfo.Capacity_data_18||'-' }}</td>
-                            <td width="20%" class="value">{{ deviceInfo.Capacity_data_19||'-' }}</td>
+                            <td width="20%" class="value" v-html="deviceInfo.Capacity_data_15||'-'"></td>
+                            <td width="20%" class="value" v-html="deviceInfo.Capacity_data_16||'-'"></td>
+                            <td width="20%" class="value" v-html="deviceInfo.Capacity_data_17||'-'"></td>
+                            <td width="20%" class="value" v-html="deviceInfo.Capacity_data_18||'-'"></td>
+                            <td width="20%" class="value" v-html="deviceInfo.Capacity_data_19||'-'"></td>
                         </tr>
                         </tbody>
                     </table>
@@ -107,11 +107,11 @@
                             <td class="littleFont">GB5</td>
                         </tr>
                         <tr >
-                            <td width="20%" class="value" :style="deviceInfo.Pan[0].color!=''?'color:'+deviceInfo.Pan[0].color:''">{{ deviceInfo.Pan[0].value }}</td>
-                            <td width="20%" class="value" :style="deviceInfo.Pan[1].color!=''?'color:'+deviceInfo.Pan[1].color:''">{{ deviceInfo.Pan[1].value }}</td>
-                            <td width="20%" class="value" :style="deviceInfo.Pan[2].color!=''?'color:'+deviceInfo.Pan[2].color:''">{{ deviceInfo.Pan[2].value }}</td>
-                            <td width="20%" class="value" :style="deviceInfo.Pan[3].color!=''?'color:'+deviceInfo.Pan[3].color:''">{{ deviceInfo.Pan[3].value }}</td>
-                            <td width="20%" class="value" :style="deviceInfo.Pan[4].color!=''?'color:'+deviceInfo.Pan[4].color:''">{{ deviceInfo.Pan[4].value }}</td>
+                            <td width="20%" class="value" :style="deviceInfo.Pan[0].color!=''?'color:'+deviceInfo.Pan[0].color:''" v-html="deviceInfo.Pan[0].value"></td>
+                            <td width="20%" class="value" :style="deviceInfo.Pan[1].color!=''?'color:'+deviceInfo.Pan[1].color:''" v-html="deviceInfo.Pan[1].value"></td>
+                            <td width="20%" class="value" :style="deviceInfo.Pan[2].color!=''?'color:'+deviceInfo.Pan[2].color:''" v-html="deviceInfo.Pan[2].value"></td>
+                            <td width="20%" class="value" :style="deviceInfo.Pan[3].color!=''?'color:'+deviceInfo.Pan[3].color:''" v-html="deviceInfo.Pan[3].value"></td>
+                            <td width="20%" class="value" :style="deviceInfo.Pan[4].color!=''?'color:'+deviceInfo.Pan[4].color:''" v-html="deviceInfo.Pan[4].value"></td>
                         </tr>
                         </tbody>
                     </table>
@@ -138,15 +138,19 @@
             );
             function getPantaoColor(v) {
                 if (v == null || v == "-") return "";
-                v = v * 1;
-                if (v < 20) return "#" + DEV_ALAR_COLOR;
-                else if (v < 50) return "#" + DEV_HINT_COLOR;
+                var v1= v.split("&nbsp;");
+                for(var i=0;i<v1.length;i++){
+                    if(v1[i]=="") continue;                    
+                    v = parseFloat(v1[i].replace('A:','').replace('B:',''));
+                    if (v < 20) return "#" + DEV_ALAR_COLOR;
+                    else if (v < 50) return "#" + DEV_HINT_COLOR;
+                }
                 return "";
             }
             onMounted(()=>{    
                 devicename.value=route.currentRoute.value.hash.slice(1);      
                 api.GetDeviceInfo(devicename.value).then((res)=>{
-                    console.log(res)
+                    //console.log(res)
                     if (res==null || res.code!=0) {
                         //NoneDevice(name)
                         return
@@ -155,8 +159,8 @@
                     tmp["Pan"] = [];
                     let paninfo = window.Pan==null ? null : window.Pan[devicename.value];
                     for (var i = 0; i < 5; i++) {
-                        var v = paninfo != null && paninfo[i]!=null ? paninfo[i] : "-";
-                        tmp["Pan"].push({"value":v,"color":getPantaoColor(v)})
+                        var v = tmp['p'+(i+1)];
+                        tmp["Pan"].push({"value":v||'-',"color":getPantaoColor(v)})
                     }
                     deviceInfo.value = tmp;
                 })