소스 검색

剑鱼维护相关

apple 5 년 전
부모
커밋
2a51ffcadb

+ 2 - 1
src/config.json

@@ -5,7 +5,8 @@
   "dbsize": 5,
   "dbname": "datatag",
   "jydbname": "extract_kf",
-  "jycollname": "zk_xiufu_test01",
+  "jycollname1": "zk_xiufu_test01",
+  "jycollname2": "zk_xiufu_test",
   "mgodben": "192.168.3.207:27092",
   "dbnameen": "enterprise",
   "mongoenc": "winner_enterprise",

BIN
src/search.png


+ 105 - 36
src/service/repair_rule.go

@@ -5,7 +5,6 @@ import (
 	"gopkg.in/mgo.v2/bson"
 	"log"
 	qu "qfw/util"
-	"reflect"
 	. "util"
 )
 
@@ -32,11 +31,17 @@ func (jy *RepairRule) RepairList() {
 func (jy *RepairRule) RepairEdit() {
 	defer qu.Catch()
 	id := jy.GetString("id")
-	data, _ := JYMgo.FindById(JyCollName,id,"")
-
+	coll := jy.GetString("coll")
+	data, _ := JYMgo.FindById(coll,id,"")
 	//contenthtml detail 单独拿出来
+	detail:= qu.ObjToString((*data)["detail"])
+	contenthtml:= qu.ObjToString((*data)["contenthtml"])
+	jy.T["detail"] = map[string]string{"detail":detail}
+	jy.T["contenthtml"] = map[string]string{"contenthtml":contenthtml}
+	delete(*data,"detail")
+	delete(*data,"contenthtml")
 	jy.T["data"] = *data
-
+	jy.T["coll"] = coll
 
 	jy.Render("repair/jianyu_edit.html", &jy.T)
 }
@@ -44,16 +49,33 @@ func (jy *RepairRule) RepairEdit() {
 //删除
 func (jy *RepairRule) RepairDelete() {
 	defer qu.Catch()
-	//测试-待定
-	jy.ServeJson(map[string]interface{}{
-		"rep": true,
-	})
-	//_id := jy.GetString("_id")
-	//set := bson.M{"_id":qu.StringTOBsonId(_id)}
-	//b :=Mgo.Del("JyCollName",set)
-	//jy.ServeJson(map[string]interface{}{
-	//	"rep": b,
-	//})
+	id := jy.GetString("_id")
+	coll := jy.GetString("coll")
+	log.Println(id,coll)
+	set := bson.M{"_id":qu.StringTOBsonId(id)}
+	b :=JYMgo.Del(coll,set)
+
+	if !b {
+		jy.ServeJson(map[string]interface{}{
+			"rep": b,
+		})
+	}else {
+		//修改es
+		//client := elastic.GetEsConn()
+		//defer elastic.DestoryEsConn(client)
+		//_, err := client.Delete().Index(EsIndex).Type(EsType).Id(id).Refresh(true).Do()
+		//if err != nil {
+		//	log.Println("delete es err:", err)
+		//}
+
+
+		//新增记录
+
+
+		jy.ServeJson(map[string]interface{}{
+			"rep": b,
+		})
+	}
 }
 
 
@@ -62,17 +84,39 @@ func (jy *RepairRule) RepairSave() {
 	if jy.Method() == "POST" {
 		data := GetPostForm(jy.Request)
 		updata:=qu.ObjToMap(data["data"])
-		log.Println(reflect.TypeOf(updata))
+		coll:=qu.ObjToString(data["coll"])
+		log.Println("当前更新的表:",coll)
 		id := qu.ObjToString((*updata)["_id"])
-		log.Println("当前id",id)
 		query := bson.M{
 			"_id": qu.StringTOBsonId(id),
 		}
 		delete(*updata,"_id")
-		rep := JYMgo.Update(JyCollName, query, bson.M{"$set": *updata}, false, true)
-		jy.ServeJson(map[string]interface{}{
-			"rep": rep,
-		})
+
+		//修改mongo
+		rep := JYMgo.Update(coll, query, bson.M{"$set": *updata}, false, true)
+
+		if !rep {
+			jy.ServeJson(map[string]interface{}{
+				"rep": rep,
+			})
+		}else {
+			//修改es
+			//client := elastic.GetEsConn()
+			//defer elastic.DestoryEsConn(client)
+			//_, err := client.Update().Index(EsIndex).Type(EsType).Id(id).Doc(*updata).Refresh(true).Do()
+			//if err != nil {
+			//	log.Println("update es err:", err)
+			//}
+
+
+			//新增记录
+
+
+			jy.ServeJson(map[string]interface{}{
+				"rep": rep,
+			})
+		}
+
 	}
 }
 
@@ -82,23 +126,35 @@ func (jy *RepairRule) SearchID() {
 	defer qu.Catch()
 	if jy.Method() == "POST" {
 		id := jy.GetString("_id")
-		id = "5da3f2cba5cb26b9b7985f3f"
+
+		//先查one 没有在查two 5da3f2c5a5cb26b9b79847fc 5ea7d06c519cb1801b15385b
+		id = "5da3f2c5a5cb26b9b79847fc"
 		if !bson.IsObjectIdHex(id){
 			jy.ServeJson(map[string]interface{}{
 				"rep":false,
 				"msg":"id格式不正确",
 			})
 		}else {
-			data, rep := JYMgo.Find(JyCollName, bson.M{"_id": qu.StringTOBsonId(id)}, nil, nil, false, -1, -1)
-			if !rep ||len(*data)<=0 {
-				jy.ServeJson(map[string]interface{}{
-					"rep": false,
-					"msg":"未查询到数据",
-				})
+			data_one, rep_one := JYMgo.Find(JyCollNameOne, bson.M{"_id": qu.StringTOBsonId(id)}, nil, nil, false, -1, -1)
+			if !rep_one ||len(*data_one)<=0 {
+				data_two, rep_two := JYMgo.Find(JyCollNameTwo, bson.M{"_id": qu.StringTOBsonId(id)}, nil, nil, false, -1, -1)
+				if !rep_two ||len(*data_two)<=0 {
+					jy.ServeJson(map[string]interface{}{
+						"rep": false,
+						"msg":"未查询到数据",
+					})
+				}else {
+					jy.ServeJson(map[string]interface{}{
+						"orgColl":JyCollNameTwo,
+						"rep":				rep_two,
+						"data":            data_two,
+					})
+				}
 			}else {
 				jy.ServeJson(map[string]interface{}{
-					"rep":				rep,
-					"data":            data,
+					"orgColl":JyCollNameOne,
+					"rep":				rep_one,
+					"data":            data_one,
 				})
 			}
 		}
@@ -109,15 +165,28 @@ func (jy *RepairRule) SearchHref() {
 	defer qu.Catch()
 	if jy.Method() == "POST" {
 		href := jy.GetString("href")
-		data, rep := JYMgo.Find(JyCollName, bson.M{"href": href}, nil, nil, false, -1, -1)
-		if !rep ||len(*data)<=0 {
-			jy.ServeJson(map[string]interface{}{
-				"rep":				false,
-			})
+		href = "http://www.chinabidding.com/bidDetail/244286088.html"
+		//href = "http://rfq.ouyeelbuy.com/rfqNotice/bidListInfo?id=3d3e2154-c7a5-11e9-8d47-005056b17e0e"
+		data_one, rep_one := JYMgo.Find(JyCollNameOne, bson.M{"href": href}, nil, nil, false, -1, -1)
+		if !rep_one ||len(*data_one)<=0 {
+			data_two, rep_two := JYMgo.Find(JyCollNameTwo, bson.M{"href": href}, nil, nil, false, -1, -1)
+			if !rep_two ||len(*data_two)<=0 {
+				jy.ServeJson(map[string]interface{}{
+					"rep": false,
+					"msg":"未查询到数据",
+				})
+			}else {
+				jy.ServeJson(map[string]interface{}{
+					"orgColl":JyCollNameTwo,
+					"rep":				rep_two,
+					"data":            data_two,
+				})
+			}
 		}else {
 			jy.ServeJson(map[string]interface{}{
-				"rep":				rep,
-				"data":            data,
+				"orgColl":JyCollNameOne,
+				"rep":				rep_one,
+				"data":            data_one,
 			})
 		}
 	}

+ 3 - 1
src/service/task_rule.go

@@ -71,7 +71,9 @@ func (task *TaskRule) TaskEdit() {
 	data, _ := Mgo.FindOneByField("taskinfo", query, `{}`)
 	(*data)["id"] = qu.BsonIdToSId((*data)["_id"])
 	task.T["data"] = *data
-	task.T["taskType"] = TaskTypeMap
+	task.T["taskType"] = *TaskTypeMap
+	log.Println(*data)
+	log.Println(*TaskTypeMap)
 	task.Render("task/task_edit.html", &task.T)
 }
 

+ 1 - 1
src/udptask/udptask.go

@@ -30,7 +30,7 @@ func processUdpMsg(act byte, data []byte, ra *net.UDPAddr) {
 		var rep map[string]interface{}
 		err := json.Unmarshal(data, &rep)
 		if err != nil { //测试接收
-
+			//
 			go Udpclient.WriteUdp([]byte{}, mu.OP_NOOP, ra) //回应上一个节点
 		} else {
 			by, _ := json.Marshal(map[string]interface{}{

+ 4 - 2
src/util/config.go

@@ -15,7 +15,8 @@ var (
 	MgoEnC          string
 	Subday          float64
 	PreviewHref     string //数据预览地址
-	JyCollName		string
+	JyCollNameOne   string
+	JyCollNameTwo   string
 )
 
 var (
@@ -60,7 +61,8 @@ func initJYMgo()  {
 		Size:        qu.IntAll(Sysconfig["dbsize"]),
 		DbName:      qu.ObjToString(Sysconfig["jydbname"]),
 	}
-	JyCollName = qu.ObjToString(Sysconfig["jycollname"])
+	JyCollNameOne = qu.ObjToString(Sysconfig["jycollname1"])
+	JyCollNameTwo = qu.ObjToString(Sysconfig["jycollname2"])
 	JYMgo.InitPool()
 
 }

+ 25 - 10
src/web/templates/repair/jianyu_edit.html

@@ -48,8 +48,15 @@
             </ul>
             <form class="form-horizontal">
                 <div class="box-body">
-                    <textarea id="jsonTextarea"></textarea>
+                    <textarea id="jsonTextarea" style="width: 100%;height: 300px"></textarea>
                 </div>
+                <div class="box-body">
+                    <textarea id="jsonDetail" style="width: 100%;height: 300px"></textarea>
+                    <textarea id="jsonContentHtml" style="width: 100%;height: 300px"></textarea>
+
+                </div>
+
+
             </form>
         </div>
     </section>
@@ -60,15 +67,16 @@
 <script>
     menuActive("/service/jianyu/repair");
     var edit_data = {{.T.data}};
-    var curID = {{.T.id}};
-
-
+    var edit_contentHtml = {{.T.contenthtml}};
+    var edit_detail = {{.T.detail}};
+    var edit_coll = {{.T.coll}};
     function parse(str) {
         return JSON.stringify(str, null, "\t")
     }
-    $('#jsonTextarea').val(parse(edit_data));
-
 
+    $('#jsonTextarea').val(parse(edit_data)); //其他属性
+    $('#jsonDetail').val(parse(edit_detail)); //其他属性
+    $('#jsonContentHtml').val(parse(edit_contentHtml)); //其他属性
 
     //更新
     function saveRepair() {
@@ -77,14 +85,21 @@
         var updata = {}
         for (var k in data) {
             updata[k] = data[k]
-            if (k=="detail") {
-
-            }
         }
+        var content = document.getElementById('jsonContentHtml').value;
+        var conData = JSON.parse(content)
+        updata["contenthtml"] = conData["contenthtml"]
+
+        var detail = document.getElementById('jsonDetail').value;
+        var detData = JSON.parse(detail)
+        updata["detail"] = detData["detail"]
+
+        // alert(JSON.stringify(updata))
+
         $.ajax({
             url: "/service/jianyu/save",
             type: 'POST',
-            data: {"data":JSON.stringify(updata)},
+            data: {"data":JSON.stringify(updata),"coll":edit_coll},
             success: function (task) {
                 if (task.rep) {
                     window.location.href="/service/jianyu/repair"

+ 19 - 14
src/web/templates/repair/jianyu_repair.html

@@ -56,9 +56,9 @@
                     <div class="box-body">
                         <div class="tab-content">
                             <input class="j-input__inner" type="text" placeholder="请输入查询的id" id="idSea">
-                            <img src="" class="search-icon" onclick="idSearch()" />
+                            <img src="/picture/search.jpg" class="search-icon" onclick="idSearch()" />
                             <input class="j-input__inner" type="text" placeholder="请输入查询的href" id="hrefSea">
-                            <img src="" class="search-icon" onclick="hrefSearch()" />
+                            <img src="/picture/search.jpg" class="search-icon" onclick="hrefSearch()" />
                         </div>
 
                         <table id="dataTable" class="table table-bordered table-hover">
@@ -66,7 +66,8 @@
                             <tr>
                                 <th>编号</th>
                                 <th>标题</th>
-                                <th>正文</th>
+                                <th>正文链接</th>
+                                <th>源表</th>
                                 <th>发布时间</th>
                                 <th>操作</th>
                             </tr>
@@ -85,6 +86,9 @@
 {{include "com/footer.html"}}
 <script>
     menuActive("/jianyu/repair");
+
+    var curColl = ""
+
     $(document).ready(function () {
         ttable = $('#dataTable').DataTable({
             "paging": false,
@@ -114,16 +118,19 @@
                 {"data": null,width:"8%"},
                 {"data": "title"},
                 {"data": "href",width:"20%"},
-                {"data": "publishtime",width:"20%", render: function (val) {
+                {"data": null,width:"10%", render: function (val){
+                        return curColl
+                    }},
+                {"data": "publishtime",width:"18%", render: function (val) {
                         var dt = new Date()
                         dt.setTime(parseInt(val) * 1000);
                         return dt.format("yyyy-MM-dd hh-mm-ss")
                     }},
                 {"data": "_id", width:"15%",render: function (val, a, row, pos) {
                         tmp = '<div>' +
-                            '<a class="btn btn-sm btn-primary" href="/service/jianyu/edit?id='+val+'">编辑</a>'+
-                            '&nbsp'+'&nbsp'+
-                            '<a class="btn btn-sm btn-danger" onclick="del_repair(\''+val+'\')">删除</a>'+
+                            '<a class="btn btn-sm btn-primary" href="/service/jianyu/edit?id='+val+'&coll='+curColl+'">编辑</a>'+
+                            '&nbsp'+'&nbsp'+//href="/service/jianyu/edit?id='+val+'
+                            '<a class="btn btn-sm btn-danger" onclick="del_repair(\''+val+'\',\''+curColl+'\')">删除</a>'+
                             '</div>';
                         return tmp
                     }}
@@ -140,6 +147,7 @@
             data:{"_id": search_name},
             success:function(r){
                 if (r.rep) {
+                    curColl = r.orgColl
                     $('#dataTable').dataTable().fnClearTable();
                     $('#dataTable').dataTable().fnAddData(r.data);
                 }else {
@@ -156,6 +164,7 @@
             data:{"href": search_name},
             success:function(r){
                 if (r.rep) {
+                    curColl = r.orgColl
                     $('#dataTable').dataTable().fnClearTable();
                     $('#dataTable').dataTable().fnAddData(r.data);
                 }else {
@@ -166,20 +175,16 @@
     }
 
 
-
-
-
-
-
-    function del_repair(del_id){
+    function del_repair(del_id,coll){
         showConfirm("确定删除?", function() {
             $.ajax({
                 url:"/service/jianyu/delete",
                 type:"post",
-                data:{"_id": del_id},
+                data:{"_id": del_id,"coll":curColl},
                 success:function(r){
                     if(r.rep){
                         $('#dataTable').dataTable().fnClearTable();
+                        showTip("删除成功")
                     }else{
                         alert("删除失败");
                     }

+ 34 - 44
src/web/templates/task/task_create.html

@@ -4,8 +4,7 @@
 <!-- Left side column. 权限菜单 -->
 {{include "com/menu.html"}}
 {{include "com/modal.html"}}
-<script src="/time/js/angular.min.js"></script>
-<script src="/time/js/wui-date.js"></script>
+
 <div class="content-wrapper">
     <section class="content-header">
         <h1>新建任务</h1>
@@ -85,13 +84,28 @@
                             <script>
                                 $('#fromTypeSelect').on('changed.bs.select', function () {
                                     if ($(this).val() == 0) {
+                                        hide()
                                         dict["s_fromtype"] = ""
                                     }else if ($(this).val() == 1) {
+                                        hide()
                                         dict["s_fromtype"] = "es"
                                     } else if ($(this).val() == 2) {
+                                        show()
                                         dict["s_fromtype"] = "mongodb"
                                     }
+                                    dict["s_synces"] = "0"
                                 })
+
+                                function hide() {
+                                    var ui =document.getElementById("isHideGroup");
+                                    ui.style.display="none";
+                                }
+                                function show() {
+                                    var ui =document.getElementById("isHideGroup");
+                                    ui.style.display="";
+                                    //置为默认
+                                    $("#syncesSelect").selectpicker('val', 0);
+                                }
                             </script>
                         </div>
                         <label class="col-sm-2 control-label"><span style="color:red;">* </span>from地址</label>
@@ -115,43 +129,24 @@
                     </div>
                     <hr>
                     {{/*第三组*/}}
-                    <div class="form-group">
-                        <label class="col-sm-2 control-label"><span style="color:red;">* </span>to方式类型</label>
+
+                    <div class="form-group" id="isHideGroup">
+                        <label class="col-sm-2 control-label">是否同步es</label>
                         <div class="col-sm-3">
-                            <select class="form-control selectpicker" id="toTypeSelect">
-                                <option selected:disabled style="diaplay:none" value=0>请选择</option>
-                                <option value=1>es</option>
-                                <option value=2>mongodb</option>
+                            <select class="form-control selectpicker" id="syncesSelect">
+                                <option value=0>否</option>
+                                <option value=1>是</option>
                             </select>
                             <script>
-                                $('#toTypeSelect').on('changed.bs.select', function () {
+                                $('#syncesSelect').on('changed.bs.select', function () {
                                     if ($(this).val() == 0) {
-                                        dict["s_totype"] = ""
-                                    }else if ($(this).val() == 1) {
-                                        dict["s_totype"] = "es"
-                                    } else if ($(this).val() == 2) {
-                                        dict["s_totype"] = "mongodb"
+                                        dict["s_synces"] = "0"
+                                    } else {
+                                        dict["s_synces"] = "1"
                                     }
                                 })
                             </script>
                         </div>
-                        <label class="col-sm-2 control-label"><span style="color:red;">* </span>to地址</label>
-                        <div class="col-sm-3">
-                            <input type="text" class="form-control" id="todburl" placeholder="请输入地址"
-                                   value="">
-                        </div>
-                    </div>
-                    <div class="form-group">
-                        <label class="col-sm-2 control-label"><span style="color:red;">* </span>to数据库</label>
-                        <div class="col-sm-3">
-                            <input type="text" class="form-control" id="todbname" placeholder="请输入数据库名"
-                                   value="">
-                        </div>
-                        <label class="col-sm-2 control-label"><span style="color:red;">* </span>to表</label>
-                        <div class="col-sm-3">
-                            <input type="text" class="form-control" id="todbcoll" placeholder="请输入表明"
-                                   value="" required>
-                        </div>
                     </div>
                 </div>
 
@@ -164,7 +159,12 @@
 {{include "com/footer.html"}}
 <script>
     menuActive("/service/task/list");
+
+    var ui =document.getElementById("isHideGroup");
+    ui.style.display="none";
+
     var codeType = {{.T.taskType}};
+
     var dict = {
         "id":"",
         "s_udpaddr":"",
@@ -177,15 +177,11 @@
         "s_fromdburl": "",
         "s_fromdbname": "",
         "s_fromdbcoll": "",
-        "s_totype": "",
-        "s_todburl": "",
-        "s_todbname": "",
-        "s_todbcoll": "",
         "i_createtime": "",
         "s_createuser": "",
         "i_updatetime": "",
         "s_updateuser": "",
-
+        "s_synces":"0"
     };
 
     //选择器添加数据
@@ -204,9 +200,7 @@
     function checkDict(data)  {
         if (data["s_taskname"]==""||data["s_tasktype"]==""||data["s_startid"]==""||
             data["s_fromdburl"]==""||data["s_fromdbname"]==""|| data["s_fromdbcoll"]==""||
-            data["s_fromtype"]==""|| data["s_todburl"]==""||data["s_todbname"]==""||
-            data["s_todbcoll"]==""|| data["s_totype"]==""|| data["s_udpaddr"]=="" ||
-            data["s_udport"]=="") {
+            data["s_fromtype"]==""|| data["s_udpaddr"]=="" || data["s_udport"]=="") {
             return true
         }
         return false
@@ -217,13 +211,9 @@
         dict["s_fromdburl"] = $('#fromdburl').val();
         dict["s_fromdbname"] = $("#fromdbname").val();
         dict["s_fromdbcoll"] = $("#fromdbcoll").val();
-        dict["s_todburl"] = $('#todburl').val();
-        dict["s_todbname"] = $('#todbname').val();
-        dict["s_todbcoll"] = $("#todbcoll").val();
         dict["s_udpaddr"] = $('#udpaddr').val();
         dict["s_udport"] = $("#udport").val();
 
-
         if (checkDict(dict)) {
             let msg = "请完善所有信息"
             showMsg(msg);
@@ -233,7 +223,7 @@
             url: "/service/task/save",
             type: 'POST',
             data: dict,
-            success: function (task) {
+            success:function (task) {
                 if (task.rep) {
                     window.location.href="/service/task/list"
                 } else {

+ 38 - 55
src/web/templates/task/task_edit.html

@@ -4,8 +4,7 @@
 <!-- Left side column. 权限菜单 -->
 {{include "com/menu.html"}}
 {{include "com/modal.html"}}
-<script src="/time/js/angular.min.js"></script>
-<script src="/time/js/wui-date.js"></script>
+
 <div class="content-wrapper">
     <section class="content-header">
         <h1>编辑任务</h1>
@@ -45,7 +44,6 @@
                                     }else {
                                         dict["s_tasktype"] = codeType[index]["code"]
                                     }
-
                                 })
                             </script>
 
@@ -85,13 +83,28 @@
                             <script>
                                 $('#fromTypeSelect').on('changed.bs.select', function () {
                                     if ($(this).val() == 0) {
+                                        hide()
                                         dict["s_fromtype"] = ""
                                     }else if ($(this).val() == 1) {
+                                        hide()
                                         dict["s_fromtype"] = "es"
                                     } else if ($(this).val() == 2) {
+                                        show()
                                         dict["s_fromtype"] = "mongodb"
                                     }
+                                    dict["s_synces"] = "0"
                                 })
+
+                                function hide() {
+                                    var ui =document.getElementById("isHideGroup");
+                                    ui.style.display="none";
+                                }
+                                function show() {
+                                    var ui =document.getElementById("isHideGroup");
+                                    ui.style.display="";
+                                    //置为默认
+                                    $("#syncesSelect").selectpicker('val', 0);
+                                }
                             </script>
                         </div>
                         <label class="col-sm-2 control-label"><span style="color:red;">* </span>from地址</label>
@@ -115,43 +128,23 @@
                     </div>
                     <hr>
                     {{/*第三组*/}}
-                    <div class="form-group">
-                        <label class="col-sm-2 control-label"><span style="color:red;">* </span>to方式类型</label>
+                    <div class="form-group" id="isHideGroup">
+                        <label class="col-sm-2 control-label">是否同步es</label>
                         <div class="col-sm-3">
-                            <select class="form-control selectpicker" id="toTypeSelect">
-                                <option selected:disabled style="diaplay:none" value=0>请选择</option>
-                                <option value=1>es</option>
-                                <option value=2>mongodb</option>
+                            <select class="form-control selectpicker" id="syncesSelect">
+                                <option value=0>否</option>
+                                <option value=1>是</option>
                             </select>
                             <script>
-                                $('#toTypeSelect').on('changed.bs.select', function () {
+                                $('#syncesSelect').on('changed.bs.select', function () {
                                     if ($(this).val() == 0) {
-                                        dict["s_totype"] = ""
-                                    }else if ($(this).val() == 1) {
-                                        dict["s_totype"] = "es"
-                                    } else if ($(this).val() == 2) {
-                                        dict["s_totype"] = "mongodb"
+                                        dict["s_synces"] = "0"
+                                    } else {
+                                        dict["s_synces"] = "1"
                                     }
                                 })
                             </script>
                         </div>
-                        <label class="col-sm-2 control-label"><span style="color:red;">* </span>to地址</label>
-                        <div class="col-sm-3">
-                            <input type="text" class="form-control" id="todburl" placeholder="请输入地址"
-                                   value="">
-                        </div>
-                    </div>
-                    <div class="form-group">
-                        <label class="col-sm-2 control-label"><span style="color:red;">* </span>to数据库</label>
-                        <div class="col-sm-3">
-                            <input type="text" class="form-control" id="todbname" placeholder="请输入数据库名"
-                                   value="">
-                        </div>
-                        <label class="col-sm-2 control-label"><span style="color:red;">* </span>to表</label>
-                        <div class="col-sm-3">
-                            <input type="text" class="form-control" id="todbcoll" placeholder="请输入表明"
-                                   value="" required>
-                        </div>
                     </div>
                 </div>
 
@@ -176,18 +169,14 @@
         "s_fromdburl": edit_data["s_fromdburl"],
         "s_fromdbname": edit_data["s_fromdbname"],
         "s_fromdbcoll": edit_data["s_fromdbcoll"],
-        "s_totype": edit_data["s_totype"],
-        "s_todburl": edit_data["s_todburl"],
-        "s_todbname": edit_data["s_todbname"],
-        "s_todbcoll": edit_data["s_todbcoll"],
         "i_createtime": edit_data["i_createtime"],
         "s_createuser": edit_data["s_createuser"],
         "i_updatetime": edit_data["i_updatetime"],
         "s_updateuser": edit_data["s_updateuser"],
         "s_udport": edit_data["s_udport"],
         "s_udpaddr": edit_data["s_udpaddr"],
+        "s_synces":edit_data["s_synces"],
     };
-
     $(document).ready(function () {
         var index = 0
         var curIndex = 0
@@ -206,31 +195,33 @@
         }
         // 数据赋值
         $("#taskTypeSelect").selectpicker('val', curIndex+1);
-        var index_from,index_to = 0;
+        var index_from,index_synces = 0;
         index_from = (dict["s_fromtype"]=="es")?1:2;
-        index_to = (dict["s_totype"]=="es")?1:2;
+
         $("#fromTypeSelect").selectpicker('val', index_from);
-        $("#toTypeSelect").selectpicker('val', index_to);
         $("#taskname").val(dict["s_taskname"])
         $("#startid").val(dict["s_startid"])
         $("#fromdburl").val(dict["s_fromdburl"])
         $("#fromdbname").val(dict["s_fromdbname"])
         $("#fromdbcoll").val(dict["s_fromdbcoll"])
         $("#fromtype").val(dict["s_fromtype"])
-        $("#todburl").val(dict["s_todburl"])
-        $("#todbname").val(dict["s_todbname"])
-        $("#todbcoll").val(dict["s_todbcoll"])
-        $("#totype").val(dict["s_totype"])
         $("#udpaddr").val(dict["s_udpaddr"])
         $("#udport").val(dict["s_udport"])
 
+        //是否展示同步select 的值
+        if (dict["s_fromtype"]=="mongodb") {
+
+        }else {
+            var ui =document.getElementById("isHideGroup");
+            ui.style.display="none";
+        }
+        index_synces = (edit_data["s_synces"]=="0")?0:1;
+        $("#syncesSelect").selectpicker('val', index_synces);
     });
     function checkDict(data)  {
         if (data["s_taskname"]==""||data["s_tasktype"]==""||data["s_startid"]==""||
             data["s_fromdburl"]==""||data["s_fromdbname"]==""|| data["s_fromdbcoll"]==""||
-            data["s_fromtype"]==""|| data["s_todburl"]==""||data["s_todbname"]==""||
-            data["s_todbcoll"]==""|| data["s_totype"]==""|| data["s_udpaddr"]=="" ||
-            data["s_udport"]=="") {
+            data["s_fromtype"]==""|| data["s_udpaddr"]=="" || data["s_udport"]=="") {
             return true
         }
         return false
@@ -241,9 +232,6 @@
         dict["s_fromdburl"] = $('#fromdburl').val();
         dict["s_fromdbname"] = $("#fromdbname").val();
         dict["s_fromdbcoll"] = $("#fromdbcoll").val();
-        dict["s_todburl"] = $('#todburl').val();
-        dict["s_todbname"] = $('#todbname').val();
-        dict["s_todbcoll"] = $("#todbcoll").val();
         dict["s_udpaddr"] = $('#udpaddr').val();
         dict["s_udport"] = $("#udport").val();
 
@@ -266,9 +254,4 @@
         })
     }
 
-
-
-
-
-
 </script>

+ 0 - 2
src/web/templates/task/task_list.html

@@ -5,8 +5,6 @@
 {{include "com/menu.html"}}
 {{include "com/modal.html"}}
 
-
-
 <div class="content-wrapper" id="showbtn">
     <section class="content-header">
         <h1>