123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229 |
- $(function(){
- //应急制度文件分类FILE_CLASSIFY_230
- // $("#FILE_CLASSIFY_230").initCanstSelect('BM_FILE_CLASSIFY');
- //$('#fileDiv').getUploadFileContent();
- //
- // $('#CHANGE_TYPE').data("data",changetype);
- // $("#CHANGE_TYPE").render();
-
- 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);
-
- });
- //单位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 parent_id = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
- var changetype = {"list":[
- {value:"2",key:"更新",suggest:""},
- {value:"3",key:"撤销",suggest:""}]
- };
- var time = "";
- var COLUMN_1_232="0";
-
- //修改表单信息,获取记录
- if((window.location.href).indexOf('?')>-1){
- var fd_id = (window.location.href).split('?')[1];
- var url = $.pathname() + '/ws/crud/CRUDService/getDataById/';
- var params = {
- classid : '232',
- objectID : fd_id
- };
- $.ajax({
- url : url,
- type : 'post',
- timeout : 60000,
- data : params,
- dataType : 'json',
- success : function(data){
- COLUMN_1_232 = data.COLUMN_1_232;//版本标志
- COLUMN_3_232 = data.COLUMN_3_232;//上传标志
- COLUMN_4_232 = data.COLUMN_4_232;//上个文件ID
- if(COLUMN_1_232=="0"){
- getFileList(fd_id,1);
- }
- if(COLUMN_3_232=="1"&&COLUMN_4_232!="0"){
- getFileList(fd_id,1);
- }
-
- //纯修改
- if(COLUMN_3_232=="0"&&COLUMN_1_232!="0"){
- getFileList(COLUMN_4_232,1);
- }
-
- $('#fillForm').ajaxWrite({data:data});
- $('#fillForm input[name="classid"]').val('232');
- },
- error : function(e){
- $.messager.alert('系统提示信息', '访问服务失败!', 'error');
- }
- });
- }
-
-
-
- var file ="";
-
- //取系统时间:年月日时分秒
- 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;
- }
- time = date.getFullYear() + seperator1 + month + seperator1 + strDate
- + "" + date.getHours() + seperator2 + date.getMinutes()
- + seperator2 + date.getSeconds();
-
-
- //表单验证
- function validateForm(containerId){
- var title = $("#NOTICE_TITLE_232").val();
- var noticedate = $("#NOTICE_PUBLISH_DATE_232").val();
-
- var valid = $(containerId).validationEngine({returnIsValid: true});
- if(valid == true){
-
- //取上传附件容器的值,如果为空,则为单纯修改预案基本信息。如不为空,则为修订预案,重新上传预案。
- var file = $("#uploaderFileName").val();
- if(file!=null&&file!=undefined&&file!=""){
- //先删除原来记录。
- del();
- $("#fd_id232").val("");
- //再新增记录
- add();
-
- }else{
- edit();
- }
- }else{
- if(title==""){
- top.Dialog.alert('标题不能为空!');
- return;
- }
- if(noticedate==""){
- top.Dialog.alert('日期不能为空!');
- return;
- }
- }
- }
- function add(containerId){
-
- 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 valid = $(containerId).validationEngine({returnIsValid: true});
- if(valid == true){
-
- $("#COLUMN_3_232").val("1");
- $("#COLUMN_4_232").val(fd_id);
- if(COLUMN_1_232=="0"){
- $("#COLUMN_1_232").val(fd_id);
- }else{
- $("#COLUMN_1_232").val(COLUMN_1_232);
- }
- var $form=$("#fillForm");
- var formValue = $form.serialize();
- var url = $.pathname() +"/ws/uploadForm/FileUpDownService/asyncFileUpLoad";
- $.request.add(url,formValue,function(data){
- closeProgress();
- top.Dialog.alert("修改成功!");
- var url = "/nwyj/page/business/am/file/"+"FileList_AM_TZ.jsp";
- top.document.getElementById("frmright").setAttribute("src", ""+encodeURI(url));
- });
- }else{
- top.Dialog.alert('请检查标红输入框!');
- }
- }
-
- //修改
- function edit(){
- $("#COLUMN_3_232").val("0");
- //上一个版本的预案的ID
- $("#COLUMN_4_232").val(fd_id);
- var formValue = $('#fillForm').serialize();
- var url = $.pathname() + '/ws/crud/CRUDService/update';
-
- $.ajax({
- url : url,
- type : 'post',
- data : formValue,
- dataType : 'text',
- timeout : 60000,
- success : function(data){
- top.Dialog.alert('修改成功!',null,null,null,-1);
- var url = "/nwyj/page/business/am/file/"+"FileList_AM_TZ.jsp";
- top.document.getElementById("frmright").setAttribute("src", ""+encodeURI(url));
- },
- error : function(){
- $.messager.alert('操作失败');
- }
- });
- }
-
- //删除原来信息
- function del(){
- // 删除记录
- $.post($.pathname() +"/ws/crud/CRUDService/delete/", {
- "objectIDs" : fd_id,
- classid : 232
- }, function(result) {
- if (result.Msg.sucsess == true) {
- //$.messager.alert("废止上一版本制度文件",null,null,null,-1);
- } else {
- top.Dialog.alert("废止失败!");
- }
- }, "json");
- }
-
- function goBack() {
- var url = "/nwyj/page/business/am/file/"+"FileList_AM_TZ.jsp";
- top.document.getElementById("frmright").setAttribute("src", ""+encodeURI(url));
- }
-
- //重置
- function resetSearch(){
- document.location.reload();
- }
- $.messager=top.Dialog;
|