Răsfoiți Sursa

#IQRV #comment [JS] 页面打开时获取终端信息

gifur 4 ani în urmă
părinte
comite
58b23c42ce

+ 25 - 2
addin/res/ManagerDesktop/js/page/home.js

@@ -105,7 +105,7 @@ function homeGenPage() {
     <div class="clearboth apply_button" style="padding-top:50px;">\
     <div class="control-label" style="margin-top: 8px;">&nbsp;</div>\
     <div class="controls">\
-    <button class="btn_normal_long" id="dm-refresh" onclick="GetTerminalBasicInfo()">\
+    <button class="btn_normal_long" id="dm-refresh" onclick="GetTerminalBasicInfo(true)">\
     刷新\
     </button>\
     </div>\
@@ -124,14 +124,37 @@ function homeGenPage() {
     }
 }
 
+function GetTerminalBasicInfo(val) {
+    let req = new Request();
+    req.timeout = 60000
+    RVC.DeviceControlEntityCtrl.QueryHardwareInfo(req, function(ret){
+        if (ret.errorCode === 0) {
+            let result = JSON.parse(ret['{e12a3dc0-3a0b-47c4-a8c3-75190a42ae68}'])
+            $('#terminalNo span').html(result.terminalNo);
+            $('#machineType span').html(result.machineType);
+            $('#deploySite span').html(result.site);
+            $('#softwareVersion span').html(result.termVersion);
+            $('#ip4Address span').html(result.ip[0]);
+            $('#macAddress span').html(result.mac[0]);
+        } else if(typeof val !== 'undefined'){
+            utilStartAlertDialog("获取终端信息失败:" + ErrorCodeStringfy(ret.errorCode));
+        }
+    });
+}
+
 var homeController = (function() {
 
     function initPage() {
-
+        
     }
+    var fistTime = true;
 
     function init() {
 
+        if (fistTime) {
+            fistTime = false;
+            GetTerminalBasicInfo();
+        }
     }
     
     return { init: init };

+ 0 - 18
addin/res/ManagerDesktop/js/public.js

@@ -1714,24 +1714,6 @@ function quitThisPage() {
     open(location, '_self').close();
 }
 
-function GetTerminalBasicInfo() {
-    let req = new Request();
-	req.timeout = 60000
-    RVC.DeviceControlEntityCtrl.QueryHardwareInfo(req, function(ret){
-        if (ret.errorCode === 0) {
-			let result = JSON.parse(ret['{e12a3dc0-3a0b-47c4-a8c3-75190a42ae68}'])
-            $('#terminalNo span').html(result.terminalNo);
-            $('#machineType span').html(result.machineType);
-            $('#deploySite span').html(result.site);
-            $('#softwareVersion span').html(result.termVersion);
-            $('#ip4Address span').html(result.ip[0]);
-            $('#macAddress span').html(result.mac[0]);
-        } else {
-            utilStartAlertDialog("获取终端信息失败:" + ErrorCodeStringfy(ret.errorCode));
-        }
-    });
-}
-
 function passwordRule1Check(pwd) {
     var hasnum = 0;
     var haslow = 0;