xiaohaizhao hai 10 meses
pai
achega
7130ea89e4

+ 14 - 4
control/components/prodnum-MT01/modules/division.vue

@@ -11,11 +11,17 @@
         class="TR-state"
         hover-class="navigator-hover"
         @click.stop="changTR(index)"
-        >{{ TRList[index].showValue || "暂未设置" }}</view
+        >{{
+          (TRList[index].showValue.includes("投入") ? "切出" : "投入") ||
+          "暂未设置"
+        }}</view
       >
       <view class="item" hover-class="navigator-hover" @click="onClick(item)">
         <view class="title">
-          {{ item.funcname }}
+          <view>{{ item.funcname }}</view>
+          <view class="pilotLamp">
+            <pilotLamp :trItem="TRList[index]" />
+          </view>
         </view>
         <view class="row">
           <view class="box">
@@ -102,8 +108,10 @@
 </template>
 
 <script>
+import pilotLamp from "./pilotLamp";
 export default {
   name: "division",
+  components: { pilotLamp },
   data() {
     return {
       list: [],
@@ -152,7 +160,7 @@ export default {
             keyList.push(formattingKey(key2));
             key2++;
             TRList.push(
-              this.__proto__.getControlItem([`时段${i}投入`], newVal)[0]
+              this.__proto__.getControlItem([`时段${i}`], newVal)[0]
             );
           }
         }
@@ -286,9 +294,11 @@ export default {
 
     .title {
       display: flex;
-      justify-content: space-between;
       margin-bottom: 6px;
       font-weight: bold;
+      .pilotLamp {
+        margin-left: 10px;
+      }
     }
 
     .row {

+ 81 - 49
control/components/prodnum-MT01/modules/pilotLamp.vue

@@ -1,77 +1,109 @@
 <template>
-    <view class="pilotLamp">
-        <view class="item" v-for="item in list" :key="item.name">
-            <view class="image">
-                <image style="height: 100%;" src="/static/img/pilot-lamp.png" mode="heightFix" />
-                <view v-if="item.value" class="bg" />
-            </view>
-            <view class="name">
-                {{ item.name }}
-            </view>
-        </view>
+  <view class="pilotLamp">
+    <view class="item" v-for="item in list" :key="item.name">
+      <view class="image">
+        <image
+          style="height: 100%"
+          src="/static/img/pilot-lamp.png"
+          mode="heightFix"
+        />
+        <view
+          v-if="item.value || (item.params.lastvalue==1)"
+          class="bg"
+          :class="item.warn ? 'red' : 'green'"
+        />
+      </view>
+      <view class="name" v-if="item.name"> {{ item.name }} </view>
     </view>
+  </view>
 </template>
 
 <script>
 export default {
-    name: 'pilotLamp',
-    data() {
-        return {
-            list: []
-        }
+  name: "pilotLamp",
+  props: {
+    trItem: Object,
+  },
+  watch: {
+    trItem: {
+      handler(newV) {
+        this.list = [newV];
+      },
+      deep: true,
+      immediate: true,
     },
-}
+  },
+  data() {
+    return {
+      list: [],
+    };
+  },
+};
 </script>
 
 <style lang="scss" scoped>
 .pilotLamp {
+  display: flex;
+  flex-wrap: wrap;
+
+  .item {
     display: flex;
-    flex-wrap: wrap;
+    flex-direction: column;
+    align-items: center;
+    width: 20%;
 
-    .item {
-        display: flex;
-        flex-direction: column;
-        align-items: center;
-        width: 20%;
+    .image {
+      position: relative;
+      height: 20px;
 
-        .image {
-            position: relative;
-            height: 20px;
+      .bg {
+        width: 14px;
+        height: 14px;
+        border-radius: 50%;
+        background: #cccccc;
+        position: absolute;
+        top: 3px;
+        left: 3px;
+      }
 
-            .bg {
-                width: 14px;
-                height: 14px;
-                border-radius: 50%;
-                background: #cccccc;
-                position: absolute;
-                top: 3px;
-                left: 3px;
-                animation: lampBackground .5s infinite alternate ease-in-out;
-            }
+      .red {
+        animation: lampBackground 0.5s infinite alternate ease-in-out;
+      }
 
-            @keyframes lampBackground {
-                from {
-                    background-color: #FF8F4A;
-                }
+      .green {
+        animation: lampBackground1 0.5s infinite alternate ease-in-out;
+      }
 
-                to {
-                    background-color: red;
-                }
-            }
+      @keyframes lampBackground {
+        from {
+          background-color: #ff8f4a;
         }
 
-        .name {
-            font-size: 12px;
-            color: #fff;
-            margin-top: 6px;
+        to {
+          background-color: red;
         }
+      }
 
+      @keyframes lampBackground1 {
+        from {
+          background-color: rgb(0, 255, 0);
+        }
 
+        to {
+          background-color: green;
+        }
+      }
     }
 
-    .item:nth-of-type(n+6) {
-        margin-top: 10px;
+    .name {
+      font-size: 12px;
+      color: #fff;
+      margin-top: 6px;
     }
+  }
 
+  .item:nth-of-type(n + 6) {
+    margin-top: 10px;
+  }
 }
 </style>

+ 5 - 1
control/components/prodnum-MT01/prodnum-MT01.vue

@@ -32,7 +32,7 @@ export default {
             },
             {
               name: "远程",
-              value: getBoole("S002"),
+              value: getBoole("S002")
             },
             {
               name: "开到位",
@@ -45,18 +45,22 @@ export default {
             {
               name: "过扭故障",
               value: getBoole("A001"),
+              warn: true,
             },
             {
               name: "失压警告",
               value: getBoole("A003"),
+              warn: true,
             },
             {
               name: "失压报警",
               value: getBoole("A004"),
+              warn: true,
             },
             {
               name: "电量低报警",
               value: getBoole("A002"),
+              warn: true,
             },
           ];
           function getBoole(name, expect = 1) {

+ 4 - 4
control/modules/My_input.vue

@@ -371,9 +371,9 @@ export default {
         value = this.value - 0;
         if (String(value).length == 0) return this.submitBreak("还未输入值");
         if (params.num_scale != 0) value = value.toFixed(params.num_scale);
-        if (params.num_minvalue && value < params.num_minvalue)
+        if (params.num_minvalue && value - 0 < params.num_minvalue - 0)
           return this.submitBreak("输入值小于最低范围");
-        if (params.num_maxvalue && value > params.num_maxvalue)
+        if (params.num_maxvalue && value - 0 > params.num_maxvalue - 0)
           return this.submitBreak("输入值大于最大范围");
       } else if (item.inputType == "switch") {
         let value = item.paramName;
@@ -400,9 +400,9 @@ export default {
         if (String(value).length == 0) return this.submitBreak("还未输入值");
         let p = item.params[item.key + "P"];
         if (p.num_scale != 0) value = value.toFixed(p.num_scale);
-        if (p.num_minvalue && value > p.num_minvalue)
+        if (p.num_minvalue && value - 0 > p.num_minvalue - 0)
           return this.submitBreak("输入值小于最低范围");
-        if (p.num_maxvalue && value < p.num_maxvalue)
+        if (p.num_maxvalue && value - 0 < p.num_maxvalue - 0)
           return this.submitBreak("输入值大于最大范围");
         return this.submit(item.w_functionid, {
           [item.key + "P"]: value,