123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635 |
- var c_hfl=[["全部","0"],["农、林、牧、渔业","A"],["采矿业","B"],["制造业","C"],["住宿和餐饮业","H"],["信息传输、软件和信息技术服务业","I"],["金融业","J"],["房地产业","K"],["租赁和商务服务业","L"],["科学研究和技术服务业","M"],["水利、环境和公共设施管理业","N"],["居民服务、修理和其他服务业","O"],["教育","P"],["卫生和社会工作","Q"],["文化、体育和娱乐业","R"],["公共管理、社会保障和社会组织","S"],["电力、热力、燃气及水生产和供应业","D"],["建筑业","E"],["批发和零售业","F"],["交通运输、仓储和邮政业","G"]]
- var c_zb=[["全部","0"],["10W以下","0-10"],["10w-100w","10-100"],["100w-1000w","100-1000"],["1000万-1亿","1000-10000"],["1亿以上","10000"]]
- var c_qfl=[["全部","0"],["股份有限公司分公司(上市、外商投资企业投资)","2211"],["普通合伙企业","4531"],["农民专业合作经济组织","9100"],["个体工商户","9600"],["有限责任公司(自然人投资或控股)","1130"]]
- var template = "<tr><td><div class='contentbg borderB' ><div><a target='_blank' href='/enterprise/${_id}.html'>${EntName}</a>${s_action}</div>"+
- "<div><small>注册号:${RegNo}</small><small>${label}:${LeRep}</small><small>登记机关:${RegOrgName}</small><small>成立日期:${EstDate}</small></div>"+
- "${s_servicenames}</div></td></tr>";
- var citySim=[{k:11,n:"北京市"},{k:12,n:"天津市"},{k:13,n:"河北省"},{k:14,n:"山西省"},{k:15,n:"内蒙古"},{k:21,n:"辽宁省"},{k:22,n:"吉林省"},{k:23,n:"黑龙江省"},{k:31,n:"上海市"},{k:32,n:"江苏省"},{k:33,n:"浙江省"},{k:34,n:"安徽省"},{k:35,n:"福建省"},{k:36,n:"江西省"},{k:37,n:"山东省"},{k:41,n:"河南省"},{k:42,n:"湖北省"},{k:43,n:"湖南省"},{k:44,n:"广东省"},{k:45,n:"广西"},{k:46,n:"海南省"},{k:50,n:"重庆市"},{k:51,n:"四川省"},{k:52,n:"贵州省"},{k:53,n:"云南省"},{k:54,n:"西藏"},{k:61,n:"陕西省"},{k:62,n:"甘肃省"},{k:63,n:"青海省"},{k:64,n:"宁夏"},{k:65,n:"新疆"},{k:71,n:"台湾省"},{k:81,n:"香港"},{k:82,n:"澳门"}];
- //点击关闭微信版企明星
- function colseWeixin(){document.getElementById('weixintu').style.visibility = 'hidden';}
- $(function(){
- //点击回车执行搜索
- $(document).keydown(function(event){
- if(event.keyCode == 13){
- $("#c_words").click()
- }
- });
- });
- 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
- }
- }
-
- }
- //调整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);
- $("#city_china select").each(function(){
- if($(this).find("option:selected").index() > 0){
- $(this).addClass("sel-checked");
- }
- });
- 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='entlist-allclaify'>"+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='entlist-allclaify'":"")+">"+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;
- var livtemp= tmp[i][1]+"";
- if (val !=""){
- if (val == tmp[i][1]){
- str+="<li name='"+ad+"' value='"+livtemp+"' class='entlist-allclaify'>"+tmp[i][0]+"</li>"
- }else{
- str+="<li name='"+ad+"' value='"+livtemp+"'>"+tmp[i][0]+"</li>"
- }
- }else{
- str+="<li name='"+ad+"' value='"+livtemp+"' "+(i==0?"class='entlist-allclaify'":"")+">"+tmp[i][0]+"</li>"
- }
-
- }
- str+="</ul>"
- $("#"+ad).html(str)
- })
- }
- function less(obj){
- pred=$(obj).prev()
- 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 currPos(){
- return [["企业社区","/search/enterprise/ent.html"]]
- }
- 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
- }
- /////////////////////企业名片详细信息页js代码///////////////////////
- //判断是否为企业名片列表页
- if(!$listent){
- $(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(!$gs){
- $("#ags").parent().hide();
- $("#gs").hide();
- }
-
- //关系网的设置
- if($relationlen>0&&typeof($("#gx").css("width")) != "undefined"){
- var zoomlevel=1;
- var w = parseInt($("#gx").css("width").replace("px","")) - 10;
- $("#infovis").css("width",w+"px");
- var h = $("#infovis").height();
- $(".controlls").css({left:$("#infovis").offset().left+w-$(".controlls").width()-10});
- //查找逻辑
- 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 = 0;
- if(nodeObj.istarget == 1){
- regcap = new Number(nodeObj.regcap);
- }else{
- regcap = new Number(nodeObj.invregcap);
- }
- 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;
- }
- 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;
- }
- }
- }
- }
- //屏蔽鼠标右点击事件
- document.getElementById("infovis").oncontextmenu=function(){return false;};
- $("#op_fullscreen").attr("title","进入全屏视图"+((!!window.ActiveXObject || "ActiveXObject" in window)?"":" (F11)"));
- //处理全屏
- function launchFullScreen(element) {
- if (element.requestFullscreen) {
- element.requestFullscreen();
- } else if (element.msRequestFullscreen) {
- element.msRequestFullscreen();
- } else if (element.mozRequestFullScreen) {
- element.mozRequestFullScreen();
- } else if (element.webkitRequestFullscreen) {
- element.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
- }
- }
- function cancelFullScreen() {
- $("#op_fullscreen").attr("title","进入全屏视图"+((!!window.ActiveXObject || "ActiveXObject" in window)?"":" (F11)"));
- //force.linkDistance(120).charge(-200).size([w,h]).resume();
- $("#infovis").css({width:w,height:h});
- svg.attr("width",w).attr("height",h);
- $(".controlls").css({left:$("#infovis").offset().left+w-$(".controlls").width()-10});
- 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("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();
- }
- };
- $("#op_fullscreen").bind("click",initFullScreen);
- function initFullScreen(){
- var fullscreenElement =
- document.fullscreenElement ||
- document.mozFullScreenElement ||
- document.webkitFullscreenElement ||
- document.msFullscreenElement;
- $(".ico_fullscreen").toggleClass("exit");
- if(!fullscreenElement || fullscreenElement==null){
- redrawflag = true;
- $("#op_fullscreen").attr("title","退出全屏视图 (F11)");
- launchFullScreen(infovisdiv);
- var timeout = 100;
- if(!!window.ActiveXObject || "ActiveXObject" in window){
- timeout = 400;
- }
- setTimeout(function(){
- //重绘
- var w=document.body.clientWidth;
- var h=document.body.clientHeight;
- $("#infovis").css({width:w,height:h});
- d3.select("svg").attr("width", w).attr("height", h);
- $(".controlls").css({left:w-$(".controlls").width() - 10});
- //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 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)
- });
- //处理缩放
- var zoom = d3.behavior.zoom().scaleExtent([0.4, 10]).on("zoom", zoomed);
-
- function zoomed() {
- svg.attr("transform",
- "translate(" + d3.event.translate + ")scale(" + d3.event.scale + ")");
- }
-
- var svg = d3.select("#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)?"#5cb85c":"#b5b5b5";
- })
- .style("stroke", function(p){
- return (p.type=="cp" || p.isLegal)?"#5cb85c":"#b5b5b5";
- })
- .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 = 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){
- return p.type=="p"?"#7e388e":p.type=="ce"?"#da4e2b":"#0b93d1";
- })
- .attr("stroke", function(p){
- return p.type=="p"?"#7e388e":p.type=="ce"?"#da4e2b":"#0b93d1";
- })
- .style("opacity","0.7");
-
-
- nodes.each(function (d,i){
- if(d.type == "ce" || d.type == "e"){
- var title = "";
- if(d.text != d.shortText){
- title = d.text;
- }
- var regcap = 0;
- if(d.istarget == 1){
- regcap = new Number(d.regcap);
- }else{
- regcap = new Number(d.invregcap);
- }
- if(regcap > 0){
- var lenRegcap = (regcap + "").length;
- if(lenRegcap > 4 && (regcap + "").indexOf(".") > -1 && (lenRegcap - (regcap + "").indexOf(".")) > 4){
- regcap = 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();
- });
-
- 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");
- }else{
- d3.selectAll(".node").each(function (){
- if(targetName == this.__data__.name || sourceName == this.__data__.name){
- d3.select(this).style("opacity","1");
- }
- });
- }
- });
-
- }
- 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]; });
-
-
- //关系网
- function tick(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 redrawflag=false;
- //重绘
- function redraw(){
- var w = parseInt($("#gx").css("width").replace("px","")) - 10;
- var h = parseInt($("#gx").css("height").replace("px",""))-10;
- d3.select("svg").attr("width", w).attr("height", h);
- force.size([w,h]).resume();
- $("#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;'><img src='/images/qfw_gxmain.png' style='width:10px;height:10px;margin:10px;' /><div style='background-color: #da4e2b;margin-top: 2px;'> </div><span style='margin-left: 10px;'>本企业</span></div>";
- htmls= htmls+ "<div class='legend-text-bg' style='margin-top: 10px;'><img src='/images/qfw_gxmain2.png' style='width:9px;height:9px;margin:10px;' /><div style='background-color: #0b93d1;margin-top: 2px;'> </div><span style='margin-left: 5px;'>其他企业</span></div>";
- htmls= htmls+ "<div class='legend-text-bg' style='margin-top: 10px;'><img src='/images/qfw_gxmain1.png' style='width:8px;height:8px;margin:10px;' /><div style='background-color: #7e388e;'> </div><span style='margin-left: 18px;'>个人</span></div>";
- htmls= htmls+ "<div style='margin:0px 7px;'><span style='font-size: 20px;font-weight: bold;color: #b5b5b5;'>→</span><span style=''>投资关系(股东→企业)</span></div>";
- htmls= htmls+ "<div style='margin:0px 7px;'><span style='font-size: 20px;font-weight: bold;color: #5cb85c;'>→</span><span style=''>法定代表人</span></div>";
- htmls= htmls+ "<div style='margin:10px 7px;' class='hidden-sm hidden-xs'><span class='text-muted'>提示:点击鼠标右键可以删除不想看的节点。</span></div>";
- htmls= htmls+"</div>"
- $("#gxw_bs").html(htmls);
- }else{
- //当关系网不存在的时候设置隐藏
- $("#agx").parent().hide();
- $("#gx").hide();
- }
-
- //微官网
- $(".wgw").click(function(){
- window.location.href="/ent/wsite/preview/"+id;
- })
-
- });
- }
- //设置级联位置信息
- function setcxSelect(){
- $('#city_china').cxSelect({
- selects: ['province', 'city', 'area'],
- required:0
- });
- $.cxSelect.setVal(province,city,area);
- }
- //咨询客服
- function openChat() {
- try {
- var url = "/chat/client/"+id;
- window.open(url, "TopChat", "toolbar=0,scrollbars=0,location=0,menubar=0,resizable=1,width=920,height=620");
- } catch (e) {
-
- }
- }
- //加载服务与服务列表展示
- if(!$listent){
- var perPage=5,currentPage=1
- //解析服务列表
- $(function(){
- //加载服务列表
- initServiceList();
- });
- //点击服务标题展示服务信息
- function clickservicename(id,isshow){
- if($("#"+id).length>0){
- if(isshow.indexOf("3")>-1){
- window.location.href="/market/detail/"+id+".html"
- }else{
- window.location.href="/market/showservice/"+id+".html"
- }
- }else{
- window.location.href="/market/showservice/"+id+".html"
- }
- }
- 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){
- console.log(res);
- if(!res || res === undefined || !res.data || res.data.length == 0) {
- o.continueBody=false;
- $("#loadMore").hide();
- }
- //判断加载更多是否显示
- if(res.totalRows>5){
- $("#loadMore").show();
- }else{
- $("#loadMore").hide();
- }
-
- }
- });
- }
- /*//编辑企业名片事件
- function btnSaveForm(){
- //联系人
- if($("#s_persion").val().length==0){
- alert("请输入正确的联系人");
- return;
- }
-
- if($("#s_persion").val().length>30){
- alert("输入的联系人必须小于30个字");
- return;
- }
- //联系电话
- var tel = $("#Tel").val();
- var telReg = !!tel.match(/^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/);
- if(telReg == false){
- alert("请输入正确的手机号");
- return;
- }
-
- if($("#s_enturl").val().length>0&& $("#s_enturl").val().indexOf(".")==-1){
- alert("请输入正确的企业网站域名");
- return;
- }
- if($("#s_weixin").val().length>0&&$("#s_weixin").val().length>20 ){
- alert("请输入正确的微信号");
- return;
- }
-
- if($("#s_address").val().length>0&&$("#s_address").val().length>50 ){
- alert("联系地址详细信息不能超过50个字");
- return;
- }
- //序列化表格内容为字符串
- var param = $("#entform").serialize();
-
- $.ajax({
- type:'post',
- url:'/member/yellowpage/dosave/enterprise',
- data:param,
- cache:false,
- dataType:'json',
- success:function(data){
- alert(data.info);
- window.location.href="/member/yellowpage/show/enterprise/"+ $entid;
- }
- });
-
- }
- */
- function analyList(rowHtml, rowData) {
- var t="";
- if(rowData.i_status==1){
- t=template_content.replace("<a class='text-primary' id='${_id}' 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 uploadBarCode(){
-
- $("#upload").trigger("click");
- }
- //显示二维码图片
- function viewBarCode(bcpath){
- if(bcpath){
- $('#myModal').modal({
- keyboard: true
- })
- $("#viewImgs").html("<img style='width:300px;height:300px;' src='"+bcpath+"'/>")
- }
- }
- //图片上传
- function makeUpload(obj){
- var option={
- btnname:"图片上传",//按钮名
- btnClass:"btn btn-primary tpsc_btnsize",
- btnCss:{"width":"80px","height":"26px;"},
- name:"upload",
- action:"/filemanage/upload?resize=250",
- afterUpload:function(data){ //此处可以重写,上传后的处理
-
- $("#mblocation .pic").css('display','block');
- $("#mblocation .pic li").remove();
- $("<li class='imgLi' style='background-color:#eee;width:200px;text-align: center; height:200px;border:1px dashed #000;'><img src='"+data.url+"' style='width:176px; height:176px;margin:0px 5px;'><div id=tips style='text-align:center;width:196px;position: absolute;cursor: pointer; border:1px solid #ddd;background-color:#808080;padding:8px;color:#fff;font-size:20px;'>图片上传</div></li>").appendTo("#mblocation ul.pic");
- var urls=$("#mblocation input.imgs").val();
- urls=urls||""
- //urls +=data.url+",";
- urls= data.url;
- limouseover();
- $("#mblocation input.imgs").attr("value",urls);
- $("#mblocation img.imgs").attr("src",urls);
- if($("#mblocation ul.pic li img").size()>=1){
- $("#upload").attr("disabled",false)
- }
- }
- };
-
- obj.upload(option);
- }
- /*
- //添加服务
- function btnAddServices(obj){
- //判断信息是否为空
- var v1=$("#mblocation input[name=servicename]").val();
- var v_price=$("#mblocation input[name=s_price]").val();
- var isselectprice=$("#s_pricemy").is(':checked');
- var v2=editor.html();
- //手机号
- var phone = $("#mblocation input[name=s_phone]").val();
-
- if(!v1){
- alert("请填写产品服务名称")
- return;
- }
-
- if(v_price.length>12){
- alert("请填写小于12位的价格")
- return;
- }
- var telReg = !!phone.match(/^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/);
- if(telReg == false){
- alert("请输入正确的手机号");
- return;
- }
-
-
- $.post('/member/yellowpage/add/service/addservice?_new='+new Date().getTime(),$("#mblocation form").serialize(),function(data){
- if(data.status=="y"){
- alert(data.info);
- cancelService();
- }else{
- alert("保存服务信息失败");
- }
- },'json');
-
- initServiceList()
- }
- */
- //删除服务
- function delservice(obj){
- console.log($(obj).attr("data-id"));
- if($(obj).attr("data-id")==0){
- alert("不能删除,请查看是否还有用户没评论或有预约未处理")
- return false
- }
- var id = $(obj).attr("value");
- var r = confirm("确定删除此服务吗?");
- if(r==true){
- $.ajax({
- type:'post',
- url:'/member/service/delservice',
- data:{"id":id},
- cache:true,
- dataType:'json',
- success:function(data){
- alert(data.msg)
- $("#service_list table tbody").html("");
- currentPage=0;
- loadMore();
- }
- });
- }
- }
- //下架服务
- function removeservice(obj){
- if($(obj).attr("data-id")==0){
- alert("不能下架,请查看是否还有用户没评论或有预约未处理")
- return false
- }
- var id = $(obj).attr("value");
- var r = confirm("确定下架此服务吗?");
- if(r==true){
- $.ajax({
- type:'post',
- url:'/member/service/removeservice',
- data:{"id":id},
- cache:true,
- dataType:'json',
- success:function(data){
- alert(data.msg)
- $("#service_list table tbody").html("");
- currentPage=0;
- loadMore();
- }
- });
- }
- }
- //清除服务弹出窗口的表单信息
- function formclane(){
- //移除表单信息
- $("#mblocation .sn").val("");
- $("#mblocation .firstservicetype option").each(function(){
- if("00" == $(this).val()){
- $(this).attr("selected","selected");
- }
- });
- //加载二级栏目下的内容
- $("#mblocation .secondservicetype option").each(function(){
- if("11" == $(this).val()){
- $(this).attr("selected","selected");
- }
- });
-
- $("#mblocation .price").val("");
- $("#mblocation .phone").val("");
- $("#mblocation .sd").val("");
- $("#mblocation .pic li").parent().css('display','none');
- $("#mblocation [name='isshow']:first").removeAttr("checked");
- $("#mblocation .isshow_checked ").removeAttr("checked");
- $("#mblocation [name='isshow']:last").removeAttr("checked");
-
- }
- //在列表中点击添加服务按钮事件
- function addService(){
- window.location.href="/member/yellowpage/show/showService/" + id;
- }
- //取消添加服务按钮事件
- function cancelService(){
- var entid = $("#entid").val();
- window.location.href="/member/yellowpage/show/enterprise/" + entid;
- }
- //价格检测
- function checkprice(obj){
- var obj = $(obj).val();
-
- if (obj.trim().length>0){
- $("#s_pricemy").attr("disabled",true);
- }else if (obj.trim().length==0){
- $("#s_pricemy").attr("disabled",false);
- }
- }
- //清除加载的图片
- function cleanpicImg(tname){
- $("#mblocation .pic li").remove();
- $("#imgmessage").css("display","block")
- //var srcimg="/images/services/qfw_" + tname +".png";
- var srcimg="/images/services/default.png";
- $("<li class='imgLi' style='background-color:#eee;width:200px;text-align: center; height:200px;border:1px dashed #000;'><img src='"+srcimg+"' style='width:176px; height:176px;margin:0px 5px;'><div id=tips style='text-align:center;width:196px;position: absolute;cursor: pointer; border:1px solid #ddd;background-color:#808080;padding:8px;color:#fff;font-size:20px;'>图片上传</div></li>").appendTo("#mblocation ul.pic");
- $("#mblocation input.imgs").attr("value",srcimg);
- limouseover();
- }
- //鼠标放到li上悬浮时间
- function limouseover(){
- // var lis=document.getElementsByTagName("li");
- var lis=$("#mblocation ul li");
- lis.each(function(index,element){
- tips.style.left=this.offsetLeft+2+"px";
- tips.style.top=this.offsetTop+this.offsetHeight-45+"px";
- //tips.style.top = 948+"px";
- $(this).click(function(){
- $("#upload").trigger("click");
- });
-
- });
-
- }
- $(function(){
- //图片上传
- makeUpload($("#mblocation .mupload"));
-
- //面议复选框点击事件
- $("#s_pricemy").click(function(){
- //是否选种面议
- var isselect=$("#s_pricemy").is(':checked');
- if(isselect){
- $("#s_price").attr("readonly","readonly");
- $("#s_price").attr("disabled",true);
- $("#s_price").attr("value","");
- }else{
- $("#s_price").removeAttr("readonly");
- $("#s_price").attr("disabled",false);
- }
- });
-
- //一级栏目内容修改
- $("#firstservicetype").change(function(){
- var tname = $(this).val();
- cleanpicImg(tname);
- });
-
- $("#mblocation .sid").val(serviceid);
- $("#mblocation .sentid").val(serentinfoid);
- if(dphone.length==0){
- dphone= phone;
- }
- $("#mblocation .phone").val(dphone);
- if(serviceid){
-
- $('#servicecity_china').cxSelect({
- selects: ['province', 'city', 'area'],
- required:0
- });
- setLocation(entsel,1);
- //产品服务类型
- $("#mblocation .firstservicetype option").each(function(){
- if(firstsertype == $(this).val()){
- $(this).attr("selected","selected");
- cleanpicImg(firstsertype);
- }
- });
- //加载二级栏目下的内容
- initSecondServiceType(firstsertype);
- //设置选择二级栏目的内容
- $("#mblocation .secondservicetype option").each(function(){
- if(secondsertype == $(this).val()){
- $(this).attr("selected","selected");
- }
- });
- //面议复选框
- if(serpricemy==1){
- $("#s_pricemy").prop("checked",true);
- $("#s_price").attr("readonly","readonly");
- $("#s_price").attr("disabled",true);
- $("#s_price").attr("value","");
- }else{
- $("#s_pricemy").attr("disabled",true);
- }
-
- //给kindereditor赋值
- editor.html(introduction);
- $("#mblocation .introduction").val(introduction);
- if(images){
- $("#mblocation .pic").css('display','block');
- var imgurls = images.split(",");
- var in1=0;
- $("#mblocation .pic li").remove();
- for(var i=0;i<imgurls.length;i++){
- if(imgurls[i]){
- in1++;
- $("<li class='imgLi' style='background-color:#eee;width:200px;text-align: center; height:200px;border:1px dashed #000;'><img src='"+imgurls[i]+"' style='width:176px; height:176px;margin:0px 5px;'><div id=tips style='text-align:center;width:196px;position:absolute;cursor: pointer;border:1px solid #ddd;background-color:#808080;padding:8px;color:#fff;font-size:20px;'>图片上传</div></li>").appendTo("#mblocation ul.pic");
- }
- }
- if(in1>=5){
- $("#mblocation .mupload").closest(".row").hide()
- }
- }else{
- //$("#mblocation .pic").css('display','none');
- }
- $("#mblocation .imgs").val(images);
- //显示位置设置
- if(strisshow!= undefined){
- $("#isshow_checked1").prop("checked",(strisshow.indexOf("1")>-1));
- $("#mblocation .isshow_checked ").prop("checked",(strisshow.indexOf("2")>-1));
- $("#isshow_checked3").prop("checked",(strisshow.indexOf("3")>-1));
- }
-
- }
- });
- /**添加服务信息**/
- function closepanel(n,id){
- $('#servicecity_china').cxSelect({
- selects: ['province', 'city', 'area'],
- required:0
- });
- setLocation(entsel,n);
- if(n){
-
- //$("#mblocation").html($("#serviceForm").clone().html());
- //图片上传
- makeUpload($("#mblocation .mupload"));
- $('#addModal').modal('show');
- if(id){
- $("#edittitle").html("编辑产品服务信息");
- $("#flagedit").attr("value","edit");
- $.post('/member/service/findservice', {"id":id}, function(data){
- var editentsel= data.data.s_opLocDistrict;
-
- if(editentsel!= undefined){
- setLocation(editentsel,n);
- }
-
- $("#mblocation .sid").val(id);
- $("#mblocation .sn").val(data.data.s_name);
- //产品服务类型
- var firstsertype= data.data.s_pservicecode;
- $("#mblocation .firstservicetype option").each(function(){
- if(firstsertype == $(this).val()){
- $(this).attr("selected","selected");
- }
- });
- //加载二级栏目下的内容
- initSecondServiceType(firstsertype);
- //设置选择二级栏目的内容
- var secondsertype= data.data.s_servicecode
- $("#mblocation .secondservicetype option").each(function(){
- if(secondsertype == $(this).val()){
- $(this).attr("selected","selected");
- }
- });
-
- $("#mblocation .price").val(data.data.f_price);
- var dphone = data.data.s_phone;
-
- if(dphone==undefined){
- dphone= phone;
- }
- $("#mblocation .phone").val(dphone);
-
- //给kindereditor赋值
- editor.html(data.data.s_introduction);
-
- $("#mblocation .imgs").val(data.data.s_images);
- //显示位置设置
- var strisshow = data.data.s_isshow;
- if(strisshow!= undefined){
- $("#isshow_checked1").prop("checked",(strisshow.indexOf("1")>-1));
- $("#mblocation .isshow_checked ").prop("checked",(strisshow.indexOf("2")>-1));
- $("#isshow_checked3").prop("checked",(strisshow.indexOf("3")>-1));
- }
-
- if(data.data.s_images){
- $("#mblocation .pic").css('display','block');
- var imgurls = data.data.s_images.split(",");
- var in1=0;
- $("#mblocation .pic li").remove();
- for(var i=0;i<imgurls.length;i++){
- if(imgurls[i]){
- in1++;
- $("<li class='imgLi' style='background-color:#eee;width:200px;text-align: center; height:200px;border:1px dashed #000;'><img src='"+imgurls[i]+"' style='width:176px; height:176px;margin:0px 5px;'><div id=tips style='text-align:center;width:196px;position:absolute;cursor: pointer;border:1px solid #ddd;background-color:#808080;padding:8px;color:#fff;font-size:20px;'>图片上传</div></li>").appendTo("#mblocation ul.pic");
- }
- }
- if(in1>=5){
- $("#mblocation .mupload").closest(".row").hide()
- }
- }else{
- $("#mblocation .pic").css('display','none');
- }
- });
- }else{
- $("#mblocation .phone").val(phone);
- }
-
- }else{
- formclane();
- $("#edittitle").html("添加产品服务信息");
- $('#addModal').modal('hide');
- }
-
-
- }
- //编辑服务信息
- function findservice( id ,me){
- //根据服务id 编辑服务信息
- if($(me).attr("data-id")==0){
- alert("不能编辑,请查看是否还有用户没评论或有预约未处理")
- return false
- }else{
- window.location.href="/member/yellowpage/edit/showService/" + id;
- }
-
- }
- /**删除上传服务中的图片**/
- function delServiceUploadImg(obj,url){
- $(obj).closest("li").remove();
- var valImg=$("#mblocation input.imgs").val();
- if (valImg){
- $("#mblocation input.imgs").val(valImg.replace(url+",",""))
- }
- $("#mblocation .mupload").closest(".row").show()
- }
- }
|