123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- /**
- * 功能:应急预警报告添加及修改
- *
- *
- * @author HXB
- * @date 2015/09/14
- */
- ReportInputAddEdit = function() {
- /**定义变量**/
- var _this = this;
- /**私有方法**/
- /***新增信息***/
- _this.save = function(){
- $("#IS_RELEASE_321").val("0");
- $("#OPR_STATE_321").val("0");
- var file = $("#uploaderFileRealName").val();
- var maingridtext = $("#maingrid").text();
- /*if(!file && !maingridtext){
- top.Dialog.alert("请上传报告附件!");
- return;
- }*/
- $form = $('#editForm');
- var valid = $form.validationEngine({returnIsValid: true});
- if(!valid){
- top.Dialog.alert(CHECKREDBOX);
- }
- if(!hasFile()){
- top.Dialog.alert("请上传附件!");
- return;
- }
- if(valid){
- showProgressBar("正在提交中...");
- var formValue = $form.serialize();
- var url = $.pathname() +"/ws/uploadForm/FileUpDownService/asyncFileUpLoad";
- $.request.add(url,formValue,function(data){
- closeProgress();
- top.Dialog.alert(data.Msg.info);
- if(pagetype=="daiban"){
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/waitdo/waitDo.html");
- }else{
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/alert/report/reportInput1/ReportInput.jsp");
- }
- });
- /*var url = $.pathname() +"/ws/uploadForm/FileUpDownService/fileUpLoad";
- if(fd_id!=undefined&&fd_id!=""){
- url = $.pathname() +"/ws/uploadForm/FileUpDownService/editlocation";
- }*/
- //fileToSave($form,null,null,url);
- }
-
- };
- _this.saveAndRelease = function(){
- $("#IS_RELEASE_321").val("1");
- $("#OPR_STATE_321").val("1");
- $form = $('#editForm');
- var valid = $form.validationEngine({returnIsValid: true});
- if(!valid){
- top.Dialog.alert(CHECKREDBOX);
- }
- if(!hasFile()){
- top.Dialog.alert("请上传附件!");
- return;
- }
- if(valid){
- showProgressBar("正在提交中...");
- var formValue = $form.serialize();
- var plan_id = $("#PLAN_ID_321").attr("selvalue");
- $.ajax({
- url : $.pathname() + '/ws/qrps/QueryReportProgrammeService/loadReportInputByDeptAndTaskId',
- type : 'post',
- timeout : 15000,
- data : {
- planId : plan_id,
- deptId : top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids(),
- reportType:"2"
- },
- ansyc:false,
- dataType : 'text',
- success : function(data) {
- if(data=="true"){
- top.Dialog.confirm("同时段,该填报要求响应报告已上报过,是否继续发布并上报覆盖之前的报告?", function(){
- var url = $.pathname() +"/ws/uploadForm/FileUpDownService/asyncFileUpLoad";
- top.Dialog.confirm("该报告尚未发布,是否发布并上报?|上报", function(){
- $.request.add(url,formValue,function(data){
- top.Dialog.alert('保存并上报成功!', null, null, null, -1);
- if(pagetype=="daiban"){
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/waitdo/waitDo.html");
- }else{
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/alert/report/reportInput1/ReportInput.jsp");
- }
- });
- });
- },
- function(){return;}
- );
- }else{
- top.Dialog.confirm("该报告尚未发布,是否发布并上报?|上报", function(){
- var url = $.pathname() +"/ws/uploadForm/FileUpDownService/asyncFileUpLoad";
- $.request.add(url,formValue,function(data){
- top.Dialog.alert('保存并上报成功!', null, null, null, -1);
- if(pagetype=="daiban"){
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/waitdo/waitDo.html");
- }else{
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/alert/report/reportInput1/ReportInput.jsp");
- }
-
- });
- },
- function(){return;}
- );
- }
- },
- error : function(e) {
- $.messager.alert('上报失败');
- }
- });
- };
- };
- function fileToSave($form,listGrid,msg,url){
- showProgressBar("正在提交中...");
- //表单异步提交处理
- $form.ajaxSubmit({
- type: 'post',
- url:url,
- //表单提交成功后的回调
- success: function(responseText, statusText, xhr, $form){
- responseText = eval('('+responseText+')');
- closeProgress();
-
- if(msg!=undefined){
- if(responseText.info == 'success')
- top.Dialog.alert(msg+'成功!');//弹出提示
- else
- top.Dialog.alert(msg+'失败!');//弹出提示
- }else{
- if(responseText.info == 'success')
- top.Dialog.alert('保存成功!');//弹出提示
- else
- top.Dialog.alert('保存失败!');//弹出提示
- }
- if(pagetype=="daiban"){
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/waitdo/waitDo.html");
- }else{
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/alert/report/reportInput1/ReportInput.jsp");
- }
- }
- });
- }
- return {
- init : function() {
- $('#save').bind('click',function(){
- _this.save();
- });
- $('#goback').bind('click',function(){
- if(pagetype=="daiban"){
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/waitdo/waitDo.html");
- }else{
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/alert/report/reportInput1/ReportInput.jsp");
- }
- });
- $('#saveandrelease').bind('click',function(){
- _this.saveAndRelease();
- });
- }
- };
- }();
- $(function() {
- ReportInputAddEdit.init();
- });
|