entcommunity.js 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. var c_hfl=[["不限行业","0"],["农、林、牧、渔业","A"],["采矿业","B"],["制造业","C"],["住宿和餐饮业","H"],["信息传输、软件和信息技术服务业","I"],["金融业","J"],["房地产业","K"],["租赁和商务服务业","L"],["科学研究和技术服务业","M"],["水利、环境和公共设施管理业","N"],["居民服务、修理和其他服务业","O"],["教育","P"],["卫生和社会工作","Q"],["文化、体育和娱乐业","R"],["公共管理、社会保障和社会组织","S"],["电力、热力、燃气及水生产和供应业","D"],["建筑业","E"],["批发和零售业","F"],["交通运输、仓储和邮政业","G"]]
  2. var c_zb=[["不限金额","0"],["10W以下","0-10"],["10w-100w","10-100"],["100w-1000w","100-1000"],["1000万-1亿","1000-10000"],["1亿以上","10000"]]
  3. var c_qfl=[["全部","0"],["股份有限公司分公司(上市、外商投资企业投资)","2211"],["普通合伙企业","4531"],["农民专业合作经济组织","9100"],["个体工商户","9600"],["有限责任公司(自然人投资或控股)","1130"]]
  4. new FastClick(document.body);
  5. var mCommunity=function(){
  6. return new mCommunity.prototype.init();
  7. };
  8. mCommunity.prototype={
  9. tabtarget:null,
  10. init:function(){
  11. return this;
  12. },
  13. initIndex:function(){
  14. changeSearchBorder();
  15. $(window).resize(function(){
  16. changeSearchBorder();
  17. });
  18. $("#query").keyup(function(){
  19. imFind(this);
  20. if($("#immediately").children().length>0){
  21. $("#immediately").show();
  22. }
  23. });
  24. $("#query").focus(function(){
  25. if($("#immediately").children().length>0){
  26. $("#immediately").show();
  27. }
  28. });
  29. $("#query").blur(function(){
  30. $("#immediately").hide();
  31. });
  32. //高级搜索
  33. $(".searchlink").click(function(){
  34. n=$(".nav-bar");
  35. if(n.is(":visible")){
  36. $(".nav-bar").slideUp(200);
  37. }else{
  38. $(".nav-bar").slideDown(200);
  39. }
  40. });
  41. var me=this;
  42. $("div.nav-bar ul.nav li").each(function(i,n){
  43. n=$(n);
  44. var target=$("#"+n.attr("id").replace("t-",""));
  45. target.height(window.screen.height-88);
  46. if(target.attr("id")=="location"){
  47. target.find("div").height(window.screen.height-88);
  48. }
  49. });
  50. //初始化筛选
  51. var obj=$.cxSelect.defaults.url;
  52. var province=$("#province ul");
  53. var provincetpl="<li data-id='$id'>$name</li>";
  54. for(var i=0;i<obj.length;i++){
  55. var node=provincetpl.replace("$id",obj[i].k).replace("$name",obj[i].n);
  56. province.append(node);
  57. var child=obj[i].s;
  58. var ulchild=$("<ul></ul>");
  59. ulchild.attr("id","city_"+obj[i].k);
  60. ulchild.append("<li></li><li data-id="+obj[i].k+">全部</li>");
  61. ulchild.addClass("hides");
  62. for(var k=0;k<child.length;k++){
  63. var lichild=$("<li></li>")
  64. lichild.text(child[k].n);
  65. lichild.attr("data-id",child[k].k);
  66. ulchild.append(lichild);
  67. }
  68. $("#city").append(ulchild);
  69. }
  70. for(var i=0;i<c_zb.length;i++){
  71. var li=$("<li></li>");
  72. li.text(c_zb[i][0]);
  73. li.attr("value",c_zb[i][1]);
  74. $("#reg ul").append(li);
  75. }
  76. for(var i=0;i<c_hfl.length;i++){
  77. var li=$("<li></li>");
  78. li.text(c_hfl[i][0]);
  79. li.attr("value",c_hfl[i][1]);
  80. $("#category ul").append(li);
  81. }
  82. //初始化监听
  83. $("div.nav-bar ul.nav li").click(function(n){
  84. n=$(n.target);
  85. var target=$("#"+n.attr("id").replace("t-",""));
  86. if(target.attr("id")!=me.tabtarget){
  87. if(me.tabtarget!=null){
  88. $("#"+me.tabtarget).hide();
  89. }
  90. me.tabtarget=target.attr("id");
  91. }
  92. if(target.is(":visible")){
  93. target.hide();
  94. }else{
  95. target.show();
  96. }
  97. });
  98. $("#city li").on("click",function(i){
  99. var node=$(i.target);
  100. $("#city li[class='hover']").attr("class","");
  101. node.attr("class","hover");
  102. $("#citys").val(node.attr("data-id"));
  103. $("#queryform").submit();
  104. });
  105. $("#province ul li").on("click",function(i){
  106. var node=$(i.target);
  107. $("#province ul li[class='hover']").attr("class","");
  108. node.attr("class","hover");
  109. target=$("#city #city_"+node.attr("data-id"));
  110. if(target.is(":hidden")){
  111. $("#city ul:visible").attr("class","hides");
  112. target.attr("class","shows");
  113. }
  114. });
  115. $("#category li").click(function(n){
  116. //这里处理行业筛选
  117. var node=$(n.target);
  118. $("#c_hfl").val(node.attr("value"));
  119. $("#queryform").submit();
  120. });
  121. $("#reg li").click(function(n){
  122. //这里处理注册资本筛选
  123. var node=$(n.target);
  124. $("#c_zb").val(node.attr("value"));
  125. $("#queryform").submit();
  126. });
  127. return this;
  128. },
  129. initmemer:function(){
  130. if(typeof(staffinfo) != "undefined" && staffinfo != null && staffinfo.length > 0){
  131. var staffinfos1 = [],staffinfos2 = [],staffinfos3 = [],staffinfos4 = [];
  132. for(var i=0;i<staffinfo.length;i++){
  133. switch(staffinfo[i].Position){
  134. case "410A":
  135. case "410B":
  136. case "410C":
  137. case "431A":
  138. case "431B":
  139. staffinfos1.push(staffinfo[i]);
  140. break;
  141. case "432A":
  142. case "432K":
  143. staffinfos2.push(staffinfo[i]);
  144. break;
  145. case "434Q":
  146. case "434R":
  147. case "436A":
  148. staffinfos3.push(staffinfo[i]);
  149. break;
  150. default:
  151. staffinfos4.push(staffinfo[i]);
  152. break;
  153. }
  154. }
  155. staffinfos1.sort(function(a,b){return a.Position-b.Position});
  156. staffinfos2.sort(function(a,b){return a.Position-b.Position});
  157. staffinfos3.sort(function(a,b){return a.Position-b.Position});
  158. staffinfos4.sort(function(a,b){return a.Position-b.Position});
  159. var hm = '<div class="ent-mainpersons">';
  160. //计算出一行可以放几个
  161. var maxCout = parseInt($(".ent-tab-content").width() / (207+20));
  162. var verticalFlag = false;
  163. var appendStaffinfo = function(obj,index){
  164. var tmp = 0;
  165. for(var i=0;i<obj.length;i++){
  166. var positionName = obj[i].PositionName;
  167. if(typeof(positionName) == "undefined" || positionName == null || positionName == ""){
  168. positionName = "监事";
  169. }
  170. tmp++;
  171. if(i==0){
  172. hm+='<div class="staffinfo-level-'+index+'">';
  173. if(verticalFlag){
  174. hm+='<a class="staffinfo-vertical"></a>';
  175. }
  176. }
  177. verticalFlag = true;
  178. hm+='<div><img src="'+cdn+'/images/entcommunity/mainperson'+index+'.png">'
  179. +'<span><font class="b-com-name">'+obj[i].Name+'</font><font class="ent-positionName">'+positionName+'</font></span></div>';
  180. if (i%2==0){
  181. hm+="<div class='sp'>&nbsp;</div>";
  182. }
  183. //竖线
  184. if(tmp == maxCout && i != obj.length-1){
  185. hm+='<a class="staffinfo-vertical"></a>';
  186. }
  187. //横线
  188. if(i != obj.length-1){
  189. if(tmp <= maxCout-1){
  190. hm+='<a class="staffinfo-horizontal"></a>';
  191. }else{
  192. tmp = 0;
  193. }
  194. }
  195. if(i==obj.length-1){
  196. hm+='</div>';
  197. }
  198. }
  199. }
  200. appendStaffinfo(staffinfos1,1);
  201. appendStaffinfo(staffinfos2,2);
  202. appendStaffinfo(staffinfos3,3);
  203. appendStaffinfo(staffinfos4,4);
  204. hm+='</div>';
  205. $(".ent-mainperson").html(hm);
  206. for(var i=0;i<5;i++){
  207. var node=$(".staffinfo-level-"+i).children().last();
  208. var node1=$(".staffinfo-level-"+i).children().first();
  209. if(node.attr("class")=="sp"){
  210. node.remove();
  211. }
  212. node1.css("margin-bottom","-5px");
  213. }
  214. }
  215. else{
  216. $(".memberinfo").show();
  217. }
  218. }
  219. }
  220. mCommunity.prototype.init.prototype = mCommunity.prototype;
  221. function changeSearchBorder(){
  222. var width=$("#query").css("width");
  223. width=width.substr(0,width.indexOf("p"))-30+"px";
  224. $("#immediately").css("width",width);
  225. $("#immediately").css("margin-left",$("#query").offset().left+15);
  226. }
  227. function viewcontent(n){
  228. var node=$(n);
  229. $(".modal-backdrop").show();
  230. $(".creditrules").show();
  231. var p=node.parent().find("div").text();
  232. p=p.replace(new RegExp(/(变)/g),'<br/>变');
  233. p=p.replace(new RegExp(/(;)/g),';<br/>');
  234. $(".creditrules .content").html(p);
  235. }
  236. hasLoadPagingJs=false
  237. //失信信息
  238. function DishonestyPaging(){
  239. this.initDishonesty = function(){
  240. var paging = new Paging("dishonestyListPaging","/front/getDishonesty",{legcerNo:legcerNo},dishonesty.pageSize,function(r){
  241. var html = '';
  242. for(var i=0;i<r.length;i++){
  243. html += '<tr><td>'
  244. +'<div style="height:10px;"></div>'
  245. +'<div class="b-com-first">'+r[i].iname+'</div>'
  246. +'<div class="b-com-second"><span>案号:'+r[i].case_code+'</span>&nbsp;&nbsp;<span>法院:'+r[i].court_name+'</span>'+'</div>'
  247. +'<div class="b-com-third">'
  248. +'<span>状态:'+r[i].performance+'</span>'
  249. +'<span>立案日期:'+new Date(Number(r[i].l_date+"000")).Format("yyyy-MM-dd")+'</span>'
  250. +'</div>'
  251. +'</td></tr>';;
  252. }
  253. $("#dishonestyListPaging").append(html);
  254. },dishonesty);
  255. paging.firstPageDatas = null;
  256. }
  257. if(hasLoadPagingJs){
  258. this.initDishonesty();
  259. }else{
  260. var thisClass = this;
  261. loadJS(cdn+"/js/paging.js",function(){
  262. hasLoadPagingJs = true;
  263. thisClass.initDishonesty();
  264. });
  265. }
  266. }
  267. var identWayFlag = true;
  268. var isLogined=true;
  269. var relationFlag=false;
  270. //加载关系网
  271. function initRelation(){
  272. $("#entrelation").height(500);
  273. $.ajax({
  274. url: "/member/getRelation",
  275. method: "post",
  276. data: {regNo:regNo,entName:entName},
  277. success: function(r){
  278. if(!r || !r.flag || !r.relation || !r.relation.links || r.relation.links.length == 0 || !r.relation.nodes || r.relation.nodes.length <= 1){
  279. alert("没有关系数据!");
  280. }else{
  281. $(".entrelation").height($(".ent-tab-content").height());
  282. loadJS(cdn+"/js/d3.v3.min.js",function(){
  283. loadJS(cdn+"/js/geometry.js",function(){
  284. loadJS(cdn+"/js/provinceData.min.js",function(){
  285. loadJS(cdn+"/js/relation.js",function(){
  286. relationEntity = new Relation(legcerNo,regNo,regCapCurName,r.relation);
  287. relationEntity.init();
  288. });
  289. });
  290. });
  291. });
  292. }
  293. },
  294. error: function(){
  295. alert("没有关系数据!");
  296. }
  297. });
  298. }