index_search.html 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <fieldset>
  2. <legend>条件搜索</legend>
  3. <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
  4. <div class="layui-form-item layui-inline">
  5. <label class="layui-form-label">标题</label>
  6. <div class="layui-input-inline">
  7. <input name="title" value="{$Think.get.title|default=''}" placeholder="请输入关键词" class="layui-input">
  8. </div>
  9. </div>
  10. <div class="layui-form-item layui-inline">
  11. <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
  12. </div>
  13. <div class="layui-form-item layui-inline">
  14. <button type="button" class="layui-btn layui-btn-sm layui-btn-normal" id="upload" style="margin-right: 10px;">
  15. <i class="layui-icon">&#xe67c;</i>批量导入
  16. </button>
  17. </div>
  18. </form>
  19. <script>form.render()
  20. layui.use('upload', function(){
  21. var upload = layui.upload;
  22. //执行实例
  23. var uploadInst = upload.render({
  24. elem: '#upload' //绑定元素
  25. ,url: "{:url('import')}" //上传接口
  26. , method: 'POST'
  27. ,accept: 'file'//指定允许上传时校验的文件类型,可选值有:images(图片)、file(所有文件)、video(视频)、audio(音频)
  28. ,exts: 'xlsx|xls'//只允许上传excel文件,未设定,那么限制的就是图片的文件格式
  29. ,before: function(obj){ //obj参数包含的信息,跟 choose回调完全一致,可参见上文。
  30. layer.load(); //上传loading
  31. }
  32. ,done: function(res){
  33. layer.closeAll('loading'); //关闭loading
  34. //上传完毕回调
  35. console.log(res)
  36. if(res.code == 1){
  37. layer.open({
  38. title: '导入结果'
  39. ,content: res.msg
  40. ,btn:['确定']
  41. ,yes:function(index, layero){
  42. location.reload();//刷新单前页
  43. }
  44. });
  45. }else{
  46. layer.msg(res.msg, {icon: 5});
  47. }
  48. }
  49. });
  50. });
  51. </script>
  52. </fieldset>