detail.html 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <extend name="$_admin_public_layout"/>
  2. <script type="text/javascript" src="__PUBLIC__/libs/js/jquery.min.js"></script>
  3. <block name="style">
  4. <link rel="stylesheet" href="__PUBLIC__/libs/layui/css/layui.css" media="all">
  5. <script src="__PUBLIC__/libs/layui/layui.js"></script>
  6. <script src="__PUBLIC__/libs/jquery/2.x/jquery.js"></script>
  7. </block>
  8. <block name="script">
  9. <script src="__PUBLIC__/libs/guide/bootstrap-tour.js"></script>
  10. <script src="__PUBLIC__/libs/guide/guide.js?_t=2016121401"></script>
  11. </block>
  12. <block name="main">
  13. <fieldset name="meta_title" class="layui-elem-field layui-field-title" style="margin-top: 20px;margin-bottom: 20px;">
  14. <legend style="margin-bottom: 0;">{$meta_title}</legend>
  15. </fieldset>
  16. <div class="layui-text layui-bg-red">
  17. [备注:激活中不能追加文件,不能再次激活,激活完成可以再次追加文件和激活]
  18. </div>
  19. <!-- 列表 -->
  20. <table class="layui-table">
  21. <colgroup>
  22. <col width="60">
  23. <col width="290">
  24. <col>
  25. </colgroup>
  26. <thead>
  27. <volist name="detail" id="v">
  28. <tr>
  29. <th>编号</th>
  30. <th>
  31. {$v.id}
  32. </th>
  33. </tr>
  34. <tr>
  35. <th>总条数|成功条数|失败条数</th>
  36. <th><?php echo $v['num']/10000;?>万条|<?php echo $v['succ']/10000;?>万条|<?php echo $v['fail']/10000;?>万条</th>
  37. </tr>
  38. <tr>
  39. <th>上传时间</th>
  40. <th>{$v.time|date="Y-m-d H:i:s",###}</th>
  41. </tr>
  42. <tr>
  43. <th>批次编码</th>
  44. <th>{$v.active_batch}</th>
  45. </tr>
  46. <tr>
  47. <th>未激活文件列表</th>
  48. <th>{$upload_txt}</th>
  49. </tr>
  50. <tr>
  51. <th>已激活文件列表</th>
  52. <th>{$active_txt}</th>
  53. </tr>
  54. <tr>
  55. <th>激活状态</th>
  56. <th>
  57. <if condition="$status eq 0">
  58. 未激活
  59. <elseif condition="$status eq 1"/>激活中
  60. <else /> 已激活
  61. </if>
  62. </th>
  63. </tr>
  64. <tr>
  65. <th>备注</th>
  66. <th>{$v.remark}</th>
  67. </tr>
  68. </volist>
  69. </thead>
  70. </table>
  71. <if condition="getUserGroup(session('user_auth.uid')) eq 1">
  72. <form enctype="multipart/form-data" method="post" class="layui-form" action="">
  73. <div class="layui-upload">
  74. <div class="layui-upload-list">
  75. <table class="layui-table">
  76. <thead>
  77. <tr>
  78. <th>文件名</th>
  79. <th>大小</th>
  80. <th>状态</th>
  81. <th>操作</th>
  82. </tr>
  83. </thead>
  84. <tbody id="demoList"></tbody>
  85. </table>
  86. </div>
  87. <div>
  88. <if condition="$v.status eq 0">
  89. <button style="margin-left:2%" type="button" class="layui-btn layui-btn-normal" id="fileList">选择多文件</button>
  90. <button style="margin-left:0.8%" type="button" class="layui-btn" id="testListAction">开始上传</button>
  91. <button id="submits_id" class="layui-btn layui-btn-warm" lay-submit lay-filter="submits">立即提交</button>
  92. <input type="button" class="layui-btn jihuo" value="提交任务">
  93. </if>
  94. <if condition="$v.fail gt 0 ">
  95. <button class="layui-btn" class="getfail" >查看失败</button>
  96. </if>
  97. </div>
  98. </div>
  99. <span id="hidden">
  100. <input type='hidden' name='active_batch' value={$detail[0][active_batch]}>
  101. <input type='hidden' name='id' value={$detail[0][id]}>
  102. </span>
  103. </form>
  104. <script>
  105. $('.jihuo').off('click').click(function(){
  106. var active_batch = $("input[name='active_batch']").val();
  107. if(active_batch==''){
  108. layer.msg('激活批次号缺少');
  109. }else{
  110. layer.msg('任务已提交');
  111. }
  112. //激活二维码
  113. $.ajax({
  114. type:'post',
  115. url:"{:U('Auto/togetTxtActivefile')}",
  116. data:{active_batch:active_batch},
  117. dataType:'json',
  118. success:function(result){
  119. return false;
  120. layer.msg(result.cont);
  121. }
  122. })
  123. })
  124. layui.use(['upload', 'layer', 'form'], function () {
  125. // var filename='{$task_detail[0][task_name]}_{$task_detail[0][task_id]}.txt';
  126. var $ = layui.jquery
  127. , upload = layui.upload,
  128. layer = layui.layer,
  129. form = layui.form;
  130. //多文件列表示例
  131. var demoListView = $('#demoList'),
  132. uploadListIns = upload.render({
  133. elem: '#fileList',
  134. url: "{:U('Qr1/UploadTemp')}",
  135. accept: 'file',//指定允许上传的文件类型
  136. exts: 'txt',//允许上传的文件后缀
  137. multiple: true,//是否允许多文件上传
  138. auto: false,//是否选完文件后自动上传
  139. bindAction: '#testListAction',//指向一个按钮触发上传
  140. choose: function (obj) { //选择文件后的回调函数
  141. var files = obj.pushFile(); //将每次选择的文件追加到文件队列
  142. //读取本地文件
  143. obj.preview(function (index, file, result) {
  144. var tr = $(['<tr id="upload-' + index + '">'
  145. , '<td>' + file.name + '</td>'
  146. , '<td>' + (file.size / 1014).toFixed(1) + 'kb</td>'
  147. , '<td>等待上传</td>'
  148. , '<td>'
  149. , '<button class="layui-btn layui-btn-mini layui-btn-danger demo-delete">删除</button>'
  150. , '</td>'
  151. , '</tr>'].join(''));
  152. //删除
  153. tr.find('.demo-delete').on('click', function () {
  154. delete files[index]; //删除对应的文件
  155. tr.remove();
  156. });
  157. demoListView.append(tr);
  158. });
  159. }
  160. , done: function (res, index, upload) {
  161. if (res.code == 1) { //上传成功
  162. var tr = demoListView.find('tr#upload-' + index)
  163. , tds = tr.children();
  164. tds.eq(2).html('<span style="color: #5FB878;">上传成功</span>');
  165. tds.eq(3).html(''); //清空操作
  166. $('#hidden').append("<input type='hidden' name='url[]' value=" + res.file + ">");
  167. //delete files[index]; //删除文件队列已经上传成功的文件
  168. return;
  169. }
  170. layer.msg(res.msg);
  171. this.error(index, upload);
  172. }
  173. , error: function (index, upload) {
  174. var tr = demoListView.find('tr#upload-' + index)
  175. , tds = tr.children();
  176. tds.eq(2).html('<span style="color: #FF5722;">上传失败</span>');
  177. tds.eq(3).find('.demo-reload').removeClass('layui-hide'); //显示重传
  178. }
  179. });
  180. form.on('submit(submits)', function (data) {
  181. var url = [];
  182. $("input[name='url[]']").each(function () {
  183. url.push($(this).val());
  184. });
  185. var active_batch = $("input[name='active_batch']").val();
  186. var id = $("input[name='id']").val();
  187. if (url.length == 0) {
  188. layer.msg('请选择上传的文件');
  189. return false;
  190. }
  191. $.ajax({
  192. async: false,//同步
  193. url: "{:U('Qr1/Upload')}",
  194. type: 'POST',
  195. data: {
  196. url: url,active_batch:active_batch,id:id
  197. },
  198. timeout: 1000,//1秒
  199. dataType: 'json',
  200. success: function (data) {
  201. layer.alert(data.msg, function (index) {
  202. window.location.href = '__SELF__';
  203. });
  204. }
  205. });
  206. return false;
  207. });
  208. });
  209. </script>
  210. </if>
  211. </block>