网站
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.
 
 
 

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