多选框优化

master
duhui 2022-08-29 21:48:34 +08:00
parent 7cacd54d1c
commit 78c64b4daf
13 changed files with 228 additions and 269 deletions

View File

@ -10,6 +10,7 @@ import com.jmfy.redisProperties.RedisUserKey;
import com.jmfy.thrift.idl.Result;
import com.jmfy.utils.RPCClient;
import com.jmfy.utils.RedisUtil;
import com.jmfy.utils.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
@ -58,6 +59,9 @@ public class GmController {
}
String serverId = request.getParameter("serverId");
if (StringUtil.isEmpty(serverId)){
return 1;
}
String[] split = serverId.split(",");
for (String str : split) {
if (!serverList.contains(str)) {

View File

@ -69,7 +69,7 @@ public class MailController {
try {
List<ServerInfo> allServerInfo = serverInfoDao.getAllServerInfo();
allServerInfo.removeIf(v->Integer.parseInt(v.getStatus()) <= 0);
map.addAttribute("serverInfo",allServerInfo);
map.addAttribute("serverInfos",allServerInfo);
map.addAttribute("itemNameMap",itemNameMap);
} catch (Exception e) {
e.printStackTrace();

View File

@ -24,6 +24,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
@ -71,7 +72,6 @@ public class ServerInfoController {
serverInfoVos.add(serverInfoVo);
}
map.addAttribute("serverInfos", serverInfoVos);
map.addAttribute("state", state);
return "findServerInfo";
}
@ -139,9 +139,7 @@ public class ServerInfoController {
* @throws Exception
*/
private ServerInfoVo createServerVo(ServerInfo serverInfo,int quick) throws Exception {
ServerInfoVo vo = new ServerInfoVo(serverInfo);
// ip+端口
vo.setIpAndPort(serverInfo.getIp()+":"+serverInfo.getPort());
ServerInfoVo vo = ServerInfoVo.newServerInfoVo(serverInfo);
// 服务器配置,开服时间,重启时间,版本号
CServerOpenTime openTime = getServerOpenTime(serverInfo.getServer_id(), quick);
if (openTime != null){
@ -149,19 +147,6 @@ public class ServerInfoController {
vo.setRestartTime(openTime.getRestartTime());
vo.setVersion(openTime.getVersion());
}
// 开服方法
String openType = "手动开服";
AutoServerSetting setting = RedisUtil.getInstence().getMapValue(RedisUserKey.AUTO_START_SERVER_SETTING, "1", "1", AutoServerSetting.class, -1);
if (setting != null && "1".equals(setting.getState())){
openType = "1".equals(setting.getChoose())?"按量开服":"自动开服";
}
vo.setOpenType(openType);
// gm跨服分组
vo.setCrossGroupId(getServerGroupId(serverInfo.getServer_id()));
// 游戏服务器跨服分组
vo.setOldGroupId(getGameServerGroupId(serverInfo.getServer_id()));
return vo;
}
@ -328,7 +313,7 @@ public class ServerInfoController {
@RequestMapping(value = "/toUpdateServerList", method = {RequestMethod.POST, RequestMethod.GET})
public String toUpdateServerList(ModelMap map) throws Exception {
List<ServerInfo> allServerInfo = serverInfoDao.getAllServerInfo();
map.addAttribute("serverInfo", allServerInfo);
map.addAttribute("serverInfos", allServerInfo);
return "serverListEdit";
}
@ -577,7 +562,6 @@ public class ServerInfoController {
portStatusMap.clear();
portStatusMap = cacheMap;
} catch (Exception e) {
LoginController.addQueue("检查游戏端口状态报错:"+e.getMessage());
e.printStackTrace();
} finally {
if (exec != null) {

View File

@ -1,6 +1,10 @@
package com.jmfy.model.vo;
import com.jmfy.controller.ServerInfoController;
import com.jmfy.model.AutoServerSetting;
import com.jmfy.model.ServerInfo;
import com.jmfy.redisProperties.RedisUserKey;
import com.jmfy.utils.RedisUtil;
import org.springframework.data.annotation.Transient;
public class ServerInfoVo extends ServerInfo {
@ -75,20 +79,32 @@ public class ServerInfoVo extends ServerInfo {
}
public ServerInfoVo(ServerInfo serverInfo){
this.setName(serverInfo.getName());
this.setIp(serverInfo.getIp());
this.setPort(serverInfo.getPort());
this.setServer_id(serverInfo.getServer_id());
this.setChannel(serverInfo.getChannel());
this.setSub_channel(serverInfo.getSub_channel());
this.setStatus(serverInfo.getStatus());
this.setPlat(serverInfo.getPlat());
this.setIs_new(serverInfo.getIs_new());
this.setRegister_state(serverInfo.getRegister_state());
this.setCoreName(serverInfo.getCoreName());
this.setIsWhite(serverInfo.getIsWhite());
this.setServer_version(serverInfo.getServer_version());
public static ServerInfoVo newServerInfoVo(ServerInfo serverInfo){
ServerInfoVo vo = new ServerInfoVo();
// 继承的属性
vo.setName(serverInfo.getName());
vo.setIp(serverInfo.getIp());
vo.setPort(serverInfo.getPort());
vo.setServer_id(serverInfo.getServer_id());
vo.setChannel(serverInfo.getChannel());
vo.setSub_channel(serverInfo.getSub_channel());
vo.setStatus(serverInfo.getStatus());
vo.setPlat(serverInfo.getPlat());
vo.setIs_new(serverInfo.getIs_new());
vo.setRegister_state(serverInfo.getRegister_state());
vo.setCoreName(serverInfo.getCoreName());
vo.setIsWhite(serverInfo.getIsWhite());
vo.setServer_version(serverInfo.getServer_version());
// 扩展的属性
vo.setIpAndPort(serverInfo.getIp()+":"+serverInfo.getPort());
// gm跨服分组
vo.setCrossGroupId(ServerInfoController.getServerGroupId(serverInfo.getServer_id()));
// 游戏服务器跨服分组
vo.setOldGroupId(ServerInfoController.getGameServerGroupId(serverInfo.getServer_id()));
// 开服方法
vo.setOpenType();
return vo;
}
public int getOldGroupId() {
@ -127,8 +143,13 @@ public class ServerInfoVo extends ServerInfo {
return openType;
}
public void setOpenType(String openType) {
this.openType = openType;
public void setOpenType() {
String result = "手动开服";
AutoServerSetting setting = RedisUtil.getInstence().getMapValue(RedisUserKey.AUTO_START_SERVER_SETTING, "1", "1", AutoServerSetting.class, -1);
if (setting != null && "1".equals(setting.getState())){
result = "1".equals(setting.getChoose())?"按量开服":"自动开服";
}
this.openType = result;
}
public long getRegisterNum() {
@ -147,22 +168,6 @@ public class ServerInfoVo extends ServerInfo {
this.onlineNum = onlineNum;
}
public int getGamePortState() {
return gamePortState;
}
public void setGamePortState(int gamePortState) {
this.gamePortState = gamePortState;
}
public int getPayPortState() {
return payPortState;
}
public void setPayPortState(int payPortState) {
this.payPortState = payPortState;
}
public int getVersion() {
return version;
}
@ -190,21 +195,6 @@ public class ServerInfoVo extends ServerInfo {
public String getGroupShow(){
return getCrossGroupId()+"("+getOldGroupId()+")";
}
@Override
public String toString() {
return "ServerInfoVo{" +
"ipAndPort='" + ipAndPort + '\'' +
", openTime='" + openTime + '\'' +
", restartTime='" + restartTime + '\'' +
", version=" + version +
", openType='" + openType + '\'' +
", registerNum=" + registerNum +
", onlineNum=" + onlineNum +
", gamePortState=" + gamePortState +
", payPortState=" + payPortState +
'}';
}
}

View File

@ -179,7 +179,6 @@ public class AutoServerManager {
cont = "服务器验证开服时间错误:服务器信息:{"+serverTime.toString()+"}";
}
} catch (Exception e) {
LoginController.addQueue("检查服务器开启状态报错服务器id"+serverId+",报错:"+e.getMessage());
cont = "服务器验证状态异常:{"+e.getMessage()+"}";
e.printStackTrace();
}

File diff suppressed because one or more lines are too long

View File

@ -9,23 +9,20 @@
<meta http-equiv="Cache-Control" content="no-siteapp"/>
<script type="text/javascript" src="lib/html5shiv.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<!-- <![endif]&ndash;&gt;-->
<!-- <![endif]&ndash;&gt;-->
<link rel="stylesheet" type="text/css" href="h-ui/css/H-ui.min.css"/>
<link rel="stylesheet" type="text/css" href="h-ui.admin/css/H-ui.admin.css"/>
<link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.8/iconfont.css"/>
<link rel="stylesheet" type="text/css" href="h-ui.admin/skin/default/skin.css" id="skin"/>
<link rel="stylesheet" type="text/css" href="h-ui.admin/css/style.css"/>
<!-- 多选框 -->
<link href="../static/searchableSelect/css/jquery.searchableSelect.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="https://apps.bdimg.com/libs/bootstrap/3.3.4/css/bootstrap.css">
<link href="../static/bootstrap/css/bootstrap-select.css" rel="stylesheet">
<!-- IE6支持 -->
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js"></script>
<script>DD_belatedPNG.fix('*');</script>
<title>服务器列表信息</title>
</head>
<body>
<nav class="breadcrumb" style="padding-bottom: 45px;">
<nav class="breadcrumb">
<i class="Hui-iconfont">&#xe67f;</i> 首页
<span class="c-gray en">&gt;</span> 服务器管理
<span class="c-gray en">&gt;</span> 服务器信息
@ -38,27 +35,9 @@
<h2><span style="color:red;">服务器信息</span></h2>
<div class="text-c">
<div style="text-align: left;">
<!--多选服务器-->
<select name="serverId" class="selectpicker" id="serverId" multiple
data-live-search="true"
data-width="260px"
data-actions-box="true">
<option th:each="server:${serverInfos}" th:if="${server.getStatus() != '-2'}" th:value="${server.getServer_id()}"
th:text="${server.getServer_id()}+'-'+${server.getName()}"></option>
</select>
<select name="status2" class="input-text" id="status2" title="服务器状态,《请选择》状态不做修改" style="width: 150px;"><!--下拉列表-->
<option value="-999">请选择</option>
<option value="-5">维护并踢全部玩家下线</option>
<option value="0">关闭</option>
<option value="1">维护</option>
<option value="2">流畅</option>
<option value="3">拥挤</option>
<option value="4">爆满</option>
</select>
<button class="btn btn-primary" type="button" onclick="updateServers()">批量修改</button>
<!-- <div style="float: right">-->
<!-- 刷新服务器缓存:【<a href="/findServerInfoNotCache">刷新</a>】-->
<!-- </div>-->
<div th:id="serverIds" style="float: left;width: 230px;"></div>
<div th:id="statuss" style="float: left;width: 120px;margin-left: 10px;"></div>
<button class="btn btn-secondary" style="margin-left: 10px;height: 40px;line-height: 40px;" type="button" onclick="updateServers()">批量修改</button>
</div>
<div class="mt-20">
<table class="table table-border table-bordered table-bg table-hover table-sort table-responsive">
@ -72,13 +51,13 @@
<th width="70">core</th>
<th width="150">开服时间</th>
<th width="100">跨服id当前</th>
<th width="100">服务器状态</th>
<th width="70">状态</th>
<th width="70">新服推荐</th>
<th width="70">版本号</th>
<th width="150">上次重启时间</th>
<!-- <th width="200">游戏端口状态(160*)</th>-->
<!-- <th width="200">支付端口状态(180*)</th>-->
<th width="200">操作</th>
<th width="250">操作</th>
</tr>
</thead>
<tbody>
@ -116,16 +95,16 @@
<!-- <span th:case="1" class="Hui-iconfont" style="color:green">开启</span>-->
<!-- </th>-->
<td class="td-manage" style="text-align: center;">
<a href="#" class="btn btn-primary radius" th:id="${obj.getServer_id()}" onclick="return editServer(this)">
<a href="#" th:id="${obj.getServer_id()}" class="btn btn-primary" onclick="return editServer(this)">
<i class="Hui-iconfont"></i> 修改
</a>
<button type="button" th:id="${obj.getServer_id()}" class="btn btn-danger" onclick="return deleteServer(this)">
<button type="button" th:id="${obj.getServer_id()}" class="btn btn-warning" onclick="return deleteServer(this)">
<i class="Hui-iconfont"></i> 删除
</button>
<button type="button" th:id="${obj.getServer_id()}" class="btn btn-secondary" onclick="return restartServer(this)">
<button type="button" th:id="${obj.getServer_id()}" class="btn btn-warning" onclick="return restartServer(this)">
<i class="Hui-iconfont"></i> 重启
</button>
<button type="button" th:id="${obj.getServer_id()}" class="btn btn-info" onclick="return cleanupServer(this)">
<button type="button" th:id="${obj.getServer_id()}" class="btn btn-danger" onclick="return cleanupServer(this)">
<i class="Hui-iconfont"></i> 清库
</button>
</td>
@ -145,12 +124,10 @@
<script type="text/javascript" src="lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
<!-- 多选框 -->
<script src="../static/bootstrap/js/bootstrap-select.js"></script>
<script type="text/javascript" src="../static/searchableSelect/js/jquery.searchableSelect.js"></script>
<script src="../static/searchableSelect/js/initBootstrap.js"></script>
<!--多选框-->
<script src="../static/xmSelect/js/xm-select.js"></script>
<script type="text/javascript">
<script th:inline="javascript">
$('.table-sort').dataTable({
"aaSorting": [[0, "desc"]],//默认第几个排序
"bStateSave": true,//状态保存
@ -160,6 +137,74 @@
]
});
var serverInfos = xmSelect.render({
el: '#serverIds', // div的id值
template({name, value}){
return name + '<span style="position: absolute; right: 10px; color: #8799a3">'+value+'</span>'
},
toolbar: { // 工具条【‘全选’,‘清空’】
show: true, // 开启工具条
showIcon: false, // 隐藏工具条的图标
},
tips: '选择服务器', // 让默认值不是“请选择”,而是“选择校区”
filterable: true, // 开启搜索模式默认按照name进行搜索
height:'260px',
model: {
label: {
type: 'block',
block: {
//最大显示数量, 0:不限制
showCount: 1,
//是否显示删除图标
showIcon: true,
}
}
},
prop: {
name: 'name',
value: 'server_id',
},
data: function () {
var infos = [[${serverInfos}]];
for (var i = infos.length - 1; i >= 0; i--) {
// 删除掉所有为2的元素
if(infos[i].statusInt == -2) {
infos.splice(i, 1);
}
}
return infos;
},
});
var serverStatus = xmSelect.render({
el: '#statuss', // div的id值
radio: true,
clickClose: true,
tips: '选择状态', // 让默认值不是“请选择”,而是“选择校区”
height:'260px',
model: {
label: {
type: 'text',
text: {
//左边拼接的字符
left: '',
//右边拼接的字符
right: '',
//中间的分隔符
separator: ', ',
},
}
},
data: [ // 默认是name相当于我们常传的value值和value(相当于我们常传的id)
{name: '停服', value: -5},
{name: '关闭', value: 0},
{name: '维护', value: 1},
{name: '流畅', value: 2},
{name: '拥挤', value: 3},
{name: '爆满', value: 4},
]
});
// 单个修改服务器
function editServer(obj) {
var serverId = $(obj).attr("id");
@ -255,13 +300,18 @@
// 批量修改服务器状态
function updateServers() {
var serverId = $("#serverId").val().toString();
var status2 = $("#status2").val().toString();
// 跨服信息
var serverId = serverInfos.getValue('valueStr');
var status = serverStatus.getValue('valueStr');
if (serverId == "" || status == ""){
alert("服务器或者状态未选择!");
return;
}
$.ajax({
type: "POST",
data: {
"serverId" : serverId,
"status": status2,
"status": status,
},
url: "/serverListEdit",
success: function (data) {

View File

@ -48,7 +48,7 @@
区服id</label>
<div class="formControls col-xs-8 col-sm-9">
<select name="serverId" class="input-text" id="serverId"><!--下拉列表-->
<option th:each="server:${serverInfo}" th:value="${server.server_id}"
<option th:each="server:${serverInfos}" th:value="${server.server_id}"
th:text="${server.server_id}+'-'+${server.name}"></option>
</select>
<span class="SERVERID"></span>

View File

@ -18,10 +18,6 @@
<link rel="stylesheet" type="text/css" href="../static/lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/style.css" />
<!-- 多选框 -->
<link href="../static/searchableSelect/css/jquery.searchableSelect.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="https://apps.bdimg.com/libs/bootstrap/3.3.4/css/bootstrap.css">
<link href="../static/bootstrap/css/bootstrap-select.css" rel="stylesheet">
<!--[if IE 6]>
<script type="text/javascript" src="../static/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
@ -37,38 +33,14 @@
发送GM
<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div class="page-container">
<div class="page-container text-c">
<h2 style="text-align: center"><span style="color:red;">发送GM</span></h2>
<div class="row cl">
<label class="form-label col-xs-4 col-sm-2">
<span class="c-red">*</span>
区服id</label>
<div class="formControls col-xs-8 col-sm-9" style="margin: -3px 0 0 -150px;">
<!--多选服务器-->
<select name="serverId" class="selectpicker" id="serverId" multiple
data-live-search="true"
data-width="300px"
data-actions-box="true">
<option th:each="server:${serverInfo}" th:value="${server.getServer_id()}"
th:text="${server.getServer_id()}+'-'+${server.getName()}"></option>
</select>
</div>
</div>
<div class="row cl" style="margin-top: 20px;">
<label class="form-label col-xs-4 col-sm-2">
<span class="c-red">*</span>
内容:</label>
<div class="formControls col-xs-8 col-sm-9" style="margin: -3px 0 0 -150px;">
<input type="text" name="content" placeholder="" value="" class="input-text"/>
<span class="ROLEID"></span>
</div>
</div>
<div class="row cl" style="margin-top: 20px;">
<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
<button class="btn btn-primary radius" style="font-size: 15px" onclick="sub()"><i class="Hui-iconfont">&#xe665;</i>
提交
<div th:id="serverIds" style="width: 230px;margin-left: 80px;"></div>
<input type="text" name="content" style="height: 36px;line-height: 36px;width: 500px; float: left; margin: 20px 0 0 80px;" placeholder="发送内容(不能为空)" class="input-text"/>
<div>
<button class="btn btn-primary radius" style="font-size: 15px;margin-top: 80px; float: left" onclick="sub()">
<i class="Hui-iconfont">&#xe665;</i>提交
</button>
</div>
</div>
@ -83,61 +55,58 @@
<script type="text/javascript" src="../static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="../static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->
<!-- 多选框 -->
<script type="text/javascript" src="../static/searchableSelect/js/jquery.searchableSelect.js"></script>
<script src="../static/bootstrap/js/bootstrap-select.js"></script>
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="../static/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="../static/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="../static/lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="../static/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript">
<!--多选框-->
<script src="../static/xmSelect/js/xm-select.js"></script>
$(function () {
// 模糊搜素
$('#InputsWrapper select').searchableSelect();
});
<script th:inline="javascript">
// 下拉框多选
init();
function init() {
initInfo();
}
function initInfo() {
$(window).on('load', function () {
$('.selectpicker').selectpicker({
// 'selectedText': 'cat',
noneSelectedText: '请选择',
noneResultsText: '没有找到匹配的组织 {0}'
});
$('.selectpicker').selectpicker('refresh');
// 检测浏览器的方法由用户自行决定
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)) {
$('.selectpicker').selectpicker('mobile');
var serverInfos = xmSelect.render({
el: '#serverIds', // div的id值
template({name, value}){
return name + '<span style="position: absolute; right: 10px; color: #8799a3">'+value+'</span>'
},
toolbar: { // 工具条【‘全选’,‘清空’】
show: true, // 开启工具条
showIcon: false, // 隐藏工具条的图标
},
tips: '选择服务器', // 让默认值不是“请选择”,而是“选择校区”
filterable: true, // 开启搜索模式默认按照name进行搜索
height:'260px',
model: {
label: {
type: 'block',
block: {
//最大显示数量, 0:不限制
showCount: 1,
//是否显示删除图标
showIcon: true,
}
}
});
}
},
prop: {
name: 'name',
value: 'server_id',
},
data: [[${serverInfos}]],
});
function sub() {
var content = $("input[name='content']").val();
if (content == null || content === ""){
alert("发送内容不能为空");
return false;
}
var serverId = $("#serverId").val();
if (serverId == null || serverId === ""){
alert("服务器列表不能为空");
return false;
return;
}
var serverId = serverInfos.getValue('valueStr');
$.ajax({
type: "POST",
data: {
"serverId": serverId.toString(),
"serverId": serverId,
"content": content
},
url: "/sendGm",
@ -151,22 +120,6 @@
}
})
}
$(function() {
// 获得上面的复选框
var $selectAll = $("#selectAll");
// alert($selectAll.prop("checked")); // 返回undefined未定义
$selectAll.click(function() {
// alert($selectAll.prop("checked"));
if ($selectAll.prop("checked") == true) {
// 上面的复选框已被选中
$(":checkbox[name='serverId']").prop("checked", true);
} else {
// 上面的复选框没被选中
$(":checkbox[name='serverId']").prop("checked", false);
}
});
});
</script>
</body>
</html>

View File

@ -45,7 +45,7 @@
<div class="formControls col-xs-8 col-sm-9">
<select name="serverId" class="input-text" id="serverId"><!--下拉列表-->
<option value="0" selected = "selected">所有区服</option>
<option th:each="server:${serverInfo}" th:value="${server.server_id}" th:text="${server.server_id}+'-'+${server.name}"></option>
<option th:each="server:${serverInfos}" th:value="${server.server_id}" th:text="${server.server_id}+'-'+${server.name}"></option>
</select>
</div>
</div>

View File

@ -59,7 +59,7 @@
data-width="300px"
data-actions-box="true">
<!-- <select name="serverId" id="serverId" class="input-text">&lt;!&ndash;下拉列表&ndash;&gt;-->
<option th:each="server:${serverInfo}" th:value="${server.server_id}"
<option th:each="server:${serverInfos}" th:value="${server.server_id}"
th:text="${server.server_id}+'-'+${server.name}"></option>
</select>
</div>

View File

@ -18,10 +18,6 @@
<link rel="stylesheet" type="text/css" href="../static/lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/style.css" />
<!-- 多选框 -->
<link href="../static/searchableSelect/css/jquery.searchableSelect.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="https://apps.bdimg.com/libs/bootstrap/3.3.4/css/bootstrap.css">
<link href="../static/bootstrap/css/bootstrap-select.css" rel="stylesheet">
<!--[if IE 6]>
<script type="text/javascript" src="../static/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
@ -39,22 +35,7 @@
</nav>
<div class="page-container">
<h2 style="text-align: center"><span style="color:red;">批量修改服务器信息</span></h2>
<div class="row cl">
<label class="form-label col-xs-4 col-sm-2">
<span class="c-red">*</span>
区服id</label>
<div class="formControls col-xs-8 col-sm-9" style="margin: -3px 0 0 -150px;">
<!--多选服务器-->
<select name="serverId" class="selectpicker" id="serverId" multiple
data-live-search="true"
data-width="300px"
data-actions-box="true">
<option th:each="server:${serverInfo}" th:value="${server.getServer_id()}"
th:text="${server.getServer_id()}+'-'+${server.getName()}"></option>
</select>
</div>
</div>
<div th:id="serverIds" style="width: 230px;"></div>
<div class="row cl" style="margin-top: 20px;">
<label class="form-label col-xs-1" style="margin-left: 7px" title="未运营状态的服务器可以立即修改,其他状态下服务器会在下周一零点生效">
跨服id修改
@ -74,49 +55,49 @@
<script type="text/javascript" src="../static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="../static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->
<!-- 多选框 -->
<script type="text/javascript" src="../static/searchableSelect/js/jquery.searchableSelect.js"></script>
<script src="../static/bootstrap/js/bootstrap-select.js"></script>
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="../static/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="../static/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="../static/lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="../static/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<!--多选框-->
<script src="../static/xmSelect/js/xm-select.js"></script>
<script type="text/javascript">
<script th:inline="javascript">
$(function () {
// 模糊搜素
$('#InputsWrapper select').searchableSelect();
});
// 下拉框多选
init();
function init() {
initInfo();
}
function initInfo() {
$(window).on('load', function () {
$('.selectpicker').selectpicker({
// 'selectedText': 'cat',
noneSelectedText: '请选择',
noneResultsText: '没有找到匹配的组织 {0}'
});
$('.selectpicker').selectpicker('refresh');
// 检测浏览器的方法由用户自行决定
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)) {
$('.selectpicker').selectpicker('mobile');
var serverInfos = xmSelect.render({
el: '#serverIds', // div的id值
template({name, value}){
return name + '<span style="position: absolute; right: 10px; color: #8799a3">'+value+'</span>'
},
toolbar: { // 工具条【‘全选’,‘清空’】
show: true, // 开启工具条
showIcon: false, // 隐藏工具条的图标
},
tips: '选择服务器', // 让默认值不是“请选择”,而是“选择校区”
filterable: true, // 开启搜索模式默认按照name进行搜索
height:'260px',
model: {
label: {
type: 'block',
block: {
//最大显示数量, 0:不限制
showCount: 1,
//是否显示删除图标
showIcon: true,
}
}
});
}
},
prop: {
name: 'name',
value: 'server_id',
},
data: [[${serverInfos}]],
});
// 批量修改服务器状态
function updateCrossId() {
var serverId = $("#serverId").val().toString();
var serverId = serverInfos.getValue('valueStr');
var crossId = $("#crossId").val().toString();
$.ajax({
type: "POST",
@ -134,22 +115,6 @@
}
})
}
$(function() {
// 获得上面的复选框
var $selectAll = $("#selectAll");
// alert($selectAll.prop("checked")); // 返回undefined未定义
$selectAll.click(function() {
// alert($selectAll.prop("checked"));
if ($selectAll.prop("checked") == true) {
// 上面的复选框已被选中
$(":checkbox[name='serverId']").prop("checked", true);
} else {
// 上面的复选框没被选中
$(":checkbox[name='serverId']").prop("checked", false);
}
});
});
</script>
</body>
</html>

View File

@ -27,7 +27,13 @@
</div>
<div style="margin-left: 20px;font-size: 18px">
<div>
<h2 style="color: red" class="f-36">更新日志[2022-7-13]</h2>
<h2 style="color: red" class="f-36">更新日志[2022-8-29]</h2>
<p class="f-14" style="line-height:32px;">
1、修改了部分界面的“服务器多选框”的样式兼容手机页面<br>
2、修改了服务器信息界面部分按钮的配色<br>
</p>
<h2 style="color: red" class="f-18">更新日志[2022-7-13]</h2>
<p class="f-14" style="line-height:32px;">
1、“服务器管理”标签下添加“批量修改服务器信息”页面用来做服务器的批量修改包含全部状态服务器<br>
2、“服务器信息”界面的 批量修改跨服id输入框 移动到 “批量修改服务器信息” 界面下,修改服务器状态选择框还在原位<br>