123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211 |
-
-
- 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 = $("<tr></tr>");
- table.append(tr1);
- tr1.append("<td align='right'><div ><span class='star'>*</span>事件日期:</div></td>");
- var td1 = $("<td align='left'></td>");
- tr1.append(td1);
- var input1 = $("<input type='text' class='validate[required] date' dateFmt='yyyy-MM' id='EVENT_DATE_363' name='EVENT_DATE_363'/>");
- input1.render();
- td1.append(input1);
-
- //台风编号
- var tr2 = $("<tr></tr>");
- table.append(tr2);
- tr2.append("<td align='right'><div ><span class='star'>*</span>台风编号:</div></td>");
- var td2 = $("<td align='left'></td>");
- tr2.append(td2);
- var input2 = $("<input type='text' class='validate[required,custom[onlyNumber]]' id='EVENT_NUM_363' inputMode='numberOnly' name='EVENT_NUM_363' maxLength='10'/>");
- input2.render();
- td2.append(input2);
-
- //台风名称
- var tr3 = $("<tr></tr>");
- table.append(tr3);
- tr3.append("<td align='right'><div ><span class='star'>*</span>台风名称:</div></td>");
- var td3 = $("<td align='left'></td>");
- tr3.append(td3);
- var input3 = $("<input type='text' id='EVENT_PLACE_363' class='validate[required]' name='EVENT_PLACE_363' maxLength='20'/>");
- input3.render();
- td3.append(input3);
- }else if(selectType=="地震"){
-
- //事件日期
- var tr1 = $("<tr></tr>");
- table.append(tr1);
- tr1.append("<td align='right'><div ><span class='star'>*</span>事件日期:</div></td>");
- var td1 = $("<td align='left'></td>");
- tr1.append(td1);
- var input1 = $("<input type='text' class='validate[required] date' dateFmt='yyyy-MM-dd' id='EVENT_DATE_363' name='EVENT_DATE_363'/>");
- input1.render();
- td1.append(input1);
-
- //震级
- var tr2 = $("<tr></tr>");
- table.append(tr2);
- tr2.append("<td align='right'><div ><span class='star'>*</span>震级:</div></td>");
- var td2 = $("<td align='left'></td>");
- tr2.append(td2);
- var input2 = $("<input type='text' id='EVENT_NUM_363' class='validate[required]' name='EVENT_NUM_363' maxLength='10'/>");
- input2.render();
- td2.append(input2);
-
- //地震位置
- var tr3 = $("<tr></tr>");
- table.append(tr3);
- tr3.append("<td align='right'><div ><span class='star'>*</span>地震位置:</div></td>");
- var td3 = $("<td align='left'></td>");
- tr3.append(td3);
- var input3 = $("<input type='text' id='EVENT_PLACE_363' class='validate[required]' name='EVENT_PLACE_363' maxLength='20'/>");
- input3.render();
- td3.append(input3);
- }else if(selectType=="冰灾"){
-
-
- //事件日期
- var tr1 = $("<tr></tr>");
- table.append(tr1);
- tr1.append("<td align='right'><div ><span class='star'>*</span>事件日期:</div></td>");
- var td1 = $("<td align='left'></td>");
- tr1.append(td1);
- var input1 = $("<input type='text' class='validate[required] date' dateFmt='yyyy-MM-dd' id='EVENT_DATE_363' name='EVENT_DATE_363'/>");
- input1.render();
- td1.append(input1);
-
- //名称
- var tr3 = $("<tr></tr>");
- table.append(tr3);
- tr3.append("<td align='right'><div ><span class='star'>*</span>名称:</div></td>");
- var td3 = $("<td align='left'></td>");
- tr3.append(td3);
- var input3 = $("<input type='text' id='EVENT_PLACE_363' class='validate[required]' value='低温雨雪冰冻灾害' name='EVENT_PLACE_363' maxLength='20'/>");
- input3.render();
- td3.append(input3);
- }else if(selectType=="降水"){
-
-
- //事件日期
- var tr1 = $("<tr></tr>");
- table.append(tr1);
- tr1.append("<td align='right'><div ><span class='star'>*</span>事件日期:</div></td>");
- var td1 = $("<td align='left'></td>");
- tr1.append(td1);
- var input1 = $("<input type='text' class='validate[required] date' dateFmt='yyyy-MM-dd'id='EVENT_DATE_363' name='EVENT_DATE_363'/>");
- input1.render();
- td1.append(input1);
-
- //名称
- var tr3 = $("<tr></tr>");
- table.append(tr3);
- tr3.append("<td align='right'><div ><span class='star'>*</span>名称:</div></td>");
- var td3 = $("<td align='left'></td>");
- tr3.append(td3);
- var input3 = $("<input type='text' id='EVENT_PLACE_363' class='validate[required]' value='降水' name='EVENT_PLACE_363' maxLength='20'/>");
- input3.render();
- td3.append(input3);
-
- }else if(selectType=="其他"){
-
-
- //事件日期
- var tr1 = $("<tr></tr>");
- table.append(tr1);
- tr1.append("<td align='right'><div ><span class='star'>*</span>事件日期:</div></td>");
- var td1 = $("<td align='left'></td>");
- tr1.append(td1);
- var input1 = $("<input type='text' class='validate[required] date' dateFmt='yyyy-MM-dd'id='EVENT_DATE_363' name='EVENT_DATE_363'/>");
- input1.render();
- td1.append(input1);
-
- //名称
- var tr3 = $("<tr></tr>");
- table.append(tr3);
- tr3.append("<td align='right'><div ><span class='star'>*</span>名称:</div></td>");
- var td3 = $("<td align='left'></td>");
- tr3.append(td3);
- var input3 = $("<input type='text' id='EVENT_PLACE_363' class='validate[required]' name='EVENT_PLACE_363' maxLength='20'/>");
- 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);
- }
|