paper.js 文件中的内容
var PaperListPage = {};
PaperListPage.TimeOutID = null;
PaperListPage.REPORTTYPE = 2 ;
PaperListPage.REPROTROOTTYPE = 1; //1为固定报表 2 为自定义报表
PaperListPage.CURRENTREPORT = null; //当前报表类型 1:固定报表日报 2:固定报表月报 3:固定报表实时报表 4:自定义报表日报 5:自定义报表月报
PaperListPage.lastReportId = 1; //当前报表ID
/**
* 加载所有报表页面
*/
PaperListPage.loadAll = function(reportType,areaType,dateType) {
PaperPage.DateParam.date == null;
// PaperListPage.REPORTTYPE = 2;
PaperListPage.REPORTTYPE = dateType;
PaperListPage.CURRENTREPORT = reportType;
alert("clearHistory");
clearHistory();
alert("showLoading");
showLoading();
// $('#reportTypeSelected').text("月报");
clearTimeout(PaperListPage.TimeOutID);
PaperListPage.TimeOutID = setTimeout(function() {
showLoadend("PaperListPage");
}, 10000);
$.ui.updatePanel("#paper_list_all_ul", "");
// Api.getPaperList("2", "1", "PaperListPage.updateListContent");
Api.getPaperList(reportType, areaType, "PaperListPage.updateListContent");
$("#searchTxt").bind("input propertychange", function() {
$("#paper_list_all_div").scroller().scrollToTop();
var keyword = $(this).val();
var cns = $(".paper_toggle_item");
//var ens = $(".nameEN");
$.each($(".paper_list_block"), function(n, value) {
// alert("keyword"+keyword);
PaperListPage.showPaperItem($(value));
if ($(value).text().match(keyword)) {
$(value).removeClass("none");
} else {
$(value).addClass("none");
}
});
for (var i = 0; i < cns.length; i++) {
if ($(cns[i]).text().match(keyword)) {
$(cns[i]).removeClass("none");
} else {
$(cns[i]).addClass("none");
}
}
});
}
/**
* 加载日报
*/
PaperListPage.loadDay = function() {
//alert("1241241");
PaperPage.DateParam.date == null
PaperListPage.REPORTTYPE = 1;
clearHistory();
showLoading();
clearTimeout(PaperListPage.TimeOutID);
PaperListPage.TimeOutID = setTimeout(function() {
showLoadend("PaperListPage");
}, 10000);
$.ui.updatePanel("#paper_list_day_ul", "");
Api.getPaperList("1", "1", "PaperListPage.updateListContentDay");
$(".search-btn").children(".turn-text").text("省版");
$("#daysearchTxt").bind("input propertychange", function() {
$("#paper_list_day_div").scroller().scrollToTop();
var keyword = $(this).val();
// alert(keyword);
var cns = $(".paper_toggle_item");
$.each($(".paper_list_block"), function(n, value) {
// alert("keyword"+keyword);
PaperListPage.showPaperItem($(value));
if ($(value).text().match(keyword)) {
$(value).removeClass("none");
} else {
$(value).addClass("none");
}
});
for (var i = 0; i < cns.length; i++) {
if ($(cns[i]).text().match(keyword)) {
$(cns[i]).removeClass("none");
} else {
$(cns[i]).addClass("none");
}
}
});
}
/**
* 加载实时
*/
PaperListPage.loadReal = function() {
PaperPage.DateParam.date == null
PaperListPage.REPORTTYPE = 1;
clearHistory();
showLoading();
clearTimeout(PaperListPage.TimeOutID);
PaperListPage.TimeOutID = setTimeout(function() {
showLoadend("PaperListPage");
}, 10000);
$.ui.updatePanel("#paper_list_real_ul", "");
Api.getPaperList("3", "2", "PaperListPage.updateListContentReal");
$("#realsearchTxt").bind("input propertychange", function() {
$("#paper_list_real_div").scroller().scrollToTop();
var keyword = $(this).val();
var cns = $(".paper_toggle_item");
//var ens = $(".nameEN");
$.each($(".paper_list_block"), function(n, value) {
// alert("keyword"+keyword);
PaperListPage.showPaperItem($(value));
if ($(value).text().match(keyword)) {
$(value).removeClass("none");
} else {
$(value).addClass("none");
}
});
for (var i = 0; i < cns.length; i++) {
if ($(cns[i]).text().match(keyword)) {
$(cns[i]).removeClass("none");
} else {
$(cns[i]).addClass("none");
}
}
});
}
//日报 切换省版和市版
PaperListPage.turnDayCity = function(el) {
//alert(1);
$("#paper_list_day_ul").html("");
if ($(el).children(".turn-text").text() == "市版") {
$(el).children(".turn-text").text("省版");
//if(ServerInfo.AREACODE=='0010'){
if(ServerInfo.userType=='1'&&ServerInfo.AREACODE=='0010'){
showLoading();
Api.getPaperList("1", "1", "PaperListPage.updateListContentDay");
}else{
$("#paper_list_all_ul").html("");
}
} else {
$(el).children(".turn-text").text("市版");
if(ServerInfo.userType=='1'){
showLoading();
Api.getPaperList("1", "2", "PaperListPage.updateListContentDay");
}else{
$("#paper_list_all_ul").html("");
}
}
}
//实时报表
PaperListPage.turnRealCity = function(el) {
$("#paper_list_real_ul").html("");
if ($(el).children(".turn-text").text() == "市版") {
$(el).children(".turn-text").text("省版");
$("#paper_list_real_ul").html("");
} else {
$(el).children(".turn-text").text("市版");
if(ServerInfo.userType=='1'){
showLoading();
Api.getPaperList("3", "2", "PaperListPage.updateListContentReal");
}else{
$("#paper_list_all_ul").html("");
}
}
}
PaperListPage.turnMonthCity = function(el) {
// $.ui.updatePanel("#paper_list_all_ul", "");
//$("#paper_list_all_ul").html("");
if ($(el).children(".turn-text").text() == "市版") {
$(el).children(".turn-text").text("省版");
// if(ServerInfo.AREACODE=='0010'){
if(ServerInfo.userType=='1'&&ServerInfo.AREACODE=='0010'){
showLoading();
Api.getPaperList(PaperListPage.CURRENTREPORT, "1", "PaperListPage.updateListContentNew");
}else{
$("#paper_list_all_ul").html("");
}
} else {
$(el).children(".turn-text").text("市版");
if(ServerInfo.userType=='1'){
showLoading();
Api.getPaperList(PaperListPage.CURRENTREPORT, "2", "PaperListPage.updateListContentNew");
}else{
$("#paper_list_all_ul").html("");
}
}
}
/**
* 加载最近访问页面
*/
PaperListPage.loadRecently = function() {
clearHistory();
showLoading();
$.ui.updatePanel("#paper_list_recent_ul", "");
Api.getRecentPaperList("PaperListPage.updateRecentListContent");
}
/**
* 加载我的收藏页面
*/
PaperListPage.loadFavorite = function() {
clearHistory();
showLoading();
$.ui.updatePanel("#paper_list_fav_ul", "");
Api.getFavPaperList("1", "1", "PaperListPage.updateFavListContent");
}
/**
* 跳转最近访问
*/
PaperListPage.turnRecently = function() {
$.ui.loadContent("#paper_list_recently", true, true, "none");
}
/**
* 跳转我的收藏
*/
PaperListPage.turnFavorite = function() {
$.ui.loadContent("#paper_list_favorite", true, true, "none");
}
/**
* 跳转报表详情
*/
PaperListPage.turnDetail = function(el) {
// $.ui.updateContentDiv("#paper_detail_iframe", "");
var id = $(el).attr("data-report-id");
var reportType = $(el).attr("data-report-type");
var isFav = $(el).attr("data-isFav");
var title = $(el).attr("data-report-title");
$("#paper_detail").attr("data-reportId", id);
$("#paper_detail").attr("data-reportType", reportType);
$("#paper_detail").attr("data-isFav", isFav);
$(".paper-d-title").text(title);
$.ui.loadContent("#paper_detail", false, false, "none");
// alert("加载滚动条");
}
/**
* 跳转所有报表
*/
PaperListPage.turnAll = function() {
$.ui.loadContent("#paper_list_all",true,true,"none");
PaperListPage.REPORTTYPE = 1;
if(ServerInfo.userType == 1){//领导用户
PaperListPage.REPROTROOTTYPE = 1; //固定报表
//$('#reportTypeRoot').text("固定");
$("#reportTypeRoot1").addClass("on_un").siblings("a").removeClass("on_un");
$('#reportTypeSelected').text("实时");
$(".turn-text").parent().parent().show();
$("#searchTxt").parent().css("width","70%");
$(".turn-text").text("市版");
PaperListPage.loadAll("3","2","1");
}else if (ServerInfo.userType == 0){
PaperListPage.REPROTROOTTYPE = 2; //自定义报表类型
//$('#reportTypeRoot').text("自定义");
$("#reportTypeRoot2").addClass("on_un").siblings("a").removeClass("on_un");
$('#reportTypeSelected').text("日报");
$(".turn-text").parent().parent().hide();
$("#searchTxt").parent().css("width","100%");
PaperListPage.loadAll("4","1","1");
}
}
/**
* 更新列表内容
*/
PaperListPage.updateListContent = function(result) {
//alert(result);
var data = decodeJson(result);
var mychildrn = data.DATA[0].CHILDREN;
if(data.DATA[0].NAME=='自定义报表'){
if (mychildrn == null || mychildrn == '') {
//$("#myPopup").trigger("close");
//alert("未配置自定义报表");
//$("#paper_list_all_div").scroller().scrollToTop();
/*showLoadendErr("PaperListPage","未配置自定义报表");
comfirm("未配置自定义报表");
setTimeout(function() {
$("#myPopup").trigger("close");
}, 3000);
clearTimeout(PaperListPage.TimeOutID);*/
if(Api.isAndroid){
window.wst.show_noReportsDialog("未配置自定义报表");
}else{
sweetAlert("未配置自定义报表");
clearTimeout(PaperListPage.TimeOutID);
}
}
}else if (mychildrn == null || mychildrn == '') {
//$("#myPopup").trigger("close");
//alert("权限不足");
//showLoadend("PaperListPage");
//$("#paper_list_all_div").scroller().scrollToTop();
/*showLoadendErr("PaperListPage","权限不足");
comfirm("权限不足");
setTimeout(function() {
$("#myPopup").trigger("close");
}, 3000);*/
if(Api.isAndroid){
window.wst.show_noReportsDialog("权限不足");
}else{
sweetAlert("权限不足");
clearTimeout(PaperListPage.TimeOutID);
}
}
var listData = {};
// listData.DataBlocks = [];
listData.DataBlocks = data.DATA;
var html = template('paper_list_all_itemtpl', listData);
//$.ui.updatePanel("#paper_list_all_ul", html);
$("#paper_list_all_ul").html(html);
var height = $(window).height() - $("#header").height() - $("#navbar").height() - $('.searchBar').height();
$("#paper_list_all_div").height(height);
$("#paper_list_all_div").scroller().enable();
$(".paper_toggle_item").hide();//隐藏所有2级菜单
// $(TitleUl).find("img").attr("src", "img/main/arrow_d.png");
$.each($(".paper-list-divider"), function(n, value) {
// alert(n+"------>:"+value.innerHTML);
if (n < 1) {
var tmp = $(value);
$(value).find("img").attr("src", "img/main/arrow_d.png");
var b = tmp.parent().children(".paper_toggle_item");
b.css('display', 'block');
}
});
hideLoading();
//取消延迟弹框
$("#myPopup").trigger("close");
clearTimeout(PaperListPage.TimeOutID);
$("#paper_list_all_div").scroller().scrollToTop();
}
PaperListPage.updateListContentNew = function(result) {
var data = decodeJson(result);
var listData = {};
listData.DataBlocks = data.DATA;
var html = template('paper_list_all_itemtpl', listData);
// $.ui.updatePanel("#paper_list_all_ul", html);
$("#paper_list_all_ul").html(html);
var height = $(window).height() - $("#header").height() - $("#navbar").height() - $('.searchBar').height();
$("#paper_list_all_div").height(height);
$("#paper_list_all_div").scroller().enable();
$(".paper_toggle_item").hide();
$.each($(".paper-list-divider"), function(n, value) {
// alert(n+"------>:"+value.innerHTML);
if (n < 1) {
var tmp = $(value);
$(value).find("img").attr("src", "img/main/arrow_d.png");
var b = tmp.parent().children(".paper_toggle_item");
b.css('display', 'block');
}
});
hideLoading();
$("#paper_list_all_div").scroller().scrollToTop();
//取消延迟弹框
$("#myPopup").trigger("close");
clearTimeout(PaperListPage.TimeOutID);
}
PaperListPage.updateListContentDay = function(result) {
// alert(result);
var data = decodeJson(result);
var listData = {};
listData.DataBlocks = data.DATA;
var html = template('paper_list_day_itemtpl', listData);
// alert(html);
$("#paper_list_day_ul").html(html);
var height = $(window).height() - $("#header").height() - $("#navbar").height() - $('.searchBar').height();
$("#paper_list_day_div").height(height);
$("#paper_list_day_div").scroller().enable();
$(".paper_toggle_item").hide();
$.each($(".paper-list-divider"), function(n, value) {
if (value.innerHTML.indexOf("收入用户")>0) {
// if (n < 1) {
var tmp = $(value);
$(value).find("img").attr("src", "img/main/arrow_d.png");
var b = tmp.parent().children(".paper_toggle_item");
b.css('display', 'block');
}
});
hideLoading();
$("#paper_list_day_div").scroller().scrollToTop();
//取消延迟弹框
$("#myPopup").trigger("close");
clearTimeout(PaperListPage.TimeOutID);
}
PaperListPage.updateListContentReal = function(result) {
var data = decodeJson(result);
var listData = {};
listData.DataBlocks = data.DATA;
var html = template('paper_list_real_itemtpl', listData);
// $.ui.updatePanel("#paper_list_all_ul", html);
$("#paper_list_real_ul").html(html);
var height = $(window).height() - $("#header").height() - $("#navbar").height() - $('.searchBar').height();
$("#paper_list_real_div").height(height);
$("#paper_list_real_div").scroller().enable();
$(".paper_toggle_item").hide();
$.each($(".paper-list-divider"), function(n, value) {
// alert(n+"------>:"+value.innerHTML);
if (value.innerHTML.indexOf("实时放号报表")>0) {
var tmp = $(value);
// alert(tmp.innerHTML);
$(value).find("img").attr("src", "img/main/arrow_d.png");
var b = tmp.parent().children(".paper_toggle_item");
b.css('display', 'block');
}
});
hideLoading();
$("#paper_list_real_div").scroller().scrollToTop();
//取消延迟弹框
$("#myPopup").trigger("close");
clearTimeout(PaperListPage.TimeOutID);
}
/**
* 更新我的收藏列表内容
*/
PaperListPage.updateFavListContent = function(result) {
// alert("我的收藏:"+result);
if (result == "null") {
hideLoading();
return;
}
var data = decodeJson(result);
if (data.RESPONSECODE != "200") {
hideLoading();
return;
}
var data = decodeJson(result);
var listData = {};
listData.DataBlocks = data.DATA;
var html = template('paper_list_fav_itemtpl', listData);
$.ui.updatePanel("#paper_list_fav_ul", html);
var height = $(window).height() - $("#header").height() - $("#navbar").height() - $('.searchBar').height();
$("#paper_list_fav_div").height(height);
$("#paper_list_fav_div").scroller().enable();
hideLoading();
}
/**
* 更新列表内容
*/
PaperListPage.updateRecentListContent = function(result) {
if (result == null) {
hideLoading();
return;
}
var data = decodeJson(result);
if (data.RESPONSECODE != "200") {
hideLoading();
return;
}
var listData = {};
listData.DataBlocks = data.DATA;
var html = template('paper_list_recent_itemtpl', listData);
$.ui.updatePanel("#paper_list_recent_ul", html);
var height = $(window).height() - $("#header").height() - $("#navbar").height() - $('.searchBar').height();
// $("#paper_list_recent_div").height(height);
// $("#paper_list_recent_div").scroller().enable();
hideLoading();
}
PaperListPage.togglePaperItem = function(el) {
var block = $(el).parent(".paper_list_block");
var showFlag = block.attr('SHOW');
if (!showFlag) {
PaperListPage.showPaperItem(block);
} else {
PaperListPage.hidePaperItem(block);
}
}
PaperListPage.showPaperItem = function(block) {
block.attr('SHOW', "SHOW");
var ChartDiv = block.children(".paper_toggle_item");
var TitleUl = block.children(".paper-list-divider");
$(TitleUl).find("img").attr("src", "img/main/arrow_d.png");
ChartDiv.css('display', 'block');
var top =TitleUl.offset().top;
if(top > 400){
document.getElementById('paper_list_all_div').scrollTop =100;
}
}
PaperListPage.hidePaperItem = function(block) {
block.removeAttr('SHOW');
var ChartDiv = block.children(".paper_toggle_item");
var TitleUl = block.children(".paper-list-divider");
$(TitleUl).find("img").attr("src", "img/main/arrow_r.png");
ChartDiv.css('display', 'none');
// var top =TitleUl.offset().top;
// $("#paper_list_all_div").css("top",top);
// document.getElementById('paper_list_all_div').scrollTop = top-25;
$("#paper_list_fav_div").scroller().enable();
}
var PaperPage = {}
//数据参数 -- 日期
PaperPage.DateParam = {
date : null,
//检查初始化
checkInit : function() {
if (this.date == null) {
this.date = new Date();
var dateStr = getLastMonth(this.date) + '-1'
this.date = dateStr.toDate();
}
$("#paper_detail_header .date_text").text(this.date.Format("yyyy-MM"));
},
setDate:function(result){
//alert("返回日期:"+result);
if(result.indexOf('null')>-1){
var d = new Date();
var vYear = d.getFullYear();
var vMon = d.getMonth()+1;
var vDay = d.getDate();
if (PaperListPage.REPORTTYPE == 1){
var vDayStr = (vDay-1)+"";
if(vDayStr=="0"){
var vMonStr = (vMon-1)+"";
if(vMonStr=="0"){
vYear=vYear-1;
result = vYear+"-12-31";
}else{
if(vMonStr=="2"||vMonStr=="4"||vMonStr=="6"||vMonStr=="7"||vMonStr=="9"){
result = vYear+"-"+ ((vMon-1) < 10 ? "0" + (vMon-1) : (vMon-1)) +"-31";
}else if(vMonStr=="3"||vMonStr=="5"||vMonStr=="8"||vMonStr=="10"){
result = vYear+"-"+ ((vMon-1) < 10 ? "0" + (vMon-1) : (vMon-1)) +"-30";
}else{
result = vYear+"-"+ ((vMon-1) < 10 ? "0" + (vMon-1) : (vMon-1)) +"-28";
}
}
}else{
vDay = vDay -1;
result = vYear+"-"+ (vMon < 10 ? "0" + vMon : vMon)+"-" + (vDay < 10 ? "0" + vDay : vDay);
}
} else if(PaperListPage.REPORTTYPE == 2){
vMon-1==0
result = (vMon-1==0?vYear-1:vYear) + "-" + (vMon-1==0?"12": (vMon-1<10?"0" + vMon : vMon));
//alert(result);
this.date = new Date(result);
}
}
if (this.date == null) {
this.date = new Date(result);
}
var dateStr = null;
if (PaperListPage.REPORTTYPE == 1){
dateStr = PaperPage.DateParam.date.Format("yyyy-MM-dd");
} else if(PaperListPage.REPORTTYPE == 2){
dateStr = PaperPage.DateParam.date.Format("yyyy-MM");
}
$("#paper_detail_header .date_text").text(dateStr);
//开始加载数据并显示
PaperPage.loadPage();
},
//调用日历控件
change : function() {
//alert(PaperListPage.REPORTTYPE);
//alert("现在时间PaperPage.DateParam:"+this.date);
if (PaperListPage.REPORTTYPE == 1){
Api.showCalendar(this.date, "PaperPage.DateParam.update");
} else if(PaperListPage.REPORTTYPE == 2){
Api.showCalendar(this.date, "PaperPage.DateParam.update", true);
}
},
//回调更新
update : function(dateStr) {
//回调,注意this为空
//alert("返回的日期1:"+dateStr);
var prev = null;
if (PaperListPage.REPORTTYPE == 1){
prev = PaperPage.DateParam.date.Format("yyyy-MM-dd");
} else if(PaperListPage.REPORTTYPE == 2){
prev = PaperPage.DateParam.date.Format("yyyy-MM");
}
// var prev = PaperPage.DateParam.date.Format("yyyy-MM");
if (prev == dateStr) {
return;
}
dateStr = new Date(dateStr);
// alert("返回的日期2:"+dateStr);
PaperPage.DateParam.date = dateStr;
// alert("返回的日期3:"+PaperPage.DateParam.date);
if (PaperListPage.REPORTTYPE == 1){
dateStr = PaperPage.DateParam.date.Format("yyyy-MM-dd");
} else if(PaperListPage.REPORTTYPE == 2){
dateStr = PaperPage.DateParam.date.Format("yyyy-MM");
}
$("#paper_detail_header .date_text").text(dateStr);
PaperPage.reload();
}
}
/**
* 初始化将报表iframe增加到最大,详情数据
*/
PaperPage.loadPage = function() {
showLoading();
//PaperListPage.TimeOutID =
//setTimeout(function() {
// hideLoading();
//}, 3000);
var id = $("#paper_detail").attr("data-reportId");
var isFav = $("#paper_detail").attr("data-isFav");
if (isFav == "1") {
$("#paper_detail_header .img_fav").attr("src","img/paper/bb_fav.png");
} else{
$("#paper_detail_header .img_fav").attr("src","img/paper/bb_fav_a.png");
}
Api.addRecent(id,"doNothing");
var reportType = $("#paper_detail").attr("data-reportType");
// PaperPage.DateParam.checkInit();
var reportidsList = "["+id+"]";
PaperPage.DateParam.date == null;
if(PaperPage.DateParam.date == null){
Api.getCanSelectDate(reportidsList,PaperListPage.REPORTTYPE,0,"PaperPage.DateParam.setDate");
return
}
PaperPage.FavParam.checkInit();
//格式化请求时间
var dateStr = null;
if (PaperListPage.REPORTTYPE == 1){
dateStr = PaperPage.DateParam.date.Format("yyyy-MM-dd");
} else if(PaperListPage.REPORTTYPE == 2){
dateStr = PaperPage.DateParam.date.Format("yyyy-MM");
}
// alert("111");
if(Api.isAndroid){
// reportType = 1;
// alert("报表类型:"+reportType+",报表ID :"+id);
// alert(reportType);
Api.getReportHTML(id,reportType,1,dateStr,"useIframeFunc2");
// Api.getReportHTML(id,reportType,1,dateStr,"useIframeFunc");
}else{
var contentWidth = window.screen.width - $("#header").height() - $("#navbar").height();
var contentHeight = window.screen.height - $("#header").height() - $("#navbar").height() - 49;
// alert("宽:"+contentWidth+",高:"+contentHeight)
// $("#paper_detail_iframe").attr("src", "iframe/singletable.html");
// Api.getReportHTML(id,reportType,1,dateStr,"reportResult"); //监测报表是否有数据
//IOS判断同一个报表是否存在数据
//如果同一个报表什么也不做。报表ID变化之后重置递减的次数,并记录当前指标
// alert("上一个报表ID:"+PaperListPage.lastReportId+",当前报表ID:"+id+",减数次数:"+monthDown);
// if( id == PaperListPage.lastReportId){
// // isSameReport = true;
// // alert("887978-----------:"+monthDown);
// }else{
// monthDown = 1;
// PaperListPage.lastReportId = id;
// }
// ServerInfo.URL=ServerInfo.URL.substr(0,ServerInfo.URL.length-1);
// alert(ServerInfo.URL);
// var url = ServerInfo.URL+"gducdc/phone.html;jsessionid="+ServerInfo.JSESSIONID+"?action=getData&REPORTID="+id+"&PID=-1&ISHTML=1&DATE="+dateStr+"&TOKEN="+ServerInfo.TOKEN+"&MOBILE="+ServerInfo.MOBILE+"&DIGFLAG=0&ISINDEX=1&MUTILDATE=true&REPORTTYPE="+reportType+"&width="+contentWidth+"&height="+contentHeight;
var url = ServerInfo.URL+"gducdc/phone.html;jsessionid="+ServerInfo.JSESSIONID+"?action=getData&REPORTID="+id+"&PID=-1&ISHTML=1&DATE="+dateStr+"&TOKEN="+ServerInfo.TOKEN+"&MOBILE="+ServerInfo.MOBILE+"&DIGFLAG=0&MUTILDATE=true&REPORTTYPE="+reportType+"&width="+contentWidth+"&height="+contentHeight;
///alert(url);
$("#paper_detail_iframe").attr("src", url);
$('#paper_detail_iframe').load(function(){
hideLoading();
});
}
PaperPage.updateFrameSize();
$(window).bind('resize', PaperPage.updateFrameSize);
//
}
PaperPage.reload = function() {
PaperPage.loadPage();
showLoading();
setTimeout(function() {
hideLoading();
}, 2000);
}
PaperPage.unloadPage = function() {
// $("#paper_detail_iframe").attr("src", "");
PaperPage.DateParam.date = null;
}
PaperPage.updateFrameSize = function() {
// alert("111");
//获得高度
var height = IndexPage.getContentAreaHeight();
//高度赋值
var frame = $("#paper_detail_iframe");
frame.height(height);
}
PaperPage.FavParam = {
status : null,
//检查初始化
checkInit : function() {
var isFav = $("#paper_detail").attr("data-isFav");
if (isFav == "1") {
PaperPage.FavParam.status = 1;
} else{
PaperPage.FavParam.status = 0;
}
},
//调用改变状态
change : function() {
var reportId = $("#paper_detail").attr("data-reportId");
Api.updateFavStatus(reportId, "PaperPage.FavParam.update");
// alert(document.getElementById("paper_detail").innerHTML);
},
//回调更新
update : function(dateStr) {
//回调,注意this为空
dateStr = decodeJson(dateStr);
$("#afui").popup({
title : "提示",
message : dateStr.MESSAGE,
cancelText : "确定",
cancelCallback: function(){
$.ui.unblockUI();
},
cancelOnly : true
});
if (PaperPage.FavParam.status == 1) {
PaperPage.FavParam.status = 0;
$("#paper_detail").attr("data-isFav","0");
$("#paper_detail_header .img_fav").attr("src","img/paper/bb_fav_a.png");
} else {
PaperPage.FavParam.status = 1;
$("#paper_detail").attr("data-isFav","1");
$("#paper_detail_header .img_fav").attr("src","img/paper/bb_fav.png");
}
}
}
//弹出报表名称和报表时间
PaperPage.showTitleDetail = function (el) {
// //alert($(el).children(".paper-d-title").text())
// //alert($(el).children(".date_text").text())
$.ui.actionsheet('<p>报表名称:' + $(el).children(".paper-d-title").text() + '</p><p>统计时段:' + $(el).children(".date_text").text() + '</p>');
}
function chooseReportType(type) {
if(type == 3){
$('#reportTypeSelected').text("月报");
document.getElementById("mor").style.display="none";
// var f = "http://localapp/mdcApp/index.html#paper_list_all";
$.ui.loadContent("#paper_list_all",true,true,"none");
// PaperListPage.loadAll();
if(PaperListPage.REPROTROOTTYPE == 1){
PaperListPage.CURRENTREPORT = 2;
}
else if(PaperListPage.REPROTROOTTYPE == 2){
PaperListPage.CURRENTREPORT = 5;
}
if(ServerInfo.userType=='1'){
if(ServerInfo.AREACODE=='0010'){
PaperListPage.loadAll(PaperListPage.CURRENTREPORT,"1","2");
$(".turn-text").text("省版");
}else
{
PaperListPage.loadAll(PaperListPage.CURRENTREPORT,"2","2");
$(".turn-text").text("市版");
}
}else{
if(PaperListPage.REPROTROOTTYPE==2){
if(Api.isAndroid){
window.wst.show_noReportsDialog("未配置自定义报表");
}else{
sweetAlert("未配置自定义报表");
clearTimeout(PaperListPage.TimeOutID);
}
}else{
if(Api.isAndroid){
window.wst.show_noReportsDialog("权限不足");
}else{
sweetAlert("权限不足");
clearTimeout(PaperListPage.TimeOutID);
}
}
$("#paper_list_all_ul").html("");
}
PaperListPage.REPORTTYPE = 2;
}else if(type == 2){
$('#reportTypeSelected').text("日报");
document.getElementById("mor").style.display="none";
if(PaperListPage.REPROTROOTTYPE == 1){
PaperListPage.CURRENTREPORT = 1;
}else if(PaperListPage.REPROTROOTTYPE == 2){
PaperListPage.CURRENTREPORT = 4;
}
// var f = "http://localapp/mdcApp/index.html#paper_list_day";
$.ui.loadContent("#paper_list_all",true,true,"none");
PaperListPage.REPORTTYPE = 1;
// PaperListPage.loadDay();
if(ServerInfo.userType=='1'){
if(ServerInfo.AREACODE=='0010'){
PaperListPage.loadAll(PaperListPage.CURRENTREPORT,"1","1");
$(".turn-text").text("省版");
}else
{
PaperListPage.loadAll(PaperListPage.CURRENTREPORT,"2","1");
$(".turn-text").text("市版");
}
}else{
if(PaperListPage.REPROTROOTTYPE==2){
if(Api.isAndroid){
window.wst.show_noReportsDialog("未配置自定义报表");
}else{
sweetAlert("未配置自定义报表");
clearTimeout(PaperListPage.TimeOutID);
}
}else{
if(Api.isAndroid){
window.wst.show_noReportsDialog("权限不足");
}else{
sweetAlert("权限不足");
clearTimeout(PaperListPage.TimeOutID);
}
}
$("#paper_list_all_ul").html("");
}
}else if(type == 1){
$('#reportTypeSelected').text("实时");
document.getElementById("mor").style.display="none";
// var f = "http://localapp/mdcApp/index.html#paper_list_real";
if(PaperListPage.REPROTROOTTYPE == 1){
PaperListPage.CURRENTREPORT = 3;
}else if(PaperListPage.REPROTROOTTYPE == 2){
PaperListPage.CURRENTREPORT = 6;
}
$.ui.loadContent("#paper_list_all",true,true,"none");
PaperListPage.REPORTTYPE = 1;
// PaperListPage.loadReal();
if(ServerInfo.userType=='1'){
PaperListPage.loadAll(PaperListPage.CURRENTREPORT,"2","1");
$(".turn-text").text("市版");
}else{
if(PaperListPage.REPROTROOTTYPE==2){
if(Api.isAndroid){
window.wst.show_noReportsDialog("未配置自定义报表");
}else{
sweetAlert("未配置自定义报表");
clearTimeout(PaperListPage.TimeOutID);
}
}else{
if(Api.isAndroid){
window.wst.show_noReportsDialog("权限不足");
}else{
sweetAlert("权限不足");
clearTimeout(PaperListPage.TimeOutID);
}
}
$("#paper_list_all_ul").html("");
}
}
}
function chooseReport(type) {
if(type == 1){
PaperListPage.REPROTROOTTYPE = 1; //固定报表类型
if(ServerInfo.userType=='1'){
$('#reportTypeSelected').text("实时");
$(".turn-text").text("市版");
// var f = "http://localapp/mdcApp/index.html#paper_list_all";
$.ui.loadContent("#paper_list_all",true,true,"none");
PaperListPage.loadAll("3","2","1");
PaperListPage.REPORTTYPE = 1;
$(".turn-text").parent().parent().show();
$("#searchTxt").parent().css("width","77%");
}else{
if(Api.isAndroid){
window.wst.show_noReportsDialog("权限不足");
}else{
sweetAlert("权限不足");
clearTimeout(PaperListPage.TimeOutID);
}
$("#paper_list_all_ul").html("");
}
}else if(type == 2){
$('#reportTypeSelected').text("日报");
// var f = "http://localapp/mdcApp/index.html#paper_list_day";
$.ui.loadContent("#paper_list_all",true,true,"none");
PaperListPage.REPORTTYPE = 1;
PaperListPage.loadAll("4","1","1");
PaperListPage.REPROTROOTTYPE = 2; //自定义报表类型
$(".turn-text").parent().parent().hide();
$("#searchTxt").parent().css("width","100%");
}
}
调用方式
首先引入paper.js
然后在当前js文件中使用
if(page == "PaperListPage"){ //报表列表
PaperListPage.loadAll();
}