网站
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

420 lines
16 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. module.data.focusListTop = data.data;
  136. var bannerFocusDataTop = template('bannerFocusDataTop', module.data);
  137. $("#bannerFocusTopContent").html(bannerFocusDataTop);
  138. new Swiper('#bannerFocusWrapTop', {
  139. paginationClickable: true,
  140. autoplay : 4000,
  141. loop:true
  142. })
  143. }
  144. }
  145. //获取地址栏参数
  146. function getQueryVariable(variable) {
  147. var query = window.location.search.substring(1);
  148. var vars = query.split("&");
  149. for (var i = 0; i < vars.length; i++) {
  150. var pair = vars[i].split("=");
  151. if (pair[0] == variable) { return pair[1]; }
  152. }
  153. return (false);
  154. }
  155. //挂牌项目列表
  156. module.itemList = function (data) {
  157. if (data.code == 200) {
  158. //console.log(data)
  159. module.data.serverApi = serverApi;
  160. var content = data.rows;
  161. var pageCount = (data.total / module.data.pageSize).toFixed(0);
  162. if (pageCount < 1) {
  163. pageCount = 1;
  164. }
  165. if (module.data.itemsInformationList == '') {
  166. // 初始化 分页器
  167. var page_s1 = createPage('.page_s1');
  168. // 设置分页
  169. setPage(page_s1, {
  170. pageTotal: data.total, // 数据总条数
  171. pageSize: module.data.pageSize, // 每页显示条数
  172. pageCurrent: 1, // 当前页
  173. maxBtnNum: 5, // 最多按钮个数 (最少5个)
  174. })
  175. $('#page_s1').html('共' + pageCount + '页')
  176. }
  177. module.data.pageCount = pageCount;
  178. module.data.itemsInformationList = content;
  179. var ItemsInformationData = template('ItemsInformationData', module.data);
  180. $("#ItemsInformationContent").html(ItemsInformationData);
  181. }
  182. }
  183. module.itemLists = function (data) {
  184. if (data.code == 200) {
  185. module.data.serverApi = serverApi;
  186. var content = data.rows;
  187. var pageCount = (data.total / module.data.pageSize).toFixed(0);
  188. if (pageCount < 1) {
  189. pageCount = 1;
  190. }
  191. if (module.data.itemsInformationList1 == '') {
  192. // 初始化 分页器
  193. var page_s1 = createPage('.page_s1');
  194. // 设置分页
  195. setPage(page_s1, {
  196. pageTotal: data.total, // 数据总条数
  197. pageSize: module.data.pageSize, // 每页显示条数
  198. pageCurrent: 1, // 当前页
  199. maxBtnNum: 5, // 最多按钮个数 (最少5个)
  200. })
  201. $('#page_s1').html('共' + pageCount + '页')
  202. }
  203. module.data.pageCount = pageCount;
  204. module.data.itemsInformationList1 = content;
  205. var ItemsInformationData1 = template('ItemsInformationData1', module.data);
  206. $("#ItemsInformationContent1").html(ItemsInformationData1);
  207. }
  208. }
  209. //标的物类型
  210. module.deptType = function (data) {
  211. //console.log(data)
  212. if (data.code == 200) {
  213. var content = data.data;
  214. module.data.deptTypeList = content;
  215. var deptTypeData = template('deptTypeData', module.data);
  216. $("#deptTypeContent").html(deptTypeData);
  217. }
  218. }
  219. //标的物所在地
  220. module.deptLocation = function (data) {
  221. if (data.code == 200) {
  222. var content = data.data;
  223. module.data.deptLocationList = content;
  224. var deptLocationData = template('deptLocationData', module.data);
  225. $("#deptLocationContent").html(deptLocationData);
  226. }
  227. }
  228. //标的物所在地(二级)
  229. module.deptSecondLocation = function (data) {
  230. if (data.data.length == 0) {
  231. document.getElementById('secondDept').style.display = 'none';
  232. return;
  233. } else {
  234. document.getElementById('secondDept').style.display = 'block';
  235. }
  236. if (data.code == 200) {
  237. //console.log(data)
  238. var content = data.data;
  239. module.data.deptSecondLocationList = content;
  240. var deptSecondLocationData = template('deptSecondLocationData', module.data);
  241. $("#secondDept").html(deptSecondLocationData);
  242. //console.log(module.data.deptId)
  243. }
  244. }
  245. tabCheck = function (deptId) {
  246. module.data.deptId = deptId;
  247. $('#locInfoall').attr("class", "auction_hall_table_tab auction_loc");
  248. $("#deptLocationContent div").attr("class", "auction_hall_table_tab auction_loc");
  249. if (deptId == '') {
  250. $('#locInfoall').addClass('auction_hall_table_tab_select');
  251. document.getElementById('secondDept').style.display = 'none';
  252. } else {
  253. $('#locInfoall' + deptId).addClass('auction_hall_table_tab_select');
  254. tools.doGet(webDept, { deptId: deptId }, module.deptSecondLocation, true);
  255. }
  256. }
  257. secondCheck = function (id, secondDeptId) {
  258. $('#locInfoSecondall').attr("class", "auction_hall_table_tab auction_loc");
  259. $("#secondDept div").attr("class", "auction_hall_table_tab auction_loc");
  260. if (id == '' && secondDeptId == '') {
  261. $('#locInfoSecondall').addClass('auction_hall_table_tab_select');
  262. module.data.deptId = $('#deptLocationContent div.auction_hall_table_tab_select').attr("data");
  263. } else {
  264. $('#locInfoall' + id).addClass('auction_hall_table_tab_select');
  265. module.data.deptId = secondDeptId;
  266. }
  267. }
  268. allDept = function () {
  269. module.data.deptSize = 30
  270. document.getElementById('allDept').innerHTML = "<i class='sanjiao-top'></i>";
  271. document.getElementById('allDept').onclick = upDept;
  272. tools.doGet(webDept + '/0', {}, module.deptLocation, true);
  273. }
  274. upDept = function () {
  275. module.data.deptSize = 24
  276. document.getElementById('allDept').innerHTML = "<i class='sanjiao-bottom'></i>";
  277. document.getElementById('allDept').onclick = allDept;
  278. tools.doGet(webDept + '/0', {}, module.deptLocation, true);
  279. }
  280. //底部友情链接
  281. module.bottomFriendsLinks = function (data) {
  282. if (data.code == 200) {
  283. var content = data.data;
  284. //console.log(content)
  285. module.data.friendsLinksList = content;
  286. var friendsLinksData = template('friendsLinksData', module.data);
  287. $("#friendsLinksContent").html(friendsLinksData);
  288. }
  289. }
  290. turnThePage = function (pageNum) {
  291. module.data.pageNum = pageNum;
  292. module.data.form.pageNum = pageNum;
  293. tools.doGet(itemsList, module.data.form, module.itemList, true);
  294. }
  295. typeCheck = function (id, projectNumber) {
  296. if(projectNumber==undefined){
  297. // projectNumber为undefined时,置空(直接传递给后台接口导致搜索问题)
  298. projectNumber = "";
  299. }
  300. module.data.projectNumber = projectNumber;//标的物类型ID
  301. //console.log(id+'----------------'+projectNumber)
  302. document.getElementById('standardTypeAll').className = 'auction_hall_table_tab';
  303. if (id == '') {
  304. id = 'All';
  305. }
  306. if(projectNumber == undefined){
  307. module.data.projectNumber = '';
  308. }
  309. for (var i = 0; i < module.data.deptTypeList.length; i++) {
  310. document.getElementById('standardType' + (i + 1)).className = 'auction_hall_table_tab';
  311. }
  312. document.getElementById('standardType' + id).className = 'auction_hall_table_tab auction_hall_table_tab_select';
  313. }
  314. selectedStatus = function (id, projectShowStatus) {
  315. module.data.projectShowStatus = projectShowStatus;
  316. document.getElementById('statusall').className = 'auction_hall_table_tab'
  317. for (var i = 0; i < 5; i++) {
  318. document.getElementById('status' + (1 + i)).className = 'auction_hall_table_tab'
  319. }
  320. document.getElementById('status' + id).className = 'auction_hall_table_tab auction_hall_table_tab_select'
  321. }
  322. goSearch = function () {
  323. module.data.itemsInformationList = '';
  324. module.data.itemsInformationList1 = '';
  325. $('.page_s1').html('')
  326. $('#page_s1').html('')
  327. module.data.form.deptId = module.data.deptId;
  328. module.data.form.projectNumber = module.data.projectNumber;
  329. module.data.form.projectShowStatus = module.data.projectShowStatus;
  330. module.data.form.signupStartTime = $('#signStartTimeStr').val();
  331. module.data.form.signupStopTime = $('#signEndTimeStr').val();
  332. module.data.form.biddingStartTime = $('#auctionStartTimeStr').val();
  333. module.data.form.biddingStopTime = $('#endTimeStr').val();
  334. module.data.form.pageNum = module.data.pageNum;
  335. module.data.form.pageSize = module.data.pageSize;
  336. //console.log(module.data.form)
  337. if (module.data.searchType == 'gyxm'){
  338. tools.doGet(itemsList, module.data.form, module.itemList, true);
  339. }else{
  340. tools.doGet(needProjectList, {projectNumber:module.data.projectNumber,pageSize:module.data.pageSize,pageNum:'1'}, module.itemLists, true);
  341. }
  342. }
  343. goDetail = function (id) {
  344. tools.skip('itemsDetail.html?id='+id);
  345. }
  346. goNeedsDetail = function (id) {
  347. tools.skip('itemsNeedsDetail.html?id='+id);
  348. }
  349. tabList = function (id) {
  350. document.getElementById('gyxm').style.display = 'none';
  351. document.getElementById('xqxm').style.display = 'none';
  352. document.getElementById(id).style.display = 'block';
  353. document.getElementById('gyxmBtn').className = '';
  354. document.getElementById('xqxmBtn').className = '';
  355. document.getElementById(id+'Btn').className = 'active';
  356. module.data.itemsInformationList = '';
  357. module.data.itemsInformationList1 = '';
  358. typeCheck('');
  359. $('.page_s1').html('')
  360. $('#page_s1').html('')
  361. if (id == 'gyxm'){
  362. module.data.searchType = 'gyxm'
  363. document.getElementById('jjsjShow').style.display = 'table-row';
  364. document.getElementById('bmsjShow').style.display = 'table-row';
  365. document.getElementById('xmztShow').style.display = 'table-row';
  366. document.getElementById('xqxmSearch').style.display = 'none';
  367. tools.doGet(itemsList, { deptId: 100, pageNum: module.data.pageNum, pageSize: module.data.pageSize }, module.itemList, true);
  368. }else{
  369. module.data.searchType = 'xqxm'
  370. document.getElementById('jjsjShow').style.display = 'none';
  371. document.getElementById('bmsjShow').style.display = 'none';
  372. document.getElementById('xmztShow').style.display = 'none';
  373. document.getElementById('xqxmSearch').style.display = 'block';
  374. tools.doGet(needProjectList, {projectNumber:'',pageSize:module.data.pageSize,pageNum:'1'}, module.itemLists, true);
  375. }
  376. }
  377. return module;
  378. });