TemplateClassPlan.html 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <!DOCTYPE html>
  2. <html class="x-admin-sm">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>欢迎页面-X-admin2.2</title>
  6. <meta name="renderer" content="webkit">
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  8. <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
  9. <link rel="stylesheet" href="https://osscold.baozhida.cn/css/font.css">
  10. <link rel="stylesheet" href="https://osscold.baozhida.cn/css/xadmin.css">
  11. <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
  12. <script src="https://osscold.baozhida.cn/lib/layui/layui.js" charset="utf-8"></script>
  13. <script type="text/javascript" src="https://osscold.baozhida.cn/js/xadmin.js"></script>
  14. <!-- 让IE8/9支持媒体查询,从而兼容栅格 -->
  15. <!--[if lt IE 9]>
  16. <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
  17. <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
  18. <![endif]-->
  19. </head>
  20. <body>
  21. <div class="x-nav">
  22. <span class="layui-breadcrumb">
  23. <a href="">首页</a>
  24. <a><cite>宝智达</cite></a>
  25. </span>
  26. <a class="layui-btn layui-btn-normal " style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
  27. <i class="layui-icon layui-icon-normal" style="line-height:30px"></i>
  28. </a>
  29. </div>
  30. <div class="layui-fluid">
  31. <div class="layui-row layui-col-space15">
  32. <div class="layui-col-md12">
  33. <div class="layui-card">
  34. <!-- <div class="layui-card-body ">-->
  35. <!-- <hr>-->
  36. <!--&lt;!&ndash; <blockquote class="layui-elem-quote">每个tr 上有两个属性 cate-id='1' 当前分类id fid='0' 父级id ,顶级分类为 0,有子分类的前面加收缩图标<i class="layui-icon x-show" status='true'>&#xe623;</i></blockquote>&ndash;&gt;-->
  37. <!-- </div>-->
  38. <div class="layui-card-header">
  39. <div class="layui-form-item">
  40. <label class="layui-form-label">
  41. <span class="x-red">*</span>权限</label>
  42. <div class="layui-input-inline">
  43. <select lay-filter="Admin_power" id="Admin_power" name="Admin_power" class="valid" >
  44. {{range $index, $elem := .List}}
  45. <option value="{{$elem.Id}}" {{if gt $.id 0 }}
  46. {{if eq $.Id $elem.Id }}
  47. selected
  48. {{end}}
  49. {{end}}
  50. >{{$elem.T_name}}</option>
  51. {{end}}
  52. </select>
  53. </div>
  54. </div>
  55. <button class="layui-btn layui-btn-normal layui-btn-xs" onclick="xadmin.open('添加','Class_?id=0',400,400)" ><i class="layui-icon">&#xe61f;</i>添加分类</button>
  56. </div>
  57. <div class="layui-card-body ">
  58. <table class="layui-table layui-form" >
  59. <thead>
  60. <tr>
  61. <!-- <th width="20">-->
  62. <!-- <input type="checkbox" name="" lay-skin="primary">-->
  63. <!-- </th>-->
  64. <!-- <th width="70">ID</th>-->
  65. <th width="250">栏目名</th>
  66. <!-- <th width="50">排序</th>-->
  67. <!-- <th width="80">状态</th>-->
  68. <th >操作</th>
  69. </thead>
  70. <tbody class="x-cate">
  71. </tbody>
  72. </table>
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. <script>
  79. layui.use(['form'], function(){
  80. form = layui.form;
  81. });
  82. /*用户-删除*/
  83. function member_del(obj,id){
  84. layer.confirm('确认要删除吗?',function(index){
  85. //发异步删除数据
  86. $(obj).parents("tr").remove();
  87. $.ajax({
  88. type: 'POST',
  89. url: 'Class_Del',//发送请求
  90. data: {Id:id},
  91. success: function(result) {
  92. console.log(result)
  93. if (result.Code == 200 ){
  94. layer.msg('已删除!', {
  95. icon: 1,
  96. time: 2000
  97. });
  98. window.location.reload();
  99. }else {
  100. layer.msg('删除失败!', {
  101. time: 2000
  102. });
  103. }
  104. }
  105. });
  106. });
  107. }
  108. // 分类展开收起的分类的逻辑
  109. //
  110. $(function(){
  111. $("tbody.x-cate tr[fid!='0']").hide();
  112. // 栏目多级显示效果
  113. $('.x-show').click(function () {
  114. if($(this).attr('status')=='true'){
  115. $(this).html('&#xe625;');
  116. $(this).attr('status','false');
  117. cateId = $(this).parents('tr').attr('cate-id');
  118. $("tbody tr[fid="+cateId+"]").show();
  119. }else{
  120. cateIds = [];
  121. $(this).html('&#xe623;');
  122. $(this).attr('status','true');
  123. cateId = $(this).parents('tr').attr('cate-id');
  124. getCateId(cateId);
  125. for (var i in cateIds) {
  126. $("tbody tr[cate-id="+cateIds[i]+"]").hide().find('.x-show').html('&#xe623;').attr('status','true');
  127. }
  128. }
  129. })
  130. })
  131. var cateIds = [];
  132. function getCateId(cateId) {
  133. $("tbody tr[fid="+cateId+"]").each(function(index, el) {
  134. id = $(el).attr('cate-id');
  135. cateIds.push(id);
  136. getCateId(id);
  137. });
  138. }
  139. </script>
  140. </body>
  141. </html>