yangjingjing vor 5 Jahren
Ursprung
Commit
b3a86dea4f
3 geänderte Dateien mit 134 neuen und 79 gelöschten Zeilen
  1. 2 2
      .env.development
  2. 121 70
      src/views/alertcenter/index.vue
  3. 11 7
      src/views/demp/monitordata/Index.vue

+ 2 - 2
.env.development

@@ -2,8 +2,8 @@
 ENV = 'development'
 
 # base api
-VUE_APP_BASE_API = 'http://101.132.105.43:8301/'
-#VUE_APP_BASE_API = 'http://127.0.0.1:8301/'
+#VUE_APP_BASE_API = 'http://101.132.105.43:8301/'
+VUE_APP_BASE_API = 'http://127.0.0.1:8301/'
 
 # vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable,
 # to control whether the babel-plugin-dynamic-import-node plugin is enabled.

+ 121 - 70
src/views/alertcenter/index.vue

@@ -2,6 +2,25 @@
   <div id="app">
     <el-container class="container">
       <el-main>
+        <div class="filter-container" v-if="user.roleName!='企业用户'">
+          <el-select v-model="ids" multiple placeholder="请选择企业" class="filter-item search-item" style="width:300px">
+            <el-option
+              v-for="item in options"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            >
+            </el-option>
+          </el-select>
+          <el-button class="filter-item" type="primary" @click="search">{{
+              $t('table.search')
+            }}
+          </el-button>
+          <el-button class="filter-item" type="success" @click="reset">{{
+              $t('table.reset')
+            }}
+          </el-button>
+        </div>
         <el-table
           style="width: 100%"
           stripe
@@ -42,7 +61,10 @@
               <!-- <span style="margin-left: 10px">{{ scope.row.eventStatus}}</span> -->
               <el-tag
                 :type="row.eventStatus| statusFilter"
-              >{{ row.eventStatus === 1 ? $t('common.alarmEvenStatus.processed') : $t('common.alarmEvenStatus.unprocessed') }}</el-tag>
+              >
+                {{ row.eventStatus === 1 ? $t('common.alarmEvenStatus.processed') : $t('common.alarmEvenStatus.unprocessed')
+                }}
+              </el-tag>
             </template>
           </el-table-column>
           <el-table-column label="处理时间" align="center">
@@ -55,7 +77,8 @@
               <!-- <span style="margin-left: 10px">{{ scope.row.isreport}}</span> -->
               <el-tag
                 :type="row.isreport| statusFilter"
-              >{{ row.isreport === 1 ? $t('common.isReport.processed') : $t('common.isReport.unprocessed') }}</el-tag>
+              >{{ row.isreport === 1 ? $t('common.isReport.processed') : $t('common.isReport.unprocessed') }}
+              </el-tag>
             </template>
           </el-table-column>
           <el-table-column label="异常原因" align="center">
@@ -64,7 +87,7 @@
             </template>
           </el-table-column>
           <el-table-column label="操作" align="center">
-            <template  slot-scope="scope">
+            <template slot-scope="scope">
               <!-- <el-button type="success" @click="removeDeviceById(scope.row.eventStatus)" v-if="scope.row.eventStatus==1">已处理</el-button> -->
               <el-button type="danger" v-if="scope.row.eventStatus==0" @click="deal(scope.row)">处理</el-button>
             </template>
@@ -73,12 +96,12 @@
         <div class="block">
           <span class="demonstration" />
           <pagination
-          v-show="total > 0"
-          :total="total"
-          :page.sync="pagination.num"
-          :limit.sync="pagination.size"
-          @pagination="test"
-        />
+            v-show="total > 0"
+            :total="total"
+            :page.sync="pagination.num"
+            :limit.sync="pagination.size"
+            @pagination="test"
+          />
         </div>
       </el-main>
     </el-container>
@@ -90,17 +113,18 @@
     >
       <el-form :model="reason">
         <el-col :span="12">
