East hace 3 años
padre
commit
a27c885939

+ 10 - 1
src/utils/chenApi.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-11-18 13:40:39
- * @LastEditTime: 2021-12-02 16:14:15
+ * @LastEditTime: 2021-12-05 13:27:51
  * @LastEditors: Please set LastEditors
  * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  * @FilePath: \hyyfClient\src\utils\chenApi.js
@@ -182,3 +182,12 @@ export function postAlarmSets(params) {
     data: params
   })
 }
+
+/* 环境监测报警 */
+export function getEnvAlarm(params) {
+  return axios({
+    url: '/produce/warningInfo/listWarningInfoZoology',
+    method: 'post',
+    data: params
+  })
+}

+ 117 - 80
src/views/Alarm/EnvWarn.vue

@@ -1,37 +1,52 @@
 <template>
   <div class="envWarn">
-    <div class="reply" :style="{color: color}">筛选查询</div>
-    <x-form :formItems="selectItems" :day="day" @setDay="setDay" @onClickType="onClickType"></x-form>
-    <new-table :height="600" :title="title" :listData="list" :tableItems="tableItems" :shows="tableShows">
-      <template #right>
+    <div class="reply" :style="{ color: color }">筛选查询</div>
+    <x-form
+      :formItems="selectItems"
+      :day="day"
+      @setDay="setDay"
+      @onClickType="onClickType"
+    >
+    </x-form>
+    <new-table
+      :height="600"
+      :title="title"
+      :listData="list"
+      :tableItems="tableItems"
+      :shows="tableShows"
+    >
+      <!-- <template #right>
         <el-button size="mini" type="primary">导出数据</el-button>
-      </template>
+      </template> -->
       <template #handler="scope">
         <el-button type="text" @click="open(scope.row)">未处理</el-button>
       </template>
     </new-table>
     <table-footer
-        :totals="total"
-        :size="pageSize"
-        @sizeChange="sizeChange"
-        @pageChange="pageChange"></table-footer>
+      :totals="total"
+      :size="pageSize"
+      @sizeChange="sizeChange"
+      @pageChange="pageChange"
+    ></table-footer>
   </div>
 </template>
 
 <script>
-import { mapState } from 'vuex';
+import { mapState } from "vuex";
 import XForm from "@/components/XForm";
 import NewTable from "@/components/newTable/NewTable";
 import TableFooter from "@/components/TableFooter";
+
+import { getEnvAlarm } from "@/utils/chenApi.js";
 export default {
   name: "EnvWarn",
   computed: {
-    ...mapState(['color'])
+    ...mapState(["color"]),
   },
   components: {
     XForm,
     NewTable,
-    TableFooter
+    TableFooter,
   },
   data() {
     return {
@@ -39,79 +54,67 @@ export default {
       selectItems: [
         {
           id: 3,
-          type: 'text',
-          text: '今日',
+          type: "text",
+          text: "今日",
           value: 1,
-          col: 1
+          col: 1,
         },
         {
           id: 4,
-          type: 'text',
-          text: '本周',
+          type: "text",
+          text: "本周",
           value: 2,
-          col: 1
+          col: 1,
         },
         {
           id: 5,
-          type: 'text',
-          text: '本月',
+          type: "text",
+          text: "本月",
           value: 3,
-          col: 1
+          col: 1,
         },
         {
           id: 6,
-          type: 'datepicker',
+          type: "datepicker",
           placeholder: [],
-          field: 'value1',
-          col: 6
+          field: "value1",
+          col: 6,
         },
         {
           id: 7,
-          type: 'button',
-          text: '查询',
+          type: "button",
+          text: "查询",
           col: 2,
-          click: 'search'
-        }
-      ],
-      title: '数据列表',
-      list: [
-        {
-          id: 1,
-          time: '2021-10-11 14:09:09',
-          location: '育肥1栋2层死猪通道',
-          content: '温度过高',
+          click: "search",
         },
-        {
-          id: 2,
-          time: '2021-10-11 14:09:09',
-          location: '卖猪台',
-          content: '温度过高',
-        }
       ],
+      title: "数据列表",
+      list: [],
       tableItems: [
         {
-          prop: 'time',
-          label: '时间',
-          minWidth: '100',
-          slotName: 'time'
+          prop: "warningTime",
+          label: "时间",
+          minWidth: "60",
+          slotName: "warningTime",
         },
         {
-          prop: 'location',
-          label: '位置',
-          minWidth: '100',
-          slotName: 'location'
+          prop: "warningName",
+          label: "报警类型",
+          minWidth: "60",
+          slotName: "warningName",
         },
         {
-          prop: 'content',
-          label: '内容',
-          minWidth: '100',
-          slotName: 'content'
+          prop: "levelName",
+          label: "报警等级",
+          minWidth: "60",
+          slotName: "levelName",
         },
         {
-          label: '处理结果',
-          minWidth: '100',
-          slotName: 'handler'
-        }
+          prop: "msg",
+          label: "内容",
+          minWidth: "100",
+          slotName: "msg",
+        },
       ],
       tableShows: {
         showIndex: false,
@@ -120,7 +123,11 @@ export default {
       total: 0,
       pageNum: 1,
       pageSize: 20,
-    }
+      time: [],
+    };
+  },
+  mounted() {
+    this.init(this.day);
   },
   methods: {
     // 修改size
@@ -130,35 +137,65 @@ export default {
     },
     // 修改页数
     pageChange(val) {
-      this.pageNum= val;
+      this.pageNum = val;
       this.init();
     },
-    init() {},
+    init() {
+      let params;
+      if (this.day === 4) {
+        params = {
+          startDate: this.time[0],
+          endDate: this.time[1],
+          type: this.day,
+          current: this.pageNum,
+          size: this.pageSize,
+        };
+      } else {
+        params = {
+          type: this.day,
+          current: this.pageNum,
+          size: this.pageSize,
+        };
+      }
+      getEnvAlarm(params).then((res) => {
+        if (res.code === 10000) {
+          this.list = res.data.records;
+          this.total = res.data.total;
+        }
+      });
+    },
     setDay(data) {
       this.day = data;
+      this.pageNum = 1;
+      this.init();
+    },
+    onClickType(val) {
+      this.day = 4;
+      this.time = val.data.value1;
+      this.pageNum = 1;
+      this.init();
     },
-    onClickType() {},
     open() {},
   },
-}
+};
 </script>
 
 <style scoped>
