From bd432a43162a6c9bb4b2fa0b11b07fd86af531c8 Mon Sep 17 00:00:00 2001 From: LiJun <LiJun@192.168.10.24> Date: 星期一, 12 十一月 2018 15:08:05 +0800 Subject: [PATCH] 机房流量统计查询页面中的首次加载页面选中指定的机房功能完成 --- gx_tieta/WebRoot/batt-traffic-statistics1.jsp | 32 ++++++++++++++++++++++++++++---- gx_tieta/WebRoot/pages/js/mylayui.js | 4 +++- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/gx_tieta/WebRoot/batt-traffic-statistics1.jsp b/gx_tieta/WebRoot/batt-traffic-statistics1.jsp index df51077..1f3d31b 100644 --- a/gx_tieta/WebRoot/batt-traffic-statistics1.jsp +++ b/gx_tieta/WebRoot/batt-traffic-statistics1.jsp @@ -210,6 +210,9 @@ }); + var isNewLoad = true; + + var pre_province = getQueryString('province'); // 鏌ヨ鐪佷笅鎷夋 searchProvince(); // 鏌ヨ鐪� @@ -232,6 +235,9 @@ for(var i=0; i<data.length; i++) { var _data = data[i]; var _tmp = getLayuiSelect(_data, _data, {}, {}); + if(pre_province == _data && isNewLoad){ + _tmp = getLayuiSelect(_data, _data, {}, {},true); + } list.push(_tmp); } }else { @@ -260,6 +266,7 @@ var tmp = { StationName1: $("#province").val() }; + var pre_city = getQueryString('city'); // 鏍规嵁鏋勯�犳潯浠舵煡璇㈠唴瀹� $.ajax({ type: 'post', @@ -278,6 +285,9 @@ for(var i=0; i<data.length; i++) { var _data = data[i]; var _tmp = getLayuiSelect(_data.StationName2, _data.StationName2, {}, _data); + if(pre_city == _data.StationName2 && isNewLoad){ + _tmp = getLayuiSelect(_data.StationName2, _data.StationName2, {}, _data,true); + } list.push(_tmp); } }else { @@ -312,6 +322,7 @@ if(isLoad) { filterLoad = layer.load(); } + var pre_county = getQueryString('county'); // 鏍规嵁鏋勯�犳潯浠舵煡璇㈠唴瀹� $.ajax({ type: 'post', @@ -331,6 +342,9 @@ for(var i=0; i<data.length; i++) { var _data = data[i]; var _tmp = getLayuiSelect(_data.StationName5, _data.StationName5, {}, _data); + if(pre_county == _data.StationName5 && isNewLoad){ + _tmp = getLayuiSelect(_data.StationName5, _data.StationName5, {}, _data,true); + } //console.info(_tmp); list.push(_tmp); } @@ -362,6 +376,8 @@ StationName2:$("#city").val(), StationName5:$("#county").val(), }; + var pre_home = getQueryString('home'); + var auto_seach = false; // 鏍规嵁鏋勯�犳潯浠舵煡璇㈠唴瀹� $.ajax({ type: 'post', @@ -384,15 +400,23 @@ dev_id: _data.FBSDeviceId }; var _tmp = getLayuiSelect(_data.StationName, _data.StationName3, _attr, _data); + if(pre_home == _data.StationName && isNewLoad){ + _tmp = getLayuiSelect(_data.StationName, _data.StationName3, _attr, _data,true); + auto_seach = true; + } list.push(_tmp); } }else { list.push(getLayuiSelect('鏆傛棤鏈烘埧', '', {}, undefined)); } - // 鏍规嵁瀵硅薄鏁扮粍鐢熸垚涓嬫媺鍒楄〃 createLayuiSelect(ele, list); form.render('select', 'homeFilter'); + if(auto_seach){ + var temp = createSearchForm(); + sTblData(temp); + } + isNewLoad = false; } }); @@ -457,7 +481,7 @@ layer.close(loading); // 瑙f瀽鑾峰彇鐨刯son var rs = JSON.parse(result.result); - console.info(rs); + //console.info(rs); // 鍒濆鍖栨暟鎹粨鏋� tOptions.data = []; if(rs.code == 1) { @@ -569,7 +593,7 @@ // 鑾峰彇鐢熸垚鎶樼嚎鍥剧殑閰嶇疆椤� function getlineGraphOpts(data, type) { - console.log(data); + //console.log(data); var rs = { xdata:[], sdata: [], @@ -592,7 +616,7 @@ rs.unit = "M"; break; } - console.log(rs); + //console.log(rs); return rs; } }); diff --git a/gx_tieta/WebRoot/pages/js/mylayui.js b/gx_tieta/WebRoot/pages/js/mylayui.js index fb9dc1e..5aa35d8 100644 --- a/gx_tieta/WebRoot/pages/js/mylayui.js +++ b/gx_tieta/WebRoot/pages/js/mylayui.js @@ -9,6 +9,7 @@ // 璁剧疆option鐨勬枃鏈�/灞炴�у��/data鍊� option.text(_list.txt); option.val(_list.val); + option.attr('selected', _list.selected); option.data('data', _list.data); Object.keys(_list.attr).forEach(function(key){ var val = _list.attr[key]; @@ -19,7 +20,7 @@ } // 鏋勯�犵敓鎴恠elect鍒楄〃鐨勫璞℃暟缁� -function getLayuiSelect(txt, val, attr, data) { +function getLayuiSelect(txt, val, attr, data, isSelected) { var obj = { val: '', txt: '', @@ -32,6 +33,7 @@ obj.txt = txt; // option鐨勬枃鏈�� obj.attr = attr; // option鐨勮嚜瀹氫箟鐨勫睘鎬� obj.data = data; // option鐨刣ata鍊� + obj.selected = isSelected?true:false; // 杩斿洖鏋勯�犵殑瀵硅薄 return obj; -- Gitblit v1.9.1