Przeglądaj źródła

2021-12-13 设备接口

East 3 lat temu
rodzic
commit
5951a301b5
2 zmienionych plików z 18 dodań i 42 usunięć
  1. 6 6
      src/utils/chenApi.js
  2. 12 36
      src/views/DeviceMana/Device.vue

+ 6 - 6
src/utils/chenApi.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-11-18 13:40:39
- * @LastEditTime: 2021-12-09 16:01:11
+ * @LastEditTime: 2021-12-13 16:29:38
  * @LastEditors: Please set LastEditors
  * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  * @FilePath: \hyyfClient\src\utils\chenApi.js
@@ -295,7 +295,7 @@ export function getAlarmInfo(params) {
 // 设备概况
 export function getDeviceSummer(params) {
   return axios({
-    url: 'http://192.168.1.165:8010/device/farm/device/getCountDeviceFailureRate',
+    url: 'http://120.27.234.126:8010/device/farm/device/getCountDeviceFailureRate',
     method: 'get',
     params: params
   })
@@ -304,7 +304,7 @@ export function getDeviceSummer(params) {
 // FIXME: 卓哥接口还没放到服务器上
 export function getDeviceList(params) {
   return axios({
-    url: 'http://192.168.1.165:8010/device/farm/device/listDevice',
+    url: 'http://120.27.234.126:8010/device/farm/device/listDevice',
     method: 'get',
     params: params
   })
@@ -314,7 +314,7 @@ export function getDeviceList(params) {
 // FIXME: 卓哥接口还没放到服务器上
 export function postDeviceAdd(params) {
   return axios({
-    url: 'http://192.168.1.165:8010/device/farm/device/newDevice',
+    url: 'http://120.27.234.126:8010/device/farm/device/newDevice',
     method: 'get',
     params: params
   })
@@ -324,7 +324,7 @@ export function postDeviceAdd(params) {
 // FIXME: 卓哥接口还没放到服务器上
 export function postDeviceEdit(params) {
   return axios({
-    url: 'http://192.168.1.165:8010/device/farm/device/editDevice',
+    url: 'http://120.27.234.126:8010/device/farm/device/editDevice',
     method: 'get',
     params: params
   })
@@ -334,7 +334,7 @@ export function postDeviceEdit(params) {
 // FIXME: 卓哥接口还没放到服务器上
 export function postDeviceDel(params) {
   return axios({
-    url: 'http://192.168.1.165:8010/device/farm/device/removeDevice',
+    url: 'http://120.27.234.126:8010/device/farm/device/removeDevice',
     method: 'get',
     params: params
   })

+ 12 - 36
src/views/DeviceMana/Device.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2021-12-07 14:27:28
- * @LastEditTime: 2021-12-09 16:02:13
+ * @LastEditTime: 2021-12-13 16:29:09
  * @LastEditors: Please set LastEditors
  * @Description: 设备管理页面
  * @FilePath: \hyyfClient\src\views\DeviceMana\Device.vue
@@ -105,38 +105,7 @@ export default {
         pageNum: 1,
       },
       tableData: tableData,
-      listData: [
-        {
-          name: "摄像头",
-          code: "001",
-          model: "hm-001",
-          manufacturer: "大华",
-          person: "-",
-          basicalParams: "200万像素星光级网络摄像头",
-          status: 1,
-          record: "-",
-        },
-        {
-          name: "摄像头",
-          code: "002",
-          model: "hm-002",
-          manufacturer: "大华",
-          person: "-",
-          basicalParams: "200万像素星光级网络摄像头",
-          status: 1,
-          record: "-",
-        },
-        {
-          name: "摄像头",
-          code: "003",
-          model: "hm-003",
-          manufacturer: "大华",
-          person: "-",
-          basicalParams: "200万像素星光级网络摄像头",
-          status: 1,
-          record: "-",
-        },
-      ],
+      listData: [],
       rows: [],
     };
   },
@@ -189,9 +158,7 @@ export default {
         const res = await postDeviceDel({
           ids: ids,
         });
-        this.tableFooterData.pageNum = 1;
-        this.initList();
-        this.initSummer();
+        this.reflash();
         if (res.code === 10000) {
           this.$message.success("删除成功");
         }
@@ -202,9 +169,12 @@ export default {
         pageNo: this.tableFooterData.pageNum,
         pageSize: this.tableFooterData.size,
       }).then((res) => {
+        console.log(res);
         if (res.code === 10000) {
           this.listData = res.data.content;
           this.tableFooterData.totals = res.data.totalElements;
+        } else {
+          this.$message.warning(res.message);
         }
       });
     },
@@ -212,10 +182,16 @@ export default {
       getDeviceSummer({
         bit: 2,
       }).then((res) => {
+        console.log(res);
         if (res.code === 10000) {
           this.manageItems[0].num = res.data.total;
           this.manageItems[1].num = res.data.num;
           this.manageItems[2].num = res.data.rate;
+        } else {
+          this.manageItems[0].num = "0";
+          this.manageItems[1].num = "0";
+          this.manageItems[2].num = "0";
+          this.$message.warning(res.message);
         }
       });
     },