superSearch.js 75 KB

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