sitemap_info.html 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. {extend name="common/base"/}
  2. <!-- 主体 -->
  3. {block name="body"}
  4. <div class="p-3">
  5. <table class="layui-hide" id="sitemap_cate" lay-filter="sitemap_cate"></table>
  6. </div>
  7. <script type="text/html" id="status">
  8. <i class="layui-icon {{# if(d.status == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
  9. </script>
  10. <script type="text/html" id="toolbarDemo">
  11. <div class="layui-btn-container">
  12. <button class="layui-btn layui-btn-sm add-menu">+ 添加网站地图</button>
  13. <button class="layui-btn layui-btn-primary layui-btn-sm add-back">返回</button>
  14. </div>
  15. </script>
  16. <script type="text/html" id="barDemo">
  17. <div class="layui-btn-group"><button class="layui-btn layui-btn-xs" lay-event="edit">编辑</button><button class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</button></div>
  18. </script>
  19. {/block}
  20. <!-- /主体 -->
  21. <!-- 脚本 -->
  22. {block name="script"}
  23. <script>
  24. var sitemap_cate_id = '{$sitemap_cate_id}';
  25. const moduleInit = ['tool'];
  26. function gouguInit() {
  27. var table = layui.table, tool = layui.tool;
  28. layui.pageTable = table.render({
  29. elem: '#sitemap_cate',
  30. title: '网站地图列表',
  31. toolbar: '#toolbarDemo',
  32. url: '/admin/sitemap/sitemap_info', //数据接口
  33. where: {
  34. id: sitemap_cate_id
  35. },
  36. page: false, //开启分页
  37. cols: [
  38. [
  39. {
  40. field: 'id',
  41. title: 'ID号',
  42. align: 'center',
  43. width: 80
  44. }, {
  45. field: 'sort',
  46. title: '排序',
  47. width: 80,
  48. align: 'center'
  49. }, {
  50. field: 'name',
  51. title: '标题',
  52. width: 200
  53. }, {
  54. field: 'pc_src',
  55. title: 'pc端链接'
  56. }, {
  57. field: 'mobile_src',
  58. title: '移动端链接'
  59. }, {
  60. field: 'right',
  61. title: '操作',
  62. toolbar: '#barDemo',
  63. width: 100,
  64. align: 'center'
  65. }
  66. ]
  67. ]
  68. });
  69. //表头工具栏事件
  70. $('body').on('click','.add-menu',function(){
  71. tool.side("/admin/sitemap/sitemap_info_add?cid="+sitemap_cate_id);
  72. return;
  73. });
  74. //监听返回
  75. $('body').on('click','.add-back',function () {
  76. history.back(-1);
  77. return false;
  78. });
  79. //监听行工具事件
  80. table.on('tool(sitemap_cate)', function (obj) {
  81. var data = obj.data;
  82. if (obj.event === 'edit') {
  83. tool.side('/admin/sitemap/sitemap_info_add?id='+obj.data.id);
  84. return;
  85. }
  86. if (obj.event === 'del') {
  87. layer.confirm('确定要删除该数据吗?', {
  88. icon: 3,
  89. title: '提示'
  90. }, function (index) {
  91. let callback = function (e) {
  92. layer.msg(e.msg);
  93. if (e.code == 0) {
  94. obj.del();
  95. }
  96. }
  97. tool.delete("/admin/sitemap/sitemap_info_delete", { id: data.id }, callback);
  98. layer.close(index);
  99. });
  100. }
  101. });
  102. }
  103. </script>
  104. {/block}
  105. <!-- /脚本 -->