-        <el-form-item label="异常原因">
-          <el-select id="selectId" v-model="reason.region" @change="exceptionCause">
-            <el-option selected="selected" label="设备检修" value="设备检修" />
-            <el-option label="其他" value="其他" />
-          </el-select>
+          <el-form-item label="异常原因">
+            <el-select id="selectId" v-model="reason.region" @change="exceptionCause">
+              <el-option selected="selected" label="设备检修" value="设备检修" />
+              <el-option selected="selected" label="工作时间外数据" value="工作时间外数据" />
+              <el-option label="其他" value="其他" />
+            </el-select>
           </el-form-item>
         </el-col>
-          <div v-show="play">
-            <el-input id="other" v-model="reason.other" placeholder="请填写原因" style="width: 200px;"/>
-          </div>
-        
+        <div v-show="play">
+          <el-input id="other" v-model="reason.other" placeholder="请填写原因" style="width: 200px;" />
+        </div>
+
       </el-form>
       <span slot="footer" class="dialog-footer" style="text-align: center">
         <el-button @click="DealdialogVisible = false">取 消</el-button>
@@ -110,8 +134,9 @@
   </div>
 </template>
 <script>
-import Pagination from "@/components/Pagination"
+import Pagination from '@/components/Pagination'
 import { compile } from 'path-to-regexp'
