adminList.html 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. {include file='common/head'}
  2. <div style="overflow-x: hidden;width: 96%;margin: auto;padding-top: 1rem;">
  3. <blockquote class="layui-elem-quote layui-text">
  4. <div class="demoTable layui-form">
  5. <button class="layui-btn addInfo" style="margin:0;"><i class="layui-icon">&#xe654;</i> 添加</button>
  6. </div>
  7. </blockquote>
  8. <div class="demoTable">
  9. <table class="layui-table" lay-data="{height: 'full-100', url:'{:url('Admin/ApiGetAdminList')}', page:true, id:'testReload',loading:true}" lay-filter="demo">
  10. <thead>
  11. <tr>
  12. <th lay-data="{field:'role_name',width:100, fixed: 'left'}">角色名称</th>
  13. <th lay-data="{field:'hread_img',width:100, fixed: 'left'}">头像</th>
  14. <th lay-data="{field:'admin_name',width:100, fixed: true}">管理员名称</th>
  15. <th lay-data="{field:'admin_number'}">工号</th>
  16. <th lay-data="{field:'login_number'}">登录账号</th>
  17. <th lay-data="{field:'mobile'}">电话</th>
  18. <th lay-data="{field:'position'}">职位</th>
  19. <th lay-data="{field:'note'}">备注信息</th>
  20. <th lay-data="{field:'status', templet: '#status'}">状态</th>
  21. <th lay-data="{fixed: 'is_hot', width:140,fixed: 'right', align:'center', toolbar: '#barDemo'}"></th>
  22. </thead>
  23. </table>
  24. <script type="text/html" id="barDemo">
  25. <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
  26. <a class="layui-btn layui-btn-xs" lay-event="pay_key">秘钥设置</a>
  27. </script>
  28. <script type="text/html" id="imgTpl">
  29. <img src="{{ d.header_img }}" style="height: 20px;" lay-event="detail_content">
  30. </script>
  31. <script type="text/html" id="status">
  32. {{# if(d.status == 1){ }}
  33. <span style="color: #5FB878">正常</span>
  34. {{# } else if( d.status ==2) { }}
  35. <span style="color: #FF5722">禁用</span>
  36. {{# } }}
  37. </script>
  38. </div>
  39. {include file='common/footer'}
  40. <script>
  41. layui.use('table', function(){
  42. var table = layui.table
  43. ,form = layui.form;
  44. var $ = layui.$, active = {
  45. reload: function(){
  46. var select = $('#parent_id');
  47. //执行重载
  48. table.reload('testReload', {
  49. where: {
  50. type_id:select.val(),
  51. }
  52. });
  53. }
  54. };
  55. //监听工具条
  56. table.on('tool(demo)', function(obj){
  57. var data = obj.data;
  58. if(obj.event === 'edit'){
  59. layer.open({
  60. type: 2,
  61. title: '管理员信息更新',
  62. shadeClose: true,
  63. shade: false,
  64. maxmin: true, //开启最大化最小化按钮
  65. area: ['100%', '100%'],
  66. content: '{:url("Admin/saveAdminInfo")}?admin_id='+data.admin_id,
  67. end: function () {
  68. table.reload('testReload');
  69. },
  70. });
  71. }else if(obj.event === 'pay_key'){
  72. layer.open({
  73. type: 2,
  74. title: '管理员秘钥设置',
  75. shadeClose: true,
  76. shade: false,
  77. maxmin: true, //开启最大化最小化按钮
  78. area: ['100%', '100%'],
  79. content: '{:url("Admin/saveAdminPayKey")}?admin_id='+data.admin_id,
  80. end: function () {
  81. table.reload('testReload');
  82. },
  83. });
  84. }
  85. });
  86. layui.use('carousel', function(){
  87. var carousel = layui.carousel;
  88. //建造实例
  89. carousel.render({
  90. elem: '#test1'
  91. ,width: '100%' //设置容器宽度
  92. ,arrow: 'always' //始终显示箭头
  93. //,anim: 'updown' //切换动画方式
  94. });
  95. });
  96. $('.demoTable .layui-btn').on('click', function(){
  97. var type = $(this).data('type');
  98. active[type] ? active[type].call(this) : '';
  99. });
  100. $('.addInfo').on('click', function() {
  101. layer.open({
  102. type: 2,
  103. title: '添加内容信息',
  104. shadeClose: true,
  105. shade: false,
  106. maxmin: true, //开启最大化最小化按钮
  107. area: ['100%', '100%'],
  108. content: '{:url("Admin/saveAdminInfo")}',
  109. end: function () {
  110. table.reload('testReload');
  111. },
  112. });
  113. });
  114. });
  115. </script>
  116. </body>
  117. </html>