Browse Source

水电开关

Shannon_mu 2 years ago
parent
commit
34f4f1257c

+ 9 - 5
commandCenter/src/views/commandDispatch/index.vue

@@ -132,18 +132,22 @@ export default {
         togglePop(row) {
             let url = '',
                 width = '2.89rem',
-                height = '2.25rem',showHide=false;
-         
+                height = '2.25rem',
+                showHide = false;
+
             if (row.deviceType == 1) {
                 url = 'typeCamera';
             } else if (row.deviceType == 2) {
                 url = 'typeAccessControl';
             } else if (row.deviceType == 3) {
                 url = 'typeCard';
-  showHide = true
-            } else if (row.deviceType == 4 || row.deviceType == 5) {
+                showHide = true;
+            } else if (row.deviceType == 4) {
                 url = 'typeHydropower';
                 height = '2.65rem';
+            } else if (row.deviceType == 5) {
+                url = 'typeHydropower';
+                height = '1.2rem';
             }
             new Promise((resolve) => {
                 this.$store.dispatch('addPopup', {
@@ -155,7 +159,7 @@ export default {
                     fullscreen: false,
                     showFooter: true,
                     showAlarm: true,
-                    showHide:showHide,
+                    showHide: showHide,
                     props: {
                         row,
                         callback: resolve

+ 33 - 4
commandCenter/src/views/commandDispatch/pop/typeHydropower.vue

@@ -12,13 +12,16 @@
             <div class="list-title">状态</div>
             <div class="list-text">{{ typeStatus(formData.deviceStatus) }}</div>
         </div>
-        <div class="list">
+        <!-- <div class="list">
             <div class="list-title">今日用{{ params.row == 4 ? '水' : '电' }}</div>
             <div class="list-text">{{ formData.readData || '--' }}</div>
-        </div>
-        <div class="list">
+        </div> -->
+        <div class="list" v-if="params.row.deviceType == 4">
             <div class="list-title">阀门控制</div>
-            <div class="list-text">{{ formData.readData || '--' }}</div>
+            <div class="list-text">
+                <div class="button" @click="valveToggle(0,formData.id)">开阀</div>
+                <div class="button" @click="valveToggle(1,formData.id)">关阀</div>
+            </div>
         </div>
     </div>
 </template>
@@ -44,6 +47,20 @@ export default {
                 })
                 .catch(() => {});
         },
+        valveToggle(satus,id) {
+            this.$http
+                .post('/sc-energy/device/batchValve', {
+                    valveStatus: satus,
+                    ids: id
+                })
+                .then(({ status, data, msg }) => {
+                    if (status === 0) {
+                        this.$message.success(msg);
+                    } else {
+                        this.$message.error(msg);
+                    }
+                });
+        },
         open() {
             this.$store.dispatch('addPopup', {
                 url: `/commandDispatch/pop/tableList.vue`,
@@ -106,6 +123,18 @@ export default {
             overflow: hidden;
             text-overflow: ellipsis;
         }
+        .button {
+            width: 60px;
+            height: 30px;
+            background: #0eaeff;
+            border-radius: 4px;
+            text-align: center;
+            line-height: 30px;
+            margin-top: 5px;
+            cursor: pointer;
+            display: inline-block;
+            margin-right: 5px;
+        }
     }
 }
 </style>