$(function () {
//$('#table').attr("data-url", "/conference/" + location.href.split("audit/")[1] + "/audits");
var count = 0;
var fmtIdx = function (value, row, index) {
return index;
}; $('.btn-excel').on('click', function() {
window.location.href= '/conference/auditExcel/' + location.href.split("/")[5];
}); $.ajax({
type: "GET",
url: "/conference/" + location.href.split("audit/")[1] + "/audits",
async:true,
dataType: "json",
success: function (data,columns) {
var columns = [{
field: 'state',
checkbox: true,
formatter:stateFormatter
}, {
field: 'audit_name',
title: '用户名'
}, {
field: 'audit_mobile',
title: '手机'
}, {
field: 'audit_status',
title: '审核状态',
formatter: statusFormatter,
events: actionEvents
}, {
field: 'audit_msg_status',
title: '短信发送状态',
formatter: msgStausFormatter
}
]; if(data.length!==0){
for(var p in data[0]){
if(['state','audit_name','audit_mobile','audit_status','audit_msg_status','audit_id','conf_id','user_id'].indexOf(p)==-1){
columns.push({ field:p,title:p});
}
}
} (function(columns){ $('#table').bootstrapTable('destroy').bootstrapTable({
method: 'get',
url: "/conference/" + location.href.split("audit/")[1] + "/audits",
cache: false,
striped: true,
sidePagination: 'client', // client or server
pageNumber: 1,
pageSize: 10,
pageList: [10,20,30],
paginationHAlign: 'right', //right, left
paginationVAlign: 'bottom', //bottom, top, both
sortable:false,
search: true,
showColumns: true,
showPaginationSwitch: true,
showRefresh: true,
clickToSelect: true,
responseHandler: function (res) {
console.log(res);
var len = res.length;
for(var i=0;i<len;i++){
res[i].index = i;
}
return res;
},
columns:columns
});
})(columns);
}
}); function topwvalid() {
$('#res').attr('action', 'respw').submit();
}
}); window.actionEvents = {
'click .pass' : function (e, value, row, index) {
audit(1,row,index);
},
'click .nopass' : function (e, value, row, index) {
audit(2,row,index);
}
} //审核提交
function audit(status, row ,index) {
$.ajax({
type: "PUT",
url: "/conference/audit",
data: {
audit_id: row.audit_id,
audit_status: status
},
dataType: "json",
success: function (data) {
console.log(data);
row.audit_status = status;
$('table').bootstrapTable('updateRow',{
index:index,
row:row
}
);
}
});
} //批量审核
function sign(status){
var list = $('#table').bootstrapTable('getSelections');
var len = list.length; count = 0;
for(var i=0;i<len;i++){
(function(i){ $.ajax({
type: "PUT",
url: "/conference/audit",
data: {
audit_id: list[i].audit_id,
audit_status: status,
},
dataType: "json",
success: function (data) {
if(data.RS_CODE==0){
list[i].audit_status =status;
count++;
if(i===len-1){
$('#table').bootstrapTable('updateRow',{index:list[i].index,row:list[i]});
$('#alllowNum').text((~~$('#alllowNum').text()+count));
}
}else{
console.log(data.RS_MSG);
}
}
}); })(i); }
} //checkbox 格式化
function stateFormatter(value, row) {
if(row.audit_status==1||row.audit_status==2){
return {
disabled: true
};
}
return value;
} //状态格式化
function statusFormatter(value, row) {
if (value == 0) {
return "<button type='button' class='btn btn-primary btn-xs pass'>通过</button>"+
"<button type='button' class='btn btn-primary btn-xs nopass' style='margin-left:20px;'>拒绝通过</button>";
} else if(value == 1) {
return "<span class='pass'>已通过</span>";
}else {
return "<span class='red'>已拒绝</span>";
}
} //短信状态格式化
function msgStausFormatter(value) {
if (value == 0) {
return "未发送";
} else if(value == 1) {
return "已发送";
}else {
return "发送失败";
}
}
/*<form action="" method="post" id="res">
<input type="hidden" name="confId" id="confId" value="${confdata.confId}">
<input type="hidden" name="respw" id="respw" value="${respw}"> </form>*/

