浏览代码

Merge branch 'dev1.4' of http://192.168.3.207:10080/qmx/datatag into dev1.4

jiaojiao7 4 年之前
父节点
当前提交
c7f2b8ce1f

+ 1 - 1
src/service/private_rule.go

@@ -27,7 +27,7 @@ type Rule struct {
 	history xweb.Mapper `xweb:"/service/rule/history"` //变更列表
 
 	downloadData     xweb.Mapper `xweb:"/service/cuser/rule/downloadata"`      //下载数据
-	downloadRule     xweb.Mapper `xweb:"/service/cuser/rule/downloadrule"`     //下载标签
+	downloadRule     xweb.Mapper `xweb:"/service/cuser/rule/downloadrule"`     //下载规则
 	demoData         xweb.Mapper `xweb:"/service/rule/preview"`          //预览数据
 	exportEs         xweb.Mapper `xweb:"/service/rule/exportes"`         //导出es
 }

+ 6 - 2
src/service/second_push.go

@@ -230,10 +230,11 @@ func (s *SecondPush) SecondPushTask() {
 			endtime := qu.Int64All(c["endtime"])
 			if len(c) != 0 && c != nil {
 				if c["dep_rules"] != nil && len(c["dep_rules"].([]interface{})) != 0 {
+					idMap := map[bson.ObjectId]bool{}
 					for _, m := range c["dep_rules"].([]interface{}) {
 						log.Println("ruleid", mongoutil.BsonIdToSId(m.(map[string]interface{})["_id"]))
 						q := bson.M{
-							"ruleid": mongoutil.BsonIdToSId(m.(map[string]interface{})["_id"]),
+							"ruleid":bson.M{"$regex": mongoutil.BsonIdToSId(m.(map[string]interface{})["_id"])},
 							"bget":   1,
 							"createtime": bson.M{
 								"$gte": starttime,
@@ -243,7 +244,10 @@ func (s *SecondPush) SecondPushTask() {
 						d, _ := MgoCus.Find("usermail", q, nil, nil, false, 0, 0)
 						if len(*d) > 0 && d != nil {
 							for _, l := range *d {
-								xlsxArr = append(xlsxArr, l)
+								if _,ok := idMap[l["_id"].(bson.ObjectId)];!ok{
+									idMap[l["_id"].(bson.ObjectId)] = true
+									xlsxArr = append(xlsxArr, l)
+								}
 							}
 						}
 					}

+ 11 - 2
src/util/parsxlsx.go

@@ -234,7 +234,7 @@ func writeMap1(tmp map[string]string, i int, v string) {
 	}
 }
 
-var bzpath, gjpath, rpath string = "web/res/标准字段包%d.xlsx", "web/res/高级字段包%d.xlsx", "web/res/标签导出%d.xlsx"
+var bzpath, gjpath, rpath string = "web/res/标准字段包%d.xlsx", "web/res/高级字段包%d.xlsx", "web/res/%s_%d.xlsx"
 
 func ResponseXlsx_Data(id string) string {
 	if id != "" {
@@ -360,6 +360,7 @@ func ResponseXlsx_Rule(id string) string {
 	defer util.Catch()
 	var data *map[string]interface{}
 	data, _ = Mgo.FindById("cuserdepartrule", id, `{}`)
+
 	if len(*data) == 0 {
 		return ""
 	}
@@ -370,15 +371,22 @@ func ResponseXlsx_Rule(id string) string {
 	}
 	sh := xf.Sheets[0]
 	fields_len := len(export_fields)
+	//
 	for i, r := range sh.Rows {
 		if i == fields_len {
 			break
 		}
+
 		field := export_fields[i] //export_fields值的顺序与模板表一致
 		if field == "i_extfieldstype" {
 			r.AddCell().SetValue(export_extfieldstype[fmt.Sprint((*data)[field])])
 			continue
 		}
+		if field == "s_userid" {
+			userName, _ := Mgo.FindById("cuser", (*data)[field].(string), `{}`)
+			r.AddCell().SetValue((*userName)["s_name"])
+			continue
+		}
 		field_val := ""
 		if strings.HasPrefix(field, "s_") {
 			field_val = util.ObjToString((*data)[field])
@@ -410,7 +418,8 @@ func ResponseXlsx_Rule(id string) string {
 			new_row.AddCell().SetValue(s_subscopeclass)
 		}
 	}
-	fname := fmt.Sprintf(rpath, time.Now().Unix())
+	ruleName := (*data)["s_name"]
+	fname := fmt.Sprintf(rpath, ruleName,time.Now().Unix())
 	xf.Save(fname)
 	return fname
 }

二进制
src/web/res/export_rule.xlsx


+ 1 - 1
src/web/res/js/model.js

@@ -66,7 +66,7 @@ $(function () {
         alr.html(ahtml);    // 复原  
         alr.find('.ok').hide();  
         alr.find('.cancel').hide();  
-        alr.find('.modal-content').width(250);  
+        alr.find('.modal-content').width(300);
         _dialog(options, sec); 
         return {  
             on: function (callback) {

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

@@ -1194,7 +1194,7 @@
     //生成数据
     function produceData() {
         if (dataMap.id == undefined || dataMap.id == "") {
-            alert("请先保存标签");
+            alert("请先保存规则");
             return
         }
         com.maskShow("正在生成数据...");
@@ -1208,7 +1208,7 @@
                     dataMap.i_estotal = r.count;
                     showTip("数据生成成功", 1000);
                 } else if (r.rep===false){
-                    showTip(r.msg, 20000);
+                    showTip(r.msg, 30000);
                 }else {
                     showTip("数据生成失败", 12000);
                 }

+ 1 - 1
src/web/templates/client/cuser_rule_edit.html

@@ -1692,7 +1692,7 @@
                     dataMap.i_estotal = r.count;
                     showTip("数据生成成功", 1000);
                 } else if (r.rep===false){
-                    showTip(r.msg, 20000);
+                    showTip(r.msg, 30000);
                 }else {
                     showTip("数据生成失败", 12000);
                 }

+ 5 - 5
src/web/templates/com/header.html

@@ -33,14 +33,14 @@
 
 <!-- common modal -->  
 <div id="com-alert" class="modal" style="z-index:9999;display: none;" >  
-    <div class="modal-dialog modal-sm">  
-      <div class="modal-content">  
-        <div class="modal-header">  
+    <div class="modal-dialog modal-sm" >
+      <div  class="modal-content" >
+        <div class="modal-header" >
           <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>  
           <h5 class="modal-title"><i class="fa fa-exclamation-circle"></i> [Title]</h5>  
         </div>  
-        <div class="modal-body small">  
-          <p>[Message]</p>  
+        <div class="modal-body small " >
+          <p style="font-size: 14px">[Message]</p>
         </div>  
         <div class="modal-footer" >  
           <button type="button" class="btn btn-default cancel" data-dismiss="modal">[BtnCancel]</button>  

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

@@ -1565,7 +1565,7 @@
     //生成数据
     function produceData() {
         if (dataMap.id == undefined || dataMap.id == "") {
-            alert("请先保存标签");
+            alert("请先保存规则");
             return
         }
         com.maskShow("正在生成数据...");
@@ -1579,7 +1579,7 @@
                     dataMap.i_estotal = r.count;
                     showTip("数据生成成功", 1000);
                 } else if (r.rep===false){
-                    showTip(r.msg, 20000);
+                    showTip(r.msg, 30000);
                 }else {
                     showTip("数据生成失败", 12000);
                 }

+ 1 - 1
src/web/templates/private/cuser_rule_edit.html

@@ -1690,7 +1690,7 @@
                     dataMap.i_estotal = r.count;
                     showTip("数据生成成功", 1000);
                 } else if (r.rep === false) {
-                    showTip(r.msg, 20000);
+                    showTip(r.msg, 30000);
                 } else {
                     showTip("数据生成失败", 12000);
                 }

+ 2 - 2
src/web/templates/private/cuser_rule_history_edit.html

@@ -1471,7 +1471,7 @@
     //生成数据
     function produceData() {
         if (dataMap.id == undefined || dataMap.id == "") {
-            alert("请先保存标签");
+            alert("请先保存规则");
             return
         }
         com.maskShow("正在生成数据...");
@@ -1485,7 +1485,7 @@
                     dataMap.i_estotal = r.count;
                     showTip("数据生成成功", 1000);
                 } else if (r.rep===false){
-                    showTip(r.msg, 20000);
+                    showTip(r.msg, 30000);
                 }else {
                     showTip("数据生成失败", 12000);
                 }

+ 1 - 1
src/web/templates/private/euser_rule_edit.html

@@ -684,7 +684,7 @@
                     dataMap.i_estotal = r.count;
                     showTip("数据生成成功", 1000);
                 } else if (r.rep===false){
-                    showTip(r.msg, 20000);
+                    showTip(r.msg, 30000);
                 }else {
                     showTip("数据生成失败", 12000);
                 }

+ 1 - 1
src/web/templates/private/history_rule_edit.html

@@ -1595,7 +1595,7 @@
                     dataMap.i_estotal = r.count;
                     showTip("数据生成成功", 1000);
                 } else if (r.rep===false){
-                    showTip(r.msg, 20000);
+                    showTip(r.msg, 30000);
                 }else {
                     showTip("数据生成失败", 12000);
                 }