查询列表代码块如下:
<script type="text/javascript">
/*
* 请在下面编写JS代码
*/
jQuery(function($){
var btnname = "批量更新人员的各级部门";
jQuery(".wea-new-top").after("<div id='btnDiv1'></div>");
// 创建一个按钮元素,并设置其属性和内容
var $button = $("<button type='button' class='ant-btn ant-btn-primary'><span>" + btnname + "</span></button>");
// 使用 .on() 方法来绑定点击事件到按钮上
$button.on("click", buttonClickHandler);
// 将按钮添加到 #btnDiv1 中
$("#btnDiv1").append($button);
//批量修改内容
function buttonClickHandler() {
var ids = ModeList.getCheckedID();
var result = ids.split(',').map(x => `'${x}'`).join(',');
console.log("选中人员ID:"+result);
//向服务器发起请求,批量更新内容
$.ajax({
type:"GET",
url:"/interface/tssx/UpdateSearchList.jsp",
data:{
"result":result
},
success:function(res){
console.log("执行成功");
ModeList.reloadTableAll();
},
error:function(res){
console.log("执行失败");
ModeList.showMessage(res.msg, 2);
}
});
}
});
</script>
<style type="text/css">
/*
* 请在下方编辑CSS
*/
span.tag{
white-space:nowrap;
border-radius:3px;padding:1px 5px;margin:0 0 0 5px;font-size:12px;
color:#888;background-color:#f8f8f8;border:1px solid #ccc;
display:inline-block;
}
span.t{background-color:transparent;border:0;}
#btnDiv1 button,#btnDiv2 button{
margin:8px 10px;
}
#spanDiv1{
width:97%;
font-size: 14px;
border-bottom: 1px solid #ccc;
margin:8px 10px;
line-height: 1.5;
padding:5px 0px;
}
</style>
UpdateSearchList.jsp
内容如下:
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ page import="net.sf.json.JSONArray" %>
<%@ page import="java.util.*" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.Objects" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="weaver.conn.RecordSet,weaver.conn.RecordSetDataSource" %>
<%@ page import="weaver.general.BaseBean" %>
<%@page import="net.sf.json.JSONObject"%>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page"/>
<%
String result = Util.null2String(request.getParameter("result"));
String updateSql = "UPDATE cus_fielddata c INNER JOIN hrmresource a ON a.id = c.id LEFT JOIN view_bmcjpath v ON a.departmentid = v.id \n"+
"SET c.field26 = v.field1, c.field27 = v.field2, c.field28 = v.field3, c.field31 = v.field4, c.field32 = v.field5, c.field33 = v.field6 \n"+
"WHERE c.scopeid = -1 AND a.STATUS < 5 AND C.id IN("+result+")";
rs.executeSql(updateSql);
%>
标签:function,批量,button,表单,E9,result,var,border,泛微
From: https://www.cnblogs.com/oeuvres/p/18545304