superSearch.js 68 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961
  1. var pageSize = 50;
  2. var nbflag = false;//是否显示的是最新招标数据
  3. var currentPage = 1;//当前页
  4. var submitflag = true;
  5. var tabularflag = "Y";
  6. var onAntiSpiderWhitelist = false; // 是否在反爬虫白名单
  7. var commonSearchWordsRegExp = [] // 通用搜索词语
  8. var tParams = goTemplateData.params
  9. if (!(tParams.isEntniche || tParams.isVip || tParams.isMember)) {
  10. localStorage.setItem('login-clear-bidsearch-list-model', 'S')
  11. }
  12. var listModel = localStorage.getItem('login-clear-bidsearch-list-model') || 'S' // 列表精简or详细 S:精简 D:详细
  13. // 采购单位画像中转页
  14. var buyerLink = '/swordfish/page_big_pc/free/loading/buyer/'
  15. // 企业画像中转页
  16. var winnerLink = '/swordfish/page_big_pc/free/loading/ent/'
  17. $(function() {
  18. priceTime();
  19. $(".Price-content").find("span:first-child").click(function(){
  20. $(this).addClass("active");
  21. $(".pricefat").removeClass("active");
  22. beforeSubmit('filter-price');
  23. })
  24. $(".timer").find("ul li:first-child").click(function(){
  25. timeshow = false;
  26. $("#starttime").css({"border-color":""});
  27. $("#endtime").css({"border-color":""});
  28. $("#timebut").hide();
  29. $(".timerInput").removeClass("customtime-active");
  30. $(this).addClass("active");
  31. $(".timerInput").removeClass("active");
  32. })
  33. //
  34. $(".pricebut").click(function(){
  35. let selectMinPrices = $(".PriceInput [name='minprice']").val();
  36. let selectMaxPrices = $(".PriceInput [name='maxprice']").val();
  37. console.log(selectMinPrices,selectMaxPrices)
  38. if(selectMinPrices && selectMaxPrices){
  39. let val = selectMinPrices+'万'+'~'+selectMaxPrices+'万'
  40. $('.selectorMoney .valueBox .title').text(val)
  41. }else{
  42. $('.selectorMoney .valueBox .title').text('价格区间')
  43. }
  44. priceCss();
  45. beforeSubmit('filter-price');
  46. searchInnerVue.$refs.selectprice.blur()
  47. })
  48. //
  49. $("#timebut").click(function(){
  50. timeshow=false;
  51. $(this).hide();
  52. $(".timerInput").removeClass("customtime-active");
  53. if($("#starttime").val()==""&&$("#endtime").val()==""){
  54. $("#starttime").css({"border-color":""});
  55. $("#endtime").css({"border-color":""});
  56. $("#timebut").hide();
  57. $(".timerInput").removeClass("customtime-active");
  58. $("#timerAll").addClass("active");
  59. $(".timerInput").removeClass("active");
  60. }else{
  61. $(".timerInput").addClass("active");
  62. $(".timer").find("ul li:first-child").removeClass("active");
  63. $(".release-time .timer li").removeClass("active");
  64. }
  65. beforeSubmit('filter-time')
  66. })
  67. //
  68. //筛选关闭和打开
  69. //根据cookie值设置筛选是否显示 移除该需求操作
  70. // var rsw = localStorage.getItem("hideorshow");
  71. // if(rsw!=null){
  72. // if(rsw=="D"){
  73. // $("#screenBtn").addClass("down");
  74. // $(".searchTender").show();
  75. // $('#fold').show()
  76. // }else{
  77. // $("#screenBtn").removeClass("down");
  78. // $(".searchTender").hide();
  79. // $('#fold').hide()
  80. // }
  81. // }
  82. //记录用户刷选按钮状态
  83. $("#screenBtn").click(function(){
  84. if($(this).attr("class").indexOf("down")>0){
  85. // localStorage.setItem("hideorshow", "D");
  86. $('#fold').show()
  87. }else{
  88. // localStorage.setItem("hideorshow", "U");
  89. $('#fold').hide()
  90. }
  91. })
  92. //
  93. var iuod = localStorage.getItem("industryuod");
  94. if(iuod!=null){
  95. if(iuod=="U"){
  96. $(".stop").click();
  97. }
  98. }
  99. //
  100. $(".stop").click(function(){
  101. if($(this).attr("class").indexOf("up")>0){
  102. localStorage.setItem("industryuod", "U");
  103. }else{
  104. localStorage.setItem("industryuod", "D");
  105. }
  106. })
  107. //全文检索和标题检索切换
  108. $("#newsclass li:nth-child(2)").click(function(){
  109. // searchInnerVue.listState.totalPage = totalPage
  110. // 重置全选按钮
  111. $('.custom-checkbox.check-all').prop('checked', false)
  112. $(".tabContainer-2 .lucene ul").html("");
  113. $("#zbSeatchT [name='selectType']").val("all");
  114. $("#right-list").addClass("active").siblings().removeClass("active");
  115. $("#allnews .lucene").show().siblings().hide();
  116. $(".tabContainer-2").hide();
  117. currentPage=1;
  118. if(submitflag){
  119. $(".hasNoData").hide();
  120. $(".working").show();
  121. // 隐藏页码
  122. searchInnerVue.showPage = false
  123. $(".tabContainer").css("min-height","600px");
  124. selectType = "all";
  125. searchOnsubmit();
  126. submitflag=false;
  127. }
  128. })
  129. $("#newsclass li:nth-child(1)").click(function(){
  130. // 重置全选按钮
  131. $('.custom-checkbox.check-all').prop('checked', false)
  132. $("#allnews .lucene ul").html("");
  133. $("#zbSeatchT [name='selectType']").val("title");
  134. $("#right-list").addClass("active").siblings().removeClass("active");
  135. $(".tabContainer-2 .lucene").show().siblings().hide();
  136. $("#allnews").hide();
  137. currentPage=1;
  138. if(submitflag){
  139. $(".hasNoData").hide();
  140. $(".working").show();
  141. // 隐藏页码
  142. searchInnerVue.showPage = false
  143. $(".tabContainer").css("min-height","600px");
  144. selectType = "title";
  145. searchOnsubmit();
  146. submitflag=false;
  147. }
  148. })
  149. $('#entsearch, #pursearch, #gysearch').on('click', function () {
  150. if($(this).attr('datahref')){
  151. location.href= $(this).attr('datahref')
  152. }
  153. })
  154. // 监听列表选择框变动时的勾选数量
  155. $('body').on('change','.custom-checkbox',function () {
  156. setTimeout(function () {
  157. let checkNum = selectDataIds ? selectDataIds.length : 0 ;
  158. if( checkNum > 0 ) {
  159. $('#checkNum-bid-box').show()
  160. $('#checkNum-bid').html(checkNum)
  161. $('#serchNum-bid').hide()
  162. }else{
  163. $('#checkNum-bid-box').hide()
  164. $('#serchNum-bid').show()
  165. }
  166. })
  167. })
  168. })
  169. //取redis里的数据
  170. function getNewBids(pnum, size){
  171. $.post("/jylab/supsearch/getNewBids",{
  172. pageNumber:pnum,
  173. pageSize: size? size : pageSize,
  174. pageType:"",
  175. fileExists: $("#zbSeatchT [name='fileExists']").val(),
  176. bid_field: $("#zbSeatchT [name='bid_field']").val(),
  177. searchGroup: $("#zbSeatchT [name='searchGroup']").val()
  178. },function(r){
  179. if(r&&r.list!=null&&r.list.length>0){
  180. $(".tabContainer").show();
  181. $(".hasNoData").hide();
  182. searchInnerVue.listState.totalPage = Math.ceil(r.count/pageSize)
  183. // searchInnerVue.checkPageNumAdd1()
  184. if (size) {
  185. appendDatas(r.list,false,true, true);
  186. } else {
  187. appendDatas(r.list,false,true);
  188. }
  189. }else{
  190. submitflag=true;
  191. $(".tabContainer").hide();
  192. $(".pagination").hide();
  193. $(".working").hide();
  194. $(".hasNoData").show();
  195. // 隐藏页码
  196. searchInnerVue.showPage = false
  197. }
  198. allCount = r.total
  199. searchInnerVue.listState.allCount = r.total
  200. // getBidIsColl()
  201. })
  202. }
  203. ////最新招标信息
  204. function getNewBiddings(num, size){
  205. var param = {
  206. pageNumber: num ? num : currentPage,
  207. pageSize: size ? size : pageSize,
  208. reqType: "lastNews",
  209. tabularflag: "Y",
  210. searchvalue: $("#zbSeatchT [name='keywords']").val(),
  211. area: $("#zbSeatchT [name='area']").val(),
  212. subtype: $("#zbSeatchT [name='subtype']").val(),
  213. publishtime: $("#zbSeatchT [name='publishtime']").val(),
  214. selectType : $("#zbSeatchT [name='selectType']").val() || 'title,content',
  215. minprice : $("#zbSeatchT [name='minprice']").val(),
  216. maxprice : $("#zbSeatchT [name='maxprice']").val(),
  217. industry : $("#zbSeatchT [name='industry']").val(),
  218. buyerclass: $("#zbSeatchT [name='buyerclass']").val(),
  219. buyertel: $("#zbSeatchT [name='buyertel']").val(),
  220. winnertel: $("#zbSeatchT [name='winnertel']").val(),
  221. notkey: $("#zbSeatchT [name='notkey']").val(),
  222. fileExists: $("#zbSeatchT [name='fileExists']").val(),
  223. city: $("#zbSeatchT [name='city']").val(),
  224. bid_field: $("#zbSeatchT [name='bid_field']").val(),
  225. searchGroup: $("#zbSeatchT [name='searchGroup']").val(),
  226. searchMode: $("#zbSeatchT [name='searchMode']").val(),
  227. wordsMode: $("#zbSeatchT [name='wordsMode']").val(),
  228. additionalWords: $("#zbSeatchT [name='additionalWords']").val()
  229. };
  230. $.post("/front/pcAjaxReq",param,function(r){
  231. heightWords = r.heightWords
  232. if(r&&r.list!=null&&r.list.length>0){
  233. // 计算总页码
  234. if (currentPage == 1) {
  235. searchInnerVue.listState.totalPage = Math.ceil(r.count/pageSize)
  236. allCount = r.total
  237. searchInnerVue.listState.allCount = r.total
  238. // searchInnerVue.checkPageNumAdd1()
  239. }
  240. $(".tabContainer").show();
  241. $(".hasNoData").hide();
  242. if (size && num === 1) {
  243. appendDatas(r.list,true,true, true);
  244. } else {
  245. appendDatas(r.list,false,false);
  246. }
  247. }else{
  248. if(currentPage>1){
  249. currentPage = currentPage-1;
  250. return false
  251. }
  252. submitflag=true;
  253. $(".tabContainer").hide();
  254. $(".pagination").hide();
  255. $(".working").hide();
  256. $(".hasNoData").show();
  257. // 隐藏页码
  258. searchInnerVue.showPage = false
  259. allCount = 0
  260. searchInnerVue.listState.allCount = 0
  261. }
  262. autoModelFn(r)
  263. })
  264. }
  265. //
  266. function appendDatas(datas,flag,isNew,onlyUpdateTable){
  267. // flag // 是否有输入
  268. let is_field=$("#zbSeatchT [name='bid_field']").val() //是否是领域化
  269. let selectContext=selectType.indexOf('content') > -1 //是否正文搜索
  270. console.log('selectType: ' + selectType,',flag: ',flag)
  271. var listHtml = '';
  272. var tableHtml = '';
  273. $(".working").hide();
  274. $(".pagination").show();
  275. // 列表模式下显示页码 表格模式下隐藏
  276. if (searchInnerVue.dataTab == 'list') {
  277. searchInnerVue.showPage = true
  278. } else {
  279. searchInnerVue.showPage = false
  280. }
  281. var searchvalueArray = heightWords.split(" ");
  282. // console.log('需要高亮的关键词、附加词组:' + searchvalueArray)
  283. $(".pagination-inner").find("span").text(currentPage);
  284. //(数据够20条显示查看更多遮罩层)
  285. if (currentPage==1){//第一页得时候需要判断 是否显示遮罩层
  286. if(datas.length>=20){
  287. $(".shade_table").css("display","");
  288. }else{
  289. $(".shade_table").css("display","none");
  290. }
  291. }
  292. for(var i=0;i<datas.length;i++){
  293. var index = (currentPage - 1) * pageSize + i + 1;
  294. var title = datas[i].title;
  295. var detail = datas[i].detail;
  296. var fileExists = datas[i].fileExists
  297. if(detail){
  298. detail = detail.replace(/[^\{\u4e00-\u9fa5]{1,90}{[^\}\u4e00-\u9fa5]+?}/g,"")
  299. if(detail.length>200){
  300. detail = detail.substring(0,200)+"..."
  301. }
  302. }
  303. // if(flag){
  304. title = keyWordHighlight(title,searchvalueArray,"<font class='com-highlight'>$1</font>");
  305. title=title.replace(/\<br>/g,"")
  306. if (detail) {
  307. detail = keyWordHighlight(detail,searchvalueArray,"<font class='com-highlight'>$1</font>");
  308. }
  309. // }
  310. // if(title.length<40){
  311. // title=title+"<span style='color:#fff;display:none;'>"+Math.random().toString(36).substring(2)+"<span>";
  312. // }
  313. var type = datas[i].subtype;
  314. if(typeof(type) == "undefined" || type == null || type == ""){
  315. type = datas[i].toptype;
  316. }
  317. if(typeof(type) == "undefined" || type == null || type == ""){
  318. type = datas[i].type;
  319. if(type == "bid"){
  320. type = "中标";
  321. datas[i].stypeadd="ZHB"
  322. }else if(type == "tender"){
  323. datas[i].stypeadd="ZB"
  324. type = "招标";
  325. }else{
  326. type = "";
  327. }
  328. }
  329. if (!onlyUpdateTable){ //是否仅更新table
  330. listHtml += '<li>'
  331. listHtml +='<div class="liLuceneList" style="border-bottom: 1px solid #EBEBEB;">'
  332. listHtml += '<input class="custom-checkbox title-text-checkbox" name="bid-list" type="checkbox" dataid="'+datas[i]._id+'" data-area="'+ datas[i].area+'"/>'
  333. listHtml +='<div class="list-container">'
  334. // 标题、推送时间
  335. listHtml += '<div class="bid-list-title">'
  336. + '<div class="list-title-flex ellipsis"><em class="visited-hd">'+index+'.</em>'
  337. + '<a class="visited-hd" onclick="noIn(this)" dataid="'+datas[i]._id+'" dataindustry="'+datas[i].industry+'" target="_blank"> '+title+ '</a></div>'
  338. if(typeof(datas[i].publishtime) != "undefined" && datas[i].publishtime != null && datas[i].publishtime != ""){
  339. var diff =new Date(parseInt(datas[i].publishtime*1000)).pattern('yyyy-MM-dd');
  340. if(diff != null){
  341. listHtml += '<span class="com-time">'+diff+'</span>';
  342. }
  343. }
  344. listHtml += '</div>'
  345. // 正文
  346. if(selectContext && detail) {
  347. listHtml += '<div class="bid-list-content">' + detail + '</div>'
  348. }
  349. // 分类标签、收藏
  350. listHtml += '<div class="bid-list-tags">'
  351. +'<div>'
  352. if (datas[i].site == '剑鱼信息发布平台') {
  353. listHtml += '<span class="tags-item tags-publish">用户发布</span>'
  354. }
  355. if ($.trim(datas[i].area) != "" && datas[i].area != "A"&&datas[i].area.indexOf("免费注册")<0) {
  356. listHtml += '<a class="tags-item" href="javascript:;"'+'onclick="gologin('+"'/list/area/"+datas[i].areaadd+".html')"+'">'+datas[i].area+'</a>';
  357. } else {
  358. listHtml += '<a href="#" style="display:none;"></a>';
  359. }
  360. if (typeof(type) != "undefined" && type != null && type != ""&&type.indexOf("免费注册")<0) {
  361. listHtml += '<a class="tags-item" href="javascript:;"'+'onclick="gologin('+"'/list/stype/"+datas[i].stypeadd+".html')"+'">'+type+'</a>';
  362. } else {
  363. listHtml += '<a href="#" style="display:none;"></a>';
  364. }
  365. // if (typeof(datas[i].industry) != "undefined" && datas[i].industry != null && datas[i].industry != ""&&!is_field) {
  366. // listHtml += '<a class="tags-item tags-industry" href="javascript:;"'+'onclick="gologin('+"'/list/industry/"+datas[i].indadd+".html')"+'">'+datas[i].industry+'</a>';
  367. // } else {
  368. // listHtml += '<a href="javascript:volid(0);" style="display:none;"></a>';
  369. // }
  370. if (typeof(datas[i].buyerclass) != "undefined" && datas[i].buyerclass != null && datas[i].buyerclass != ""&&!is_field && datas[i].buyerclass !== '其它'&&datas[i].buyerclass.indexOf("免费注册")<0) {
  371. listHtml += '<a class="tags-item" href="javascript:volid(0);"'+'>'+datas[i].buyerclass+'</a>';
  372. } else {
  373. listHtml += '<a href="javascript:volid(0);" style="display:none;"></a>';
  374. }
  375. var amount= getacount(datas[i].bidamount,datas[i].budget)
  376. if (amount!="") {
  377. /**
  378. * @date 2023/2/15 支持未登录用户使用,存在字符串 略,需要额外判断
  379. */
  380. var tempMoneyNumber = amount
  381. if (typeof tempMoneyNumber === 'number') {
  382. tempMoneyNumber = conversionMoeny(tempMoneyNumber)
  383. }
  384. listHtml += '<a class="tags-item">'+tempMoneyNumber+'</a>';
  385. } else {
  386. listHtml += '<a href="javascript:volid(0);" style="display:none;"></a>';
  387. }
  388. // 附件
  389. if (fileExists) {
  390. listHtml+='<span class="tags-item tags-file">'+'有附件'+'</span>'
  391. }
  392. listHtml+='</div>'
  393. listHtml+='<div>'
  394. // 是否参标(2022/05/12)
  395. listHtml += '<i class="icon-canbiao" style="display:none" dataid="'+datas[i]._id+'" ></i>'
  396. // // 是否收藏
  397. listHtml += '<i class="icon-collect" dataid="'+datas[i]._id+'"></i>'
  398. // 是否山川应用嵌入环境 添加操作按钮
  399. var inInjectBI = getParam('report') === 'bi' || (location.href.indexOf('/jylab/bi/index') !== -1)
  400. if (inInjectBI) {
  401. listHtml += '<button class="bi-report-inject-button" data-id="'+datas[i]._id+'">添加</button>'
  402. }
  403. listHtml+='</div>'
  404. listHtml += '</div>'
  405. // 详细列表内容
  406. if (listModel === 'D') {
  407. listHtml += '<div class="bid-detail-info" data-subtype='+ datas[i].subtype +'>'
  408. if (datas[i].buyer || datas[i].buyertel || datas[i].budget) {
  409. listHtml += '<p class="d-i-item">'
  410. if (datas[i].buyer) {
  411. listHtml += '<span><i class="d-i-item-label">采购单位:</i>'
  412. // 可能是多个采购单位(测试环境出现过)
  413. if (datas[i].buyer.indexOf('、') > -1) {
  414. var buyerArr = datas[i].buyer.split('、')
  415. console.log(buyerArr);
  416. for(var j = 0; j< buyerArr.length;j++) {
  417. var dun = j != buyerArr.length - 1 ? '<i class="highlight-text">、</i>' : ''
  418. listHtml += '<a class="highlight-text" href="' + buyerLink + buyerArr[j] +'" target="_blank">'+ buyerArr[j]+ '</a>' + dun
  419. }
  420. } else {
  421. listHtml += '<a class="highlight-text" href="' + buyerLink + datas[i].buyer +'" target="_blank">'+ datas[i].buyer+ '</a>'
  422. }
  423. listHtml += '</span>'
  424. }
  425. if (datas[i].buyertel) {
  426. datas[i].buyerperson = datas[i].buyerperson ? datas[i].buyerperson +',' : ''
  427. listHtml += '<span><i class="d-i-item-label">采购单位联系方式:</i>'+ datas[i].buyerperson + datas[i].buyertel + '<a class="highlight-text" href="' + buyerLink + datas[i].buyer + '?position=contact" target="_blank"> 获取更多</a></span>'
  428. }
  429. if (datas[i].budget) {
  430. /**
  431. * @date 2023/2/15 支持未登录用户使用,存在字符串 略,需要额外判断
  432. */
  433. var tempMoneyNumber = datas[i].budget
  434. if (typeof tempMoneyNumber === 'number') {
  435. tempMoneyNumber = conversionMoeny(tempMoneyNumber)
  436. }
  437. listHtml += '<span><i class="d-i-item-label">预算金额:</i>' + tempMoneyNumber + '</span>'
  438. }
  439. listHtml +='</p>'
  440. }
  441. if (datas[i].agency || datas[i].agencytel) {
  442. listHtml += '<p class="d-i-item">'
  443. if (datas[i].agency) {
  444. listHtml += '<span><i class="d-i-item-label">代理机构:</i>' + datas[i].agency + '</span>'
  445. }
  446. if (datas[i].agencytel) {
  447. datas[i].agencyperson = datas[i].agencyperson ? datas[i].agencyperson +',' : ''
  448. listHtml += '<span><i class="d-i-item-label">代理机构联系方式:</i>' + datas[i].agencyperson + datas[i].agencytel + '</span>'
  449. }
  450. listHtml +='</p>'
  451. }
  452. if (datas[i].winnerInfo || datas[i].winnertel || datas[i].bidamount) {
  453. listHtml += '<p class="d-i-item">'
  454. if (datas[i].winnerInfo) {
  455. listHtml += '<span><i class="d-i-item-label">中标单位:</i>'
  456. for(var j=0;j<datas[i].winnerInfo.length;j++) {
  457. var dun = j != datas[i].winnerInfo.length - 1 ? '<i class="highlight-text">、</i>' : ''
  458. listHtml +='<a class="highlight-text" href="' + winnerLink + datas[i].winnerInfo[j].winnerId +'" target="_blank">'+ datas[i].winnerInfo[j].winner+ '</a>'+ dun
  459. }
  460. listHtml +='</span>'
  461. }
  462. if (datas[i].winnertel && datas[i].winnerInfo) {
  463. // 如果有两个中标单位则不显示‘获取更多’,只有一个中标单位显示‘获取更多’并跳到画像通讯录锚点位置
  464. var moreWinnerTel = datas[i].winnerInfo && datas[i].winnerInfo.length > 1 ? '' :'<a class="highlight-text" href="' + winnerLink + datas[i].winnerInfo[0].winnerId + '?position=contact" target="_blank"> 获取更多</a></span>'
  465. datas[i].winnerperson = datas[i].winnerperson ? datas[i].winnerperson +',' : ''
  466. listHtml += '<span><i class="d-i-item-label">中标单位联系方式:</i>' + datas[i].winnerperson + datas[i].winnertel + moreWinnerTel +'</span>'
  467. }
  468. if (datas[i].bidamount) {
  469. /**
  470. * @date 2023/2/15 支持未登录用户使用,存在字符串 略,需要额外判断
  471. */
  472. var tempMoneyNumber = datas[i].bidamount
  473. if (typeof tempMoneyNumber === 'number') {
  474. tempMoneyNumber = conversionMoeny(tempMoneyNumber)
  475. }
  476. listHtml += '<span><i class="d-i-item-label">中标金额:</i>'+ tempMoneyNumber +'</span>'
  477. }
  478. listHtml +='</p>'
  479. }
  480. if (datas[i].signendtime || datas[i].bidendtime || datas[i].bidopentime) {
  481. listHtml += '<p class="d-i-item">'
  482. if (datas[i].signendtime) {
  483. listHtml += '<span><i class="d-i-item-label">报名截止日期:</i>' + utils.dateFromNow(Number(datas[i].signendtime+"000")) +'</span>'
  484. }
  485. if (datas[i].bidendtime) {
  486. listHtml += '<span><i class="d-i-item-label">投标截止日期:</i>' + utils.dateFromNow(Number(datas[i].bidendtime+"000")) + '</span>'
  487. }
  488. if (datas[i].bidopentime) {
  489. /**
  490. * @date 2023/2/15 支持未登录用户使用,存在字符串 略,需要额外判断
  491. */
  492. var tempDate = datas[i].bidopentime
  493. if (typeof tempDate === 'number') {
  494. tempDate = utils.dateFromNow(Number(tempDate+"000"))
  495. }
  496. listHtml += '<span><i class="d-i-item-label">开标日期:</i>' + tempDate + '</span>'
  497. }
  498. listHtml +='</p>'
  499. }
  500. //领域化展示 商品&采购单位&中标单位
  501. if (is_field){
  502. listHtml += '<p class="d-i-item">'
  503. if (datas[i].purchasing) {
  504. listHtml += '<span><i class="d-i-item-label">产品:</i>' + datas[i].purchasing +'</span>'
  505. }
  506. listHtml +='</p>'
  507. }
  508. listHtml += '</div>'
  509. }
  510. listHtml += '</div>'
  511. listHtml +='</div>'
  512. listHtml += '</li>'
  513. if(i == 5) {
  514. listHtml += '<div data-list-ad class="_t3di2018y5"></div>'
  515. }
  516. if(i == 26) {
  517. listHtml += '<div data-list-ad class="_6omliqck79a"></div>'
  518. }
  519. }
  520. //表格仅显示前20条信息
  521. if (i >= 20||currentPage!=1){
  522. continue
  523. }
  524. tableHtml +='<tr onclick="noIn(this)" dataid="'+datas[i]._id+'" dataindustry="'+datas[i].industry+'" target="_blank">'
  525. +'<td width="48"><div>'+index+'</div></td>'
  526. if(typeof(datas[i].projectname) != "undefined" && datas[i].projectname != null && datas[i].projectname != ""){
  527. datas[i].projectname = keyWordHighlight(datas[i].projectname,searchvalueArray,"<font class='com-highlight'>$1</font>");
  528. tableHtml += '<td class="tt-l" width="315"><div>'+datas[i].projectname+'</div></td>';
  529. }else{
  530. let title=datas[i].title.replace(/\<br>/g,"")
  531. tableHtml += '<td class="tt-l" width="315"><div>'+title+'</div></td>';
  532. }
  533. if(typeof(type) != "undefined" && type != null && type != ""){
  534. tableHtml += '<td width="84"><div>'+type+'公告</div></td>';
  535. }else{
  536. tableHtml += '<td width="84"><div></div></td>';
  537. }
  538. if(typeof(datas[i].budget) != "undefined" && datas[i].budget != null && datas[i].budget != ""){
  539. /**
  540. * @date 2023/2/15 支持未登录用户使用,存在字符串 略,需要额外判断
  541. */
  542. var budget = datas[i].budget
  543. if (typeof datas[i].budget === 'number') {
  544. budget = tableFormatMoney(datas[i].budget, {
  545. type: 'number',
  546. digit: 2,
  547. level: 1
  548. })
  549. }
  550. tableHtml += '<td class="tt-r" width="73"><div>'+budget+'</div></td>';
  551. }else{
  552. tableHtml += '<td class="tt-r" width="73"><div></div></td>';
  553. }
  554. if(typeof(datas[i].buyer) != "undefined" && datas[i].buyer != null && datas[i].buyer != ""){
  555. tableHtml += '<td class="tt-l" width="181"><div>'+datas[i].buyer+'</div></td>';
  556. }else{
  557. tableHtml += '<td class="tt-l" width="181"><div></div></td>';
  558. }
  559. if(typeof(datas[i].bidopentime) != "undefined" && datas[i].bidopentime != null && datas[i].bidopentime != ""){
  560. /**
  561. * @date 2023/2/15 支持未登录用户使用,存在字符串 略,需要额外判断
  562. */
  563. var diff = datas[i].bidopentime
  564. if (typeof datas[i].bidopentime === 'number') {
  565. diff = formatDate(Number(datas[i].bidopentime),"l");
  566. }
  567. tableHtml += '<td width="103"><div>'+diff+'</div></td>';
  568. }else{
  569. tableHtml += '<td width="103"><div></div></td>';
  570. }
  571. if(typeof(datas[i].winner) != "undefined" && datas[i].winner != null && datas[i].winner != ""){
  572. tableHtml += '<td class="tt-l" width="174"><div>'+datas[i].winner+'</div></td>';
  573. }else{
  574. tableHtml += '<td class="tt-l" width="174"><div></div></td>';
  575. }
  576. if(typeof(datas[i].bidamount) != "undefined" && datas[i].bidamount != null && datas[i].bidamount != ""){
  577. /**
  578. * @date 2023/2/15 支持未登录用户使用,存在字符串 略,需要额外判断
  579. */
  580. var bidamount = datas[i].bidamount
  581. if (typeof datas[i].bidamount === 'number') {
  582. bidamount = tableFormatMoney(datas[i].bidamount, {
  583. type: 'number',
  584. digit: 2,
  585. level: 1
  586. })
  587. }
  588. tableHtml += '<td class="tt-r" width="76"><div>'+bidamount+'</div></td>';
  589. }else{
  590. tableHtml += '<td class="tt-r" width="76"><div></div></td>';
  591. }
  592. if(typeof(datas[i].publishtime) != "undefined" && datas[i].publishtime != null && datas[i].publishtime != ""){
  593. var diff = formatDate(Number(datas[i].publishtime),"s");
  594. if(diff != null){
  595. tableHtml += '<td width="103"><div>'+diff+'</div></td>';
  596. }
  597. }else{
  598. tableHtml += '<td width="103"><div></div></td>';
  599. }
  600. tableHtml+='</tr>'
  601. }
  602. // 搜索框有输入词
  603. if(flag){
  604. if(selectContext) {
  605. $("#allnews").show();
  606. $(".tabContainer-2").hide();
  607. } else {
  608. $("#allnews").hide();
  609. $(".tabContainer-2").show();
  610. }
  611. }else{
  612. $("#allnews").hide();
  613. $(".tabContainer-2").show();
  614. }
  615. if (currentPage!=1){
  616. tableHtml = sessionStorage.getItem("table_first_context")
  617. }else{
  618. sessionStorage.setItem("table_first_context",tableHtml)
  619. }
  620. //console.log(listHtml)
  621. // 没有关键词或者没有选中正文
  622. if(!flag||!selectContext){
  623. if (!onlyUpdateTable){
  624. $(".tabContainer-2 .lucene ul").html(listHtml);
  625. }
  626. $(".tabContainer-2 .lucene-table table tbody").html(tableHtml);
  627. }else{
  628. if(selectContext){
  629. if (!onlyUpdateTable){
  630. $("#allnews .lucene ul").html(listHtml);
  631. }
  632. $("#allnews .lucene-table table tbody").html(tableHtml);
  633. }
  634. }
  635. $(".tabContainer").css("min-height","");
  636. submitflag=true;
  637. // backTopAdjust();
  638. // 生成dom之后再查标讯有无收藏
  639. getBidIsColl()
  640. // 生成dom之后再查标讯有无参标
  641. getBidIsJoin()
  642. checkVisited()
  643. // 生成dom之后再查询是否勾选
  644. getCheckList()
  645. distributeInit() // 分发初始化
  646. /**
  647. * @date 2022/12/15 山川环境嵌入搜索
  648. * 更新是否已添加状态
  649. */
  650. InBIInjectHooks.check()
  651. // 信息类型是“采购意向”和“拟建项目”,无采购意向和拟建项目权限的超级订阅用户(老超级订阅用户),即使选择详细列表,也按照精简列表展示
  652. // 大会员、商机管理、超级订阅(配置时间之前的老用户)有超前项目权限
  653. if (!goTemplateData.params.vipBefore202209 && !goTemplateData.params.isMember && !goTemplateData.params.isEntniche) {
  654. $('.bid-detail-info[data-subtype="拟建"]').hide()
  655. $('.bid-detail-info[data-subtype="采购意向"]').hide()
  656. }
  657. }
  658. function getacount(bidamount,budget){
  659. if(typeof(bidamount) != "undefined" && bidamount != null && bidamount != ""&&bidamount!=="免费注册即可查看"){
  660. return bidamount
  661. }
  662. if(typeof(budget) != "undefined" && budget != null && budget != ""&&budget!=="免费注册即可查看"){
  663. return budget
  664. }
  665. return ""
  666. }
  667. //金额转化 金额:0-万元以下单位为元 ,万元以上至亿元以下单位为万元 ,亿元以上单位为亿元。保留 小数点后 2 位,不进行四舍五入。
  668. function conversionMoeny(money){
  669. var m = ""+money;
  670. var m_arr = m.split(".")
  671. var m_1 = m_arr[0]
  672. var len_m1 = m_1.length;
  673. if (len_m1 >= 9 ){
  674. m = m_1.substring(0,len_m1-8) + "." + m_1.substring(len_m1-8,len_m1-6) + "亿元"
  675. } else if (len_m1 >= 5) {
  676. m =m_1.substring(0,len_m1-4) + "." + m_1.substring(len_m1-4,len_m1-2) + "万元"
  677. } else {
  678. if(m_arr.length == 1) {
  679. return m + ".00元"
  680. }
  681. var m_2 = m_arr[1]
  682. if (m_2.length > 1) {
  683. m_2 = m_2.substring(0,2)
  684. } else {
  685. m_2 = m_2.substring(0,1) + "0"
  686. }
  687. m = m_1 + "." + m_2 + "元"
  688. }
  689. return m
  690. }
  691. //关闭遮罩层
  692. function layerClose(){
  693. $("#myModal").modal("hide");
  694. }
  695. //
  696. function formatDate(date,sl) {
  697. var myDate = new Date(date*1000);
  698. var year=myDate.getFullYear();
  699. var month=myDate.getMonth()+1;
  700. var date=myDate.getDate();
  701. var hour = myDate.getHours()
  702. var min = myDate.getMinutes()
  703. if(sl=="l"){
  704. if(hour<10){
  705. hour="0"+hour
  706. }
  707. if(min<10){
  708. min="0"+min
  709. }
  710. return year+"-"+month+"-"+date+"<br>"+hour+":"+min;
  711. }else{
  712. return year+"-"+month+"-"+date;
  713. }
  714. }
  715. //
  716. function onpicking(dp,obj){
  717. var time = new Date(dp.cal.newdate.y,dp.cal.newdate.M-1,dp.cal.newdate.d).getTime()+"";
  718. time = time.substring(0,time.length - 3);
  719. $(obj).attr("data-value",time);
  720. }
  721. //
  722. function onclearing(obj){
  723. $(obj).attr("data-value","");
  724. //localStorage.removeItem($(obj).attr("id"))
  725. if($(".customtime").hasClass("active") && getInputTime().join("") == ""){
  726. $(".customtime").removeClass("active");
  727. $("#publishtime #alltime").addClass("active");
  728. }
  729. }
  730. //
  731. function picked(dp,obj){
  732. //localStorage.setItem($(obj).attr("id"),$(obj).val()+"_"+$(obj).attr("data-value"))
  733. }
  734. //
  735. function getInputTime(){
  736. var starttime = $("#starttime").attr("data-value");
  737. if(starttime){
  738. starttime = $.trim(starttime);
  739. }else{
  740. starttime = "";
  741. }
  742. var endtime = $("#endtime").attr("data-value");
  743. if(endtime){
  744. endtime = $.trim(endtime);
  745. // 处理endtime,endtime取当日23:59:59
  746. // 将enttime时间戳加1天并减去1秒(单位用s来计算)
  747. //var day1 = 24 * 60 * 60
  748. //var seconds1 = 1
  749. //endtime = Number(endtime) + day1 - seconds1
  750. //电脑端保存的刷选 结束时间+1天没问题,因为结束时间是当前0点;移动端保存刷选的结束时间是当前23点59分59秒,再+1天会延长到第二天 23点59分58秒;
  751. // 这块放后端处理:搜索的时候默认到当天23点59分59秒;
  752. }else{
  753. endtime = "";
  754. }
  755. return [starttime,endtime]
  756. }
  757. //---取VIP数据---
  758. function getVIPData(clickpaging){
  759. var this_selectType = $("#zbSeatchT [name='selectType']").val();
  760. if(this_selectType != "all"){
  761. LimitClass.limitFlag = false;
  762. LimitClass.result = null;
  763. LimitClass.list = null;
  764. }else{
  765. if(LimitClass.limitFlag){
  766. if(clickpaging){
  767. LimitClass.paging(currentPage);
  768. }else{
  769. $(".tabContainer .lucene").hide();
  770. $(".tabContainer .lucene-table").show();
  771. }
  772. return true;
  773. }
  774. }
  775. var tlflag = false;
  776. $(".tabContainer-2 .lucene").hide();
  777. $("#allnews").hide();
  778. $(".pagination").hide();
  779. $(".working").show();
  780. // 隐藏页码
  781. searchInnerVue.showPage = false
  782. if(!$("#zbSeatchT [name='keywords']").val()&&!$("#zbSeatchT [name='keywords']").val()&&!$("#zbSeatchT [name='industry']").val()){
  783. $(".working").hide();
  784. $(".pagination").show();
  785. // 显示页码
  786. searchInnerVue.showPage = true
  787. return true;
  788. }
  789. var tabflag = false;
  790. if($("#zbSeatchT [name='keywords']").val()!=""){
  791. // $("#newsclass").show();
  792. // $("#newsnow").hide();
  793. tlflag = true;
  794. }else{
  795. // $("#newsclass").hide();
  796. // $("#newsnow").show();
  797. tlflag = false;
  798. }
  799. var reqType="bidSearch";
  800. if($("#zbSeatchT [name='keywords']").val()==""){
  801. reqType="lastNews";
  802. }
  803. var param = {
  804. pageNumber: 1,
  805. pageSize: pageSize,
  806. reqType: reqType,
  807. searchvalue: $("#zbSeatchT [name='keywords']").val(),
  808. area: $("#zbSeatchT [name='area']").val(),
  809. subtype: $("#zbSeatchT [name='subtype']").val(),
  810. publishtime: $("#zbSeatchT [name='publishtime']").val(),
  811. selectType : this_selectType || 'title,content',
  812. minprice : $("#zbSeatchT [name='minprice']").val(),
  813. maxprice : $("#zbSeatchT [name='maxprice']").val(),
  814. industry : $("#zbSeatchT [name='industry']").val(),
  815. tabularflag : tabularflag,
  816. buyerclass: $("#zbSeatchT [name='buyerclass']").val(),
  817. buyertel: $("#zbSeatchT [name='buyertel']").val(),
  818. winnertel: $("#zbSeatchT [name='winnertel']").val(),
  819. notkey: $("#zbSeatchT [name='notkey']").val(),
  820. fileExists: $("#zbSeatchT [name='fileExists']").val(),
  821. city: $("#zbSeatchT [name='city']").val(),
  822. bid_field: $("#zbSeatchT [name='bid_field']").val(),
  823. searchGroup: $("#zbSeatchT [name='searchGroup']").val(),
  824. searchMode: $("#zbSeatchT [name='searchMode']").val(),
  825. wordsMode: $("#zbSeatchT [name='wordsMode']").val(),
  826. additionalWords: $("#zbSeatchT [name='additionalWords']").val()
  827. };
  828. $.ajax({
  829. type:'post',
  830. url:'/front/pcAjaxReq',
  831. async:false,
  832. data:param,
  833. dataType:'json',
  834. success:function(r){
  835. afterAjaxReq(r);
  836. if(r&&r.list!=null&&r.list.length>0){
  837. $(".hasNoData").hide();
  838. // appendDatas(r.list,tlflag,true,true);
  839. appendDatas(r.list,tlflag,true,false);
  840. }else{
  841. $(".working").hide();
  842. $(".hasNoData").show();
  843. // 隐藏页码
  844. searchInnerVue.showPage = false
  845. }
  846. tabflag = true;
  847. autoModelFn(r)
  848. }
  849. })
  850. return tabflag
  851. }
  852. getWhetherInAntiSpiderWhiteList()
  853. // 判断文字中是否有通用词(返回true表示text是通用词)
  854. // (关键词不为空时,判断是否包含通用词)
  855. function checkTextIncludesCommonWords (text) {
  856. if (!text) {
  857. return false
  858. }
  859. var passArr = []
  860. text = $.trim(text)
  861. if ($.isArray(commonSearchWordsRegExp)) {
  862. commonSearchWordsRegExp.forEach(function (reg) {
  863. var c = text.replace(reg, '')
  864. passArr.push(!!c)
  865. })
  866. }
  867. var hasNoPass = passArr.indexOf(false) !== -1
  868. return hasNoPass
  869. }
  870. // text: 去空格后的主关键词
  871. function checkAndClearTextIncludesCommonWords (text) {
  872. var mainKeysHasCommonWords = false
  873. var additionalWordsHasCommonWords = false
  874. // 检查主关键词
  875. if (checkTextIncludesCommonWords(text)) {
  876. mainKeysHasCommonWords = true
  877. $('#t-clear').trigger('click')
  878. }
  879. // 检查附加词
  880. var additionalWords = searchInnerVue.keywordTags
  881. var replacedAdditionalWords = []
  882. if ($.isArray(additionalWords)) {
  883. for(var i = 0; i < additionalWords.length; i++) {
  884. var item = additionalWords[i]
  885. if (checkTextIncludesCommonWords(item)) {
  886. // ...
  887. additionalWordsHasCommonWords = true
  888. } else {
  889. replacedAdditionalWords.push(item)
  890. }
  891. }
  892. if (additionalWordsHasCommonWords) {
  893. searchInnerVue.keywordTags = replacedAdditionalWords
  894. }
  895. }
  896. return mainKeysHasCommonWords || additionalWordsHasCommonWords
  897. }
  898. /// 搜索前执行函数
  899. function beforeSubmit(from){
  900. // from=='F'即执行的是点击搜索按钮或回车搜索事件
  901. // from=='filter-*'表示筛选查询事件
  902. // from=='tab-*'表示tab切换查询事件
  903. // from=='page-init-recovery'回显搜索
  904. from = from || ''
  905. var searchKeywords = $.trim($("#zbSeatchT input[name='keywords']").val())
  906. // 如果在反爬白名单,则空搜索刷新搜索结果(即允许空搜索)
  907. // 不在,则不允许空搜索(此处空搜索指的是主搜索框是否为空)
  908. if (!onAntiSpiderWhitelist) {
  909. // 切换三种筛选类型时候判断(切换tab时不弹窗)
  910. if (!searchKeywords) {
  911. if (from.indexOf('tab-') !== -1) {
  912. return false
  913. }
  914. }
  915. // 关键词去两边空格后为空
  916. if (!searchKeywords && searchInnerVue.keywordTags.length === 0) {
  917. showToast('请先输入关键词')
  918. return false
  919. } else {
  920. // 判断关键词中是否有通用词,并清空对应通用词的项
  921. var hasCommonWords = checkAndClearTextIncludesCommonWords(searchKeywords)
  922. if (hasCommonWords) {
  923. showToast('请输入项目名称等关键词')
  924. return false
  925. }
  926. }
  927. }
  928. // 关键词不为空时 存sessionStorage值
  929. if (searchKeywords !== "") {
  930. sessionStorage.setItem('is-click-search', 1)
  931. } else {
  932. sessionStorage.removeItem('is-click-search')
  933. }
  934. // 重置全选按钮
  935. $('.custom-checkbox.check-all').prop('checked', false)
  936. $(".hasNoData").hide();
  937. $(".working").show();
  938. // 隐藏页码
  939. searchInnerVue.showPage = false
  940. //$(".tabContainer-2 .lucene ul").html("");
  941. //$(".tabContainer-2 .lucene-table table tbody").html("");
  942. $(".tabContainer .lucene ul").html("");
  943. //$(".tabContainer .lucene-table table tbody").html("");
  944. $(".tabContainer").css("min-height","600px");
  945. // $("#right-list").addClass("active").siblings().removeClass("active");
  946. $(".tabContainer-2 .lucene").show().siblings().hide();
  947. // $("#right-list").addClass("active").siblings().removeClass("active");
  948. $("#allnews .lucene").show().siblings().hide();
  949. $(".tabContainer-2").hide();
  950. $("#allnews").hide();
  951. $(".pagination").hide();
  952. searchInnerVue.dataTab = 'list'
  953. searchInnerVue.listModel = localStorage.getItem('login-clear-bidsearch-list-model')
  954. setTimeout(function(){
  955. currentPage=1;
  956. // 重置element ui页码为1
  957. searchInnerVue.listState.num = 1
  958. //时间
  959. var publishtime = null;
  960. var timeslot = getInputTime().join("_");
  961. if($(".timerInput").hasClass("active")){
  962. if(timeslot != "_"){
  963. $("#zbSeatchT [name='publishtime']").val(timeslot);
  964. }else{
  965. $("#zbSeatchT [name='publishtime']").val("");
  966. }
  967. }else{
  968. publishtime = $(".timer .active").attr("data-value");
  969. if(typeof(publishtime) != "undefined"){
  970. $("#zbSeatchT [name='publishtime']").val(publishtime);
  971. }else{
  972. $("#zbSeatchT [name='publishtime']").val("");
  973. }
  974. }
  975. if(timeslot != "_"){
  976. $("#zbSeatchT [name='timeslot']").val(timeslot);
  977. }else{
  978. $("#zbSeatchT [name='timeslot']").val("");
  979. }
  980. //地区
  981. // var selectAreas = "";
  982. // $(".region-content .active:not(.parent-node)").each(function(){
  983. // var thisText = $(this).text();
  984. // if(thisText != "全国"){
  985. // if(selectAreas != ""){
  986. // selectAreas += ",";
  987. // }
  988. // selectAreas += thisText;
  989. // }
  990. // });
  991. // $("#zbSeatchT [name='area']").val(selectAreas);
  992. //类型
  993. var selectSubTypes = "";
  994. $(".info-content .active:not(.parent-node)").each(function(){
  995. if($(this).attr("id") == "whole"||$(this).attr("id") == "infoBtn"){
  996. return true;
  997. }
  998. var thisText = $(this).attr("data-value");
  999. if (thisText!=undefined){
  1000. if(selectSubTypes != ""){
  1001. selectSubTypes += ",";
  1002. }
  1003. selectSubTypes += thisText;
  1004. }
  1005. });
  1006. // 信息类型二级分类全选只传一级分类文案
  1007. $(".info-content .parent-node").each(function(){
  1008. if($(this).attr("id") == "whole"||$(this).attr("id") == "infoBtn"){
  1009. return true;
  1010. }
  1011. var thisHaveClass = $(this).hasClass("active");
  1012. let thisText = $(this).text()
  1013. if (thisHaveClass){
  1014. if(thisText == '招标预告') {
  1015. selectSubTypes = selectSubTypes.replace(/预告,预审,预审结果,论证意见,需求公示/, "招标预告")
  1016. } else if(thisText == '招标公告') {
  1017. selectSubTypes = selectSubTypes.replace(/招标,邀标,询价,竞谈,单一,竞价,变更/, "招标公告")
  1018. } else if(thisText == '招标结果') {
  1019. selectSubTypes = selectSubTypes.replace(/中标,成交,废标,流标/, "招标结果")
  1020. } else if(thisText == '招标信用信息') {
  1021. selectSubTypes = selectSubTypes.replace(/合同,验收,违规/, "招标信用信息")
  1022. }
  1023. }
  1024. });
  1025. $("#zbSeatchT [name='subtype']").val(selectSubTypes);
  1026. //行业
  1027. var selectIndustrys = "";
  1028. var thisText = "";
  1029. $(".industry-content .active").each(function(){
  1030. if($(this).attr("id") == "induAll"){
  1031. return true;
  1032. }else if($(this).hasClass("active")&&$(this).hasClass("parent-node")){
  1033. $(this).nextUntil(".diver").each(function(){
  1034. thisText = $(this).attr("data-value");
  1035. if(selectIndustrys != ""){
  1036. selectIndustrys += ",";
  1037. }
  1038. selectIndustrys += thisText;
  1039. });
  1040. }else{
  1041. thisText = $(this).attr("data-value");
  1042. if(selectIndustrys != ""){
  1043. selectIndustrys += ",";
  1044. }
  1045. selectIndustrys += thisText;
  1046. }
  1047. });
  1048. // $("#zbSeatchT [name='industry']").val(selectIndustrys); // 使用下拉组件赋值隐藏域 这里不再赋值
  1049. //价格
  1050. if(!$("#priceAll").hasClass("active")){
  1051. var selectMinPrices = $(".PriceInput [name='minprice']").val();
  1052. var selectMaxPrices = $(".PriceInput [name='maxprice']").val();
  1053. $("#zbSeatchT [name='minprice']").val(selectMinPrices);
  1054. $("#zbSeatchT [name='maxprice']").val(selectMaxPrices);
  1055. }else{
  1056. $("#zbSeatchT [name='minprice']").val("");
  1057. $("#zbSeatchT [name='maxprice']").val("");
  1058. }
  1059. //搜索关键词
  1060. var searchname = $("#zbSeatchT input[name='keywords']").val();
  1061. //$("#zbSeatchT input[name='searchvalue']").val($.trim(searchname));
  1062. // 采购单位类型
  1063. var buyerTypeArr = ""
  1064. var buyerText = ""
  1065. $(".buyclass .active").each(function(){
  1066. if ($(this).hasClass('buyclass-all')) {
  1067. return true
  1068. } else if ($(this).hasClass('buy-list')) {
  1069. if ($(this).attr("data-value")) {
  1070. buyerText = $(this).attr("data-value");
  1071. if(buyerTypeArr != ""){
  1072. buyerTypeArr += ",";
  1073. }
  1074. buyerTypeArr += buyerText;
  1075. }
  1076. }
  1077. })
  1078. //采购单位类型 下拉组件回调赋值不在此处赋值
  1079. // $("#zbSeatchT [name='buyerclass']").val(buyerTypeArr)
  1080. // $("#buyerInput").val(buyerTypeArr);
  1081. //采购单位联系方式有无
  1082. // $("#zbSeatchT [name='buyertel']").val($(".custom-input[name='buyertel']").attr('data-value'));
  1083. //中标单位联系方式有无
  1084. // $("#zbSeatchT [name='winnertel']").val($(".custom-input[name='winnertel']").attr('data-value'));
  1085. //排除词
  1086. $("#zbSeatchT [name='notkey']").val($("#zbSeatchT [name='notkey']").val());
  1087. if(!$("#zbSeatchT [name='keywords']").val()&&!$("#zbSeatchT [name='industry']").val()&&from!="F" && !$("#zbSeatchT [name='additionalWords']").val()){
  1088. // getNewBids(currentPage);
  1089. getNewBiddings(currentPage)
  1090. }else{
  1091. if(from!="F"){
  1092. if(submitflag){
  1093. if($.trim(searchname)==""){
  1094. getNewBiddings();
  1095. nbflag = false;
  1096. }else{
  1097. searchvalue = $.trim(searchname);
  1098. searchOnsubmit();
  1099. nbflag = true;
  1100. }
  1101. submitflag=false;
  1102. }
  1103. setTimeout(function(){
  1104. submitflag=true
  1105. },200);
  1106. }else{
  1107. if($.trim(searchname)!=""){
  1108. nbflag = true;
  1109. }
  1110. }
  1111. }
  1112. return true
  1113. },200)
  1114. }
  1115. var LimitClass = {
  1116. prevNoLimitFlag: false,
  1117. limitFlag: false,
  1118. list: null,
  1119. result: null,
  1120. paging: function(cp){
  1121. if(LimitClass.list != null){
  1122. var start = (cp-1)*pageSize;
  1123. var end = start+pageSize;
  1124. if(end > LimitClass.list.length){
  1125. end = LimitClass.list.length;
  1126. }
  1127. LimitClass.result.list = LimitClass.list.slice(start,end);
  1128. }
  1129. pcAjaxReqCallBack(LimitClass.result);
  1130. }
  1131. };
  1132. //搜索关键词信息
  1133. function searchOnsubmit(clickpaging){
  1134. var this_selectType = $("#zbSeatchT [name='selectType']").val();
  1135. if(this_selectType != "all"){
  1136. LimitClass.limitFlag = false;
  1137. LimitClass.result = null;
  1138. LimitClass.list = null;
  1139. }else{
  1140. if(clickpaging&&LimitClass.limitFlag){
  1141. LimitClass.paging(currentPage);
  1142. return;
  1143. }
  1144. }
  1145. var param = {
  1146. pageNumber: currentPage,
  1147. pageSize: pageSize,
  1148. reqType: "bidSearch",
  1149. searchvalue: $("#zbSeatchT [name='keywords']").val(),
  1150. area: $("#zbSeatchT [name='area']").val(),
  1151. subtype: $("#zbSeatchT [name='subtype']").val(),
  1152. publishtime: $("#zbSeatchT [name='publishtime']").val(),
  1153. selectType : this_selectType || 'title,content',
  1154. minprice : $("#zbSeatchT [name='minprice']").val(),
  1155. maxprice : $("#zbSeatchT [name='maxprice']").val(),
  1156. industry : $("#zbSeatchT [name='industry']").val(),
  1157. tabularflag: "Y",
  1158. buyerclass: $("#zbSeatchT [name='buyerclass']").val(),
  1159. buyertel: $("#zbSeatchT [name='buyertel']").val(),
  1160. winnertel: $("#zbSeatchT [name='winnertel']").val(),
  1161. notkey: $("#zbSeatchT [name='notkey']").val(),
  1162. fileExists: $("#zbSeatchT [name='fileExists']").val(),
  1163. city: $("#zbSeatchT [name='city']").val(),
  1164. bid_field: $("#zbSeatchT [name='bid_field']").val(),
  1165. searchGroup: $("#zbSeatchT [name='searchGroup']").val(),
  1166. searchMode: $("#zbSeatchT [name='searchMode']").val(),
  1167. wordsMode: $("#zbSeatchT [name='wordsMode']").val(),
  1168. additionalWords: $("#zbSeatchT [name='additionalWords']").val()
  1169. };
  1170. $.post("/front/pcAjaxReq",param,function(r){
  1171. heightWords = r.heightWords
  1172. if(r.limitFlag){
  1173. LimitClass.limitFlag = true;
  1174. LimitClass.result = r;
  1175. LimitClass.list = r.list;
  1176. LimitClass.paging(currentPage);
  1177. LimitClass.prevNoLimitFlag = false;
  1178. // 重新分页
  1179. searchInnerVue.listState.totalPage = Math.ceil(r.count / pageSize)
  1180. allCount = r.total
  1181. searchInnerVue.listState.allCount = r.total
  1182. // searchInnerVue.checkPageNumAdd1()
  1183. }else{
  1184. LimitClass.prevNoLimitFlag = true;
  1185. LimitClass.limitFlag = false;
  1186. pcAjaxReqCallBack(r);
  1187. }
  1188. autoModelFn(r)
  1189. // getBidIsColl()
  1190. });
  1191. }
  1192. function showSearchTipForTimeRange (type) {
  1193. var tempDom = $("#hasNoData_tiptext>font:eq(0)")
  1194. var tipMap = {
  1195. 'fiveyear': '近5年',
  1196. 'threeyear': '近3年',
  1197. 'thisyear': '近1年',
  1198. 'lately-7': '近7天',
  1199. 'lately-30': '近30天'
  1200. }
  1201. var tempStr = ''
  1202. var defaultRange = $("#zbSeatchT [name='publishtime']").val() || selectPublishtime
  1203. if (tipMap[defaultRange]) {
  1204. tempStr = tipMap[defaultRange]
  1205. } else {
  1206. var tempTimeList = defaultRange.split('_')
  1207. if (tempTimeList[0]) {
  1208. tempStr = new Date(tempTimeList[0] * 1000).pattern('yyyy/MM/dd')
  1209. }
  1210. if (tempTimeList[1]) {
  1211. if (tempStr.length) {
  1212. tempStr += '-'
  1213. }
  1214. tempStr += new Date(tempTimeList[1] * 1000).pattern('yyyy/MM/dd')
  1215. }
  1216. }
  1217. tempDom.find('span').text(tempStr)
  1218. if (type !== false) {
  1219. tempDom.show();
  1220. }
  1221. }
  1222. $(function () {
  1223. setTimeout(function(){
  1224. showSearchTipForTimeRange(false);
  1225. },500)
  1226. document.addEventListener('visibilitychange', function() {
  1227. if (document.visibilityState === 'visible') {
  1228. getBidIsJoin()
  1229. }
  1230. })
  1231. })
  1232. function autoModelFn (r) {
  1233. var keywordFlag = $("#zbSeatchT [name='keywords']").val()
  1234. var addkeyFlag = $("#zbSeatchT [name='additionalWords']").val()
  1235. var sModel = $("#zbSeatchT [name='searchMode']").val()
  1236. // console.log(autoSwitchModel, sModel, (keywordFlag || addkeyFlag), r.list);
  1237. var jzFlag = !autoSwitchModel && sModel == 0 && (keywordFlag || addkeyFlag) && r.list == null
  1238. var mhFlag = autoSwitchModel && sModel == 1 && (keywordFlag || addkeyFlag)
  1239. if (jzFlag) {
  1240. console.log(jzFlag, '精准flag');
  1241. $("#zbSeatchT [name='searchMode']").val(1)
  1242. searchInnerVue.keywordSearchType = 1
  1243. beforeSubmit('filter-mode')
  1244. autoSwitchModel = true
  1245. }
  1246. if (mhFlag) {
  1247. console.log(mhFlag, '模糊flag');
  1248. if (r.list && r.list.length > 0) {
  1249. toastFn('精准搜索无结果,已为您自动切换到模糊搜索', 5000)
  1250. autoSwitchModel = false
  1251. } else {
  1252. $("#zbSeatchT [name='searchMode']").val(0)
  1253. searchInnerVue.keywordSearchType = 0
  1254. }
  1255. }
  1256. }
  1257. function pcAjaxReqCallBack(r){
  1258. afterAjaxReq(r);
  1259. var isAllSearch = $("#zbSeatchT [name='selectType']").val()=="all";
  1260. if(r.list == null || r.list.length == 0){
  1261. $("#hasNoData_tiptext>font").hide();
  1262. if(r.status==-1){
  1263. $("#hasNoData_tiptext>font:eq(1)").show();
  1264. }else if (r.status==-2){
  1265. $("#hasNoData_tiptext>font:eq(2)").show();
  1266. }else{
  1267. showSearchTipForTimeRange()
  1268. }
  1269. if(isAllSearch){
  1270. $("#allSearchModel").hide();
  1271. }else{
  1272. // $("#allSearchModel").show();
  1273. }
  1274. //分页过程中,突然切换控制状态
  1275. if(r.limitFlag && LimitClass.prevNoLimitFlag){
  1276. $("#hasNoData_tiptext>font").hide();
  1277. $("#hasNoData_tiptext>font:eq(1)").show();
  1278. }else{
  1279. if(currentPage>1){
  1280. currentPage = currentPage-1;
  1281. return false
  1282. }
  1283. }
  1284. $(".tabContainer").hide();
  1285. $(".pagination").hide();
  1286. $(".working").hide();
  1287. $(".hasNoData").show();
  1288. // 隐藏页码
  1289. searchInnerVue.showPage = false
  1290. submitflag=true;
  1291. }else{
  1292. //$(".tabContainer").show();
  1293. $(".hasNoData").hide();
  1294. searchInnerVue.listState.totalPage = Math.ceil(r.count / pageSize);
  1295. appendDatas(r.list,true,false)
  1296. }
  1297. allCount = r.total
  1298. searchInnerVue.listState.allCount = r.total
  1299. }
  1300. function afterAjaxReq(r){
  1301. secondFlag=r.secondFlag;
  1302. if(r.interceptOtherWord){
  1303. $("#intercept .interceptWord").text(r.interceptOtherWord);
  1304. $("#intercept .interceptLimit").text(r.interceptLimit);
  1305. $("#intercept").removeClass("hidden");
  1306. }else{
  1307. $("#intercept").addClass("hidden");
  1308. }
  1309. if(r.keywords != null && typeof(r.keywords) != "undefined"){
  1310. $(".searchname").val(r.keywords);
  1311. }
  1312. $(".side-bar-bottom-font").text("“"+$.trim($(".searchname").val()).replace(/\s+/," ")+"”");
  1313. // if(secondFlag==""&&typeof(r.heightWords) != "undefined"){
  1314. // heightWords = r.heightWords;
  1315. // }
  1316. heightWords = r.heightWords;
  1317. if(r.pcAjaxFlag=="T"){
  1318. // heightWords = r.heightWords;
  1319. totalPage = Math.ceil(r.count / pageSize)
  1320. list= r.list;
  1321. secondList= r.secondList;
  1322. // vue 重置总页数
  1323. searchInnerVue.listState.totalPage = Math.ceil(r.count / pageSize);
  1324. allCount = r.total
  1325. searchInnerVue.listState.allCount = r.total
  1326. // searchInnerVue.checkPageNumAdd1()
  1327. }
  1328. if(secondFlag==""&&typeof(totalPage) != "undefined" && currentPage == 1){
  1329. if (r.totalPage==1){
  1330. totalPage = parseInt(r.count/pageSize)+1;
  1331. if(totalPage>10){
  1332. totalPage=10;
  1333. }
  1334. // vue 重置总页数
  1335. searchInnerVue.listState.totalPage = totalPage
  1336. // searchInnerVue.checkPageNumAdd1()
  1337. }else{
  1338. totalPage = Math.ceil(r.count / pageSize);
  1339. searchInnerVue.listState.totalPage = Math.ceil(r.count / pageSize)
  1340. // searchInnerVue.checkPageNumAdd1()
  1341. }
  1342. allCount = r.total
  1343. searchInnerVue.listState.allCount = r.total
  1344. }
  1345. }
  1346. function getCheckList() {
  1347. var getSelectNum = 0 // 获取这一页有多少个选中
  1348. var $dom = $('.custom-checkbox:not(.check-all)[name="bid-list"]')
  1349. $.each($dom,function(i, value) {
  1350. if(selectDataIds.length == 0) return
  1351. selectDataIds.forEach(function(item,index) {
  1352. let dataid = $(value).attr('dataid')
  1353. if (item == dataid) {
  1354. getSelectNum++
  1355. $(this).attr('checked', true)
  1356. }
  1357. })
  1358. })
  1359. if(getSelectNum>=50) {
  1360. $('.custom-checkbox').prop("checked",true)
  1361. } else {
  1362. $('.custom-checkbox').prop("checked",false)
  1363. $dom.each(function(i, dNode) {
  1364. if(selectDataIds.length == 0) return
  1365. selectDataIds.forEach(function(item,index) {
  1366. let dataid = $(dNode).attr('dataid')
  1367. if (item == dataid) {
  1368. getSelectNum++
  1369. $(dNode).prop('checked', true)
  1370. }
  1371. })
  1372. })
  1373. }
  1374. }
  1375. /*
  1376. 招标信息是否被收藏接口ajax
  1377. bids: String, // 招标信息id(多个用,号拼接) 必填
  1378. */
  1379. function getBidIsColl () {
  1380. collectClick()
  1381. var bids = ""
  1382. var dataId = ""
  1383. // 区分标题搜索和全文搜索收藏
  1384. var allSearch = selectType.indexOf('content') > -1 && $("#zbSeatchT [name='keywords']").val() !==""
  1385. // console.log('当前是否显示的是全文',allSearch)
  1386. var $dom = allSearch ? $('.all-text-checkbox[name="bid-list"]') : $('.title-text-checkbox[name="bid-list"]')
  1387. $dom.each(function() {
  1388. if ($(this).attr('dataid')) {
  1389. dataId = $(this).attr("dataid");
  1390. if(bids != ""){
  1391. bids += ",";
  1392. }
  1393. bids += dataId;
  1394. }
  1395. })
  1396. $.ajax({
  1397. type:'post',
  1398. url:'/publicapply/bidcoll/isColl?t=' + Date.now(),
  1399. data: {
  1400. bids: bids
  1401. },
  1402. dataType:'json',
  1403. success: function(r){
  1404. if (r.data) {
  1405. var data = r.data
  1406. $('.icon-collect').removeClass('checked')
  1407. data.forEach(function(item,index){
  1408. if (selectType == 'title') {
  1409. $('.icon-collect[dataid="' + item + '"]').addClass('checked')
  1410. } else {
  1411. $('.icon-collect[dataid="' + item + '"]').addClass('checked')
  1412. }
  1413. })
  1414. }
  1415. }
  1416. })
  1417. }
  1418. // 收藏点击事件
  1419. function collectClick() {
  1420. // console.log(vipState, '是否是超级订阅用户')
  1421. // 单个收藏点击事件
  1422. $('.icon-collect').unbind('click').on('click',function(e) {
  1423. // 登录判断
  1424. if (!loginflag) {
  1425. openLoginDig()
  1426. return
  1427. }
  1428. baiduEvent('列表页标讯收藏-星标') // 百度统计代码
  1429. e.stopPropagation()
  1430. var $that = $(this)
  1431. var checked = $(this).hasClass('checked')
  1432. var checkedId = $(this).attr('dataid')
  1433. var binfo = [{
  1434. bid: checkedId
  1435. }]
  1436. if (checked) {
  1437. // 单个取消收藏行为
  1438. collBidAction('R', binfo, function(res) {
  1439. if (res.data) {
  1440. if (selectType == 'title') {
  1441. // 标题搜索下相关样式
  1442. // $that.removeClass('checked').parents().siblings('input[type="checkbox"]').prop("checked",false).removeAttr('disabled')
  1443. $that.removeClass('checked')
  1444. } else {
  1445. // 全文搜索下相关样式
  1446. // $that.removeClass('checked').parents('.luce-right').siblings().find('input[type="checkbox"]').prop("checked",false).removeAttr('disabled')
  1447. $that.removeClass('checked')
  1448. }
  1449. toastFn('已取消收藏', 800)
  1450. } else {
  1451. toastFn(res.error_msg, 1000)
  1452. }
  1453. })
  1454. } else {
  1455. // 单个收藏行为
  1456. vm.dialogTitle = '重要项目一键创建标签收藏!请完善个人信息,为您匹配精准服务'
  1457. // 查询是否需要用户留资料 不需要 则执行下一步回调(收藏标讯行为)
  1458. vm.isNeedSubmit('article_collection',function() {
  1459. sessionStorage.setItem('$save-tags-binfo', JSON.stringify(binfo)) // 将本次收藏的标讯id缓存起来 用于绑定标签时使用
  1460. collBidAction('C', binfo, function(res) {
  1461. if (res.data) {
  1462. toastFn('收藏成功', 1500)
  1463. if (selectType == 'title') {
  1464. $that.addClass('checked')
  1465. } else {
  1466. $that.addClass('checked')
  1467. }
  1468. var top = (parseInt($that.position().top) + 50 ) + 'px';
  1469. $('.tags-box').show(function(){
  1470. activeTags = []
  1471. $('.tag-labels').empty()
  1472. $('.clear-input').val('')
  1473. $('.tags-list').find('.tags-item').removeClass('tags-active')
  1474. $('.tag-placeholder').show()
  1475. }).css('top', top)
  1476. getUserTags()
  1477. } else {
  1478. // 是超级订阅用户或者其他付费用户
  1479. if (vipState || res.error_msg.indexOf('付费') > -1) {
  1480. toastFn('您的标讯收藏上限为5000条,请联系客服人员。', 1500)
  1481. } else {
  1482. updateVipDialog('标讯收藏满100条-去升级')
  1483. }
  1484. }
  1485. })
  1486. }, $(this))
  1487. }
  1488. })
  1489. // 批量收藏
  1490. $('#bid-collect').off('click').bind('click',function(e){
  1491. // 登录判断
  1492. if (!loginflag) {
  1493. openLoginDig()
  1494. return
  1495. }
  1496. baiduEvent('列表页标讯收藏-星标') // 百度统计代码
  1497. e.stopPropagation()
  1498. var top = (parseInt($(this).position().top) + 60 ) + 'px';
  1499. var len = $('.custom-checkbox:not(".check-all"):checked').length;
  1500. var checkedId = [] // 提交后端需要的标讯id数组
  1501. var leftArr = [] // checkbox选中的数据
  1502. var rightArr = [] // 当前已收藏过的数据
  1503. var notSameArr = [] // 选中的数据 与 收藏过的数据相比不同的数组
  1504. $('.custom-checkbox:not(".check-all"):checked').each(function(){
  1505. if ($(this).attr('dataid')) {
  1506. checkedId.push({
  1507. bid: $(this).attr('dataid')
  1508. })
  1509. leftArr.push($(this).attr('dataid'))
  1510. }
  1511. })
  1512. $('.icon-collect.checked').each(function() {
  1513. if ($(this).attr('dataid')) {
  1514. rightArr.push($(this).attr('dataid'))
  1515. }
  1516. })
  1517. var $that = $(this)
  1518. // 判断有无选中的标讯信息
  1519. if (len > 0 || selectDataIds.length > 0) {
  1520. selectDataIds.forEach(function(v) {
  1521. checkedId.push({
  1522. bid: v
  1523. })
  1524. })
  1525. checkedId = arrUnique(checkedId)
  1526. if(leftArr.length <= rightArr.length) {
  1527. for (key in leftArr) {
  1528. var stra = leftArr[key];
  1529. var count = 0;
  1530. for (var j = 0; j < rightArr.length; j++) {
  1531. var strb = rightArr[j];
  1532. if (stra == strb) {
  1533. count++;
  1534. }
  1535. }
  1536. if (count === 0) { //表示数组1的这个值没有重复的,放到notSameArr列表中
  1537. notSameArr.push(stra);
  1538. }
  1539. }
  1540. // 如果没有不同的值 即为选中的标讯都已收藏过 有不同的值即为有未收藏的标讯
  1541. // console.log(notSameArr, 'notSameArr')
  1542. if(notSameArr.length == 0) {
  1543. toastFn('已收藏', 800)
  1544. return
  1545. }
  1546. }
  1547. vm.dialogTitle = '重要项目一键创建标签收藏!请完善个人信息,为您匹配精准服务'
  1548. // 查询是否需要用户留资料 不需要 则执行下一步回调(批量收藏标讯行为)
  1549. vm.isNeedSubmit('article_collection', function() {
  1550. sessionStorage.setItem('$save-tags-binfo', JSON.stringify(checkedId)) // 将本次收藏的标讯id缓存起来 用于绑定标签时使用
  1551. collBidAction('C', checkedId, function(res) {
  1552. if (res.data) {
  1553. toastFn('收藏成功', 1500)
  1554. if (selectType == 'title') {
  1555. $('.custom-checkbox:not(".check-all"):checked').siblings().children('.icon-collect').addClass('checked')
  1556. } else {
  1557. $('.custom-checkbox:not(".check-all"):checked').parents('.liLuceneList').find('.icon-beforeSubmitcollect').addClass('checked')
  1558. }
  1559. // 收藏成功后再查一次收藏状态,为了区分达到收藏上限点时部分收藏成功,部分收藏失败
  1560. getBidIsColl()
  1561. // 弹出标签弹框时 清除上次选择的标签
  1562. $('.tags-box').show().css('top', top)
  1563. getUserTags()
  1564. } else {
  1565. // 是超级订阅用户或者其他付费用户
  1566. if (vipState || res.error_msg.indexOf('付费') > -1) {
  1567. toastFn('您的标讯收藏上限为5000条,请联系客服人员。', 1500)
  1568. } else {
  1569. updateVipDialog('标讯收藏满100条-去升级')
  1570. }
  1571. }
  1572. })
  1573. })
  1574. } else {
  1575. toastFn('尚未选择标讯,请选择', 1000)
  1576. }
  1577. })
  1578. }
  1579. function distributeInit(){
  1580. $.ajax({
  1581. type: 'get',
  1582. contentType: "application/json",
  1583. url: '/entbase/ent/entinfo',
  1584. success: function (r) {
  1585. if (r.data) {
  1586. if(r.data.admin_system || r.data.admin_department){
  1587. $('#right-distribute').show();
  1588. $('.line-distribute').show();
  1589. }
  1590. }
  1591. }
  1592. })
  1593. // $('#right-distribute').show();
  1594. // $('.line-distribute').show();
  1595. $('#right-distribute').off('click').bind('click',function(e){
  1596. e.stopPropagation()
  1597. let len = $('.custom-checkbox:not(".check-all"):checked').length;
  1598. let checkedArea = []
  1599. let checked_id = []
  1600. $('.custom-checkbox:not(".check-area"):checked').each(function(){
  1601. if ($(this).attr('data-area')) {
  1602. checkedArea.push($(this).attr('data-area'))
  1603. }
  1604. if ($(this).attr('dataid')) {
  1605. checked_id.push($(this).attr('dataid'))
  1606. }
  1607. })
  1608. if(len) {
  1609. if(checkedArea.length !== 0){
  1610. // 拉起选择人员弹窗 有地区
  1611. person_Dialog.selectAreas = checkedArea
  1612. }else{
  1613. // 无地区
  1614. person_Dialog.selectArea = []
  1615. }
  1616. person_Dialog.titleMsg = '选择接收人员' // 设置弹窗标题
  1617. person_Dialog.searchVal = ''
  1618. person_Dialog.centerDialogVisible = true // 打开弹窗
  1619. person_Dialog.selectDataIds = checked_id // 传入标讯ID
  1620. person_Dialog.getData('yes') // 发送获取人员列表请求
  1621. }else{
  1622. toastFn('尚未选择公告,请选择', 1000)
  1623. }
  1624. })
  1625. }
  1626. /*******参标方法start**********/
  1627. /*
  1628. 招标信息是否参标藏接口ajax
  1629. bids: String, // 招标信息id(多个用,号拼接) 必填
  1630. */
  1631. function getBidIsJoin () {
  1632. joinBidsClick()
  1633. var bids = ""
  1634. var dataId = ""
  1635. // 区分标题搜索和全文搜索收藏
  1636. // var allSearch = selectType.indexOf('content') > -1 && $("#zbSeatchT [name='keywords']").val() !== ""
  1637. // // console.log('当前是否显示的是全文',allSearch)
  1638. // var $dom = allSearch ? $('.all-text-checkbox[name="bid-list"]') : $('.title-text-checkbox[name="bid-list"]')
  1639. var $dom = $('.title-text-checkbox[name="bid-list"]')
  1640. $dom.each(function () {
  1641. if ($(this).attr('dataid')) {
  1642. dataId = $(this).attr("dataid");
  1643. if (bids != "") {
  1644. bids += ",";
  1645. }
  1646. bids += dataId;
  1647. }
  1648. })
  1649. var paramsData = {
  1650. ids: bids
  1651. }
  1652. $.ajax({
  1653. type: 'post',
  1654. contentType: "application/json",
  1655. url: '/jyapi/jybx/core/participate/show?t=' + Date.now(),
  1656. data: JSON.stringify(paramsData),
  1657. dataType: 'json',
  1658. success: function (r) {
  1659. if (r.data) {
  1660. var data = r.data
  1661. if(data.length > 0) {
  1662. Bidrenewal_Dialog.initBidrenewalDialog = true // 加载参标状态更新弹窗
  1663. }
  1664. $('.icon-canbiao').removeClass('checked')
  1665. data.forEach(function (item, index) {
  1666. $('.icon-canbiao[dataid="' + item.id + '"]').show()
  1667. // $('.icon-canbiao[dataid="' + item + '"]').css("display","inline-block");
  1668. if(item.value) {
  1669. $('.icon-canbiao[dataid="' + item.id + '"]').addClass('checked')
  1670. }
  1671. })
  1672. }
  1673. }
  1674. })
  1675. }
  1676. // 参标点击事件
  1677. function joinBidsClick() {
  1678. // console.log(vipState, '是否是超级订阅用户')
  1679. // 单个参标点击事件
  1680. $('.icon-canbiao').unbind('click').on('click',function(e) {
  1681. // 登录判断
  1682. if (!loginflag) {
  1683. openLoginDig()
  1684. return
  1685. }
  1686. e.stopPropagation()
  1687. var $that = $(this)
  1688. var checked = $(this).hasClass('checked')
  1689. var checkedId = $(this).attr('dataid')
  1690. if (checked) {
  1691. toastFn('如需终止参标,需要在详情页进行操作。', 800)
  1692. } else {
  1693. joinBidAction('in', checkedId, function(res) {
  1694. if (res.data && res.error_code == 0) {
  1695. // toastFn('已参标,请前往我的参标项目列表查看', 1500)
  1696. // 调起参标更新弹窗
  1697. Bidrenewal_Dialog.sendId(checkedId)
  1698. window.$BidrenewalDialog.open()
  1699. $that.addClass('checked')
  1700. } else if(res.error_code == -1){
  1701. var msg = res.error_msg || '操作错误,请稍后重试'
  1702. toastFn(msg, 1500)
  1703. }
  1704. })
  1705. }
  1706. })
  1707. }
  1708. /********参标方法end********/
  1709. /**
  1710. * @date 2022/12/15 山川环境嵌入搜索
  1711. * 山川应用嵌入环境 特殊处理
  1712. */
  1713. var InBIInjectHooks = {
  1714. // 已添加的标讯信息
  1715. ids: [],
  1716. // 获取已添加的标讯信息
  1717. getInfoIds: function () {
  1718. $.ajax({
  1719. url: '/jyapi/biService/getInfoId',
  1720. type: 'POST',
  1721. success: function (res) {
  1722. if (Array.isArray(res.data)) {
  1723. this.ids = res.data
  1724. this.upDateView()
  1725. }
  1726. }.bind(this)
  1727. })
  1728. },
  1729. // 添加标讯信息
  1730. setInfoId: function (ids) {
  1731. $.ajax({
  1732. url: '/jyapi/biService/addProject',
  1733. type: 'POST',
  1734. contentType: 'application/json',
  1735. data: JSON.stringify({
  1736. info_id: ids.join(','),
  1737. source: 2
  1738. }),
  1739. success: function () {
  1740. this.getInfoIds()
  1741. if (ids.length > 1) {
  1742. selectDataIds = []
  1743. $('.custom-checkbox').prop("checked", false)
  1744. }
  1745. }.bind(this)
  1746. })
  1747. },
  1748. // 刷新视图
  1749. upDateView: function () {
  1750. var _this = this
  1751. $(".liLuceneList").each(function () {
  1752. var nowId = $(this).find('.custom-checkbox').attr('dataid')
  1753. var hasNowId = _this.ids.indexOf(nowId) !== -1
  1754. // 刷新 dom 状态
  1755. $(this).find('.bi-report-inject-button').text(hasNowId ? '已添加' : '添加')
  1756. $(this).find('.custom-checkbox').prop('disabled', hasNowId)
  1757. })
  1758. },
  1759. getCheckIds: function () {
  1760. return selectDataIds || []
  1761. },
  1762. checkInBI: function () {
  1763. var inInjectBI = getParam('report') === 'bi' || (location.href.indexOf('/jylab/bi/index') !== -1)
  1764. return inInjectBI
  1765. },
  1766. check: function () {
  1767. if (this.checkInBI()) {
  1768. // 获取数据
  1769. this.getInfoIds()
  1770. }
  1771. },
  1772. inject: function () {
  1773. if (this.checkInBI()) {
  1774. $("body").addClass('in-iframe in-bi')
  1775. // 仅展示信息-结果类型
  1776. $(".bi-mark.parent-node").trigger('click')
  1777. var _this = this
  1778. // 添加按钮点击事件
  1779. $("body").on('click', '.bi-report-inject-button', function () {
  1780. var nowStatus = $(this).text() === '已添加'
  1781. if (nowStatus) {
  1782. return
  1783. }
  1784. var nowId = $(this).attr('data-id')
  1785. var isAllButton = nowId === 'all'
  1786. // 批量添加
  1787. if (isAllButton) {
  1788. _this.setInfoId(_this.getCheckIds())
  1789. } else {
  1790. // 单个添加
  1791. _this.setInfoId([nowId])
  1792. }
  1793. })
  1794. // 获取数据
  1795. this.getInfoIds()
  1796. }
  1797. }
  1798. }
  1799. $(function () {
  1800. InBIInjectHooks.inject()
  1801. })
  1802. function arrUnique(arr){
  1803. let ojb = {};
  1804. arr = arr.reduce(function(prevArr, currentItem) {
  1805. //利用对象的键名无法重复的特点,mch_id是唯一区别的属性值
  1806. ojb[currentItem.bid] ? '' : ojb[currentItem.bid] = true && prevArr.push(currentItem);
  1807. return prevArr
  1808. }, [])
  1809. return arr;
  1810. }
  1811. function openBigMemberDialog (str, content) {
  1812. $('.auth-dialog').show()
  1813. $('.auth-dialog .dialog-title').text('您暂无使用权限')
  1814. $('.auth-dialog .dialog-content').html(content || '开通大会员,查看更多招标项目,畅享商机不受限!')
  1815. $('.auth-dialog .default-btn').click(function () {
  1816. $('.auth-dialog').hide(300)
  1817. })
  1818. $('.auth-dialog .confirm-btn').text('免费体验')
  1819. $('.auth-dialog .confirm-btn').off('click').bind('click',function () {
  1820. var advName = '招标搜索' + str + '-去开通'
  1821. baiduEvent(advName) // 点击去开通事件 百度统计
  1822. $('.auth-dialog').hide(300)
  1823. vm.dialogTitle = '免费用户查看超过500条招标搜索结果'
  1824. vm.isNeedSubmit('jylab_see500_plus', function () {
  1825. vm.showSuccess = true
  1826. })
  1827. })
  1828. }
  1829. // 开通提醒弹框
  1830. function openVipDialog(str, content) {
  1831. $('.auth-dialog').show()
  1832. $('.auth-dialog .dialog-title').text('开通超级订阅')
  1833. $('.auth-dialog .dialog-content').html(content || '立享更多搜索权限,寻找商机更精准')
  1834. $('.auth-dialog .default-btn').click(function () {
  1835. $('.auth-dialog').hide(300)
  1836. })
  1837. $('.auth-dialog .confirm-btn').text('去开通')
  1838. $('.auth-dialog .confirm-btn').off('click').bind('click',function () {
  1839. var advName = '招标搜索' + str + '-去开通'
  1840. baiduEvent(advName) // 点击去开通事件 百度统计
  1841. window.open('/swordfish/page_big_pc/free/svip/buy')
  1842. })
  1843. }
  1844. // 升级提醒弹框
  1845. function updateVipDialog(str) {
  1846. $('.update-dialog').show()
  1847. $('.update-dialog .default-btn').click(function () {
  1848. $('.update-dialog').hide(300)
  1849. })
  1850. $('.update-dialog .confirm-btn').off('click').bind('click',function () {
  1851. baiduEvent(str) // 点击去升级事件 百度统计
  1852. window.open('/front/subscribe.html')
  1853. })
  1854. }
  1855. // 列表页收藏点击事件 百度统计
  1856. function baiduEvent(name) {
  1857. // console.log(name, 'name')
  1858. try {
  1859. _hmt.push(['_trackEvent', '超级订阅-pc', 'click', name]);
  1860. } catch (e) {
  1861. console.log('未初始化百度统计')
  1862. }
  1863. }
  1864. // toast上限提示
  1865. function toastFn (text, duration) {
  1866. if (!duration) {
  1867. duration = 1000
  1868. }
  1869. var _html = ""
  1870. _html+='<div class="custom-toast"><div class="mask" style="background-color: transparent;"></div><div class="toast-container">'
  1871. _html+='<span>' + text + '</span></div></div>'
  1872. $('body').append(_html)
  1873. setTimeout(function(){
  1874. $(".custom-toast").fadeOut().remove();
  1875. },duration)
  1876. }
  1877. function gologin (link) {
  1878. // window.location.href=link
  1879. window.open(link)
  1880. }
  1881. function getWhetherInAntiSpiderWhiteList () {
  1882. $.ajax({
  1883. url: '/publicapply/userbase/whitelist',
  1884. type: 'GET',
  1885. success: function(r){
  1886. if (r && r.data) {
  1887. onAntiSpiderWhitelist = r.data.onTheWhitelist
  1888. if ($.isArray(r.data.filterReg)) {
  1889. var w = []
  1890. r.data.filterReg.forEach(function (item) {
  1891. w.push(new RegExp(item))
  1892. })
  1893. commonSearchWordsRegExp = w
  1894. }
  1895. // 首次执行一次(兼容url传参查询)
  1896. // 延迟执行,需要等到Vue实例初始化, clear按钮事件绑定完成, whitelist内容获取完成之后在校验
  1897. var urlSearchValue = getParam('keywords')
  1898. if (urlSearchValue && !onAntiSpiderWhitelist) {
  1899. setTimeout(function () {
  1900. var hasCommonWords = checkAndClearTextIncludesCommonWords(searchvalue || urlSearchValue)
  1901. if (hasCommonWords) {
  1902. showToast('请输入项目名称等关键词')
  1903. }
  1904. }, 500)
  1905. }
  1906. }
  1907. }
  1908. })
  1909. }