entcommunity.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  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. $(".bottom").show();
  38. }else{
  39. $(".nav-bar").slideDown(200);
  40. }
  41. });
  42. var me=this;
  43. $("div.nav-bar ul.nav li").each(function(i,n){
  44. n=$(n);
  45. var target=$("#"+n.attr("id").replace("t-",""));
  46. target.height(window.screen.height-88);
  47. if(target.attr("id")=="location"){
  48. target.find("div").height(window.screen.height-88);
  49. }
  50. });
  51. //初始化筛选
  52. var obj=$.cxSelect.defaults.url;
  53. var province=$("#province ul");
  54. var provincetpl="<li data-id='$id'>$name</li>";
  55. for(var i=0;i<obj.length;i++){
  56. var node=provincetpl.replace("$id",obj[i].k).replace("$name",obj[i].n);
  57. province.append(node);
  58. var child=obj[i].s;
  59. var ulchild=$("<ul></ul>");
  60. ulchild.attr("id","city_"+obj[i].k);
  61. ulchild.append("<li></li><li data-id="+obj[i].k+">全部</li>");
  62. ulchild.addClass("hides");
  63. for(var k=0;k<child.length;k++){
  64. var lichild=$("<li></li>")
  65. lichild.text(child[k].n);
  66. lichild.attr("data-id",child[k].k);
  67. ulchild.append(lichild);
  68. }
  69. $("#city").append(ulchild);
  70. }
  71. for(var i=0;i<c_zb.length;i++){
  72. var li=$("<li></li>");
  73. li.text(c_zb[i][0]);
  74. li.attr("value",c_zb[i][1]);
  75. $("#reg ul").append(li);
  76. }
  77. for(var i=0;i<c_hfl.length;i++){
  78. var li=$("<li></li>");
  79. li.text(c_hfl[i][0]);
  80. li.attr("value",c_hfl[i][1]);
  81. $("#category ul").append(li);
  82. }
  83. //初始化监听
  84. $("div.nav-bar ul.nav li").click(function(n){
  85. n=$(n.target);
  86. var target=$("#"+n.attr("id").replace("t-",""));
  87. if(target.attr("id")!=me.tabtarget){
  88. if(me.tabtarget!=null){
  89. $("#"+me.tabtarget).hide();
  90. }
  91. me.tabtarget=target.attr("id");
  92. }
  93. if(target.is(":visible")){
  94. target.hide();
  95. $(".bottom").show();
  96. }else{
  97. target.show();
  98. if (target.attr("id")=="location"){
  99. var index=$("#province li.hover").index()-1;
  100. if (index>9){
  101. $("#province").scrollTop(index*34);
  102. }
  103. var index=$("#city li.hover").index()-1;
  104. if(index>9){
  105. $("#city").scrollTop(index*34);
  106. }else{
  107. $("#city").scrollTop(10);
  108. }
  109. }
  110. $(".bottom").hide();
  111. }
  112. });
  113. $("#city li").on("click",function(i){
  114. var node=$(i.target);
  115. $("#city li[class='hover']").attr("class","");
  116. node.attr("class","hover");
  117. $("#citys").val(node.attr("data-id"));
  118. $("#queryform").submit();
  119. });
  120. $("#province ul li").on("click",function(i){
  121. var node=$(i.target);
  122. if(node.text()=="全国" || node.text()==""){
  123. $("#citys").val("0");
  124. $("#queryform").submit();
  125. }
  126. $("#province ul li[class='hover']").attr("class","");
  127. node.attr("class","hover");
  128. target=$("#city #city_"+node.attr("data-id"));
  129. if(target.is(":hidden")){
  130. $("#city ul:visible").attr("class","hides");
  131. target.attr("class","shows");
  132. }
  133. });
  134. $("#category li").click(function(n){
  135. //这里处理行业筛选
  136. var node=$(n.target);
  137. $("#c_hfl").val(node.attr("value"));
  138. $("#queryform").submit();
  139. });
  140. $("#reg li").click(function(n){
  141. //这里处理注册资本筛选
  142. var node=$(n.target);
  143. $("#c_zb").val(node.attr("value"));
  144. $("#queryform").submit();
  145. });
  146. //初始化筛选状态
  147. var citycode=$("#citys").val();
  148. var c_hflx=$("#c_hfl").val();
  149. var c_zbx=$("#c_zb").val();
  150. $("#category li[value="+c_hflx+"]").css("background","#FFF");
  151. $("#reg li[value="+c_zbx+"]").css("background","#FFF");
  152. if(citycode=="0" || citycode==""){
  153. $("#province li[data-id="+citycode+"]").addClass("hover");
  154. }else{
  155. var p=$("#province li[data-id="+citycode.substr(0,2)+"]");
  156. if(p){
  157. p.addClass("hover");
  158. $("#city li[data-id="+citycode+"]").parent().addClass("shows");
  159. $("#city li[data-id="+citycode+"]").addClass("hover");
  160. }
  161. }
  162. return this;
  163. },
  164. initmemer:function(){
  165. if(typeof(staffinfo) != "undefined" && staffinfo != null && staffinfo.length > 0){
  166. var staffinfos1 = [],staffinfos2 = [],staffinfos3 = [],staffinfos4 = [];
  167. for(var i=0;i<staffinfo.length;i++){
  168. switch(staffinfo[i].Position){
  169. case "410A":
  170. case "410B":
  171. case "410C":
  172. case "431A":
  173. case "431B":
  174. staffinfos1.push(staffinfo[i]);
  175. break;
  176. case "432A":
  177. case "432K":
  178. staffinfos2.push(staffinfo[i]);
  179. break;
  180. case "434Q":
  181. case "434R":
  182. case "436A":
  183. staffinfos3.push(staffinfo[i]);
  184. break;
  185. default:
  186. staffinfos4.push(staffinfo[i]);
  187. break;
  188. }
  189. }
  190. staffinfos1.sort(function(a,b){return a.Position-b.Position});
  191. staffinfos2.sort(function(a,b){return a.Position-b.Position});
  192. staffinfos3.sort(function(a,b){return a.Position-b.Position});
  193. staffinfos4.sort(function(a,b){return a.Position-b.Position});
  194. var hm = '<div class="ent-mainpersons">';
  195. //计算出一行可以放几个
  196. var maxCout = parseInt($(".ent-tab-content").width() / (207+20));
  197. var verticalFlag = false;
  198. var appendStaffinfo = function(obj,index){
  199. var tmp = 0;
  200. for(var i=0;i<obj.length;i++){
  201. var positionName = obj[i].PositionName;
  202. if(typeof(positionName) == "undefined" || positionName == null || positionName == ""){
  203. positionName = "监事";
  204. }
  205. tmp++;
  206. if(i==0){
  207. hm+='<div class="staffinfo-level-'+index+'">';
  208. if(verticalFlag){
  209. hm+='<a class="staffinfo-vertical"></a>';
  210. }
  211. }
  212. verticalFlag = true;
  213. hm+='<div><img src="'+cdn+'/images/entcommunity/mainperson'+index+'.png">'
  214. +'<span><font class="b-com-name">'+obj[i].Name+'</font><font class="ent-positionName">'+positionName+'</font></span></div>';
  215. if (i%2==0){
  216. hm+="<div class='sp'>&nbsp;</div>";
  217. }
  218. //竖线
  219. if(tmp == maxCout && i != obj.length-1){
  220. hm+='<a class="staffinfo-vertical"></a>';
  221. }
  222. //横线
  223. if(i != obj.length-1){
  224. if(tmp <= maxCout-1){
  225. hm+='<a class="staffinfo-horizontal"></a>';
  226. }else{
  227. tmp = 0;
  228. }
  229. }
  230. if(i==obj.length-1){
  231. hm+='</div>';
  232. }
  233. }
  234. }
  235. appendStaffinfo(staffinfos1,1);
  236. appendStaffinfo(staffinfos2,2);
  237. appendStaffinfo(staffinfos3,3);
  238. appendStaffinfo(staffinfos4,4);
  239. hm+='</div>';
  240. $(".ent-mainperson").html(hm);
  241. for(var i=0;i<5;i++){
  242. var node=$(".staffinfo-level-"+i).children().last();
  243. var node1=$(".staffinfo-level-"+i).children().first();
  244. if(node.attr("class")=="sp"){
  245. node.remove();
  246. }
  247. node1.css("margin-bottom","-5px");
  248. }
  249. }
  250. else{
  251. $(".memberinfo").show();
  252. }
  253. }
  254. }
  255. mCommunity.prototype.init.prototype = mCommunity.prototype;
  256. function changeSearchBorder(){
  257. var width=$("#query").css("width");
  258. width=width.substr(0,width.indexOf("p"))-45+"px";
  259. $("#immediately").css("width",width);
  260. $("#immediately").css("margin-left",$("#query").offset().left);
  261. }
  262. function viewcontent(n){
  263. var node=$(n);
  264. $(".modal-backdrop").show();
  265. $(".creditrules").show();
  266. var p=node.parent().find("div").text();
  267. p=p.replace(new RegExp(/(变)/g),'<br/>变');
  268. p=p.replace(new RegExp(/(;)/g),';<br/>');
  269. $(".creditrules .content").html(p);
  270. }
  271. hasLoadPagingJs=false
  272. //失信信息
  273. function DishonestyPaging(){
  274. this.initDishonesty = function(){
  275. var paging = new Paging("dishonestyListPaging","/front/getDishonesty",{legcerNo:legcerNo},dishonesty.pageSize,function(r){
  276. var html = '';
  277. for(var i=0;i<r.length;i++){
  278. html += '<tr><td>'
  279. +'<div style="height:10px;"></div>'
  280. +'<div class="b-com-first">'+r[i].iname+'</div>'
  281. +'<div class="b-com-second"><span>案号:'+r[i].case_code+'</span>&nbsp;&nbsp;<span>法院:'+r[i].court_name+'</span>'+'</div>'
  282. +'<div class="b-com-third">'
  283. +'<span>状态:'+r[i].performance+'</span>'
  284. +'<span>立案日期:'+new Date(Number(r[i].l_date+"000")).Format("yyyy-MM-dd")+'</span>'
  285. +'</div>'
  286. +'</td></tr>';;
  287. }
  288. $("#dishonestyListPaging").append(html);
  289. },dishonesty);
  290. paging.firstPageDatas = null;
  291. }
  292. if(hasLoadPagingJs){
  293. this.initDishonesty();
  294. }else{
  295. var thisClass = this;
  296. loadJS(cdn+"/js/paging.js",function(){
  297. hasLoadPagingJs = true;
  298. thisClass.initDishonesty();
  299. });
  300. }
  301. }
  302. var identWayFlag = true;
  303. var isLogined=true;
  304. var relationFlag=false;
  305. //加载关系网
  306. function initRelation(){
  307. $.ajax({
  308. url: "/member/getRelation",
  309. method: "post",
  310. data: {regNo:regNo,entName:entName},
  311. success: function(r){
  312. console.log(r);
  313. if(!r || !r.flag || !r.relation || !r.relation.links || r.relation.links.length == 0 || !r.relation.nodes || r.relation.nodes.length <= 1){
  314. }else{
  315. $(".entrelation").height($(".ent-tab-content").height());
  316. loadJS(cdn+"/js/d3.v3.min.js",function(){
  317. loadJS(cdn+"/js/geometry.js",function(){
  318. loadJS(cdn+"/js/provinceData.min.js",function(){
  319. loadJS(cdn+"/js/relation.js",function(){
  320. relationEntity = new Relation(legcerNo,regNo,regCapCurName,r.relation,true);
  321. relationEntity.init();
  322. });
  323. });
  324. });
  325. });
  326. }
  327. },
  328. error: function(){
  329. $("div[data-id=c_relation]").addClass("disabled");
  330. }
  331. });
  332. }