濮阳12345web

tongZhiChaXun.js 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. var token = $.cookie("token");
  2. var table = $('#table1');
  3. function LB(obj) {
  4. obj.empty();
  5. $("<option value='-1'>所有分类</option>").appendTo(obj);
  6. $.getJSON(huayi.config.callcenter_url + "CallPlan/GetCategoryAllList2", {
  7. "token": $.cookie("token")
  8. }, function (data) {
  9. if (data.state.toLowerCase() == "success") {
  10. var content = data.data;
  11. $(content).each(function (i, n) {
  12. $("<option value='" + n.id + "'>" + n.name + "</option>").appendTo(obj);
  13. })
  14. }
  15. })
  16. }
  17. $(document).ready(function () {
  18. LB($('#leiBie')); //类别
  19. initTable();
  20. //搜索
  21. $('.searchGo').click(function () {
  22. initTable();
  23. })
  24. //添加
  25. $('.return').click(function () {
  26. top.$("iframe:visible")[0].src = "VoiceNotification/addTongZhi.html";
  27. })
  28. })
  29. function initTable() {
  30. //先销毁表格
  31. table.bootstrapTable('destroy');
  32. //初始化表格,动态从服务器加载数据
  33. table.bootstrapTable({
  34. method: "get", //使用get请求到服务器获取数据
  35. url: huayi.config.callcenter_url + "Callplan/getlist", //获取数据的Servlet地址
  36. contentType: "application/x-www-form-urlencoded",
  37. striped: true, //表格显示条纹
  38. pagination: true, //启动分页
  39. pageSize: 10, //每页显示的记录数
  40. pageNumber: 1, //当前第几页
  41. pageList: [10, 20, 50, 100], //记录数可选列表
  42. search: false, //是否启用查询
  43. showColumns: false, //显示下拉框勾选要显示的列
  44. showRefresh: false, //显示刷新按钮
  45. sidePagination: "server", //表示服务端请求
  46. //设置为undefined可以获取pageNumber,pageSize,searchText,sortName,sortOrder
  47. //设置为limit可以获取limit, offset, search, sort, order
  48. queryParamsType: "undefined",
  49. queryParams: function queryParams(params) { //设置查询参数
  50. var param = {
  51. page: params.pageNumber,
  52. pagesize: params.pageSize,
  53. token: $.cookie("token"),
  54. name: $('.keyw').val(),
  55. categoryid: $('#leiBie').val()
  56. };
  57. return param;
  58. },
  59. onLoadSuccess: function () { //加载成功时执行
  60. //layer.msg("加载成功");
  61. },
  62. onLoadError: function () { //加载失败时执行
  63. //layer.msg("加载数据失败", { time: 1500, icon: 2 });
  64. }
  65. });
  66. }
  67. function caoZuo(val, row) {
  68. if (row.id == -10001)
  69. return '<div><a title="号码详情" style="margin-right:5px;" onclick="detail(' + row.id + ')"><i class="fa fa-file-text-o" aria-hidden="true"></i> </div>'
  70. else if (row.id == -10002)
  71. return '<div><a title="号码详情" style="margin-right:5px;" onclick="detail(' + row.id + ')"><i class="fa fa-file-text-o" aria-hidden="true"></i><a title="编辑" style="margin-right:5px;" onclick="XG(' + row.id + ')"><i class="fa fa-pencil-square-o"></i></a> </div>'
  72. else
  73. return '<div><a title="号码详情" style="margin-right:5px;" onclick="detail(' + row.id + ')"><i class="fa fa-file-text-o" aria-hidden="true"></i></a><a title="编辑" style="margin-right:5px;" onclick="XG(' + row.id + ')"><i class="fa fa-pencil-square-o"></i></a><a title="删除" onclick="del(' + row.id + ')"><i class="fa fa-remove"></i></a> </div>'
  74. }
  75. function detail(id) {
  76. top.$("iframe:visible")[0].src = "VoiceNotification/phonelist.html?id=" + id;
  77. }
  78. //删除
  79. function del(id) {
  80. var laye = layer.confirm('您确定要删除吗?', {
  81. btn: ['确定', '取消'] //可以无限个按钮
  82. }, function (index, layero) {
  83. //按钮【按钮一】的回调
  84. $.ajax({
  85. type: "post",
  86. url: huayi.config.callcenter_url + "Callplan/Delete",
  87. async: true,
  88. dataType: 'json',
  89. data: {
  90. token: $.cookie("token"),
  91. id: id
  92. },
  93. success: function (data) {
  94. if (data.state.toLowerCase() == 'success') {
  95. layer.msg("删除成功!");
  96. layer.close(laye);
  97. initTable();
  98. }
  99. }
  100. });
  101. }, function (index) {
  102. //按钮【按钮二】的回调
  103. layer.close(laye)
  104. });
  105. }
  106. //修改
  107. function XG(id) {
  108. top.$("iframe:visible")[0].src = "VoiceNotification/changeTongZhi.html?id=" + id;
  109. }