Jianghan пре 3 година
родитељ
комит
84a3efded4

+ 36 - 18
src/front/remark.go

@@ -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
@@ -602,12 +622,11 @@ func (f *Front) CheckData() {
 		if tid != "" {
 			// 任务数据质检
 			query["b_istag"] = true
-			query["s_grouptaskid"] = tid
+			query["s_usertaskid"] = 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,7 +640,7 @@ 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}
+		field := map[string]interface{}{"title": 1, "v_baseinfo": 1, "b_check": 1, "i_ckdata": 1, "s_login": 1}
 		info, _ := util.Mgo.Find(sourceinfo, query, `{"_id": 1}`, field, false, start, limit)
 		count := util.Mgo.Count(sourceinfo, query)
 		qu.Debug(query, sourceinfo, count)
@@ -633,28 +652,27 @@ 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 := 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
 		}
@@ -707,7 +725,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)
 }
 

+ 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

+ 12 - 4
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>
@@ -64,6 +64,8 @@
     let pid = {{ .T.pid }}
     let sourceinfo = {{ .T.sourceinfo }}
 
+    let index = 0
+
     $(function () {
         ttable = $('#dataTable').dataTable({
             "paging": true,
@@ -91,13 +93,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
                         }

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

@@ -80,6 +80,8 @@
     let topsubtype = {{ .T.topsubtype }}
     let allfield = {{ .T.allfield }}
 
+    let index = 0
+
     $(function () {
         ttable = $('#dataTable').dataTable({
             "paging": true,
@@ -107,7 +109,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": [

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

@@ -80,7 +80,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": [