based_in121.html 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. {extend name="../../admin/view/main"}
  2. {block name="button"}
  3. {if auth("add")}
  4. {/if}
  5. <button data-title="导入" class='layui-btn layui-btn-sm layui-btn-primary' id="dr">导入</button>
  6. {/block}
  7. {block name='content'}
  8. <div class="think-box-shadow">
  9. <table class="layui-table margin-top-10" lay-skin="line">
  10. <input type="hidden" id="table" value="{$t}">
  11. <input type="hidden" id="num" value="{$n}">
  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='&#45;&#45;'}-->
  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:function () {
  45. return $('#table').val();
  46. },
  47. num:function () {
  48. return $('#num').val();
  49. },
  50. }
  51. ,before: function(obj){ //obj参数包含的信息,跟 choose回调完全一致,可参见上文。
  52. layer.load(); //上传loading
  53. }
  54. ,done: function(res){
  55. layer.closeAll('loading'); //关闭loading
  56. layer.msg('上传成功');
  57. }
  58. ,error: function(){
  59. layer.msg('上传失败');
  60. }
  61. });
  62. });
  63. </script>
  64. {/block}