网站
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

517 行
19 KiB

  1. /**
  2. * Created by Administrator on 2021/4/5.
  3. */
  4. define(['jquery', "template", "Tools", "itemsApi", "paging", 'dateTime', 'swiper'], function ($, template, Tools) {
  5. //数据存储
  6. var module = {
  7. data: {
  8. //服务器地址
  9. // serverApi: 'http://219.148.186.198:8082/ruoyi-admin',
  10. searchType:'gyxm',
  11. serverApi: '',
  12. //标的物类型
  13. deptTypeList: [],
  14. //标的物所在地
  15. deptLocationList: [],
  16. //标的物二级所在地
  17. deptSecondLocationList: [],
  18. //新闻列表
  19. itemsInformationList: '',
  20. //新闻列表
  21. itemsInformationList1: '',
  22. //页码
  23. pageNum: 1,
  24. //页码集合
  25. pageList: [],
  26. //每页数量
  27. pageSize: 20,
  28. //总页数
  29. pageCount: 0,
  30. //标的物集合长度
  31. deptSize: 24,
  32. //标的物选中项id
  33. deptId: '100',
  34. //标的所在地选中
  35. secondDeptId: '',
  36. //标的物类型ID
  37. projectNumber: '',
  38. //项目状态
  39. projectShowStatus: '',
  40. //报名开始时间
  41. signupStartTime: '',
  42. //报名结束时间
  43. signupStopTime: '',
  44. //竞价开始时间
  45. biddingStartTime: '',
  46. //竞价结束时间
  47. biddingStopTime: '',
  48. form: {
  49. deptId: 100,
  50. projectNumber: '',
  51. projectShowStatus: '',
  52. // signupStartTime: '',
  53. // signupStopTime: '',
  54. // biddingStartTime: '',
  55. // biddingStopTime: '',
  56. pageNum: 1,
  57. pageSize: 20,
  58. }
  59. },
  60. };
  61. var tools = new Tools();
  62. module.init = function (page) {
  63. //获取焦点图信息
  64. //tools.doGet(websitePicture, {picType:1,status:0,orderByColumn:'picSort',isAsc:'desc'}, module.focusNewsTop , true);
  65. //底部友情链接
  66. tools.doGet(friendsLinks, {}, module.bottomFriendsLinks, true);
  67. if (getQueryVariable('projectCode') || getQueryVariable('projectName') || getQueryVariable('projectNumber')) {
  68. //console.log('首页进入')
  69. tools.doGet(itemsList, {
  70. deptId: 100,
  71. pageNum: module.data.pageNum,
  72. pageSize: module.data.pageSize,
  73. projectCode: getQueryVariable('projectCode'),
  74. projectName: getQueryVariable('projectName'),
  75. projectNumber: getQueryVariable('projectNumber')
  76. }, module.itemList, true);
  77. }else if(getQueryVariable('clickType') == 'deptType'){//新闻资讯
  78. tools.doGet(itemsList, { deptId: 100, pageNum: module.data.pageNum, pageSize: module.data.pageSize }, module.itemList, true);
  79. setTimeout(function(){
  80. typeCheck(getQueryVariable('dictSort'),getQueryVariable('dictCode'))
  81. goSearch()
  82. },500)
  83. }else if(getQueryVariable('clickType') == 'deptLocation'){
  84. tools.doGet(itemsList, { deptId: 100, pageNum: module.data.pageNum, pageSize: module.data.pageSize }, module.itemList, true);
  85. setTimeout(function(){
  86. tabCheck(getQueryVariable('dictSort'))
  87. goSearch()
  88. },500)
  89. }else if(getQueryVariable('clickType') == 'collectiveAssets'){
  90. setTimeout(function(){
  91. tabList('xqxm')
  92. },500)
  93. } else {
  94. //新闻资讯
  95. tools.doGet(itemsList, { deptId: 100, pageNum: module.data.pageNum, pageSize: module.data.pageSize }, module.itemList, true);
  96. }
  97. //标的物类型
  98. tools.doGet(webDeptType + "/project_type", {}, module.deptType, true);
  99. //标的物所在地
  100. tools.doGet(webDept, { deptId: '' }, module.deptLocation, true);
  101. //网站配置信息(网站名称 底部联系方式 公安备案号 网站备案号)
  102. tools.getWebConfig();
  103. $("#signStartTimeStr").datetime({
  104. type: "date",
  105. value: [new Date().getFullYear(),new Date().getMonth()+1,new Date().getDate()],
  106. success: function (res) {
  107. //console.log(res)
  108. }
  109. })
  110. $("#signEndTimeStr").datetime({
  111. type: "date",
  112. value: [new Date().getFullYear(),new Date().getMonth()+1,new Date().getDate()],
  113. success: function (res) {
  114. //console.log(res)
  115. }
  116. })
  117. $("#auctionStartTimeStr").datetime({
  118. type: "date",
  119. value: [new Date().getFullYear(),new Date().getMonth()+1,new Date().getDate()],
  120. success: function (res) {
  121. //console.log(res)
  122. }
  123. })
  124. $("#endTimeStr").datetime({
  125. type: "date",
  126. value: [new Date().getFullYear(),new Date().getMonth()+1,new Date().getDate()],
  127. success: function (res) {
  128. //console.log(res)
  129. }
  130. })
  131. };
  132. //焦点图数据
  133. module.focusNewsTop = function (data) {
  134. if (data.code == 200) {
  135. let focusArray = [];
  136. if(data.data.length<1){
  137. focusArray.push({
  138. picUrl:'../../../static/images/banner1.png'
  139. },{
  140. picUrl:'../../../static/images/banner2.png'
  141. },{
  142. picUrl:'../../../static/images/banner3.png'
  143. })
  144. }else{
  145. data.data.forEach(res=>{
  146. focusArray.push({
  147. picUrl:'/api'+res.picUrl
  148. })
  149. })
  150. }
  151. module.data.focusListTop = focusArray;
  152. var bannerFocusDataTop = template('bannerFocusDataTop', module.data);
  153. $("#bannerFocusTopContent").html(bannerFocusDataTop);
  154. new Swiper('#bannerFocusWrapTop', {
  155. paginationClickable: true,
  156. autoplay : 4000,
  157. loop:true
  158. })
  159. }
  160. }
  161. //获取地址栏参数
  162. function getQueryVariable(variable) {
  163. var query = window.location.search.substring(1);
  164. var vars = query.split("&");
  165. for (var i = 0; i < vars.length; i++) {
  166. var pair = vars[i].split("=");
  167. if (pair[0] == variable) { return pair[1]; }
  168. }
  169. return (false);
  170. }
  171. //交易项目列表
  172. module.itemList = function (data) {
  173. if (data.code == 200) {
  174. console.log(serverApi)
  175. module.data.serverApi = serverApi;
  176. var content = data.rows;
  177. var pageCount = (data.total / module.data.pageSize).toFixed(0);
  178. if (pageCount < 1) {
  179. pageCount = 1;
  180. }
  181. if (module.data.itemsInformationList == '') {
  182. // 初始化 分页器
  183. var page_s1 = createPage('.page_s1');
  184. // 设置分页
  185. setPage(page_s1, {
  186. pageTotal: data.total, // 数据总条数
  187. pageSize: module.data.pageSize, // 每页显示条数
  188. pageCurrent: 1, // 当前页
  189. maxBtnNum: 5, // 最多按钮个数 (最少5个)
  190. })
  191. $('#page_s1').html('共' + pageCount + '页')
  192. }
  193. module.data.pageCount = pageCount;
  194. module.data.itemsInformationList = content;
  195. var ItemsInformationData = template('ItemsInformationData', module.data);
  196. $("#ItemsInformationContent").html(ItemsInformationData);
  197. var ItemsInformationData2 = template('ItemsInformationData2', module.data);
  198. $("#ItemsInformationContent2").html(ItemsInformationData2);
  199. }
  200. }
  201. trHover = function(status,i,type){
  202. if (type == 'over'){
  203. if (status == '已经成交'||status == '项目公示'){
  204. $('#span'+i).attr('class','color-d7d7d7-hover')
  205. }
  206. if (status == '正在报名'){
  207. $('#span'+i).attr('class','color-ffe5d5-hover')
  208. }
  209. if (status == '等待竞价'){
  210. $('#span'+i).attr('class','color-d0e1f6-hover')
  211. }
  212. if (status == '等待成交'){
  213. $('#span'+i).attr('class','color-d1f1e1-hover')
  214. }
  215. if (status == '正在竞价'){
  216. $('#span'+i).attr('class','color-fad3d3-hover')
  217. }
  218. }
  219. if (type == 'out'){
  220. if (status == '已经成交'||status == '项目公示'){
  221. $('#span'+i).attr('class','color-d7d7d7')
  222. }
  223. if (status == '正在报名'){
  224. $('#span'+i).attr('class','color-ffe5d5')
  225. }
  226. if (status == '等待竞价'){
  227. $('#span'+i).attr('class','color-d0e1f6')
  228. }
  229. if (status == '等待成交'){
  230. $('#span'+i).attr('class','color-d1f1e1')
  231. }
  232. if (status == '正在竞价'){
  233. $('#span'+i).attr('class','color-fad3d3')
  234. }
  235. }
  236. }
  237. module.itemLists = function (data) {
  238. if (data.code == 200) {
  239. module.data.serverApi = serverApi;
  240. var content = data.rows;
  241. var pageCount = (data.total / module.data.pageSize).toFixed(0);
  242. if (pageCount < 1) {
  243. pageCount = 1;
  244. }
  245. if (module.data.itemsInformationList1 == '') {
  246. // 初始化 分页器
  247. var page_s1 = createPage('.page_s1');
  248. // 设置分页
  249. setPage(page_s1, {
  250. pageTotal: data.total, // 数据总条数
  251. pageSize: module.data.pageSize, // 每页显示条数
  252. pageCurrent: 1, // 当前页
  253. maxBtnNum: 5, // 最多按钮个数 (最少5个)
  254. })
  255. $('#page_s1').html('共' + pageCount + '页')
  256. }
  257. module.data.pageCount = pageCount;
  258. module.data.itemsInformationList1 = content;
  259. var ItemsInformationData1 = template('ItemsInformationData1', module.data);
  260. $("#ItemsInformationContent1").html(ItemsInformationData1);
  261. }
  262. }
  263. //标的物类型
  264. module.deptType = function (data) {
  265. //console.log(data)
  266. if (data.code == 200) {
  267. var content = data.data;
  268. module.data.deptTypeList = content;
  269. var deptTypeData = template('deptTypeData', module.data);
  270. $("#deptTypeContent").html(deptTypeData);
  271. }
  272. }
  273. //标的物所在地
  274. module.deptLocation = function (data) {
  275. if (data.code == 200) {
  276. var content = data.data;
  277. module.data.deptLocationList = content;
  278. var deptLocationData = template('deptLocationData', module.data);
  279. $("#deptLocationContent").html(deptLocationData);
  280. }
  281. }
  282. //标的物所在地(二级)
  283. module.deptSecondLocation = function (data) {
  284. if (data.data.length == 0) {
  285. document.getElementById('secondDept').style.display = 'none';
  286. return;
  287. } else {
  288. document.getElementById('secondDept').style.display = 'block';
  289. }
  290. if (data.code == 200) {
  291. //console.log(data)
  292. var content = data.data;
  293. module.data.deptSecondLocationList = content;
  294. var deptSecondLocationData = template('deptSecondLocationData', module.data);
  295. $("#secondDept").html(deptSecondLocationData);
  296. //console.log(module.data.deptId)
  297. }
  298. }
  299. tabCheck = function (deptId) {
  300. module.data.deptId = deptId;
  301. console.log(deptId)
  302. $('#locInfoall').attr("class", "auction_hall_table_tab auction_loc");
  303. $("#deptLocationContent div").attr("class", "auction_hall_table_tab auction_loc");
  304. if (deptId == '') {
  305. $('#locInfoall').addClass('auction_hall_table_tab_select');
  306. document.getElementById('secondDept').style.display = 'none';
  307. } else {
  308. $('#locInfoall' + deptId).addClass('auction_hall_table_tab_select');
  309. tools.doGet(webDept, { deptId: deptId }, module.deptSecondLocation, true);
  310. }
  311. }
  312. secondCheck = function (id, secondDeptId) {
  313. $('#locInfoSecondall').attr("class", "auction_hall_table_tab auction_loc");
  314. $("#secondDept div").attr("class", "auction_hall_table_tab auction_loc");
  315. if (id == '' && secondDeptId == '') {
  316. $('#locInfoSecondall').addClass('auction_hall_table_tab_select');
  317. module.data.deptId = $('#deptLocationContent div.auction_hall_table_tab_select').attr("data");
  318. } else {
  319. $('#locInfoall' + id).addClass('auction_hall_table_tab_select');
  320. module.data.deptId = secondDeptId;
  321. }
  322. }
  323. allDept = function () {
  324. module.data.deptSize = 30
  325. document.getElementById('allDept').innerHTML = "<i class='sanjiao-top'></i>";
  326. document.getElementById('allDept').onclick = upDept;
  327. tools.doGet(webDept + '/0', {}, module.deptLocation, true);
  328. }
  329. upDept = function () {
  330. module.data.deptSize = 24
  331. document.getElementById('allDept').innerHTML = "<i class='sanjiao-bottom'></i>";
  332. document.getElementById('allDept').onclick = allDept;
  333. tools.doGet(webDept + '/0', {}, module.deptLocation, true);
  334. }
  335. //底部友情链接
  336. module.bottomFriendsLinks = function (data) {
  337. if (data.code == 200) {
  338. var content = data.data;
  339. //console.log(content)
  340. module.data.friendsLinksList = content;
  341. var friendsLinksData = template('friendsLinksData', module.data);
  342. $("#friendsLinksContent").html(friendsLinksData);
  343. }
  344. }
  345. turnThePage = function (pageNum) {
  346. module.data.pageNum = pageNum;
  347. module.data.form.pageNum = pageNum;
  348. tools.doGet(itemsList, module.data.form, module.itemList, true);
  349. }
  350. typeCheck = function (id, projectNumber) {
  351. if(projectNumber==undefined){
  352. // projectNumber为undefined时,置空(直接传递给后台接口导致搜索问题)
  353. projectNumber = "";
  354. }
  355. module.data.projectNumber = projectNumber;//标的物类型ID
  356. console.log(id+'----------------'+projectNumber)
  357. document.getElementById('standardTypeAll').className = 'auction_hall_table_tab';
  358. if (id == '') {
  359. id = 'All';
  360. }
  361. if(projectNumber == undefined){
  362. module.data.projectNumber = '';
  363. }
  364. for (var i = 0; i < module.data.deptTypeList.length; i++) {
  365. document.getElementById('standardType' + (i + 1)).className = 'auction_hall_table_tab';
  366. }
  367. document.getElementById('standardType' + id).className = 'auction_hall_table_tab auction_hall_table_tab_select';
  368. }
  369. selectedStatus = function (id, projectShowStatus) {
  370. module.data.projectShowStatus = projectShowStatus;
  371. document.getElementById('statusall').className = 'auction_hall_table_tab'
  372. for (var i = 0; i < 5; i++) {
  373. document.getElementById('status' + (1 + i)).className = 'auction_hall_table_tab'
  374. }
  375. document.getElementById('status' + id).className = 'auction_hall_table_tab auction_hall_table_tab_select'
  376. }
  377. goSearchClear = function(){
  378. selectedStatus('all');
  379. tabCheck('');
  380. typeCheck('');
  381. $('#signStartTimeStr').val('')
  382. $('#signEndTimeStr').val('')
  383. $('#auctionStartTimeStr').val('')
  384. $('#endTimeStr').val('')
  385. goSearch();
  386. }
  387. goSearch = function () {
  388. module.data.itemsInformationList = '';
  389. module.data.itemsInformationList1 = '';
  390. $('.page_s1').html('')
  391. $('#page_s1').html('')
  392. module.data.form.deptId = module.data.deptId;
  393. module.data.form.projectNumber = module.data.projectNumber;
  394. module.data.form.projectShowStatus = module.data.projectShowStatus;
  395. console.log($('#signStartTimeStr').val()!=null)
  396. if (module.data.form.signupStartTime){
  397. delete module.data.form.signupStartTime;
  398. }
  399. if (module.data.form.signupStopTime){
  400. delete module.data.form.signupStopTime;
  401. }
  402. if (module.data.form.biddingStartTime){
  403. delete module.data.form.biddingStartTime;
  404. }
  405. if (module.data.form.biddingStopTime){
  406. delete module.data.form.biddingStopTime;
  407. }
  408. if ($('#signStartTimeStr').val()!=''){
  409. module.data.form.signupStartTime = $('#signStartTimeStr').val();
  410. }
  411. if ($('#signEndTimeStr').val()!=''){
  412. module.data.form.signupStopTime = $('#signEndTimeStr').val();
  413. }
  414. if ($('#auctionStartTimeStr').val()!=''){
  415. module.data.form.biddingStartTime = $('#auctionStartTimeStr').val();
  416. }
  417. if ($('#endTimeStr').val()!=''){
  418. module.data.form.biddingStopTime = $('#endTimeStr').val();
  419. }
  420. module.data.form.pageNum = module.data.pageNum;
  421. module.data.form.pageSize = module.data.pageSize;
  422. console.log(module.data.form)
  423. if (module.data.searchType == 'gyxm'){
  424. tools.doGet(itemsList, module.data.form, module.itemList, true);
  425. }else{
  426. tools.doGet(needProjectList, {deptId:module.data.deptId,projectNumber:module.data.projectNumber,pageSize:module.data.pageSize,pageNum:'1'}, module.itemLists, true);
  427. }
  428. }
  429. goDetail = function (id) {
  430. tools.skip('itemsDetail.html?id='+id);
  431. }
  432. goNeedsDetail = function (id) {
  433. tools.skip('itemsNeedsDetail.html?id='+id);
  434. }
  435. tabList = function (id) {
  436. module.data.itemsInformationList = '';
  437. module.data.itemsInformationList1 = '';
  438. typeCheck('');
  439. $('.page_s1').html('')
  440. $('#page_s1').html('')
  441. if (id == 'gyxm'){
  442. module.data.searchType = 'gyxm'
  443. document.getElementById('jjsjShow').style.display = 'table-row';
  444. document.getElementById('bmsjShow').style.display = 'table-row';
  445. document.getElementById('xmztShow').style.display = 'table-row';
  446. document.getElementById('xqxmSearch').style.display = 'none';
  447. document.getElementById('xqxmSearch2').style.display = 'none';
  448. tools.doGet(itemsList, { deptId: 100, pageNum: module.data.pageNum, pageSize: module.data.pageSize }, module.itemList, true);
  449. }else{
  450. module.data.searchType = 'xqxm'
  451. document.getElementById('jjsjShow').style.display = 'none';
  452. document.getElementById('bmsjShow').style.display = 'none';
  453. document.getElementById('xmztShow').style.display = 'none';
  454. document.getElementById('xqxmSearch').style.display = 'block';
  455. document.getElementById('xqxmSearch2').style.display = 'block';
  456. tools.doGet(needProjectList, {projectNumber:'',pageSize:module.data.pageSize,pageNum:'1'}, module.itemLists, true);
  457. }
  458. }
  459. centerTap = function (type) {
  460. document.getElementById('ItemsInformationContent2').style.display = 'none';
  461. document.getElementById('gyxm').style.display = 'none';
  462. document.getElementById(type).style.display = 'block';
  463. }
  464. return module;
  465. });