index.html 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. {extend name="common/base"/}
  2. <!-- 主体 -->
  3. {block name="body"}
  4. <div class="p-3">
  5. <div class="gg-form-bar border-t border-x" style="padding-bottom:10px;">
  6. <button class="layui-btn layui-btn-sm add-menu">+ 添加通知设置</button>
  7. </div>
  8. <div>
  9. <table class="layui-hide" id="treeTable" lay-filter="treeTable"></table>
  10. </div>
  11. </div>
  12. {/block}
  13. <!-- /主体 -->
  14. <!-- 脚本 -->
  15. {block name="script"}
  16. <script>
  17. const moduleInit = ['tool', 'treeGrid'];
  18. function gouguInit() {
  19. var treeGrid = layui.treeGrid,table = layui.table, tool = layui.tool;
  20. var pageTable = treeGrid.render({
  21. id: 'treeTable',
  22. elem: '#treeTable',
  23. idField: 'id',
  24. url: "/admin/pushmessage/index",
  25. cellMinWidth: 80,
  26. treeId: 'id',//树形id字段名称
  27. treeUpId: 'pid',//树形父id字段名称
  28. treeShowName: 'title',//以树形式显示的字段
  29. height: 'full-0',
  30. isOpenDefault:true,
  31. cols: [[
  32. { field: 'id', width: 100, title: 'ID号', align: 'center' },
  33. // { field: 'pid', title: '上级部门ID',width: 120, align: 'center'},
  34. { field: 'title', title: '通知情况', width: 315},
  35. { field: 'content', title: '通知财政局内容'},
  36. {
  37. field: 'is_wechat', title: '微信推送',width: 120, align: 'center',
  38. templet: function(d){
  39. if(d.rule_url == null || d.content == ''){
  40. return '';
  41. }
  42. if(d.is_wechat == 1){
  43. return "√";
  44. }else{
  45. return "×";
  46. }
  47. }
  48. },
  49. { field: 'content_company', title: '通知公司内容'},
  50. {
  51. field: 'is_wechat_company', title: '微信推送',width: 120, align: 'center',
  52. templet: function(d){
  53. if(d.rule_url == null || d.content_company == ''){
  54. return '';
  55. }
  56. if(d.is_wechat_company == 1){
  57. return "√";
  58. }else{
  59. return "×";
  60. }
  61. }
  62. },
  63. { field: 'content_proprietor', title: '通知业主内容'},
  64. {
  65. field: 'is_wechat_proprietor', title: '微信推送',width: 120, align: 'center',
  66. templet: function(d){
  67. if(d.rule_url == null || d.content_proprietor == '' || d.content_proprietor == null){
  68. return '';
  69. }
  70. if(d.is_wechat_proprietor == 1){
  71. return "√";
  72. }else{
  73. return "×";
  74. }
  75. }
  76. },
  77. { field: 'rule_url', title: 'url'},
  78. // { field: 'is_notice', title: '是否通知',width: 120, align: 'center'},
  79. // { field: 'is_carbon', title: '是否抄送',width: 120, align: 'center'},
  80. { width:180, title: '操作', align: 'center', templet: function (d) {
  81. var html =
  82. '<span class="layui-btn-group">' +
  83. '<button class="layui-btn layui-btn-xs" lay-event="add">添加下级设置</button>' +
  84. '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">编辑</button>' +
  85. '<button class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</button>' +
  86. '</span>';
  87. return html;
  88. }
  89. },
  90. ]],
  91. page: false,
  92. });
  93. //表头工具栏事件
  94. $('body').on('click','.add-menu', function(){
  95. tool.side("/admin/pushmessage/add");
  96. return;
  97. });
  98. //操作按钮
  99. treeGrid.on('tool(treeTable)', function (obj) {
  100. if (obj.event === 'add') {
  101. tool.side("/admin/pushmessage/add?pid="+obj.data.id);
  102. return;
  103. }
  104. if (obj.event === 'edit') {
  105. tool.side("/admin/pushmessage/edit?id="+obj.data.id);
  106. return;
  107. }
  108. if (obj.event === 'del') {
  109. layer.confirm('确定要删除吗?', {icon: 3, title:'提示'}, function(index){
  110. let callback = function (e) {
  111. layer.msg(e.msg);
  112. if (e.code == 0) {
  113. obj.del();
  114. }
  115. }
  116. tool.delete("/admin/pushmessage/delete", { id: obj.data.id }, callback);
  117. layer.close(index);
  118. });
  119. }
  120. });
  121. }
  122. </script>
  123. {/block}
  124. <!-- /脚本 -->