Keine Beschreibung

onlineServiceList.js 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. $(document).ready(function(){
  2. initTable()
  3. });
  4. function initTable() {
  5. //先销毁表格
  6. $('#table_all').bootstrapTable('destroy');
  7. //初始化表格,动态从服务器加载数据
  8. $("#table_all").bootstrapTable({
  9. method: "get", //使用get请求到服务器获取数据
  10. url: huayi.config.callcenter_url + "testusertypeapi/api/TestUserType/getfpzxinfos", //获取数据的Servlet地址
  11. contentType: 'application/x-www-form-urlencoded',
  12. striped: true, //表格显示条纹
  13. pagination: true, //启动分页
  14. pageSize: 10, //每页显示的记录数
  15. pageNumber: 1, //当前第几页
  16. pageList: [10, 20, 50, 100], //记录数可选列表
  17. search: false, //是否启用查询
  18. showColumns: false, //显示下拉框勾选要显示的列
  19. showRefresh: false, //显示刷新按钮
  20. sidePagination: "server", //表示服务端请求
  21. //设置为undefined可以获取pageNumber,pageSize,searchText,sortName,sortOrder
  22. //设置为limit可以获取limit, offset, search, sort, order
  23. queryParamsType: "undefined",
  24. queryParams: function queryParams(params) { //设置查询参数
  25. var param = {
  26. PageIndex: params.pageNumber,
  27. PageSize: params.pageSize,
  28. // token: $.cookie("token"),
  29. };
  30. return param;
  31. },
  32. responseHandler: function(res) {
  33. return {
  34. "total": res.data.total, //总页数
  35. "rows": res.data.rows //数据
  36. };
  37. },
  38. onLoadSuccess: function (data) { //加载成功时执行
  39. },
  40. onLoadError: function () { //加载失败时执行
  41. }
  42. });
  43. }
  44. //操作
  45. function formatterOperate(val,row){
  46. return '<ul class="tool_downs">' +
  47. '<li><a href="javascript:;" class="aBtn" authorize="yes" id="HY_delete_' + val + '" onclick="btn_edit(\'' + row.id + '\')" title="删除">编辑</a></li>' +
  48. '<li><a href="javascript:;" class="aBtn" authorize="yes" id="HY_delete_' + val + '" onclick="btn_delete(\'' + row.id + '\')" title="删除">删除</a></li>' +
  49. '</ul>';
  50. }
  51. //添加
  52. function btn_add(){
  53. layer.open({
  54. type: 2,
  55. content: "addedit.html",
  56. title: '添加消息模板',
  57. area: ['50%', '45%'], //宽高
  58. });
  59. }
  60. //人员在线状态
  61. function stateOperate(val){
  62. if(val=='0'){
  63. return '<div>未工作</div>'
  64. }else{
  65. return '<div>工作中</div>'
  66. }
  67. }
  68. //编辑
  69. function btn_edit(id){
  70. layer.open({
  71. type: 2,
  72. content: "addedit.html?id="+id,
  73. title: '编辑消息模板',
  74. area: ['50%', '45%'], //宽高
  75. });
  76. }
  77. //删除
  78. function btn_delete(id){
  79. layer.confirm('确定删除选中记录?', {
  80. icon: 7,
  81. btn: ['是', '否'] //按钮
  82. }, function() {
  83. /*发送请求*/
  84. $.ajax({
  85. type: "get",
  86. url: huayi.config.callcenter_url + 'testusertypeapi/api/TestUserType/delefpzxinfos',
  87. async: true,
  88. dataType: 'json',
  89. data: {
  90. id: id,
  91. },
  92. success: function(data) {
  93. if(data.state.toLowerCase() == 'success') {
  94. var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  95. layer.close(index); //再执行关闭
  96. layer.msg("删除成功");
  97. initTable();
  98. }
  99. }
  100. });
  101. });
  102. }