前端页面
序号
租客姓名
租客手机号
意向房屋地址
状态
负责人编号
负责人
带客申请
${vs.index+1}
${list.name }
${list.phone }
${list.address }
待分配
已分配
${list.user_id }
${list.username }
您无权查看
没有相关数据
统一分配
${page.pageStr}
复选框按钮
$(function() {
//复选框全选控制
var active_class = 'active';
$('#simple-table > thead > tr > th input[type=checkbox]').eq(0).on('click', function(){
var th_checked = this.checked;//checkbox inside "TH" table header
$(this).closest('table').find('tbody > tr').each(function(){
var row = this;
if(th_checked) $(row).addClass(active_class).find('input[type=checkbox]').eq(0).prop('checked', true);
else $(row).removeClass(active_class).find('input[type=checkbox]').eq(0).prop('checked', false);
});
});
});
获取选中的内容
function makeAll(msg){
bootbox.confirm(msg, function(result) {
if(result) {
var str = '';
var emstr = '';
for(var i=0;i < document.getElementsByName('ids').length;i++)
{
if(document.getElementsByName('ids')[i].value!=1){
if(document.getElementsByName('ids')[i].checked){
if(str=='') str += document.getElementsByName('ids')[i].value;
else str += ',' + document.getElementsByName('ids')[i].value;
if(emstr=='') emstr += document.getElementsByName('ids')[i].id;
else emstr += ',' + document.getElementsByName('ids')[i].id;
}
}
}
if(str==''){
bootbox.dialog({
message: "您没有选择任何内容或内容不符!",
buttons:
{ "button":{ "label":"确定", "className":"btn-sm btn-success"}}
});
$("#zcheckbox").tips({
side:3,
msg:'点这里全选',
bg:'#AE81FF',
time:8
});
return;
}else{
if(msg == '确定选中的数据吗?'){
top.jzts();
var diag = new top.Dialog();
diag.Drag=true;
diag.Title ="批量修改";
diag.URL = '<%=basePath%>appointment/editAdmin.do?ids='+emstr;
diag.Width = 600;
diag.Height = 265;
diag.CancelEvent = function(){ //关闭事件
diag.close();
};
diag.show();
后台代码
批量修改我用的是for循环这样会修改几个数据就执行几条sql语句效率比较低,要提高效率可以在xml里面写一个批量修改的sql语句
/**
* 批量修改
* @return
* @throws Exception
*/
@RequestMapping(value="editApp1")
public ModelAndView editApp1() throws Exception{
ModelAndView mv=this.getModelAndView();
PageData pd=this.getPageData();
// appointmentService.listEditApp(pd);
String ids = pd.getString("ids");
String idss[] = ids.split(",");
int user_id=Integer.parseInt((String)pd.get("user_id"));
for(int i=0;i
前后台数据交互的万能类
@SuppressWarnings("rawtypes")
public class PageData extends ActEntity implements Map {
private static final long serialVersionUID = 1L;
private Map map = null;
private HttpServletRequest request;
public PageData(HttpServletRequest request) {
this.request = request;
Map returnMap = new HashMap();
String name = "";
String value = "";
Map properties = request.getParameterMap();
for (Map.Entry entry : properties.entrySet()) {
name = entry.getKey();
Object valueObj = entry.getValue();
if (null == valueObj) {
value = "";
} else if (valueObj instanceof String[]) {
String[] values = (String[]) valueObj;
for (int i = 0; i < values.length; i++) {
value = values[i] + ",";
}
value = value.substring(0, value.length() - 1);
} else {
value = valueObj.toString();
}
returnMap.put(name, value);
}
map = returnMap;
}
public PageData() {
map = new HashMap();
}
@Override
public Object get(Object key) {
Object obj = null;
if (map.get(key) instanceof Object[]) {
Object[] arr = (Object[]) map.get(key);
obj = request == null ? arr : (request.getParameter((String) key) == null ? arr : arr[0]);
} else {
obj = map.get(key);
}
return obj;
}
public String getString(Object key) {
return get(key) == null ? "" : get(key).toString();
}
@SuppressWarnings("unchecked")
@Override
public Object put(Object key, Object value) {
return map.put(key, value);
}
@Override
public Object remove(Object key) {
return map.remove(key);
}
public void clear() {
map.clear();
}
public boolean containsKey(Object key) {
// TODO Auto-generated method stub
return map.containsKey(key);
}
public boolean containsValue(Object value) {
// TODO Auto-generated method stub
return map.containsValue(value);
}
public Set entrySet() {
// TODO Auto-generated method stub
return map.entrySet();
}
public boolean isEmpty() {
// TODO Auto-generated method stub
return map.isEmpty();
}
public Set keySet() {
// TODO Auto-generated method stub
return map.keySet();
}
@SuppressWarnings("unchecked")
public void putAll(Map t) {
// TODO Auto-generated method stub
map.putAll(t);
}
public int size() {
// TODO Auto-generated method stub
return map.size();
}
public Collection values() {
// TODO Auto-generated method stub
return map.values();
}
@Override
public String toString() {
return "PageData [map=" + map + ", request=" + request + "]";
}
}
public abstract class ActEntity implements Serializable {
private static final long serialVersionUID = 1L;
protected Activit act; // 流程任务对象
public ActEntity() {
super();
}
@JsonIgnore
public Activit getAct() {
if (act == null){
act = new Activit();
}
return act;
}
public void setAct(Activit act) {
this.act = act;
}
/**
* 获取流程实例ID
* @return
*/
public String getProcInsId() {
return this.getAct().getProcInsId();
}
/**
* 设置流程实例ID
* @param procInsId
*/
public void setProcInsId(String procInsId) {
this.getAct().setProcInsId(procInsId);
}
}