$(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>*/

最新文章

  1. [.Net] 手把手带你将自己打造的类库丢到 NuGet 上
  2. RedHat 和 Mirantis OpenStack 产品的版本和功能汇总和对比(持续更新)
  3. The superclass javax.servlet.http.HttpServlet was not found on the Java Build Path。
  4. python 代码片段21
  5. C++ Primer与c++编程思想的比较(转)
  6. ArrayList调用remove方法需要注意的地方
  7. 2014-08-04 BBS主页页面的设计
  8. vs2010更改默认环境设置
  9. QSlider解决点击不能到该位置问题
  10. 每天一个Linux命令 3
  11. github如何添加ssh
  12. php基本函数的学习(2)
  13. Python字符串的操作
  14. 解决 HomeBrew 下载缓慢的问题
  15. angularjs1.X进阶笔记(3)——如何重构controller
  16. bs4 FeatureNotFound: Couldn&#39;t find a tree builder with the features you requested: lxml. Do you need to install a parser library?
  17. php curl使用 常用操作
  18. Java学习之JDBC 2019/3/10
  19. Python 语言来编码和解码 JSON 对象
  20. dma传输数据长度,在启动前必须确保是一个大于0的数字

热门文章

  1. javascript中的感叹号 &quot;!&quot;
  2. Goodbye 2016 总结与展望
  3. Dubbo_异常_Service启动时默认将方法注册到内网IP
  4. BZOJ1257 [CQOI2007]余数之和sum
  5. 【JavaWeb】Spring+SpringMVC+MyBatis+SpringSecurity+EhCache+JCaptcha 完整Web基础框架(四)
  6. Rest webservice 和SOAP webservice
  7. SNMP Tutorial
  8. Service Provider Interface
  9. JavaScript 实现5秒倒计时,接着跳转
  10. Response to preflight request doesn&#39;t pass access control check: No &#39;Access-Control-Allow-Origin&#39; heade