网站
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 

465 rindas
17 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(data)
  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. }
  198. }
  199. module.itemLists = function (data) {
  200. if (data.code == 200) {
  201. module.data.serverApi = serverApi;
  202. var content = data.rows;
  203. var pageCount = (data.total / module.data.pageSize).toFixed(0);
  204. if (pageCount < 1) {
  205. pageCount = 1;
  206. }
  207. if (module.data.itemsInformationList1 == '') {
  208. // 初始化 分页器
  209. var page_s1 = createPage('.page_s1');
  210. // 设置分页
  211. setPage(page_s1, {
  212. pageTotal: data.total, // 数据总条数
  213. pageSize: module.data.pageSize, // 每页显示条数
  214. pageCurrent: 1, // 当前页
  215. maxBtnNum: 5, // 最多按钮个数 (最少5个)
  216. })
  217. $('#page_s1').html('共' + pageCount + '页')
  218. }
  219. module.data.pageCount = pageCount;
  220. module.data.itemsInformationList1 = content;
  221. var ItemsInformationData1 = template('ItemsInformationData1', module.data);
  222. $("#ItemsInformationContent1").html(ItemsInformationData1);
  223. }
  224. }
  225. //标的物类型
  226. module.deptType = function (data) {
  227. //console.log(data)
  228. if (data.code == 200) {
  229. var content = data.data;
  230. module.data.deptTypeList = content;
  231. var deptTypeData = template('deptTypeData', module.data);
  232. $("#deptTypeContent").html(deptTypeData);
  233. }
  234. }
  235. //标的物所在地
  236. module.deptLocation = function (data) {
  237. if (data.code == 200) {
  238. var content = data.data;
  239. module.data.deptLocationList = content;
  240. var deptLocationData = template('deptLocationData', module.data);
  241. $("#deptLocationContent").html(deptLocationData);
  242. }
  243. }
  244. //标的物所在地(二级)
  245. module.deptSecondLocation = function (data) {
  246. if (data.data.length == 0) {
  247. document.getElementById('secondDept').style.display = 'none';
  248. return;
  249. } else {
  250. document.getElementById('secondDept').style.display = 'block';
  251. }
  252. if (data.code == 200) {
  253. //console.log(data)
  254. var content = data.data;
  255. module.data.deptSecondLocationList = content;
  256. var deptSecondLocationData = template('deptSecondLocationData', module.data);
  257. $("#secondDept").html(deptSecondLocationData);
  258. //console.log(module.data.deptId)
  259. }
  260. }
  261. tabCheck = function (deptId) {
  262. module.data.deptId = deptId;
  263. console.log(deptId)
  264. $('#locInfoall').attr("class", "auction_hall_table_tab auction_loc");
  265. $("#deptLocationContent div").attr("class", "auction_hall_table_tab auction_loc");
  266. if (deptId == '') {
  267. $('#locInfoall').addClass('auction_hall_table_tab_select');
  268. document.getElementById('secondDept').style.display = 'none';
  269. } else {
  270. $('#locInfoall' + deptId).addClass('auction_hall_table_tab_select');
  271. tools.doGet(webDept, { deptId: deptId }, module.deptSecondLocation, true);
  272. }
  273. }
  274. secondCheck = function (id, secondDeptId) {
  275. $('#locInfoSecondall').attr("class", "auction_hall_table_tab auction_loc");
  276. $("#secondDept div").attr("class", "auction_hall_table_tab auction_loc");
  277. if (id == '' && secondDeptId == '') {
  278. $('#locInfoSecondall').addClass('auction_hall_table_tab_select');
  279. module.data.deptId = $('#deptLocationContent div.auction_hall_table_tab_select').attr("data");
  280. } else {
  281. $('#locInfoall' + id).addClass('auction_hall_table_tab_select');
  282. module.data.deptId = secondDeptId;
  283. }
  284. }
  285. allDept = function () {
  286. module.data.deptSize = 30
  287. document.getElementById('allDept').innerHTML = "<i class='sanjiao-top'></i>";
  288. document.getElementById('allDept').onclick = upDept;
  289. tools.doGet(webDept + '/0', {}, module.deptLocation, true);
  290. }
  291. upDept = function () {
  292. module.data.deptSize = 24
  293. document.getElementById('allDept').innerHTML = "<i class='sanjiao-bottom'></i>";
  294. document.getElementById('allDept').onclick = allDept;
  295. tools.doGet(webDept + '/0', {}, module.deptLocation, true);
  296. }
  297. //底部友情链接
  298. module.bottomFriendsLinks = function (data) {
  299. if (data.code == 200) {
  300. var content = data.data;
  301. //console.log(content)
  302. module.data.friendsLinksList = content;
  303. var friendsLinksData = template('friendsLinksData', module.data);
  304. $("#friendsLinksContent").html(friendsLinksData);
  305. }
  306. }
  307. turnThePage = function (pageNum) {
  308. module.data.pageNum = pageNum;
  309. module.data.form.pageNum = pageNum;
  310. tools.doGet(itemsList, module.data.form, module.itemList, true);
  311. }
  312. typeCheck = function (id, projectNumber) {
  313. if(projectNumber==undefined){
  314. // projectNumber为undefined时,置空(直接传递给后台接口导致搜索问题)
  315. projectNumber = "";
  316. }
  317. module.data.projectNumber = projectNumber;//标的物类型ID
  318. console.log(id+'----------------'+projectNumber)
  319. document.getElementById('standardTypeAll').className = 'auction_hall_table_tab';
  320. if (id == '') {
  321. id = 'All';
  322. }
  323. if(projectNumber == undefined){
  324. module.data.projectNumber = '';
  325. }
  326. for (var i = 0; i < module.data.deptTypeList.length; i++) {
  327. document.getElementById('standardType' + (i + 1)).className = 'auction_hall_table_tab';
  328. }
  329. document.getElementById('standardType' + id).className = 'auction_hall_table_tab auction_hall_table_tab_select';
  330. }
  331. selectedStatus = function (id, projectShowStatus) {
  332. module.data.projectShowStatus = projectShowStatus;
  333. document.getElementById('statusall').className = 'auction_hall_table_tab'
  334. for (var i = 0; i < 5; i++) {
  335. document.getElementById('status' + (1 + i)).className = 'auction_hall_table_tab'
  336. }
  337. document.getElementById('status' + id).className = 'auction_hall_table_tab auction_hall_table_tab_select'
  338. }
  339. goSearch = function () {
  340. module.data.itemsInformationList = '';
  341. module.data.itemsInformationList1 = '';
  342. $('.page_s1').html('')
  343. $('#page_s1').html('')
  344. module.data.form.deptId = module.data.deptId;
  345. module.data.form.projectNumber = module.data.projectNumber;
  346. module.data.form.projectShowStatus = module.data.projectShowStatus;
  347. console.log($('#signStartTimeStr').val()!=null)
  348. if (module.data.form.signupStartTime){
  349. delete module.data.form.signupStartTime;
  350. }
  351. if (module.data.form.signupStopTime){
  352. delete module.data.form.signupStopTime;
  353. }
  354. if (module.data.form.biddingStartTime){
  355. delete module.data.form.biddingStartTime;
  356. }
  357. if (module.data.form.biddingStopTime){
  358. delete module.data.form.biddingStopTime;
  359. }
  360. if ($('#signStartTimeStr').val()!=''){
  361. module.data.form.signupStartTime = $('#signStartTimeStr').val();
  362. }
  363. if ($('#signEndTimeStr').val()!=''){
  364. module.data.form.signupStopTime = $('#signEndTimeStr').val();
  365. }
  366. if ($('#auctionStartTimeStr').val()!=''){
  367. module.data.form.biddingStartTime = $('#auctionStartTimeStr').val();
  368. }
  369. if ($('#endTimeStr').val()!=''){
  370. module.data.form.biddingStopTime = $('#endTimeStr').val();
  371. }
  372. module.data.form.pageNum = module.data.pageNum;
  373. module.data.form.pageSize = module.data.pageSize;
  374. console.log(module.data.form)
  375. if (module.data.searchType == 'gyxm'){
  376. tools.doGet(itemsList, module.data.form, module.itemList, true);
  377. }else{
  378. tools.doGet(needProjectList, {projectNumber:module.data.projectNumber,pageSize:module.data.pageSize,pageNum:'1'}, module.itemLists, true);
  379. }
  380. }
  381. goDetail = function (id) {
  382. tools.skip('itemsDetail.html?id='+id);
  383. }
  384. goNeedsDetail = function (id) {
  385. tools.skip('itemsNeedsDetail.html?id='+id);
  386. }
  387. tabList = function (id) {
  388. document.getElementById('gyxm').style.display = 'none';
  389. document.getElementById('xqxm').style.display = 'none';
  390. document.getElementById(id).style.display = 'block';
  391. document.getElementById('gyxmBtn').className = '';
  392. document.getElementById('xqxmBtn').className = '';
  393. document.getElementById(id+'Btn').className = 'active';
  394. module.data.itemsInformationList = '';
  395. module.data.itemsInformationList1 = '';
  396. typeCheck('');
  397. $('.page_s1').html('')
  398. $('#page_s1').html('')
  399. if (id == 'gyxm'){
  400. module.data.searchType = 'gyxm'
  401. document.getElementById('jjsjShow').style.display = 'table-row';
  402. document.getElementById('bmsjShow').style.display = 'table-row';
  403. document.getElementById('xmztShow').style.display = 'table-row';
  404. document.getElementById('xqxmSearch').style.display = 'none';
  405. tools.doGet(itemsList, { deptId: 100, pageNum: module.data.pageNum, pageSize: module.data.pageSize }, module.itemList, true);
  406. }else{
  407. module.data.searchType = 'xqxm'
  408. document.getElementById('jjsjShow').style.display = 'none';
  409. document.getElementById('bmsjShow').style.display = 'none';
  410. document.getElementById('xmztShow').style.display = 'none';
  411. document.getElementById('xqxmSearch').style.display = 'block';
  412. tools.doGet(needProjectList, {projectNumber:'',pageSize:module.data.pageSize,pageNum:'1'}, module.itemLists, true);
  413. }
  414. }
  415. return module;
  416. });