浏览代码

Merge branch 'develop' of 192.168.3.17:zhanghongbo/qfw into develop

李广朋 9 年之前
父节点
当前提交
659a687f7a

+ 17 - 9
core/src/qfw/yellowpage/yellowpagemanager.go

@@ -238,23 +238,28 @@ func (yp *Yellowpage) EnterpriseInfo(id string) error {
 			if relflag {
 				if d, err := json.Marshal(relation["nodes"]); err == nil && json.Unmarshal(d, &nodes) == nil && len(*nodes) > 0 {
 					//相关企业
-					var regNos []string
+					var entmids []ObjectId
 					for _, v := range *nodes {
-						if v["type"] == "e" {
-							regNos = append(regNos, v["name"].(string))
-						}
-						if len(regNos) == 6 {
-							break
+						if v["type"] == "e" && v["entmid"] != nil && v["entmid"].(string) != "" {
+							entmids = append(entmids, ObjectIdHex(v["entmid"].(string)))
 						}
 					}
-					if len(regNos) > 0 {
-						relevantEnts := Find("enterprise", M{"RegNo": M{"$in": regNos}}, nil, `{"s_avatar":1,"RegNo":1,"EntName":1}`, false, -1, -1)
+					if len(entmids) > 0 {
+						relevantEnts := Find("enterprise", M{"_id": M{"$in": entmids}}, nil, `{"s_avatar":1,"RegNo":1,"EntName":1}`, false, -1, -1)
 						if relevantEnts != nil && len(*relevantEnts) > 0 {
 							for _, relevantEnt := range *relevantEnts {
 								relevantEnt["_id"] = util.BsonIdToSId(relevantEnt["_id"])
+								for _, node := range *nodes {
+									if node["entmid"] != nil && node["entmid"].(string) == relevantEnt["_id"] {
+										node["haslink"] = true
+										break
+									}
+								}
 							}
 							yp.T["relevantEnts"] = relevantEnts
 						}
+						relation["nodes"] = nodes
+						redis.Put("enterprise", "relation-"+regNo, relation, 7*ONEDAY)
 					}
 				}
 			}
@@ -415,7 +420,8 @@ func storeNode(data *map[string]interface{}, ls *list.List, dir /*方向反转*/
 	invopstate, _ := (*data)["invopstate"].(string)
 	regcapcurname, _ := (*data)["regcapcurname"].(string)
 	shortname, _ := (*data)["shortname"].(string)
-	ls.PushBack([]string{invtype, invcerno, invname, entregno, entname, strconv.Itoa(level), fmt.Sprint(invweight), invacconam, fmt.Sprint(regcap), fmt.Sprint(invregcap), legcerno, opstate, invopstate, regcapcurname, util.BsonIdToSId((*data)["_id"]), shortname})
+	entmid := (*data)["entmid"]
+	ls.PushBack([]string{invtype, invcerno, invname, entregno, entname, strconv.Itoa(level), fmt.Sprint(invweight), invacconam, fmt.Sprint(regcap), fmt.Sprint(invregcap), legcerno, opstate, invopstate, regcapcurname, util.BsonIdToSId((*data)["_id"]), shortname, util.BsonIdToSId(entmid)})
 }
 
 func findIndex(code string, arr []interface{}) (index int, mtType string) {
@@ -521,6 +527,7 @@ func makeRelation(mnregno, mnname string) interface{} {
 				"regcapcurname": v[13],
 				"_id":           v[14],
 				"shorttext":     v[15],
+				"entmid":        v[16],
 			}
 		}
 		//加企业
@@ -536,6 +543,7 @@ func makeRelation(mnregno, mnname string) interface{} {
 				"regcapcurname": v[13],
 				"_id":           v[14],
 				"shorttext":     v[15],
+				"entmid":        v[16],
 			}
 		}
 	}

+ 1 - 1
core/src/web/staticres/css/entcommunity.css

@@ -642,7 +642,7 @@ a:focus, a:hover{
     position: absolute;
     display: inline-block;
     border-radius: 4px;
-    width: 80px;
+    width: 110px;
 	height: 25px;
     line-height: 25px;
     text-align: center;

+ 1 - 1
core/src/web/staticres/js/entportrait.js

@@ -195,7 +195,7 @@ function initRelation(){
 								loadJS(cdn+"/js/geometry.js",function(){
 									loadJS(cdn+"/js/provinceData.min.js",function(){
 										loadJS(cdn+"/js/relation.js",function(){
-											relationEntity = new Relation(legcerNo,regNo,regCapCurName,r.relation);
+											relationEntity = new Relation(legcerNo,regNo,regCapCurName,r.relation,r.relation.nodes.length>15);
 											relationEntity.init();
 										});
 									});

+ 9 - 9
core/src/web/staticres/js/relation.js

@@ -1,9 +1,9 @@
-function Relation(legcerNo,regNo,regCapCurName,data){
+function Relation(legcerNo,regNo,regCapCurName,data,modleFlag){
 	this.legcerNo = legcerNo;
 	this.regNo = regNo;
 	this.regCapCurName = regCapCurName;
 	this.data = data;
-	this.modleFlag = data.nodes.length>15;
+	this.modleFlag = modleFlag;
 	this.defaultIsPattern = this.modleFlag;
 	this.zoomlevel = 1;
 	this.w = 0;
@@ -93,10 +93,10 @@ Relation.prototype.init = function(){
 	$("#entrelation-fullscreen").attr("title","进入全屏视图"+((!!window.ActiveXObject || "ActiveXObject" in window)?"":" (F11)"));
 	///////////////////////关系网实例////////////////////////////
 	var htmls="<div style='position:absolute;top:0px;' class='legend'>";
-	htmls= htmls+ "<div class='legend-text-bg' style='margin-top: 10px;'><div style='background-color: #ff9800;opacity: 0.8;'></div><span style='margin-left: 20px;color: #ffffff;'>本企业</span></div>";
-	htmls= htmls+ "<div class='legend-text-bg' style='margin-top: 10px;'><div style='background-color: #ABE6DB;'></div><span style='margin-left: 12px;color: #056351;'>其他企业</span></div>";
-	htmls= htmls+ "<div class='legend-text-bg' style='margin-top: 10px;'><div style='background-color: #2196f3;'></div><span style='margin-left: 25px;color: #ffffff;'>个人</span></div>";
-	htmls= htmls+ "<div class='legend-text-bg' style='margin-top: 10px;margin-bottom: 10px;'><div style='background-color: #afafaf;'></div><span style='margin-left: 5px;color: #ffffff;'>注吊销企业</span></div>";
+	htmls= htmls+ "<div class='legend-text-bg' style='margin-top: 10px;'><div style='background-color: #ff9800;opacity: 0.8;'></div><span style='margin-left: 35px;color: #ffffff;'>本企业</span></div>";
+	htmls= htmls+ "<div class='legend-text-bg' style='margin-top: 10px;'><div style='background-color: #ABE6DB;'></div><span style='margin-left: 27px;color: #056351;'>其他企业</span></div>";
+	htmls= htmls+ "<div class='legend-text-bg' style='margin-top: 10px;'><div style='background-color: #2196f3;'></div><span style='margin-left: 7px;color: #ffffff;'>其他单位和个人</span></div>";
+	htmls= htmls+ "<div class='legend-text-bg' style='margin-top: 10px;margin-bottom: 10px;'><div style='background-color: #afafaf;'></div><span style='margin-left: 20px;color: #ffffff;'>注吊销企业</span></div>";
 	htmls= htmls+ "<div style='position: relative;'><span style='position: absolute;top: 7.5px;width: 25px;height: 5px;background-color: #e2e2e2;'></span><span style='position: absolute;left: 25px;top: 4px;border-top: 6px solid transparent;border-bottom: 6px solid transparent;border-left: 12px solid #e2e2e2;'></span><span style='margin-left: 45px;'>投资关系(股东→企业)</span></div>";
 	htmls= htmls+ "<div style='position: relative;'><span style='position: absolute;top: 7.5px;width: 25px;height: 5px;background-color: #cd93d7;'></span><span style='position: absolute;left: 25px;top: 4px;border-top: 6px solid transparent;border-bottom: 6px solid transparent;border-left: 12px solid #cd93d7;'></span><span style='margin-left: 45px;'>法定代表人</span></div>";
 	//htmls= htmls+ "<div style='margin:10px 0px;' class='hidden-sm hidden-xs'><span class='text-muted'>提示:点击鼠标右键可以删除不想看的节点。</span></div>";
@@ -763,7 +763,7 @@ Relation.prototype.makeRelation = function(){
 		}
 	})
 	.style("cursor",function (d,i){
-		if(d.type == "e"){
+		if(d.type == "e" && d.haslink){
 			return "pointer";
 		}else{
 			return "auto";
@@ -783,8 +783,8 @@ Relation.prototype.makeRelation = function(){
     	return p.type=="p"?"#ffffff":p.type=="ce"?"#ffffff":"#056351";
 	})
 	.on("click",function (d,i){
-		if(!dragstatus && d.type == "e"){
-			window.open("/enterpriseInfoByRegNO/"+d.name+".html");
+		if(!dragstatus && d.type == "e" && d.haslink){
+			window.open("/enterprise/"+d.entmid+".html");
 		}
 	});
 	thisClass.makeTextBg();

+ 17 - 4
core/src/web/templates/yellowpage/enterpriseinfo.html

@@ -17,12 +17,23 @@
 		<div class="entinfo-cart">
 			<div class="b-com-first">
 				<font class="b-com-title">{{if .T.res.EntName}}{{.T.res.EntName}}{{end}}</font>
-				{{if .T.res.OpStateName}}
-				<span class="{{if eq .T.res.OpStateName "注销" "吊销"}}ent-status-r{{else}}ent-status-g{{end}}">
+				{{if .T.res.OpState}}
+				<span class="{{if eq .T.res.OpState "07" "08" "11"}}ent-status-r{{else}}ent-status-g{{end}}">
 				<script>
+					var OpState = {{.T.res.OpState}};
 					var OpStateName = {{.T.res.OpStateName}};
-					if(OpStateName.length > 2){
-						OpStateName = OpStateName.substring(0,2);
+					if(OpState == "07"){
+						OpStateName = "注销";
+					}else if(OpState == "08"){
+						OpStateName = "撤销";
+					}else if(OpState == "11"){
+						OpStateName = "吊销";
+					}else if(OpState == "06"){
+						OpStateName = "存续";
+					}else{
+						if(OpStateName.length > 2){
+							OpStateName = OpStateName.substring(0,2);
+						}
 					}
 					document.write(OpStateName);
 				</script>
@@ -476,12 +487,14 @@
 			<div class="b-adver-content">
 				<ul>
 				{{range $k,$v := .T.relevantEnts}}
+					{{if le $k 6}}
 					<li class="cursor-pointer{{if eq $k 0}} margin-0 border-t-0{{end}}" onclick="window.location.href='/enterprise/{{$v._id}}.html'">
 						<div>
 							<img src="{{if $v.s_avatar}}{{$v.s_avatar}}{{else}}null{{end}}" onerror="this.src='{{Msg "seo" "cdn"}}/images/ent-logo.png'">
 							<a href="/enterprise/{{$v._id}}.html">{{$v.EntName}}</a>
 						</div>
 					</li>
+					{{end}}
 				{{end}}
 				</ul>
 				<div class="clearfix"></div>