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. </tr>
  18. </thead>
  19. {/notempty}
  20. <tbody>
  21. {foreach $list as $key=>$vo}
  22. <tr>
  23. <td class="text-left nowrap relative">
  24. {$vo.A|default='--'}
  25. </td>
  26. <td class='text-left nowrap'>
  27. {$vo.B|default='--'}
  28. </td>
  29. </tr>
  30. {/foreach}
  31. </tbody>
  32. </table>
  33. {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
  34. </div>
  35. <script>
  36. layui.use('upload', function(){
  37. var upload = layui.upload;
  38. //执行实例
  39. var uploadInst = upload.render({
  40. elem: '#dr' //绑定元素
  41. ,url: '/admin/Excel/upExcel'
  42. ,accept: 'file' //普通文件,
  43. ,data:{
  44. table:'jijiao_youer_school',
  45. num:8
  46. }
  47. ,before: function(obj){ //obj参数包含的信息,跟 choose回调完全一致,可参见上文。
  48. layer.load(); //上传loading
  49. }
  50. ,done: function(res){
  51. layer.closeAll('loading'); //关闭loading
  52. layer.msg('上传成功');
  53. }
  54. ,error: function(){
  55. layer.msg('上传失败');
  56. }
  57. });
  58. });
  59. </script>
  60. {/block}