index.html 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <extend name="Public:base" />
  2. <block name="content">
  3. <div class="page-header">
  4. <a href="{:U('Nodes/add')}" class="btn btn-primary">新增节点</a>
  5. </div>
  6. <div class="row">
  7. <div class="col-xs-12">
  8. <div id="append_parent"></div>
  9. <div class="table-responsive">
  10. <table class="table table-striped table-bordered table-hover">
  11. <thead>
  12. <tr>
  13. <td>节点结构</td>
  14. <td>节点名称</td>
  15. <td>节点类型</td>
  16. <td>状态</td>
  17. <td>操作</td>
  18. </tr>
  19. </thead>
  20. <tbody>
  21. <volist name="nodes" id="node">
  22. <tr align="center">
  23. <td align="left">{$node['fullname']}</td>
  24. <td>{$node['name']}</td>
  25. <td>{$node['type']}</td>
  26. <td><if condition="$node['status'] eq 1">已启用<else/>已禁用</if></td>
  27. <td>[ <a href="javascript:void(0);" value="{:U('Nodes/toggleStatus', array('id' => $node['id'], 'status' => $node['status']))}" name="{$node['title']}" status="{$node['status']}" class="toggle"><if condition="$node['status'] eq 1">禁用<else/>启用</if></a> ]</td>
  28. </tr>
  29. </volist>
  30. </tbody>
  31. </table>
  32. </div>
  33. </div>
  34. </div>
  35. </block>
  36. <block name="javascript">
  37. <script src="__JS__/dialog/dialog.js" id="dialog_js" charset="utf-8"></script>
  38. <link rel="stylesheet" href="__JS__/dialog/dialog.css" />
  39. <script>
  40. $(function(){
  41. $(".toggle").click(function(){
  42. var url = $(this).attr("value");
  43. var name = $(this).attr("name");
  44. var status = $(this).attr("status") || 0;
  45. status = status ? '禁用' : '启用';
  46. var obj = $(this);
  47. showDialog('您确定'+ status + " <b>" + name + "</b> 节点吗?", 'confirm','温馨提示', function(){
  48. $.getJSON(url, function(json){
  49. if(json.state == 1)
  50. {
  51. showSucc(json.msg);
  52. } else {
  53. //showSucc(json.msg)
  54. showError(json.msg);
  55. }
  56. });
  57. })
  58. return false;
  59. });
  60. });
  61. </script>
  62. <style type="text/css">
  63. a.dialog-bottom-btn{
  64. height:auto;
  65. }
  66. </style>
  67. </block>