<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
|
<%
|
String path = request.getContextPath();
|
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
|
%>
|
<%@ taglib uri="/struts-tags" prefix="s"%>
|
<!DOCTYPE HTML>
|
<html>
|
<head>
|
<base href="<%=basePath%>">
|
<meta charset="UTF-8">
|
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE10" />
|
<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>
|
<!--头部内容开始-->
|
<jsp:include page="Top.jsp" flush="true"/>
|
<!--头部内容结束-->
|
<!-- 主体内容 -->
|
<div id="main">
|
<!-- 导航开始 -->
|
<jsp:include page="nav.jsp" flush="true"/>
|
<!-- 导航结束 -->
|
<div id="eleInfor">
|
<span class="summary"><s:text name="Show/hide_the_query_conditions"/></span> <!-- 显示和隐藏条件 -->
|
<!-- 条件选择内容 -->
|
<div class="checkCon">
|
<!-- 维护区信息 -->
|
<table>
|
<tr class="fWeight">
|
<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>
|
</td>
|
<td>
|
<select id="city" name=""></select>
|
</td>
|
<td>
|
<select id="county" name=""></select>
|
</td>
|
<td>
|
<select id="station_name" name=""></select>
|
</td>
|
<td>
|
<select id="battgroup_name" name=""></select>
|
</td>
|
</tr>
|
</table>
|
</div>
|
</div>
|
<!-- 条件查询结束 -->
|
<!-- 左上容器 -->
|
<div id="ltop">
|
<span class="toptxt"><s:text name="Chartere_room_(chartered_room_equipment)"/>(<font id="station_num">0</font>)</span> <!-- 包机机房(或包机机房设备) -->
|
<!-- 包机机房列表 -->
|
<div class="li-con"></div>
|
</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>
|
<th><s:text name="Chartere_room_(chartered_room_equipment)"/></th> <!-- 包机机房(或包机机房设备) -->
|
<th><s:text name="Charter_battery_pack"/>(<font id="batt_num">0</font>)</th> <!-- 包机电池组 -->
|
</tr>
|
</thead>
|
</table>
|
<!-- 包机机房和包机电池组容器 -->
|
<div id="tbroom"><!-- 包机机房和包机电池组内容 --></div>
|
</div>
|
<!-- 清除浮动 -->
|
<div class="clear"></div>
|
<!-- 左下容器 -->
|
<div id="lbottom">
|
<span class="toptxt"><s:text name="Package_unit_list"/></span> <!-- 包机组列表 -->
|
<!-- 包机组列表 -->
|
<div class="li-con"></div>
|
<!-- 一个用户对应的包机组 -->
|
<div class="hide-ul"></div>
|
</div>
|
<!-- 右下容器 -->
|
<div id="rbottom">
|
<span class="toptxt"><s:text name="Package_unit_user_list"/></span> <!-- 包机组用户列表 -->
|
<!-- 包机组用户列表 -->
|
<div class="li-con"></div>
|
</div>
|
</div>
|
<!-- 主体内容结束 -->
|
<!-- 右键菜单内容 -->
|
<div id="right-menu">
|
<a href="javascript:;" class="apply"><s:text name="Apply"/></a> <!-- 应用 -->
|
<a href="javascript:;" class="add"><s:text name="Add"/></a> <!-- 添加 -->
|
<a href="javascript:;" class="edit"><s:text name="Edit"/></a> <!-- 编辑 -->
|
<a href="javascript:;" class="re-name"><s:text name="Rename"/></a> <!-- 重命名 -->
|
<a href="javascript:;" class="del"><s:text name="Delete"/></a> <!-- 删除 -->
|
<a href="javascript:;" class="look"><s:text name="Look_batt_pack"/></a> <!-- 查看电池组 -->
|
</div>
|
<!-- 右键表格菜单 -->
|
<div id="tb-right-menu">
|
<a href="javascript:;" class="apply"><s:text name="Apply"/></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> <!-- 全部选中 -->
|
</div>
|
<a href="javascript:;" class="del"><s:text name="Remove_batt_group"/></a> <!-- 移除电池组 -->
|
</div>
|
<!-- 添加包机组 -->
|
<div id="addPwr">
|
<span><s:text name="Add_new_baoji_group"/></span> <!-- 添加新的包机组 -->
|
<div class="txt-con">
|
<input type="text" value="" placeholder="<s:text name='Please_enter_a_new_charter_group_name'/>"> <!-- 请输入新的包机组名 -->
|
</div>
|
<div class="btn-con">
|
<input type="button" class="enSure" value="<s:text name='Determine'/>"> <!-- 确定 -->
|
<input type="button" class="outAdd" value="<s:text name='Exit'/>"> <!-- 退出 -->
|
</div>
|
</div>
|
<!-- 重命名包机组 -->
|
<div id="rename">
|
<span><s:text name='Rename_baoji_group_name'/></span> <!-- 重命名包机组名 -->
|
<div class="txt-con">
|
<input type="text" value="" placeholder="<s:text name='Please_enter_a_new_charter_group_name'/>"> <!-- 请输入新的权限组名 -->
|
</div>
|
<div class="btn-con">
|
<input type="button" class="enSure" value="<s:text name='Determine'/>"> <!-- 确定 -->
|
<input type="button" class="out" value="<s:text name='Exit'/>"> <!-- 退出 -->
|
</div>
|
</div>
|
<!-- 包机用户组 -->
|
<div id="user_power">
|
<span><s:text name='Username_options'/></span> <!-- 用户名选项 -->
|
<select style="display:none;">
|
<option>全部</option>
|
<option>一枢纽</option>
|
<option>二枢纽</option>
|
<option>枢纽楼</option>
|
</select>
|
<div class="tbHead"><!--<table class="upper"></table>这里放的是表格选项固定的头部 --></div>
|
<div class="con_table"><!--<table class="upper"></table>这里放的是表格选项滚动部分 --></div>
|
<div class="input_container">
|
<input type="button" class="enSure" value="<s:text name='Determine'/>"> <!-- 确定 -->
|
<input type="button" class="out" value="<s:text name='Return'/>"> <!-- 返回 -->
|
</div>
|
</div>
|
<!-- 整体遮罩层 -->
|
<div id="allShade"></div>
|
<!--清除浮动-->
|
<div class="clear"></div>
|
</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");
|
if(obj!=null){
|
String permits =obj.toString(); %>
|
permits=<%=permits%>;
|
//console.info(json);
|
<% } %>
|
var battstationList = []; //所有电池组和机房数组
|
var battstationIdList = []; //所有电池组和机房id
|
|
var isCanEdit; //判断是否可以编辑
|
$(document).ready(function(){
|
isCanEdit=findValIsExist('usr_edit_permit',permits);
|
if(!isCanEdit)
|
{
|
$("#right-menu").remove();
|
$("#tb-right-menu").remove();
|
}
|
});
|
|
//屏蔽浏览器右键菜单功能
|
$(document).ready(function(){
|
document.oncontextmenu=function(){
|
return false;
|
};
|
});
|
|
//创建权限组下的用户
|
function createUserLi(ele,ArrTex,ArrVal,ArrNum){
|
var __ul=$('<ul></ul>');
|
var __li=new Array();
|
//给每个li添加文本
|
for(var i=0;i<ArrTex.length;i++)
|
{
|
__li[i]=$('<li num="'+ArrNum[i]+'" value="'+ArrVal[i]+'">'+ArrTex[i]+'</li>');
|
__ul.append(__li[i]);
|
}
|
ele.append(__ul);
|
}
|
|
//创建权限组列表
|
function createGrounpList(ele,ArrLi,ArrVal){
|
var __ul=$('<ul></ul>');
|
var __li=new Array();
|
//给每个li添加文本
|
for(var i=0;i<ArrLi.length;i++)
|
{
|
__li[i]=$('<li value="'+ArrVal[i]+'">'+ArrLi[i]+'</li>');
|
__ul.append(__li[i]);
|
}
|
ele.append(__ul);
|
}
|
|
//创建包机组列表
|
function createUserList(ele,ArrLi){
|
var __ul=$('<ul></ul>');
|
var __li=new Array();
|
//给每个li添加文本
|
for(var i=0;i<ArrLi.length;i++)
|
{
|
__li[i]=$('<li>'+ArrLi[i]+'</li>');
|
__ul.append(__li[i]);
|
}
|
ele.append(__ul);
|
}
|
//初始化页面
|
$(document).ready(function(){
|
//高度自适应
|
var scrnHt=$(window).height(); //浏览器可视区域的高度
|
var bodyHt=$('body').height(); //获取body的高度
|
var lBtmUlHt=$('#lbottom .li-con').height(); //获取左下的列表的高度
|
var rBtmUlHt=$('#rbottom .li-con').height(); //获取右下的列表的高度
|
//对比body的高度和浏览器可视区域高度
|
if(scrnHt>bodyHt)
|
{
|
$('#lbottom .li-con').height(lBtmUlHt+scrnHt-bodyHt);
|
$('#rbottom .li-con').height(rBtmUlHt+scrnHt-bodyHt);
|
}
|
//可视区域改变时高度变化
|
$(window).resize(function(){
|
var newScrnHt=$(window).height(); //浏览器可视区域的高度
|
var newBodyHt=$('body').height(); //获取body的高度
|
if(newScrnHt>newBodyHt)
|
{
|
var newLBtmUlHt=$('#lbottom .li-con').height(); //获取左下的列表的高度
|
var newRBtmUlHt=$('#rbottom .li-con').height(); //获取右下的列表的高度
|
//对比body的高度和浏览器可视区域高度
|
$('#lbottom .li-con').height(newLBtmUlHt+newScrnHt-newBodyHt);
|
$('#rbottom .li-con').height(newRBtmUlHt+newScrnHt-newBodyHt);
|
}
|
});
|
|
setUserName();
|
//页面加载完生成包机组列表
|
searchAllbaojiGroup();
|
|
//页面内的基础点击效果
|
$('#eleInfor .summary').click(function(){
|
$('#eleInfor .checkCon').slideToggle();
|
});
|
});
|
|
//查询所有的包机组并生成列表
|
function searchAllbaojiGroup(){
|
$.post("User_battgroup_baojigroupAction!searchAll",null,function(data){
|
data=data.result;
|
model=eval("("+data+")");
|
if(model.code==1 && model.data.length>0){
|
var index=0;
|
var ArrLi=new Array();
|
var ArrVal=new Array();
|
for(var i=0;i<model.data.length;i++){
|
data=model.data[i];
|
//console.info(data);
|
ArrLi[index]=data.baoji_group_name;
|
ArrVal[index++]=data.baoji_group_id;
|
}
|
createGrounpList($('#lbottom .li-con'),ArrLi,ArrVal);
|
}
|
});
|
}
|
|
|
//根据包机组id查询管理该包机组的用户
|
function searchBaojiZuUser(baoji_group_id){
|
$('#rbottom .li-con').text('');
|
if(baoji_group_id!=undefined && baoji_group_id>0){
|
$.post("User_battgroup_baojigroupAction!serchByCondition","us.baoji_group_id="+baoji_group_id,function(data){
|
data=data.result;
|
model=eval("("+data+")");
|
if(model.code==1 && model.data.length>0){
|
var ArrLi=new Array();
|
var ArrVal=new Array();
|
var ArrNum=new Array();
|
var index=0;
|
for(var i=0;i<model.data.length;i++){
|
data=model.data[i];
|
//console.info(data);
|
ArrLi[index]=data.UName;
|
ArrVal[index++]=data.UId;
|
ArrNum.push(data.UBaojiusr);
|
}
|
createUserLi($('#rbottom .li-con'),ArrLi,ArrVal,ArrNum);
|
}
|
});
|
}
|
}
|
|
|
function searchAllBattstation(baoji_group_id){
|
if(baoji_group_id!=undefined && baoji_group_id>0){
|
$('#ltop .li-con').text('');
|
//清除机房电池组表格内容
|
$('#tbroom table').remove();
|
var totalstationNum=0; //所有机房数
|
var totalbattNum=0; //所有电池组数
|
$.post("User_battgroup_baojigroupAction!serchByInfo","us.baoji_group_id="+baoji_group_id,function(data){
|
data=data.result;
|
model=eval("("+data+")");
|
var stationList=new Array(); //所有机房数组
|
var stationidList=new Array(); //所有机房数组对应的id
|
battstationList=new Array(); //所有电池组和机房数组
|
battstationIdList=new Array(); //所有电池组和机房id数组
|
var allbattstation=new Array(); //存放所有的机房和电池组
|
|
var all_index=0;
|
var stataion_index=0;
|
var battstation_index=0;
|
var stationName="";
|
var index=0;
|
if(model.code==1 && model.data.length>0){
|
//console.log(model.data);
|
for(var i=0;i<model.data.length;i++){
|
totalbattNum=model.data.length;
|
data=model.data[i];
|
//console.info(data);
|
allbattstation[all_index++]=data.StationName;
|
allbattstation[all_index++]=data.BattGroupName;
|
|
index=0;
|
stationList[stataion_index++]=data.StationName;
|
stationidList.push(data.StationId);
|
battstationList[stataion_index-1]=new Array();
|
battstationList[stataion_index-1].push(data.StationName);
|
battstationList[stataion_index-1].push(data.BattGroupName);
|
battstationIdList[stataion_index-1]=new Array();
|
battstationIdList[stataion_index-1].push(data.StationId);
|
battstationIdList[stataion_index-1].push(data.BattGroupId);
|
stationName=data.StationName;
|
|
}
|
var rsData = {
|
name: [],
|
id:[]
|
}
|
if(model.code == 1) {
|
rsData = formattedData(model.data);
|
}
|
|
//console.info(stationList);
|
//console.info(battstationIdList);
|
|
createGrounpList($('#ltop .li-con'),rsData.name,rsData.id);
|
// 使每个包机机房处于被选中状态
|
$('#ltop .li-con li').addClass('b8cfe5');
|
totalstationNum=stationList.length;
|
createBattTable(allbattstation);
|
addTdIdx($('#tbroom table tbody td'),battstationIdList);
|
}
|
getbattStationlength();
|
/* $('#station_num').text(totalstationNum);
|
$('#batt_num').text(totalbattNum); */
|
});
|
}
|
}
|
|
|
//创建机房和电池组的表格
|
function createBattTable(ArrTd){
|
//alert(ArrTd);
|
if(ArrTd!=undefined){
|
// 创建等待框
|
createWait($('#tbroom'));
|
//创建页面中的右上方的表格
|
var ArrTh=new Array(); //定义表头数据
|
//定义表格头部数据
|
ArrTh=['<s:text name="Chartere_room_(chartered_room_equipment)"/>','<s:text name="Charter_battery_pack"/>']; /* 包机机房 包机电池组 */
|
//创建表格
|
createTable('tbroom','tbScroll',ArrTh.length,ArrTh,ArrTd);
|
|
//清除等待框
|
$('#tbroom .wait').remove();
|
//计算容器宽度让表头和表体对齐
|
var tbRoomWidth=$('#tbroom').width();
|
// 让容器内的表格宽度一致
|
$('#rtop table').width(tbRoomWidth-20);
|
$('#batt_num').text(ArrTd.length/2);
|
}
|
}
|
|
//页面左下内生成的列表的事件
|
$(document).ready(function(){
|
//点击包机组列表的内容
|
var LiIndex=0;
|
var preVal=0;
|
// 鼠标点击的效果
|
$('#lbottom').on('mousedown','.li-con li',function(e){
|
// 鼠标点击的生成列表和表格
|
if(!$(this).hasClass('b8cfe5')){
|
//查询所有的机房和电池组并生成列表
|
searchAllBattstation($(this).attr('value'));
|
//生成包机组用户列表
|
searchBaojiZuUser($(this).attr('value'));
|
}
|
|
//给被选中的li添加class
|
$('#lbottom .li-con li').removeClass('b8cfe5');
|
$(this).addClass('b8cfe5');
|
if($('#lbottom .hide-ul:visible').length!=0)
|
{
|
return;
|
}
|
//利用jquery的方式获取当前点击的是否是右键
|
if(e.which==3)
|
{
|
LiIndex=$(this).index(); //当前点击的行数
|
preVal=$(this).val(); //当前行数的value的值
|
var disX=(e||event).clientX+10; //获取鼠标点击的横坐标
|
var disY=(e||event).clientY+10; // 获取鼠标点击的纵坐标
|
var scrollY=$(document).scrollTop();
|
$('#right-menu').css('top',disY+scrollY+'px');
|
$('#right-menu').css('left',disX+'px');
|
//为右键菜单添加class
|
$('#right-menu .add').removeClass('add-user');
|
$('#right-menu .del').removeClass('del-user');
|
$('#right-menu .add').addClass('add-group');
|
$('#right-menu .del').addClass('del-group');
|
//显示相应的菜单内容
|
$('#right-menu').show();
|
$('#right-menu .add').show();
|
$('#right-menu .del').show();
|
$('#right-menu .edit').hide();
|
$('#right-menu .look').hide();
|
//if($(this).hasClass('blue'))
|
//{
|
$('#right-menu .re-name').show();
|
//}else{
|
// $('#right-menu .re-name').hide();
|
//}
|
|
setPosition($("#right-menu"),disX, disY);
|
return false;
|
}
|
});
|
|
$('#lbottom').on('mousedown',function(e){
|
|
//利用jquery的方式获取当前点击的是否是右键
|
if(e.which==3)
|
{
|
var disX=(e||event).clientX+10; //获取鼠标点击的横坐标
|
var disY=(e||event).clientY+10; // 获取鼠标点击的纵坐标
|
var scrollY=$(document).scrollTop();
|
$('#right-menu').css('top',disY+scrollY+'px');
|
$('#right-menu').css('left',disX+'px');
|
//为右键菜单添加class
|
$('#right-menu .add').removeClass('add-user');
|
$('#right-menu .del').removeClass('del-user');
|
$('#right-menu .add').addClass('add-group');
|
$('#right-menu .del').addClass('del-group');
|
//显示相应的菜单内容
|
$('#right-menu').show();
|
$('#right-menu .add').show();
|
$('#right-menu .del').hide();
|
$('#right-menu .edit').hide();
|
$('#right-menu .look').hide();
|
//if($(this).hasClass('blue'))
|
//{
|
$('#right-menu .re-name').hide();
|
//}else{
|
// $('#right-menu .re-name').hide();
|
//}
|
|
setPosition($("#right-menu"),disX, disY);
|
}
|
});
|
|
//点击页面内容右键菜单消失
|
$('div').click(function(){
|
//右键菜单消失
|
$('#right-menu').hide();
|
});
|
//点击添加按钮的效果
|
$('#right-menu').on('click','.add-group',function(){
|
$('#addPwr').show();
|
$('#allShade').show();
|
});
|
//点击退出按钮效果
|
$('#addPwr .outAdd').click(function(){
|
$('#addPwr').hide();
|
$('#allShade').hide();
|
});
|
//点击确定在包机组列表创建li
|
$('#addPwr .enSure').click(function(){
|
var txtVal=$('#addPwr .txt-con input[type="text"]').val();
|
if($.trim(txtVal)!='')
|
{
|
var flag=true;
|
$('#lbottom .li-con li').each(function(){
|
if(txtVal==$(this).text()){
|
flag=false;
|
}
|
});
|
if(flag){
|
$.post('User_battgroup_baojigroupAction!add',"us.baoji_group_name="+txtVal,function(data){
|
//console.info(data);
|
var model=eval("("+data.result+")");
|
if(model.code==1){
|
layer.msg(model.msg);
|
}else{
|
layer.msg(model.msg);
|
}
|
$('#lbottom .li-con ul').remove();
|
searchAllbaojiGroup();
|
//隐藏添加窗口
|
$('#addPwr').hide();
|
$('#allShade').hide();
|
});
|
}else{
|
layer.msg('<s:text name="The_baoji_group_name_already_exists,Please_enter_a_different_set_of_names"/>!'); /* 该包机组名已经存在,请输入其他组名 */
|
}
|
}else{
|
layer.msg('<s:text name="Can_not_be_empty"/>!!!'); /* 不能为空 */
|
}
|
});
|
//点击编辑按钮给当前行添加class
|
$('#right-menu .edit').click(function(){
|
$('#lbottom .li-con li').removeClass('red');
|
$('#lbottom .li-con li').eq(LiIndex).addClass('blue');
|
});
|
//点击重命名按钮
|
$('#right-menu .re-name').click(function(){
|
var baojiName=$('#lbottom .li-con li').eq(LiIndex).text();
|
$('#rename .txt-con input').attr('value',baojiName);
|
//console.info(baojiName);
|
//显示重命名窗口
|
$('#rename').show();
|
$('#allShade').show();
|
});
|
//点击退出按钮退出重命名窗口
|
$('#rename .out').click(function(){
|
//隐藏重命名窗口
|
$('#rename').hide();
|
$('#allShade').hide();
|
});
|
//点击确定按钮替换当前的文本
|
$('#rename .enSure').click(function(){
|
var txtVal=$('#rename .txt-con input').val();
|
if($.trim(txtVal).length>0){
|
var flag=true;
|
$('#lbottom .li-con li').each(function(){
|
if($(this).text()==txtVal){
|
flag=false;
|
}
|
});
|
var id=$('#lbottom .li-con li').eq(LiIndex).attr('value');
|
if(flag){
|
$.post('User_battgroup_baojigroupAction!update','us.baoji_group_id='+id+'&us.baoji_group_name='+txtVal,function(data){
|
var model=eval("("+data.result+")");
|
layer.msg(model.msg);
|
$('#lbottom .li-con ul').remove();
|
searchAllbaojiGroup();
|
//隐藏重命名窗口
|
$('#rename').hide();
|
$('#allShade').hide();
|
});
|
}else{
|
layer.msg('<s:text name="The_baoji_group_name_already_exists,Please_enter_a_different_set_of_names"/>!'); /* 该包机组名已经存在,请输入其他组名 */
|
}
|
}else{
|
layer.msg('<s:text name="Can_not_be_empty"/>!!!'); /* 不能为空 */
|
}
|
|
});
|
//点击删除按钮
|
$('#right-menu .del-group').live('click',function(){
|
var oLi=$('#lbottom .li-con li').eq(LiIndex);
|
// 取人删除包机组
|
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){
|
layer.msg(model.msg);
|
}else{
|
layer.msg(model.msg);
|
}
|
$('#lbottom .li-con ul').remove();
|
searchAllbaojiGroup();
|
});
|
});
|
});
|
});
|
|
var ArrTh=['<s:text name="Username"/>','<s:text name="Options"/>']; //定义表头数据 用户名 选项
|
var ArrTd=new Array(); //定义表内数据
|
// 包机组用户列表点击事件
|
$(document).ready(function(){
|
// 鼠标(左右键)点击
|
var LiIndex=0; //记录当前行
|
$('#rbottom').on('mousedown','.li-con li',function(e){
|
//点击的该行背景色改变其他行不变色
|
$('#rbottom .li-con li').removeClass('b8cfe5');
|
$(this).addClass('b8cfe5');
|
if($('#lbottom .hide-ul:visible').length!=0)
|
{
|
return;
|
}
|
//利用jquery的方式获取当前点击的是否是右键
|
if(e.which==3)
|
{
|
LiIndex=$(this).index(); //当前点击的行数
|
var disX=(e||event).clientX+10; //获取鼠标点击的横坐标
|
var disY=(e||event).clientY+10; // 获取鼠标点击的纵坐标
|
var scrollY=$(document).scrollTop();
|
$('#right-menu').css('top',disY+scrollY+'px');
|
$('#right-menu').css('left',disX+'px');
|
//为右键菜单添加class
|
$('#right-menu .add').removeClass('add-group');
|
$('#right-menu .del').removeClass('del-group');
|
$('#right-menu .add').addClass('add-user');
|
$('#right-menu .del').addClass('del-user');
|
//显示相应的菜单内容
|
$('#right-menu').show();
|
$('#right-menu .add').show();
|
$('#right-menu .del').show();
|
$('#right-menu .look').show();
|
//隐藏菜单内容
|
$('#right-menu .edit').hide();
|
$('#right-menu .re-name').hide();
|
|
setPosition($("#right-menu"),disX, disY);
|
}
|
});
|
|
var userlist;
|
// 点击添加按钮的效果
|
|
$('#right-menu').on('click','.add-user',function(){
|
userlist=new Array();
|
var baojiid = $('#lbottom .li-con li.b8cfe5').attr('value');
|
$.post('User_battgroup_baojigroup_usrAction!serchByInfo','ubbu.baoji_group_id='+baojiid,function(data){
|
var model=eval("("+data.result+")");
|
if(model.code==1 && model.data.length>0){
|
userlist=model.data
|
//console.info(userlist);
|
for(var i=0;i<model.data.length;i++){
|
ArrTd[i]=[userlist[i].UName,'<input type="checkbox" />'];
|
}
|
}
|
//清除表格内容
|
$('#user_power .tbHead table').remove();
|
$('#user_power .con_table table').remove();
|
//根据数据生成表格
|
createCard($('#user_power .tbHead'),ArrTh,ArrTd);
|
createCard($('#user_power .con_table'),ArrTh,ArrTd);
|
//显示添加包机组用户
|
$('#user_power').show();
|
$('#allShade').show();
|
});
|
});
|
//退出添加权限用户组界面
|
$('#user_power .out').click(function(){
|
//隐藏添加权限用户名界面
|
$('#user_power').hide();
|
$('#allShade').hide();
|
});
|
|
// 点击确定添加权限组用户
|
$('#user_power .enSure').click(function(){
|
var txtArrLi=new Array(); //记录选择的用户
|
var useidArr=new Array(); //记录选中用户的id
|
|
//定义jquery变量
|
var $tr=$('#user_power .con_table tbody tr');
|
var $input=$('#user_power .con_table tbody input[type="checkbox"]');
|
var k=0;
|
for(var i=0;i<$input.length;i++)
|
{
|
if($input.eq(i).is(':checked'))
|
{
|
txtArrLi[k]=$tr.eq(i).find('td').eq(0).text();
|
useidArr[k++]=userlist[i].UId;
|
}
|
}
|
//alert(txtArrLi);
|
if(txtArrLi.length!=0)
|
{
|
for(var i=0;i<txtArrLi.length;i++)
|
{
|
var flag=true;
|
$('#rbottom .li-con li').each(function(){
|
if(txtArrLi[i]==$(this).text()){
|
flag=false;
|
}
|
});
|
//alert(flag);
|
if(flag){
|
$('#rbottom .li-con').append($('<ul><li class="red" value="'+useidArr[i]+'">'+txtArrLi[i]+'</li></ul>'));
|
}
|
}
|
}
|
//隐藏添加用户界面
|
$('#user_power').hide();
|
$('#allShade').hide();
|
});
|
//点击删除
|
//点击删除按钮
|
$('#right-menu').on('click','.del-user',function(){
|
var ouserLi=$('#rbottom .li-con li').eq(LiIndex);
|
var obaoLi=$('#lbottom .li-con li.b8cfe5');
|
// 提示是否删除包机用户
|
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();
|
});
|
});
|
|
$('#right-menu').on('click','.apply',function(data){
|
var oLis=$('#rbottom .li-con li.red');
|
//alert(oLis.length);
|
var baojili = $('#lbottom .li-con li.b8cfe5');
|
var baoji_user=new Array();
|
if(oLis.length>0){
|
for(var i=0;i<oLis.length;i++){
|
baoji_user.push({
|
baoji_group_id:baojili.val(),
|
baoji_group_name:baojili.text(),
|
uId:oLis.eq(i).val(),
|
uname:oLis.eq(i).text(),
|
});
|
}
|
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+")");
|
layer.msg(model.msg);
|
var baojizuid=$('#lbottom .li-con li.b8cfe5').attr('value');
|
searchBaojiZuUser(baojizuid);
|
// 隐藏等待框
|
loading.hideLoading();
|
});
|
}else{
|
layer.msg('<s:text name="There_is_nothing_to_be_done"/>'); /* 没有什么可以做的 */
|
}
|
});
|
//点击查看包机组效果
|
$('#right-menu .look').click(function(){
|
var uid=$('#rbottom .li-con .b8cfe5').attr('value');
|
searchStationAndBatt(uid);
|
searchBaojiByUid(uid);
|
|
});
|
//隐藏权限组
|
$('#lbottom .hide-ul').click(function(){
|
var baoid=$('#lbottom .li-con li.b8cfe5').attr('value');
|
searchAllBattstation(baoid);
|
$(this).hide();
|
});
|
});
|
//让右键生成的弹出框随浏览器滚动而滚动
|
$(document).ready(function(){
|
$(window).scroll(function(){
|
var scrollY=$(this).scrollTop();
|
$('#addPwr').css('top',scrollY+200+'px');
|
$('#rename').css('top',scrollY+200+'px');
|
$('#user_power').css('top',scrollY+80+'px');
|
});
|
});
|
// 点击右上方表格
|
$('#tbroom').on('click','table tr',function(){
|
//去掉其他行的class给点击的行添加class
|
$('#tbroom table tr').removeClass('b8cfe5');
|
$(this).addClass('b8cfe5');
|
});
|
|
|
//根据用户id查询其机房和包机组
|
function searchStationAndBatt(uid){
|
$('#ltop .li-con').text('');
|
//清除机房电池组表格内容
|
$('#tbroom table').remove();
|
if(uid!=undefined){
|
$.post("User_battgroup_baojigroup_battgroupAction!serchByCondition","user_inf.UId="+uid,function(data){
|
// 生成等待框
|
data=data.result;
|
data=eval("("+data+")");
|
//console.info(data);
|
var stationList=new Array(); //存放下方左边表格的信息
|
var stationidList=new Array();
|
var s_index=0;
|
battstationList=new Array(); //存放所有电池机房信息
|
battstationIdList=new Array(); //存放所有电池机房的id
|
var b_index=-1;
|
var battinfo=new Array(); //存放所有电池组的信息
|
var info_index=0;
|
var stationName="";
|
var totalbattNum=0;
|
if(data.code==1 && data.data.length>0){
|
var index;
|
totalbattNum=data.data.length;
|
//console.info(data.data);
|
for(var i=0;i<data.data.length;i++){
|
//console.info(data.data[i]);
|
battinfo[info_index++]=data.data[i].StationName;
|
battinfo[info_index++]=data.data[i].BattGroupName;
|
if(stationName==data.data[i].StationName){
|
battstationList[b_index][index++]=data.data[i].StationName;
|
battstationList[b_index][index++]=data.data[i].BattGroupName;
|
battstationIdList[b_index].push(data.data[i].StationId);
|
battstationIdList[b_index].push(data.data[i].BattGroupId);
|
}else{
|
stationName=data.data[i].StationName;
|
index=0;
|
stationList[s_index]=data.data[i].StationName;
|
stationidList[s_index++]=data.data[i].StationId;
|
battstationList[++b_index]=new Array();
|
battstationList[b_index][index++]=data.data[i].StationName;
|
battstationList[b_index][index++]=data.data[i].BattGroupName;
|
|
battstationIdList[b_index]=new Array();
|
battstationIdList[b_index].push(data.data[i].StationId);
|
battstationIdList[b_index].push(data.data[i].BattGroupId);
|
}
|
}
|
createGrounpList($('#ltop .li-con'),stationList,stationidList);
|
$('#station_num').text(stationList.length);
|
$('#batt_num').text(totalbattNum);
|
// 使每个包机机房处于被选中状态
|
$('#ltop .li-con li').addClass('b8cfe5');
|
totalstationNum=stationList.length;
|
createBattTable(battinfo);
|
}
|
});
|
}
|
}
|
|
//根据用户id查询所在的包机组
|
function searchBaojiByUid(uid){
|
if(uid!=undefined){
|
$.post("User_infAction!serchByInfo","uif.UId="+uid,function(data){
|
data=data.result;
|
model=eval("("+data+")");
|
if(model.code==1 && model.data.length>0){
|
//根据用户信息创建该用户的所有权限
|
var ArrUserLi=new Array();
|
for(var i=0;i<model.data.length;i++){
|
data=model.data[i];
|
ArrUserLi[i]=data.baoji_group_name;
|
}
|
//清除表格内容
|
$('#lbottom .hide-ul ul').remove();
|
//根据数据生成列表
|
createUserList($('#lbottom .hide-ul'),ArrUserLi);
|
//显示用户的所有权限
|
$('#lbottom .hide-ul').show();
|
}
|
});
|
}
|
}
|
|
// 省-市-机房-电池组
|
$(document).ready(function(){
|
//页面加载时查询维护区中的枢纽类型
|
$.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 $select = $("#station_name1");
|
$select.text('');
|
for(var i=0;i<=data.data.length;i++){
|
$option=$("<option></option>");
|
if(i==0){
|
$option.html("<s:text name='All'/>(<s:text name='Common'/>"+data.data.length+"<s:text name='Species'/>)");
|
$option.attr("value", "");
|
}else{
|
$option.text(data.data[i-1].StationName1);
|
$option.attr("value",data.data[i-1].StationName1);
|
}
|
$select.append($option);
|
}
|
}else{
|
$("#station_name1").text('').html('<option>暂未添加省</option>');
|
}
|
findCity();
|
});
|
});
|
|
// 根据维护区的内容查询市
|
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();
|
}
|
});
|
}
|
|
//当维护区的值变换时更新市
|
$('#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 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!serchBattByStation_all","json="+JSON.stringify(tmp),function(data){
|
data=data.result;
|
//console.info(data);
|
data=eval("("+data+")");
|
//console.info(data);
|
if(data.code==1 && data.data.length>0){
|
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){
|
var tdIndex=0;
|
if($(this).hasClass('b8cfe5')==false)
|
{
|
//去掉其他行的class给点击的行添加class
|
$('#tbroom table tr').removeClass('b8cfe5');
|
$(this).addClass('b8cfe5');
|
}
|
if($('#lbottom .hide-ul:visible').length!=0)
|
{
|
return;
|
}
|
//根据jquery判断是否是鼠标右键
|
if(e.which==3)
|
{
|
LiIndex=$(this).index(); //当前点击的行数
|
var disX=(e||event).clientX+10; //获取鼠标点击的横坐标
|
var disY=(e||event).clientY+10; // 获取鼠标点击的纵坐标
|
var scrollY=$(document).scrollTop();
|
$('#tb-right-menu').css('top',disY+scrollY+'px');
|
$('#tb-right-menu').css('left',disX+'px');
|
$('#tb-right-menu').show();
|
$('#tb-right-menu .all-pitch').show();
|
$('#tb-right-menu .del').show();
|
|
setPosition($("#tb-right-menu"),disX, disY);
|
}
|
|
return false;
|
});
|
//点击全部选择
|
$('#tb-right-menu .all-pitch').click(function(){
|
$('#tbroom table tr').addClass('b8cfe5');
|
});
|
|
//点击表格右键菜单消失
|
$('div').click(function(){
|
$('#tb-right-menu').hide();
|
});
|
|
$('#rbottom .li-con').on('dblclick','li',function(){
|
searchStationAndBatt($(this).attr('value'));
|
searchBaojiByUid($(this).attr('value'));
|
});
|
|
$(document).ready(function(){
|
$('#lbottom .hide-ul').hide();
|
|
$('#rbottom').mousedown(function(e){
|
if($('#lbottom .hide-ul:visible').length!=0)
|
{
|
return;
|
}
|
if($('#lbottom .b8cfe5').length!=0)
|
{
|
|
//根据jquery判断是否是鼠标右键
|
if(e.which==3)
|
{
|
var disX=(e||event).clientX+10; //获取鼠标点击的横坐标
|
var disY=(e||event).clientY+10; // 获取鼠标点击的纵坐标
|
var scrollY=$(document).scrollTop();
|
$('#right-menu').css('top',disY+scrollY+'px');
|
$('#right-menu').css('left',disX+'px');
|
//为右键菜单添加class
|
$('#right-menu .add').removeClass('add-group');
|
$('#right-menu .del').removeClass('del-group');
|
$('#right-menu .add').addClass('add-user');
|
$('#right-menu .del').addClass('del-user');
|
//显示相应的菜单内容
|
$('#right-menu').show();
|
if($(this).find('li').length==0)
|
{
|
$('#right-menu .add').show();
|
$('#right-menu .del').hide();
|
$('#right-menu .look').hide();
|
|
}else if($(this).find('.b8cfe5').length!=0){
|
$('#right-menu .add').show();
|
$('#right-menu .del').show();
|
$('#right-menu .look').show();
|
}else{
|
$('#right-menu .add').show();
|
$('#right-menu .del').hide();
|
$('#right-menu .look').hide();
|
}
|
//隐藏菜单内容
|
$('#right-menu .edit').hide();
|
$('#right-menu .re-name').hide();
|
|
setPosition($("#right-menu"), disX,disY);
|
}
|
}
|
|
});
|
|
$('#tbroom').mousedown(function(e){
|
if($('#lbottom .hide-ul:visible').length!=0)
|
{
|
return;
|
}
|
if($('#lbottom .b8cfe5').length!=0)
|
{
|
//if($(this).find('td').length==0)
|
//{
|
//根据jquery判断是否是鼠标右键
|
if(e.which==3)
|
{
|
var disX=(e||event).clientX+10; //获取鼠标点击的横坐标
|
var disY=(e||event).clientY+10; // 获取鼠标点击的纵坐标
|
var scrollY=$(document).scrollTop();
|
$('#tb-right-menu').css('top',disY+scrollY+'px');
|
$('#tb-right-menu').css('left',disX+'px');
|
$('#tb-right-menu').show();
|
$('#tb-right-menu .all-pitch').hide();
|
$('#tb-right-menu .del').hide();
|
|
setPosition($("#tb-right-menu"),disX, disY);
|
}
|
//}
|
}
|
});
|
|
});
|
|
//给右侧表格的单元格添加下标
|
function addTdIdx(eleTdList,arrIdx){
|
var __arrIdx=new Array();
|
var getType=typeof arrIdx[0];
|
if(getType=="object")
|
{
|
var n=0;
|
for(var i=0;i<arrIdx.length;i++)
|
{
|
for(var k=0;k<arrIdx[i].length;k++)
|
{
|
__arrIdx[n]=arrIdx[i][k];
|
n++;
|
}
|
}
|
}else{
|
__arrIdx=arrIdx;
|
}
|
eleTdList.each(function(i){
|
$(this).attr('tdIdx',__arrIdx[i]);
|
});
|
}
|
|
//上方表格内容
|
$(document).ready(function(){
|
//根据li的value的值确定li的下标
|
function getLiIdx(arrLiIdx,liVal){
|
var idx=-1;
|
for(var i=0;i<arrLiIdx.length;i++)
|
{
|
if(arrLiIdx[i][0]==liVal)
|
{
|
idx=i;
|
return idx;
|
}
|
}
|
return idx;
|
}
|
//二维数组的指定子数组内添加数组
|
function addValToArr(bigArr,smallArr,idx){
|
var __smallArr=new Array();
|
//如果下标值+1超出bigArr的长度
|
if((idx+1)>bigArr.length)
|
{
|
bigArr.push(__smallArr);
|
}
|
var getType=toString(typeof smallArr[0]);
|
//将要添加的数组依次存入指定的数组内
|
if(getType=='object')
|
{
|
var n=0;
|
for(var i=0;i<smallArr.length;i++)
|
{
|
for(var k=0;k<smallArr[i].length;k++)
|
{
|
__smallArr[n]=smallArr[i][k];
|
n++;
|
}
|
}
|
}else{
|
__smallArr=smallArr;
|
}
|
//剔除重复的内容
|
for(var i=1;i<__smallArr.length;i+=2)
|
{
|
for(var k=1;k<bigArr[idx].length;k+=2)
|
{
|
if(bigArr[idx][k]==__smallArr[i])
|
{
|
__smallArr.splice(i-1,2); //清除重复内容
|
}
|
}
|
}
|
//将指定的数组内的值添加到大的数组内
|
for(var i=0;i<__smallArr.length;i++)
|
{
|
bigArr[idx].push(__smallArr[i]);
|
}
|
}
|
var bigEleGroupTxt=new Array(); //存储添加的电池组文本的二维数组
|
var bigEleGroupVal=new Array(); //存储添加的电池组val的二维数组
|
var roomLiIdx=-1;
|
$('#ltop .li-con').on('click','ul li',function(){
|
$('#ltop .li-con li').removeClass('b8cfe5');
|
$(this).addClass('b8cfe5');
|
//点击左侧的列表右侧生成表格
|
//console.info(battstationIdList);
|
roomLiIdx=getLiIdx(battstationIdList,$(this).val());
|
//console.info(roomLiIdx);
|
if(roomLiIdx<battstationList.length && roomLiIdx!=-1)
|
{
|
var tblTd = getBattListsByStation(battstationList,battstationIdList, $(this).val());
|
createBattTable(tblTd.tblData);
|
//createTablenew($('#tbroom'),ArrTh,ArrTd[roomLiIdx]);
|
//console.info(battstationIdList);
|
addTdIdx($('#tbroom table tbody td'),tblTd.tblAttr); //给单元格添加下标
|
|
}else{
|
var newArrTd=new Array();
|
createTablenew($('#tbroom'),ArrTh,newArrTd);
|
}
|
//如果点击的是红的就执行下面判断语句的内容
|
if($(this).hasClass('red'))
|
{
|
//获取点击红的下标
|
var RedLiIdx=$(this).prevAll('li.red').length;
|
//console.info(bigEleGroupTxt);
|
addTd($('#tbroom table tbody'),2,bigEleGroupTxt[RedLiIdx]);
|
addTdIdx($('#tbroom table tbody tr.red td'),bigEleGroupVal[RedLiIdx]);
|
}
|
//计算容器宽度让表头和表体对齐
|
var tbRoomWidth=$('#tbroom').width();
|
// 让容器内的表格宽度一致
|
$('#rtop table').width(tbRoomWidth-20);
|
getbattStationlength();
|
});
|
|
//点击添加单个电池组按钮
|
function addRedLi(myRoom,myRoomVal,singleELeGroup,singleEleVal){
|
var isRedNotExist=true;
|
var RedLiIdx=-1; //存储红色的下标
|
//给左侧的包机房添加一行
|
if($('#ltop .li-con ul').length==0)
|
{
|
var __ul=$('<ul></ul>');
|
$('#ltop .li-con').append(__ul);
|
}
|
//通过遍历查看该包机机房是否存在
|
$('#ltop .li-con ul li.red').each(function(){
|
if($(this).text()==myRoom[0])
|
{
|
isRedNotExist=false;
|
RedLiIdx=$(this).prevAll('li.red').length;
|
return;
|
}
|
});
|
//如果添加的内容与原有的内容有重复就剔除
|
delRepeatVal(battstationIdList,singleEleVal,singleELeGroup);
|
//根据isExist的值进行定义下面发生的内容
|
if(isRedNotExist && singleEleVal.length>0)
|
{
|
//console.info(myRoom[0]);
|
RedLiIdx=$('#ltop .li-con ul .red').length;
|
var __li=$('<li class="red b8cfe5" value="'+myRoomVal[0]+'" liIdx="'+RedLiIdx+'">'+myRoom[0]+'</li>');
|
$('#ltop .li-con ul').append(__li);
|
RedLiIdx=$('#ltop .li-con ul .red').length-1;
|
}
|
|
|
addValToArr(bigEleGroupTxt,singleELeGroup,RedLiIdx);
|
addValToArr(bigEleGroupVal,singleEleVal,RedLiIdx);
|
//console.info(bigEleGroupTxt);
|
//遍历左侧包机机房并全部选中
|
$('#ltop .li-con ul li').each(function(){
|
if(!$(this).hasClass('b8cfe5'))
|
{
|
$(this).addClass('b8cfe5');
|
}
|
});
|
|
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, // 电池组id
|
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, // 电池组id
|
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, // 电池组id
|
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, // 电池组id
|
StationName: '', // 机房名称
|
StationName5: '', // 区/县
|
StationName2: '', // 市
|
StationName1: '', // 省
|
};
|
var json=window.JSON.stringify(binf);
|
$.post('BattInfAction!serchBatt','result='+json,function(data){
|
var model=eval("("+data.result+")");
|
//console.info(model);
|
var myRoom=new Array();
|
var myRoomVal=new Array();
|
var singleELeGroup=new Array();
|
var singleEleVal=new Array();
|
if(model.code==1){
|
var data=model.data[0];
|
myRoom.push(data.StationName);
|
myRoomVal.push(data.StationId);
|
singleELeGroup.push(data.StationName);
|
singleELeGroup.push(data.BattGroupName);
|
singleEleVal.push(data.StationId);
|
singleEleVal.push(data.BattGroupId);
|
//console.info(myRoom);
|
addRedLi(myRoom,myRoomVal,singleELeGroup,singleEleVal);
|
}
|
});
|
}else{
|
layer.msg('<s:text name="Please_choose_a_group_of_battery_pack!"/>');
|
}
|
});
|
//添加整个机房的电池组
|
$('#tb-right-menu .add-station').click(function(){
|
//获取包机房名称和新增电池组名称
|
var myRoom=new Array();
|
var myRoomVal=new Array();
|
var singleELeGroup=new Array();
|
var singleEleVal=new Array();
|
var stationname=$('#station_name').attr('value');
|
if(stationname.length>0 && $('#lbottom .li-con li.b8cfe5').text().length>0){
|
var binf=new Object();
|
binf={
|
BattGroupId: 0, // 电池组id
|
StationName: stationname, // 机房名称
|
StationName5: '', // 区/县
|
StationName2: '', // 市
|
StationName1: '', // 省
|
};
|
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('<s:text name="Please_select_a_set_of_Computer_room"/>!'); //请先选择一组机房
|
}
|
});
|
//删除当前的行电池组
|
$('#tb-right-menu .del').click(function(){
|
var baojiLi=$('#lbottom .li-con li.b8cfe5');
|
// 是否确认删除电池组
|
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');
|
//需要判断是否含有新添加的电池组
|
$('#tbroom table .b8cfe5').not(redTr).each(function(){
|
removeArray.push({
|
baoji_group_id:baojiLi.attr('value'),
|
baoji_group_name:baojiLi.text(),
|
StationId:$(this).find('td').eq(0).attr('tdidx'),
|
BattGroupId:$(this).find('td').eq(1).attr('tdidx'),
|
note:$(this).find('td').eq(0).text()+"-"+$(this).find('td').eq(1).text(),
|
});
|
});
|
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+")");
|
layer.msg(model.msg);
|
searchAllBattstation(baojiLi.attr('value'));
|
});
|
bigEleGroupTxt=new Array();
|
bigEleGroupVal=new Array();
|
}else{
|
var removeLi=new Array();
|
//移除当前选中的红色电池组时
|
$('#tbroom table .b8cfe5').each(function(){
|
if($(this).hasClass("red"))
|
{
|
var redTdIdx=$(this).find('td').eq(1).attr('tdidx');
|
var redLiIdx=-1;
|
//遍历大数组
|
for(var i=0;i<bigEleGroupVal.length;i++)
|
{
|
for(var k=1;k<bigEleGroupVal[i].length;k+=2)
|
{
|
if(bigEleGroupVal[i][k]==redTdIdx)
|
{
|
bigEleGroupTxt[i].splice(k-1,2);
|
bigEleGroupVal[i].splice(k-1,2);
|
}
|
}
|
}
|
var stationid=$(this).find('td').eq(0).attr('tdidx');
|
$(this).remove();
|
//console.info(stationid);
|
if($('#tbroom table tbody .red td[tdidx="'+stationid+'"]').length==0){
|
removeLi.push(stationid);
|
}
|
}
|
});
|
for(var i=0;i<removeLi.length;i++){
|
removeLeftli(removeLi[i]);
|
}
|
getbattStationlength();
|
}
|
});
|
});
|
|
//移除左边列表中value='stationid'的li
|
function removeLeftli(stationid){
|
$('#ltop .li-con li.red').each(function(){
|
if($(this).attr('value')==stationid){
|
$(this).remove();
|
}
|
});
|
var idx=0;
|
$('#ltop .li-con li.red').each(function(){
|
$(this).attr('liidx',idx++);
|
});
|
}
|
|
//点击应用将选中的电池组添加到包机组
|
$('#tb-right-menu .apply').click(function(){
|
|
var baojiLi=$('#lbottom .li-con li.b8cfe5');
|
var newBatt=new Array();
|
for(var i=0;i<bigEleGroupVal.length;i++){
|
for(var j=0;j<bigEleGroupVal[i].length-1;j+=2){
|
newBatt.push({
|
baoji_group_id:baojiLi.attr('value'),
|
baoji_group_name:baojiLi.text(),
|
StationId:bigEleGroupVal[i][j],
|
BattGroupId:bigEleGroupVal[i][j+1],
|
note:bigEleGroupTxt[i][j]+"-"+bigEleGroupTxt[i][j+1],
|
});
|
//console.info(bigEleGroupTxt[i][j]+"--"+bigEleGroupTxt[i][j+1]);
|
}
|
}
|
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+")");
|
layer.msg(model.msg);
|
searchAllBattstation(baojiLi.attr('value'));
|
bigEleGroupTxt=new Array();
|
bigEleGroupVal=new Array();
|
});
|
}else{
|
layer.msg('<s:text name="There_is_nothing_to_be_done"/>'); /* 没有什么可以做的 */
|
}
|
});
|
|
//初始化bigEleGroupTxt和bigEleGroupVal
|
$('#lbottom .li-con').on('mousedown','ul li',function(){
|
if(!$(this).hasClass('b8cfe5'))
|
{
|
bigEleGroupTxt=new Array();
|
bigEleGroupVal=new Array();
|
}
|
});
|
});
|
|
//剔除数组内重复的内容
|
function delRepeatVal(oldArrVal,newArrVal,newArrTxt){
|
for(var i=0;i<oldArrVal.length;i++)
|
{
|
for(var j=1;j<oldArrVal[i].length;j+=2)
|
{
|
for(var k=1;k<newArrVal.length;k+=2)
|
{
|
if(newArrVal[k]==oldArrVal[i][j])
|
{
|
newArrVal.splice(k-1,2);
|
newArrTxt.splice(k-1,2);
|
}
|
}
|
}
|
}
|
//console.info(oldArrVal);
|
}
|
|
//显示所有的单元格
|
function showAllTd(bigArrTxt,bigArrVal){
|
var tmp = battstationList[0]?battstationList[0]:[];
|
//创建表格
|
createTablenew($('#tbroom'),ArrTh,tmp);
|
//console.info(ArrTd);
|
for(var i=1;i<battstationList.length;i++)
|
{
|
addGroupTd($('#tbroom table tbody'),ArrTh.length,battstationList[i]);
|
}
|
addTdIdx($('#tbroom table tbody td'),battstationIdList);
|
|
//遍历检测红色li的val和liidx
|
$('#ltop .li-con ul li.red').each(function(i){
|
var _liVal=$(this).val();
|
var _liIdx=$(this).attr('liidx');
|
//查看当前包机机房是否在已经生成的包机机房内
|
for(var k=0;k<battstationIdList.length;k++)
|
{
|
if(battstationIdList[k][0]==bigArrVal[i][0])
|
{
|
addGroupTd($('#tbroom table tbody'),ArrTh.length,battstationList[k]);
|
addTdIdx($('#tbroom table tbody td').not('td[tdidx]'),battstationIdList[k]);
|
}
|
}
|
//将红色内容添加到表格中
|
addTd($('#tbroom table tbody'),2,bigArrTxt[i]);
|
addTdIdx($('#tbroom table tbody tr.red td').not('td[tdidx]'),bigArrVal[i]);
|
|
});
|
//计算容器宽度让表头和表体对齐
|
var tbRoomWidth=$('#tbroom').width();
|
// 让容器内的表格宽度一致
|
$('#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('添加的内容已存在!');
|
}
|
|
}
|
|
//添加表格的一行
|
function addGroupTd(ele,len,__ArrTd){
|
//定义tr和td标签
|
var __ArrTagTr=new Array();
|
var __ArrTagTd=new Array();
|
var __TrLength=0;
|
__TrLength=Math.ceil(__ArrTd.length/len);
|
//创建tr
|
for(var i=0;i<__TrLength;i++)
|
{
|
__ArrTagTr[i]=$('<tr></tr>');
|
}
|
//给每个td添加文本
|
for(var i=0;i<__ArrTd.length;i++)
|
{
|
__ArrTagTd[i]=$('<td>'+__ArrTd[i]+'</td>');
|
}
|
var n=0;
|
//根据len将td添加到对应的行
|
for(var i=0;i<__TrLength;i++)
|
{
|
for(var k=0;k<len;k++)
|
{
|
__ArrTagTr[i].append(__ArrTagTd[n]);
|
n++;
|
}
|
}
|
for(var i=0;i<__TrLength;i++)
|
{
|
ele.append(__ArrTagTr[i]);
|
}
|
}
|
|
function getbattStationlength(){
|
var stationNum=$('#ltop .li-con ul li').length;
|
$('#station_num').text(stationNum);
|
|
var battlength=$('#tbroom table tbody tr').length;
|
$('#batt_num').text(battlength);
|
}
|
|
// 滚动到底部
|
function scrollBottom(container, content) {
|
var containerHt = container.height();
|
var contentHt = content.height();
|
var shiftHt = contentHt - containerHt;
|
if(shiftHt>0) {
|
container.scrollTop(shiftHt);
|
}
|
}
|
|
|
// 筛选查询的数据
|
function formattedData(data) {
|
var rsObj ={
|
name: '',
|
id: ''
|
};
|
var _rsData = [];
|
var _tmp = [];
|
var isExist = false;
|
for(var i=0;i<data.length; i++) {
|
var _id = data[i].StationId;
|
var _name = data[i].StationName;
|
isExist = false;
|
for(var k=0; k<_tmp.length; k++) {
|
if(_tmp[k] == _id) {
|
isExist = true;
|
break;
|
}
|
}
|
// 不存在
|
if(!isExist) {
|
_tmp.push(_id);
|
_rsData.push(_name);
|
}
|
}
|
|
rsObj.name = _rsData;
|
rsObj.id = _tmp;
|
return rsObj;
|
}
|
|
// 根据机房id获取机房的电池组
|
function getBattListsByStation(battList, battIdList, id) {
|
console.log(battList);
|
console.log(battIdList);
|
console.log(id);
|
var _rsObj = {
|
tblData:[],
|
tblAttr: []
|
};
|
var _rsId = [];
|
var _rsText = [];
|
for(var i=0; i<battIdList.length;i++) {
|
if(battIdList[i][0] == id) {
|
// 机房id和电池组id
|
_rsId.push(battIdList[i][0]);
|
_rsId.push(battIdList[i][1]);
|
|
// 机房名称和电池组名称
|
_rsText.push(battList[i][0]);
|
_rsText.push(battList[i][1]);
|
}
|
}
|
_rsObj.tblData = _rsText;
|
_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>
|