123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403 |
- governmentDocEdit = function(){
- /**定义变量**/
- var _this = this;
- var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids();
- /**私有方法**/
- /***新增信息***/
- _this.save = function(){
-
- //1、取系统时间
- // var getSysTime = getTime();
-
-
- //没有附件上传,直接修改信息,调用修改的方法。
- /***********保存文件版本值(附件名称+时间)start**************/
- /* $("#VERSION_240").val("");
- //取上传文件的名称
- var file = $("#uploaderFileName").val();
- //alert("file"+file);
- // var file = $("#fileDiv").val();
- if(file!=null && file!=""){
- version=file+getSysTime;
- }else{
- version="";
- }
- $("#VERSION_240").val(version);*/
-
- //取系统时间:年月日时分秒
- var date = allGetServerTime();
- var seperator1 = "";
- 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 dataNow= date.getFullYear() + seperator1 + month + seperator1 + strDate;
- var filename = $("#DOCUMENT_NAME_240").val();
- //判断是否上传附件
- if(hasFile()==true){
- $("#VERSION_240").val(filename+dataNow+"版");
- }
-
- //***********************************修改方法,将is_del状态改为1,信息的状态字段改为废止。****************************************//*
- //修改方法
- /* function edit111(id0){
- //设置状态字段为废止 formReset
- $("#STATE_240").setValue("4");
- $form = $('#editForm');
- var url = $.pathname() +"/ws/uploadForm/FileUpDownService/asyncFileUpLoad";
- var formValue = $form.serialize();
- $.request.add(url,formValue,function(data){
- closeProgress();
- top.Dialog.alert(data.Msg.info);
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/am/fileManager/governmentDoc/governmentDoc.jsp");
- });
- }
- */
-
- /***********保存文件版本值(附件名称+时间)end****************/
- var id0=$("#FD_OBJECTID240").val();
-
- $('#editForm input[name="classid"]').val('240');
- $form = $('#editForm');
- //表单验证
- var valid = $form.validationEngine({returnIsValid: true});
-
- if(!valid){
- top.Dialog.alert("请检查标红的输入空!");
- }
-
- if(valid){
- showProgressBar("正在提交中...");
- //2通过状态的字段来判断是否需要顶掉上一个版本。调用删除方法 ( 修订-2、修正-3 两种选择需要顶掉上一个版本)删除成功后,调用新增方法。
- var stat = $("#STATE_240").val();
- if(stat==2 || stat==3){//如果状态为修订-2或修正-3,删除原记录,重新生成新记录
- //删除上一个版本
- del(id0);
- //新增一条记录
- add();
- }else if(stat=="4"){
- top.Dialog.confirm("确定要废止吗?|废止", function() {
- // 删除记录
- $.post($.pathname() +"/ws/crud/CRUDService/delete/", {
- "objectIDs" : id0,
- classid : 240
- }, function(result) {
- if (result.Msg.sucsess == true) {
- top.Dialog.alert("废止成功",null,null,null,-1);
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/am/fileManager/governmentDoc/governmentDoc.jsp");
- } else {
- top.Dialog.alert("废止失败!");
- }
- }, "json");
-
- });
- }else if(stat=="5"){
- top.Dialog.confirm("确定要撤销吗?|撤销", function() {
- // 删除记录
- $.post($.pathname() +"/ws/crud/CRUDService/delete/", {
- "objectIDs" : id0,
- classid : 240
- }, function(result) {
- if (result.Msg.sucsess == true) {
- top.Dialog.alert("撤销成功",null,null,null,-1);
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/am/fileManager/governmentDoc/governmentDoc.jsp");
- } else {
- top.Dialog.alert("撤销失败!");
- }
- }, "json");
-
- });
- }else{//否则仅修改
- edit();
- }
- }
- };
-
- //删除方法XXXXXXXXXXXXXXX
- function del(id0){
- $.post($.pathname() +"/ws/crud/CRUDService/delete/", {
- "objectIDs" : id0,
- classid : 240
- }, function(result) {
- if (result.Msg.sucsess == true) {
- //$.messager.alert("删除成功",null,null,null,-1);
- // 刷新表格数据
- //g.rend();
- } else {
- //top.Dialog.alert("删除失败!");
- }
- }, "json");
- }
-
- /***********************************修改方法,将is_del状态改为1,信息的状态字段改为废止。****************************************/
- //修改方法
- function edit111(){
- //设置状态字段为废止 formReset
- $("#STATE_240").setValue("4");
- $("#IS_del_240").val("1");
- var url = $.pathname() +"/ws/uploadForm/FileUpDownService/asyncFileUpLoad";
- var formValue = $form.serialize();
- $.request.add(url,formValue,function(data){
- closeProgress();
- top.Dialog.alert(data.Msg.info);
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/am/fileManager/governmentDoc/governmentDoc.jsp");
- });
- }
-
- //修改方法
- function edit(){
- //alert("修改方法");
- //var url = $.pathname() +"/ws/crud/CRUDService/update/";
- var url = $.pathname() +"/ws/uploadForm/FileUpDownService/asyncFileUpLoad";
-
- var formValue = $form.serialize();
- $.request.add(url,formValue,function(data){
- closeProgress();
- top.Dialog.alert(data.Msg.info);
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/am/fileManager/governmentDoc/governmentDoc.jsp");
- });
- }
- //新增方法
- function add(){
- //alert("新增方法");
- var date = allGetServerTime();
- var seperator1 = "";
- 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 dataNow1= date.getFullYear() + seperator1 +"-" + month +"-" + seperator1 + strDate;
- $('#TYPEIN_TIME_240').val(dataNow1);
- //删除上个版本的附件
- var fdobj = document.getElementsByName("uploaderFileObjectid");
- for(var i=fdobj.length; i>0; i--){
- var id = fdobj[0].id;
- id = id.replace("uploaderFileObjectid","");
- //大于30说明是从数据库查出来的附件
- if(id.length==30){
- $("#uploaderFileObjectid"+id).remove();
- $("#uploaderFileRealName"+id).remove();
- $("#uploaderFileName"+id).remove();
- $("#uploaderFileExt"+id).remove();
- }
- }
-
- //需要将上一个文件的主键ID清空
- $("#FD_OBJECTID240").val("");
- //取表单所有元素的值
- var formValue = $form.serialize();
-
- //将上一个文件信息的主键ID存入OBJ_FIRST这个字段(主页面已经完成)
- // var url = $.pathname() +"/ws/crud/CRUDService/update/";
- //
- // var formValue = $form.serialize();
- // $.request.add(url,formValue,function(data){
- /*closeProgress();
- top.Dialog.alert(data.Msg.info);
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/am/fileManager/governmentDoc/governmentDoc.jsp");*/
- // });
- //新增
- //url = $.pathname() + '/ws/crud/CRUDService/create/';
- url = $.pathname() +"/ws/uploadForm/FileUpDownService/asyncFileUpLoad";
- //var formValue = $form.serialize();
-
- //alert(formValue);
- $.request.add(url,formValue,function(data){
-
- closeProgress();
- top.Dialog.alert(data.Msg.info);
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/am/fileManager/governmentDoc/governmentDoc.jsp");
- });
-
- //之前发布状态重新更新
-
- }
- //取系统时间:年月日时分秒
- function getTime(){
- 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();
- return time;
- }
- // 创建报表填报计划he报告填报要求
- return {
- init : function() {
- $('#save').bind('click',function(){
- $form = $('#editForm');
- var valid = $form.validationEngine({returnIsValid: true});//表单验证
- if(!valid){
- top.Dialog.alert("请检查标红输入框!");
- return ;
- }
- var level = $("#SECRECY_LEVEL_240").val();
- var flag = false;
- var obj = document.getElementsByName("uploaderFileName");
- for(var i =0;i<obj.length;i++){
- if(obj[i].id.length<30){
- flag = true;
- }
- }
- var STATE = $("#STATE_240").val();
- //判断是否上传附件
- if((level==1)&&(!flag)&&(STATE=="2"||STATE=="3")){
- top.Dialog.alert("请选择上传的文件!");
- return;
- }
-
- top.Dialog.confirm("是否要保存?|政府公文",function(){//点击确定
- _this.save();
- }/*,function(){//点击取消
- //alert("bbbbbb");
- }*/);
-
- });
- /** 保存并发布 **/
- $("#saveAndIssue").bind("click",function(){
-
- var level = $("#SECRECY_LEVEL_240").val();
- var flag = false;
- var obj = document.getElementsByName("uploaderFileName");
- for(var i =0;i<obj.length;i++){
- if(obj[i].id.length<30){
- flag = true;
- }
- }
- var STATE = $("#STATE_240").val();
- //判断是否上传附件
- if((level==1)&&(!flag)&&(STATE=="2"||STATE=="3")){
- top.Dialog.alert("请选择上传的文件!");
- return;
- }
-
- top.Dialog.confirm("是否要发布?|政府公文",function(){//点击确定
- $("#IS_ISSUE_240").val("1");
- //alert($("#IS_ISSUE_240").val());//1
- _this.save();
- }/*,function(){//点击取消
- //alert("bbbbbb");
- }*/);
- //_this.saveAndIssue();
- });
- $('#back').bind('click',function(){
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/am/fileManager/governmentDoc/governmentDoc.jsp");
- });
- }
- };
-
- }();
- /***************************************历史信息************************************************************/
- /* var g;
- var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids();
- //点击主键跳转详细信息页面
- this.openDetail = function(rowindex) {
- var row = g.getRow(rowindex);
- var fd_id = row.FD_OBJECTID240;
- // alert(fd_id);
- // window.location.href="governmentDocView.jsp?fd_id="+fd_id;
- // window.open("governmentDocView.jsp?"+fd_id);
- window.open("/nwyj/page/business/am/fileManager/governmentDoc/governmentDocView.jsp?fd_id="+fd_id);
- //$('#frmright', window.parent.document).attr('src',$.pathname()+'/page/business/gps/programManagement/detailProgramManagement.jsp?fd_id='+fd_id);
- };
- //初始化列表
- function initVersion(){
- //alert("历史信息");
- var condition = " FD_OBJECTID='"+obj_old+"' or OBJ_FIRST='"+obj_old+"' ";
- // var condition = "is_del = '0'";
- var loadParams = {"listId" : '240',"condition" : condition,direction:'DESC',sort: 'UPDATEDATE'};
- //双视图不支持getRow()取行号的方法。
- // 工具条
- var roleCons = roleButtonArr();
- var toolBarOpt1 = {
- items : [{ text: '下载' ,click:"onDownload",iconClass: 'download_tem',id:"10007" }],
- roleCons:roleCons
- };
- //树形列
- var grid_option1 = {
- columns: [
- {display : '发布单位',name : 'DISPATCH_UNIT_240', align : 'center',width : '12%',isPrimaryKey:true,
- render : function(rowdata, rowindex, value, column) {
- return "<a href='javascript:;' style='width:100%;height:100%;display:block' title='" + value + "' onclick='openDetail(" + rowindex + ")'>" + value + "</a>";
- }
- },
- {display : '公文名称', name : 'DOCUMENT_NAME_240', align : 'center', width : '10%'},
- {display : '发文字号', name : 'DISPATCH_WORD_SIZE_240', align : 'center', width : '6%'},
- {display : '状态', name : 'STATE_240_SHOW', align : 'center', width : '7%'},
- {display : '保密级别', name : 'SECRECY_LEVEL_240_SHOW', align : 'center', width : '7%'},
- {display : '录入人', name : 'TYPEIN_PEOPLE_240', align : 'center', width : '8%'},
- {display : '录入人联系方式', name : 'TYPEIN_PEOPLE_PHONE_NUM_240', align : 'center', width : '10%'},
- {display : '录入时间', name : 'TYPEIN_TIME_240', align : 'center', width : '10%'},
- {display : '单位', name : 'UNITE_240_SHOW', align : 'center', width : '8%'},
- {display : '部门', name : 'DEPT_240_SHOW', align : 'center', width : '8%'},
- {display : '文件版本', name : 'VERSION_240', align : 'center', width : '14%'},
- ],
- rownumbers : true,
- checkbox : true,
- width:"100%",
- pageSize : 10,
- percentWidthMode : true
- };
- var options1={
- url :'/nwyj/ws/crud/CRUDService/queryQui',
- params:loadParams,
- gridOptions:grid_option1,
- singleRecodeOptions:{a:"aa"},
- paperOpration:{showInput:"true"},
- toolBarOptions:toolBarOpt1
- };
- g=gridAndSingleRecode=$("#historyMsg").quickgridAndSingleRecode(options1);
- }
-
- //下载
- function onDownload(){
- var rows = g.getSelectedRows();
- if (rows.length == 0) {
- top.Dialog.alert("请选择一条记录");
- return;
- }
- if (rows.length > 1) {
- top.Dialog.alert("只能选择一条记录");
- return;
- }
- var fd_id = rows[0].FD_OBJECTID240;
- //showFile(fd_id);
- // }
- // function showFile(fd_id){
- var diag = new top.Dialog();// 定义一个窗口对象
- diag.Title = "下载";// 窗口标题
- //diag.URL = $.pathname() +"/page/business/am/base/showDownloadFile.html?fd_id="+fd_id;// 窗口对应的页面
- diag.URL = $.pathname() +"/page/business/am/fileManager/governmentDoc/showDownloadFile.html?fd_id="+fd_id;// 窗口对应的页面
- diag.Height = 400;
- diag.ShowOkButton=false;// 不显示确认按钮
- diag.ShowCancelButton=false;// 不显示取消按钮
- diag.ButtonAlign="center";// 按钮居中
- diag.show();// 显示窗口
- }*/
-
- $(function() {
- governmentDocEdit.init();
- });
|