$(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. MobaXterm.9.4|ssh连接工具

    在狂博客中,无意发现的一款集成的远程连接工具MobaXterm.9.4,官方有个人免费版,和企业版!有连接数限制,此款为破解版.感觉还挺不错的,ssh远程连接工具! 01.主界面  02.可选的远程 ...

  2. 一个c#的输入框函数

    private static string InputBox(string Caption, string Hint, string Default) { Form InputForm = new F ...

  3. HTML中为何p标签内不可包含div标签?那哪些块元素里面不能放哪些块元素呢?

    先看下面的例子你就能明白两者的差别: <p>测试一下块元素与<span>内联元素</span>的差别</p> <p>测试一下<div& ...

  4. jQuery 自定义插件 (分页控件)

    1.引入jqpage.js 2.html代码 <div id="page"> </div> 3.js 调用 $(function () { $.fn.jqp ...

  5. 关于Django 错误 doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS

    记录一下 报错 doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS\ 这个问题出现没 ...

  6. iOS中富文本NSMutableAttributedString的用法

    NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc]initWithString:@"我是富文 ...

  7. HAproxy的安装与配置讲解

    1,安装 官网下载 http://www.haproxy.org/#down cd /usr/local/src/ wget http://www.haproxy.org/download/1.4/s ...

  8. iframe 跨域相互操作

    我们在开发后台管理系统时可能会经常要跟 iframe 打交道,因为现在大部分后台管理系统都是页面内嵌iframe,所以有时候两者之间就难免要互相通信,但浏览器为了安全的原因,所以就禁止了不同域的访问, ...

  9. cocos2dx-lua_修改源码流程(cocos2dx-3.10、win7、Cocos Code IDE1.2)

    以下是在cocos2dx-3.10.win7.Cocos Code IDE1.2下假定你已经配置好了cocos2dx的环境.1.修改源代码步骤(1)在Cocos/Cocos2d-x/cocos2d-x ...

  10. ssh key生成

    Mac电脑用终端生成SSH key 访问自己的Github 字数684 阅读427 评论4 喜欢15 前言:最近有不少刚刚使用github管理代码的开发者或者新手码农在网上 问我如何关联自己的gith ...