|
@@ -1,25 +1,31 @@
|
|
|
var entType = "企业";
|
|
|
+var relation = null;
|
|
|
+var serviceList = null;
|
|
|
with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];
|
|
|
//解析服务列表
|
|
|
-$(function(){
|
|
|
- //重绘关系网
|
|
|
- try{
|
|
|
- // redraw();
|
|
|
- }catch(e){}
|
|
|
+$(function(){
|
|
|
//联系地址
|
|
|
- if($chiancity){
|
|
|
- setcxSelect();
|
|
|
- var pt=province?($("#provincesel option[value="+province+"]").text()):"";
|
|
|
- var ct=city?($("#citysel option[value="+city+"]").text()):"";
|
|
|
- var at=area?($("#areasel option[value="+area+"]").text()):"";
|
|
|
- //设置地图上显示的位置
|
|
|
- $("#location").attr("value",as1);
|
|
|
- $("#cityname").attr("value",pt.trim()+ct.trim()+at.trim());
|
|
|
- //获取地图的经纬度
|
|
|
- doOptions();
|
|
|
- $("#city_china").text(pt+ct+at+as1);
|
|
|
- }else{
|
|
|
- setcxSelect();
|
|
|
+ if(address){
|
|
|
+ loadJS("/js/jquery.cxselect.js",function(){
|
|
|
+ $('#city_china').cxSelect({
|
|
|
+ selects: ['province', 'city', 'area'],
|
|
|
+ required:0
|
|
|
+ });
|
|
|
+ $.cxSelect.setVal(province,city,area);
|
|
|
+ var pt=province?($("#provincesel option[value="+province+"]").text()):"";
|
|
|
+ var ct=city?($("#citysel option[value="+city+"]").text()):"";
|
|
|
+ var at=area?($("#areasel option[value="+area+"]").text()):"";
|
|
|
+ //设置地图上显示的位置
|
|
|
+ $("#location").attr("value",as1);
|
|
|
+ $("#cityname").attr("value",pt.trim()+ct.trim()+at.trim());
|
|
|
+ //获取地图的经纬度
|
|
|
+ loadJS("http://api.map.baidu.com/getscript?v=2&ak=AFd8b176f363f23e6a23d516f4cfb742&services=&t=20150522093217",function(){
|
|
|
+ loadJS("/js/geocoder.js",function(){
|
|
|
+ doOptions();
|
|
|
+ });
|
|
|
+ });
|
|
|
+ $("#city_china").text(pt+ct+at+as1);
|
|
|
+ });
|
|
|
}
|
|
|
//隐藏地图
|
|
|
$("#fade").click(closeMap);
|
|
@@ -28,14 +34,19 @@ $(function(){
|
|
|
$(".bdsharebuttonbox").show();
|
|
|
});
|
|
|
//切换
|
|
|
- $(".entinfo-tab>li").click(function(){
|
|
|
- $(".entinfo-tab>li").removeClass("entinfo-active");
|
|
|
- $(this).addClass("entinfo-active");
|
|
|
- $(".entinfo-tab-content>div").addClass("hide");
|
|
|
- $(".entinfo-tab-content>div:eq("+$(this).index()+")").removeClass("hide");
|
|
|
+ $(".ent-tab>li").click(function(){
|
|
|
+ $(".ent-tab>li").removeClass("ent-active");
|
|
|
+ $(this).addClass("ent-active");
|
|
|
+ $(".ent-tab-content>div").addClass("hide");
|
|
|
+ $(".ent-tab-content>div:eq("+$(this).index()+")").removeClass("hide");
|
|
|
+ if($(this).index() == 1){
|
|
|
+ b_afterLogin();
|
|
|
+ }else if($(this).index() == 5 && serviceList == null){
|
|
|
+ //加载服务列表
|
|
|
+ serviceList = new ServiceList();
|
|
|
+ }
|
|
|
});
|
|
|
- //加载服务列表
|
|
|
- initServiceList();
|
|
|
+ new ServiceList();
|
|
|
});
|
|
|
//显示地图
|
|
|
function showMap(){
|
|
@@ -51,1111 +62,59 @@ function closeMap(){
|
|
|
document.getElementById('fade').style.display = 'none';
|
|
|
$("html,body").removeClass("overflow-hidden");
|
|
|
}
|
|
|
-//关系网初始化
|
|
|
-function Relation(data){
|
|
|
- this.zoomlevel = 1;
|
|
|
- //关系网的设置
|
|
|
- $("#entrelation-fullscreen").bind("click",initFullScreen);
|
|
|
- var w = parseInt($("#entrelation").css("width").replace("px","")) - 80;
|
|
|
- $("#entrelation-infovis").css("width",w+"px");
|
|
|
- var h = $("#entrelation-infovis").height();
|
|
|
- if($(".entrelation-controlls").length>0){
|
|
|
- $(".entrelation-controlls").css({left:$("#entrelation").width()-$(".entrelation-controlls").width()-30});
|
|
|
- }
|
|
|
- //查找逻辑
|
|
|
- var index=-1;
|
|
|
- var reg = new RegExp(/(有限公司|有限责任公司|股份有限公司|总公司|分公司|公司|事务所|合伙企业)$|\(.*\)|\(.*\)/g);
|
|
|
- /*var provinces = [];
|
|
|
- $.ajax({
|
|
|
- url: "/js/provinceData.min.json",
|
|
|
- dataType: "json",
|
|
|
- cache: true,
|
|
|
- async: false,
|
|
|
- success: function(json){
|
|
|
- provinces = json;
|
|
|
- }
|
|
|
- });*/
|
|
|
- var filterEntName = function(text){
|
|
|
- this.allProvinces = "河南省、青海省、山西省、黑龙江省、安徽省、广西壮族自治区、西藏自治区";
|
|
|
- this.commonReplace = function(t){
|
|
|
- if(t.length > 1 && text.startWith(t)){
|
|
|
- var textCopy = text.replace(new RegExp("^"+t),"");
|
|
|
- if(textCopy.length > 2){
|
|
|
- text = textCopy;
|
|
|
- }
|
|
|
- return true;
|
|
|
- }
|
|
|
- return false;
|
|
|
- };
|
|
|
- this.replaceStart = function(t,f){
|
|
|
- var flag = false;
|
|
|
- var minus = null;
|
|
|
- if(this.commonReplace(t)){//替换省、市、县、区
|
|
|
- return true;
|
|
|
- }
|
|
|
- if(f){//不替换
|
|
|
- flag = false;
|
|
|
- }else if(t.endWith("维吾尔自治区")){
|
|
|
- flag = true;
|
|
|
- minus = 6;
|
|
|
- }else if(t.endWith("回族自治区") || t.endWith("壮族自治区") || t.endWith("特别行政区")){
|
|
|
- flag = true;
|
|
|
- minus = 5;
|
|
|
- }else if(t.endWith("自治州") || t.endWith("自治县") || t.endWith("自治区")){
|
|
|
- flag = true;
|
|
|
- minus = 3;
|
|
|
- }else if(t.endWith("地区")){
|
|
|
- flag = true;
|
|
|
- minus = 2;
|
|
|
- }else if(t.endWith("省") || t.endWith("市") || t.endWith("区")){
|
|
|
- flag = true;
|
|
|
- minus = 1;
|
|
|
- }
|
|
|
- if(flag){
|
|
|
- return this.commonReplace(t.substring(0,t.length-minus));
|
|
|
- }
|
|
|
- return false;
|
|
|
- };
|
|
|
- this.replaceCity = function(citys){
|
|
|
- if(citys){
|
|
|
- for(var c in citys){//市
|
|
|
- var c_name = citys[c].n;
|
|
|
- if(this.replaceStart(c_name)){
|
|
|
- this.replaceAreas(citys[c].s);
|
|
|
- return true;
|
|
|
- }else if(this.replaceAreas(citys[c].s)){
|
|
|
- return true;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- };
|
|
|
- this.replaceAreas = function(areas){
|
|
|
- if(areas){
|
|
|
- for(var a in areas){//县、区
|
|
|
- var a_name = areas[a].n;
|
|
|
- if(this.replaceStart(a_name,true)){
|
|
|
- return true;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- };
|
|
|
- for(var p in provinces){//省
|
|
|
- var p_name = provinces[p].n;
|
|
|
- if(this.allProvinces.indexOf(p_name) == -1){
|
|
|
- continue;
|
|
|
- }
|
|
|
- if(this.replaceStart(p_name)){
|
|
|
- this.replaceCity(provinces[p].s);
|
|
|
- break;
|
|
|
- }else if(this.replaceCity(provinces[p].s)){
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- return text;
|
|
|
- }
|
|
|
- for(var i=0;i<data.nodes.length;i++){
|
|
|
- var nodeObj = data.nodes[i];
|
|
|
- nodeObj.text = $.trim(nodeObj.text);
|
|
|
- nodeObj.shortText = nodeObj.text;
|
|
|
- if(nodeObj.type == "e" || nodeObj.type == "ce"){
|
|
|
- var text = nodeObj.shortText;
|
|
|
- if(text.length > 2){//先替换结尾
|
|
|
- text = text.replace(reg,"");
|
|
|
- }
|
|
|
- if(text.length > 2){//再替换开头
|
|
|
- //text = filterEntName(text);
|
|
|
- }
|
|
|
- if(text.length > 2){//小于两个字符不生效
|
|
|
- nodeObj.shortText = text;
|
|
|
- }
|
|
|
- if(nodeObj.name==regno){//先找本企业位置
|
|
|
- index=i;
|
|
|
- nodeObj["regcap"] = (typeof(d1) == "undefined")?0:d1;
|
|
|
- nodeObj["legcerno"] = legcerno;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- /*********************************连线处理***********************************/
|
|
|
- var minLink=-1,maxLink=-1;
|
|
|
- for(var i=0;i<data.links.length;i++){
|
|
|
- var linkObj = data.links[i];
|
|
|
- if(linkObj.target==index && data.nodes[linkObj.source].name==legcerno){
|
|
|
- //data.nodes[linkObj.source].type="cp";
|
|
|
- linkObj.type = "cp"
|
|
|
- linkObj.isLegal = 1;
|
|
|
- }
|
|
|
- //
|
|
|
- data.nodes[linkObj.target]["istarget"] = 1;
|
|
|
- if(data.nodes[linkObj.source].name == data.nodes[linkObj.target].invlegcerno || data.nodes[linkObj.source].name == data.nodes[linkObj.target].legcerno){
|
|
|
- linkObj.isLegal = 1;
|
|
|
- }
|
|
|
- if(typeof(linkObj.invacconam) == "undefined"){
|
|
|
- continue;
|
|
|
- }
|
|
|
- var invacconam = new Number(linkObj.invacconam);
|
|
|
- if(minLink == -1 && maxLink == -1){
|
|
|
- minLink = invacconam;
|
|
|
- maxLink = invacconam;
|
|
|
- }else if(invacconam > maxLink){
|
|
|
- maxLink = invacconam;
|
|
|
- }else if(invacconam < minLink){
|
|
|
- minLink = invacconam;
|
|
|
- }
|
|
|
- }
|
|
|
- var getLineSectionArray = function(){
|
|
|
- var countSection = 6;
|
|
|
- var section = (maxLink - minLink) / countSection;
|
|
|
- var sectionArr = [];
|
|
|
- for(var i=2;i<=countSection;i++){
|
|
|
- var minVal = minLink;
|
|
|
- if(sectionArr.length > 0){
|
|
|
- minVal = sectionArr[sectionArr.length - 1].maxVal;
|
|
|
- }
|
|
|
- var maxVal = minLink+section*i;
|
|
|
- if(i == countSection){
|
|
|
- maxVal += section;
|
|
|
- }
|
|
|
- var sectionObj = {linkVal:i,minVal:minVal,maxVal:maxVal};
|
|
|
- sectionArr.push(sectionObj);
|
|
|
- }
|
|
|
- return sectionArr;
|
|
|
- }
|
|
|
- /////////////
|
|
|
- var linkSectionArray = getLineSectionArray();
|
|
|
- for(var i=0;i<data.links.length;i++){
|
|
|
- var linksObj = data.links[i];
|
|
|
- linksObj["linkVal"] = 2;
|
|
|
- if(typeof(linkObj.invacconam) == "undefined"){
|
|
|
- continue;
|
|
|
- }
|
|
|
- var invacconam = new Number(linksObj.invacconam);
|
|
|
- for(var s in linkSectionArray){
|
|
|
- var sectionObj = linkSectionArray[s];
|
|
|
- if(invacconam >= sectionObj.minVal && invacconam < sectionObj.maxVal){
|
|
|
- linksObj["linkVal"] = sectionObj.linkVal;
|
|
|
- continue;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- /*********************************节点处理***********************************/
|
|
|
- var minNode=-1,maxNode=-1;
|
|
|
- for(var i=0;i<data.nodes.length;i++){
|
|
|
- var nodeObj = data.nodes[i];
|
|
|
- if(nodeObj.type == "e" || nodeObj.type == "ce"){
|
|
|
- var regcap = nodeObj.regcap;
|
|
|
- if(minNode == -1 && maxNode == -1){
|
|
|
- minNode = regcap;
|
|
|
- maxNode = regcap;
|
|
|
- }else if(regcap > maxNode){
|
|
|
- maxNode = regcap;
|
|
|
- }else if(regcap < minNode){
|
|
|
- minNode = regcap;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- var getNodeSectionArray = function(){
|
|
|
- var countSection = 7;
|
|
|
- var section = (maxNode - minNode) / countSection;
|
|
|
- var sectionArr = [];
|
|
|
- for(var i=1;i<=countSection;i++){
|
|
|
- var minVal = minNode;
|
|
|
- if(sectionArr.length > 0){
|
|
|
- minVal = sectionArr[sectionArr.length - 1].maxVal;
|
|
|
- }
|
|
|
- var maxVal = minNode+section*i;
|
|
|
- if(i == countSection){
|
|
|
- maxVal += section;
|
|
|
- }
|
|
|
- var sectionObj = {nodeVal:6+i,minVal:minVal,maxVal:maxVal};
|
|
|
- sectionArr.push(sectionObj);
|
|
|
- }
|
|
|
- return sectionArr;
|
|
|
+function b_afterLogin(flag){
|
|
|
+ if($(".ent-tab>li:eq(1)").hasClass("ent-active") && relation == null){
|
|
|
+ initRelation();
|
|
|
}
|
|
|
- var nodeSectionArray = getNodeSectionArray();
|
|
|
- for(var i=0;i<data.nodes.length;i++){
|
|
|
- var nodeObj = data.nodes[i];
|
|
|
- nodeObj["nodeVal"] = 7;
|
|
|
- if(nodeObj.type == "e" || nodeObj.type == "ce"){
|
|
|
- var invacconam = new Number(nodeObj.invacconam);
|
|
|
- var regcap = new Number(nodeObj.regcap);
|
|
|
- for(var s in nodeSectionArray){
|
|
|
- var sectionObj = nodeSectionArray[s];
|
|
|
- if(regcap >= sectionObj.minVal && regcap < sectionObj.maxVal){
|
|
|
- nodeObj["nodeVal"] = sectionObj.nodeVal;
|
|
|
- continue;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- //屏蔽鼠标右点击事件
|
|
|
- if(document.getElementById("entrelation-infovis")){
|
|
|
- document.getElementById("entrelation-infovis").oncontextmenu=function(){return false;};
|
|
|
- }
|
|
|
- $("#entrelation-fullscreen").attr("title","进入全屏视图"+((!!window.ActiveXObject || "ActiveXObject" in window)?"":" (F11)"));
|
|
|
- //处理全屏
|
|
|
- function launchFullScreen(element) {
|
|
|
- if(element){
|
|
|
- if (element.requestFullscreen) {
|
|
|
- element.requestFullscreen();
|
|
|
- } else if (element.msRequestFullscreen) {
|
|
|
- element.msRequestFullscreen();
|
|
|
- } else if (element.mozRequestFullScreen) {
|
|
|
- element.mozRequestFullScreen();
|
|
|
- } else if (element.webkitRequestFullscreen) {
|
|
|
- // 对 Chrome 特殊处理,
|
|
|
- // 参数 Element.ALLOW_KEYBOARD_INPUT 使全屏状态中可以键盘输入。
|
|
|
- if ( window.navigator.userAgent.toUpperCase().indexOf( 'CHROME' ) >= 0 ) {
|
|
|
- element.webkitRequestFullScreen( Element.ALLOW_KEYBOARD_INPUT );
|
|
|
- }else {
|
|
|
- // Safari 浏览器中,如果方法内有参数,则 Fullscreen 功能不可用。
|
|
|
- element.webkitRequestFullScreen();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- function cancelFullScreen() {
|
|
|
- h = $("#entrelation-infovis").height();
|
|
|
- $("#entrelation-fullscreen").attr("title","进入全屏视图"+((!!window.ActiveXObject || "ActiveXObject" in window)?"":" (F11)"));
|
|
|
- //force.linkDistance(120).charge(-200).size([w,h]).resume();
|
|
|
- $("#entrelation-infovis").css({width:w,height:h});
|
|
|
- //设置svg标签的宽度与高度
|
|
|
- d3.select("svg").attr("width", w).attr("height", h);
|
|
|
- $(".entrelation-controlls").css({left:$("#entrelation").width()-$(".entrelation-controlls").width()-30});
|
|
|
- if(document.exitFullscreen) {
|
|
|
- document.exitFullscreen();
|
|
|
- } else if (document.msExitFullscreen) {
|
|
|
- document.msExitFullscreen();
|
|
|
- } else if (document.mozCancelFullScreen) {
|
|
|
- document.mozCancelFullScreen();
|
|
|
- } else if (document.webkitExitFullscreen) {
|
|
|
- document.webkitExitFullscreen();
|
|
|
- }
|
|
|
- }
|
|
|
- $(document).on('webkitfullscreenchange mozfullscreenchange msfullscreenchange fullscreenchange', function(){
|
|
|
- if (!document.fullscreenElement && // alternative standard method
|
|
|
- !document.mozFullScreenElement &&
|
|
|
- !document.webkitFullscreenElement &&
|
|
|
- !document.msFullscreenElement ) {
|
|
|
- //退出
|
|
|
- cancelFullScreen();
|
|
|
- });
|
|
|
- var infovisdiv = document.getElementById("entrelation-infovis");
|
|
|
- document.onkeydown=function(event){
|
|
|
- var e = event || window.event || arguments.callee.caller.arguments[0];
|
|
|
- if(e && e.keyCode==122){
|
|
|
- event.preventDefault?event.preventDefault():window.event.returnValue = false;
|
|
|
- if(!!window.ActiveXObject || "ActiveXObject" in window){//ie下F11不能用,屏蔽掉
|
|
|
- if($(".exit").length == 0){
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
- initFullScreen();
|
|
|
- }else if(e && e.keyCode==27){
|
|
|
- event.preventDefault?event.preventDefault():window.event.returnValue = false;
|
|
|
- cancelFullScreen();
|
|
|
- }
|
|
|
- };
|
|
|
- function initFullScreen(){
|
|
|
- var fullscreenElement =
|
|
|
- document.fullscreenElement ||
|
|
|
- document.mozFullScreenElement ||
|
|
|
- document.webkitFullscreenElement ||
|
|
|
- document.msFullscreenElement;
|
|
|
- $(".entrelation-fullscreen").toggleClass("exit");
|
|
|
- if(!fullscreenElement || fullscreenElement==null){
|
|
|
- redrawflag = true;
|
|
|
- $("#entrelation-fullscreen").attr("title","退出全屏视图 (F11)");
|
|
|
- launchFullScreen(infovisdiv);
|
|
|
- var timeout = 100;
|
|
|
- if(!!window.ActiveXObject || "ActiveXObject" in window){
|
|
|
- timeout = 200;
|
|
|
- }
|
|
|
- setTimeout(function(){
|
|
|
- if(force!=undefined){
|
|
|
- //重绘
|
|
|
- var w=document.body.clientWidth;
|
|
|
- var h=document.body.clientHeight;
|
|
|
- //if(w>1200){
|
|
|
- //w= 1200
|
|
|
- //}
|
|
|
- $("#entrelation-infovis").css({width:w,height:h});
|
|
|
- d3.select("svg").attr("width", w).attr("height", h);
|
|
|
- $(".entrelation-controlls").css({left:w-$(".entrelation-controlls").width() - 70});
|
|
|
- force.linkDistance(h).charge(-700).size([w,h]).resume();
|
|
|
- }
|
|
|
-
|
|
|
- },timeout);
|
|
|
- }else{
|
|
|
- cancelFullScreen();
|
|
|
- }
|
|
|
- }
|
|
|
- //计算点之间的距离
|
|
|
- var chargeArray = [[0,10],[10,20],[20,30],[30,40],[40,50],[50,60],[60,70],[70,80],[80,90],[90,100],[100,110]];
|
|
|
- var chargeVal = -1600;
|
|
|
- var nodeCount = data.nodes.length;
|
|
|
- for(var i in chargeArray){
|
|
|
- if(nodeCount >= chargeArray[i][0] && nodeCount < chargeArray[i][1]){
|
|
|
- chargeVal += i*100;
|
|
|
- break;
|
|
|
- }else if(i == chargeArray.length){
|
|
|
- chargeVal += i*100;
|
|
|
- }
|
|
|
- }
|
|
|
- var tick=function (e) {
|
|
|
- lines.attr("d", function(d) {
|
|
|
- var sy = d.source.y,
|
|
|
- x = d.target.x,
|
|
|
- y = d.target.y;
|
|
|
- if(sy > y){
|
|
|
- sy -= 12;
|
|
|
- }else{
|
|
|
- sy += 5;
|
|
|
- }
|
|
|
- var line = new geo.LineSegment(d.source.x, sy, x, y);
|
|
|
- for (var e in d.target.edge) {
|
|
|
- var ix = line.intersect(d.target.edge[e].offset(x, y));
|
|
|
- if (ix.in1 && ix.in2) {
|
|
|
- x = ix.x;
|
|
|
- y = ix.y;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- var dx = x - d.source.x,
|
|
|
- dy = y - sy,
|
|
|
- dr = Math.sqrt(dx * dx + dy * dy),
|
|
|
- theta = Math.atan2(dy, dx) + Math.PI / 7.85,
|
|
|
- d90 = Math.PI / 2,
|
|
|
- dtxs = x - Math.cos(theta),
|
|
|
- dtys = y - Math.sin(theta);
|
|
|
- return "M" + d.source.x + "," + sy + "A" + dr + "," + dr + " 0 0 1," + x + "," + y + "A" + dr + "," + dr + " 0 0 0," + d.source.x + "," + sy + "M" + dtxs + "," + dtys + "l" + (3.5 * Math.cos(d90 - theta) - 10 * Math.cos(theta)) + "," + (-3.5 * Math.sin(d90 - theta) - 10 * Math.sin(theta)) + "L" + (dtxs - 3.5 * Math.cos(d90 - theta) - 10 * Math.cos(theta)) + "," + (dtys + 3.5 * Math.sin(d90 - theta) - 10 * Math.sin(theta)) + "z";
|
|
|
- });
|
|
|
- nodes.attr("transform", function(d) {
|
|
|
- return "translate(" + d.x + "," + d.y + ")scale(" + zoomlevel+ ")";
|
|
|
- });
|
|
|
- }
|
|
|
- var force = d3.layout.force()
|
|
|
- .nodes(data.nodes)
|
|
|
- .links(data.links)
|
|
|
- .size([w, h])
|
|
|
- .linkDistance(function(p){
|
|
|
- return Math.floor(Math.random()*60)+90;
|
|
|
- })
|
|
|
- .chargeDistance(600)
|
|
|
- .charge(chargeVal)
|
|
|
- .linkStrength(1)
|
|
|
- .on('tick',tick);
|
|
|
- var dragstatus = false,
|
|
|
- mouseoverstatus = false;
|
|
|
- var drag = force.drag()
|
|
|
- .on("dragstart",function(d,i){
|
|
|
- d.fixed = true; //拖拽开始后设定被拖拽对象为固定
|
|
|
- d3.event.sourceEvent.stopPropagation(); // Prevent panning
|
|
|
- })
|
|
|
- .on("drag",function(d,i){
|
|
|
- dragstatus = true;
|
|
|
- mouseoverstatus = true;
|
|
|
- })
|
|
|
- .on("dragend",function(d,i){
|
|
|
- mouseoverstatus = false;
|
|
|
- setTimeout(function(){
|
|
|
- dragstatus = false;
|
|
|
- },500)
|
|
|
- });
|
|
|
- function zoomed() {
|
|
|
- svg.attr("transform",
|
|
|
- "translate(" + d3.event.translate + ")scale(" + d3.event.scale + ")");
|
|
|
- }
|
|
|
- //处理缩放
|
|
|
- var zoom = d3.behavior.zoom().scaleExtent([0.4, 10]).on("zoom", zoomed);
|
|
|
- var svg = d3.select("#entrelation-infovis").append("svg:svg")
|
|
|
- .attr("width", w)
|
|
|
- .attr("height", h)
|
|
|
- .call(zoom)
|
|
|
- .append("g");
|
|
|
-
|
|
|
- var lines = svg.append("svg:g")
|
|
|
- .selectAll("path")
|
|
|
- .data(force.links())
|
|
|
- .enter().append("path")
|
|
|
- .style("fill", function(p){
|
|
|
- return (p.type=="cp" || p.isLegal)?"#cd93d7":"#cecece";
|
|
|
- })
|
|
|
- .style("stroke", function(p){
|
|
|
- return (p.type=="cp" || p.isLegal)?"#cd93d7":"#cecece";
|
|
|
- })
|
|
|
- .attr("stroke-width",function (e,i){
|
|
|
- return e.linkVal;
|
|
|
- });
|
|
|
- lines.each(function (d,i){
|
|
|
- var invacconam = new Number(d.invacconam);
|
|
|
- if(invacconam > 0){
|
|
|
- var lenInvacconam = (invacconam + "").length;
|
|
|
- if(lenInvacconam > 4 && (invacconam + "").indexOf(".") > -1 && (lenInvacconam - (invacconam + "").indexOf(".")) > 4){
|
|
|
- invacconam = (new Number(invacconam)).toFixed(4);
|
|
|
- }
|
|
|
- d3.select(this).append("title").text("投资金额:"+invacconam+"万元");
|
|
|
- }
|
|
|
- });
|
|
|
- var nodes = svg.append("svg:g")
|
|
|
- .selectAll(".node")
|
|
|
- .data(force.nodes())
|
|
|
- .enter()
|
|
|
- .append("g")
|
|
|
- .call(force.drag)
|
|
|
- .attr('class', 'node')
|
|
|
- .on('mouseover', function(d) {
|
|
|
- highlightObject(this,true);
|
|
|
- })
|
|
|
- .on('mouseout', function(d) {
|
|
|
- highlightObject(this,false);
|
|
|
- })
|
|
|
- .on("mousedown",function (e,i){
|
|
|
- d3.event.preventDefault();
|
|
|
- removeNode(this);
|
|
|
- });
|
|
|
- nodes.append("rect")
|
|
|
- .attr("rx", 5)
|
|
|
- .attr("ry", 5)
|
|
|
- .attr('height', 20)
|
|
|
- .attr("fill", function(p){
|
|
|
- if(p.type == "e" && (p.opstate == "11" || p.opstate == "07")){
|
|
|
- return "#cecece";
|
|
|
- }
|
|
|
- return p.type=="p"?"#2196f3":p.type=="ce"?"#ff9800":"#cddc39";
|
|
|
- })
|
|
|
- .attr("stroke", function(p){
|
|
|
- if(p.type == "e" && (p.opstate == "11" || p.opstate == "07")){
|
|
|
- return "#cecece";
|
|
|
- }
|
|
|
- return p.type=="p"?"#2196f3":p.type=="ce"?"#ff9800":"#cddc39";
|
|
|
- }).style("opacity",function(p){
|
|
|
- if(p.type=="e" && (p.opstate != "11" || p.opstate != "07")){
|
|
|
- return "0.5";
|
|
|
- }
|
|
|
- return "1";
|
|
|
- });
|
|
|
- nodes.each(function (d,i){
|
|
|
- if(d.type == "ce" || d.type == "e"){
|
|
|
- var title = "";
|
|
|
- if(d.text != d.shortText){
|
|
|
- title = d.text;
|
|
|
- }
|
|
|
- var regcap = d.regcap;
|
|
|
- if(regcap > 0){
|
|
|
- var lenRegcap = (regcap + "").length;
|
|
|
- if(lenRegcap > 4 && (regcap + "").indexOf(".") > -1 && (lenRegcap - (regcap + "").indexOf(".")) > 4){
|
|
|
- regcap = (new Number(regcap)).toFixed(4);
|
|
|
- }
|
|
|
- if(title != ""){
|
|
|
- title += "\n";
|
|
|
- }
|
|
|
- title += "注册资本:"+regcap+"万元";
|
|
|
- }
|
|
|
- if(title != ""){
|
|
|
- d3.select(this).append("title").text(title);
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- nodes.append('text')
|
|
|
- .text(function(d){
|
|
|
- return d.shortText;
|
|
|
- })
|
|
|
- .style("cursor",function (d,i){
|
|
|
- if(d.type == "e"){
|
|
|
- return "pointer";
|
|
|
- }else{
|
|
|
- return "auto";
|
|
|
- }
|
|
|
- })
|
|
|
- .on("click",function (d,i){
|
|
|
- if(!dragstatus && d.type == "e"){
|
|
|
- window.open("/enterpriseInfoByRegNO/"+d.name+".html");
|
|
|
- }
|
|
|
- });
|
|
|
- setTimeout(function() {
|
|
|
- nodes.each(function(d) {
|
|
|
- var node = d3.select(this),
|
|
|
- text = node.selectAll('text'),
|
|
|
- bounds = {},
|
|
|
- first = true;
|
|
|
-
|
|
|
- text.each(function() {
|
|
|
- var box = this.getBBox();
|
|
|
- if (first || box.x < bounds.x1) {
|
|
|
- bounds.x1 = box.x;
|
|
|
- }
|
|
|
- if (first || box.y < bounds.y1) {
|
|
|
- bounds.y1 = box.y;
|
|
|
- }
|
|
|
- if (first || box.x + box.width > bounds.x2) {
|
|
|
- bounds.x2 = box.x + box.width;
|
|
|
- }
|
|
|
- if (first || box.y + box.height > bounds.y2) {
|
|
|
- bounds.y2 = box.y + box.height;
|
|
|
- }
|
|
|
- first = false;
|
|
|
- }).attr('text-anchor', 'middle');
|
|
|
-
|
|
|
- var padding = {"left":3,"right":3,"top":2,"bottom":2},
|
|
|
- margin = {"left":3,"right":3,"top":2,"bottom":2},
|
|
|
- oldWidth = bounds.x2 - bounds.x1;
|
|
|
-
|
|
|
- bounds.x1 -= oldWidth / 2;
|
|
|
- bounds.x2 -= oldWidth / 2;
|
|
|
-
|
|
|
- bounds.x1 -= padding.left;
|
|
|
- bounds.y1 -= padding.top;
|
|
|
- bounds.x2 += padding.left + padding.right;
|
|
|
- bounds.y2 += padding.top + padding.bottom;
|
|
|
-
|
|
|
- var width = bounds.x2 - bounds.x1;
|
|
|
- var height = bounds.y2 - bounds.y1;
|
|
|
- node.select('rect')
|
|
|
- .attr('x', bounds.x1)
|
|
|
- .attr('y', bounds.y1)
|
|
|
- //.attr('height', height)
|
|
|
- .attr('width', width);
|
|
|
-
|
|
|
- d.edge = {
|
|
|
- left : new geo.LineSegment(bounds.x1, bounds.y1, bounds.x1, bounds.y2),
|
|
|
- right : new geo.LineSegment(bounds.x2, bounds.y1, bounds.x2, bounds.y2),
|
|
|
- top : new geo.LineSegment(bounds.x1, bounds.y1, bounds.x2, bounds.y1),
|
|
|
- bottom : new geo.LineSegment(bounds.x1, bounds.y2, bounds.x2, bounds.y2)
|
|
|
- };
|
|
|
- });
|
|
|
- force.start();
|
|
|
- },10);
|
|
|
- function highlightObject(obj,flag){
|
|
|
- if(mouseoverstatus){
|
|
|
- return;
|
|
|
- }
|
|
|
- if(!flag){
|
|
|
- d3.selectAll(".node").each(function (){
|
|
|
- d3.select(this).style("opacity","1");
|
|
|
- });
|
|
|
- d3.selectAll("path").each(function (){
|
|
|
- d3.select(this).style("opacity","1");
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
- var name = obj.__data__.name;
|
|
|
- d3.selectAll(".node").each(function (){
|
|
|
- if(name != this.__data__.name){
|
|
|
- d3.select(this).style("opacity","0.2");
|
|
|
- }
|
|
|
- });
|
|
|
- d3.selectAll("path").each(function (){
|
|
|
- var targetName = this.__data__.target.name;
|
|
|
- var sourceName = this.__data__.source.name;
|
|
|
- if(name != targetName && name != sourceName){
|
|
|
- d3.select(this).style("opacity","0.2");
|
|
|
+}
|
|
|
+//加载关系网
|
|
|
+function initRelation(){
|
|
|
+ if(isLogined){
|
|
|
+ $.post("/member/getRelation",{regNo:regNo,entName:entName},function(r){
|
|
|
+ if(r.flag == false){
|
|
|
+ $("#entrelation-nologin").addClass("hide");
|
|
|
+ $("#entrelation-limit,#entrelation-noauthe").removeClass("hide");
|
|
|
+ $("#entrelation-infovis").hide();
|
|
|
+ }else if(r.flag == true && (r == null || typeof(r) == "undefined" || typeof(r.links) == "undefined" || r.links.length == 0 || typeof(r.nodes) == "undefined" || r.nodes.length <= 1)){
|
|
|
+ relation = "";
|
|
|
+ $("#entrelation-infovis").hide();
|
|
|
+ $("#entrelation-findnull").removeClass("hide");
|
|
|
}else{
|
|
|
- d3.selectAll(".node").each(function (){
|
|
|
- if(targetName == this.__data__.name || sourceName == this.__data__.name){
|
|
|
- d3.select(this).style("opacity","1");
|
|
|
- }
|
|
|
+ loadJS("/js/d3.v3.min.js",function(){
|
|
|
+ loadJS("/js/geometry.js",function(){
|
|
|
+ loadJS("/js/relation.js",function(){
|
|
|
+ $("#entrelation-limit").addClass("hide");
|
|
|
+ $(".entrelation").height(500);
|
|
|
+ relation = new Relation(legcerNo,regNo,r.relation);
|
|
|
+ relation.init();
|
|
|
+ });
|
|
|
+ });
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
- }
|
|
|
- function removeNode(obj){
|
|
|
- if(d3.event.which != 3){
|
|
|
- return;
|
|
|
- }
|
|
|
- highlightObject(obj,false);
|
|
|
- d3.select(obj).remove();
|
|
|
- var name = obj.__data__.name;
|
|
|
- var removeAloneNode = function(removeNodeName){
|
|
|
- var isRemoveAloneNode = true;
|
|
|
- d3.selectAll("path").each(function (i){
|
|
|
- if(removeNodeName == this.__data__.source.name || removeNodeName == this.__data__.target.name){
|
|
|
- isRemoveAloneNode = false;
|
|
|
- return true;
|
|
|
- }
|
|
|
- });
|
|
|
- if(isRemoveAloneNode){
|
|
|
- d3.selectAll("rect").each(function (){
|
|
|
- if(this.__data__.name == removeNodeName){
|
|
|
- d3.select(this).remove();
|
|
|
- return true;
|
|
|
- }
|
|
|
- });
|
|
|
- d3.selectAll("text").each(function (){
|
|
|
- if(this.__data__.name == removeNodeName){
|
|
|
- d3.select(this).remove();
|
|
|
- return true;
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- d3.selectAll("path").each(function (){
|
|
|
- if(name == this.__data__.target.name){
|
|
|
- var fromNodeName = this.__data__.source.name;
|
|
|
- d3.select(this).remove();
|
|
|
- removeAloneNode(fromNodeName);
|
|
|
- }else if(name == this.__data__.source.name){
|
|
|
- var toNodeName = this.__data__.target.name;
|
|
|
- d3.select(this).remove();
|
|
|
- removeAloneNode(toNodeName);
|
|
|
- }
|
|
|
- });
|
|
|
- d3.selectAll("rect").each(function (){
|
|
|
- if(name == this.__data__.name){
|
|
|
- d3.select(this).remove();
|
|
|
- }
|
|
|
- });
|
|
|
- d3.selectAll("text").each(function (){
|
|
|
- if(name == this.__data__.name){
|
|
|
- d3.select(this).remove();
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- var diagonal = d3.svg.diagonal().projection(function(d) { return [d.y, d.x]; });
|
|
|
- /////////////重绘画布///////////////////
|
|
|
- var redrawflag=false;
|
|
|
- //重绘
|
|
|
- function redraw(){
|
|
|
- if(force!=undefined){
|
|
|
- var w = parseInt($("#entrelation").css("width").replace("px","")) - 80;
|
|
|
- var h = parseInt($("#entrelation").css("height").replace("px",""))-10;
|
|
|
- d3.select("svg").attr("width", w).attr("height", h);
|
|
|
- force.size([w,h]).resume();
|
|
|
- $("#entrelation-infovis").css({width:w,height:h});
|
|
|
- //
|
|
|
- redrawflag=false;
|
|
|
- }
|
|
|
- }
|
|
|
- $(window).resize(function(){
|
|
|
- if(!redrawflag){
|
|
|
- //1秒后重绘
|
|
|
- redrawflag=true;
|
|
|
- setTimeout(redraw,1000);
|
|
|
- }
|
|
|
- firstresize=false;
|
|
|
- });
|
|
|
- ///////////////////////关系网实例////////////////////////////
|
|
|
- var htmls="<div style='position:absolute;' class='legend'>";
|
|
|
- htmls= htmls+ "<div class='legend-text-bg' style='margin-top: 10px;'><div style='background-color: #ff9800;'></div><span style='margin-left: 20px;'>本企业</span></div>";
|
|
|
- htmls= htmls+ "<div class='legend-text-bg' style='margin-top: 10px;'><div style='background-color: #cddc39;opacity:0.5;'></div><span style='margin-left: 12px;'>其他企业</span></div>";
|
|
|
- htmls= htmls+ "<div class='legend-text-bg' style='margin-top: 10px;'><div style='background-color: #2196f3;'></div><span style='margin-left: 25px;'>个人</span></div>";
|
|
|
- htmls= htmls+ "<div class='legend-text-bg' style='margin-top: 10px;margin-bottom: 10px;'><div style='background-color: #cecece;'></div><span style='margin-left: 5px;'>注吊销企业</span></div>";
|
|
|
- htmls= htmls+ "<div><span style='font-size: 20px;font-weight: bold;color: #cecece;'>→</span><span style=''>投资关系(股东→企业)</span></div>";
|
|
|
- htmls= htmls+ "<div><span style='font-size: 20px;font-weight: bold;color: #cd93d7;'>→</span><span style=''>法定代表人</span></div>";
|
|
|
- htmls= htmls+ "<div style='margin:10px 0px;' class='hidden-sm hidden-xs'><span class='text-muted'>提示:点击鼠标右键可以删除不想看的节点。</span></div>";
|
|
|
- htmls= htmls+"</div>"
|
|
|
- $("#entrelation-legend").html(htmls);
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-/*
|
|
|
-function getCityN(code){
|
|
|
- if(code){
|
|
|
- var n=code.substring(0,2)
|
|
|
- for(var i=0;i<citySim.length;i++){
|
|
|
- if (citySim[i].k==n) {
|
|
|
- return citySim[i].n;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return "";
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-function reloadData(obj,name){
|
|
|
- name=name||obj.attr("name")
|
|
|
- var val=(obj.attr("value")||obj.val());
|
|
|
-
|
|
|
- if (val==0) val=""
|
|
|
- if(name=="city"&&!val){
|
|
|
- var pids=obj.attr("id")
|
|
|
- if(pids=="c_area"){
|
|
|
- var v=obj.prev("select").val()
|
|
|
- if(!v){
|
|
|
- v=obj.prev("select").prev("select").val()
|
|
|
- }
|
|
|
- if(v){
|
|
|
- val=v
|
|
|
- }
|
|
|
-
|
|
|
- }else if(pids=="c_city"){
|
|
|
- var v=obj.prev("select").val()
|
|
|
- if(v){
|
|
|
- val=v
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }else if(name=="c_author"){
|
|
|
- if(!obj.prop("checked")){
|
|
|
- val="";
|
|
|
- }
|
|
|
- }
|
|
|
- //调整value 值
|
|
|
- if(val==10){
|
|
|
- val = "10-100"
|
|
|
- }else if(val ==100){
|
|
|
- val = "100-1000"
|
|
|
- }else if(val ==1000){
|
|
|
- val = "1000-10000"
|
|
|
- }
|
|
|
- //搜索表单提交
|
|
|
- $("#searchForm input[name="+name+"]").val(val);
|
|
|
- document.forms['searchForm'].submit();
|
|
|
-}
|
|
|
-
|
|
|
-function setLocation(entsel,serviceloc){
|
|
|
- //所在地处理
|
|
|
- var le = entsel.length
|
|
|
- var sel1 = "";
|
|
|
- var sel2 = "";
|
|
|
- var sel3 = "";
|
|
|
- if (le == 2) {
|
|
|
- sel1 = entsel.substring(0,2);
|
|
|
- sel2 = 0;
|
|
|
- sel3 = 0;
|
|
|
- }else if (le == 4){
|
|
|
- sel1 = entsel.substring(0,2);
|
|
|
- sel2 = entsel.substring(0,4);
|
|
|
- sel3 = 0;
|
|
|
- }else{
|
|
|
- sel1 = entsel.substring(0,2);
|
|
|
- sel2 = entsel.substring(0,4);
|
|
|
- sel3 = entsel.substring(0,6);
|
|
|
- }
|
|
|
- $.cxSelect.setVal(sel1,sel2,sel3);
|
|
|
- if(serviceloc){
|
|
|
- //添加编辑服务中的省
|
|
|
- $("#servicecity_china .province option").each(function(){
|
|
|
- if(sel1 == $(this).val()){
|
|
|
- $(this).attr("selected","selected");
|
|
|
- }
|
|
|
- });
|
|
|
- //添加编辑服务中的市
|
|
|
- $("#servicecity_china .city option").each(function(){
|
|
|
- if(sel2 == $(this).val()){
|
|
|
- $(this).attr("selected","selected");
|
|
|
- }
|
|
|
- });
|
|
|
- //添加编辑服务中的县
|
|
|
- $("#servicecity_china .area option").each(function(){
|
|
|
- if(sel3 == $(this).val()){
|
|
|
- $(this).attr("selected","selected");
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-}
|
|
|
-cityMouse="";
|
|
|
-$(function(){
|
|
|
-
|
|
|
- ////推荐企业
|
|
|
- loadImg(1);
|
|
|
- //行业类别 注册资本 加载
|
|
|
- makeFl();
|
|
|
- //所在地信息加载
|
|
|
- if($chiancity){
|
|
|
- $('#city_china').cxSelect({
|
|
|
- selects: ['province', 'city', 'area'],
|
|
|
- required:0,
|
|
|
- somep:true,
|
|
|
- someps:[41,45]
|
|
|
- });
|
|
|
- setLocation(entsel)
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- //处理点击重新加载
|
|
|
- $("div[id^=c_] li,li[id^=c_],input[id^=c_]").click(function(){
|
|
|
-
|
|
|
- if(this.id=="c_words"){
|
|
|
- reloadData($("#header-searchInputs"))
|
|
|
- }else{
|
|
|
- reloadData($(this))
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
- $("select[id^=c_]").click(function(){
|
|
|
- cityMouse=this.id
|
|
|
- }).change(function(){
|
|
|
- if(this.id==cityMouse){
|
|
|
- reloadData($(this),"city")
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
- //处理选择样式
|
|
|
- $("div[id^=c_] li").click(function(){
|
|
|
- $("li",$(this).closest("div")).removeClass("text-primary");
|
|
|
- $(this).addClass("text-primary");
|
|
|
- })
|
|
|
- //搜索关键字
|
|
|
- var words=""
|
|
|
-
|
|
|
- if(btempwords){
|
|
|
- words=btempwords
|
|
|
- $("#header-searchInput").val(words);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-})
|
|
|
-function makeFl(){
|
|
|
- //行业类别
|
|
|
- $(["c_hfl"]).each(function(i,ad){
|
|
|
- var str="<ul>";
|
|
|
- var tmp=eval(ad)
|
|
|
- for(var i=0;i<tmp.length;i++){
|
|
|
- var val = chf1;
|
|
|
- if (val !=""){
|
|
|
- if (val == tmp[i][1]){
|
|
|
- str+="<li name='"+ad+"' value='"+tmp[i][1]+"' class='text-primary'>"+tmp[i][0]+"</li>"
|
|
|
- var j ="J"
|
|
|
- if (val > j || val == "D" || val == "E" || val == "F" || val == "G" ){
|
|
|
- $("#c_hfl").next().find("small").text("收起<")
|
|
|
- $("#c_hfl").removeClass("less")
|
|
|
-
|
|
|
- }
|
|
|
- }else{
|
|
|
- str+="<li name='"+ad+"' value='"+tmp[i][1]+"'>"+tmp[i][0]+"</li>"
|
|
|
- }
|
|
|
- }else{
|
|
|
- str+="<li name='"+ad+"' value='"+tmp[i][1]+"' "+(i==0?"class='text-primary'":"")+">"+tmp[i][0]+"</li>"
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- str+="</ul>"
|
|
|
- $("#"+ad).html(str)
|
|
|
- })
|
|
|
- //注册资本
|
|
|
- $(["c_zb"]).each(function(i,ad){
|
|
|
- var str="<ul>";
|
|
|
- var tmp=eval(ad)
|
|
|
- for(var i=0;i<tmp.length;i++){
|
|
|
- var val = czb;
|
|
|
- if (val !=""){
|
|
|
- if (val == tmp[i][1]){
|
|
|
- str+="<li name='"+ad+"' value='"+tmp[i][1]+"' class='text-primary'>"+tmp[i][0]+"</li>"
|
|
|
- }else{
|
|
|
- str+="<li name='"+ad+"' value='"+tmp[i][1]+"'>"+tmp[i][0]+"</li>"
|
|
|
- }
|
|
|
- }else{
|
|
|
- str+="<li name='"+ad+"' value='"+tmp[i][1]+"' "+(i==0?"class='text-primary'":"")+">"+tmp[i][0]+"</li>"
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- str+="</ul>"
|
|
|
- $("#"+ad).html(str)
|
|
|
- })
|
|
|
-}
|
|
|
-function less(obj){
|
|
|
- pred=$(obj).prev()
|
|
|
- obj=$(obj).find("small")
|
|
|
- var text=obj.text()
|
|
|
- if(text=="更多>"){
|
|
|
- obj.text("收起<")
|
|
|
- pred.removeClass("less")
|
|
|
- }else{
|
|
|
- obj.text("更多>")
|
|
|
- pred.addClass("less")
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
-//推荐企业
|
|
|
-function loadImg(n){
|
|
|
- var str=""
|
|
|
- for(var i=0;i<n;i++){
|
|
|
- str+="<img src='/images/right_ad.png'>"
|
|
|
- }
|
|
|
- $("#tjqy").html(str)
|
|
|
-}
|
|
|
-
|
|
|
-function GetDiffName(i) {
|
|
|
- ret=["法定代表人"]
|
|
|
- //ret=["法定代表人","住所","成立日期"]
|
|
|
- switch (i) {
|
|
|
- case "9600":
|
|
|
- {
|
|
|
- ret[0] = "经营者"
|
|
|
- //ret[1] = "经营场所"
|
|
|
- //ret[2] = "注册日期"
|
|
|
- break;
|
|
|
- }
|
|
|
- case "4500":
|
|
|
- case "6800":
|
|
|
- case "6810":
|
|
|
- case "6820":
|
|
|
- case "7100":
|
|
|
- case "7110":
|
|
|
- case "7120":
|
|
|
- case "7130":
|
|
|
- case "7190":
|
|
|
- case "9200":
|
|
|
- case "6840":
|
|
|
- case "2100":
|
|
|
- case "2110":
|
|
|
- case "2120":
|
|
|
- case "2121":
|
|
|
- case "2122":
|
|
|
- case "2123":
|
|
|
- case "2130":
|
|
|
- case "2140":
|
|
|
- case "2150":
|
|
|
- case "2151":
|
|
|
- case "2152":
|
|
|
- case "2190":
|
|
|
- case "2200":
|
|
|
- case "2210":
|
|
|
- case "2211":
|
|
|
- case "2212":
|
|
|
- case "2213":
|
|
|
- case "2219":
|
|
|
- case "2220":
|
|
|
- case "2221":
|
|
|
- case "2222":
|
|
|
- case "2223":
|
|
|
- case "2229":
|
|
|
- case "4000":
|
|
|
- case "4300":
|
|
|
- case "4310":
|
|
|
- case "4320":
|
|
|
- case "4330":
|
|
|
- case "4340":
|
|
|
- case "4550":
|
|
|
- case "4551":
|
|
|
- case "4552":
|
|
|
- case "4553":
|
|
|
- case "4560":
|
|
|
- case "5800":
|
|
|
- case "5810":
|
|
|
- case "5820":{
|
|
|
- ret[0] = "负责人"
|
|
|
- //ret[1] = "营业场所"
|
|
|
- //ret[2] = "成立日期"
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- return ret
|
|
|
-}
|
|
|
-//公式信息是否显示
|
|
|
-if(!$gs){
|
|
|
- $("#ags").parent().hide();
|
|
|
- $("#gs").hide();
|
|
|
-}
|
|
|
-*/
|
|
|
-
|
|
|
-
|
|
|
-var perPage=5,currentPage=1
|
|
|
-
|
|
|
-//点击服务标题展示服务信息
|
|
|
-function clickservicename(id,isshow){
|
|
|
- if(isshow.indexOf("3")>-1){
|
|
|
- window.location.href="/market/detail/"+id+".html"
|
|
|
}else{
|
|
|
- window.location.href="/market/showservice/"+id+".html"
|
|
|
+ $("#entrelation-limit,#entrelation-nologin").removeClass("hide");
|
|
|
}
|
|
|
}
|
|
|
-function initServiceList(){
|
|
|
- $("#service_list").datatable({
|
|
|
- perPage: perPage
|
|
|
- ,showPagination:false
|
|
|
- ,checkbox:""
|
|
|
- ,checkboxHeader:false
|
|
|
- ,showHeader:false
|
|
|
- ,idField:"_id"
|
|
|
- ,classname:"table-hover"
|
|
|
- ,url: '/searchEntSer/' + $entid
|
|
|
- ,rowCallback: analyList,
|
|
|
- ajaxSuccess:function(res,o){
|
|
|
- if(!res || res === undefined || !res.data || res.data.length == 0) {
|
|
|
- o.continueBody=false;
|
|
|
- $("#loadMore").hide();
|
|
|
- $("#service").hide();
|
|
|
- }else{
|
|
|
- $("#service").show();
|
|
|
- }
|
|
|
- //判断加载更多是否显示
|
|
|
- if(res.totalRows>5){
|
|
|
- $("#loadMore").show();
|
|
|
- }else{
|
|
|
- $("#loadMore").hide();
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-//显示二维码图片
|
|
|
-function viewBarCode(bcpath){
|
|
|
- if(bcpath){
|
|
|
- $('#myModal').modal({
|
|
|
- keyboard: true
|
|
|
- })
|
|
|
- $("#viewImgs").html("<img style='width:300px;height:300px;' src='"+bcpath+"'/>")
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-function analyList(rowHtml, rowData) {
|
|
|
- var t="";
|
|
|
- if(rowData.i_status==1){
|
|
|
- t=template_content.replace("<a class='text-primary' value='${_id}' data-id='${s_isEdit}' onclick='removeservice(this)'>下架</a>","");
|
|
|
- }else{
|
|
|
- t=template_content.replace("已下架","");
|
|
|
- }
|
|
|
- return t.replace(/\$\{(.*?)\}/g,
|
|
|
- function(a, b, c) {
|
|
|
- var res = rowData[b]||"";
|
|
|
- //去掉后台服务列表中的图片
|
|
|
- var data = res.replace(/<img.*>.*<\/img>/ig,""); //过滤如<img></img>形式的图片元素
|
|
|
- res = data.replace(/<img.*\/>/ig, ""); //过滤如<img />形式的元素
|
|
|
- if (!res&&b=="s_images"){
|
|
|
- res="/images/services/default.png"
|
|
|
- }else{
|
|
|
- res = res.replace(/\n/g,"");
|
|
|
- }
|
|
|
- return res;
|
|
|
- });
|
|
|
-}
|
|
|
-//加载更多
|
|
|
-function loadMore(){
|
|
|
- $.post('/searchEntSer/'+$entid ,{currentPage:currentPage+1,perPage:perPage},function(data){
|
|
|
- if(data){
|
|
|
- var res=data["data"]
|
|
|
- if(!res || res === undefined || res.length == 0) {
|
|
|
- $("#loadMore").hide();
|
|
|
- return;
|
|
|
- }else if(data.totalRows<=(perPage*data.currentPage)){
|
|
|
- $("#loadMore").hide();
|
|
|
- }else{
|
|
|
- $("#loadMore").show();
|
|
|
- }
|
|
|
- currentPage=data["currentPage"];
|
|
|
- var str="";
|
|
|
-
|
|
|
- for(var i=0;i<res.length;i++){
|
|
|
- var temp=res[i];
|
|
|
- str+=analyList("",temp)
|
|
|
- }
|
|
|
- $("#service_list table tbody").append(str);
|
|
|
- }
|
|
|
- })
|
|
|
-}
|
|
|
-
|
|
|
-//设置级联位置信息
|
|
|
-function setcxSelect(){
|
|
|
- $('#city_china').cxSelect({
|
|
|
- selects: ['province', 'city', 'area'],
|
|
|
- required:0
|
|
|
+//服务列表
|
|
|
+function ServiceList(){
|
|
|
+ loadJS("/js/paging.js",function(){
|
|
|
+ paging = new Paging("serviceListPaging","/front/findServiceByEntId",{entId:entId},6,function(r){
|
|
|
+ if(r.length == 0){
|
|
|
+ $("#serviceList").next(".ent-findnull").removeClass("hide");
|
|
|
+ }
|
|
|
+ var html = '';
|
|
|
+ for(var i=0;i<r.length;i++){
|
|
|
+ html += '<tr>'
|
|
|
+ +'<td rowspan="2" width="120"><img src="'+(r[i].s_images==""?"null":r[i].s_images)+'" onerror="this.src=\'/images/services/default.png\'"></td>'
|
|
|
+ +'<td class="b-com-name"><a href="/market/detail/'+r[i]._id+'.html">'+r[i].s_name+'</a></td>'
|
|
|
+ +'<td width="100" class="text-center">报价:<font class="text-primary">'+(r[i].s_pricemy==0?"面议":r[i].f_price+"元")+'</font></td>'
|
|
|
+ +'<td width="100" class="text-center">评价:<font class="text-primary">'+r[i].i_comments+'</font></td>'
|
|
|
+ +'<tr>'
|
|
|
+ +'<td>'+r[i].s_introduction+'</td>'
|
|
|
+ +'</tr>';
|
|
|
+ }
|
|
|
+ $("#serviceList").html(html);
|
|
|
+ });
|
|
|
});
|
|
|
- $.cxSelect.setVal(province,city,area);
|
|
|
}
|