zhaobao 2 anos atrás
pai
commit
9eeb90b5ce
2 arquivos alterados com 38 adições e 12 exclusões
  1. 10 10
      src/api/goaf/sensor.js
  2. 28 2
      src/views/particulars/sensor.vue

+ 10 - 10
src/api/goaf/sensor.js

@@ -1,40 +1,40 @@
 
 import request from '@/utils/request'
-// 获取所有传感器类型信息
+// 获取所有传感器
 export function getSensor(params) {
   return request({
-    url: '/goaf/sensortypecfg/list',
+    url: '/goaf/goafdevinfo/list',
     params
   })
 }
-// 根据类型获取传感器类型信息
-export function getSensorByType(typeId) {
+// 分页获取传感器
+export function getSensorByPage(params) {
   return request({
-    url: `/goaf/sensortypecfg/${typeId}`
+    url: '/goaf/goafdevinfo/page',
+    params
   })
 }
 // 增加
 export function createSensor(data) {
   return request({
-    url: '/goaf/sensortypecfg/add',
+    url: '/goaf/goafdevinfo/add',
     method: 'POST',
     data
   })
 }
 
 // 删除
-export function delSensor(typeId) {
+export function delSensor(goafDevId) {
   return request({
-    url: `/goaf/sensortypecfg/delete/${typeId}`
+    url: `/goaf/goafdevinfo/delete/${goafDevId}`
   })
 }
 
 // 修改
 export function updateSensor(data) {
   return request({
-    url: '/goaf/sensortypecfg/update',
+    url: '/goaf/goafdevinfo/update',
     method: 'PUT',
     data
   })
 }
-

+ 28 - 2
src/views/particulars/sensor.vue

@@ -66,7 +66,10 @@
                         </div>
                     </div> 
                     <div class="el-pagination-wrap">
-                        <el-pagination small layout="prev, pager, next" :total="50" />
+                        <el-pagination small layout="prev, pager, next" 
+                        :total="total"
+                        @size-change="handleSizeChange"
+                        @current-change="handleCurrentChange" />
                      </div>                                   
                 </div>
             </div>
@@ -104,6 +107,7 @@
 <script>
 import AlertChart from './components/AlertChart.vue'
 import WarnChart from './components/WarnChart.vue'
+import { getSensorByPage } from '@/api/goaf/sensor'
  export default {
     name:"sensor",
     components:{
@@ -114,6 +118,11 @@ import WarnChart from './components/WarnChart.vue'
         return{
             activeId:'1',
             activetab:'1',
+            conditions: {
+                page: 1,
+                limit: 8,
+                goafName:""
+            }, 
             items:[
                 {name:"首页",id:"1",path:"/particulars/sensor"},
                 {name:"压力传感器",id:"2",path:"/particulars/check"},
@@ -142,7 +151,9 @@ import WarnChart from './components/WarnChart.vue'
                 {label:1,value:2},
                 {label:2,value:3},
                 {label:3,value:4}
-            ]                      
+            ],   
+            dataList:[],
+            total:0                  
         }
     },
     created(){
@@ -155,6 +166,14 @@ import WarnChart from './components/WarnChart.vue'
                 this.$refs['warn-chart'].init();
             })
         },
+        getData(){
+            getSensorByPage(this.conditions).then((resp) => {
+                this.listLoading = false
+                const {data, total } = resp
+                this.dataList = data
+                this.total = total
+            })
+        },
         changeHead(item){
             this.activeId=item.id
             if(item.id==='5'){
@@ -176,6 +195,13 @@ import WarnChart from './components/WarnChart.vue'
                 range:0               
             }
         },
+        handleSizeChange(limit){
+            this.conditions.limit=limit
+            this.getData()
+        },
+        handleCurrentChange(pageNumber){
+            this.conditions.page=pageNumber
+        }  
     }
  }
 </script>