index.php 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. {extend name="public/container"}
  2. {block name="content"}
  3. <div class="row">
  4. <div class="col-sm-12">
  5. <div class="ibox">
  6. <div class="ibox-title">
  7. <button type="button" class="btn btn-w-m btn-primary" onclick="$eb.createModalFrame(this.innerText,'{:Url('create',array('gid'=>$gid))}')">添加数据</button>
  8. <div class="ibox-tools">
  9. </div>
  10. </div>
  11. <div class="ibox-content">
  12. <div class="row">
  13. <div class="col-sm-8 m-b-xs">
  14. <?php /* <form action="" class="form-inline">
  15. <i class="fa fa-search" style="margin-right: 10px;"></i>
  16. <select name="is_show" aria-controls="editable" class="form-control input-sm">
  17. <option value="">是否显示</option>
  18. <option value="1" {eq name="params.is_show" value="1"}selected="selected"{/eq}>显示</option>
  19. <option value="0" {eq name="params.is_show" value="0"}selected="selected"{/eq}>不显示</option>
  20. </select>
  21. <select name="access" aria-controls="editable" class="form-control input-sm">
  22. <option value="">子管理员是否可用</option>
  23. <option value="1" {eq name="params.access" value="1"}selected="selected"{/eq}>可用</option>
  24. <option value="0" {eq name="params.access" value="0"}selected="selected"{/eq}>不可用</option>
  25. </select>
  26. <div class="input-group">
  27. <input type="text" name="keyword" value="{$params.keyword}" placeholder="请输入关键词" class="input-sm form-control"> <span class="input-group-btn">
  28. <button type="submit" class="btn btn-sm btn-primary"> 搜索</button> </span>
  29. </div>
  30. </form> */ ?>
  31. <form action="" class="form-inline">
  32. <i class="fa fa-search" style="margin-right: 10px;"></i>
  33. <input type="hidden" name="gid" value="{$where.gid}">
  34. <select name="status" aria-controls="editable" class="form-control input-sm">
  35. <option value="">是否可用</option>
  36. <option value="1" {eq name="where.status" value="1"}selected="selected"{/eq}>显示</option>
  37. <option value="2" {eq name="where.status" value="2"}selected="selected"{/eq}>不显示</option>
  38. </select>
  39. <button type="submit" class="btn btn-sm btn-primary"> 搜索</button> </span>
  40. </form>
  41. </div>
  42. </div>
  43. <div class="table-responsive">
  44. <table class="table table-striped table-bordered">
  45. <thead>
  46. <tr>
  47. <th class="text-center">编号</th>
  48. {volist name="fields" id="vo"}
  49. <th class="text-center">{$vo.name}</th>
  50. {/volist}
  51. <th class="text-center">是否可用</th>
  52. <th class="text-center">操作</th>
  53. </tr>
  54. </thead>
  55. <tbody class="">
  56. {volist name="list" id="vo"}
  57. <tr>
  58. <td class="text-center">
  59. {$vo.id}
  60. </td>
  61. {volist name="fields" id="item"}
  62. <td class="text-center">
  63. {if condition="isset($vo['value'][$item['title']]['value']) && $vo['value'][$item['title']]['value'] !== ''"}
  64. {if condition="$vo.value[$item['title']]['type'] == 'upload' || $vo.value[$item['title']]['type'] == 'uploads'"}
  65. {if condition="is_array($vo.value[$item['title']]['value'])"}
  66. {volist name="vo.value[$item['title']]['value']" id="valueItem"}
  67. <img class="image" data-image="{$valueItem}" width="45" height="45" src="{$valueItem}" />
  68. {/volist}
  69. {else/}
  70. <img class="image" data-image="{$vo.value[$item['title']]['value']}" width="45" height="45" src="{$vo.value[$item['title']]['value']}" />
  71. {/if}
  72. {else/}
  73. {$vo.value[$item['title']]['value']}
  74. {/if}
  75. {/if}
  76. </td>
  77. {/volist}
  78. <td class="text-center">
  79. {if condition="$vo.status eq 1"}
  80. <i class="fa fa-check text-navy"></i>
  81. {elseif condition="$vo.status eq 2"/}
  82. <i class="fa fa-close text-danger"></i>
  83. {/if}
  84. </td>
  85. <td class="text-center">
  86. <button class="btn btn-info btn-xs" type="button" onclick="$eb.createModalFrame('编辑','{:Url('edit',array('gid'=>$gid,'id'=>$vo['id']))}')"><i class="fa fa-edit"></i> 编辑</button>
  87. <button class="btn btn-danger btn-xs " data-url="{:Url('delete',array('id'=>$vo['id']))}" type="button"><i class="fa fa-times"></i> 删除</button>
  88. </td>
  89. </tr>
  90. {/volist}
  91. </tbody>
  92. </table>
  93. </div>
  94. {include file="public/inner_page"}
  95. </div>
  96. </div>
  97. </div>
  98. </div>
  99. {/block}
  100. {block name="script"}
  101. <script>
  102. $('.btn-danger').on('click',function(){
  103. window.t = $(this);
  104. var _this = $(this),url =_this.data('url');
  105. $eb.$swal('delete',function(){
  106. $eb.axios.get(url).then(function(res){
  107. console.log(res);
  108. if(res.status == 200 && res.data.code == 200) {
  109. $eb.$swal('success',res.data.msg);
  110. _this.parents('tr').remove();
  111. }else
  112. return Promise.reject(res.data.msg || '删除失败')
  113. }).catch(function(err){
  114. $eb.$swal('error',err);
  115. });
  116. })
  117. });
  118. $(".image").on('click',function (e) {
  119. var images = $(this).data('image');
  120. $eb.openImage(images);
  121. })
  122. </script>
  123. {/block}