123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211 |
- $(function(){
- //应急制度文件分类FILE_CLASSIFY_230
- $("#FILE_CLASSIFY_230").initCanstSelect('BM_FILE_CLASSIFY');
- //$('#fileDiv').getUploadFileContent();旧的上传控件
-
- //新的上传控件
- var opts = {
- //swf: 'baiduUpload/Uploader.swf',
- //server: 'Upload',
- fileNumLimit: 1,
- fileSizeLimit: 200 * 1024 * 1024, // 200 M
- fileSingleSizeLimit: 50 * 1024 * 1024, // 50 M
- pick: {
- id: '#filePicker',
- label: '点击选择文件',
- name : 'file'
- },
- dnd: '#dndArea',
- paste: '#uploader',
- chunked: false,
- chunkSize: 512 * 1024,
- disableGlobalDnd: true
- };
-
- $('#fileDiv').getAsyncUploadFileContent(opts);
-
- var bodyheight = $(window.document.body).height();
- $(parent.document.body).find("#iframeChild2").height(bodyheight);
- $(top.document.body).find("#frmright").height(bodyheight);
-
- //记录当前页面的值
- InitformValue = $('#fillForm').serialize();
- });
- //记录当前页面的值
- var InitformValue="";
-
- //取复选框勾选的值
- var strRO="";
-
-
- //取系统时间:年月日时分秒
- var date = allGetServerTime();
- var seperator1 = "";
- var seperator2 = "";
- var month = date.getMonth() + 1;
- var strDate = date.getDate();
- if (month >= 1 && month <= 9) {
- month = "0" + month;
- }
- if (strDate >= 0 && strDate <= 9) {
- strDate = "0" + strDate;
- }
- var time = date.getFullYear() + seperator1 + month + seperator1 + strDate
- + "" + date.getHours() + seperator2 + date.getMinutes()
- + seperator2 + date.getSeconds();
- var dataNow= date.getFullYear() + seperator1 +"-" + month + "-"+seperator1 + strDate;
-
- //单位ID
- var deptName = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids();
- var getUser_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id()+""; //登录人ID
- var parentId = top.com.sinosoft.lz.system.user.LoginInfo.getParent_ids();
- var parent_id = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
- //新增
- function add(containerId){
- var title = $("#FILE_TITLE_230").val();
- var classify = $("#FILE_CLASSIFY_230").val();
- var filedate = $("#FILE_ADD_DATE_230").val();
-
- var file = $("#uploaderFileName").val();
- var ldot = file.lastIndexOf(".");
- var type ="."+ file.substring(ldot + 1);
- var pos=file.lastIndexOf("\\");
- var filename = file.substring(pos+1,ldot);
- var tempFile = file.split(",");
- if(tempFile.length>1){
-
- top.Dialog.alert("只允许上传一个附件,请检查是否只上传了一个附件。");
- return;
- }
-
- if(file.length>300){
- top.Dialog.alert("您上传的附件名称太长,请重命名后上传。");
- return;
- }
-
-
- var valid = $(containerId).validationEngine({returnIsValid: true});
- if(valid == true){
-
- //文件标题FILE_TITLE_230
- //文件分类FILE_CLASSIFY_230
- //发文日期FILE_ADD_DATE_230
- //电子文件ELECTRONIC_FILE_230
- //文件摘要FILE_CONTENT_230
- //变更说明CHANGE_DETAIL_230
-
- //当前登录人ID getUser_id
- $("#PIGEONHOLE_MAN_ID_230").val(getUser_id);
- //文件版本
- $("#VERSION_ID_230").val(filename+time+type);
- //变更类型:0新增 1、更新 2、撤销
- //归档日期
- $("#PIGEONHOLE_DATE_230").val(dataNow);
-
- //发布单位ID PUBLISH_COMP_ID_230
- $("#PUBLISH_COMP_ID_230").val(parent_id);
- //上级单位ID
- $("#REPORT_COMP_ID_230").val(parentId);
- var $form=$("#fillForm");
- var formValue = $form.serialize();
- var url = $.pathname() +"/ws/uploadForm/FileUpDownService/asyncFileUpLoad";
- $.request.add(url,formValue,function(data){
- closeProgress();
- top.Dialog.alert(data.Msg.info);
-
- var url = "/nwyj/page/business/am/file/"+"FileList_AM.jsp";
- top.document.getElementById("frmright").setAttribute("src", ""+encodeURI(url));
- });
- }else{
- // top.Dialog.alert('请检查标红输入框!');
- if(title==""){
- top.Dialog.alert('文件标题填写不正确,请按要求填写!');
- return;
- }
- if(classify==""){
- top.Dialog.alert('文件分类填写不正确,请按要求填写!');
- return;
- }
- if(filedate==""){
- top.Dialog.alert('发文日期填写不正确,请按要求填写!');
- return;
- }
- }
- }
-
- //取树形下拉框的值
- /* function test(){
-
- var selectNodesRO = $("#selectTree5-1").data("selectedNodes");
- for(var i=0;i<selectNodesRO.length;i++){
- strRO += selectNodesRO[i].id;
- }
- }*/
-
- 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('添加失败!');//弹出提示
- }
- history.back();
- /*var url = "/nwyj/page/business/am/file/"+"FileList_AM.jsp";
- window.parent.document.getElementById("iframeChild2").setAttribute("src", ""+encodeURI(url));*/
- }
- });
- }
- function goBack() {
- var url = "/nwyj/page/business/am/file/"+"FileList_AM.jsp";
- top.parent.document.getElementById("frmright").setAttribute("src", ""+encodeURI(url));
-
- /**********************退出表单时的验证判断****************************/
- /*var formValue = $('#fillForm').serialize();
- if(formValue!=InitformValue){
- top.Dialog.confirm("您已修改了表单,是否需要离开?|离开", function() {
- var url = "/nwyj/page/business/am/file/"+"FileList_AM.jsp";
- parent.document.getElementById("iframeChild2").setAttribute("src", ""+encodeURI(url));
- });
- }else{
- var url = "/nwyj/page/business/am/file/"+"FileList_AM.jsp";
- parent.document.getElementById("iframeChild2").setAttribute("src", ""+encodeURI(url));
- }*/
- }
-
- function redPlanDeptp(data){
-
- diag = new top.Dialog();// 定义一个窗口对象
- diag.Title = "选择关联的专项预案";// 窗口标题
- diag.URL = $.pathname() +"/page/business/am/contingencyPlan/PlanGuanlian.jsp?"+data;// 窗口对应的页面
- diag.Height = 500;
- diag.Width =600;
- diag.ShowOkButton=false;// 不显示确认按钮
- diag.ShowCancelButton=false;// 不显示取消按钮
- diag.ButtonAlign="center";// 按钮居中
- diag.show();// 显示窗口
- }
-
- //重置
- function resetSearch(){
- document.location.reload();
- }
- $.messager=top.Dialog;
|