查询条件包含:开始日期,结束日期等等
var stat_date = this.options.form.getWidgetByName("p_stat_date").getValue();
var end_date = this.options.form.getWidgetByName("p_end_date").getValue();
var tcname = this.options.form.getWidgetByName("p_tcname").getValue();
var rsname = this.options.form.getWidgetByName("p_rsname").getValue();
var orgname = this.options.form.getWidgetByName("p_orgname").getValue();
var type = this.options.form.getWidgetByName("p_type").getValue();
var source = this.options.form.getWidgetByName("p_source").getValue();
var startD = new Date(Date.parse(stat_date.replace(/-/g,"/")));
var endD = new Date(Date.parse(end_date.replace(/-/g,"/")));
var days = parseInt((endD.getTime()-startD.getTime()) / (1000 * 60 * 60 * 24));
if (days>31){
if(tcname!='' || rsname!='' || orgname!='' || type!='' || source!=''){
_g().parameterCommit();
}
else {
alert("查询时间超过一个月的必须要包含其他条件!");
return false;
}
}
else{
_g().parameterCommit();
}
简要如下:
var stat_date = this.options.form.getWidgetByName("p_date1").getValue();
var end_date = this.options.form.getWidgetByName("p_date2").getValue();
var startD = new Date(Date.parse(stat_date.replace(/-/g,"/")));
var endD = new Date(Date.parse(end_date.replace(/-/g,"/")));
var days = parseInt((endD.getTime()-startD.getTime()) / (1000 * 60 * 60 * 24));
if (days>31){
alert("查询时间不能超过1个月!");
return false;
}
else{
_g().parameterCommit();
}