为wsn数据选择时间范围的添加了如果是多个点的话可以设置所有变量的时间

This commit is contained in:
Li Jianxuan 2014-01-03 06:19:04 +00:00
parent e2f2b2ae71
commit a6efab68c9
1 changed files with 56 additions and 9 deletions

View File

@ -168,6 +168,8 @@ westdc.dataservice.wsn = {
this.selects = "";
this.uls = new Array();
this.count = 0;
this.first = 0;
for(i in data.data)
{
this.input = new Array();
@ -185,12 +187,32 @@ westdc.dataservice.wsn = {
+ '<input class="wsnctl-timeend" type="text" name="site['+i+'][endtime]" value="' + data.data[i].endtime + '" />'
+ '</div>';
this.uls.push('<div class="wsnctl" rel="'+i+'" style="float:left"><h4>观测点:'+data.data[i].name+'</h4>可下载的变量: '+ this.input.join("") + this.timemap + '<hr /></div>');
this.count++;
if(this.count == 1)
{
this.first = i;
}
}
this.selects = this.uls.join("");
if(this.count > 1)
{
this.allcontrol = '<div class="wsnctl">'
+ '<div class="wsnctl-time"><div>为所有数据选择时间范围(如果某些数据的时间超出范围请单独再次修改):</div> '
+ '<input class="wsnctl-all-timestart" type="text" value="' + data.data[this.first].starttime + '" /> - '
+ '<input class="wsnctl-all-timeend" type="text" value="' + data.data[this.first].endtime + '" />'
+ '</div></div><hr />';
}else{
this.allcontrol = "";
}
this.HTML = '<div class=""><div class="modal-header"><h3>'+data.info.service_title+'</h3></div>'
+ '<div class="modal-body"><form id="dataservice-wsn-form">'
+ '<div class="modal-body">'
+ this.allcontrol
+ '<form id="dataservice-wsn-form">'
+ '<div>'
+ this.selects
+ '</div>'
@ -209,14 +231,17 @@ westdc.dataservice.wsn = {
siteid = $(this).attr('rel');
timestart = $(this).children('.wsnctl-time').children('.wsnctl-timestart');
timeend = $(this).children('.wsnctl-time').children('.wsnctl-timeend');
year_start=(timestart).val().substr(0,4);
month_start=parseInt((timestart).val().substr(5,2))-1;
day_start=parseInt((timestart).val().substr(8,2));
year_end=(timeend.val()).substr(0,4);
month_end=parseInt((timeend.val()).substr(5,2))-1;
day_end=parseInt((timeend.val()).substr(8,2))
timestart.datepicker({ minDate: new Date(year_start, month_start, day_start), maxDate: new Date(year_end, month_end, day_end) });
timeend.datepicker({ minDate: new Date(year_start, month_start, day_start), maxDate: new Date(year_end, month_end, day_end) });
if(timestart.length && timeend.length)
{
year_start=(timestart).val().substr(0,4);
month_start=parseInt((timestart).val().substr(5,2))-1;
day_start=parseInt((timestart).val().substr(8,2));
year_end=(timeend.val()).substr(0,4);
month_end=parseInt((timeend.val()).substr(5,2))-1;
day_end=parseInt((timeend.val()).substr(8,2));
timestart.datepicker({ minDate: new Date(year_start, month_start, day_start), maxDate: new Date(year_end, month_end, day_end) });
timeend.datepicker({ minDate: new Date(year_start, month_start, day_start), maxDate: new Date(year_end, month_end, day_end) });
}
$(this).find('.wsnctl-select-all').click(function(e) {
if($(this).attr('checked') == 'checked')
{
@ -225,6 +250,28 @@ westdc.dataservice.wsn = {
$(this).parent('label').parent('div').find('.wsnctl-select').removeAttr('disabled');
}
});
alltimestart = $(this).children('.wsnctl-time').children('.wsnctl-all-timestart');
alltimeend = $(this).children('.wsnctl-time').children('.wsnctl-all-timeend');
if(alltimestart.length)
{
alltimestart.datepicker({});
alltimestart.change(function(e) {
val = $(this).val();
$('.wsnctl').each(function(index, element) {
$(this).children('.wsnctl-time').children('.wsnctl-timestart').val(val);
});
});
}
if(alltimeend.length)
{
alltimeend.datepicker({});
alltimeend.change(function(e) {
val = $(this).val();
$('.wsnctl').each(function(index, element) {
$(this).children('.wsnctl-time').children('.wsnctl-timeend').val(val);
});
});
}
});
}
}