superSearch.js 67 KB

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