var typeJson = [{"key":"台风","value":"台风"},
{"key":"地震","value":"地震"},
{"key":"冰灾","value":"冰灾"},
{"key":"降水","value":"降水"},
{"key":"山火","value":"山火"},
{"key":"其他","value":"其他"}];
/***新增事件***/
function save(){
$form = $('#editForm');
var valid = $form.validationEngine({returnIsValid: true});
if(!valid){
top.Dialog.alert(CHECKREDBOX);
return;
}
getEventName();
if(valid){
showProgressBar("正在提交中...");
var url = $.pathname() + '/ws/crud/CRUDService/create/';
if(fd_id && fd_id!="null" && fd_id.length>0){//修改
url = $.pathname() + '/ws/crud/CRUDService/update/';
}
var formValue = $form.serialize();
$.ajax({
url : url,
type : 'post',
data : formValue,
dataType : 'json',
async: false,
success : function(data){
}
});
}
};
function getServerTime(){
var nowTime = "";
$.ajax({//后台获取系统当前时间
url : $.pathname()+ '/ws/response/responseService/getNowTime',
type : 'post',
dataType : 'text',
async : false,
success : function(result){
nowTime=result;
},error : function(e){
top.Dialog.alert("获取后台时间失败!");
return nowTime;
}
});
return nowTime;
}
/******
选择事件类型
*******/
function changeEventType(){
var selectType = $("#EVENT_TYPE_363").attr("relvalue");
var table = $("#this_table");
var allTr = $("#this_table>tr:gt(0)");
allTr.remove();
if(selectType=="台风"){
//事件日期
var tr1 = $("
");
table.append(tr1);
tr1.append("*事件日期: | ");
var td1 = $(" | ");
tr1.append(td1);
var input1 = $("");
input1.render();
td1.append(input1);
//台风编号
var tr2 = $("
");
table.append(tr2);
tr2.append("*台风编号: | ");
var td2 = $(" | ");
tr2.append(td2);
var input2 = $("");
input2.render();
td2.append(input2);
//台风名称
var tr3 = $("
");
table.append(tr3);
tr3.append("*台风名称: | ");
var td3 = $(" | ");
tr3.append(td3);
var input3 = $("");
input3.render();
td3.append(input3);
}else if(selectType=="地震"){
//事件日期
var tr1 = $("
");
table.append(tr1);
tr1.append("*事件日期: | ");
var td1 = $(" | ");
tr1.append(td1);
var input1 = $("");
input1.render();
td1.append(input1);
//震级
var tr2 = $("
");
table.append(tr2);
tr2.append("*震级: | ");
var td2 = $(" | ");
tr2.append(td2);
var input2 = $("");
input2.render();
td2.append(input2);
//地震位置
var tr3 = $("
");
table.append(tr3);
tr3.append("*地震位置: | ");
var td3 = $(" | ");
tr3.append(td3);
var input3 = $("");
input3.render();
td3.append(input3);
}else if(selectType=="冰灾"){
//事件日期
var tr1 = $("
");
table.append(tr1);
tr1.append("*事件日期: | ");
var td1 = $(" | ");
tr1.append(td1);
var input1 = $("");
input1.render();
td1.append(input1);
//名称
var tr3 = $("
");
table.append(tr3);
tr3.append("*名称: | ");
var td3 = $(" | ");
tr3.append(td3);
var input3 = $("");
input3.render();
td3.append(input3);
}else if(selectType=="降水"){
//事件日期
var tr1 = $("
");
table.append(tr1);
tr1.append("*事件日期: | ");
var td1 = $(" | ");
tr1.append(td1);
var input1 = $("");
input1.render();
td1.append(input1);
//名称
var tr3 = $("
");
table.append(tr3);
tr3.append("*名称: | ");
var td3 = $(" | ");
tr3.append(td3);
var input3 = $("");
input3.render();
td3.append(input3);
}else if(selectType=="其他"){
//事件日期
var tr1 = $("
");
table.append(tr1);
tr1.append("*事件日期: | ");
var td1 = $(" | ");
tr1.append(td1);
var input1 = $("");
input1.render();
td1.append(input1);
//名称
var tr3 = $("
");
table.append(tr3);
tr3.append("*名称: | ");
var td3 = $(" | ");
tr3.append(td3);
var input3 = $("");
input3.render();
td3.append(input3);
}
}
/***
* 获取事件名称,拼接
* 赋值
*/
function getEventName(){
var selectType = $("#EVENT_TYPE_363").attr("relvalue");
var name = "";
if(selectType=="台风"){
name = $("#EVENT_DATE_363").val()+"_"+$("#EVENT_NUM_363").val()+selectType+$("#EVENT_PLACE_363").val();
}else if(selectType=="地震"){
name = $("#EVENT_DATE_363").val()+"_"+$("#EVENT_PLACE_363").val()+$("#EVENT_NUM_363").val()+selectType;
}else{
name = $("#EVENT_DATE_363").val()+"_"+$("#EVENT_PLACE_363").val();
}
$("#EVENT_NAME_363").val(name);
}