|
- /**
- * Created by Administrator on 2021/4/5.
- */
- define(['jquery', "template", "Tools", "itemsApi", "paging", 'dateTime', 'swiper'], function ($, template, Tools) {
- //数据存储
- var module = {
- data: {
- //服务器地址
- // serverApi: 'http://219.148.186.198:8082/ruoyi-admin',
- searchType:'gyxm',
- serverApi: '',
- //标的物类型
- deptTypeList: [],
- //标的物所在地
- deptLocationList: [],
- //标的物二级所在地
- deptSecondLocationList: [],
- //新闻列表
- itemsInformationList: '',
- //新闻列表
- itemsInformationList1: '',
- //页码
- pageNum: 1,
- //页码集合
- pageList: [],
- //每页数量
- pageSize: 20,
- //总页数
- pageCount: 0,
- //标的物集合长度
- deptSize: 24,
- //标的物选中项id
- deptId: '100',
- //标的所在地选中
- secondDeptId: '',
- //标的物类型ID
- projectNumber: '',
- //项目状态
- projectShowStatus: '',
- //报名开始时间
- signupStartTime: '',
- //报名结束时间
- signupStopTime: '',
- //竞价开始时间
- biddingStartTime: '',
- //竞价结束时间
- biddingStopTime: '',
- form: {
- deptId: 100,
- projectNumber: '',
- projectShowStatus: '',
- // signupStartTime: '',
- // signupStopTime: '',
- // biddingStartTime: '',
- // biddingStopTime: '',
- pageNum: 1,
- pageSize: 20,
- }
- },
- };
- var tools = new Tools();
-
- module.init = function (page) {
- //获取焦点图信息
- //tools.doGet(websitePicture, {picType:1,status:0,orderByColumn:'picSort',isAsc:'desc'}, module.focusNewsTop , true);
- //底部友情链接
- tools.doGet(friendsLinks, {}, module.bottomFriendsLinks, true);
- if (getQueryVariable('projectCode') || getQueryVariable('projectName') || getQueryVariable('projectNumber')) {
- //console.log('首页进入')
- tools.doGet(itemsList, {
- deptId: 100,
- pageNum: module.data.pageNum,
- pageSize: module.data.pageSize,
- projectCode: getQueryVariable('projectCode'),
- projectName: getQueryVariable('projectName'),
- projectNumber: getQueryVariable('projectNumber')
- }, module.itemList, true);
- }else if(getQueryVariable('clickType') == 'deptType'){//新闻资讯
- tools.doGet(itemsList, { deptId: 100, pageNum: module.data.pageNum, pageSize: module.data.pageSize }, module.itemList, true);
- setTimeout(function(){
- typeCheck(getQueryVariable('dictSort'),getQueryVariable('dictCode'))
- goSearch()
- },500)
- }else if(getQueryVariable('clickType') == 'deptLocation'){
- tools.doGet(itemsList, { deptId: 100, pageNum: module.data.pageNum, pageSize: module.data.pageSize }, module.itemList, true);
- setTimeout(function(){
- tabCheck(getQueryVariable('dictSort'))
- goSearch()
- },500)
- }else if(getQueryVariable('clickType') == 'collectiveAssets'){
- setTimeout(function(){
- tabList('xqxm')
- },500)
- } else {
- //新闻资讯
- tools.doGet(itemsList, { deptId: 100, pageNum: module.data.pageNum, pageSize: module.data.pageSize }, module.itemList, true);
- }
-
- //标的物类型
- tools.doGet(webDeptType + "/project_type", {}, module.deptType, true);
-
- //标的物所在地
- tools.doGet(webDept, { deptId: '' }, module.deptLocation, true);
-
- //网站配置信息(网站名称 底部联系方式 公安备案号 网站备案号)
- tools.getWebConfig();
-
- $("#signStartTimeStr").datetime({
- type: "date",
- value: [new Date().getFullYear(),new Date().getMonth()+1,new Date().getDate()],
- success: function (res) {
- //console.log(res)
- }
- })
-
- $("#signEndTimeStr").datetime({
- type: "date",
- value: [new Date().getFullYear(),new Date().getMonth()+1,new Date().getDate()],
- success: function (res) {
- //console.log(res)
- }
- })
-
- $("#auctionStartTimeStr").datetime({
- type: "date",
- value: [new Date().getFullYear(),new Date().getMonth()+1,new Date().getDate()],
- success: function (res) {
- //console.log(res)
- }
- })
-
- $("#endTimeStr").datetime({
- type: "date",
- value: [new Date().getFullYear(),new Date().getMonth()+1,new Date().getDate()],
- success: function (res) {
- //console.log(res)
- }
- })
-
-
- };
-
- //焦点图数据
- module.focusNewsTop = function (data) {
- if (data.code == 200) {
-
- let focusArray = [];
-
- if(data.data.length<1){
- focusArray.push({
- picUrl:'../../../static/images/banner1.png'
- },{
- picUrl:'../../../static/images/banner2.png'
- },{
- picUrl:'../../../static/images/banner3.png'
- })
- }else{
- data.data.forEach(res=>{
- focusArray.push({
- picUrl:'/api'+res.picUrl
- })
- })
- }
-
- module.data.focusListTop = focusArray;
- var bannerFocusDataTop = template('bannerFocusDataTop', module.data);
- $("#bannerFocusTopContent").html(bannerFocusDataTop);
-
- new Swiper('#bannerFocusWrapTop', {
- paginationClickable: true,
- autoplay : 4000,
- loop:true
- })
-
- }
- }
-
- //获取地址栏参数
- function getQueryVariable(variable) {
- var query = window.location.search.substring(1);
- var vars = query.split("&");
- for (var i = 0; i < vars.length; i++) {
- var pair = vars[i].split("=");
- if (pair[0] == variable) { return pair[1]; }
- }
- return (false);
- }
-
- //交易项目列表
- module.itemList = function (data) {
- if (data.code == 200) {
- console.log(serverApi)
- module.data.serverApi = serverApi;
- var content = data.rows;
- var pageCount = (data.total / module.data.pageSize).toFixed(0);
- if (pageCount < 1) {
- pageCount = 1;
- }
- if (module.data.itemsInformationList == '') {
- // 初始化 分页器
- var page_s1 = createPage('.page_s1');
- // 设置分页
- setPage(page_s1, {
- pageTotal: data.total, // 数据总条数
- pageSize: module.data.pageSize, // 每页显示条数
- pageCurrent: 1, // 当前页
- maxBtnNum: 5, // 最多按钮个数 (最少5个)
- })
- $('#page_s1').html('共' + pageCount + '页')
- }
- module.data.pageCount = pageCount;
- module.data.itemsInformationList = content;
- var ItemsInformationData = template('ItemsInformationData', module.data);
- $("#ItemsInformationContent").html(ItemsInformationData);
- var ItemsInformationData2 = template('ItemsInformationData2', module.data);
- $("#ItemsInformationContent2").html(ItemsInformationData2);
- }
- }
-
- module.itemLists = function (data) {
- if (data.code == 200) {
- module.data.serverApi = serverApi;
- var content = data.rows;
- var pageCount = (data.total / module.data.pageSize).toFixed(0);
- if (pageCount < 1) {
- pageCount = 1;
- }
- if (module.data.itemsInformationList1 == '') {
- // 初始化 分页器
- var page_s1 = createPage('.page_s1');
- // 设置分页
- setPage(page_s1, {
- pageTotal: data.total, // 数据总条数
- pageSize: module.data.pageSize, // 每页显示条数
- pageCurrent: 1, // 当前页
- maxBtnNum: 5, // 最多按钮个数 (最少5个)
- })
- $('#page_s1').html('共' + pageCount + '页')
- }
- module.data.pageCount = pageCount;
- module.data.itemsInformationList1 = content;
- var ItemsInformationData1 = template('ItemsInformationData1', module.data);
- $("#ItemsInformationContent1").html(ItemsInformationData1);
- }
- }
-
- //标的物类型
- module.deptType = function (data) {
- //console.log(data)
- if (data.code == 200) {
- var content = data.data;
- module.data.deptTypeList = content;
- var deptTypeData = template('deptTypeData', module.data);
- $("#deptTypeContent").html(deptTypeData);
- }
- }
-
- //标的物所在地
- module.deptLocation = function (data) {
- if (data.code == 200) {
- var content = data.data;
- module.data.deptLocationList = content;
- var deptLocationData = template('deptLocationData', module.data);
- $("#deptLocationContent").html(deptLocationData);
- }
- }
-
- //标的物所在地(二级)
- module.deptSecondLocation = function (data) {
- if (data.data.length == 0) {
- document.getElementById('secondDept').style.display = 'none';
- return;
- } else {
- document.getElementById('secondDept').style.display = 'block';
- }
- if (data.code == 200) {
- //console.log(data)
- var content = data.data;
- module.data.deptSecondLocationList = content;
- var deptSecondLocationData = template('deptSecondLocationData', module.data);
- $("#secondDept").html(deptSecondLocationData);
- //console.log(module.data.deptId)
- }
- }
-
- tabCheck = function (deptId) {
- module.data.deptId = deptId;
- console.log(deptId)
- $('#locInfoall').attr("class", "auction_hall_table_tab auction_loc");
- $("#deptLocationContent div").attr("class", "auction_hall_table_tab auction_loc");
- if (deptId == '') {
- $('#locInfoall').addClass('auction_hall_table_tab_select');
- document.getElementById('secondDept').style.display = 'none';
- } else {
- $('#locInfoall' + deptId).addClass('auction_hall_table_tab_select');
- tools.doGet(webDept, { deptId: deptId }, module.deptSecondLocation, true);
- }
- }
-
- secondCheck = function (id, secondDeptId) {
- $('#locInfoSecondall').attr("class", "auction_hall_table_tab auction_loc");
- $("#secondDept div").attr("class", "auction_hall_table_tab auction_loc");
- if (id == '' && secondDeptId == '') {
- $('#locInfoSecondall').addClass('auction_hall_table_tab_select');
- module.data.deptId = $('#deptLocationContent div.auction_hall_table_tab_select').attr("data");
- } else {
- $('#locInfoall' + id).addClass('auction_hall_table_tab_select');
- module.data.deptId = secondDeptId;
- }
- }
-
- allDept = function () {
- module.data.deptSize = 30
- document.getElementById('allDept').innerHTML = "<i class='sanjiao-top'></i>";
- document.getElementById('allDept').onclick = upDept;
- tools.doGet(webDept + '/0', {}, module.deptLocation, true);
- }
-
- upDept = function () {
- module.data.deptSize = 24
- document.getElementById('allDept').innerHTML = "<i class='sanjiao-bottom'></i>";
- document.getElementById('allDept').onclick = allDept;
- tools.doGet(webDept + '/0', {}, module.deptLocation, true);
- }
- //底部友情链接
- module.bottomFriendsLinks = function (data) {
- if (data.code == 200) {
- var content = data.data;
- //console.log(content)
- module.data.friendsLinksList = content;
- var friendsLinksData = template('friendsLinksData', module.data);
- $("#friendsLinksContent").html(friendsLinksData);
- }
- }
-
- turnThePage = function (pageNum) {
- module.data.pageNum = pageNum;
- module.data.form.pageNum = pageNum;
- tools.doGet(itemsList, module.data.form, module.itemList, true);
- }
-
- typeCheck = function (id, projectNumber) {
- if(projectNumber==undefined){
- // projectNumber为undefined时,置空(直接传递给后台接口导致搜索问题)
- projectNumber = "";
- }
- module.data.projectNumber = projectNumber;//标的物类型ID
- console.log(id+'----------------'+projectNumber)
- document.getElementById('standardTypeAll').className = 'auction_hall_table_tab';
- if (id == '') {
- id = 'All';
- }
- if(projectNumber == undefined){
- module.data.projectNumber = '';
- }
- for (var i = 0; i < module.data.deptTypeList.length; i++) {
- document.getElementById('standardType' + (i + 1)).className = 'auction_hall_table_tab';
- }
- document.getElementById('standardType' + id).className = 'auction_hall_table_tab auction_hall_table_tab_select';
- }
-
- selectedStatus = function (id, projectShowStatus) {
- module.data.projectShowStatus = projectShowStatus;
- document.getElementById('statusall').className = 'auction_hall_table_tab'
- for (var i = 0; i < 5; i++) {
- document.getElementById('status' + (1 + i)).className = 'auction_hall_table_tab'
- }
- document.getElementById('status' + id).className = 'auction_hall_table_tab auction_hall_table_tab_select'
- }
-
- goSearchClear = function(){
- selectedStatus('all');
- tabCheck('');
- typeCheck('');
- $('#signStartTimeStr').val('')
- $('#signEndTimeStr').val('')
- $('#auctionStartTimeStr').val('')
- $('#endTimeStr').val('')
- goSearch();
- }
-
- goSearch = function () {
- module.data.itemsInformationList = '';
- module.data.itemsInformationList1 = '';
- $('.page_s1').html('')
- $('#page_s1').html('')
- module.data.form.deptId = module.data.deptId;
- module.data.form.projectNumber = module.data.projectNumber;
- module.data.form.projectShowStatus = module.data.projectShowStatus;
-
- console.log($('#signStartTimeStr').val()!=null)
-
- if (module.data.form.signupStartTime){
- delete module.data.form.signupStartTime;
- }
- if (module.data.form.signupStopTime){
- delete module.data.form.signupStopTime;
- }
- if (module.data.form.biddingStartTime){
- delete module.data.form.biddingStartTime;
- }
- if (module.data.form.biddingStopTime){
- delete module.data.form.biddingStopTime;
- }
-
- if ($('#signStartTimeStr').val()!=''){
- module.data.form.signupStartTime = $('#signStartTimeStr').val();
- }
- if ($('#signEndTimeStr').val()!=''){
- module.data.form.signupStopTime = $('#signEndTimeStr').val();
- }
- if ($('#auctionStartTimeStr').val()!=''){
- module.data.form.biddingStartTime = $('#auctionStartTimeStr').val();
- }
- if ($('#endTimeStr').val()!=''){
- module.data.form.biddingStopTime = $('#endTimeStr').val();
- }
-
- module.data.form.pageNum = module.data.pageNum;
- module.data.form.pageSize = module.data.pageSize;
-
- console.log(module.data.form)
-
- if (module.data.searchType == 'gyxm'){
- tools.doGet(itemsList, module.data.form, module.itemList, true);
- }else{
- tools.doGet(needProjectList, {deptId:module.data.deptId,projectNumber:module.data.projectNumber,pageSize:module.data.pageSize,pageNum:'1'}, module.itemLists, true);
- }
-
- }
-
- goDetail = function (id) {
- tools.skip('itemsDetail.html?id='+id);
- }
-
- goNeedsDetail = function (id) {
- tools.skip('itemsNeedsDetail.html?id='+id);
- }
-
- tabList = function (id) {
-
- module.data.itemsInformationList = '';
- module.data.itemsInformationList1 = '';
- typeCheck('');
- $('.page_s1').html('')
- $('#page_s1').html('')
-
- if (id == 'gyxm'){
- module.data.searchType = 'gyxm'
- document.getElementById('jjsjShow').style.display = 'table-row';
- document.getElementById('bmsjShow').style.display = 'table-row';
- document.getElementById('xmztShow').style.display = 'table-row';
- document.getElementById('xqxmSearch').style.display = 'none';
- document.getElementById('xqxmSearch2').style.display = 'none';
- tools.doGet(itemsList, { deptId: 100, pageNum: module.data.pageNum, pageSize: module.data.pageSize }, module.itemList, true);
- }else{
- module.data.searchType = 'xqxm'
- document.getElementById('jjsjShow').style.display = 'none';
- document.getElementById('bmsjShow').style.display = 'none';
- document.getElementById('xmztShow').style.display = 'none';
- document.getElementById('xqxmSearch').style.display = 'block';
- document.getElementById('xqxmSearch2').style.display = 'block';
- tools.doGet(needProjectList, {projectNumber:'',pageSize:module.data.pageSize,pageNum:'1'}, module.itemLists, true);
- }
-
- }
-
- centerTap = function (type) {
- document.getElementById('ItemsInformationContent2').style.display = 'none';
- document.getElementById('gyxm').style.display = 'none';
- document.getElementById(type).style.display = 'block';
- }
-
- return module;
- });
|