From 2fe250ece8de95b3f70172fe5b45793ab6a3084a Mon Sep 17 00:00:00 2001 From: D:/workspace/chenjingjing/git/gx_tieta/gx_tieta/.gitignore <chenjingjing@LAPTOP-E51P2139> Date: 星期五, 18 一月 2019 17:30:50 +0800 Subject: [PATCH] 未审批可更改 --- gx_tieta/WebRoot/elegroup.jsp | 632 ++++++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 514 insertions(+), 118 deletions(-) diff --git a/gx_tieta/WebRoot/elegroup.jsp b/gx_tieta/WebRoot/elegroup.jsp index f2b48db..f98ff46 100644 --- a/gx_tieta/WebRoot/elegroup.jsp +++ b/gx_tieta/WebRoot/elegroup.jsp @@ -13,11 +13,44 @@ <title><s:text name="Package_unit_manage"/></title> <link rel="stylesheet" type="text/css" href="css/basic.css"> <link rel="stylesheet" type="text/css" href="css/elegroup.css"> - + <link rel="stylesheet" type="text/css" href="font-awesome-4.7.0/css/font-awesome.css"> + <link rel="stylesheet" href="src/css/layui.css"> <script type="text/javascript" src="js/frame.js"></script> <script type="text/javascript" src="js/jquery-1.8.3.js"></script> <script type="text/javascript" src="js/base.js"></script> - + <style> + .toolbar-fixed-top-right { + position: absolute; + top: 0; + right: 0; + z-index: 99; + } + .toolbar-fixed-top-right.right10 { + right: 10px; + } + .toolbar-fixed-top-right.right20 { + right: 20px; + } + .toolbar-fixed-top-right.top3 { + top: 5px; + } + .toolbar-fixed-top-right select { + font-size: 12px; + height: 26px; + vertical-align: top; + border: 1px solid #ccc; + margin-right: 4px; + } + .toolbar-fixed-top-right a.tool-btn{ + display: inline-block; + margin-right: 10px; + color: #000; + font-size: 20px; + } + .toolbar-fixed-top-right a.tool-btn:hover { + color: #1495E7; + } + </style> </head> <body> <!--澶撮儴鍐呭寮�濮�--> @@ -35,25 +68,27 @@ <!-- 缁存姢鍖轰俊鎭� --> <table> <tr class="fWeight"> - <td><s:text name="Maintenance_area"/></td> <!-- 缁存姢鍖� --> + <td>鐪�</td> <!-- 鐪� --> + <td>甯�</td> <!-- 甯� --> + <td>鍖�/鍘�</td> <!-- 鍖�/鍘� --> <td><s:text name="Computer_site"/></td> <!-- 鏈烘埧绔欑偣锛堟垨鏈烘埧璁惧锛� --> <td><s:text name="Battery"/></td> <!-- 钃勭數姹犵粍 --> </tr> <tr> <td> - <select id="station_name1" name=""> - - </select> + <select id="station_name1" name=""></select> </td> <td> - <select id="station_name" name=""> - - </select> + <select id="city" name=""></select> </td> <td> - <select id="battgroup_name" name=""> - - </select> + <select id="county" name=""></select> + </td> + <td> + <select id="station_name" name=""></select> + </td> + <td> + <select id="battgroup_name" name=""></select> </td> </tr> </table> @@ -68,6 +103,19 @@ </div> <!-- 鍙充笂瀹瑰櫒 --> <div id="rtop"> + <div class="toolbar-fixed-top-right top3 right20"> + <select name="addType" id="addType"> + <option value="0">鍏ㄧ渷鏈烘埧</option> + <option value="1">鍏ㄥ競鏈烘埧</option> + <option value="2">鍏ㄥ競鍖�/鍘挎埧</option> + <option value="3">鍗曚釜鏈烘埧</option> + <option value="4">鐢垫睜缁�</option> + </select> + <a href="javasscript:;" class="tool-btn" id="toolBtnAdd" title="娣诲姞"><i class="fa fa-plus"></i></a> + <a href="javasscript:;" class="tool-btn" id="toolBtnApply" title="搴旂敤"><i class="fa fa-sticky-note-o"></i></a> + <a href="javasscript:;" class="tool-btn" id="toolBtnAll" title="鍏ㄩ��"><i class="fa fa-check-square-o"></i></a> + <a href="javasscript:;" class="tool-btn" id="toolBtnDel" title="绉婚櫎"><i class="fa fa-trash-o"></i></a> + </div> <table style="width:100%"> <thead> <tr> @@ -109,8 +157,11 @@ <!-- 鍙抽敭琛ㄦ牸鑿滃崟 --> <div id="tb-right-menu"> <a href="javascript:;" class="apply"><s:text name="Apply"/></a> <!-- 搴旂敤 --> - <a href="javascript:;" class="add-batt"><s:text name="Add_single_batt_group"/></a> <!-- 娣诲姞鍗曚釜鐢垫睜缁� --> + <a href="javascript:;" class="add-province">娣诲姞鍏ㄧ渷鏈烘埧</a> <!-- 娣诲姞鍏ㄧ渷鏈烘埧 --> + <a href="javascript:;" class="add-city">娣诲姞鍏ㄥ競鏈烘埧</a> + <a href="javascript:;" class="add-county">娣诲姞鍏ㄥ尯/鍘挎満鎴�</a> <!-- 娣诲姞鍏ㄥ競鏈烘埧 --> <a href="javascript:;" class="add-station"><s:text name="Add_all_Chartere_room_batt_group"/></a> <!-- 娣诲姞鏁翠釜鏈烘埧鐢垫睜缁� --> + <a href="javascript:;" class="add-batt"><s:text name="Add_single_batt_group"/></a> <!-- 娣诲姞鍗曚釜鐢垫睜缁� --> <!--<a href="javascript:;" class="add-weihuqu"><s:text name="Add_maintenance_area_batt_group"/></a> 娣诲姞鏁翠釜缁存姢鍖虹數姹犵粍 --> <div class="a-con"> <a href="javascript:;" class="all-pitch"><s:text name="All_selected"/></a> <!-- 鍏ㄩ儴閫変腑 --> @@ -162,6 +213,7 @@ </body> <script type="text/javascript" src="js/buildNav.js"></script> <script type="text/javascript" src="js/createTab.js"></script> +<script type="text/javascript" src="src/layui.all.js"></script> <script type="text/javascript"> var permits; <% Object obj=session.getAttribute("permits"); @@ -255,7 +307,7 @@ } }); - setUserName(); + //setUserName(); //椤甸潰鍔犺浇瀹岀敓鎴愬寘鏈虹粍鍒楄〃 searchAllbaojiGroup(); @@ -372,8 +424,9 @@ createBattTable(allbattstation); addTdIdx($('#tbroom table tbody td'),battstationIdList); } - $('#station_num').text(totalstationNum); - $('#batt_num').text(totalbattNum); + getbattStationlength(); + /* $('#station_num').text(totalstationNum); + $('#batt_num').text(totalbattNum); */ }); } } @@ -520,9 +573,9 @@ //console.info(data); var model=eval("("+data.result+")"); if(model.code==1){ - alert(model.msg); + layer.msg(model.msg); }else{ - alert(model.msg); + layer.msg(model.msg); } $('#lbottom .li-con ul').remove(); searchAllbaojiGroup(); @@ -531,10 +584,10 @@ $('#allShade').hide(); }); }else{ - alert('<s:text name="The_baoji_group_name_already_exists,Please_enter_a_different_set_of_names"/>!'); /* 璇ュ寘鏈虹粍鍚嶅凡缁忓瓨鍦�,璇疯緭鍏ュ叾浠栫粍鍚� */ + layer.msg('<s:text name="The_baoji_group_name_already_exists,Please_enter_a_different_set_of_names"/>!'); /* 璇ュ寘鏈虹粍鍚嶅凡缁忓瓨鍦�,璇疯緭鍏ュ叾浠栫粍鍚� */ } }else{ - alert('<s:text name="Can_not_be_empty"/>锛侊紒锛�'); /* 涓嶈兘涓虹┖ */ + layer.msg('<s:text name="Can_not_be_empty"/>锛侊紒锛�'); /* 涓嶈兘涓虹┖ */ } }); //鐐瑰嚮缂栬緫鎸夐挳缁欏綋鍓嶈娣诲姞class @@ -571,7 +624,7 @@ if(flag){ $.post('User_battgroup_baojigroupAction!update','us.baoji_group_id='+id+'&us.baoji_group_name='+txtVal,function(data){ var model=eval("("+data.result+")"); - alert(model.msg); + layer.msg(model.msg); $('#lbottom .li-con ul').remove(); searchAllbaojiGroup(); //闅愯棌閲嶅懡鍚嶇獥鍙� @@ -579,29 +632,33 @@ $('#allShade').hide(); }); }else{ - alert('<s:text name="The_baoji_group_name_already_exists,Please_enter_a_different_set_of_names"/>!'); /* 璇ュ寘鏈虹粍鍚嶅凡缁忓瓨鍦�,璇疯緭鍏ュ叾浠栫粍鍚� */ + layer.msg('<s:text name="The_baoji_group_name_already_exists,Please_enter_a_different_set_of_names"/>!'); /* 璇ュ寘鏈虹粍鍚嶅凡缁忓瓨鍦�,璇疯緭鍏ュ叾浠栫粍鍚� */ } }else{ - alert('<s:text name="Can_not_be_empty"/>锛侊紒锛�'); /* 涓嶈兘涓虹┖ */ + layer.msg('<s:text name="Can_not_be_empty"/>锛侊紒锛�'); /* 涓嶈兘涓虹┖ */ } }); //鐐瑰嚮鍒犻櫎鎸夐挳 $('#right-menu .del-group').live('click',function(){ var oLi=$('#lbottom .li-con li').eq(LiIndex); - if(confirm("<s:text name='Confirm_del'/>'"+oLi.text()+"'锛�")){ /* 纭鍒犻櫎鍖呮満缁� */ + // 鍙栦汉鍒犻櫎鍖呮満缁� + layer.confirm("<s:text name='Confirm_del'/>'"+oLi.text()+"'锛�", {icon:3, title: '绯荤粺鎻愮ず'}, function(index) { + layer.close(index); var baojigroupid=oLi.attr('value'); + loading.showLoading(); $.post('User_battgroup_baojigroupAction!delete','us.baoji_group_id='+baojigroupid+"&us.baoji_group_name="+oLi.text(),function(data){ + loading.hideLoading(); var model=eval("("+data.result+")"); if(model.code==1){ - alert(model.msg); + layer.msg(model.msg); }else{ - alert(model.msg); + layer.msg(model.msg); } $('#lbottom .li-con ul').remove(); searchAllbaojiGroup(); }); - } + }); }); }); @@ -722,17 +779,24 @@ $('#right-menu').on('click','.del-user',function(){ var ouserLi=$('#rbottom .li-con li').eq(LiIndex); var obaoLi=$('#lbottom .li-con li.b8cfe5'); - if(confirm('<s:text name="Determine"/><s:text name="From"/>:'+obaoLi.text()+'<s:text name="Delete"/>:'+ouserLi.text()+"?")){ //纭畾浠庡寘鏈虹粍 鍚�? - var num=ouserLi.attr('num'); - var temp = {num:num,uname:ouserLi.text(),baoji_group_name:obaoLi.text()}; - $.post('User_battgroup_baojigroup_usrAction!delete',"json="+JSON.stringify(temp),function(data){ - var model=eval("("+data.result+")"); - alert(model.msg); - searchBaojiZuUser(obaoLi.attr('value')); + // 鎻愮ず鏄惁鍒犻櫎鍖呮満鐢ㄦ埛 + layer.confirm( + '<s:text name="Determine"/><s:text name="From"/>'+obaoLi.text()+'<s:text name="Delete"/>'+ouserLi.text()+"?", + {icon:3,title:'绯荤粺鎻愮ず'}, + function(index) { + layer.close(index); + var num=ouserLi.attr('num'); + var temp = {num:num,uname:ouserLi.text(),baoji_group_name:obaoLi.text()}; + loading.showLoading(); + $.post('User_battgroup_baojigroup_usrAction!delete',"json="+JSON.stringify(temp),function(data){ + loading.hideLoading(); + var model=eval("("+data.result+")"); + layer.msg(model.msg); + searchBaojiZuUser(obaoLi.attr('value')); + }); + //鍒犻櫎閫変腑鐨勮 + $('#rbottom .li-con li').eq(LiIndex).remove(); }); - //鍒犻櫎閫変腑鐨勮 - $('#rbottom .li-con li').eq(LiIndex).remove(); - } }); $('#right-menu').on('click','.apply',function(data){ @@ -750,15 +814,20 @@ }); } var json=window.JSON.stringify(baoji_user); + + // 鏄剧ず绛夊緟妗� + loading.showLoading(); //console.info(json); $.post('User_battgroup_baojigroup_usrAction!add',"json="+json,function(data){ var model=eval("("+data.result+")"); - alert(model.msg); + layer.msg(model.msg); var baojizuid=$('#lbottom .li-con li.b8cfe5').attr('value'); searchBaojiZuUser(baojizuid); + // 闅愯棌绛夊緟妗� + loading.hideLoading(); }); }else{ - alert('<s:text name="There_is_nothing_to_be_done"/>'); /* 娌℃湁浠�涔堝彲浠ュ仛鐨� */ + layer.msg('<s:text name="There_is_nothing_to_be_done"/>'); /* 娌℃湁浠�涔堝彲浠ュ仛鐨� */ } }); //鐐瑰嚮鏌ョ湅鍖呮満缁勬晥鏋� @@ -875,93 +944,207 @@ }); } } - - $(document).ready(function(){ + + // 鐪�-甯�-鏈烘埧-鐢垫睜缁� + $(document).ready(function(){ //椤甸潰鍔犺浇鏃舵煡璇㈢淮鎶ゅ尯涓殑鏋㈢航绫诲瀷 - $.post("BattInfAction_serchByStation",null,function(data){ + $.post("BattInfAction!serchAllStation_all",null,function(data){ + //console.info(data); data=data.result; data=eval("("+data+")"); //console.info(data); if(data.code==1 && data.data.length>0){ - var Ostation_name1=document.getElementById("station_name1"); - Ostation_name1.innerHTML=""; + var $select = $("#station_name1"); + $select.text(''); for(var i=0;i<=data.data.length;i++){ - option=createEle("option"); + $option=$("<option></option>"); if(i==0){ - option.innerHTML="<s:text name='All'/>(<s:text name='Common'/>"+data.sum+"<s:text name='Species'/>)"; /* 鍏ㄩ儴 鍏� 绉� */ - option.setAttribute("value", ""); + $option.html("<s:text name='All'/>(<s:text name='Common'/>"+data.data.length+"<s:text name='Species'/>)"); + $option.attr("value", ""); }else{ - option.innerHTML=data.data[i-1].StationName1; - option.setAttribute("value",data.data[i-1].StationName1); + $option.text(data.data[i-1].StationName1); + $option.attr("value",data.data[i-1].StationName1); } - Ostation_name1.appendChild(option); - } + $select.append($option); + } + }else{ + $("#station_name1").text('').html('<option>鏆傛湭娣诲姞鐪�</option>'); } - findStationNamebyStationname1(); - }); - - //褰撶淮鎶ゅ尯鐨勫�煎彉鎹㈡椂鏇存柊鏈烘埧绔欑偣 - $('#station_name1').change(function(){ - findStationNamebyStationname1() + findCity(); }); }); - //鏍规嵁缁存姢鍖烘煡璇㈢珯鐐� - function findStationNamebyStationname1(){ - var selectvalue=$("#station_name1 option:selected").val(); - $.post("BattInfAction_serchByStationName","bif.StationName1="+selectvalue,function(data){ - data=data.result; - data=eval("("+data+")"); - if(data.code==1 && data.data.length>0){ - var Ostttion_name = document.getElementById("station_name"); - Ostttion_name.innerHTML=""; - for(var i=0;i<=data.data.length;i++){ - option=createEle("option"); - if(i==0){ - option.innerHTML="<s:text name='All'/>(<s:text name='Common'/>"+data.sum+"<s:text name='Species'/>)"; - option.setAttribute("value", ""); - }else{ - option.innerHTML=data.data[i-1].StationName; - option.setAttribute("value",data.data[i-1].StationName); - } - Ostttion_name.appendChild(option); + // 鏍规嵁缁存姢鍖虹殑鍐呭鏌ヨ甯� + function findCity() { + var data = { + StationName1: $("#station_name1").val() + }; + // 璇锋眰鑾峰彇褰撳墠鐪佷笅鐨勫競 + $.ajax({ + type: "post", + url: "BattInfAction!serchStationName2_all", + async:true, + dataType:'json', + data:"json = "+JSON.stringify(data), + success: function(data){ + var rs = JSON.parse(data.result); + var $select = $("#city"); + if(rs.code == 1) { + var _data= rs.data; + // 鏍规嵁鏁版嵁鏋勯�犵敓鎴愪笅鎷夊垪琛ㄧ殑鏁版嵁 + var optsList = []; + for(var i=0;i<_data.length;i++){ + var __data = _data[i]; + var tmp = getOptionsData(__data.StationName2, __data.StationName2, __data); + optsList.push(tmp); + } + // 鏍规嵁鏁版嵁鐢熸垚涓嬫媺鍒楄〃 + createOptions($select, optsList, true); + }else { + $select.text('').html('<option>鏆傛棤鍙祴甯�</option>'); + } + findCounty(); + } + }); + } + + // 鏌ヨ鍖�/鍘� + function findCounty() { + var tmp = { + StationName1:$("#station_name1").val(), + StationName2:$("#city").val(), + }; + + // 鏌ヨ鍖哄幙 + $.ajax({ + type: 'post', + async: true, + url: "BattInfAction!serchStationName5_all", + data: "json="+JSON.stringify(tmp), + success:function(data) { + var rs = JSON.parse(data.result); + var $select = $("#county"); + if(rs.code==1){ + var _data = rs.data; + // 鏍规嵁鏁版嵁鏋勯�犵敓鎴愪笅鎷夊垪琛ㄧ殑鏁版嵁 + var optsList = []; + for(var i=0;i<_data.length;i++){ + var __data = _data[i]; + var _attr = { + StationId: __data.StationId + }; + var tmp = getOptionsData(__data.StationName5, __data.StationName5, __data, _attr); + optsList.push(tmp); + } + + // 鏍规嵁鏁版嵁鐢熸垚涓嬫媺鍒楄〃 + createOptions($select, optsList, true); + }else{ + $select.text('').html('<option>鏆傛棤鍙祴鏈烘埧绔欑偣</option>'); } + findStationNamebyStationname1(); } - findserchByBattGroupNamebystationname(); }); - $('#station_name').change(function(){ + } + + //褰撶淮鎶ゅ尯鐨勫�煎彉鎹㈡椂鏇存柊甯� + $('#station_name1').change(function(){ + findCity(); + }); + + //褰撶淮鎶ゅ尯鐨勫�煎彉鎹㈡椂鏇存柊鏈烘埧绔欑偣 + $('#city').change(function(){ + findCounty(); + }); + + //褰撳尯/鍘跨殑鍊煎彉鎹㈡椂鏇存柊鏈烘埧绔欑偣 + $('#county').change(function(){ + findStationNamebyStationname1(); + }); + + //鏍规嵁鐪侊紝甯傛煡璇㈢珯鐐� + function findStationNamebyStationname1(){ + var tmp = { + StationName1:$("#station_name1").val(), + StationName2:$("#city").val(), + StationName5:$("#county").val() + }; + //var selectvalue=$("#station_name1 option:selected").val(); + //alert(selectvalue); + $.post("BattInfAction!serchStationName3_all","json="+JSON.stringify(tmp),function(data){ + var rs = JSON.parse(data.result); + if(rs.code==1){ + var _data = rs.data; + var $select = $("#station_name"); + // 鏍规嵁鏁版嵁鏋勯�犵敓鎴愪笅鎷夊垪琛ㄧ殑鏁版嵁 + var optsList = []; + for(var i=0;i<_data.length;i++){ + var __data = _data[i]; + var _attr = { + StationId: __data.StationId + }; + var tmp = getOptionsData(__data.StationName, __data.StationName, __data, _attr); + optsList.push(tmp); + } + + // 鏍规嵁鏁版嵁鐢熸垚涓嬫媺鍒楄〃 + createOptions($select, optsList, true); + }else{ + $("#station_name").text('').html('<option>鏆傛棤鍙祴鏈烘埧绔欑偣</option>'); + } findserchByBattGroupNamebystationname(); }); } - //鏍规嵁缁存姢鍖哄拰鏈烘埧鏌ヨ钃勭數姹犵粍 + // 鏍规嵁鏈烘埧鍚嶇О鏌ヨ鐢垫睜缁� + $('#station_name').change(function(){ + findserchByBattGroupNamebystationname(); + }); + + //鏍规嵁鐪侊紝甯傚拰鏈烘埧鏌ヨ钃勭數姹犵粍 function findserchByBattGroupNamebystationname(){ - var station_name1=$("#station_name1 option:selected").val(); - var station_name=$("#station_name option:selected").val(); + var stationid = $("#station_name").find('option:selected').attr('stationid')?$("#station_name").find('option:selected').attr('stationid'):''; + // 鏋勯�犳煡璇㈡潯浠� + var tmp = { + StationName1:$("#station_name1").val(), + StationName2:$("#city").val(), + StationName5:$("#county").val(), + StationName: $("#station_name").val(), + StationId: stationid + }; + + //var station_name1=$("#station_name1 option:selected").val(); + //var station_name=$("#station_name option:selected").val(); - $.post("BattInfAction_serchByBattGroupName","bif.StationName1="+station_name1+"&bif.StationName="+station_name,function(data){ + $.post("BattInfAction!serchBattByStation_all","json="+JSON.stringify(tmp),function(data){ data=data.result; + //console.info(data); data=eval("("+data+")"); - //console.info(data.data); + //console.info(data); if(data.code==1 && data.data.length>0){ - - var Obattgroup_name = document.getElementById("battgroup_name"); - Obattgroup_name.innerHTML=""; - - for(var i=0;i<=data.data.length;i++){ - option=createEle("option"); - if(i!=0){ - option.innerHTML=data.data[i-1].BattGroupName+"-"+data.data[i-1].MonCount+"<s:text name='Section'/>"; - option.setAttribute("value",data.data[i-1].BattGroupId); - }else{ - option.innerHTML="<s:text name='All'/>(<s:text name='Common'/>"+data.sum+"<s:text name='Species'/>)"; - option.setAttribute("value", "0"); - } - Obattgroup_name.appendChild(option); + var $select = $("#battgroup_name"); + // 鏍规嵁鏁版嵁鏋勯�犵敓鎴愪笅鎷夊垪琛ㄧ殑鏁版嵁 + var optsList = []; + for(var i=0;i<data.data.length;i++){ + var _data = data.data[i]; + var _attr = { + stationname: _data.StationName, + dev_id: _data.FBSDeviceId, + batt_num: _data.GroupIndexInFBSDevice+1 + }; + var txt = _data.BattGroupName+'-'+_data.MonCount+"<s:text name='Section'/>"; + var tmp = getOptionsData(txt, _data.BattGroupId, _data, _attr); + optsList.push(tmp); } + + // 鏍规嵁鏁版嵁鐢熸垚涓嬫媺鍒楄〃 + createOptions($select, optsList, true); + $select.find('option').eq(0).val(0); + }else{ + $("#battgroup_name").text('').html('<option>鏆傛棤鍙祴钃勭數姹犵粍</option>'); } }); - } + } //榧犳爣鍙抽敭鐐瑰嚮 $('#tbroom').on('mousedown','table tr',function(e){ @@ -1251,15 +1434,146 @@ showAllTd(bigEleGroupTxt,bigEleGroupVal); } + + // 娣诲姞鏁翠釜鐪佺殑鏈烘埧 + $('#tb-right-menu .add-province').click(function() { + //鑾峰彇鍖呮満鎴垮悕绉板拰鏂板鐢垫睜缁勫悕绉� + var myRoom=new Array(); + var myRoomVal=new Array(); + var singleELeGroup=new Array(); + var singleEleVal=new Array(); + var province=$('#station_name1').attr('value'); + if(province.length>0 && $('#lbottom .li-con li.b8cfe5').text().length>0){ + var binf=new Object(); + binf={ + BattGroupId: 0, // 鐢垫睜缁刬d + StationName: '', // 鏈烘埧鍚嶇О + StationName5: '', // 鍖�/鍘� + StationName2: '', // 甯� + StationName1: province, // 鐪� + }; + var json=window.JSON.stringify(binf); + $.post('BattInfAction!serchBatt','result='+json,function(data){ + var model=eval("("+data.result+")"); + //console.info(model); + if(model.code==1 && model.data.length>0){ + //var stationid=0; + for(var i=0;i<model.data.length;i++){ + var batt=model.data[i]; + //console.info(batt); + myRoom.push(batt.StationName); + myRoomVal.push(batt.StationId); + singleELeGroup.push(batt.StationName); + singleELeGroup.push(batt.BattGroupName); + singleEleVal.push(batt.StationId); + singleEleVal.push(batt.BattGroupId); + } + //console.info(singleELeGroup); + addRedLi(myRoom,myRoomVal,singleELeGroup,singleEleVal); + } + }); + }else{ + layer.msg('璇烽�夋嫨鐪�!'); //璇峰厛閫夋嫨鐪� + } + }); + + // 娣诲姞鏁翠釜甯傜殑鏈烘埧 + $('#tb-right-menu .add-city').click(function() { + //鑾峰彇鍖呮満鎴垮悕绉板拰鏂板鐢垫睜缁勫悕绉� + var myRoom=new Array(); + var myRoomVal=new Array(); + var singleELeGroup=new Array(); + var singleEleVal=new Array(); + var city = $('#city').attr('value'); + if(city.length>0 && $('#lbottom .li-con li.b8cfe5').text().length>0){ + var binf=new Object(); + binf={ + BattGroupId: 0, // 鐢垫睜缁刬d + StationName: '', // 鏈烘埧鍚嶇О + StationName5: '', // 鍖�/鍘� + StationName2: city, // 甯� + StationName1: '', // 鐪� + }; + //console.log(binf); + var json=window.JSON.stringify(binf); + $.post('BattInfAction!serchBatt','result='+json,function(data){ + var model=eval("("+data.result+")"); + //console.info(model); + if(model.code==1 && model.data.length>0){ + //var stationid=0; + for(var i=0;i<model.data.length;i++){ + var batt=model.data[i]; + //console.info(batt); + myRoom.push(batt.StationName); + myRoomVal.push(batt.StationId); + singleELeGroup.push(batt.StationName); + singleELeGroup.push(batt.BattGroupName); + singleEleVal.push(batt.StationId); + singleEleVal.push(batt.BattGroupId); + } + //console.info(singleELeGroup); + addRedLi(myRoom,myRoomVal,singleELeGroup,singleEleVal); + } + }); + }else{ + layer.msg('璇烽�夋嫨甯�!'); //璇峰厛閫夋嫨甯� + } + }); + + // 娣诲姞鏁翠釜鍖�/鍘跨殑鏈烘埧 + $('#tb-right-menu .add-county').click(function() { + //鑾峰彇鍖呮満鎴垮悕绉板拰鏂板鐢垫睜缁勫悕绉� + var myRoom=new Array(); + var myRoomVal=new Array(); + var singleELeGroup=new Array(); + var singleEleVal=new Array(); + var county = $('#county').attr('value'); + if(county.length>0 && $('#lbottom .li-con li.b8cfe5').text().length>0){ + var binf=new Object(); + binf={ + BattGroupId: 0, // 鐢垫睜缁刬d + StationName: '', // 鏈烘埧鍚嶇О + StationName5: county, // 鍖�/鍘� + StationName2: '', // 甯� + StationName1: '', // 鐪� + }; + //console.log(binf); + var json=window.JSON.stringify(binf); + $.post('BattInfAction!serchBatt','result='+json,function(data){ + var model=eval("("+data.result+")"); + console.info(model); + if(model.code==1 && model.data.length>0){ + //var stationid=0; + for(var i=0;i<model.data.length;i++){ + var batt=model.data[i]; + //console.info(batt); + myRoom.push(batt.StationName); + myRoomVal.push(batt.StationId); + singleELeGroup.push(batt.StationName); + singleELeGroup.push(batt.BattGroupName); + singleEleVal.push(batt.StationId); + singleEleVal.push(batt.BattGroupId); + } + //console.info(singleELeGroup); + addRedLi(myRoom,myRoomVal,singleELeGroup,singleEleVal); + } + }); + }else{ + layer.msg('璇烽�夋嫨鍖�/鍘�!'); //璇峰厛閫夋嫨鍖�/鍘� + } + }); + //娣诲姞鍗曚釜鐢垫睜缁� $('#tb-right-menu .add-batt').click(function(){ var battgrouid= $('#battgroup_name').attr('value'); if(battgrouid!=0 && $('#lbottom .li-con li.b8cfe5').text().length>0){ var binf=new Object(); binf={ - BattGroupId:battgrouid, - StationName:'', - StationName1:'', + BattGroupId: battgrouid, // 鐢垫睜缁刬d + StationName: '', // 鏈烘埧鍚嶇О + StationName5: '', // 鍖�/鍘� + StationName2: '', // 甯� + StationName1: '', // 鐪� }; var json=window.JSON.stringify(binf); $.post('BattInfAction!serchBatt','result='+json,function(data){ @@ -1282,7 +1596,7 @@ } }); }else{ - alert('<s:text name="Please_choose_a_group_of_battery_pack!"/>'); + layer.msg('<s:text name="Please_choose_a_group_of_battery_pack!"/>'); } }); //娣诲姞鏁翠釜鏈烘埧鐨勭數姹犵粍 @@ -1296,9 +1610,11 @@ if(stationname.length>0 && $('#lbottom .li-con li.b8cfe5').text().length>0){ var binf=new Object(); binf={ - BattGroupId:0, - StationName:stationname, - StationName1:'', + BattGroupId: 0, // 鐢垫睜缁刬d + StationName: stationname, // 鏈烘埧鍚嶇О + StationName5: '', // 鍖�/鍘� + StationName2: '', // 甯� + StationName1: '', // 鐪� }; var json=window.JSON.stringify(binf); $.post('BattInfAction!serchBatt','result='+json,function(data){ @@ -1321,13 +1637,15 @@ } }); }else{ - alert('<s:text name="Please_select_a_set_of_Computer_room"/>!'); //璇峰厛閫夋嫨涓�缁勬満鎴� + layer.msg('<s:text name="Please_select_a_set_of_Computer_room"/>!'); //璇峰厛閫夋嫨涓�缁勬満鎴� } }); //鍒犻櫎褰撳墠鐨勮鐢垫睜缁� $('#tb-right-menu .del').click(function(){ var baojiLi=$('#lbottom .li-con li.b8cfe5'); - if(confirm('<s:text name="Confirm_that_the_selected_battery_pack_is_removed_from_the_package"/>锛�')){ + // 鏄惁纭鍒犻櫎鐢垫睜缁� + layer.confirm('<s:text name="Confirm_that_the_selected_battery_pack_is_removed_from_the_package"/>锛�',{icon:3, title: '绯荤粺鎻愮ず'},function(index) { + layer.close(index); var removeArray=new Array(); var redTr=$('#tbroom table .red'); //闇�瑕佸垽鏂槸鍚﹀惈鏈夋柊娣诲姞鐨勭數姹犵粍 @@ -1342,9 +1660,11 @@ }); if(removeArray.length>0){ var json=window.JSON.stringify(removeArray); + loading.showLoading(); $.post('User_battgroup_baojigroup_battgroupAction!delete','result='+json,function(data){ + loading.hideLoading(); var model=eval("("+data.result+")"); - alert(model.msg); + layer.msg(model.msg); searchAllBattstation(baojiLi.attr('value')); }); bigEleGroupTxt=new Array(); @@ -1381,8 +1701,8 @@ removeLeftli(removeLi[i]); } getbattStationlength(); - } - } + } + }); }); //绉婚櫎宸﹁竟鍒楄〃涓璿alue='stationid'鐨刲i @@ -1418,15 +1738,17 @@ if(newBatt.length!=0){ var json=window.JSON.stringify(newBatt); //console.info(json); + loading.showLoading(); $.post('User_battgroup_baojigroup_battgroupAction!add','result='+json,function(data){ + loading.hideLoading(); var model=eval("("+data.result+")"); - alert(model.msg); + layer.msg(model.msg); searchAllBattstation(baojiLi.attr('value')); bigEleGroupTxt=new Array(); bigEleGroupVal=new Array(); }); }else{ - alert('<s:text name="There_is_nothing_to_be_done"/>'); /* 娌℃湁浠�涔堝彲浠ュ仛鐨� */ + layer.msg('<s:text name="There_is_nothing_to_be_done"/>'); /* 娌℃湁浠�涔堝彲浠ュ仛鐨� */ } }); @@ -1456,13 +1778,14 @@ } } } - console.info(oldArrVal); + //console.info(oldArrVal); } //鏄剧ず鎵�鏈夌殑鍗曞厓鏍� function showAllTd(bigArrTxt,bigArrVal){ + var tmp = battstationList[0]?battstationList[0]:[]; //鍒涘缓琛ㄦ牸 - createTablenew($('#tbroom'),ArrTh,battstationList[0]); + createTablenew($('#tbroom'),ArrTh,tmp); //console.info(ArrTd); for(var i=1;i<battstationList.length;i++) { @@ -1493,11 +1816,16 @@ // 璁╁鍣ㄥ唴鐨勮〃鏍煎搴︿竴鑷� $('#rtop table').width(tbRoomWidth-20); getbattStationlength(); + //console.info(bigArrTxt); + if(bigArrTxt.length != 0) { + // 璁惧琛ㄦ牸婊氬姩鍒伴《閮� + scrollBottom($('#tbroom'), $('#tbroom table')); + // 鏈烘埧鍒楄〃婊氬姩鍒伴《閮� + scrollBottom($('#ltop .li-con'), $('#ltop .li-con ul')); + }else { + layer.msg('娣诲姞鐨勫唴瀹瑰凡瀛樺湪锛�'); + } - // 璁惧琛ㄦ牸婊氬姩鍒伴《閮� - scrollBottom($('#tbroom'), $('#tbroom table')); - // 鏈烘埧鍒楄〃婊氬姩鍒伴《閮� - scrollBottom($('#ltop .li-con'), $('#ltop .li-con ul')); } //娣诲姞琛ㄦ牸鐨勪竴琛� @@ -1609,5 +1937,73 @@ _rsObj.tblAttr = _rsId; return _rsObj; } + + // 缁欐ā鍧楁坊鍔犲伐鍏锋潯 + $(function() { + $('.toolbar-fixed-top-right').tooltip(); + + // 鐐瑰嚮娣诲姞鎸夐挳 + $('#toolBtnAdd').click(function() { + var baoji = $('#lbottom .li-con li.b8cfe5').text(); + if(baoji.length == 0) { + layer.msg('璇烽�夋嫨宸︿笅鏂圭殑鍖呮満缁勶紒锛侊紒'); + }else { + var addType = $('#addType').val(); + addBattGroup(addType); + } + }); + + // 鐐瑰嚮搴旂敤鎸夐挳 + $('#toolBtnApply').click(function() { + var baoji = $('#lbottom .li-con li.b8cfe5').text(); + if(baoji.length == 0) { + layer.msg('璇烽�夋嫨宸︿笅鏂圭殑鍖呮満缁勶紒锛侊紒'); + }else { + $('#tb-right-menu .apply').click(); + } + }); + + // 鐐瑰嚮鍏ㄩ�夋寜閽� + $('#toolBtnAll').click(function() { + var baoji = $('#lbottom .li-con li.b8cfe5').text(); + if(baoji.length == 0) { + layer.msg('璇烽�夋嫨宸︿笅鏂圭殑鍖呮満缁勶紒锛侊紒'); + }else { + $('#tb-right-menu .all-pitch').click(); + } + }); + + // 鐐瑰嚮鍒犻櫎鎸夐挳 + $('#toolBtnDel').click(function() { + var baoji = $('#lbottom .li-con li.b8cfe5').text(); + if(baoji.length == 0) { + layer.msg('璇烽�夋嫨宸︿笅鏂圭殑鍖呮満缁勶紒锛侊紒'); + }else { + $('#tb-right-menu .del').click(); + } + }); + + // 鏍规嵁閫夋嫨鐨勬坊鍔犵數姹犵粍 + function addBattGroup(num) { + switch(num) { + case '0': // 娣诲姞鍏ㄧ渷 + $('#tb-right-menu .add-province').click(); + break; + case '1': + $('#tb-right-menu .add-city').click(); + break; + case '2': + $('#tb-right-menu .add-county').click(); + break; + case '3': + $('#tb-right-menu .add-station').click(); + break; + case '4': + $('#tb-right-menu .add-batt').click(); + break; + + } + } + }); </script> </html> \ No newline at end of file -- Gitblit v1.9.1