| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224 |
- <extend name="$_admin_public_layout"/>
- <script type="text/javascript" src="__PUBLIC__/libs/js/jquery.min.js"></script>
- <block name="style">
- <link rel="stylesheet" href="__PUBLIC__/libs/layui/css/layui.css" media="all">
- <script src="__PUBLIC__/libs/layui/layui.js"></script>
- <script src="__PUBLIC__/libs/jquery/2.x/jquery.js"></script>
- </block>
- <block name="script">
- <script src="__PUBLIC__/libs/guide/bootstrap-tour.js"></script>
- <script src="__PUBLIC__/libs/guide/guide.js?_t=2016121401"></script>
- </block>
- <block name="main">
- <fieldset name="meta_title" class="layui-elem-field layui-field-title" style="margin-top: 20px;margin-bottom: 20px;">
- <legend style="margin-bottom: 0;">{$meta_title}</legend>
- </fieldset>
- <div class="layui-text layui-bg-red">
- [备注:激活中不能追加文件,不能再次激活,激活完成可以再次追加文件和激活]
- </div>
- <!-- 列表 -->
- <table class="layui-table">
- <colgroup>
- <col width="60">
- <col width="290">
- <col>
- </colgroup>
- <thead>
- <volist name="detail" id="v">
- <tr>
- <th>编号</th>
- <th>
- {$v.id}
- </th>
- </tr>
- <tr>
- <th>总条数|成功条数|失败条数</th>
- <th><?php echo $v['num']/10000;?>万条|<?php echo $v['succ']/10000;?>万条|<?php echo $v['fail']/10000;?>万条</th>
- </tr>
- <tr>
- <th>上传时间</th>
- <th>{$v.time|date="Y-m-d H:i:s",###}</th>
- </tr>
- <tr>
- <th>批次编码</th>
- <th>{$v.active_batch}</th>
- </tr>
- <tr>
- <th>未激活文件列表</th>
- <th>{$upload_txt}</th>
- </tr>
- <tr>
- <th>已激活文件列表</th>
- <th>{$active_txt}</th>
- </tr>
- <tr>
- <th>激活状态</th>
- <th>
- <if condition="$status eq 0">
- 未激活
- <elseif condition="$status eq 1"/>激活中
- <else /> 已激活
- </if>
- </th>
- </tr>
- <tr>
- <th>备注</th>
- <th>{$v.remark}</th>
- </tr>
- </volist>
- </thead>
- </table>
- <if condition="getUserGroup(session('user_auth.uid')) eq 1">
- <form enctype="multipart/form-data" method="post" class="layui-form" action="">
- <div class="layui-upload">
- <div class="layui-upload-list">
- <table class="layui-table">
- <thead>
- <tr>
- <th>文件名</th>
- <th>大小</th>
- <th>状态</th>
- <th>操作</th>
- </tr>
- </thead>
- <tbody id="demoList"></tbody>
- </table>
- </div>
- <div>
- <if condition="$v.status eq 0">
- <button style="margin-left:2%" type="button" class="layui-btn layui-btn-normal" id="fileList">选择多文件</button>
- <button style="margin-left:0.8%" type="button" class="layui-btn" id="testListAction">开始上传</button>
- <button id="submits_id" class="layui-btn layui-btn-warm" lay-submit lay-filter="submits">立即提交</button>
- <input type="button" class="layui-btn jihuo" value="提交任务">
- </if>
- <if condition="$v.fail gt 0 ">
- <button class="layui-btn" class="getfail" >查看失败</button>
- </if>
- </div>
- </div>
- <span id="hidden">
- <input type='hidden' name='active_batch' value={$detail[0][active_batch]}>
- <input type='hidden' name='id' value={$detail[0][id]}>
- </span>
- </form>
- <script>
- $('.jihuo').off('click').click(function(){
- var active_batch = $("input[name='active_batch']").val();
- if(active_batch==''){
- layer.msg('激活批次号缺少');
- }else{
- layer.msg('任务已提交');
- }
- //激活二维码
- $.ajax({
- type:'post',
- url:"{:U('Auto/togetTxtActivefile')}",
- data:{active_batch:active_batch},
- dataType:'json',
- success:function(result){
- return false;
- layer.msg(result.cont);
- }
- })
- })
- layui.use(['upload', 'layer', 'form'], function () {
- // var filename='{$task_detail[0][task_name]}_{$task_detail[0][task_id]}.txt';
- var $ = layui.jquery
- , upload = layui.upload,
- layer = layui.layer,
- form = layui.form;
- //多文件列表示例
- var demoListView = $('#demoList'),
- uploadListIns = upload.render({
- elem: '#fileList',
- url: "{:U('Qr1/UploadTemp')}",
- accept: 'file',//指定允许上传的文件类型
- exts: 'txt',//允许上传的文件后缀
- multiple: true,//是否允许多文件上传
- auto: false,//是否选完文件后自动上传
- bindAction: '#testListAction',//指向一个按钮触发上传
- choose: function (obj) { //选择文件后的回调函数
- var files = obj.pushFile(); //将每次选择的文件追加到文件队列
- //读取本地文件
- obj.preview(function (index, file, result) {
- var tr = $(['<tr id="upload-' + index + '">'
- , '<td>' + file.name + '</td>'
- , '<td>' + (file.size / 1014).toFixed(1) + 'kb</td>'
- , '<td>等待上传</td>'
- , '<td>'
- , '<button class="layui-btn layui-btn-mini layui-btn-danger demo-delete">删除</button>'
- , '</td>'
- , '</tr>'].join(''));
- //删除
- tr.find('.demo-delete').on('click', function () {
- delete files[index]; //删除对应的文件
- tr.remove();
- });
- demoListView.append(tr);
- });
- }
- , done: function (res, index, upload) {
- if (res.code == 1) { //上传成功
- var tr = demoListView.find('tr#upload-' + index)
- , tds = tr.children();
- tds.eq(2).html('<span style="color: #5FB878;">上传成功</span>');
- tds.eq(3).html(''); //清空操作
- $('#hidden').append("<input type='hidden' name='url[]' value=" + res.file + ">");
- //delete files[index]; //删除文件队列已经上传成功的文件
- return;
- }
- layer.msg(res.msg);
- this.error(index, upload);
- }
- , error: function (index, upload) {
- var tr = demoListView.find('tr#upload-' + index)
- , tds = tr.children();
- tds.eq(2).html('<span style="color: #FF5722;">上传失败</span>');
- tds.eq(3).find('.demo-reload').removeClass('layui-hide'); //显示重传
- }
- });
- form.on('submit(submits)', function (data) {
- var url = [];
- $("input[name='url[]']").each(function () {
- url.push($(this).val());
- });
- var active_batch = $("input[name='active_batch']").val();
- var id = $("input[name='id']").val();
- if (url.length == 0) {
- layer.msg('请选择上传的文件');
- return false;
- }
- $.ajax({
- async: false,//同步
- url: "{:U('Qr1/Upload')}",
- type: 'POST',
- data: {
- url: url,active_batch:active_batch,id:id
- },
- timeout: 1000,//1秒
- dataType: 'json',
- success: function (data) {
- layer.alert(data.msg, function (index) {
- window.location.href = '__SELF__';
- });
- }
- });
- return false;
- });
- });
- </script>
- </if>
- </block>
|