index.html 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <article class="cl pd-10" style="min-width: 900px;">
  2. <div class="cl pd-5 bg-1 bk-gray mt-20">
  3. <span class="l">
  4. <a href="javascript:;" onclick="del_all()" class="btn btn-danger radius">
  5. <i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a>
  6. <a class="btn btn-primary radius" href="javascript:save(0);">
  7. <i class="Hui-iconfont">&#xe600;</i> 添加模型</a>
  8. </span>
  9. <span class="r">共有数据:<strong id="total">{notempty name="list"}{$list->total()}{else/}0{/notempty}</strong>
  10. 条</span>
  11. </div>
  12. <div id="edatalist">
  13. <table class="table table-border table-bordered table-bg">
  14. <thead>
  15. <tr class="text-c">
  16. <th width="25px;">
  17. <input type="checkbox" name="" value="">
  18. </th>
  19. <th width="80px;">ID</th>
  20. <th width="160px;">模块名称</th>
  21. <th width="160px;">表名称</th>
  22. <th width="160px;">模型名称</th>
  23. <th width="180px;">表描述</th>
  24. <th width="100px;">表类型</th>
  25. <th width="80px;">主键</th>
  26. <th width="80px;">排序</th>
  27. <th width="140px;">创建时间</th>
  28. <th>操作</th>
  29. </tr>
  30. </thead>
  31. <tbody>
  32. {foreach $list as $val}
  33. <tr class="text-c va-m">
  34. <td>
  35. <input type="checkbox" value="{$val.id}" name="checkbox[]">
  36. </td>
  37. <td>{$val.id}</td>
  38. <td>{$val.module_name}</td>
  39. <td>{$val.table_name}</td>
  40. <td>{$val.model_name}</td>
  41. <td>{$val.remark}</td>
  42. <td>{$val.table_type}</td>
  43. <td>{$val.pk}</td>
  44. <td><input type="text" class="input-text input-sort" value="{$val.sort}" data-id="{$val.id}"
  45. style="text-align: center;"></td>
  46. <td>{$val.create_time|date="Y-m-d H:i:s"}</td>
  47. <td class="td-manage">
  48. <a class="btn btn-primary radius" href="javascript:save({$val.id});"
  49. title="编辑" style="text-decoration:none" class="ml-10">
  50. <i class="Hui-iconfont">&#xe6df;</i>编辑
  51. </a>
  52. <a class="btn btn-danger radius" href="javascript:;" title="删除" style="text-decoration:none"
  53. class="ml-10" onClick="del(this,'{$val.id}')">
  54. <i class="Hui-iconfont">&#xe6e2;</i>删除
  55. </a>
  56. </td>
  57. </tr>
  58. {/foreach}
  59. </tbody>
  60. </table>
  61. </div>
  62. <div class="cl pd-5 bg-1 bk-gray mt-20 ">
  63. <span class="r">{notempty name="list"}{$list->render()|raw}{/notempty}</span>
  64. </div>
  65. </article>
  66. <script>
  67. function save(id) {
  68. var title = id == 0 ? '添加模型' : '修改模型'
  69. var url = "{:url('save')}" + "?_layer=true&id=" + id
  70. layer_show(title, url, 800, 700);
  71. }
  72. // 排序
  73. $(".input-sort").change(function () {
  74. var sort = $(this).val();
  75. var id = $(this).data('id');
  76. // console.log(sort);
  77. // console.log(id);
  78. $.post('sort', {
  79. 'id': id,
  80. 'sort': sort
  81. }, function (res) {
  82. console.log(res);
  83. if (res) {
  84. layer.msg('排序成功', {
  85. icon: 1,
  86. time: 2000
  87. });
  88. } else {
  89. layer.msg('排序失败', {
  90. icon: 5,
  91. time: 2000
  92. });
  93. }
  94. }, 'json');
  95. })
  96. // 产品上加/下架 or 文章上线.下线
  97. function duty(action, obj, id) {
  98. var duty = 2,
  99. title = '上线',
  100. button = 'default',
  101. status = '下线';
  102. if (action == 'up') {
  103. duty = 1;
  104. title = '下线';
  105. status = '正常';
  106. button = 'success';
  107. action = 'down';
  108. } else {
  109. action = 'up';
  110. }
  111. var text = "<a href=\"javascript:void(0);\" title=" + title + " onClick=\"duty('" + action + "', this," + id + ")\" >";
  112. text += '<span class="label label-' + button + ' radius">' + status + '</span></a>';
  113. $.post("duty", {
  114. 'id': id,
  115. 'status': duty
  116. }, function (data) {
  117. if (data.code == 2) {
  118. $(obj).after(text);
  119. $(obj).remove();
  120. layer.msg(data.msg, {
  121. icon: 6,
  122. time: 1000
  123. });
  124. } else {
  125. layer.msg(data.msg, {
  126. icon: 5,
  127. time: 1000
  128. });
  129. }
  130. }, 'json');
  131. }
  132. </script>