123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173 |
- /**
- * 功能:应急预警报告添加及修改
- *
- *
- * @author HXB
- * @date 2015/09/14
- */
- ReportInputPlanAddEdit = function() {
- /**定义变量**/
- var _this = this;
- /**私有方法**/
- /***新增信息***/
- _this.save = function(){
- if(_is_add){
- top.Dialog.alert("不能重复添加预警填报要求,请重新选择!");
- return;
- }
- var pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]");
- var obj = getTimeId();
- if(!checkTime()){
- return;
- }else if(!decideTime()){
- return ;
- } else if(!checkTimes()){
- return;
- }else if(!checkTimeAdd("addTime",obj,timeindex)){
- return;
- }else if(pattern.test($("#PROGRAMME_NAME_320").val())){
- top.Dialog.alert("填报要求名称不能包含特殊字符");
- return;
- }
- $('#editForm input[name="classid"]').val('320');
- var deptName = $("#WRITE_DEPT_ID_320_show").val();
-
-
-
- $("#WRITE_DEPT_NAME_320").val(deptName);
- $form = $('#editForm');
- var valid = $form.validationEngine({returnIsValid: true});
- if($("#show_WRITE_DEPT_ID_320").val()==""){
- $("#show_WRITE_DEPT_ID_320").addClass("error-field");
-
- }else{
- $("#show_WRITE_DEPT_ID_320").removeClass("error-field");
- }
- if(!valid){
- top.Dialog.alert(CHECKREDBOX);
- return;
- }
- if(valid){
- showProgressBar("正在提交中...");
- var url = $.pathname() + '/ws/crud/CRUDService/create/';
- var _write_dept_name = $("#selectTree3_input").val();
- if(fd_id!=undefined&&fd_id!=""&&fd_id!="null"){
- url = $.pathname() +"/ws/crud/CRUDService/update/";
- }
- var formValue = $form.serialize();
- $.request.add(url,formValue,function(data){
- closeProgress();
- top.Dialog.alert(data.Msg.info);
- if(isAlert != null && isAlert == 0){
- $('#frmright', window.parent.document).attr('src',$.pathname()+ "/page/business/em/alert/warning/WarningReleaseMatter.jsp?fd_id="+ warningId);
- }else{
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/alert/report/reportInputPlan/ReportInputPlan.jsp");
- }
-
- });
- }
-
- };
- _this.saveAndRelease = function(){
- if(_is_add){
- top.Dialog.alert("不能重复添加预警填报要求,请重新选择!");
- return;
- }
- if(!checkTime()){
- return;
- }else if(!decideTime()){
- return ;
- } else if(!checkTimes()){
- return;
- }
- $('#editForm input[name="classid"]').val('320');
- var deptName = $("#WRITE_DEPT_ID_320_show").val();
-
-
- $("#WRITE_DEPT_NAME_320").val(deptName);
- $form = $('#editForm');
- var valid = $form.validationEngine({returnIsValid: true});
- if(!valid){
- top.Dialog.alert(CHECKREDBOX);
- }
- if(valid){
- showProgressBar("正在提交中...");
- var url = $.pathname() + '/ws/crud/CRUDService/create/';
- var _write_dept_name = $("#selectTree3_input").val();
- if(fd_id!=undefined&&fd_id!=""&&fd_id!="null"){
- url = $.pathname() +"/ws/crud/CRUDService/update/";
- }
- $("#IS_RELEASE_320").val("1");
- var formValue = $form.serialize();
- $.request.add(url,formValue,function(data){
- closeProgress();
- //top.Dialog.alert(data.Msg.info);
- top.Dialog.confirm("发布成功!是否发送短信通知?", function() {
- var comp_id = $("input[name=WRITE_DEPT_ID_320]").val();
- $.ajax({
- url : $.pathname()+ '/ws/qrps/QueryReportProgrammeService/reportPlanSendMsg',
- type : 'post',
- data : {
- /*'fd_id' : fd_id,
- 'userId':userId,*/
- 'comp_id':comp_id
- },
- async:false,
- dataType : 'json',
- success : function(data) {
- addMsg(data.list.split("|")[0],data.list.split("|")[1],"新发布了一个预警报告填报要求,请及时填报!",1);
- },
- error : function(e) {
- $.messager.alert('访问服务失败!', 'error');
- }
- });
- },function(){
- if(isAlert != null && isAlert == 0){
- $('#frmright', window.parent.document).attr('src',$.pathname()+ "/page/business/em/alert/warning/WarningReleaseMatter.jsp?fd_id="+ warningId);
- }else{
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/alert/report/reportInputPlan/ReportInputPlan.jsp");
- }
-
- });
- });
- }
-
- };
-
- _this.formReset = function(){
- //if(fd_id!=undefined&&fd_id!=""){
- $('#frmright', window.parent.document).attr('src',$.pathname()+ '/page/business/em/alert/report/reportInputPlan/ReportInputPlanAddEdit.jsp?fd_id='+fd_id);
- //}else{
- // document.getElementById("editForm").reset();
- // $("#dept_name").resetValue();
- //}
- };
- return {
- init : function() {
- $('#save').bind('click',function(){
- _this.save();
- });
- $("#saveAndRelease").bind("click",function(){
- _this.saveAndRelease();
- })
- $('#goback').bind('click',function(){
- if(isAlert != null && isAlert == 0){
- $('#frmright', window.parent.document).attr('src',$.pathname()+ "/page/business/em/alert/warning/WarningReleaseMatter.jsp?fd_id="+ warningId);
- }else{
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/alert/report/reportInputPlan/ReportInputPlan.jsp");
- }
-
- });
- }
- };
- }();
- $(function() {
- ReportInputPlanAddEdit.init();
- });
- window.onload = function(){
- $(".selectbox").attr("readonly","readonly");
- };
|