maxiaoshan 5 years ago
parent
commit
d3035cd13f

+ 1 - 2
src/service/rule_service.go

@@ -337,7 +337,7 @@ func (r *Rule) DemoData() {
 		query := bson.M{
 			"s_dataid": sDataid,
 		}
-		data, _ := Mgo.Find("tagsdata", query, nil, nil, false, start, limit)
+		data, _ := Mgo.Find("tagsdata", query, bson.M{"publishtime": -1}, nil, false, start, limit)
 		count := Mgo.Count("tagsdata", query)
 		r.ServeJson(map[string]interface{}{
 			"data":            data,
@@ -367,7 +367,6 @@ func (r *Rule) DownloadData() {
 	defer qu.Catch()
 	if r.Method() == "POST" {
 		dataId := r.GetString("s_dataid")
-		qu.Debug(dataId)
 		if path := ResponseXlsx(dataId); path == "" {
 			r.ServeJson("内部错误")
 		} else {

+ 8 - 7
src/util/parsxlsx.go

@@ -7,6 +7,7 @@ import (
 	"qfw/util"
 	"strconv"
 	"strings"
+	"time"
 )
 
 const (
@@ -150,10 +151,10 @@ func Parsxlsx(filebyte []byte) (map[string]interface{}, error) {
 }
 var bzpath,gjpath string = "web/res/标准字段包.xlsx","web/res/高级字段包.xlsx"
 
-func ResponseXlsx(dataId string) string {
-	if dataId != "" {
+func ResponseXlsx(id string) string {
+	if id != "" {
 		query := bson.M{
-			"s_dataid": dataId,
+			"_id": bson.ObjectIdHex(id),
 		}
 		data, _ := Mgo.FindOne("tags", query)
 		if (*data) != nil && len(*data) > 0 {
@@ -162,7 +163,7 @@ func ResponseXlsx(dataId string) string {
 				isStandard = false
 			}
 
-			data, _ := Mgo.Find("tagsdata", query, nil, nil, false, -1, -1)
+			data, _ := Mgo.Find("tagsdata", bson.M{"s_dataid":util.ObjToString((*data)["s_dataid"])}, nil, nil, false, -1, -1)
 			if (*data) == nil || len(*data) == 0 {
 				return ""
 			}
@@ -181,7 +182,7 @@ func ResponseXlsx(dataId string) string {
 					row.AddCell().SetValue(v["city"])
 					row.AddCell().SetValue(v["title"])
 					row.AddCell().SetValue(v["subtype"])
-					row.AddCell().SetValue(v["publishtime"])
+					row.AddCell().SetValue(time.Unix(util.Int64All(v["publishtime"]), 0).Format("2006-01-02"))
 					row.AddCell().SetValue(v["buyer"])
 					row.AddCell().SetValue(v["winner"])
 					row.AddCell().SetFloat(util.Float64All(v["bidamount"])/10000)
@@ -210,14 +211,14 @@ func ResponseXlsx(dataId string) string {
 					row.AddCell().SetValue(v["title"])
 					row.AddCell().SetValue(v["subtype"])
 					row.AddCell().SetValue(v["detail"])
-					row.AddCell().SetValue(v["publishtime"])
+					row.AddCell().SetValue(time.Unix(util.Int64All(v["publishtime"]), 0).Format("2006-01-02"))
 					row.AddCell().SetValue(v["href"])
 					row.AddCell().SetValue(v["s_jyhref"])
 					row.AddCell().SetValue(v["projectname"])
 					row.AddCell().SetValue(v["projectscope"])
 					row.AddCell().SetFloat(util.Float64All(v["budget"])/10000)
 					row.AddCell().SetFloat(util.Float64All(v["bidamount"])/10000)
-					row.AddCell().SetValue(v["bidopentime"])
+					row.AddCell().SetValue(time.Unix(util.Int64All(v["bidopentime"]), 0).Format("2006-01-02"))
 					row.AddCell().SetValue(v["buyer"])
 					row.AddCell().SetValue(v["buyerperson"])
 					row.AddCell().SetValue(v["buyertel"])

BIN
src/web/res/fields.xlsx


+ 1 - 2
src/web/templates/com/header.html

@@ -167,7 +167,7 @@
 							<table id="previewData" class="table table-bordered" style="white-space: nowrap">
 								<thead>
 								<tr>
-									<th rowspan="2">序号</th>
+									<th rowspan="2" style="align-content: center">序号</th>
 									<th rowspan="2">关键词</th>
 									<th rowspan="2">省份</th>
 									<th rowspan="2">城市</th>
@@ -180,7 +180,6 @@
 									<th rowspan="2">项目范围</th>
 									<th rowspan="2">预算金额<br>(万元)</th>
 									<th rowspan="2">中标金额<br>(万元)</th>
-									<th rowspan="2">中标单位</th>
 									<th rowspan="2">开标日期</th>
 									<th colspan="3">采购单位信息</th>
 									<th rowspan="2">招标代理机构</th>

+ 105 - 59
src/web/templates/private/rule_create.html

@@ -945,44 +945,71 @@
                 },
                 "columns": [
                     {"data": null, width: "2%"},
-                    {"data": "s_matchkey", width: "8%"},
-                    {"data": "title", width: "5%"},
-                    {"data": "s_jyhref", width: "5%"},
-                    {"data": "subtype", width: "4%", render: function(val) {
-                            if (val == undefined) {
-                                val = ""
+                    {"data": function(row) {
+                            if (row.s_keymatch != undefined) {
+                                return row.s_keymatch
+                            }else {
+                                return ""
                             }
-                            return val
-                        }},
-                    {"data": "area", width: "4%", render: function(val) {
-                            if (val == undefined) {
-                                val = ""
+                        }, width: "8%"},
+                    {"data": function(row) {
+                            if (row.area != undefined) {
+                                return row.area
+                            }else {
+                                return ""
                             }
-                            return val
-                        }},
-                    {"data": "city", width: "4%", render: function(val) {
-                            if (val == undefined) {
-                                val = ""
+                        }, width: "4%"},
+                    {"data": function(row) {
+                            if (row.city != undefined) {
+                                return row.city
+                            }else {
+                                return ""
                             }
-                            return val
-                        }},
-                    {"data": "publishtime", width: "4%", render: function(val) {
+                        }, width: "4%"},
+                    {"data": function (row) {
+                            if (row.s_jyhref != undefined) {
+                                tmp = '<a class="" target="_blank" href='+row.s_jyhref+'>'+row.title+'</a>';
+                                return tmp
+                            }else {
+                                return row.title
+                            }
+                        }, width: "5%"},
+                    {"data": function(row) {
+                            if (row.subtype != undefined) {
+                                return row.subtype
+                            }else {
+                                return ""
+                            }
+                        }, width: "4%"},
+                    {"data": function (row) {
+                            var str = com.trimStr(row.detail);
+                            if (str.length > 14) {
+                                return str.substring(0, 14) + "..."
+                            }else {
+                                return str
+                            }
+                        }, width: "5%"},
+                    {"data": function(row) {
                             var dt = new Date();
-                            dt.setTime(parseInt(val)*1000);
+                            dt.setTime(parseInt(row.publishtime)*1000);
                             return dt.format("yyyy-MM-dd hh:mm:ss")
-                        }},
-                    {"data": "buyer", width: "3%", render: function (val) {
-                            if (val == undefined) {
-                                val = ""
+                        }, width: "4%"},
+                    {"data": function (row) {
+                            if (row.href != undefined) {
+                                var shref = row.href;
+                                tmp = '<a class="" target="_blank" href='+shref+'>公告地址</a>';
+                                return tmp
+                            }else {
+                                return ""
                             }
-                            return val
-                        }},
-                    {"data": "winner", width: "3%", render: function (val) {
-                            if (val == undefined) {
-                                val = ""
+                        }, width: "5%"},
+                    {"data": "projectname", width: "5%"},
+                    {"data": function (row) {
+                            if (row.projectscope != undefined) {
+                                return row.projectscope
                             }
-                            return val
-                        }},
+                            return ""
+                        }, width: "3%"},
                     {"data": "budget", width: "3%", render: function (val) {
                             if (val == undefined) {
                                 val = ""
@@ -1004,54 +1031,73 @@
                                 return ""
                             }
                         }},
-                    {"data": "projectname", width: "5%"},
-                    {"data": "projectscope", width: "3%", render: function (val) {
+                    {"data": "buyer", width: "3%", render: function (val) {
                             if (val == undefined) {
                                 val = ""
                             }
                             return val
                         }},
-                    {"data": "detail", width: "5%"},
-                    {"data": "buyerperson", width: "5%", render: function (val) {
-                            if (val == undefined) {
-                                val = ""
+                    {"data": function (row) {
+                            if (row.buyerperson != undefined) {
+                                return row.buyerperson
+                            }else {
+                                return ""
                             }
-                            return val
-                        }},
-                    {"data": "buyertel", width: "5%", render: function (val) {
-                            if (val == undefined) {
-                                val = ""
+                        }, width: "4%"},
+                    {"data": function (row) {
+                            if (row.buyertel != undefined) {
+                                return row.buyertel
+                            }else {
+                                return ""
                             }
-                            return val
-                        }},
+                        }, width: "4%"},
                     {"data": "agency", width: "5%", render: function (val) {
                             if (val == undefined) {
                                 val = ""
                             }
                             return val
                         }},
-                    {"data": "buyerperson", width: "5%", render: function (val) {
+                    {"data": "winner", width: "3%", render: function (val) {
                             if (val == undefined) {
                                 val = ""
                             }
                             return val
                         }},
-                ],
-                "columnDefs": [
-                    {
-                        "targets": [15],
-                        render: function (data, type, full, meta) {
-                            if (data) {
-                                if (data.length > 10) {
-                                    return com.trimStr(data).substr(0, 14) + " <a href = 'javascript:void(0);' onclick = 'javascript:searchBtn3(\""+data+"\")' >...</a> ";
-                                }else{
-                                    return data;
-                                }
+                    {"data": function (row) {
+                            if (row.winnerperson != undefined) {
+                                return row.winnerperson
                             }else {
-                                return "";
+                                return ""
                             }
-                        }
-                    }
+                        }, width: "4%"},
+                    {"data": function (row) {
+                            if (row.winnertel != undefined) {
+                                return row.winnertel
+                            }else {
+                                return ""
+                            }
+                        }, width: "4%"},
+                    {"data": function (row) {
+                            if (row.legal_person != undefined) {
+                                return row.legal_person
+                            }else {
+                                return ""
+                            }
+                        }, width: "4%"},
+                    {"data": function (row) {
+                            if (row.company_phone != undefined) {
+                                return row.company_phone
+                            }else {
+                                return ""
+                            }
+                        }, width: "4%"},
+                    {"data": function (row) {
+                            if (row.company_email != undefined) {
+                                return row.company_email
+                            }else {
+                                return ""
+                            }
+                        }, width: "4%"},
                 ]
             });
             $('#modal-preview').modal("show");

+ 74 - 46
src/web/templates/private/rule_edit.html

@@ -1001,7 +1001,14 @@
                             return ""
                         }
                     }, width: "4%"},
-                {"data": "title", width: "5%"},
+                {"data": function (row) {
+                        if (row.s_jyhref != undefined) {
+                            tmp = '<a class="" target="_blank" href='+row.s_jyhref+'>'+row.title+'</a>';
+                            return tmp
+                        }else {
+                            return row.title
+                        }
+                    }, width: "5%"},
                 {"data": function(row) {
                         if (row.subtype != undefined) {
                             return row.subtype
@@ -1009,14 +1016,12 @@
                             return ""
                         }
                     }, width: "4%"},
-                {"data": "detail", width: "5%"},
                 {"data": function (row) {
-                        if (row.s_jyhref != undefined) {
-                            var shref = row.s_jyhref;
-                            tmp = '<a class="" target="_blank" href='+shref+'>公告地址</a>';
-                            return tmp
+                        var str = com.trimStr(row.detail);
+                        if (str.length > 14) {
+                            return str.substring(0, 14) + "..."
                         }else {
-                            return ""
+                            return str
                         }
                     }, width: "5%"},
                 {"data": function(row) {
@@ -1024,18 +1029,22 @@
                         dt.setTime(parseInt(row.publishtime)*1000);
                         return dt.format("yyyy-MM-dd hh:mm:ss")
                     }, width: "4%"},
-                {"data": "buyer", width: "3%", render: function (val) {
-                        if (val == undefined) {
-                            val = ""
+                {"data": function (row) {
+                        if (row.href != undefined) {
+                            var shref = row.href;
+                            tmp = '<a class="" target="_blank" href='+shref+'>公告地址</a>';
+                            return tmp
+                        }else {
+                            return ""
                         }
-                        return val
-                    }},
-                {"data": "winner", width: "3%", render: function (val) {
-                        if (val == undefined) {
-                            val = ""
+                    }, width: "5%"},
+                {"data": "projectname", width: "5%"},
+                {"data": function (row) {
+                        if (row.projectscope != undefined) {
+                            return row.projectscope
                         }
-                        return val
-                    }},
+                        return ""
+                    }, width: "3%"},
                 {"data": "budget", width: "3%", render: function (val) {
                         if (val == undefined) {
                             val = ""
@@ -1057,54 +1066,73 @@
                             return ""
                         }
                     }},
-                {"data": "projectname", width: "5%"},
-                {"data": "projectscope", width: "3%", render: function (val) {
-                        if (val == undefined) {
-                            val = ""
-                        }
-                        return val
-                    }},
-                {"data": "buyerperson", width: "5%", render: function (val) {
+                {"data": "buyer", width: "3%", render: function (val) {
                         if (val == undefined) {
                             val = ""
                         }
                         return val
                     }},
-                {"data": "buyertel", width: "5%", render: function (val) {
-                        if (val == undefined) {
-                            val = ""
+                {"data": function (row) {
+                       if (row.buyerperson != undefined) {
+                           return row.buyerperson
+                       }else {
+                           return ""
+                       }
+                    }, width: "4%"},
+                {"data": function (row) {
+                        if (row.buyertel != undefined) {
+                            return row.buyertel
+                        }else {
+                            return ""
                         }
-                        return val
-                    }},
+                    }, width: "4%"},
                 {"data": "agency", width: "5%", render: function (val) {
                         if (val == undefined) {
                             val = ""
                         }
                         return val
                     }},
-                {"data": "buyerperson", width: "5%", render: function (val) {
+                {"data": "winner", width: "3%", render: function (val) {
                         if (val == undefined) {
                             val = ""
                         }
                         return val
                     }},
-            ],
-            "columnDefs": [
-                {
-                    "targets": [7],
-                    render: function (data, type, full, meta) {
-                        if (data) {
-                            console.log("------", data);
-                            if (data.length > 10) {
-                                return com.trimStr(data).substr(0, 14) + " <a href = 'javascript:void(0);' onclick = 'javascript:searchBtn3(\""+data+"\")' >...</a> ";
-                            }else{
-                                return data;
-                            }
+                {"data": function (row) {
+                        if (row.winnerperson != undefined) {
+                            return row.winnerperson
                         }else {
-                            return "";
+                            return ""
                         }
-                    }
-                }
+                    }, width: "4%"},
+                {"data": function (row) {
+                        if (row.winnertel != undefined) {
+                            return row.winnertel
+                        }else {
+                            return ""
+                        }
+                    }, width: "4%"},
+                {"data": function (row) {
+                        if (row.legal_person != undefined) {
+                            return row.legal_person
+                        }else {
+                            return ""
+                        }
+                    }, width: "4%"},
+                {"data": function (row) {
+                        if (row.company_phone != undefined) {
+                            return row.company_phone
+                        }else {
+                            return ""
+                        }
+                    }, width: "4%"},
+                {"data": function (row) {
+                        if (row.company_email != undefined) {
+                            return row.company_email
+                        }else {
+                            return ""
+                        }
+                    }, width: "4%"},
             ]
         });
         $('#modal-preview').modal("show");

+ 1 - 11
src/web/templates/private/rule_list.html

@@ -97,7 +97,7 @@
                       tmp = '<div>' +
                           '<a class="btn btn-sm btn-primary" href="/service/rule/edit?id='+val+'">编辑</a>'+
                           '<a class="btn btn-sm btn-danger" onclick="del(\'' + val + '\')">删除</a>'+
-                          '<a class="btn btn-sm btn-success" onclick="downloadData(\'' + val + '\')">导出</a>'+
+                          '<a class="btn btn-sm btn-success" href="/service/rule/download?s_dataid='+val+'" target="_Blank">导出</a>'+
                           '<a class="btn btn-sm btn-success" onclick=produceData(\'' + val + '\')>生成数据</a>'+
                           '<a class="btn btn-sm btn-warning" onclick="archive(\'' + val + '\')">存档</a>'+
                           '</div>';
@@ -150,16 +150,6 @@
         var href = {{.T.preview_href}} + "?key=" + s_dataid;
         alert(href)
     }
-    function downloadData(s_dataid) {
-        console.log(s_dataid);
-        $.ajax({
-            url:"/service/rule/download",
-            type:"post",
-            data:{"s_dataid": s_dataid},
-            success:function(r){
-            }
-        })
-    }
     function produceData(data) {
         $.ajax({
             url:"/service/rule/produce",