我的bootstrapTable的应用的更多相关文章

  1. JS组件系列——BootstrapTable+KnockoutJS实现增删改查解决方案(一)

    前言:出于某种原因,需要学习下Knockout.js,这个组件很早前听说过,但一直没尝试使用,这两天学习了下,觉得它真心不错,双向绑定的机制简直太爽了.今天打算结合bootstrapTable和Kno ...

  2. JS组件系列——BootstrapTable 行内编辑解决方案:x-editable

    前言:之前介绍bootstrapTable组件的时候有提到它的行内编辑功能,只不过为了展示功能,将此一笔带过了,罪过罪过!最近项目里面还是打算将行内编辑用起来,于是再次研究了下x-editable组件 ...

  3. JS组件系列——BootstrapTable+KnockoutJS实现增删改查解决方案(四):自定义T4模板快速生成页面

    前言:上篇介绍了下ko增删改查的封装,确实节省了大量的js代码.博主是一个喜欢偷懒的人,总觉得这些基础的增删改查效果能不能通过一个什么工具直接生成页面效果,啥代码都不用写了,那该多爽.于是研究了下T4 ...

  4. JS组件系列——BootstrapTable+KnockoutJS实现增删改查解决方案(三):两个Viewmodel搞定增删改查

    前言:之前博主分享过knockoutJS和BootstrapTable的一些基础用法,都是写基础应用,根本谈不上封装,仅仅是避免了html控件的取值和赋值,远远没有将MVVM的精妙展现出来.最近项目打 ...

  5. 总结一下项目中遇到的分页问题,使用bootstrap-table来做的后台分页,大家可以借鉴一下 (分页第一篇)

    前台进入bootstrap的js和css文件,我就不多少了,另外要引进bootstrap-table的js和css 废话不多说,直接代码.   框架为ssm,代码很清楚 <div class=& ...

  6. JS组件系列——BootstrapTable+KnockoutJS实现增删改查解决方案(二)

    前言:上篇 JS组件系列——BootstrapTable+KnockoutJS实现增删改查解决方案(一) 介绍了下knockout.js的一些基础用法,由于篇幅的关系,所以只能分成两篇,望见谅!昨天就 ...

  7. 级联两个bootstrap-table。一张表显示相关的数据,通过点击这张表的某一行,传过去对应的ID,刷新另外一张表。

    二张表的代码(我用的插件,大家可以去网上直接下载http://issues.wenzhixin.net.cn/bootstrap-table/): <div class="contai ...

  8. bootstrap-table填坑之旅<二>事件

    接着研究bootstrap-table... ... 这一篇研究bootstrap-table的事件及回调函数 先上一个demo HTML <div class="alert aler ...

  9. bootstrap-table填坑之旅<一>认识bootstrap-table

    应公司需求,改版公司ERP的数据显示样式.由于前期开发的样式是bootstrap,所以选bootstrap-table理所当然(也是因为看了bootstrap-table官网的example功能强大, ...

随机推荐

  1. 修改hosts文件在本地使域名解析到指定IP

    # Additionally, comments (such as these) may be inserted on individual  # lines or following the mac ...

  2. Spring Aspectj切入点语法定义

    在使用spring框架配置AOP的时候,pointcut"切入点" 例如定义切入点表达式 execution(* com.sample.service.impl..*.*(..)) ...

  3. js压缩xml字符串,将xml字符串转换为xml对象,将xml对象转换为json对象

    /** * 压缩xml字符串 */ function compressXmlStr(str){ var prefix, suffix; var i = str.indexOf("\r&quo ...

  4. ThinkPHP 多语言

    1.注意区分项目语言包和系统语言包 2.实现语言包和数据库语言同步切换 实用链接: ThinkPHP完全开发手册3.1 多语言 thinkphp3.1 多语言简单demo 总结ThinkPHP使用技巧 ...

  5. ajax实现局部刷新

    <!DOCTYPE html><html><head lang="en"> <meta charset="UTF-8" ...

  6. Beta版本冲刺第七天

    Aruba 408 409 410 428 429 431 完成任务: 新增:完成文字导出为图片并改善画布大小 改进:适应MIUI系统相册选图 改进:调整activity间的跳转逻辑 改进:调整编辑窗 ...

  7. note

    John的博客 http://blog.sina.com.cn/chinatownjohn 剑4-11真题+新东方pdf,王陆语料库(听力)+顾家北手把手教你写剑9版(写作)+人人雅思哥记忆卡(口语) ...

  8. python_九九乘法表

    # 九九乘法表 print(" 九九乘法表") for table_x in range(1,10): for table_y in range(1,table_x +1): pr ...

  9. [Java] ApplicationContext 辅助类

    我们经常需要获取各种 bean , 需要用到 context. 下面的类可以方便的使用 context , 获取 bean 等. import java.io.File; import java.ut ...

  10. 百度编辑器ueditor插入表格没有边框颜色的解决方法

    附:从word excel 中 复制的表格提交后无边框,参考这个同学的,写的很详细:   http://blog.csdn.net/lovelyelfpop/article/details/51678 ...