Bläddra i källkod

新版任务修改

maxiaoshan 1 år sedan
förälder
incheckning
ff12b2d006

+ 2 - 13
src/front/front.go

@@ -92,20 +92,8 @@ var AutoTpl map[string]interface{}
 var Mails *util.Mail
 var Reg = regexp.MustCompile(`(http|https)://([\w]+\.)+[\w]+`)
 var ListFilterReg = regexp.MustCompile("关键词过滤")
+var ProjectHrefReg = regexp.MustCompile("projecthref")
 var Transfercode map[string]interface{}
-var LuaStateMap = map[int]string{
-	0:  "待完成",
-	1:  "待审核",
-	2:  "未通过",
-	3:  "已通过",
-	4:  "已作废",
-	5:  "已上架",
-	6:  "已下架",
-	7:  "无发布",
-	8:  "需登录",
-	9:  "转python",
-	10: "已删除",
-}
 
 func (f *Front) Login() error {
 	username := f.GetString("username")
@@ -1018,6 +1006,7 @@ func (f *Front) UpdateESP() {
 		set["state"] = 0
 		set["event"] = 7000
 		set["spidertype"] = "history"
+		go ModifyLogs_UpdateCodeState(code)
 		//更新、新建任务
 		//task, _ := u.MgoEB.FindOne("task", map[string]interface{}{"s_code": code, "i_state": map[string]interface{}{"$in": []int{0, 1, 2, 3, 5}}})
 		//text := "指定追加描述:------------------------------\n无发布转待完成\n"

+ 49 - 0
src/front/log.go

@@ -0,0 +1,49 @@
+package front
+
+import (
+	qu "qfw/util"
+	"time"
+	"util"
+)
+
+//无效爬虫改为待完成爬虫,更新历史爬虫状态
+func ModifyLogs_UpdateCodeState(code string) {
+	defer qu.Catch()
+	query := map[string]interface{}{"code": code}
+	set := map[string]interface{}{"$set": map[string]interface{}{"new_state": -1, "updatetime": time.Now().Unix()}}
+	util.MgoEB.Update("luaconfig_modify_logs", query, set, false, false)
+}
+
+//爬虫上架记录当前爬虫信息
+func ModifyLogs_SaveCodeLogs(code string, lua map[string]interface{}) {
+	defer qu.Catch()
+	site := qu.ObjToString(lua["site"])
+	user := qu.ObjToString(lua["modifyuser"])
+	query := map[string]interface{}{"code": code}
+	upset := map[string]interface{}{}
+	tmp, _ := util.MgoEB.FindOne("luaconfig_modify_logs", query)
+	if len(*tmp) == 0 { //新爬虫首次上架
+		upset = map[string]interface{}{
+			"code":            code,
+			"site":            lua["site"],
+			"user":            lua["modifyuser"],
+			"new_content":     lua,
+			"history_content": map[string]interface{}{},
+			"new_state":       5,
+			"history_state":   5,
+			"updatetime":      time.Now().Unix(),
+		}
+
+	} else { //历史爬虫维护上架
+		upset = map[string]interface{}{
+			"site":            site,
+			"user":            user,
+			"new_content":     lua,
+			"history_content": (*tmp)["new_content"],
+			"new_state":       5,
+			"history_state":   (*tmp)["new_state"],
+			"updatetime":      time.Now().Unix(),
+		}
+	}
+	util.MgoEB.Update("luaconfig_modify_logs", query, map[string]interface{}{"$set": upset}, true, false)
+}

+ 5 - 3
src/front/spider.go

@@ -455,6 +455,7 @@ func (f *Front) SaveStep() {
 			param["iscopycontent"] = f.StepRe3.Checked
 			//
 			param["listisfilter"] = ListFilterReg.MatchString(f.Step2.Expert) //列表页校验是否含“--关键词过滤”
+			param["projecthref"] = ProjectHrefReg.MatchString(f.Step2.Expert) || ProjectHrefReg.MatchString(f.Step3.Expert)
 			checkLua := LuaTextCheck(infoformat, param, param_list_chrome, param_list_rangechrome, param_content_chrome, msgResult)
 			//checkLua := LuaTextCheck(f.Base.SpiderCode, f.Step2.Expert, f.Step3.Expert, f.Step2.Types, infoformat, model, msgResult)
 			if !checkLua {
@@ -702,13 +703,13 @@ func LuaTextCheck(infoformat int, param map[string]interface{}, param_list_chrom
 		city := qu.ObjToString(model["city"])
 		district := qu.ObjToString(model["district"])
 		if area != "" && !strings.Contains(list, area) {
-			errmsg += "省份信息与模板不一致;"
+			warnmsg += "省份信息与模板不一致;"
 		}
 		if city != "" && !strings.Contains(list, city) {
-			errmsg += "城市信息与模板不一致;"
+			warnmsg += "城市信息与模板不一致;"
 		}
 		if district != "" && !strings.Contains(list, district) {
-			errmsg += "区/县信息与模板不一致;"
+			warnmsg += "区/县信息与模板不一致;"
 		}
 		if infoformat == 2 && !strings.Contains(detail, "projectname") {
 			errmsg += "拟建/审批数据缺少projectname字段;"
@@ -1504,6 +1505,7 @@ func UpStateAndUpSpider(code, id, reason, username string, state int) (bool, err
 				} else if state == Sp_state_5 { //上架,核对时间重置
 					upset["l_checktime"] = 0
 					LuaSaveLog(code, username, one, 1)
+					go ModifyLogs_SaveCodeLogs(code, *one)
 				} else if state == Sp_state_4 { //作废,作废原因
 					upset["disablereason"] = reason
 					//upset["modifytime"] = time.Now().Unix()

+ 1 - 1
src/front/spider2.go

@@ -27,7 +27,7 @@ func (f *Front) TagCode() {
 	*/
 	update = map[string]interface{}{
 		"$set": map[string]interface{}{
-			"tasktags." + stype: time.Now().Unix(),
+			"codetags." + stype: time.Now().Unix(),
 		},
 	}
 	util.MgoEB.Update("luaconfig", map[string]interface{}{"code": code}, update, false, false)

+ 11 - 111
src/taskManager/taskManager.go

@@ -161,10 +161,10 @@ func (t *TaskM) Taskfile() {
 
 func (t *TaskM) ManagerTask() {
 	auth := qu.IntAll(t.GetSession("auth"))
-	urgency, _ := t.GetInteger("state")       //紧急程度
 	taskState, _ := t.GetInteger("taskState") //任务状态
 	event, _ := t.GetInteger("taskEvent")     //节点
 	stype, _ := t.GetInteger("taskStype")     //任务类型
+	platform := t.GetString("platform")       //平台
 	userid := t.GetString("userid")
 	searchStr := t.GetString("search[value]")
 	//search := strings.Replace(searchStr, " ", "", -1)
@@ -183,7 +183,7 @@ func (t *TaskM) ManagerTask() {
 			t.T["modifyusers"] = GetModifyUsers()
 			t.Render("task.html", &t.T)
 		} else {
-			query := queryCriteria(userid, urgency, taskState, event, stype)
+			query := queryCriteria(userid, platform, taskState, event, stype)
 			if search != "" {
 				query["$or"] = []interface{}{
 					map[string]interface{}{"s_code": map[string]interface{}{"$regex": search}},
@@ -214,45 +214,13 @@ func (t *TaskM) ManagerTask() {
 				for k, v := range *task {
 					v["num"] = k + 1 + page*10
 					v["encode"] = util.Se.Encode2Hex(fmt.Sprint(v["s_code"]))
-					s_urgency := qu.IntAll(v["s_urgency"])
-					if s_urgency == 1 {
-						v["s_urgency"] = "普通"
-					} else if s_urgency == 2 {
-						v["s_urgency"] = "紧急"
-					} else if s_urgency == 3 {
-						v["s_urgency"] = "非常紧急"
-					} else if s_urgency == 4 {
-						v["s_urgency"] = "特别紧急"
-					}
-					state := qu.IntAll(v["i_state"])
-					if state == 0 {
-						v["i_state"] = "待确认"
-					} else if state == 1 {
-						v["i_state"] = "待处理"
-					} else if state == 2 {
-						v["i_state"] = "处理中"
-					} else if state == 3 {
-						v["i_state"] = "待审核"
-					} else if state == 4 {
-						v["i_state"] = "审核通过"
-					} else if state == 5 {
-						v["i_state"] = "未通过"
-					} else if state == 6 {
-						v["i_state"] = "关闭"
-					}
-					if v["i_event"] == nil { //节点
-						v["i_event"] = 0
-					}
-					l_complete := qu.Int64All(v["l_complete"])
-					v["l_complete"] = qu.FormatDateByInt64(&l_complete, qu.Date_Full_Layout)
-					//v["l_complete"] = time.Unix(v["l_complete"].(int64), 0).Format("2006-01-02 15:04:05")
 					v["_id"] = mongodb.BsonIdToSId(v["_id"])
 					//根据code查询luaconfig
-					param := findLua(v["s_code"].(string))
-					if len(param) < 13 || param == nil {
-						v["href"] = "javascript:void(0)"
+					lua, _ := u.MgoEB.FindOneByField("luaconfig", map[string]interface{}{"code": qu.ObjToString(v["s_code"])}, `{"href":1}`)
+					if len(*lua) > 0 {
+						v["href"] = (*lua)["href"]
 					} else {
-						v["href"] = param[11]
+						v["href"] = "javascript:void(0)"
 					}
 				}
 			}
@@ -284,15 +252,15 @@ func (t *TaskM) Mytask() {
 		limit, _ := t.GetInteger("length")
 		draw, _ := t.GetInteger("draw")
 		//state, _ := t.GetInteger("state")
-		urgency, _ := t.GetInteger("state")
 		taskState, _ := t.GetInteger("taskState")
+		platform := t.GetString("platform")   //平台
 		stype, _ := t.GetInteger("taskStype") //任务类型
 		event, _ := t.GetInteger("taskEvent") //节点
 		searchStr := t.GetString("search[value]")
 		//search := strings.Replace(searchStr, " ", "", -1)
 		search := strings.TrimSpace(searchStr)
 		//查询自己的任务
-		query = queryCriteria(userid, urgency, taskState, event, stype)
+		query = queryCriteria(userid, platform, taskState, event, stype)
 		if search != "" {
 			query["$or"] = []interface{}{
 				map[string]interface{}{"s_code": map[string]interface{}{"$regex": search}},
@@ -326,37 +294,6 @@ func (t *TaskM) Mytask() {
 				}
 				v["relatecode"] = relatecode
 				v["encode"] = util.Se.Encode2Hex(code)
-				urgency := qu.ObjToString(v["s_urgency"])
-				if urgency == "1" {
-					v["s_urgency"] = "普通"
-				} else if urgency == "2" {
-					v["s_urgency"] = "紧急"
-				} else if urgency == "3" {
-					v["s_urgency"] = "非常紧急"
-				} else if urgency == "4" {
-					v["s_urgency"] = "特别紧急"
-				}
-				state := qu.IntAll(v["i_state"])
-				if state == 0 {
-					v["i_state"] = "待确认"
-				} else if state == 1 {
-					v["i_state"] = "待处理"
-				} else if state == 2 {
-					v["i_state"] = "处理中"
-				} else if state == 3 {
-					v["i_state"] = "待审核"
-				} else if state == 4 {
-					v["i_state"] = "审核通过"
-				} else if state == 5 {
-					v["i_state"] = "未通过"
-				} else if state == 6 {
-					v["i_state"] = "关闭"
-				}
-				if v["i_event"] == nil { //节点
-					v["i_event"] = 0
-				}
-
-				v["l_complete"] = time.Unix(v["l_complete"].(int64), 0).Format("2006-01-02 15:04:05")
 				v["_id"] = mongodb.BsonIdToSId(v["_id"])
 			}
 		}
@@ -1067,13 +1004,13 @@ func updateClose(code string) {
 		fmt.Println("closerate关闭任务:code	", flag)
 	}
 }
-func queryCriteria(userid string, urgency, taskState, event, stype int) (query map[string]interface{}) {
+func queryCriteria(userid, platform string, taskState, event, stype int) (query map[string]interface{}) {
 	query = map[string]interface{}{}
 	if userid != "" && userid != "-1" {
 		query["s_modifyid"] = userid
 	}
-	if urgency >= 0 {
-		query["s_urgency"] = strconv.Itoa(urgency)
+	if platform != "" && platform != "-1" {
+		query["s_platform"] = platform
 	}
 	if taskState >= 0 {
 		query["i_state"] = taskState
@@ -1084,43 +1021,6 @@ func queryCriteria(userid string, urgency, taskState, event, stype int) (query m
 	if stype >= 0 {
 		query["s_type"] = strconv.Itoa(stype)
 	}
-
-	// if urgency >= 0 && taskState >= 0 && event >= 0 { //选择节点,状态和紧急度
-	// 	query = map[string]interface{}{
-	// 		"s_urgency": strconv.Itoa(urgency),
-	// 		"i_state":   taskState,
-	// 		"i_event":   event,
-	// 	}
-	// } else if event >= 0 && urgency < 0 && taskState >= 0 { //选择节点和状态,未选择紧急度
-	// 	query = map[string]interface{}{
-	// 		"i_state": taskState,
-	// 		"i_event": event,
-	// 	}
-	// } else if event >= 0 && urgency >= 0 && taskState < 0 { //选择节点和紧急度,未选择状态
-	// 	query = map[string]interface{}{
-	// 		"i_event":   event,
-	// 		"s_urgency": strconv.Itoa(urgency),
-	// 	}
-	// } else if event >= 0 && urgency < 0 && taskState < 0 { //选择节点,未选择紧急度和状态
-	// 	query = map[string]interface{}{
-	// 		"i_event": event,
-	// 	}
-	// } else if event < 0 && urgency >= 0 && taskState >= 0 { //未选择节点,选择紧急度和状态
-	// 	query = map[string]interface{}{
-	// 		"s_urgency": strconv.Itoa(urgency),
-	// 		"i_state":   taskState,
-	// 	}
-	// } else if event < 0 && urgency < 0 && taskState >= 0 { //未选择节点和紧急度,选择状态
-	// 	query = map[string]interface{}{
-	// 		"i_state": taskState,
-	// 	}
-	// } else if event < 0 && urgency >= 0 && taskState < 0 { //未选择节点和状态,选择紧急度
-	// 	query = map[string]interface{}{
-	// 		"s_urgency": strconv.Itoa(urgency),
-	// 	}
-	// } else {
-	// 	query = make(map[string]interface{})
-	// }
 	return
 }
 

+ 1 - 1
src/vpsconfig.json

@@ -12,7 +12,7 @@
             "2": "lt-2zebxi1ablpl9e277bsd",
             "4": "lt-2ze5ir54gy4ui8okr71f",
             "8": "lt-2ze5hgfe53yoav19ndid",
-            "120": "lt-2ze5fzxwgt8jcqczvmjy"
+            "12": "lt-2ze5fzxwgt8jcqczvmjy"
           }
         }
       }

+ 5 - 5
src/web/staticres/js/common.js

@@ -436,7 +436,7 @@ common.spider.setModel=function(name,p){
 			var label=$("<label class='col-sm-4 control-label'>"+model[k]+"</label>");
 			var c_div=$("<div class='col-md-7'></div>");
 			if(model[k]=="省份"){
-				var select=$("<select class='form-control' disabled onchange='getcity($(this).val())'></select>")
+				var select=$("<select class='form-control' onchange='getcity($(this).val())'></select>")
 				select.attr("name",k);
 				select.attr("id",k);
 				for(var i in common.spider.json){
@@ -448,16 +448,16 @@ common.spider.setModel=function(name,p){
 				}
 				modelbody.append(div.append(label).append(c_div.append(select)));
 			}else if(model[k]=="城市"){
-				var select=$("<select class='form-control' disabled onchange='cleardistrict()'></select>")
+				var select=$("<select class='form-control' onchange='cleardistrict()'></select>")
 				select.attr("name",k);
 				select.attr("id",k);
 				modelbody.append(div.append(label).append(c_div.append(select)));
 			}else{
 				var input=$("<input type='text'  class='form-control'/>");
 				input.attr("name",k);
-				if(k == "district"){
-					input.attr("disabled",true);
-				}
+				// if(k == "district"){
+				// 	input.attr("disabled",true);
+				// }
 				input.attr("id",k);
 				input.attr("placeholder",model[k]);
 				modelbody.append(div.append(label).append(c_div.append(input)));

+ 100 - 106
src/web/templates/mytask.html

@@ -21,12 +21,12 @@
 								<th>节点</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>
@@ -48,37 +48,37 @@
 				
        		 },
 			"columnDefs": [
-			    { "orderable": false, "targets": [0,1,2,3,4,5,12] },
+			    { "orderable": false, "targets": [0,1,2,3,4,5,9] },
 				//爬虫挂起
-				{"targets":[11], createdCell: function (cell, cellData, rowData, rowIndex, colIndex) {
-						var aInput;
-						$(cell).click(function () {
-							if( rowData.i_state == "关闭"||rowData.i_pendstate ==1 ){//任务不能由挂起转为非挂起状态;关闭任务不能挂起操作
-								return
-							}
-							$(this).html(createComboxPendState(rowData.s_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 = 1
-							}
-							mytask.cell(cell).data(text);
-							cellData = text;
-						});
-					}}
+				// {"targets":[11], createdCell: function (cell, cellData, rowData, rowIndex, colIndex) {
+				// 		var aInput;
+				// 		$(cell).click(function () {
+				// 			if( rowData.i_state == "关闭"||rowData.i_pendstate ==1 ){//任务不能由挂起转为非挂起状态;关闭任务不能挂起操作
+				// 				return
+				// 			}
+				// 			$(this).html(createComboxPendState(rowData.s_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 = 1
+				// 			}
+				// 			mytask.cell(cell).data(text);
+				// 			cellData = text;
+				// 		});
+				// 	}}
 			],	
-      		"order": [[10,"desc"]], //默认排序列
+      		"order": [[8,"desc"]], //默认排序列
 			"lengthChange":false,
 			"serverSide": true,
 			"searching": true,
@@ -90,50 +90,48 @@
 	      		{"data": "s_site"},
 				{"data": "s_channel"},
 				{"data": "i_event"},
-				{"data": "i_state"},
-				{"data": "s_type",render:function(val,a,row){
-				  if(val== "8"){
-					val="采集频率异常"
-				  }else if(val=="7"){
-					val="列表页异常"
-				  }else if(val=="6"){
-					val="附件异常"
-				  }else if(val=="5"){
-					val="下载异常"
-				  }else if(val=="4"){
-					val="运行异常"
-				  }else if(val=="3"){
-					val="时间异常"
-				  }else if(val=="2"){
-					val="数据异常"
-				  }else if(val=="1"){
-					val="数量异常"
-				  }else if (val=="10"){
-					val="抽查任务"
-				  }else if(val=="0"){
-					val="常规任务"
-				  }else{
-					val="历史任务"
-				  }
-				  return val
-				}},
-				{"data": "s_urgency"},
+				{"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=="3"){
+							val="爬虫翻页异常"
+						}else if(val=="4"){
+							val="采集频率异常"
+						}else if(val=="5"){
+							val="下载异常"
+						}else if(val=="6"){
+							val="数据异常警告"
+						}else if(val=="0"){
+							val="常规任务"
+						}
+						return val;
+					}},
 				{"data": "i_times"},
-				{"data": "i_frequencyerrtimes","width":"28px",render:function(val,a,row){
-					if(val == undefined){
-						return 0;
-					}
-					return val;
-				}},
 				{"data": "s_source"},
-				{"data":"l_complete"},
-				{ "data": "i_pendstate",render:function(val){
-					if(val == 0||val == undefined){
-						return "否"
-					}else{
-						return "是"
-					}
-				}},
+				{"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",render:function(val,a,row){
 					var div=$("<div><div class=\"btn-group\"></div></div>")
 					var dbutton=$('<a type="button" href="#" class="btn btn-sm btn-default" onclick="viewtask(\''+row._id+'\',\''+row.relatecode+'\');">查看</a>');
@@ -158,15 +156,10 @@
 			    });    
 			},
 			"fnServerParams": function (e) {  
-				var state=$("#task_urgency").val();
 				var taskState = $("#task_state").val();
 				var taskEvent = $("#task_event").val();
         		var taskStype = $("#task_stype").val();
-				if(state){
-					e.state=state;
-				}else{
-					e.state="-1";
-				}
+				var platform = $("#platform").val();
 				if(taskState){
 					e.taskState = taskState;
 				}else{
@@ -184,6 +177,12 @@
 				}else{
 					e.taskStype="-1";
 				}
+				//平台
+				if(platform){
+					e.platform = platform;
+				}else{
+					e.platform="-1";
+				}
       }
 	  });
 		mytask.on('init.dt', function () {
@@ -191,18 +190,6 @@
 			if(search){
 				$("[type=search]").val(search);
 			}
-			var opt="<option value='-1'>全部</option>"+
-				"<option value='1'>普通</option>"+
-				"<option value='2'>紧急</option>"+
-				"<option value='3'>非常紧急</option>"+
-				"<option value='4'>特别紧急</option>";
-				var select="<div class='form-group'><label for='name'>紧急程度:</label>"+
-				"<select id='task_urgency' onchange='checkclick(this.value)' class='form-control input-sm'>"+
-				opt+
-				"</select></div>"
-				$("#mytask_filter").prepend("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
-				$("#mytask_filter").prepend(select);
-			
 			var taskState="<option value='-1'>全部</option>"+
 				"<option value='0'>待确认</option>"+
 				"<option value='1'>待处理</option>"+
@@ -218,22 +205,18 @@
 				"</select></div>"
 				$("#mytask_filter").prepend("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
 				$("#mytask_filter").prepend(selectState);
-			
-      		var taskStype="<option value='-1'>全部</option>"+
-				"<option value='8'>采集频率异常</option>"+
-        		"<option value='7'>列表页异常</option>"+
-				"<option value='6'>附件异常</option>"+
-				"<option value='5'>下载异常</option>"+
-				"<option value='4'>运行异常</option>"+
-				"<option value='3'>时间异常</option>"+
-				"<option value='2'>数据异常</option>"+
-				"<option value='1'>数量异常</option>"+
-				"<option value='10'>抽查任务</option>"+
-				"<option value='0'>常规任务</option>";
+			var taskStype="<option value='-1'>全部</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>"+
+					"<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'>"+
+					"<select id='task_stype' onchange='checkclick(this.value)' class='form-control input-sm'>"+
 					taskStype+
-				"</select></div>"
+					"</select></div>"
 				$("#mytask_filter").prepend("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
 				$("#mytask_filter").prepend(selectStype);
       	
@@ -248,6 +231,17 @@
 				"</select></div>"
 				$("#mytask_filter").prepend("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
 				$("#mytask_filter").prepend(selectEvent);
+			//平台
+			var platform="<option value='-1'>全部</option>"
+			platform+="<option value='golua平台'>golua平台</option>";
+			platform+="<option value='chrome'>chrome</option>";
+			platform+="<option value='python'>python</option>";
+			var selectPlatform="<div class='form-group'><label for='name'>平台:</label>"+
+					"<select id='platform' onchange='checkclick(this.value)' class='form-control input-sm'>"+
+					platform+
+					"</select></div>"
+			$("#mytask_filter").prepend("&nbsp;&nbsp;");
+			$("#mytask_filter").prepend(selectPlatform);
 			//修改样式
 			$("#mytask_wrapper .col-sm-6").css({width:"100%"});
 		});

+ 3 - 3
src/web/templates/spiderbase.html

@@ -363,9 +363,9 @@
 									var event = events[k];
 									var endtext = " value="+event+">"+event+"</option>";
 									var midtext = "";
-									if(event == 7000){
-										midtext = midtext +" disabled style='color:#DADADA'";
-									}
+									// if(event == 7000){
+									// 	midtext = midtext +" disabled style='color:#DADADA'";
+									// }
 									if ({{.T.spidertype}} == "increment" && event == {{.T.lua.event}}) {//增量爬虫展示event
 										midtext = midtext + " selected";
 									} else if({{.T.spidertype}} == "history" && event == {{.T.lua.incrementevent}}){//历史展示incrementevent

+ 122 - 153
src/web/templates/task.html

@@ -72,13 +72,13 @@
 								<th>状态</th>
                					<th>类型</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>
@@ -114,43 +114,43 @@
        		 },
 			"columnDefs": [
 				{ "targets": 0 ,"bVisible": false}, //隐藏列
-				{ "orderable": false, "targets": [0,1,2,3,4,5,6,7,8,16] }, //设置列不可排序
+				{ "orderable": false, "targets": [0,1,2,3,4,5,6,7,8,13] }, //设置列不可排序
 				//爬虫挂起
-				{"targets":[15], createdCell: function (cell, cellData, rowData, rowIndex, colIndex) {
-					var aInput;
-					$(cell).click(function () {
-						if( rowData.i_state == "关闭"||rowData.i_pendstate ==1 ){//任务不能由挂起转为非挂起状态;关闭任务不能挂起操作
-							return
-						}
-						$(this).html(createComboxPendState(rowData.s_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 = 1
-						}
-						ttabletask.cell(cell).data(text);
-						cellData = text;
-					});
-				}}
+				// {"targets":[15], createdCell: function (cell, cellData, rowData, rowIndex, colIndex) {
+				// 	var aInput;
+				// 	$(cell).click(function () {
+				// 		if( rowData.i_state == "关闭"||rowData.i_pendstate ==1 ){//任务不能由挂起转为非挂起状态;关闭任务不能挂起操作
+				// 			return
+				// 		}
+				// 		$(this).html(createComboxPendState(rowData.s_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 = 1
+				// 		}
+				// 		ttabletask.cell(cell).data(text);
+				// 		cellData = text;
+				// 	});
+				// }}
 			],
-			"order": [[14,"desc"]], //默认排序列
+			"order": [[12,"desc"]], //默认排序列
 			"lengthChange":false,
 			"serverSide": true,
 			"searching": true,
 			"ordering": true,
 			"info": true,
-			"autoWidth": false,
+			"autoWidth": true,
 			"columns": [
 				{"data": "href"},
 				{"data": "_id",render:function(val,a,row){
@@ -175,61 +175,51 @@
 					// return "<a href='"+href+"' target='_blank' title='"+val+"'>"+val+"</a>"
 						return val;
 				}},
-				{"data": "i_state","width":"5%"},
-				{"data": "s_type","width":"7%",render:function(val,a,row){
-				  if(val== "8"){
-					val="采集频率异常"
-				  }else if(val=="7"){
-					val="列表页异常"
-				  }else if(val=="6"){
-					val="附件异常"
-				  }else if(val=="5"){
-					val="下载异常"
-				  }else if(val=="4"){
-					val="运行异常"
-				  }else if(val=="3"){
-					val="时间异常"
-				  }else if(val=="2"){
-					val="数据异常"
-				  }else if(val=="1"){
-					val="数量异常"
-				  }else if (val=="10"){
-					val="抽查任务"
-				  }else if(val=="0"){
-					val="常规任务"
-				  }else{
-					val="历史任务"
-				  }
-				  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_modify"},
-				{"data": "s_urgency",render:function(val,a,row){
-					if(val){
-						return val
-					}else{
-						return ""
+				{"data": "s_type","width":"7%",render:function(val,a,row){
+					if(val== "1"){
+						val="列表页异常"
+					}else if(val=="2"){
+						val="数据异常错误"
+					}else if(val=="3"){
+						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"},
 				{"data": "i_times"},
-				{"data": "i_frequencyerrtimes","width":"6%",render:function(val,a,row){
-				  if(val == undefined){
-					return 0;
-				  }
-				  return val;
-				}},
 				{"data": "s_source"},
 				{"data": "l_complete","width":"8%",render:function(val,a,row){
-					return val;
+					var dt = new Date()
+					dt.setTime(parseInt(val) * 1000);
+					return dt.format("yyyy-MM-dd hh:mm:ss");
 				}},
-				{"data": "i_pendstate",render:function(val){
-					if(val == 0||val == undefined){
-						return "否"
-					}else{
-						return "是"
-					}
-				}},
-				{"data": "_id","width":"13%",render:function(val,a,row){
+				{"data": "_id","width":"10%",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>');
@@ -240,12 +230,12 @@
 					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'] == "待确认"){
+					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);
 				 	}
-					div.find(".btn-group").append(buttonTag);
 					return div.html();
 				}}
 			],
@@ -260,17 +250,11 @@
 			    });    
 			},
 			"fnServerParams": function (e) {  
-				var state=$("#task_urgency").val();
 				var taskState = $("#task_state").val();
 				var taskEvent = $("#task_event").val();
 				var taskStype = $("#task_stype").val();
 				var userid = $("#modifyuser").val();
-				//紧急程度
-				if(state){
-					e.state=state;
-				}else{
-					e.state="-1";
-				}
+				var platform = $("#platform").val();
 				//任务状态
 				if(taskState){
 					e.taskState = taskState;
@@ -283,35 +267,28 @@
 				}else{
 					e.taskEvent="-1";
 				}
-        //任务类型
-        if(taskStype){
+				//任务类型
+				if(taskStype){
 					e.taskStype = taskStype;
 				}else{
 					e.taskStype="-1";
 				}
-        //维护人
-        if(userid){
+				//维护人
+				if(userid){
 					e.userid = userid;
 				}else{
 					e.userid="-1";
 				}
-      }
-	  });
+				//平台
+				if(platform){
+					e.platform = platform;
+				}else{
+					e.platform="-1";
+				}
+     		}
+	    });
 		common.setActive("index_rwgl");
 		ttabletask.on('init.dt', function () {
-
-			var opt="<option value='-1'>全部</option>"+
-				"<option value='1'>普通</option>"+
-				"<option value='2'>紧急</option>"+
-				"<option value='3'>非常紧急</option>"+
-				"<option value='4'>特别紧急</option>";
-			var select="<div class='form-group'><label for='name'>紧急程度:</label>"+
-				"<select id='task_urgency' onchange='checkclick(this.value)' class='form-control input-sm'>"+
-				opt+
-				"</select></div>"
-			$("#task_filter").prepend("&nbsp;&nbsp;");
-			$("#task_filter").prepend(select);
-
 			var taskState="<option value='-1'>全部</option>"+
 				"<option value='0'>待确认</option>"+
 				"<option value='1'>待处理</option>"+
@@ -328,22 +305,19 @@
 				$("#task_filter").prepend(selectState);
 
 			var taskStype="<option value='-1'>全部</option>"+
-        "<option value='8'>采集频率异常</option>"+
-        "<option value='7'>列表页异常</option>"+
-				"<option value='6'>附件异常</option>"+
-				"<option value='5'>下载异常</option>"+
-				"<option value='4'>运行异常</option>"+
-				"<option value='3'>时间异常</option>"+
-				"<option value='2'>数据异常</option>"+
-				"<option value='1'>数量异常</option>"+
-        "<option value='10'>抽查任务</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>"+
+					"<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("&nbsp;&nbsp;");
-				$("#task_filter").prepend(selectStype);
+					"<select id='task_stype' onchange='checkclick(this.value)' class='form-control input-sm'>"+
+					taskStype+
+					"</select></div>"
+			$("#task_filter").prepend("&nbsp;&nbsp;");
+			$("#task_filter").prepend(selectStype);
 
 			var taskEvent="<option value='-1'>全部</option>"
 			var events={{.T.events}}
@@ -368,6 +342,17 @@
 			"</select></div>"
 			$("#task_filter").prepend("&nbsp;&nbsp;");
 			$("#task_filter").prepend(selectModifyuser);
+			//平台
+			var platform="<option value='-1'>全部</option>"
+			platform+="<option value='golua平台'>golua平台</option>";
+			platform+="<option value='chrome'>chrome</option>";
+			platform+="<option value='python'>python</option>";
+			var selectPlatform="<div class='form-group'><label for='name'>平台:</label>"+
+					"<select id='platform' onchange='checkclick(this.value)' class='form-control input-sm'>"+
+					platform+
+					"</select></div>"
+			$("#task_filter").prepend("&nbsp;&nbsp;");
+			$("#task_filter").prepend(selectPlatform);
 			//修改样式
 			$("#task_wrapper .col-sm-6").css({width:"100%"});
 		});
@@ -435,22 +420,6 @@
 		  }
 		})
 	}
-	//
-	//删除任务
-	//function delTask(id){
-	//	showConfirm("确定删除?",function(){
-	//		$.post("/center/task/del",{"id":id},function(r){
-	//			if("ok" == r.state){
-	//				showTip("删除成功", 1000);
-	//				$('#com-alert').on('hidden.bs.modal', function () {
-	//					ttabletask.ajax.reload();
-	//				})
-	//			}else{
-	//				showTip("删除失败", 1000);
-	//			}
-	//		})
-	//	})
-	//}
 	function disables_cancel(){
 		$("#modal-assigntask").modal("hide");
 	}
@@ -463,7 +432,7 @@
     var reasontext = $("#reason").val();
     $.post("/center/task/assignChangeTaskState",{"code":assigncode,"id":assignid,"reason":reasontext},function(r){
 			if(r == "y"){
-        $("#modal-assigntask").modal("hide");
+        	$("#modal-assigntask").modal("hide");
 				showTip("分发成功", 1000);
 				$('#com-alert').on('hidden.bs.modal', function () {
 					ttabletask.ajax.reload();
@@ -478,19 +447,19 @@
 		});
   }
   
-	//分任务
+	//分任务
 	function assignTask(code,state,id){
-		if(state != "待确认"){
+		if(state != "0"){
 			return;
 		}
-    assigncode = code;
-    assignid = id;
-    $("#modal-assigntask").modal("show");
+    	assigncode = code;
+    	assignid = id;
+    	$("#modal-assigntask").modal("show");
 	}
 
 	//关闭任务
 	function closeTask(code,state,id){
-		if(state == "关闭"){
+		if(state == "6"){
 			return
 		}	
 		showConfirm("确定关闭任务?",function(){
@@ -511,10 +480,10 @@
 
 	//标记任务
 	function tagTask(code,state,id,stype){
-	  if(state != "待确认" && state != "待处理" && state != "处理中"){
-		  alert("该任务不能被标记!")
-		  return
-	  }
+		if(state != 0){
+			alert("该任务不能被标记!")
+			return
+		}
 	  showConfirm("确定标记任务?",function(){
 		  $.post("/center/spider/tagcode",{"id":id,"code":code,"stype":stype},function(r){
 			  if(r == "y"){
@@ -537,7 +506,7 @@
 		$("#task_wrapper td input[type=checkbox]").each(function(){
 			if($(this).prop("checked")){
 				var state = $(this).attr("state")
-				if(state == "关闭"){
+				if(state == "6"){
 					flag = false;
 				}
 				ids.push($(this).val());
@@ -574,7 +543,7 @@
 		$("#task_wrapper td input[type=checkbox]").each(function(){
 			if($(this).prop("checked")){
 				var state = $(this).attr("state")
-				if(state == "关闭"){
+				if(state == "6"){
 					flag = false;
 				}
 				ids.push($(this).val());
@@ -611,7 +580,7 @@
 	  $("#task_wrapper td input[type=checkbox]").each(function(){
 		  if($(this).prop("checked")){
 			  var state = $(this).attr("state")
-			  if(state == "待处理"){
+			  if(state == "1"){
 				  ids.push($(this).val());
 				  // codes.push($(this).attr("code"));
 			  }