100 lines
2.2 KiB
JavaScript
100 lines
2.2 KiB
JavaScript
var dataservice = {
|
|
//wsn 选择数据
|
|
choiceData : function(uuid)
|
|
{
|
|
this.uuid = uuid;
|
|
|
|
$.ajax({
|
|
'type':"POST",
|
|
'url':'/data/dataservice',
|
|
'data':'uuid=' + this.uuid,
|
|
'success':function(data){
|
|
if(typeof(data) == 'undefined')
|
|
{
|
|
alert("数据源错误,请联系管理员");
|
|
return false;
|
|
}
|
|
|
|
if(!$.isEmptyObject(data.error))
|
|
{
|
|
alert(data.error);
|
|
return false;
|
|
}
|
|
|
|
if(data.type == "wsn")
|
|
{
|
|
html = dataservice.wsn.dialog.site(data);
|
|
methods.creatWindow(id,html);
|
|
}
|
|
|
|
},
|
|
'timeout': 30000,
|
|
'error': function(){
|
|
alert('出现错误,请刷新后重试');
|
|
}
|
|
});
|
|
|
|
},
|
|
creatWindow : function(html){
|
|
$.colorbox({
|
|
initialHeight: '0',
|
|
initialWidth: '0',
|
|
html: html,
|
|
opacity: '0.3',
|
|
onComplete: function(){
|
|
$('.confirm_yes').click(function(e){
|
|
e.preventDefault();
|
|
});
|
|
$('.confirm_no').click(function(e){
|
|
e.preventDefault();
|
|
$.colorbox.close();
|
|
});
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
dataservice.wsn = {
|
|
request : function()
|
|
{
|
|
$.ajax({
|
|
'type':"POST",
|
|
'url':'/data/wsn/',
|
|
'data':$('#wsn-form').serialize(),
|
|
'success':function(data){
|
|
if (typeof(data)=='object')
|
|
{
|
|
if(typeof(data.error)!='undefined')
|
|
{alert(data.error);}
|
|
if(typeof(data.success)!='undefined')
|
|
{
|
|
window.location.reload();
|
|
}
|
|
}
|
|
else{
|
|
alert('出现错误,请稍候再试');
|
|
}
|
|
},
|
|
'timeout': 30000,
|
|
'error': function(){
|
|
alert('出现错误,请刷新后重试');
|
|
}
|
|
});
|
|
},
|
|
dialog : {
|
|
site : function(data){
|
|
|
|
this.HTML = '<div class=""><div class="modal-header"><h3>选择观测点</h3></div>'
|
|
+ '<div class="modal-body"><form id="wsn-form">'
|
|
+ '<div></div>'
|
|
+ '<input type="hidden" name="uuid" value="'+data.uuid+'" />'
|
|
+ '</form></div>'
|
|
+ '<div class="modal-footer"><a href="javascript:void(0);" class="btn btn-primary confirm_yes" onclick=' + data.callback + '>下一步</a>'
|
|
+ '<a href="javascript:void(0);" class="btn confirm_no">取消</a></div></div>';
|
|
return this.HTML;
|
|
},
|
|
var : function(data){
|
|
|
|
}
|
|
}
|
|
} |