|
@@ -0,0 +1,515 @@
|
|
|
|
+{{include "head.html"}}
|
|
|
|
+`<div class="modal fade" id="modal-assigntask" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
|
|
|
+ <div class="modal-dialog">
|
|
|
|
+ <div class="modal-content">
|
|
|
|
+ <div class="modal-header">
|
|
|
|
+ <div class="modal-header">
|
|
|
|
+ <button type="button" id="assign-close" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
|
|
|
+ <!--<div class="edit-form">-->
|
|
|
|
+ <div class="edit-info">
|
|
|
|
+ <span class="glyphicon glyphicon-remove" id="code-assign" aria-hidden="true"></span>
|
|
|
|
+ <span class="info">爬虫分发<span>
|
|
|
|
+ </div>
|
|
|
|
+ <form class="form-horizontal" role="form">
|
|
|
|
+ <div class="form-group">
|
|
|
|
+ <label for="modify" class="col-sm-2 control-label">问题描述:</label>
|
|
|
|
+ <div class="col-sm-10">
|
|
|
|
+ <textarea class="form-control" id="reason"></textarea>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="form-group" id="assign-style">
|
|
|
|
+ <div class="col-sm-offset-2 col-sm-10">
|
|
|
|
+ <input type="button" onclick="comfirm_disables()" class="btn btn-primary" value="确定">
|
|
|
|
+ <input type="button" onclick="disables_cancel()" class="btn btn-default" value="取消">
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </form>
|
|
|
|
+ <!--</div> -->
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div><!-- /.modal-content -->
|
|
|
|
+ </div><!-- /.modal -->
|
|
|
|
+</div>
|
|
|
|
+
|
|
|
|
+<div class="content-wrapper">
|
|
|
|
+ <section class="content-header">
|
|
|
|
+ <h1>
|
|
|
|
+ 任务列表
|
|
|
|
+ <small>
|
|
|
|
+ <button class="btn btn-primary" onclick='tasks()'>
|
|
|
|
+ 批量导入任务
|
|
|
|
+ </button>
|
|
|
|
+ <iframe srcdoc="<form id='uploadform' method='post' enctype='multipart/form-data' action='/center/taskfile'><input type='file' name='xlsx' /></form>" height=0 scrolling=no class="hide" id="taskfileframe">
|
|
|
|
+ </iframe>
|
|
|
|
+
|
|
|
|
+ <button class="btn btn-primary createTask" onclick='createTask("")'>新建任务</button>
|
|
|
|
+
|
|
|
|
+ <a class="btn btn-default btn-sm" id="batchAssign" onclick="batchAssign()">批量分发</a>
|
|
|
|
+ <a class="btn btn-default btn-sm" id="batchClose" onclick="batchClose()">批量关闭</a>
|
|
|
|
+ </small>
|
|
|
|
+ </h1>
|
|
|
|
+ <ol class="breadcrumb">
|
|
|
|
+ <li><a href="#"><i class="fa fa-dashboard"></i> 导入</a></li>
|
|
|
|
+ <li class="active">列表</li>
|
|
|
|
+ </ol>
|
|
|
|
+ </section>
|
|
|
|
+ <section id="taskerrmsg" class="content hide" style="min-height:0px;">
|
|
|
|
+ <h5>错误信息:</h5>
|
|
|
|
+ </section>
|
|
|
|
+ <section class="content">
|
|
|
|
+ <div class="box">
|
|
|
|
+ <div class="box-body">
|
|
|
|
+ <table id="task" class="table table-bordered table-striped">
|
|
|
|
+ <thead>
|
|
|
|
+ <tr>
|
|
|
|
+ <th>网址</th>
|
|
|
|
+ <th><input type="checkbox" id="selrow" onclick="selectrow(this)"/></th>
|
|
|
|
+ <th>编号</th>
|
|
|
|
+ <th>网站名称</th>
|
|
|
|
+ <th>栏目名称</th>
|
|
|
|
+ <th>爬虫代码</th>
|
|
|
|
+ <th>状态</th>
|
|
|
|
+ <th>类型</th>
|
|
|
|
+ <th>维护人</th>
|
|
|
|
+ <th>节点</th>
|
|
|
|
+ <th>次数</th>
|
|
|
|
+ <th>来源</th>
|
|
|
|
+ <th>最迟完成时间</th>
|
|
|
|
+ <th class="hidden-xs">操作</th>
|
|
|
|
+ </tr>
|
|
|
|
+ </thead>
|
|
|
|
+ <tbody>
|
|
|
|
+
|
|
|
|
+ </tbody>
|
|
|
|
+ </table>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </section>
|
|
|
|
+<script>
|
|
|
|
+ var assigncode = "";
|
|
|
|
+ var assignid = "";
|
|
|
|
+ $(function(){
|
|
|
|
+ window.setInterval(function(){
|
|
|
|
+ $.post("/center/task/getJumpMark",function(r){
|
|
|
|
+ if(r){
|
|
|
|
+ ttabletask.ajax.reload();
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }, 3000);
|
|
|
|
+
|
|
|
|
+ taskConst = true;
|
|
|
|
+ setCookie("task","");
|
|
|
|
+ ttabletask = $('#task').DataTable({
|
|
|
|
+ "language": {
|
|
|
|
+ "url": "/js/dataTables.chinese.lang"
|
|
|
|
+ },
|
|
|
|
+ "ajax": {
|
|
|
|
+ "url": "/center/newtask/tasklist",
|
|
|
|
+ "type": "POST"
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ "columnDefs": [
|
|
|
|
+ { "targets": 0 ,"bVisible": false}, //隐藏列
|
|
|
|
+ { "orderable": false, "targets": [0,1,2,3,4,5,6,7,8,13] } //设置列不可排序
|
|
|
|
+ ],
|
|
|
|
+ "order": [[12,"desc"]], //默认排序列
|
|
|
|
+ "lengthChange":false,
|
|
|
|
+ "serverSide": true,
|
|
|
|
+ "searching": true,
|
|
|
|
+ "ordering": true,
|
|
|
|
+ "info": true,
|
|
|
|
+ "autoWidth": true,
|
|
|
|
+ "columns": [
|
|
|
|
+ {"data": "href"},
|
|
|
|
+ {"data": "_id",render:function(val,a,row){
|
|
|
|
+ return "<input type='checkbox' value='"+val+"' code='"+row.s_code+"' state='"+row.i_state+"'/>"
|
|
|
|
+ }},
|
|
|
|
+ {"data": "_id",render:function(val,a,row){
|
|
|
|
+ return row.num
|
|
|
|
+ }},
|
|
|
|
+ {"data": "s_site","width":"10%"},
|
|
|
|
+ {"data": "s_channel","width":"10%",render:function(val,a,row){
|
|
|
|
+ var href ="javascript:void(0)" ;
|
|
|
|
+ if(row["href"] != ""){
|
|
|
|
+ href = row["href"];
|
|
|
|
+ }
|
|
|
|
+ var vals="<a href='"+href+"' title='"+val+"' target='_blank'>"+val+"</a>"
|
|
|
|
+ return vals
|
|
|
|
+ }},
|
|
|
|
+ {"data": "s_code",render:function(val,a,row){
|
|
|
|
+ // var site = row["s_site"];
|
|
|
|
+ // var chanel = row["s_channel"];
|
|
|
|
+ // var href = "http://test.qmx.top:3000/dashboard/db/pa-chong-cai-ji-fen-jiao-ben-30ri-zou-shi-fen-xi?orgId=5&var-spidercode="+val+"&var-site="+site+"&=var-channel="+chanel;
|
|
|
|
+ // return "<a href='"+href+"' target='_blank' title='"+val+"'>"+val+"</a>"
|
|
|
|
+ return val;
|
|
|
|
+ }},
|
|
|
|
+ {"data": "i_state","width":"5%",render:function(val,a,row){
|
|
|
|
+ if (val == 0){
|
|
|
|
+ return "待确认"
|
|
|
|
+ }else if (val == 1){
|
|
|
|
+ return "待处理"
|
|
|
|
+ }else if (val == 2){
|
|
|
|
+ return "处理中"
|
|
|
|
+ }else if (val == 3){
|
|
|
|
+ return "待审核"
|
|
|
|
+ }else if (val == 4){
|
|
|
|
+ return "审核通过"
|
|
|
|
+ }else if (val == 5){
|
|
|
|
+ return "未通过"
|
|
|
|
+ }else if (val == 6){
|
|
|
|
+ return "关闭"
|
|
|
|
+ }
|
|
|
|
+ }},
|
|
|
|
+ {"data": "s_type","width":"7%",render:function(val,a,row){
|
|
|
|
+ if(val== "1"){
|
|
|
|
+ val="列表页异常"
|
|
|
|
+ }else if(val=="2"){
|
|
|
|
+ val="数据异常错误"
|
|
|
|
+ }else if(val=="4"){
|
|
|
|
+ val="采集频率异常"
|
|
|
|
+ }else if(val=="5"){
|
|
|
|
+ val="下载异常"
|
|
|
|
+ }else if(val=="6"){
|
|
|
|
+ val="数据异常警告"
|
|
|
|
+ }else if(val=="0"){
|
|
|
|
+ val="常规任务"
|
|
|
|
+ }
|
|
|
|
+ return val;
|
|
|
|
+ }},
|
|
|
|
+ {"data": "s_modify",},
|
|
|
|
+ {"data": "i_event",render:function(val,a,row){
|
|
|
|
+ if (val == undefined){
|
|
|
|
+ return "";
|
|
|
|
+ }
|
|
|
|
+ return val;
|
|
|
|
+ }},
|
|
|
|
+ {"data": "i_times"},
|
|
|
|
+ {"data": "s_source"},
|
|
|
|
+ {"data": "l_complete","width":"8%",render:function(val,a,row){
|
|
|
|
+ var dt = new Date()
|
|
|
|
+ dt.setTime(parseInt(val) * 1000);
|
|
|
|
+ return dt.format("yyyy-MM-dd hh:mm:ss");
|
|
|
|
+ }},
|
|
|
|
+ {"data": "_id","width":"9%",render:function(val,a,row){
|
|
|
|
+ var div=$("<div><div class=\"btn-group\"></div></div>")
|
|
|
|
+ var buttonWatch=$('<a type="button" target="_blank" class="btn btn-sm btn-success">编辑</a>');
|
|
|
|
+ var buttonClose=$('<a type="button" class="btn btn-sm btn-danger">关闭</a>');
|
|
|
|
+ var buttonTag=$('<a type="button" class="btn btn-sm btn-primary">标记</a>');
|
|
|
|
+ //var buttonDel=$('<a type="button" class="btn btn-sm btn-default">删除</a>');
|
|
|
|
+ buttonWatch.attr("href","/center/newtask/edit/"+row['_id']+"__0");
|
|
|
|
+ buttonClose.attr("onclick","closeTask('"+row['s_code']+"','"+row['i_state']+"','"+row['_id']+"')");
|
|
|
|
+ buttonTag.attr("onclick","tagTask('"+row['s_code']+"','"+row['i_state']+"','"+row['_id']+"','"+row['s_type']+"')");
|
|
|
|
+ div.find(".btn-group").append(buttonWatch);
|
|
|
|
+ div.find(".btn-group").append(buttonClose);
|
|
|
|
+ if(row['i_state'] == "0"){
|
|
|
|
+ var buttonAssign=$('<a type="button" class="btn btn-sm btn-warning">分发</a>');
|
|
|
|
+ buttonAssign.attr("onclick","assignTask('"+row['s_code']+"','"+row['i_state']+"','"+row['_id']+"')");
|
|
|
|
+ div.find(".btn-group").append(buttonAssign);
|
|
|
|
+ div.find(".btn-group").append(buttonTag);//只有待确认的任务可以标记
|
|
|
|
+ }
|
|
|
|
+ return div.html();
|
|
|
|
+ }}
|
|
|
|
+ ],
|
|
|
|
+ "fnDrawCallback": function(table) {
|
|
|
|
+ $("ul.pagination").prepend(" 转到第 <input type='text' id='changePage' style='width:20px;'> 页 <a type='text' href='javascript:void(0);' id='dataTable-btn' style='text-align:center'>GO</a>");
|
|
|
|
+ $('#dataTable-btn').click(function(e) {
|
|
|
|
+ var redirectpage=0
|
|
|
|
+ if($("#changePage").val() && $("#changePage").val() > 0) {
|
|
|
|
+ var redirectpage = $("#changePage").val() - 1;
|
|
|
|
+ }
|
|
|
|
+ ttabletask.page(redirectpage).draw(false);
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ "fnServerParams": function (e) {
|
|
|
|
+ var taskState = $("#task_state").val();
|
|
|
|
+ var taskEvent = $("#task_event").val();
|
|
|
|
+ var taskStype = $("#task_stype").val();
|
|
|
|
+ var userid = $("#modifyuser").val();
|
|
|
|
+ //任务状态
|
|
|
|
+ if(taskState){
|
|
|
|
+ e.taskState = taskState;
|
|
|
|
+ }else{
|
|
|
|
+ e.taskState="-1";
|
|
|
|
+ }
|
|
|
|
+ //节点
|
|
|
|
+ if(taskEvent){
|
|
|
|
+ e.taskEvent = taskEvent;
|
|
|
|
+ }else{
|
|
|
|
+ e.taskEvent="-1";
|
|
|
|
+ }
|
|
|
|
+ //任务类型
|
|
|
|
+ if(taskStype){
|
|
|
|
+ e.taskStype = taskStype;
|
|
|
|
+ }else{
|
|
|
|
+ e.taskStype="-1";
|
|
|
|
+ }
|
|
|
|
+ //维护人
|
|
|
|
+ if(userid){
|
|
|
|
+ e.userid = userid;
|
|
|
|
+ }else{
|
|
|
|
+ e.userid="-1";
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ common.setActive("index_newrwgl");
|
|
|
|
+ ttabletask.on('init.dt', function () {
|
|
|
|
+ var taskState="<option value='-1'>全部</option>"+
|
|
|
|
+ "<option value='0'>待确认</option>"+
|
|
|
|
+ "<option value='1'>待处理</option>"+
|
|
|
|
+ "<option value='2'>处理中</option>"+
|
|
|
|
+ "<option value='3'>待审核</option>"+
|
|
|
|
+ "<option value='4'>审核通过</option>"+
|
|
|
|
+ "<option value='5'>未通过</option>"+
|
|
|
|
+ "<option value='6'>关闭</option>";
|
|
|
|
+ var selectState="<div class='form-group'><label for='name'>任务状态:</label>"+
|
|
|
|
+ "<select id='task_state' onchange='checkclick(this.value)' class='form-control input-sm'>"+
|
|
|
|
+ taskState+
|
|
|
|
+ "</select></div>"
|
|
|
|
+ $("#task_filter").prepend(" ");
|
|
|
|
+ $("#task_filter").prepend(selectState);
|
|
|
|
+
|
|
|
|
+ var taskStype="<option value='-1'>全部</option>"+
|
|
|
|
+ "<option value='1'>列表页异常</option>"+
|
|
|
|
+ "<option value='2'>数据异常错误</option>"+
|
|
|
|
+ "<option value='4'>采集频率异常</option>"+
|
|
|
|
+ "<option value='5'>下载异常</option>"+
|
|
|
|
+ "<option value='6'>数据异常警告</option>"+
|
|
|
|
+ "<option value='0'>常规任务</option>";
|
|
|
|
+ var selectStype="<div class='form-group'><label for='name'>任务类型:</label>"+
|
|
|
|
+ "<select id='task_stype' onchange='checkclick(this.value)' class='form-control input-sm'>"+
|
|
|
|
+ taskStype+
|
|
|
|
+ "</select></div>"
|
|
|
|
+ $("#task_filter").prepend(" ");
|
|
|
|
+ $("#task_filter").prepend(selectStype);
|
|
|
|
+
|
|
|
|
+ var taskEvent="<option value='-1'>全部</option>"
|
|
|
|
+ var events={{.T.events}}
|
|
|
|
+ for(k in events){
|
|
|
|
+ taskEvent+="<option value='"+events[k]+"'>"+events[k]+"</option>"
|
|
|
|
+ }
|
|
|
|
+ var selectEvent="<div class='form-group'><label for='name'>节点:</label>"+
|
|
|
|
+ "<select id='task_event' onchange='checkclick(this.value)' class='form-control input-sm'>"+
|
|
|
|
+ taskEvent+
|
|
|
|
+ "</select></div>"
|
|
|
|
+ $("#task_filter").prepend(" ");
|
|
|
|
+ $("#task_filter").prepend(selectEvent);
|
|
|
|
+
|
|
|
|
+ var modifyuser="<option value='-1'>全部</option>"
|
|
|
|
+ var modifyusers={{.T.modifyusers}}
|
|
|
|
+ for(k in modifyusers){
|
|
|
|
+ modifyuser+="<option value='"+modifyusers[k]["_id"]+"'>"+modifyusers[k]["s_name"]+"</option>"
|
|
|
|
+ }
|
|
|
|
+ var selectModifyuser="<div class='form-group'><label for='name'>维护人:</label>"+
|
|
|
|
+ "<select id='modifyuser' onchange='checkclick(this.value)' class='form-control input-sm'>"+
|
|
|
|
+ modifyuser+
|
|
|
|
+ "</select></div>"
|
|
|
|
+ $("#task_filter").prepend(" ");
|
|
|
|
+ $("#task_filter").prepend(selectModifyuser);
|
|
|
|
+ //修改样式
|
|
|
|
+ $("#task_wrapper .col-sm-6").css({width:"100%"});
|
|
|
|
+ });
|
|
|
|
+ ttabletask.on('preXhr.dt', function ( e, settings, data ) {
|
|
|
|
+ $("[type=search]").keypress(function(){
|
|
|
|
+ setCookie("task",$("[type=search]").val());
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ function checkclick(urgency){
|
|
|
|
+ ttabletask.ajax.reload();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function tasks(){
|
|
|
|
+ var f=$("#taskfileframe").contents().find("input");
|
|
|
|
+ f.get(0).click();
|
|
|
|
+ f.change(function(){
|
|
|
|
+ var val=$(this).val()?$(this).val():"";
|
|
|
|
+ if(val.indexOf(".xlsx")<0){
|
|
|
|
+ showTip("文件格式非法",2000);
|
|
|
|
+ }else{
|
|
|
|
+ $(this).parent().submit();
|
|
|
|
+ common.maskShow("正在导入数据");
|
|
|
|
+ var ret=setInterval(function(){
|
|
|
|
+ var f=$(window.frames[0].document).find("form");
|
|
|
|
+ if(f.length==0){
|
|
|
|
+ common.maskHide();
|
|
|
|
+ var errorInfo=$(window.frames[0].document).find("body").html();
|
|
|
|
+ $(window.frames[0].document).find("body").append("<form id='uploadform' method='post' enctype='multipart/form-data' action='/center/taskfile'><input type='file' name='xlsx' /></form>");
|
|
|
|
+
|
|
|
|
+ var r=window.confirm("导入完毕,是否查看错误信息");
|
|
|
|
+ if(r){
|
|
|
|
+ $("#taskerrmsg").removeClass("hide").append(errorInfo);
|
|
|
|
+ ttabletask.ajax.reload();
|
|
|
|
+ }else{
|
|
|
|
+ window.location.reload();
|
|
|
|
+ }
|
|
|
|
+ clearInterval(ret);
|
|
|
|
+ }
|
|
|
|
+ },500)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ function disables_cancel(){
|
|
|
|
+ $("#modal-assigntask").modal("hide");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function comfirm_disables(){
|
|
|
|
+ if(assigncode== "" || assignid == ""){
|
|
|
|
+ showTip("分发失败", 1000);
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ var reasontext = $("#reason").val();
|
|
|
|
+ $.post("/center/task/assignChangeTaskState",{"code":assigncode,"id":assignid,"reason":reasontext},function(r){
|
|
|
|
+ if(r == "y"){
|
|
|
|
+ $("#modal-assigntask").modal("hide");
|
|
|
|
+ showTip("分发成功", 1000);
|
|
|
|
+ $('#com-alert').on('hidden.bs.modal', function () {
|
|
|
|
+ ttabletask.ajax.reload();
|
|
|
|
+ })
|
|
|
|
+ }else if(r == "e"){
|
|
|
|
+ showTip("任务已存在", 1000);
|
|
|
|
+ }else if(r == "n"){
|
|
|
|
+ showTip("分发失败", 1000);
|
|
|
|
+ }else{
|
|
|
|
+ showTip("没有权限", 1000);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //分配任务
|
|
|
|
+ function assignTask(code,state,id){
|
|
|
|
+ if(state != "待确认"){
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ assigncode = code;
|
|
|
|
+ assignid = id;
|
|
|
|
+ $("#modal-assigntask").modal("show");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //关闭任务
|
|
|
|
+ function closeTask(code,state,id){
|
|
|
|
+ if(state == "关闭"){
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ showConfirm("确定关闭任务?",function(){
|
|
|
|
+ $.post("/center/task/closeChangeTaskState",{"id":id,"code":code},function(r){
|
|
|
|
+ if(r == "y"){
|
|
|
|
+ showTip("关闭成功", 1000);
|
|
|
|
+ $('#com-alert').on('hidden.bs.modal', function () {
|
|
|
|
+ ttabletask.ajax.reload();
|
|
|
|
+ })
|
|
|
|
+ }else if(r == "n"){
|
|
|
|
+ showTip("关闭失败", 1000);
|
|
|
|
+ }else{
|
|
|
|
+ showTip("没有权限", 1000);
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //标记任务
|
|
|
|
+ function tagTask(code,state,id,stype){
|
|
|
|
+ if(state != "待确认" && state != "待处理" && state != "处理中"){
|
|
|
|
+ alert("该任务不能被标记!")
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ showConfirm("确定标记任务?",function(){
|
|
|
|
+ $.post("/center/spider/tagcode",{"id":id,"code":code,"stype":stype},function(r){
|
|
|
|
+ if(r == "y"){
|
|
|
|
+ showTip("标记成功", 1000);
|
|
|
|
+ $('#com-alert').on('hidden.bs.modal', function () {
|
|
|
|
+ ttabletask.ajax.reload();
|
|
|
|
+ })
|
|
|
|
+ }else{
|
|
|
|
+ showTip("标记失败", 1000);
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //批量分发
|
|
|
|
+ function batchAssign(){
|
|
|
|
+ var codes=[];
|
|
|
|
+ var ids=[];
|
|
|
|
+ var flag = true;
|
|
|
|
+ $("#task_wrapper td input[type=checkbox]").each(function(){
|
|
|
|
+ if($(this).prop("checked")){
|
|
|
|
+ var state = $(this).attr("state")
|
|
|
|
+ if(state == "关闭"){
|
|
|
|
+ flag = false;
|
|
|
|
+ }
|
|
|
|
+ ids.push($(this).val());
|
|
|
|
+ codes.push($(this).attr("code"));
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ if(!flag){
|
|
|
|
+ showTip("请选择未关闭的任务", 2000);
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if(ids.length >0){
|
|
|
|
+ showConfirm("确定批量分发?", function() {
|
|
|
|
+ $.post("/center/task/batchAssign",{"codes":codes.join(","),"ids":ids.join(",")},function(r){
|
|
|
|
+ if(r == null){
|
|
|
|
+ showTip("批量分发成功", 1000);
|
|
|
|
+ }else{
|
|
|
|
+ showTip(r+";分发失败",30000);
|
|
|
|
+ }
|
|
|
|
+ $("#selrow").prop('checked',false);
|
|
|
|
+ $('#com-alert').on('hidden.bs.modal', function () {
|
|
|
|
+ ttabletask.ajax.reload();
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ }else{
|
|
|
|
+ showTip("没有选择项", 1000);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //批量关闭
|
|
|
|
+ function batchClose(){
|
|
|
|
+ var ids=[]
|
|
|
|
+ var codes=[];
|
|
|
|
+ var flag = true;
|
|
|
|
+ $("#task_wrapper td input[type=checkbox]").each(function(){
|
|
|
|
+ if($(this).prop("checked")){
|
|
|
|
+ var state = $(this).attr("state")
|
|
|
|
+ if(state == "关闭"){
|
|
|
|
+ flag = false;
|
|
|
|
+ }
|
|
|
|
+ ids.push($(this).val());
|
|
|
|
+ codes.push($(this).attr("code"));
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ if(!flag){
|
|
|
|
+ showTip("请选择未关闭的任务", 2000);
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if(ids.length >0){
|
|
|
|
+ showConfirm("确定批量关闭?", function() {
|
|
|
|
+ $.post("/center/task/batchClose",{"ids":ids.join(","),"codes":codes.join(",")},function(r){
|
|
|
|
+ if(r == null){
|
|
|
|
+ showTip("批量关闭成功", 1000);
|
|
|
|
+ }else{
|
|
|
|
+ showTip(r+";关闭失败",30000);
|
|
|
|
+ }
|
|
|
|
+ $("#selrow").prop('checked',false);
|
|
|
|
+ $('#com-alert').on('hidden.bs.modal', function () {
|
|
|
|
+ ttabletask.ajax.reload();
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ }else{
|
|
|
|
+ showTip("没有选择项", 1000);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function selectrow(me){
|
|
|
|
+ var sel=$(me);
|
|
|
|
+ var isSelected=sel.prop('checked');
|
|
|
|
+ if(isSelected){
|
|
|
|
+ $("#task td input[type=checkbox]").prop("checked",true);
|
|
|
|
+ }else{
|
|
|
|
+ $("#task td input[type=checkbox]").prop("checked",false);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+</script>
|
|
|
|
+</div>
|
|
|
|
+{{include "bottom.html"}}
|