+
 export default {
   components: { Pagination },
   filters: {
@@ -137,21 +162,46 @@ export default {
       play: false,
       dialogFormVisible: false,
       reason: {},
-       params: {},
+      params: {},
       total: 0,
       pagination: {
         size: 10,
-        num: 1,
+        num: 1
       },
-      selectedRow:{},
+      options: [],
+      ids: [],
+      selectedRow: {},
       DealdialogVisible: false,
       radio: 3
     }
   },
+  computed: {
+    user() {
+      return this.$store.state.account.user
+    }
+  },
   created() {
     this.test()
+    if (this.$store.state.account.user.roleName!='企业用户'){
+      this.$get('/demp/info/deviceInfo/getCompanys').then((r) => {
+        this.options = r.data.data
+        // console.log(r.data.data)
+      })
+    }
   },
   methods: {
+    reset() {
+      this.params = {}
+      this.ids = []
+      this.search()
+    },
+    search() {
+      // this.resetForm()
+      this.params.id = this.ids
+      this.test({
+        ...this.params
+      })
+    },
     exceptionCause() {
       if (this.reason.region == '其他') {
         this.play = true
@@ -159,74 +209,75 @@ export default {
         this.play = false
       }
     },
-   deal(row) {
-     this.selectedRow=row
-     this.DealdialogVisible=true
+    deal(row) {
+      this.selectedRow = row
+      this.DealdialogVisible = true
       // this.form.eventStatus = 1;
-      
+
     },
-    dealReason(){
+    dealReason() {
       // console.log(this.reason.region)
-      let reason_=this.reason.region;
-      if(this.reason.region==null){
-         this.$message({
-          message: this.$t("tips.createTips"),
-          type: "error",
+      let reason_ = this.reason.region
+      if (this.reason.region == null) {
+        this.$message({
+          message: this.$t('tips.createTips'),
+          type: 'error'
         })
         return
       }
-      if(this.reason.region == '其他'){//其他原因文本框非空校验
-      if(this.reason.other==null){
+      if (this.reason.region == '其他') {//其他原因文本框非空校验
+        if (this.reason.other == null) {
           this.$message({
-          message: this.$t("tips.createTips"),
-          type: "error",
-        })
-        return
-      }else{
-        reason_=this.reason.region+"-"+this.reason.other
-      }
+            message: this.$t('tips.createTips'),
+            type: 'error'
+          })
+          return
+        } else {
+          reason_ = this.reason.region + '-' + this.reason.other
+        }
       }
-     this.$post("/demp/info/alarmEvent/finishEvent",{ 
-            id: this.selectedRow.id,
-            reason:reason_,
-            deviceId:this.selectedRow.deviceId,
-            sensorId:this.selectedRow.sensorId,
-            start:this.selectedRow.alarmTime,
-            end:this.selectedRow.finishTime
-            }).then(() => {
-              this.$message({
-              message: this.$t("tips.executeSuccess"),
-              type: "success",
-        });
-        this.DealdialogVisible=false
-        this.test();
+      this.$post('/demp/info/alarmEvent/finishEvent', {
+        id: this.selectedRow.id,
+        reason: reason_,
+        deviceId: this.selectedRow.deviceId,
+        sensorId: this.selectedRow.sensorId,
+        start: this.selectedRow.alarmTime,
+        end: this.selectedRow.finishTime
+      }).then(() => {
+        this.$message({
+          message: this.$t('tips.executeSuccess'),
+          type: 'success'
+        })
+        this.DealdialogVisible = false
+        this.test()
       })
     },
     // 初始页currentPage、初始每页数据数pagesize和数据data
-    handleSizeChange: function (size) {
-      this.pagesize = size;
-      console.log(this.pagesize); // 每页下拉显示数据
+    handleSizeChange: function(size) {
+      this.pagesize = size
+      console.log(this.pagesize) // 每页下拉显示数据
     },
-    handleCurrentChange: function (currentPage) {
-      this.currentPage = currentPage;
-      console.log(this.currentPage); // 点击第几页
+    handleCurrentChange: function(currentPage) {
+      this.currentPage = currentPage
+      console.log(this.currentPage) // 点击第几页
     },
-    test() {
-      this.params.pageSize = this.pagination.size;
-      this.params.pageNum = this.pagination.num;
-      this.$get("/demp/info/alarmEvent/list", { ...this.params }).then((r) => {
+    test(params = {}) {
+      this.params.pageSize = this.pagination.size
+      this.params.pageNum = this.pagination.num
+      this.$get('/demp/info/alarmEvent/list', { ...this.params }).then((r) => {
         // console.log(r.data.data.rows)
-        this.tableData = r.data.data.rows;
-        this.total = r.data.data.total;
-      });
-    },
-  },
+        this.tableData = r.data.data.rows
+        this.total = r.data.data.total
+      })
+    }
+  }
 }
 </script>
 <style>
 h1 {
   text-align: center;
 }
+
 .buttons {
   margin: auto;
   margin-top: 20px;

+ 11 - 7
src/views/demp/monitordata/Index.vue

@@ -322,6 +322,12 @@ export default {
   mounted() {
     // this.initCharts()
     this.fetch1()
+    if (this.$store.state.account.user.roleName != '企业用户') {
+      this.$get('/demp/info/deviceInfo/getCompanys').then((r) => {
+        this.options = r.data.data
+        // console.log(r.data.data)
+      })
+    }
     this.dataRefreh()
 
   },
@@ -331,9 +337,10 @@ export default {
   },
   methods: {
     tableRowClassName(val) {
-      console.log(val.row.dataValue)
-      if (val.row.dataValue < val.row.lowValue || val.row.dataValue > val.row.highValue) {
-        return 'warning-row'
+      if (val.row.lowValue != null && val.row.highValue != null) {
+        if (val.row.dataValue < val.row.lowValue || val.row.dataValue > val.row.highValue) {
+          return 'warning-row'
+        }
       }
       return ''
     },
@@ -356,6 +363,7 @@ export default {
     },
     reset() {
       this.queryParams = {}
+      this.ids = []
       this.sort = {}
       this.search()
     },
@@ -376,10 +384,6 @@ export default {
         this.total = r.data.data.total
         this.loading = false
       })
-      this.$get('/demp/info/deviceInfo/getCompanys').then((r) => {
-        this.options = r.data.data
-        // console.log(r.data.data)
-      })
     },
     closedFun() {
       this.historyDataVisible = false