maxiaoshan 3 жил өмнө
parent
commit
0eff349b12

+ 1 - 1
src/config.json

@@ -6,7 +6,7 @@
     "alltocoll": "marked",
     "bidding":{
         "addr":"192.168.3.207:27092",
-        "db": "qfw_data",
+        "db": "mxs",
         "coll1": "bidding",
         "coll2": "bidding_back",
         "size": 10,

+ 10 - 10
src/front/group.go

@@ -74,20 +74,20 @@ func (f *Front) GroupTaskListByAdmin() {
 		status := f.GetString("s_status")
 		searchStr := f.GetString("search[value]")
 		search := strings.TrimSpace(searchStr)
-		starttime := f.GetString("starttime")
-		endtime := f.GetString("endtime")
+		starttime, _ := f.GetInt("starttime")
+		endtime, _ := f.GetInt("endtime")
 		query := map[string]interface{}{
 			"s_stype": "group", //检索用户组任务
 		}
-		timeQ := make(map[string]interface{})
-		if starttime != "" {
-			timeQ["$gte"], _ = strconv.Atoi(starttime)
-		}
-		if endtime != "" {
-			timeQ["$lte"], _ = strconv.Atoi(endtime)
+		if starttime > 0 {
+			query["i_starttime"] = map[string]interface{}{
+				"$gte": starttime,
+			}
 		}
-		if len(timeQ) > 0 {
-			query["i_createtime"] = timeQ
+		if endtime > 0 {
+			query["i_completetime"] = map[string]interface{}{
+				"$lte": endtime,
+			}
 		}
 		if status != "-1" { //任务状态
 			query["s_status"] = status

+ 2 - 1
src/front/mark.go

@@ -113,7 +113,8 @@ func (f *Front) JyMarkList() {
 		}
 		count := util.Mgo.Count(sourceInfo, query)
 		qu.Debug("query:", query, sourceInfo, count)
-		list, _ := util.Mgo.Find(sourceInfo, query, map[string]interface{}{"_id": 1}, nil, false, start, limit)
+		fields := map[string]interface{}{"v_baseinfo.title": 1, "b_istag": 1, "i_ckdata": 1}
+		list, _ := util.Mgo.Find(sourceInfo, query, map[string]interface{}{"_id": 1}, fields, false, start, limit)
 		//checkedNum, allNum := GetCheckedAndAllDataInfo(query, coll) //已标和总数信息
 		f.ServeJson(map[string]interface{}{"draw": draw, "data": *list, "recordsFiltered": count, "recordsTotal": count})
 	} else {

+ 1 - 1
src/front/project.go

@@ -442,7 +442,7 @@ func (f *Front) ProjectGroupTaskSave() {
 			success = util.Mgo.SaveBulk(util.TASKCOLLNAME, taskArr...)
 			if success {
 				msg = "任务分发成功"
-				UpdateSourceInfoByGroup(sourceinfo, stype, groupIdTask) //用户组分发任务成功后,给数据源打上用户组标识,同时生成任务临时表
+				UpdateSourceInfoByGroup(sourceinfo, stype, groupIdTask) //用户组分发任务成功后,给数据源打上用户组标识
 			} else {
 				msg = "任务分发失败"
 			}

+ 54 - 20
src/front/remark.go

@@ -43,7 +43,7 @@ func (f *Front) RemarkList() {
 			}
 		}
 		qu.Debug(query)
-		field := map[string]interface{}{"title": 1, "v_baseinfo": 1, "b_istag": 1, "i_ckdata": 1}
+		field := map[string]interface{}{"v_baseinfo.title": 1, "b_istag": 1, "i_ckdata": 1}
 		info, _ := util.Mgo.Find(sourceinfo, query, `{"_id": 1}`, field, false, start, limit)
 		count := util.Mgo.Count(sourceinfo, query)
 		qu.Debug(query, sourceinfo, count)
@@ -102,7 +102,7 @@ func (f *Front) RemarkDetail() {
 	f.T["worder_new"] = rep["worder_new"]
 	f.T["pcl_new"] = rep["pcl_new"]
 	f.T["pkg_new"] = rep["pkg_new"]
-	f.T["nextid"] = GetNextDataId(did, coll, pid) //下一条id
+	f.T["nextid"] = GetNextDataId(did, coll, tid) //下一条id
 	_ = f.Render("project/remark_detail.html", &f.T)
 }
 
@@ -523,7 +523,7 @@ func DealData(tmpLen int, publishtime float64, tmp []map[string]interface{}, mor
 	return
 }
 
-//获取当前数据下一条的id
+// GetNextDataId 获取当前数据下一条的id
 func GetNextDataId(id, coll, tid string) string {
 	nextIdQuery := map[string]interface{}{
 		"_id": map[string]interface{}{
@@ -533,6 +533,26 @@ func GetNextDataId(id, coll, tid string) string {
 	if tid != "" {
 		nextIdQuery["s_usertaskid"] = tid
 	}
+	qu.Debug(nextIdQuery, coll)
+	one, _ := util.Mgo.Find(coll, nextIdQuery, `{"_id":1}`, `{"_id":1}`, true, 0, 1)
+	if one != nil && len(*one) == 1 {
+		return mgo.BsonIdToSId((*one)[0]["_id"])
+	}
+	return id
+}
+
+// GetNextDataId1 质检下一条
+func GetNextDataId1(id, coll, tid string) string {
+	nextIdQuery := map[string]interface{}{
+		"b_istag": true,
+		"_id": map[string]interface{}{
+			"$gt": mgo.StringTOBsonId(id),
+		},
+	}
+	if tid != "" {
+		nextIdQuery["s_usertaskid"] = tid
+	}
+	qu.Debug(nextIdQuery, coll)
 	one, _ := util.Mgo.Find(coll, nextIdQuery, `{"_id":1}`, `{"_id":1}`, true, 0, 1)
 	if one != nil && len(*one) == 1 {
 		return mgo.BsonIdToSId((*one)[0]["_id"])
@@ -553,7 +573,7 @@ func (f *Front) CheckList() {
 		searchStr := f.GetString("search[value]")
 		search := strings.TrimSpace(searchStr)
 		query := map[string]interface{}{
-			"s_stype": "group",
+			"s_stype": "user",
 		}
 		if iRole != "0" {
 			query["s_groupid"] = gid
@@ -601,13 +621,16 @@ func (f *Front) CheckData() {
 		query := make(map[string]interface{})
 		if tid != "" {
 			// 任务数据质检
+			if stype == "group" {
+				query["s_grouptaskid"] = tid
+			} else {
+				query["s_usertaskid"] = tid
+			}
 			query["b_istag"] = true
-			query["s_grouptaskid"] = tid
 		} else {
 			if stype == "notag" {
 				query["b_istagging"] = false // 达标
 				query["b_isgivegroup"] = false
-				query["i_ckdata"] = 2
 			} else if stype == "tag" {
 				query["b_istagging"] = true //未达标
 				query["i_ckdata"] = 2
@@ -621,8 +644,8 @@ func (f *Front) CheckData() {
 			}
 		}
 		qu.Debug("Query:", query)
-		field := map[string]interface{}{"title": 1, "v_baseinfo": 1, "b_istag": 1, "i_ckdata": 1, "s_login": 1}
-		info, _ := util.Mgo.Find(sourceinfo, query, `{"_id": 1}`, field, false, start, limit)
+		fields := map[string]interface{}{"v_baseinfo.title": 1, "b_check": 1, "i_ckdata": 1, "s_login": 1}
+		info, _ := util.Mgo.Find(sourceinfo, query, `{"_id": 1}`, fields, false, start, limit)
 		count := util.Mgo.Count(sourceinfo, query)
 		qu.Debug(query, sourceinfo, count)
 		f.ServeJson(map[string]interface{}{
@@ -633,34 +656,40 @@ func (f *Front) CheckData() {
 		})
 	} else {
 		if tid == "" {
-			project, _ := util.Mgo.FindById(util.PROJECTCOLLNAME, pid, map[string]interface{}{"i_importnum": 1})
-			f.T["taskNum"] = (*project)["i_importnum"]
+			//project, _ := util.Mgo.FindById(util.PROJECTCOLLNAME, pid, map[string]interface{}{"i_importnum": 1})
+			//f.T["taskNum"] = (*project)["i_importnum"]
 			query1 := make(map[string]interface{})
 			query2 := make(map[string]interface{})
 			if stype == "notag" {
-				query1["b_istagging"] = false // 达标
-				query2["b_istagging"] = false
+				query1["b_istagging"] = false   // 达标
+				query1["b_isgivegroup"] = false //未分发
 			} else if stype == "tag" {
 				query1["b_istagging"] = true //未达标
 				query2["b_istagging"] = true
 			}
-			query1["i_ckdata"] = 2
-			query2["b_check"] = true
-			tagCount := util.Mgo.Count(sourceinfo, query1)
-			checkCount := util.Mgo.Count(sourceinfo, query2)
-			f.T["taskTagNum"] = tagCount
+			f.T["taskNum"] = util.Mgo.Count(sourceinfo, query1)
+			query1["b_check"] = true // 已质检
+			checkCount := util.Mgo.Count(sourceinfo, query1)
+			f.T["taskTagNum"] = 0
 			f.T["taskCheckNum"] = checkCount
 		} else {
 			task, _ := util.Mgo.FindById(util.TASKCOLLNAME, tid, map[string]interface{}{"i_givenum": 1})
 			f.T["taskNum"] = (*task)["i_givenum"]
-			tagCount := util.Mgo.Count(sourceinfo, map[string]interface{}{"s_grouptaskid": tid, "b_istag": true})
-			checkCount := util.Mgo.Count(sourceinfo, map[string]interface{}{"s_grouptaskid": tid, "b_check": true})
+			tagCount, checkCount := 0, 0
+			if stype == "group" {
+				tagCount = util.Mgo.Count(sourceinfo, map[string]interface{}{"s_grouptaskid": tid, "b_istag": true})
+				checkCount = util.Mgo.Count(sourceinfo, map[string]interface{}{"s_grouptaskid": tid, "b_check": true})
+			} else {
+				tagCount = util.Mgo.Count(sourceinfo, map[string]interface{}{"s_usertaskid": tid, "b_istag": true})
+				checkCount = util.Mgo.Count(sourceinfo, map[string]interface{}{"s_usertaskid": tid, "b_check": true})
+			}
 			f.T["taskTagNum"] = tagCount
 			f.T["taskCheckNum"] = checkCount
 		}
 		f.T["pid"] = pid
 		f.T["tid"] = tid
 		f.T["sourceinfo"] = sourceinfo
+		f.T["stype"] = stype
 		_ = f.Render("project/check_data_list.html", &f.T)
 	}
 }
@@ -707,7 +736,7 @@ func (f *Front) CheckDetail() {
 	f.T["worder_new"] = rep["worder_new"]
 	f.T["pcl_new"] = rep["pcl_new"]
 	f.T["pkg_new"] = rep["pkg_new"]
-	f.T["nextid"] = GetNextDataId(did, coll, tid) //下一条id
+	f.T["nextid"] = GetNextDataId1(did, coll, tid) //下一条id
 	_ = f.Render("project/check_detail.html", &f.T)
 }
 
@@ -878,6 +907,11 @@ func (f *Front) CheckResult() {
 	}
 	sess := util.Mgo.GetMgoConn()
 	defer util.Mgo.DestoryMongoConn(sess)
+	if tid == "" {
+
+	} else {
+
+	}
 	query := map[string]interface{}{"s_grouptaskid": tid, "b_istag": true}
 	result := sess.DB(util.Mgo.DbName).C(sourceinfo).Find(query).Iter()
 	for tmp := make(map[string]interface{}); result.Next(&tmp); markNum++ {

+ 3 - 0
src/front/user.go

@@ -587,6 +587,7 @@ func (f *Front) UserTaskList() {
 	user := f.GetSession("user").(map[string]interface{})
 	s_role := qu.ObjToString(user["i_role"])
 	s_personid := qu.ObjToString(user["id"])
+	gid := qu.ObjToString(user["s_groupid"])
 	if f.Method() == "POST" {
 		start, _ := f.GetInteger("start")
 		limit, _ := f.GetInteger("length")
@@ -599,6 +600,8 @@ func (f *Front) UserTaskList() {
 		}
 		if s_role == "4" {
 			query["s_personid"] = s_personid
+		} else if s_role == "2" {
+			query["s_grouptaskid"] = gid
 		}
 		if status != "-1" { //任务状态
 			query["s_status"] = status

+ 4 - 1
src/util/config.go

@@ -50,9 +50,12 @@ var (
 
 var SE = qu.SimpleEncrypt{Key: "topJYBX2019"}
 var SourceInfoIndexArr = []mongo.IndexModel{
-	mongo.IndexModel{Keys: map[string]interface{}{"s_grouptaskid": 1}},               //独立索引
+	mongo.IndexModel{Keys: map[string]interface{}{"s_grouptaskid": 1}}, //独立索引
+	mongo.IndexModel{Keys: map[string]interface{}{"s_usertaskid": 1}},
 	mongo.IndexModel{Keys: map[string]interface{}{"s_grouptaskid": 1, "b_istag": 1}}, //联合索引
 	mongo.IndexModel{Keys: map[string]interface{}{"s_grouptaskid": 1, "s_isgiveuser": 1}},
+	mongo.IndexModel{Keys: map[string]interface{}{"s_usertaskid": 1, "b_istag": 1}},
+	mongo.IndexModel{Keys: map[string]interface{}{"s_usertaskid": 1, "b_check": 1}},
 	mongo.IndexModel{Keys: map[string]interface{}{"b_istagging": 1}},
 	mongo.IndexModel{Keys: map[string]interface{}{"b_istagging": 1, "b_istag": 1}},
 	mongo.IndexModel{Keys: map[string]interface{}{"b_isgivegroup": 1, "b_istagging": 1}},

+ 16 - 5
src/web/templates/project/check_data_list.html

@@ -24,9 +24,9 @@
                             <div class="form-group" style="margin-left: 10px;margin-top: 10px">
                                 <div class="col-xs-5" style="width: auto">
                                     <label class="form-inline">已标数据/数据总量:
-                                        <input type="text" class="form-control" style="width: 80px" readonly value="{{.T.taskTagNum}} / {{ .T.taskNum }}"></label>
+                                        <input type="text" class="form-control" style="width: 120px;padding: 5px" readonly value="{{.T.taskTagNum}} / {{ .T.taskNum }}"></label>
                                     <label class="form-inline">已检数据/已标总量:
-                                        <input type="text" class="form-control" style="width: 80px" readonly value="{{.T.taskCheckNum}} / {{ .T.taskTagNum }}"></label>
+                                        <input type="text" class="form-control" style="width: 120px;padding: 5px" readonly value="{{.T.taskCheckNum}} / {{ .T.taskTagNum }}"></label>
                                 </div>
                                 <input type="button" class="btn btn-primary" onclick="checkResult()" value="质检结果">
                             </div>
@@ -63,12 +63,17 @@
     let tid = {{ .T.tid }}
     let pid = {{ .T.pid }}
     let sourceinfo = {{ .T.sourceinfo }}
+    let stype = {{ .T.stype }}
+
+    let index = 0
 
     $(function () {
         ttable = $('#dataTable').dataTable({
             "paging": true,
             "lengthChange": false,
             "searching": true,
+            "processing": true,
+            "pageLength": 20,
             "ordering": false,
             "info": true,
             "autoWidth": false,
@@ -76,7 +81,7 @@
             "ajax": {
                 "url": "/front/user/check/data",
                 "type": "post",
-                "data": {"tid": tid, "s_sourceinfo": sourceinfo}
+                "data": {"tid": tid, "s_sourceinfo": sourceinfo, "stype": stype}
             },
             "language": {
                 "url": "/dist/js/dataTables.chinese.lang"
@@ -91,13 +96,19 @@
                     ttable.api().page(redirectpage).draw(false);
                 });
                 this.api().column(0).nodes().each(function (cell, i) {
-                    cell.innerHTML = i + 1;
+                    index ++
+                    cell.innerHTML = index;
                 });
             },
             "columns": [
                 {"data": null, width: "2%"},
                 {"data": "v_baseinfo.title", render: function (val, index, row) {
-                        let tmp = '<a style="display: inline-block;cursor:pointer;font-size:16px;color: green" target="_blank" href="/front/user/check/detail/?pid='+pid+'&did=' + row._id + '&s_sourceinfo='+sourceinfo+'">' + val + '</a>'
+                        let tmp
+                        if (row["b_check"]) {
+                            tmp = '<a style="display: inline-block;cursor:pointer;font-size:16px;color: green" target="_blank" href="/front/user/check/detail/?pid='+pid+'&did=' + row._id + '&s_sourceinfo='+sourceinfo+'">' + val + '</a>'
+                        } else {
+                            tmp = '<a style="display: inline-block;cursor:pointer;font-size:16px;color: #428bca" target="_blank" href="/front/user/check/detail/?pid='+pid+'&did=' + row._id + '&s_sourceinfo='+sourceinfo+'">' + val + '</a>'
+                        }
                         return tmp
                     }},
                 {"data": "s_login", "defaultContent": ""},

+ 3 - 2
src/web/templates/project/check_detail.html

@@ -404,6 +404,7 @@
 
     let did = {{ .T.did }}      // 数据id
     let pid = {{ .T.pid }}      // 项目id
+    let tid = {{ .T.tid }}
     let coll = {{ .T.coll }}    // 表名
     var allCheckFields = {{ .T.fields }}          //本次需标注的所有字段
     console.log(allCheckFields)
@@ -916,9 +917,9 @@
                         alert("请先保存数据!")
                     } else {
                         if (nextid === "") {
-                            showMsg("数据已经全部标注完")
+                            alert("数据已经全部标注完")
                         } else {
-                            // window.location.href = "/front/user/remark/list?pid="+pid+"&tid="+tid+"&s_sourceinfo="+coll
+                            window.location.href = "/front/user/check/detail/?pid="+pid+"&tid="+tid+"&did="+nextid+"&s_sourceinfo="+coll
                         }
                     }
                 },

+ 10 - 7
src/web/templates/project/project_list.html

@@ -205,13 +205,13 @@
                                 </div>
                                 <div class="form-group">
                                     <label class="col-sm-3 control-label">售后人员</label>
-                                    <div class="col-sm-6">
+                                    <div class="col-sm-5">
                                         <input type="text" class="form-control" id="edit-person">
                                     </div>
                                 </div>
                                 <div class="form-group">
                                     <label class="col-sm-3 control-label">选择标注字段</label>
-                                    <div class="col-sm-6">
+                                    <div class="col-sm-5">
                                         <select class="form-control selectpicker" multiple
                                                 id="markFieldSelect"></select>
                                     </div>
@@ -414,9 +414,11 @@
                     hideLoading()
                     if (r.success) {
                         $("#modal-create-project").modal('hide')
+                        let msg = r.msg + "<br>"+"导入数据:"+r.importnum+"条;成功:"+r.successnum+"条;失败:"+r.failnum+"条。"
+                        showMsg(msg, 1500);
                         ttable.api().ajax.reload();
                     } else {
-                        showTip(r.msg, 3000)
+                        showMsg(r.msg, 2000)
                     }
                 }
             })
@@ -443,11 +445,11 @@
                         hideLoading()
                         if (r.success) {
                             $("#modal-create-project").modal('hide')
-                            showTip(r.msg, 3000);
+                            let msg = r.msg + "<br>"+"导入数据:"+r.importnum+"条;成功:"+r.successnum+"条;失败:"+r.failnum+"条。"
+                            showMsg(msg, 1500);
                             ttable.api().ajax.reload();
                         } else {
-                            console.log(r.msg)
-                            showMsg(r.msg);
+                            showMsg(r.msg, 2000);
                         }
                     }
                 })
@@ -465,6 +467,7 @@
         $('#rule-edit-name').val(projectmap["s_rulename"])
         $('#dpart-edit-name').val(projectmap["s_departname"])
         $('#edit-person').val(projectmap["s_personname"])
+        $("#markFieldSelect").selectpicker("deselectAll");
         if (projectmap.v_fields !== undefined) {
             $('#markFieldSelect option').each(function(){
                 let v = $(this).val()
@@ -506,7 +509,7 @@
                     "s_rulename": tmp["s_rulename"], "v_fields": tmp["v_fields"], "s_name": tmp["s_name"]},
                 success: function (r) {
                     if (r.success) {
-                        showTip("保存成功", 1000)
+                        showTip("保存成功", 500)
                         cancelModel()
                         ttable.api().ajax.reload();
                     } else {

+ 1 - 1
src/web/templates/project/remark_detail.html

@@ -916,7 +916,7 @@
                         alert("请先保存数据!")
                     } else {
                         if (nextid === "") {
-                            showMsg("数据已经全部标注完")
+                            alert("数据已经全部标注完")
                         } else {
                             window.location.href = "/front/user/remark/detail/?pid="+pid+"&tid="+tid+"&did="+nextid+"&s_sourceinfo="+coll
                         }

+ 6 - 1
src/web/templates/project/remark_jy_list.html

@@ -80,10 +80,14 @@
     let topsubtype = {{ .T.topsubtype }}
     let allfield = {{ .T.allfield }}
 
+    let index = 0
+
     $(function () {
         ttable = $('#dataTable').dataTable({
             "paging": true,
             "lengthChange": false,
+            "processing": true,
+            "pageLength": 20,
             "searching": false,
             "ordering": false,
             "info": true,
@@ -107,7 +111,8 @@
                     ttable.api().page(redirectpage).draw(false);
                 });
                 this.api().column(0).nodes().each(function (cell, i) {
-                    cell.innerHTML = i + 1;
+                    index ++
+                    cell.innerHTML = index;
                 });
             },
             "columns": [

+ 4 - 1
src/web/templates/project/remark_list.html

@@ -57,6 +57,8 @@
         ttable = $('#dataTable').dataTable({
             "paging": true,
             "lengthChange": false,
+            "processing": true,
+            "pageLength": 20,
             "searching": true,
             "ordering": false,
             "info": true,
@@ -80,7 +82,8 @@
                     ttable.api().page(redirectpage).draw(false);
                 });
                 this.api().column(0).nodes().each(function (cell, i) {
-                    cell.innerHTML = index + 1;
+                    index ++
+                    cell.innerHTML = index;
                 });
             },
             "columns": [

+ 1 - 1
src/web/templates/project/task_group_list.html

@@ -115,7 +115,7 @@
                         tmp = '<div>' +
                             '<a class="btn btn-sm btn-primary" href="/front/group/user/task/list?grouptaskid=' + val + '&s_sourceinfo='+row.s_sourceinfo+'">查看</a>&nbsp;&nbsp;' +
                             // '<a class="btn btn-sm btn-warning">分发</a>&nbsp;&nbsp;' +
-                            '<a class="btn btn-sm btn-primary" href="/front/user/check/data?pid='+row.s_projectid+'&tid=' + val + '&s_sourceinfo='+row.s_sourceinfo+'">质检</a>&nbsp;&nbsp;' +
+                            '<a class="btn btn-sm btn-primary" href="/front/user/check/data?pid='+row.s_projectid+'&tid='+val+'&s_sourceinfo='+row.s_sourceinfo+'&stype=group">质检</a>&nbsp;&nbsp;' +
                             // '<a class="btn btn-sm btn-primary">质检结果</a>&nbsp;&nbsp;' +
                             '<a class="btn btn-sm btn-primary" onclick="deliverTask(\'' + val + '\',\'' + row.s_status + '\')">交付</a>&nbsp;&nbsp;' +
                             '</div>';