-  .envWarn {
-    width: 100%;
-    height: 100%;
-    box-sizing: border-box;
-    padding: 20px 20px 0 20px;
-  }
-  .reply {
-    width: 100%;
-    border: 1px solid #ddd;
-    border-bottom: 0;
-    height: 50px;
-    background-color: #F3F3F3;
-    line-height: 50px;
-    font-size: 18px;
-    box-sizing: border-box;
-    padding-left: 20px;
-  }
+.envWarn {
+  width: 100%;
+  height: 100%;
+  box-sizing: border-box;
+  padding: 20px 20px 0 20px;
+}
+.reply {
+  width: 100%;
+  border: 1px solid #ddd;
+  border-bottom: 0;
+  height: 50px;
+  background-color: #f3f3f3;
+  line-height: 50px;
+  font-size: 18px;
+  box-sizing: border-box;
+  padding-left: 20px;
+}
 </style>

+ 20 - 2
src/views/Alarm/alarm-set/RegularForm.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2021-11-29 15:55:20
- * @LastEditTime: 2021-12-01 14:57:57
+ * @LastEditTime: 2021-12-05 13:24:25
  * @LastEditors: Please set LastEditors
  * @Description: 常规设置的每一项
  * @FilePath: \hyyfClient\src\views\Alarm\alarm-set\RegularForm.vue
@@ -66,6 +66,17 @@
           </el-input>
           <span class="margin-left">T/HT</span>
         </el-form-item>
+        <el-form-item label="ph值:" prop="totalFlow">
+          <el-input style="width: 200px" v-model="regularForm.ph"> </el-input>
+          <div class="margin-left block"></div>
+        </el-form-item>
+      </div>
+
+      <div class="row">
+        <el-form-item label="瞬时流量:" prop="totalFlow">
+          <el-input style="width: 200px" v-model="regularForm.flow"> </el-input>
+          <span class="margin-left">T/HT</span>
+        </el-form-item>
       </div>
     </el-form>
   </div>
@@ -95,7 +106,6 @@ export default {
     initRegular() {
       getRegularList({}).then(({ code, data }) => {
         if (code === 10000) {
-          this.regularForm = { ...data };
           if (!data) {
             this.regularForm = {
               maxTem: "未设定",
@@ -107,8 +117,11 @@ export default {
               ammonia: "未设定",
               phosphorus: "未设定",
               nitrogen: "未设定",
+              ph: "未设定",
+              flow: "未设定",
             };
           }
+          this.regularForm = { ...data };
         }
       });
     },
@@ -129,4 +142,9 @@ export default {
 .margin-left {
   padding-left: 20px;
 }
+.block {
+  display: inline-block;
+  height: 10px;
+  width: 55px;
+}
 </style>

+ 11 - 2
src/views/Alarm/alarm-set/alarm-table.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2021-11-29 17:27:07
- * @LastEditTime: 2021-12-01 16:07:07
+ * @LastEditTime: 2021-12-05 12:01:20
  * @LastEditors: Please set LastEditors
  * @Description: 报警设置的表格
  * @FilePath: \hyyfClient\src\views\Alarm\alarm-set\alarm-table.vue
@@ -95,7 +95,7 @@ export default {
           } else {
             return smallItem;
           }
-        } else {
+        } else if (rowIndex < 14) {
           if (rowIndex === 11) {
             return {
               rowspan: 3,
@@ -104,6 +104,15 @@ export default {
           } else {
             return smallItem;
           }
+        } else {
+          if (rowIndex === 14) {
+            return {
+              rowspan: 4,
+              colspan: 1,
+            };
+          } else {
+            return smallItem;
+          }
         }
       }
     },