Jianghan 3 vuotta sitten
vanhempi
commit
0ab7cb40f6

+ 9 - 1
src/front/group.go

@@ -102,6 +102,7 @@ func (f *Front) GroupTaskListByAdmin() {
 				map[string]interface{}{"s_entname": map[string]interface{}{"$regex": search}},
 				map[string]interface{}{"s_rulename": map[string]interface{}{"$regex": search}},
 				map[string]interface{}{"s_departname": map[string]interface{}{"$regex": search}},
+				map[string]interface{}{"s_groupname": map[string]interface{}{"$regex": search}},
 			}
 		}
 		qu.Debug("Query:", query)
@@ -213,7 +214,7 @@ func (f *Front) GroupTaskDeliver() {
 	msg := ""
 	groupTaskId := f.GetString("taskid") //用户组任务id
 	qu.Debug("Group Task ID:", groupTaskId)
-	groupTask, _ := util.Mgo.FindById(util.TASKCOLLNAME, groupTaskId, map[string]interface{}{"v_sonids": 1, "s_sourceinfo": 1})
+	groupTask, _ := util.Mgo.FindById(util.TASKCOLLNAME, groupTaskId, map[string]interface{}{"v_sonids": 1, "s_sourceinfo": 1, "s_projectid": 1})
 	if groupTask != nil && len(*groupTask) > 0 {
 		sonUserIds := (*groupTask)["v_sonids"].([]interface{})
 		if len(sonUserIds) > 0 {
@@ -247,6 +248,13 @@ func (f *Front) GroupTaskDeliver() {
 	} else {
 		msg = "查询任务失败"
 	}
+	// 项目下的数据全部完成,项目中打上标记b_iscomplete
+	sourinfo := qu.ObjToString((*groupTask)["s_sourceinfo"])
+	pid := qu.ObjToString((*groupTask)["s_projectid"])
+	info, _ := util.Mgo.FindOneByField(sourinfo, map[string]interface{}{"b_istag": false}, map[string]interface{}{"s_status": 1})
+	if len(*info) == 0 {
+		util.Mgo.UpdateById(util.PROJECTCOLLNAME, pid, map[string]interface{}{"$set": map[string]interface{}{"b_iscomplete": true}})
+	}
 	f.ServeJson(map[string]interface{}{"success": success, "msg": msg})
 }
 

+ 11 - 3
src/front/remark.go

@@ -544,7 +544,9 @@ func GetNextDataId(id, coll, tid string) string {
 		qu.Debug(nextIdQuery)
 		one, _ = util.Mgo.Find(coll, nextIdQuery, `{"_id":1}`, `{"_id":1}`, true, 0, 1)
 		if len(*one) == 1 && len((*one)[0]) > 0 {
-			qu.Debug((*one))
+			if mgo.BsonIdToSId((*one)[0]["_id"]) == id {
+				return ""
+			}
 			return mgo.BsonIdToSId((*one)[0]["_id"])
 		}
 	}
@@ -573,6 +575,9 @@ func GetNextDataId1(id, coll, tid string) string {
 		delete(nextIdQuery, "_id")
 		one, _ = util.Mgo.Find(coll, nextIdQuery, `{"_id":1}`, `{"_id":1}`, true, 0, 1)
 		if len(*one) == 1 && len((*one)[0]) > 0 {
+			if mgo.BsonIdToSId((*one)[0]["_id"]) == id {
+				return ""
+			}
 			return mgo.BsonIdToSId((*one)[0]["_id"])
 		}
 	}
@@ -947,11 +952,11 @@ func (f *Front) CheckResult() {
 	sourceinfo := f.GetString("s_sourceinfo")
 	stype := f.GetString("stype")
 	datatype, _ := f.GetInteger("datatype")
-	task, _ := util.Mgo.FindById(util.TASKCOLLNAME, tid, map[string]interface{}{"i_givenum": 1})
+	var allNum int
 	projcet, _ := util.Mgo.FindById(util.PROJECTCOLLNAME, pid, map[string]interface{}{"v_fields": 1})
 	//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})
-	allNum := (*task)["i_givenum"]          //任务数据量
+
 	markNum, checkNum, checkNumR := 0, 0, 0 // 标注数量,	审核数据量,	审核数据完全正确的数据量
 	cmaps := make(map[string]int)           // 标注字段整体准确率
 	umaps := make(map[string]interface{})   // 按人员 字段准确率
@@ -962,6 +967,7 @@ func (f *Front) CheckResult() {
 	defer util.Mgo.DestoryMongoConn(sess)
 	query := make(map[string]interface{})
 	if tid == "" {
+		allNum = util.Mgo.Count(util.PROJECTCOLLNAME, map[string]interface{}{"b_check": true})
 		query1 := make(map[string]interface{})
 		if stype == "all" {
 			query1["i_ckdata"] = 2
@@ -981,6 +987,8 @@ func (f *Front) CheckResult() {
 		}
 		f.T["taskNum"] = util.Mgo.Count(sourceinfo, query1)
 	} else {
+		task, _ := util.Mgo.FindById(util.TASKCOLLNAME, tid, map[string]interface{}{"i_givenum": 1})
+		allNum = qu.IntAll((*task)["i_givenum"]) //任务数据量
 		if stype == "group" {
 			query["s_grouptaskid"] = tid
 		} else {

+ 8 - 8
src/front/user.go

@@ -46,14 +46,14 @@ func (f *Front) Login() {
 			})
 			return
 		}
-		//if !captcha.VerifyString(code, imgCode) {
-		//	qu.Debug("图片验证码错误-%s \n", username)
-		//	f.ServeJson(map[string]interface{}{
-		//		"checked":  false,
-		//		"message": "图片验证码错误",
-		//	})
-		//	return
-		//}
+		if !captcha.VerifyString(code, imgCode) {
+			qu.Debug("图片验证码错误-%s \n", username)
+			f.ServeJson(map[string]interface{}{
+				"checked": false,
+				"message": "图片验证码错误",
+			})
+			return
+		}
 		query := map[string]interface{}{
 			"s_login":    username,
 			"s_password": passwordEn,

+ 14 - 13
src/web/templates/project/check_detail.html

@@ -281,7 +281,7 @@
                                                 <div v-for="(uin, uindex) of two.uInput" class="input-box"
                                                      :key="uin.title">
                                                     <div class="label" v-if="uin.selectArr">
-                                                        <span>[[uin.title]]&nbsp;:&nbsp;</span>
+                                                        <span><span v-if="allCheckFields[uin.key]">*</span>[[uin.title]]&nbsp;:&nbsp;</span>
                                                         <select v-model="uin.select"
                                                                 @change="focusFn(uin, oindex,index,uindex, two, one)">
                                                             <option disabled value="">请选择</option>
@@ -299,7 +299,7 @@
                                                         </div>
                                                     </div>
                                                     <div class="label" v-else :title="uin.input">
-                                                        <span @click="goText(uin.title)">[[uin.title]]&nbsp;:&nbsp;</span>
+                                                        <span @click="goText(uin.title)"><span v-if="allCheckFields[uin.key]" style="color: red">*</span>[[uin.title]]&nbsp;:&nbsp;</span>
                                                         <input type="text" v-model="uin.input"
                                                                @focus="goText(uin.input)" @click="goText(uin.input)"
                                                                @blur="focusFn(uin, oindex, index, uindex,two,one)">
@@ -758,6 +758,7 @@
             // pageHtml: `{{Html (Regexp (Regexp .T.info.detail "(\\n|\\\\n)\\s+" "\n") "(`|\\n|\\\\n)+" "<br/>")}}`,
             pageHtml: '{{ .T.info.detail }}',
             showPop: false,
+            allCheckFields: allCheckFields,
             editData:[{
                 title: '基本字段',
                 show: true,
@@ -1253,17 +1254,6 @@
                 },
                 //验证保存提示
                 open:function (stype) {
-                    this.$confirm('是否保存?', '提示', {
-                        confirmButtonText: '确定',
-                        cancelButtonText: '取消',
-                        type: 'warning'
-                    }).then(() => {
-                        this.upChange(stype)
-                    }).catch(() => {
-                    });
-                },
-                //保存事件
-                upChange: function (stype) {
                     var noTagKey = [];
                     this.editData.filter(function (one) {
                         if (one.title === "标的信息" || one.title === "多包信息" || one.title === "中标候选人信息") {
@@ -1375,6 +1365,17 @@
                         this.$alert("未标注完成");
                         return
                     }
+                    this.$confirm('是否保存?', '提示', {
+                        confirmButtonText: '确定',
+                        cancelButtonText: '取消',
+                        type: 'warning'
+                    }).then(() => {
+                        this.upChange(stype)
+                    }).catch(() => {
+                    });
+                },
+                //保存事件
+                upChange: function (stype) {
                     var d = JSON.stringify(this.editData);
                     var _this = this
                     $.ajax({

+ 20 - 8
src/web/templates/project/project_list.html

@@ -155,7 +155,7 @@
                                 <div class="form-group">
                                     <label class="col-sm-3 control-label"><span style="color:red;">* </span>数据表名</label>
                                     <div class="col-sm-5">
-                                        <input type="text" class="form-control" id="coll-save-name" placeholder="数据表名">
+                                        <input type="text" class="form-control" onkeyup="value=value.replace(/[^a-zA-Z]/g,'')" id="coll-save-name" placeholder="数据表名">
                                     </div>
                                 </div>
                             </div>
@@ -318,13 +318,25 @@
                 },
                 {
                     "data": "_id", width: "11%", render: function (val, a, row, pos) {
-                        tmp = '<div>' +
-                            '<a class="btn btn-sm btn-primary" onclick="editPro(\'' + pos.row + '\')">编辑</a>&nbsp;&nbsp;' +
-                            '<a class="btn btn-sm btn-primary" onclick="clearPro(\''+ pos.row +'\')">清洗</a>&nbsp;&nbsp;' +
-                            '<a class="btn btn-sm btn-primary" onclick="checkMethod(\'' + val + '\',\''+row.s_sourceinfo+'\',\'' + row.s_status + '\')">质检</a>&nbsp;&nbsp;' +
-                            // '<a class="btn btn-sm btn-primary" href="">质检结果</a>&nbsp;&nbsp;' +
-                            '<a class="btn btn-sm btn-primary" onclick="completePro(\'' + val + '\',\''+row.s_sourceinfo+'\',\'' + row.s_status + '\')">完成</a>&nbsp;&nbsp;' +
-                            '</div>';
+                        let tmp = "";
+                        if (row.b_iscomplete) {
+                            tmp = '<div>' +
+                                '<a class="btn btn-sm btn-primary" onclick="editPro(\'' + pos.row + '\')">编辑</a>&nbsp;&nbsp;' +
+                                '<a class="btn btn-sm btn-primary" onclick="clearPro(\''+ pos.row +'\')">查看</a>&nbsp;&nbsp;' +
+                                '<a class="btn btn-sm btn-primary" onclick="checkMethod(\'' + val + '\',\''+row.s_sourceinfo+'\',\'' + row.s_status + '\')">质检</a>&nbsp;&nbsp;' +
+                                // '<a class="btn btn-sm btn-primary" href="">质检结果</a>&nbsp;&nbsp;' +
+                                '<a class="btn btn-sm btn-primary" onclick="completePro(\'' + val + '\',\''+row.s_sourceinfo+'\',\'' + row.s_status + '\')">完成</a>&nbsp;&nbsp;' +
+                                '</div>';
+                        }else {
+                            tmp = '<div>' +
+                                '<a class="btn btn-sm btn-primary" onclick="editPro(\'' + pos.row + '\')">编辑</a>&nbsp;&nbsp;' +
+                                '<a class="btn btn-sm btn-primary" onclick="clearPro(\''+ pos.row +'\')">清洗</a>&nbsp;&nbsp;' +
+                                '<a class="btn btn-sm btn-primary" onclick="checkMethod(\'' + val + '\',\''+row.s_sourceinfo+'\',\'' + row.s_status + '\')">质检</a>&nbsp;&nbsp;' +
+                                // '<a class="btn btn-sm btn-primary" href="">质检结果</a>&nbsp;&nbsp;' +
+                                '<a class="btn btn-sm btn-primary" onclick="completePro(\'' + val + '\',\''+row.s_sourceinfo+'\',\'' + row.s_status + '\')">完成</a>&nbsp;&nbsp;' +
+                                '</div>';
+                        }
+
                         return tmp
                     }
                 }

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

@@ -282,7 +282,7 @@
                                                 <div v-for="(uin, uindex) of two.uInput" class="input-box"
                                                      :key="uin.title">
                                                     <div class="label" v-if="uin.selectArr">
-                                                        <span>[[uin.title]]&nbsp;:&nbsp;</span>
+                                                        <span><span v-if="allCheckFields[uin.key]">*</span>[[uin.title]]&nbsp;:&nbsp;</span>
                                                         <select v-model="uin.select"
                                                                 @change="focusFn(uin, oindex,index,uindex, two, one)">
                                                             <option disabled value="">请选择</option>
@@ -296,11 +296,10 @@
                                                             <!--<div :class="{err: uin.status == '0'}" @click="uin.status = '0'"></div>-->
                                                             <div class="add-tip" @click="setStatus(uin,'2', two, one)"
                                                                  :class="{err: (uin.status != '1' && uin.status != '-1')}"></div>
-
                                                         </div>
                                                     </div>
                                                     <div class="label" v-else :title="uin.input">
-                                                        <span @click="goText(uin.title)">[[uin.title]]&nbsp;:&nbsp;</span>
+                                                        <span @click="goText(uin.title)"><span v-if="allCheckFields[uin.key]" style="color: red">*</span>[[uin.title]]&nbsp;:&nbsp;</span>
                                                         <input type="text" v-model="uin.input"
                                                                @focus="goText(uin.input)" @click="goText(uin.input)"
                                                                @blur="focusFn(uin, oindex, index, uindex,two,one)">
@@ -758,6 +757,7 @@
             // pageHtml: `{{Html (Regexp (Regexp .T.info.detail "(\\n|\\\\n)\\s+" "\n") "(`|\\n|\\\\n)+" "<br/>")}}`,
             pageHtml: '{{ .T.info.detail }}',
             showPop: false,
+            allCheckFields: allCheckFields,
             editData:[{
                 title: '基本字段',
                 show: true,
@@ -1253,17 +1253,6 @@
                 },
                 //验证保存提示
                 open:function (stype) {
-                    this.$confirm('是否保存?', '提示', {
-                        confirmButtonText: '确定',
-                        cancelButtonText: '取消',
-                        type: 'warning'
-                    }).then(() => {
-                        this.upChange(stype)
-                    }).catch(() => {
-                    });
-                },
-                //保存事件
-                upChange: function (stype) {
                     var noTagKey = [];
                     console.log(allCheckFields)
                     this.editData.filter(function (one) {
@@ -1382,6 +1371,17 @@
                         this.$alert("未做任何修改");
                         return;
                     }
+                    this.$confirm('是否保存?', '提示', {
+                        confirmButtonText: '确定',
+                        cancelButtonText: '取消',
+                        type: 'warning'
+                    }).then(() => {
+                        this.upChange(stype)
+                    }).catch(() => {
+                    });
+                },
+                //保存事件
+                upChange: function (stype) {
                     if (tid === "") {
                         $.ajax({
                             url: "/front/data/jyuser/mark",

+ 5 - 0
src/web/templates/project/task_detail.html

@@ -9,9 +9,14 @@
             <small></small>
         </h1>
         <ol class="breadcrumb">
+            {{if .T.pid}}
             <li><a href="/front/project"><i class="fa fa-dashboard"></i> 项目列表</a></li>
             <li><a href="/front/project/task/list?pid={{ .T.pid }}"><i class="fa fa-dashboard"></i> 项目分发</a></li>
             <li><a href="#"><i class="fa fa-dashboard"></i> 任务分发</a></li>
+            {{else}}
+            <li><a href="/front/group/task/list"><i class="fa fa-dashboard"></i> 任务分发</a></li>
+            <li><a href="#"><i class="fa fa-dashboard"></i> 用户任务分发</a></li>
+            {{end}}
         </ol>
     </section>
     <!-- Main content -->