|
@@ -187,6 +187,7 @@
|
|
|
|
|
|
<script>
|
|
<script>
|
|
var first=1;
|
|
var first=1;
|
|
|
|
+var user = {};
|
|
$(function(){
|
|
$(function(){
|
|
ttable=$('#spider').DataTable({
|
|
ttable=$('#spider').DataTable({
|
|
"language": {
|
|
"language": {
|
|
@@ -332,7 +333,7 @@ $(function(){
|
|
},
|
|
},
|
|
"columns": [
|
|
"columns": [
|
|
{ "data": "_id",render:function(val,a,row){
|
|
{ "data": "_id",render:function(val,a,row){
|
|
- return "<input type='checkbox' scope='"+row.i_scope+"' value='"+val+"' name='"+row.param_common[1]+"_"+row.param_common[2]+"' code='"+row.param_common[0]+"'/>"
|
|
|
|
|
|
+ return "<input type='checkbox' platform='"+row.platform+"' scope='"+row.i_scope+"' value='"+val+"' name='"+row.param_common[1]+"_"+row.param_common[2]+"' code='"+row.param_common[0]+"'/>"
|
|
}},
|
|
}},
|
|
{ "data": "_id",render:function(val,a,row){
|
|
{ "data": "_id",render:function(val,a,row){
|
|
return row.num
|
|
return row.num
|
|
@@ -611,6 +612,10 @@ $(function(){
|
|
function comfirm_spidercopy(){
|
|
function comfirm_spidercopy(){
|
|
var code = $("#spidercopy").val();
|
|
var code = $("#spidercopy").val();
|
|
if(code != ""){
|
|
if(code != ""){
|
|
|
|
+ if(code.indexOf("_bu") != -1 ){
|
|
|
|
+ alert("该爬虫不可复制!")
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
$.ajax({
|
|
$.ajax({
|
|
url:"/center/spider/copy",
|
|
url:"/center/spider/copy",
|
|
type:"post",
|
|
type:"post",
|
|
@@ -674,12 +679,14 @@ $(function(){
|
|
function assign(){
|
|
function assign(){
|
|
var names=[];
|
|
var names=[];
|
|
$("#spider td input[type=checkbox]").each(function(){
|
|
$("#spider td input[type=checkbox]").each(function(){
|
|
- console.log($(this).attr('scope'))
|
|
|
|
- if ($(this).attr('scope') == '1'){//禁止分配的爬虫
|
|
|
|
- $(this).prop("checked",false);
|
|
|
|
- }else if($(this).prop("checked")){
|
|
|
|
|
|
+ if($(this).prop("checked")){
|
|
names.push($(this).attr("name"));
|
|
names.push($(this).attr("name"));
|
|
}
|
|
}
|
|
|
|
+ // if ($(this).attr('scope') == '1'){//禁止分配的爬虫
|
|
|
|
+ // $(this).prop("checked",false);
|
|
|
|
+ // }else if($(this).prop("checked")){
|
|
|
|
+ // names.push($(this).attr("name"));
|
|
|
|
+ // }
|
|
});
|
|
});
|
|
if(names.length>0){
|
|
if(names.length>0){
|
|
$("#modal-assign .list-group").empty();
|
|
$("#modal-assign .list-group").empty();
|
|
@@ -754,13 +761,17 @@ $(function(){
|
|
showTip("没有选择项", 1000, function() {});
|
|
showTip("没有选择项", 1000, function() {});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ //查找开发人员
|
|
function searchAssignModify(){
|
|
function searchAssignModify(){
|
|
$.post("/center/searchMintainer",function(r){
|
|
$.post("/center/searchMintainer",function(r){
|
|
var data = r.mintainer;
|
|
var data = r.mintainer;
|
|
$("#assign-modify").empty();
|
|
$("#assign-modify").empty();
|
|
$("#assign-modify").append("<option value=''>--请选择--</option>");
|
|
$("#assign-modify").append("<option value=''>--请选择--</option>");
|
|
for(var i in data){
|
|
for(var i in data){
|
|
- $("#assign-modify").append("<option value='"+data[i]["_id"]+"'>"+data[i]["s_email"]+"</option>");
|
|
|
|
|
|
+ var email = data[i]["s_email"];
|
|
|
|
+ var uid = data[i]["_id"];
|
|
|
|
+ user[uid] = data[i]["s_platform"];
|
|
|
|
+ $("#assign-modify").append("<option value='"+uid+"'>"+email+"</option>");
|
|
}
|
|
}
|
|
})
|
|
})
|
|
}
|
|
}
|
|
@@ -770,9 +781,6 @@ $(function(){
|
|
function disables_cancel(){
|
|
function disables_cancel(){
|
|
$("#modal-disables").modal("hide");
|
|
$("#modal-disables").modal("hide");
|
|
}
|
|
}
|
|
- function spidercopy_cancel(){
|
|
|
|
- $("#modal-spidercopy").modal("hide");
|
|
|
|
- }
|
|
|
|
function nopublish_cancel(){
|
|
function nopublish_cancel(){
|
|
$("#modal-nopublish").modal("hide");
|
|
$("#modal-nopublish").modal("hide");
|
|
}
|
|
}
|
|
@@ -780,36 +788,54 @@ $(function(){
|
|
function assign_save(){
|
|
function assign_save(){
|
|
$("#modal-assign").modal("hide");
|
|
$("#modal-assign").modal("hide");
|
|
var userid = $("#assign-modify").val();
|
|
var userid = $("#assign-modify").val();
|
|
|
|
+ var userPlatform = user[userid];//被分配人员所属平台
|
|
if(userid != ""){
|
|
if(userid != ""){
|
|
- var codes=[];
|
|
|
|
|
|
+ var codes = [];
|
|
|
|
+ var nocodes = [];
|
|
$("#spider td input[type=checkbox]").each(function(){
|
|
$("#spider td input[type=checkbox]").each(function(){
|
|
if($(this).prop("checked")){
|
|
if($(this).prop("checked")){
|
|
- codes.push($(this).attr("code"));
|
|
|
|
|
|
+ var codePlatform = $(this).attr("platform");//被分配爬虫所属平台
|
|
|
|
+ var userScope = $(this).attr("scope");//被分配爬虫所属平台
|
|
|
|
+ console.log(userPlatform,codePlatform,userScope)
|
|
|
|
+ //lua平台除外包人员外,内部不可分配爬虫
|
|
|
|
+ if (codePlatform == "golua平台" && userPlatform == "golua平台" && userScope == '1'){
|
|
|
|
+ nocodes.push($(this).attr("code"));
|
|
|
|
+ }else{
|
|
|
|
+ codes.push($(this).attr("code"));
|
|
|
|
+ }
|
|
//ids.push($(this).val());
|
|
//ids.push($(this).val());
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
+ if(codes.length == 0){
|
|
|
|
+ showTip("所选爬虫不可重新分配!", 2000, function() {});
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (nocodes.length != 0){
|
|
|
|
+ showTip("含有不可分配爬虫:"+nocodes.join(";"), 5000, function() {});
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
$.ajax({
|
|
$.ajax({
|
|
- url:"/center/user/assign",
|
|
|
|
- type:"post",
|
|
|
|
- data:{
|
|
|
|
- "codes":codes.join(","),
|
|
|
|
- "userid":userid
|
|
|
|
- },
|
|
|
|
- success:function(r){
|
|
|
|
- if(r=="y"){
|
|
|
|
- showTip("分配成功", 500, function() {});
|
|
|
|
- $("#selrow").prop('checked',false);
|
|
|
|
- $('#com-alert').on('hidden.bs.modal', function () {
|
|
|
|
- ttable.ajax.reload();
|
|
|
|
- })
|
|
|
|
- }else if(r=="n"){
|
|
|
|
- showTip("分配失败", 1000, function() {});
|
|
|
|
- }else if(r=="null"){
|
|
|
|
- showTip("没有该用户,请重新输入", 1000, function() {});
|
|
|
|
- assign();
|
|
|
|
- }
|
|
|
|
|
|
+ url:"/center/user/assign",
|
|
|
|
+ type:"post",
|
|
|
|
+ data:{
|
|
|
|
+ "codes":codes.join(","),
|
|
|
|
+ "userid":userid
|
|
|
|
+ },
|
|
|
|
+ success:function(r){
|
|
|
|
+ if(r=="y"){
|
|
|
|
+ showTip("分配成功", 500, function() {});
|
|
|
|
+ $("#selrow").prop('checked',false);
|
|
|
|
+ $('#com-alert').on('hidden.bs.modal', function () {
|
|
|
|
+ ttable.ajax.reload();
|
|
|
|
+ })
|
|
|
|
+ }else if(r=="n"){
|
|
|
|
+ showTip("分配失败", 1000, function() {});
|
|
|
|
+ }else if(r=="null"){
|
|
|
|
+ showTip("没有该用户,请重新输入", 1000, function() {});
|
|
|
|
+ assign();
|
|
}
|
|
}
|
|
- })
|
|
|
|
|
|
+ }
|
|
|
|
+ })
|
|
}else{
|
|
}else{
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -866,7 +892,10 @@ $(function(){
|
|
}
|
|
}
|
|
})
|
|
})
|
|
}
|
|
}
|
|
-{{end}}
|
|
|
|
|
|
+{{end}}
|
|
|
|
+function spidercopy_cancel(){
|
|
|
|
+ $("#modal-spidercopy").modal("hide");
|
|
|
|
+}
|
|
</script>
|
|
</script>
|
|
</div>
|
|
</div>
|
|
{{include "bottom.html"}}
|
|
{{include "bottom.html"}}
|