|
@@ -142,7 +142,8 @@
|
|
|
<th>最后修改时间</th>
|
|
|
<th>状态</th>
|
|
|
<th>平台</th>
|
|
|
- <th class="hidden-xs">操作</th>
|
|
|
+ <th>挂起</th>
|
|
|
+ <th class="hidden-xs">操作</th>
|
|
|
</tr>
|
|
|
</thead>
|
|
|
</table>
|
|
@@ -159,107 +160,132 @@ $(function(){
|
|
|
"url": "/js/dataTables.chinese.lang"
|
|
|
},
|
|
|
"columnDefs": [
|
|
|
- { "orderable": false, "targets": [0,10,11] },
|
|
|
- //更新节点
|
|
|
- {"targets":[6], createdCell: function (cell, cellData, rowData, rowIndex, colIndex) {
|
|
|
- {{if gt (session "auth") 2}}
|
|
|
- var aInput;
|
|
|
- $(cell).click(function () {
|
|
|
- $(this).html(createComboxEvent(rowData._id,rowData.state,rowData.code));
|
|
|
- var aInput = $(this).find(":input");
|
|
|
- aInput.focus().val(cellData);
|
|
|
- });
|
|
|
- $(cell).on("click", ":input", function (e) {
|
|
|
- e.stopPropagation();
|
|
|
- });
|
|
|
- $(cell).on("change", ":input", function () {
|
|
|
- $(this).blur();
|
|
|
- });
|
|
|
- $(cell).on("blur", ":input", function () {
|
|
|
- var text = $(this).find("option:selected").text();
|
|
|
- ttable.cell(cell).data(text);
|
|
|
- cellData = text;
|
|
|
- });
|
|
|
- {{end}}
|
|
|
- }},
|
|
|
- //更新状态
|
|
|
- {"targets":[9], createdCell: function (cell, cellData, rowData, rowIndex, colIndex) {
|
|
|
- {{if gt (session "auth") 2}}
|
|
|
- var aInput;
|
|
|
- $(cell).click(function () {
|
|
|
- if(cellData!=4&&cellData!=7&&cellData!=8&&cellData!=9&&cellData!=10){
|
|
|
- return
|
|
|
- }
|
|
|
- $(this).html(createComboxState(rowData._id));
|
|
|
- var aInput = $(this).find(":input");
|
|
|
- aInput.focus().val(cellData);
|
|
|
- });
|
|
|
- $(cell).on("click", ":input", function (e) {
|
|
|
- e.stopPropagation();
|
|
|
- });
|
|
|
- $(cell).on("change", ":input", function () {
|
|
|
- $(this).blur();
|
|
|
- });
|
|
|
- $(cell).on("blur", ":input", function () {
|
|
|
- var text = $(this).find("option:selected").text();
|
|
|
- if(text=="待完成"){
|
|
|
- text = 0
|
|
|
- }else if (text=="已作废"){
|
|
|
- text = 4
|
|
|
- }else if (text=="无发布"){
|
|
|
- text = 7
|
|
|
- }else if (text=="需登录"){
|
|
|
- text = 8
|
|
|
- }else if (text=="无法处理"){
|
|
|
- text = 9
|
|
|
- }else if (text=="已删除"){
|
|
|
- text = 10
|
|
|
- }else if (text=="已上线"){
|
|
|
- text = 11
|
|
|
- }
|
|
|
- ttable.cell(cell).data(text);
|
|
|
- cellData = text;
|
|
|
- });
|
|
|
- {{end}}
|
|
|
- }},
|
|
|
- //更新平台
|
|
|
- {"targets":[10], createdCell: function (cell, cellData, rowData, rowIndex, colIndex) {
|
|
|
- {{if gt (session "auth") 2}}
|
|
|
- var aInput;
|
|
|
- $(cell).click(function () {
|
|
|
- $(this).html(createComboxPlatform(rowData.code,rowData._id));
|
|
|
- var aInput = $(this).find(":input");
|
|
|
- aInput.focus().val(cellData);
|
|
|
- });
|
|
|
- $(cell).on("click", ":input", function (e) {
|
|
|
- e.stopPropagation();
|
|
|
- });
|
|
|
- $(cell).on("change", ":input", function () {
|
|
|
- $(this).blur();
|
|
|
- });
|
|
|
- $(cell).on("blur", ":input", function () {
|
|
|
- var text = $(this).find("option:selected").text();
|
|
|
- if(text=="待完成"){
|
|
|
- text = 0
|
|
|
- }else if (text=="已作废"){
|
|
|
- text = 4
|
|
|
- }else if (text=="无发布"){
|
|
|
- text = 7
|
|
|
- }else if (text=="需登录"){
|
|
|
- text = 8
|
|
|
- }else if (text=="无法处理"){
|
|
|
- text = 9
|
|
|
- }else if (text=="已删除"){
|
|
|
- text = 10
|
|
|
- }else if (text=="已上线"){
|
|
|
- text = 11
|
|
|
- }
|
|
|
- ttable.cell(cell).data(text);
|
|
|
- cellData = text;
|
|
|
- });
|
|
|
- {{end}}
|
|
|
- }}
|
|
|
- ],
|
|
|
+ { "orderable": false, "targets": [0,10] },
|
|
|
+ //更新节点
|
|
|
+ {"targets":[6], createdCell: function (cell, cellData, rowData, rowIndex, colIndex) {
|
|
|
+ {{if gt (session "auth") 2}}
|
|
|
+ var aInput;
|
|
|
+ $(cell).click(function () {
|
|
|
+ $(this).html(createComboxEvent(rowData._id,rowData.state,rowData.code));
|
|
|
+ var aInput = $(this).find(":input");
|
|
|
+ aInput.focus().val(cellData);
|
|
|
+ });
|
|
|
+ $(cell).on("click", ":input", function (e) {
|
|
|
+ e.stopPropagation();
|
|
|
+ });
|
|
|
+ $(cell).on("change", ":input", function () {
|
|
|
+ $(this).blur();
|
|
|
+ });
|
|
|
+ $(cell).on("blur", ":input", function () {
|
|
|
+ var text = $(this).find("option:selected").text();
|
|
|
+ ttable.cell(cell).data(text);
|
|
|
+ cellData = text;
|
|
|
+ });
|
|
|
+ {{end}}
|
|
|
+ }},
|
|
|
+ //更新状态
|
|
|
+ {"targets":[9], createdCell: function (cell, cellData, rowData, rowIndex, colIndex) {
|
|
|
+ {{if gt (session "auth") 2}}
|
|
|
+ var aInput;
|
|
|
+ $(cell).click(function () {
|
|
|
+ if(cellData!=4&&cellData!=7&&cellData!=8&&cellData!=9&&cellData!=10){
|
|
|
+ return
|
|
|
+ }
|
|
|
+ $(this).html(createComboxState(rowData._id));
|
|
|
+ var aInput = $(this).find(":input");
|
|
|
+ aInput.focus().val(cellData);
|
|
|
+ });
|
|
|
+ $(cell).on("click", ":input", function (e) {
|
|
|
+ e.stopPropagation();
|
|
|
+ });
|
|
|
+ $(cell).on("change", ":input", function () {
|
|
|
+ $(this).blur();
|
|
|
+ });
|
|
|
+ $(cell).on("blur", ":input", function () {
|
|
|
+ var text = $(this).find("option:selected").text();
|
|
|
+ if(text=="待完成"){
|
|
|
+ text = 0
|
|
|
+ }else if (text=="已作废"){
|
|
|
+ text = 4
|
|
|
+ }else if (text=="无发布"){
|
|
|
+ text = 7
|
|
|
+ }else if (text=="需登录"){
|
|
|
+ text = 8
|
|
|
+ }else if (text=="无法处理"){
|
|
|
+ text = 9
|
|
|
+ }else if (text=="已删除"){
|
|
|
+ text = 10
|
|
|
+ }else if (text=="已上线"){
|
|
|
+ text = 11
|
|
|
+ }
|
|
|
+ ttable.cell(cell).data(text);
|
|
|
+ cellData = text;
|
|
|
+ });
|
|
|
+ {{end}}
|
|
|
+ }},
|
|
|
+ //更新平台
|
|
|
+ {"targets":[10], createdCell: function (cell, cellData, rowData, rowIndex, colIndex) {
|
|
|
+ {{if gt (session "auth") 2}}
|
|
|
+ var aInput;
|
|
|
+ $(cell).click(function () {
|
|
|
+ $(this).html(createComboxPlatform(rowData.code,rowData._id));
|
|
|
+ var aInput = $(this).find(":input");
|
|
|
+ aInput.focus().val(cellData);
|
|
|
+ });
|
|
|
+ $(cell).on("click", ":input", function (e) {
|
|
|
+ e.stopPropagation();
|
|
|
+ });
|
|
|
+ $(cell).on("change", ":input", function () {
|
|
|
+ $(this).blur();
|
|
|
+ });
|
|
|
+ $(cell).on("blur", ":input", function () {
|
|
|
+ var text = $(this).find("option:selected").text();
|
|
|
+ if(text=="待完成"){
|
|
|
+ text = 0
|
|
|
+ }else if (text=="已作废"){
|
|
|
+ text = 4
|
|
|
+ }else if (text=="无发布"){
|
|
|
+ text = 7
|
|
|
+ }else if (text=="需登录"){
|
|
|
+ text = 8
|
|
|
+ }else if (text=="无法处理"){
|
|
|
+ text = 9
|
|
|
+ }else if (text=="已删除"){
|
|
|
+ text = 10
|
|
|
+ }else if (text=="已上线"){
|
|
|
+ text = 11
|
|
|
+ }
|
|
|
+ ttable.cell(cell).data(text);
|
|
|
+ cellData = text;
|
|
|
+ });
|
|
|
+ {{end}}
|
|
|
+ }},
|
|
|
+ //爬虫挂起
|
|
|
+ {"targets":[11], createdCell: function (cell, cellData, rowData, rowIndex, colIndex) {
|
|
|
+ var aInput;
|
|
|
+ $(cell).click(function () {
|
|
|
+ $(this).html(createComboxPendState(rowData.code));
|
|
|
+ var aInput = $(this).find(":input");
|
|
|
+ aInput.focus().val(cellData);
|
|
|
+ });
|
|
|
+ $(cell).on("click", ":input", function (e) {
|
|
|
+ e.stopPropagation();
|
|
|
+ });
|
|
|
+ $(cell).on("change", ":input", function () {
|
|
|
+ $(this).blur();
|
|
|
+ });
|
|
|
+ $(cell).on("blur", ":input", function () {
|
|
|
+ var text = $(this).find("option:selected").text();
|
|
|
+ if(text == "否"){
|
|
|
+ text = 0
|
|
|
+ }else if(text == "是"){
|
|
|
+ text = 1
|
|
|
+ }
|
|
|
+ ttable.cell(cell).data(text);
|
|
|
+ cellData = text;
|
|
|
+ });
|
|
|
+ }}
|
|
|
+ ],
|
|
|
"order": [[1,"desc"]],
|
|
|
"processing":true,
|
|
|
"serverSide": true,
|
|
@@ -338,6 +364,13 @@ $(function(){
|
|
|
return val
|
|
|
}},
|
|
|
{ "data": "platform"},
|
|
|
+ { "data": "pendstate",render:function(val){
|
|
|
+ if(val == 0){
|
|
|
+ return "否"
|
|
|
+ }else{
|
|
|
+ return "是"
|
|
|
+ }
|
|
|
+ }},
|
|
|
{ "data": "param_common","width":"95px",render:function(val,a,row){
|
|
|
var div=$("<div><div class=\"btn-group\"></div></div>")
|
|
|
var currentuser="{{session "username"}}";
|
|
@@ -508,11 +541,11 @@ $(function(){
|
|
|
$("#spider td input[type=checkbox]").prop("checked",false);
|
|
|
}
|
|
|
}
|
|
|
- function spidercopy(){
|
|
|
- $("#modal-spidercopy").modal("show");
|
|
|
- }
|
|
|
- //复制爬虫
|
|
|
- function comfirm_spidercopy(){
|
|
|
+ function spidercopy(){
|
|
|
+ $("#modal-spidercopy").modal("show");
|
|
|
+ }
|
|
|
+ //复制爬虫
|
|
|
+ function comfirm_spidercopy(){
|
|
|
var code = $("#spidercopy").val();
|
|
|
if(code != ""){
|
|
|
$.ajax({
|
|
@@ -532,7 +565,30 @@ $(function(){
|
|
|
alert("爬虫不能为空!")
|
|
|
}
|
|
|
}
|
|
|
-{{if gt (session "auth") 1}}
|
|
|
+ function createComboxPendState(code){
|
|
|
+ return "<select onchange='changeCodePendState(this.value,\""+code+"\")' class='form-control input-sm'>"+
|
|
|
+ "<option value=1>是</option>"+
|
|
|
+ "<option value=0>否</option>"+
|
|
|
+ "</select>"
|
|
|
+};
|
|
|
+ function changeCodePendState(pendstate,code){
|
|
|
+ $.ajax({
|
|
|
+ url:"/center/spider/updatePendState",
|
|
|
+ type:"post",
|
|
|
+ data:{
|
|
|
+ "pendstate":pendstate,
|
|
|
+ "code":code,
|
|
|
+ "stype":"code"
|
|
|
+ },
|
|
|
+ success:function(r){
|
|
|
+ if(!r || !r.success){
|
|
|
+ showTip("修改失败", 1000, function() {});
|
|
|
+ }
|
|
|
+ ttable.ajax.reload();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+{{if gt (session "auth") 1}}
|
|
|
function refuse(me){
|
|
|
var $r=window.prompt("确定打回?请输入打回原因")
|
|
|
if($r){
|
|
@@ -550,26 +606,7 @@ $(function(){
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- //function disable(me){
|
|
|
- // showConfirm("确定作废?", function() {
|
|
|
- // $.ajax({
|
|
|
- // url:$(me).attr("hrefs"),
|
|
|
- // type:"post",
|
|
|
- // success:function(r){
|
|
|
- // if(r){
|
|
|
- // //showTip("作废成功", 1000, function() {});
|
|
|
- // ttable.ajax.reload(null,false);
|
|
|
- // }else{
|
|
|
- /// showTip("作废失败", 1000, function() {});
|
|
|
- // }
|
|
|
- // }
|
|
|
- // })
|
|
|
- // });
|
|
|
- //}
|
|
|
-
|
|
|
-
|
|
|
+ }
|
|
|
function assign(){
|
|
|
var names=[];
|
|
|
$("#spider td input[type=checkbox]").each(function(){
|
|
@@ -666,7 +703,7 @@ $(function(){
|
|
|
function disables_cancel(){
|
|
|
$("#modal-disables").modal("hide");
|
|
|
}
|
|
|
- function spidercopy_cancel(){
|
|
|
+ function spidercopy_cancel(){
|
|
|
$("#modal-spidercopy").modal("hide");
|
|
|
}
|
|
|
//分配爬虫
|
|
@@ -707,16 +744,16 @@ $(function(){
|
|
|
return;
|
|
|
}
|
|
|
};
|
|
|
- //修改节点
|
|
|
- function createComboxEvent(id,state,code){
|
|
|
- var events={{.T.events}};
|
|
|
- var spiderEvent="";
|
|
|
+ //修改节点
|
|
|
+ function createComboxEvent(id,state,code){
|
|
|
+ var events={{.T.events}};
|
|
|
+ var spiderEvent="";
|
|
|
for(k in events){
|
|
|
spiderEvent+="<option value='"+events[k]+"'>"+events[k]+"</option>"
|
|
|
}
|
|
|
- return "<select onchange='changeEventOrStateOrPlatform(this.value,\"event\",\""+state+"\",\""+code+"\",\""+id+"\")' class='form-control input-sm'>"+spiderEvent+"</select>"
|
|
|
- };
|
|
|
- function createComboxState(id){
|
|
|
+ return "<select onchange='changeEventOrStateOrPlatform(this.value,\"event\",\""+state+"\",\""+code+"\",\""+id+"\")' class='form-control input-sm'>"+spiderEvent+"</select>"
|
|
|
+ };
|
|
|
+ function createComboxState(id){
|
|
|
return "<select id='task_state' onchange='changeEventOrStateOrPlatform(this.value,\"state\",\"\",\"\",\""+id+"\")' class='form-control input-sm'>"+
|
|
|
"<option value='0' class='text-info text-bold'>待完成</option>"+
|
|
|
"<option disabled value='1'>待审核</option>"+
|
|
@@ -732,16 +769,16 @@ $(function(){
|
|
|
"<option disabled value='10'>已上线</option>"+
|
|
|
+"</select>"
|
|
|
};
|
|
|
- function createComboxPlatform(code,id){
|
|
|
- return "<select onchange='changeEventOrStateOrPlatform(this.value,\"platform\",\"\",\""+code+"\",\""+id+"\")' class='form-control input-sm'>"+
|
|
|
+ function createComboxPlatform(code,id){
|
|
|
+ return "<select onchange='changeEventOrStateOrPlatform(this.value,\"platform\",\"\",\""+code+"\",\""+id+"\")' class='form-control input-sm'>"+
|
|
|
"<option value='golua平台'>golua平台</option>"+
|
|
|
"<option value='python'>python</option>"+
|
|
|
"<option value='通用爬虫'>通用爬虫</option>"+
|
|
|
"<option value='chrome插件'>chrome插件</option>"+
|
|
|
"</select>"
|
|
|
};
|
|
|
- function changeEventOrStateOrPlatform(val,w,s,c,id){
|
|
|
- $.ajax({
|
|
|
+ function changeEventOrStateOrPlatform(val,w,s,c,id){
|
|
|
+ $.ajax({
|
|
|
url:"/center/spider/updateesp",
|
|
|
type:"post",
|
|
|
data:{
|
|
@@ -751,7 +788,7 @@ $(function(){
|
|
|
"s":s,
|
|
|
"c":c
|
|
|
},
|
|
|
- success:function(r){
|
|
|
+ success:function(r){
|
|
|
if(r=="n"){
|
|
|
showTip("修改失败", 1000, function() {});
|
|
|
}
|