jiaojiao7 %!s(int64=4) %!d(string=hai) anos
pai
achega
969c2ef977

+ 18 - 6
src/client/client.go

@@ -39,7 +39,6 @@ func (this *Client) Index() {
 	// if (*data)["i_state"] == 1 {
 	tagRule, _ := Mgo.Find("eusertagrule", map[string]interface{}{"s_userid": id, "b_delete": false}, nil, nil, false, -1, -1)
 	this.T["tagrule"] = *tagRule
-	log.Println(tagRule)
 	appid := qu.ObjToString((*data)["s_appid"])
 	mails, _ := MgoCus.FindOneByField("user", map[string]interface{}{"appid": appid}, `{"mails":1,"username":1}`)
 	this.T["mails"] = mails
@@ -123,12 +122,25 @@ func (c *Client) CuserRuleDel() {
 func (c *Client) DepartDel() {
 	defer qu.Catch()
 	_id := c.GetString("id")
-	set := bson.M{
-		"$set": bson.M{
-			"b_delete": true,
-		},
+	ids := strings.Split(_id, ",")
+	update := [][]map[string]interface{}{}
+	for _, v := range ids {
+		idAndSet := []map[string]interface{}{}
+		idAndSet = append(idAndSet, bson.M{"_id": mongoutil.StringTOBsonId(v)}) //查询条件
+		idAndSet = append(idAndSet, bson.M{"$set": bson.M{"b_delete": true}})   //修改的数据
+		update = append(update, idAndSet)
+		/*update = append(update, []map[string]interface{}{
+			map[string]interface{}{
+				"_id": mongoutil.StringTOBsonId(v),
+			},
+			map[string]interface{}{
+				"$set": map[string]interface{}{
+					"b_delete": true,
+				},
+			},
+		})*/
 	}
-	b := Mgo.UpdateById("cuserdepart", _id, set)
+	b := Mgo.UpdateBulk("cuserdepart", update...)
 	c.ServeJson(map[string]interface{}{
 		"rep": b,
 	})

+ 2 - 2
src/web/templates/client/cuser_rule_create.html

@@ -337,13 +337,13 @@
                                             </script>
                                         </div>
                                     </div>
-                                    <hr>
+                                    {{/*<hr>
                                     <div id="es_div" class="form-group" style="display: none">
                                         <label class="col-sm-2 control-label">ES语句</label>
                                         <div class="col-sm-8">
                                             <textarea class="form-control" id="estxt" readonly></textarea>
                                         </div>
-                                    </div>
+                                    </div>*/}}
                                 </div>
                             </div>
                         </form>

+ 10 - 1
src/web/templates/client/index.html

@@ -465,6 +465,7 @@
     function singleSelect1(obj) {
         var tag = true;
         selectIndex.length = 0;
+        console.log("222", selectIndex.length)
         $('input[name="ckb-depart"]').each(function () {
             if (this.checked) {
                 keyTableChecked = true;
@@ -569,7 +570,15 @@
                     var j = selectIndex[i] - 1;
                     tmp.push(j)
                 }
-                var did = departArr[tmp[0]]._id
+                var did = "";
+                for (var i = 0; i < tmp.length; i++) {
+                    if (i === tmp.length - 1) {
+                        did += departArr[tmp[i]]._id
+                    } else {
+                        did += departArr[tmp[i]]._id + ","
+                    }
+                }
+                console.log(did)
                 var bol = false
                 $.ajax({
                     url: "/client/depart/del",