修复:1. 切换报表类型后默认时间消失

2. 部分页面时间输入框消失
This commit is contained in:
chenjinsong
2018-07-12 15:28:46 +08:00
parent 91799c01f9
commit af3171b17b
2 changed files with 10 additions and 11 deletions

View File

@@ -343,6 +343,9 @@ public class BaseController {
if (StringUtils.isBlank(report.getReportTime())) { if (StringUtils.isBlank(report.getReportTime())) {
report.setReportTime(DateUtils.formatDate(new Date(), "yyyy-MM-dd")); report.setReportTime(DateUtils.formatDate(new Date(), "yyyy-MM-dd"));
} }
if (report.getReportType() == null) {
report.setReportType(1);
}
} }
protected void initFormCondition(Model model){ protected void initFormCondition(Model model){
List<RequestInfo> requestInfos=requestInfoService.getValidRequestInfo(); List<RequestInfo> requestInfos=requestInfoService.getValidRequestInfo();

View File

@@ -8,9 +8,9 @@
//筛选功能初始化 //筛选功能初始化
filterActionInit(); filterActionInit();
//日期类型初始化 //日期类型初始化
changeReportType("${bean.reportType}", true); changeReportType("${bean.reportType}");
$("#reportType").change(function(){ $("#reportType").change(function(){
changeReportType($("#reportType", false).val()); changeReportType($("#reportType").val());
}); });
//reset //reset
$("#resetBtn").on("click",function(){ $("#resetBtn").on("click",function(){
@@ -89,29 +89,25 @@
}); });
}); });
function changeReportType(reportType, init) { function changeReportType(reportType) {
$("#intype").remove(); $("#intype").remove();
var reportTime = ""; var reportTime = "${bean.reportTime }";
if (init) {
reportTime = "${bean.reportTime }";
}
if(reportType == 1){//需删除元素后重新添加直接更改onclick会出现缓存问题 if(reportType == 1){//需删除元素后重新添加直接更改onclick会出现缓存问题
$("#reportTypeDiv").append('<input id="intype" name="reportTime" class="form-control input-medium Wdate" type="text" value="' + reportTime + '" readonly="readonly" onclick=WdatePicker({dateFmt:"yyyy-MM-dd",isShowClear:true});>'); $("#reportTypeDiv").append('<input id="intype" name="reportTime" class="form-control input-medium Wdate" type="text" value="' + reportTime + '" readonly="readonly" onclick=WdatePicker({dateFmt:"yyyy-MM-dd",isShowClear:true});>');
} else if(reportType == 2){ } else if(reportType == 2){
$("#reportTypeDiv").append('<input id="intype" name="reportTime" class="form-control input-medium Wdate" type="text" value="' + reportTime + '" readonly="readonly" onclick=WdatePicker({dateFmt:"yyyy-MM",isShowClear:true});>'); $("#reportTypeDiv").append('<input id="intype" name="reportTime" class="form-control input-medium Wdate" type="text" value="' + reportTime.substring(0, 7) + '" readonly="readonly" onclick=WdatePicker({dateFmt:"yyyy-MM",isShowClear:true});>');
} else if(reportType == 3){ } else if(reportType == 3){
$("#reportTypeDiv").append('<input id="intype" name="reportTime" class="form-control input-medium Wdate" type="text" value="' + reportTime + '" readonly="readonly" onclick=WdatePicker({dateFmt:"yyyy",isShowClear:true});>'); $("#reportTypeDiv").append('<input id="intype" name="reportTime" class="form-control input-medium Wdate" type="text" value="' + reportTime.substring(0, 4) + '" readonly="readonly" onclick=WdatePicker({dateFmt:"yyyy",isShowClear:true});>');
} }
} }
var ajaxReport=function(url,target){ var ajaxReport=function(url,target){
var random=new Date().getTime();
loading('<spring:message code="onloading"/>'); loading('<spring:message code="onloading"/>');
$.ajax({ $.ajax({
type:'post', type:'post',
async:false, async:false,
cache:false, cache:false,
url:'${ctx}'+url+"?random="+random,///report/ajaxNtcTagReport url:'${ctx}'+url,// /report/ajaxNtcTagReport
data:{ data:{
"action":$('[name="action"]').val(), "action":$('[name="action"]').val(),
"reportType":$('[name="reportType"]').val(), "reportType":$('[name="reportType"]').val(),