网站
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 

469 wiersze
18 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 == ''&&content.length>0) {
  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 == ''&&content.length>0) {
  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. $("#xqxmSearch").attr("class", "input_data_btn");
  267. if (deptId == '') {
  268. $('#locInfoall').addClass('auction_hall_table_tab_select');
  269. document.getElementById('secondDept').style.display = 'none';
  270. } else {
  271. $('#locInfoall' + deptId).addClass('auction_hall_table_tab_select');
  272. tools.doGet(webDept, { deptId: deptId }, module.deptSecondLocation, true);
  273. }
  274. }
  275. secondCheck = function (id, secondDeptId) {
  276. $('#locInfoSecondall').attr("class", "auction_hall_table_tab auction_loc");
  277. $("#secondDept div").attr("class", "auction_hall_table_tab auction_loc");
  278. if (id == '' && secondDeptId == '') {
  279. $('#locInfoSecondall').addClass('auction_hall_table_tab_select');
  280. module.data.deptId = $('#deptLocationContent div.auction_hall_table_tab_select').attr("data");
  281. } else {
  282. $('#locInfoall' + id).addClass('auction_hall_table_tab_select');
  283. module.data.deptId = secondDeptId;
  284. }
  285. }
  286. allDept = function () {
  287. module.data.deptSize = 30
  288. document.getElementById('allDept').innerHTML = "<i class='sanjiao-top'></i>";
  289. document.getElementById('allDept').onclick = upDept;
  290. tools.doGet(webDept + '/0', {}, module.deptLocation, true);
  291. }
  292. upDept = function () {
  293. module.data.deptSize = 24
  294. document.getElementById('allDept').innerHTML = "<i class='sanjiao-bottom'></i>";
  295. document.getElementById('allDept').onclick = allDept;
  296. tools.doGet(webDept + '/0', {}, module.deptLocation, true);
  297. }
  298. //底部友情链接
  299. module.bottomFriendsLinks = function (data) {
  300. if (data.code == 200) {
  301. var content = data.data;
  302. //console.log(content)
  303. module.data.friendsLinksList = content;
  304. var friendsLinksData = template('friendsLinksData', module.data);
  305. $("#friendsLinksContent").html(friendsLinksData);
  306. }
  307. }
  308. turnThePage = function (pageNum) {
  309. module.data.pageNum = pageNum;
  310. module.data.form.pageNum = pageNum;
  311. let type = module.data.searchType;
  312. if (type == 'gyxm'){
  313. tools.doGet(itemsList, module.data.form, module.itemList, true);
  314. }else{
  315. tools.doGet(needProjectList, {deptId:module.data.deptId,projectNumber:module.data.projectNumber,pageSize:module.data.pageSize,pageNum:'1'}, module.itemLists, true);
  316. }
  317. }
  318. typeCheck = function (id, projectNumber) {
  319. if(projectNumber==undefined){
  320. // projectNumber为undefined时,置空(直接传递给后台接口导致搜索问题)
  321. projectNumber = "";
  322. }
  323. module.data.projectNumber = projectNumber;//标的物类型ID
  324. console.log(id+'----------------'+projectNumber)
  325. document.getElementById('standardTypeAll').className = 'auction_hall_table_tab';
  326. if (id == '') {
  327. id = 'All';
  328. }
  329. if(projectNumber == undefined){
  330. module.data.projectNumber = '';
  331. }
  332. for (var i = 0; i < module.data.deptTypeList.length; i++) {
  333. document.getElementById('standardType' + (i + 1)).className = 'auction_hall_table_tab';
  334. }
  335. document.getElementById('standardType' + id).className = 'auction_hall_table_tab auction_hall_table_tab_select';
  336. }
  337. selectedStatus = function (id, projectShowStatus) {
  338. module.data.projectShowStatus = projectShowStatus;
  339. document.getElementById('statusall').className = 'auction_hall_table_tab'
  340. for (var i = 0; i < 5; i++) {
  341. document.getElementById('status' + (1 + i)).className = 'auction_hall_table_tab'
  342. }
  343. document.getElementById('status' + id).className = 'auction_hall_table_tab auction_hall_table_tab_select'
  344. }
  345. goSearch = function () {
  346. module.data.itemsInformationList = '';
  347. module.data.itemsInformationList1 = '';
  348. $('.page_s1').html('')
  349. $('#page_s1').html('')
  350. module.data.form.deptId = module.data.deptId;
  351. module.data.form.projectNumber = module.data.projectNumber;
  352. module.data.form.projectShowStatus = module.data.projectShowStatus;
  353. console.log($('#signStartTimeStr').val()!=null)
  354. if (module.data.form.signupStartTime){
  355. delete module.data.form.signupStartTime;
  356. }
  357. if (module.data.form.signupStopTime){
  358. delete module.data.form.signupStopTime;
  359. }
  360. if (module.data.form.biddingStartTime){
  361. delete module.data.form.biddingStartTime;
  362. }
  363. if (module.data.form.biddingStopTime){
  364. delete module.data.form.biddingStopTime;
  365. }
  366. if ($('#signStartTimeStr').val()!=''){
  367. module.data.form.signupStartTime = $('#signStartTimeStr').val();
  368. }
  369. if ($('#signEndTimeStr').val()!=''){
  370. module.data.form.signupStopTime = $('#signEndTimeStr').val();
  371. }
  372. if ($('#auctionStartTimeStr').val()!=''){
  373. module.data.form.biddingStartTime = $('#auctionStartTimeStr').val();
  374. }
  375. if ($('#endTimeStr').val()!=''){
  376. module.data.form.biddingStopTime = $('#endTimeStr').val();
  377. }
  378. module.data.form.pageNum = '1';
  379. module.data.form.pageSize = module.data.pageSize;
  380. console.log(module.data.form)
  381. if (module.data.searchType == 'gyxm'){
  382. tools.doGet(itemsList, module.data.form, module.itemList, true);
  383. }else{
  384. tools.doGet(needProjectList, {deptId:module.data.deptId,projectNumber:module.data.projectNumber,pageSize:module.data.pageSize,pageNum:'1'}, module.itemLists, true);
  385. }
  386. }
  387. goDetail = function (id) {
  388. tools.skip('itemsDetail.html?id='+id);
  389. }
  390. goNeedsDetail = function (id) {
  391. tools.skip('itemsNeedsDetail.html?id='+id);
  392. }
  393. tabList = function (id) {
  394. document.getElementById('gyxm').style.display = 'none';
  395. document.getElementById('xqxm').style.display = 'none';
  396. document.getElementById(id).style.display = 'block';
  397. document.getElementById('gyxmBtn').className = '';
  398. document.getElementById('xqxmBtn').className = '';
  399. document.getElementById(id+'Btn').className = 'active';
  400. module.data.itemsInformationList = '';
  401. module.data.itemsInformationList1 = '';
  402. typeCheck('');
  403. $('.page_s1').html('')
  404. $('#page_s1').html('')
  405. if (id == 'gyxm'){
  406. module.data.searchType = 'gyxm'
  407. document.getElementById('jjsjShow').style.display = 'table-row';
  408. document.getElementById('bmsjShow').style.display = 'table-row';
  409. document.getElementById('xmztShow').style.display = 'table-row';
  410. document.getElementById('xqxmSearch').style.display = 'none';
  411. tools.doGet(itemsList, { deptId: 100, pageNum: module.data.pageNum, pageSize: module.data.pageSize }, module.itemList, true);
  412. }else{
  413. module.data.searchType = 'xqxm'
  414. document.getElementById('jjsjShow').style.display = 'none';
  415. document.getElementById('bmsjShow').style.display = 'none';
  416. document.getElementById('xmztShow').style.display = 'none';
  417. document.getElementById('xqxmSearch').style.display = 'block';
  418. tools.doGet(needProjectList, {projectNumber:'',pageSize:module.data.pageSize,pageNum:'1'}, module.itemLists, true);
  419. }
  420. }
  421. return module;
  422. });