index.html 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. {extend name="../../admin/view/main"}
  2. {block name="button"}
  3. {if auth("add")}
  4. {/if}
  5. {if auth("add")}
  6. <button data-title="导入" class='layui-btn layui-btn-sm layui-btn-primary' id="dr">导入</button>
  7. {/if}
  8. {/block}
  9. {block name='content'}
  10. <div class="think-box-shadow">
  11. <table class="layui-table margin-top-10" lay-skin="line">
  12. {notempty name='list'}
  13. <thead>
  14. <tr>
  15. <th class="text-left nowrap">学校代码</th>
  16. <th class="text-left nowrap">学校名称</th>
  17. <th></th>
  18. </tr>
  19. </thead>
  20. {/notempty}
  21. <tbody>
  22. {foreach $list as $key=>$vo}
  23. <tr>
  24. <td class="text-left nowrap relative">
  25. {$vo.A|default='--'}
  26. </td>
  27. <td class='text-left nowrap'>
  28. {$vo.B|default='--'}
  29. </td>
  30. </tr>
  31. {/foreach}
  32. </tbody>
  33. </table>
  34. {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
  35. </div>
  36. <script>
  37. layui.use('upload', function(){
  38. var upload = layui.upload;
  39. //执行实例
  40. var uploadInst = upload.render({
  41. elem: '#dr' //绑定元素
  42. ,url: '/admin/Excel/upExcel'
  43. ,accept: 'file' //普通文件,
  44. ,data:{
  45. table:'jijiao_primary_school',
  46. num:8
  47. }
  48. ,before: function(obj){ //obj参数包含的信息,跟 choose回调完全一致,可参见上文。
  49. layer.load(); //上传loading
  50. }
  51. ,done: function(res){
  52. layer.closeAll('loading'); //关闭loading
  53. layer.msg('上传成功');
  54. }
  55. ,error: function(){
  56. layer.msg('上传失败');
  57. }
  58. });
  59. });
  60. </script>
  61. {/block}