notify_list.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. $(function () {
  2. });
  3. /*
  4. 参数解释:
  5. title 标题
  6. url 请求的url
  7. id 需要操作的数据id
  8. w 弹出层宽度(缺省调默认值)
  9. h 弹出层高度(缺省调默认值)
  10. */
  11. /*管理员-增加*/
  12. function notify_add(title,url,w,h){
  13. var index = layer_show(title,pagePath+url,w,h);
  14. layer.full(index);
  15. }
  16. /*管理员-编辑*/
  17. function notify_edit(title,url,w,h) {
  18. var index = layer_show(title, pagePath + url, w, h);
  19. layer.full(index);
  20. }
  21. // 阅读情况
  22. function notify_readDetail(title,url,w,h){
  23. layer_show(title, pagePath + url, w, h);
  24. }
  25. /*管理员-详情*/
  26. function notify_info(title,url,w,h){
  27. var index = layer_show(title,pagePath+url,w,h);
  28. layer.full(index);
  29. }
  30. /*管理员-批量删除*/
  31. function notify_del(){
  32. layer.confirm('确认要删除吗?',function(index){
  33. var chlength=$('#notifyTb tbody').find('input[type="checkbox"]:checked').length;
  34. if(chlength<=0){
  35. alert('请选择删除元素');
  36. return false;
  37. }
  38. var ids='';
  39. $('#notifyTb tbody').find('input[type="checkbox"]:checked').each(function(i,item){
  40. ids=ids+$(this).attr("id")+",";
  41. });
  42. ids=ids.substring(0,ids.length-1);
  43. $.ajax({
  44. url :pagePath+"/government/notify/deleteBatch",
  45. type : "post",
  46. data : {'ids':ids},
  47. dataType : "json",
  48. success: function (result) {
  49. if (result.success) {
  50. smileMessage(result.message)
  51. setTime();
  52. } else {
  53. errorMessage(result.message);
  54. }
  55. },
  56. error: function () {
  57. errorMessage('系统错误!');
  58. }
  59. });
  60. });
  61. }
  62. /*管理员-归档*/
  63. function notify_archive(){
  64. var chlength=$('#notifyTb tbody').find('input[type="checkbox"]:checked').length;
  65. if(chlength<=0){
  66. sadMessage('请选择归档元素');
  67. return false;
  68. }
  69. layer.confirm('确认要归档吗?',function(index){
  70. var ids='';
  71. var notify_detail_ids='';
  72. $('#notifyTb tbody').find('input[type="checkbox"]:checked').each(function(i,item){
  73. if($(this).attr("notify_detail_id")!="" && $(this).attr("notify_detail_id")!="0"){
  74. notify_detail_ids+=$(this).attr("notify_detail_id")+",";
  75. }else{
  76. ids+=$(this).attr("id")+",";
  77. }
  78. });
  79. ids=ids.substring(0,ids.length-1);
  80. notify_detail_ids=notify_detail_ids.substring(0,notify_detail_ids.length-1);
  81. $.ajax({
  82. url :pagePath+"/government/notify/archiveBatch",
  83. type : "post",
  84. data : {
  85. 'ids':ids,
  86. 'notify_detail_ids':notify_detail_ids
  87. },
  88. dataType : "json",
  89. success: function (result) {
  90. if (result.success) {
  91. smileMessage(result.message)
  92. setTime();
  93. } else {
  94. errorMessage(result.message);
  95. }
  96. },
  97. error: function () {
  98. errorMessage('系统错误!');
  99. }
  100. });
  101. });
  102. }