index.php 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. {extend name="public/container"}
  2. {block name="head_top"}
  3. {/block}
  4. {block name="content"}
  5. <div class="layui-fluid" style="background: #fff;margin-top: -10px;">
  6. <div class="layui-row layui-col-space15">
  7. <div class="layui-col-md12">
  8. <div class="layui-card">
  9. <!-- <div class="layui-card-header">门店列表</div>-->
  10. <div class="layui-card-body">
  11. <div class="layui-btn-container">
  12. <button class="layui-btn layui-btn-sm"
  13. onclick="$eb.createModalFrame(this.innerText,'{:Url('addGroup')}',{h:250,w:720})">添加分组
  14. </button>
  15. </div>
  16. <table class="layui-hide" id="List" lay-filter="List"></table>
  17. <script type="text/html" id="act">
  18. <button type="button" class="layui-btn layui-btn-xs layui-btn-normal" lay-event='edit'>
  19. 修改名称
  20. </button>
  21. <button type="button" class="layui-btn layui-btn-xs layui-btn-normal" lay-event='del'>
  22. 删除分组
  23. </button>
  24. </script>
  25. </div>
  26. </div>
  27. </div>
  28. </div>
  29. </div>
  30. <script src="{__ADMIN_PATH}js/layuiList.js"></script>
  31. {/block}
  32. {block name="script"}
  33. <script>
  34. layList.tableList('List', "{:Url('groupList')}", function () {
  35. return [
  36. {field: 'id', title: 'ID', sort: true, event: 'id', width: '20%'},
  37. {field: 'group_name', title: '分组名称', width: '60%'},
  38. {field: 'right', title: '操作', align: 'center', toolbar: '#act', width: '20%'},
  39. ];
  40. });
  41. //点击事件绑定
  42. layList.tool(function (event, data, obj) {
  43. switch (event) {
  44. case 'del':
  45. var url = layList.U({c: 'user.user_group', a: 'delete', q: {id: data.id}});
  46. var code = {title: "操作提示", text: "确定删除该分组?", type: 'info', confirm: '是的,删除'};
  47. $eb.$swal('delete', function () {
  48. $eb.axios.get(url).then(function (res) {
  49. if (res.status == 200 && res.data.code == 200) {
  50. $eb.$swal('success', res.data.msg);
  51. obj.del();
  52. location.reload();
  53. } else
  54. return Promise.reject(res.data.msg || '删除失败')
  55. }).catch(function (err) {
  56. $eb.$swal('error', err);
  57. });
  58. }, code)
  59. break;
  60. case 'open_image':
  61. $eb.openImage(data.image);
  62. break;
  63. case 'edit':
  64. $eb.createModalFrame(data.group_name + '-编辑', layList.U({a: 'addGroup', q: {id: data.id}}), {h: 250, w: 720});
  65. break;
  66. }
  67. })
  68. </script>
  69. {/block}