tremble 4 年之前
父节点
当前提交
d1f12b2735
共有 2 个文件被更改,包括 38 次插入28 次删除
  1. 0 1
      js/main_2020_show.js
  2. 38 27
      js/showHardware.js

+ 0 - 1
js/main_2020_show.js

@@ -27,7 +27,6 @@ $("#hotPannel .close").on('click',()=>{
 $("#hotPannel input.mui-switch").on('change',()=>{
     var ifOn = $('#hotPannel input.mui-switch').is(':checked');
     window.changeDeviceStatus(window.hotNeedUpdatePannel)
-    console.log('切换',window.hotNeedUpdatePannel)
 })
 
 

+ 38 - 27
js/showHardware.js

@@ -1,6 +1,6 @@
 $(function () {
-  let url = ``;
-  // let url = `http://8.135.106.227:8004/`;
+  // let url = ``;
+  let url = `http://192.168.0.135:8004`;
 
   let gName = "Gridtable";
   let grtable = document.querySelector("#gridtb");
@@ -8,6 +8,7 @@ $(function () {
     gridManagerName: gName,
     height: "300px",
     ajaxData: function (setting) {
+      console.log(setting.pageData,setting.sortData);
       // 传入分页及排序的配置项
       return getList(Object.assign({}, setting.pageData, setting.sortData));
     },
@@ -15,6 +16,7 @@ $(function () {
     supportCheckbox: false,
     supportAjaxPage: true,
     useNoTotalsMode: true,
+    pageSize:10,
     columnData: [
       {
         key: "code",
@@ -70,18 +72,27 @@ $(function () {
   let getList = function (params) {
     return new Promise((resolve, reject) => {
       $.ajax({
-        method: "GET",
+        method: "POST",
+        data : JSON.stringify({
+          "devTypeId": "",
+          "name": "",
+          "pageNum": params.cPage,
+          "pageSize": params.pSize,
+          "searchKey": "",
+          "userId": ""
+        }),
         headers: {
           "Content-Type": "application/json",
         },
         dataType: "json",
         contentType: "application/json",
-        url: url + "/api/device/list",
+        url: url + "/api/device/listPage",
+
         success: function (data) {
-          if (data.code === 0) {
+          if (data.code == 0) {
             resolve({
-              ...data,
-              totals: data.data.length,
+              data:data.data.records,
+              totals: data.data.total,
             });
           } else {
             reject(data);
@@ -93,25 +104,25 @@ $(function () {
 
   window.changeDeviceStatus = function (item) {
     console.log(item);
-    // $.ajax({
-      
-    //   method: "GET",
-    //   headers: {
-    //     "Content-Type": "application/json",
-    //   },
-    //   dataType: "json",
-    //   contentType: "application/json",
-    //   url: url + "/api/device/list",
-    //   success: function (data) {
-    //     if (data.code === 0) {
-    //       resolve({
-    //         ...data,
-    //         totals: data.data.length,
-    //       });
-    //     } else {
-    //       reject(data);
-    //     }
-    //   },
-    // });
+    let tmp = item.infoAttribute.hardware
+    $.ajax({
+      method: "GET",
+      headers: {
+        "Content-Type": "application/json",
+      },
+      dataType: "json",
+      contentType: "application/json",
+      url: url + `/api/device/control/${tmp.id}/${tmp.deviceCode}/${paramValue}/03`,
+      success: function (data) {
+        if (data.code === 0) {
+          resolve({
+            ...data,
+            totals: data.data.length,
+          });
+        } else {
+          reject(data);
+        }
+      },
+    });
   }
 });