common.js 31 KB

1
  1. $.namespace("com.sinosoft.lz.system.user","com.sinosoft.lz.system.department","com.sinosoft.lz.system.right","com.sinosoft.lz.system.config","com.sinosoft.common.utils","com.sinosoft.common.frameWork");CHECKREDBOX="请检查标红输入框!";function openMsg(){}function exitSys(){top.Dialog.confirm("你确定退出本系统吗?",function(){var e=$.pathname()+"/ws/sys/LoginService/Logout/"+com.sinosoft.lz.system.user.LoginInfo.getLogin_name()+"/"+com.sinosoft.lz.system.user.LoginInfo.getSessionID();$.ajax({url:e,type:"get",timeout:6e3,dataType:"json",success:function(e){if(e=="0"){window.location="../"}else{window.location="../"}}})})}function excelExport(e,t,i,a,n,l){t.classId=e;t.expParams=a;t.title=n;var r=$.pathname()+"/ws/excel/ExcelService/CreateToExcelByClassId";if(l=="report"){r=$.pathname()+"/ws/excel/ExcelService/CreateReportToExcelByClassId"}else if(l=="rcreport"){r=$.pathname()+"/ws/excel/ExcelService/CreateRCReportToExcelByClassId"}else if(l=="gps"){r=$.pathname()+"/ws/excel/ExcelService/CreateTaskDataToExcelByClassId"}else if(l=="yjxy"){r=$.pathname()+"/ws/excel/ExcelService/CreateYJXYReportToExcelByClassId"}$.ajax({url:r,type:"post",timeout:15e4,data:t,async:false,dataType:"text",success:function(e){var t=$.pathname()+"/page/common/getExcel.jsp?exportContent="+e+"&destFileName="+encodeURI(encodeURI(i));window.open(t)},error:function(e){top.Dialog.alert("导出Excel失败")}})}function downExcel(e,t){}function exportExcel(e,t,i){$.ajax({url:$.pathname()+"/ws/excel/ExcelService/CreateToExcel",type:"post",timeout:15e3,data:t,dataType:"text",success:function(e){var t=$.pathname()+"/page/common/getExcel.jsp?exportContent="+e+"&destFileName="+encodeURI(encodeURI(i));var a=window.open(t,"_blank");a.location.href=t},error:function(e){top.Dialog.alert("导出Excel失败")}})}function fileToSave($form,listGrid,msg){$form.ajaxSubmit({url:$.pathname()+"/ws/uploadForm/FileUpDownService/fileUpLoad",success:function(responseText,statusText,xhr,$form){responseText=eval("("+responseText+")");top.Dialog.close();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("保存失败!")}}})}function fileToupdate($form,listGrid,msg){showProgressBar("正在提交中...");$form.ajaxSubmit({url:$.pathname()+"/ws/uploadForm/FileUpDownService/editlocation",success:function(responseText,statusText,xhr,$form){responseText=eval("("+responseText+")");top.Dialog.close();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("保存失败!")}listGrid.setNewPage(1);listGrid.loadData()}})}(function(e){e.fn.extend({getUploadFileContent:function(){var t="<fieldset>";t+="<legend>上传附件</legend>";t+='<input type="hidden" name="isSync" value="1"/>';t+='<table id="filetable">';t+="<tr>";t+='<td width="50px" align="right">附件&nbsp;</td>';t+='<td id="file-input">';t+="</td>";t+='<td id="input-button">';t+="</td>";t+="</tr>";t+="</table>";t+="</fieldset>";var i=this;i.append(t);i.render();$inputFile=e('<input name="fileData" fileWidth="400" type="file" contenteditable="false" />');e("#file-input").append($inputFile);$inputFile.render();$button=e('<input class="button" type="button" value="点击新增" onclick="addNewFile()"/>');e("#input-button").append($button);$button.render()}})})(jQuery);(function(e){e.fn.extend({getUploadFileContent1:function(t){var i="<fieldset>";i+="<legend>上传附件</legend>";i+='<input type="hidden" name="isSync" value="1"/>';i+='<table class="filetable">';i+="<tr>";i+='<td width="50px" align="right">附件&nbsp;</td>';i+='<td class="file-input">';i+="</td>";i+='<td class="input-button">';i+="</td>";i+="</tr>";i+="</table>";i+="</fieldset>";var a=t;a.append(i);a.render();$inputFile=e('<input name="fileData" fileWidth="400" type="file" contenteditable="false" />');t.find(".file-input").append($inputFile);$inputFile.render();$button=e('<input class="button addButton" type="button" value="点击新增"/>');a.find(".input-button").append($button);$button.render();a.find(".addButton").live("click",function(){if(a.find(".filetable").find("tr").length>=10){top.Dialog.alert("最多可上传五个文件",null,null,null,null);return}var t=e('<input type="file" fileWidth="400" contenteditable="false" name="fileData"/>');var i=e('<input type="button" value="删除该行" class="button"/>');var n=e('<input class="button addButton" type="button" value="点击新增""/>');var l=e('<tr><td align="right">附件&nbsp;</td><td></td><td></td></tr>');l.find("td").eq(1).append(t);l.find("td").eq(2).append(i).append("&nbsp;&nbsp;").append(n);t.render();i.render();a.find(".filetable").append(l);i.click(function(){var t=e(this);t.parent().parent().remove()})})}})})(jQuery);(function(e){e.fn.extend({getDutyUploadFileContent:function(){var t="<fieldset>";t+="<legend>上传附件</legend>";t+='<input type="hidden" name="isSync" value="1"/>';t+='<table id="filetable">';t+="<tr>";t+='<td width="50px" align="right">附件&nbsp;</td>';t+='<td id="file-input">';t+="</td>";t+='<td id="input-button">';t+="</td>";t+="</tr>";t+="</table>";t+="</fieldset>";var i=this;i.append(t);i.render();$inputFile=e('<input name="fileData" fileWidth="400" type="file" contenteditable="false" />');e("#file-input").append($inputFile);$inputFile.render()}})})(jQuery);(function(e){e.fn.extend({getUploadFileContentMore:function(){var t="<fieldset>";t+="<legend>上传附件</legend>";t+='<input type="hidden" name="isSync" value="1"/>';t+='<table id="filetable">';t+="<tr>";t+='<td width="50px" align="right">附件&nbsp;</td>';t+='<td id="file-input">';t+="</td>";t+='<td id="input-button">';t+="</td>";t+="</tr>";t+="</table>";t+="</fieldset>";t+='<fieldset id="fileListLegend" style="display:none;">';t+="<legend>附件列表</legend>";t+='<div id="fileList" style="width:95%;padding:0px;display:none;"><div id="maingrid"></div>';t+="</div>";t+="</fieldset>";var i=this;i.append(t);i.render();$inputFile=e('<input name="fileData" fileWidth="400" type="file" contenteditable="false" />');e("#file-input").append($inputFile);$inputFile.render();$button=e('<input class="button" type="button" value="点击新增" onclick="addNewFile()"/>');e("#input-button").append("&nbsp;&nbsp;").append($button);$button.render();$delBtn.click(deleteBtnRow)}})})(jQuery);(function(e){e.fn.extend({getAsyncUploadFileContent:function(t){var i="<div id='uploader'>"+"<input type='hidden' name ='uploaderFileRealName' id = 'uploaderFileRealName'/>"+"<input type='hidden' name ='uploaderFileName' id = 'uploaderFileName'/>"+"<input type='hidden' name ='uploaderFileExt' id = 'uploaderFileExt'/>"+"<div class='statusBar' style='display:none;'>"+"<div class='progress'>"+"<span class='text'>0%</span>"+"<span class='percentage'></span>"+"</div>"+"<div class='info'></div>"+"<div class='btns'>"+"<div id='filePicker2'></div><div class='uploadBtn'>开始上传</div>"+"</div>"+"</div>"+"<div class='queueList'>"+"<div id='dndArea' class='placeholder'>"+"<div id='filePicker'></div>"+"</div>"+"</div>"+"</div>";this.append(i);this.render();var a={swf:e.pathname()+"/scripts/webUploader/Uploader.swf",server:e.pathname()+"/Upload",fileNumLimit:20,fileSizeLimit:200*1024*1024,fileSingleSizeLimit:50*1024*1024,pick:{id:"#filePicker",label:"点击选择文件",name:"file"},dnd:"#dndArea",paste:"#uploader",chunked:false,chunkSize:512*1024,disableGlobalDnd:true};t=e.extend(a,t);Manager.upload(t)},newAsyncFileUpload:function(t,i,a){var n={auto:true,swf:"/nwyj/scripts/webUploader/Uploader.swf",server:"/nwyj/ws/uploadForm/FileUpDownService/indexUpLoad",pick:"#picker",fileNumLimit:5,fileSizeLimit:200*1024*1024,fileSingleSizeLimit:50*1024*1024,chunked:false,chunkSize:512*1024,fileTypeLimit:"exe,jsp,asp",accept:{extensions:"gif,jpg,jpeg,bmp,png,rar,zip,doc,docx,xls,xlsx,mp4,pdf,pptx"},disableGlobalDnd:true};t=e.extend(n,t);var l;var r="";var o=0;if(i){var d={listId:110,condition:"is_Del = '0' and MainId ='"+i+"' ORDER BY SORT"};e.ajax({url:e.pathname()+"/ws/uploadForm/FileUpDownService/queryFiles",type:"post",timeout:15e3,data:d,dataType:"json",async:false,success:function(e){if(e){r=e.rows}}})}var s='<table class="tableStyle" width="100%">'+"<tr>"+'<td style="width: 100%" align="left">'+'<span style="padding: 20px 20px;"><b>文件列表</b></span> ';if(a!="0"&&a!=0){s+='<span class="buttonStyle" id="picker"><img src="/nwyj/scripts/webUploader/images/add.png">&nbsp;添加附件</span>'}else{s+='<span class="buttonStyle gray" id="picker"><img src="/nwyj/scripts/webUploader/images/add.png">&nbsp;添加附件</span>'}s+='<span class="buttonStyle gray" id="fileUpdate"><img src="/nwyj/scripts/webUploader/images/update.png">&nbsp;修改标题 </span>'+'<span class="buttonStyle gray" id="fileDelete"><img src="/nwyj/scripts/webUploader/images/delete.png">&nbsp;删除</span> '+'<span class="buttonStyle gray" id="fileDown"><img src="/nwyj/scripts/webUploader/images/filedown.png">&nbsp;下载</span> '+'<span class="buttonStyle gray" id="read"><img width="12" height="12" src="/nwyj/scripts/webUploader/images/read.png">&nbsp;预览</span> '+'<span class="buttonStyle gray" id="setUp"><img src="/nwyj/scripts/webUploader/images/up.png">&nbsp;上移</span> '+'<span class="buttonStyle gray" id="setDown"><img src="/nwyj/scripts/webUploader/images/down.png">&nbsp;下移</span></td>'+"</tr>"+"</table>"+'<table id ="ta" width="100%" class="fileButtonTableStyle">'+"<tr>"+'<td style="width: 100px;border-right:1px solid #CBCBCB;" align="center"><b>附件</b></td>'+'<td id="fileListContainer" align="left"></td>'+"</tr>"+"</table>";this.append(s);this.render();e(".buttonStyle").hover(function(){var t=e(this).attr("class");if(t.indexOf("gray")==-1&&e(this).attr("id")!="picker"){e(this).addClass("buttonHover")}},function(){var t=e(this).attr("class");e(this).removeClass("buttonHover")});e("#fileDelete").bind("click",x);e("#setUp").bind("click",I);e("#setDown").bind("click",D);e("#fileDown").bind("click",E);e("#fileUpdate").bind("click",k);e("#read").bind("click",function(){var t=$();if(!t){return}else{var i=e(t).attr("id").replace("div_","");var a=e("#uploaderFileExt"+i).val();var n=S(a);if(n){window.open(n+"?filePath="+encodeURI(encodeURI(e("#uploaderFileRealName"+i).val()))+"."+a)}else{top.Dialog.alert("暂不支持该类型文件预览")}}});if(r){for(var p=0;p<r.length;p++){o++;var c=r[p].FD_OBJECTID110;var u=r[p].SAVENAME_110;var f=r[p].NAME_110;var v=r[p].FILEEXT_110;var m=r[p].FILESIZE_110;var g="";if(m!="undefined"&&m!=""&&m!="null"&&m!=" "){if(m<1024*1024){g=(m/1024).toFixed(2)+"K"}else if(m>1024*1024*1024*1024){g=(m/1024/1024/1024).toFixed(2)+"G"}else{g=(m/1024/1024).toFixed(2)+"M"}}else{m="0";g="0"}var h=B(v);e("#fileListContainer").append('<div class="div1" id="div_'+c+'">'+'<table class="fileTableStyle">'+"<tr>"+'<td width="20px">'+'<input type="checkbox" name="checkBoxName" id="checkBox'+c+'" onclick ="clickCheckBox(\''+c+"',"+a+')"/>'+"</td>"+'<td width="20px" onclick ="clickFile(\''+c+"',"+a+')">'+'<div class="div2" id="count'+c+'">'+o+"</div>"+"</td>"+'<td width="20px" onclick ="clickFile(\''+c+"',"+a+')">'+h+"</td>"+"<td onclick =\"clickFile('"+c+"',"+a+')">'+'<div class="div2" name = "fileName" id="'+c+'">'+f+"."+v+"</div>"+"</td>"+'<td width="50px" onclick ="clickFile(\''+c+"',"+a+')">'+'<div class="div2">'+g+"</div>"+"</td>"+"</tr>"+"</table>"+'<input type="hidden" name ="uploaderFileRealName" id = "uploaderFileRealName'+c+'" value = "'+u+'"/>'+'<input type="hidden" name ="uploaderFileName" id = "uploaderFileName'+c+'" value = "'+f+'"/>'+'<input type="hidden" name ="uploaderFileExt" id = "uploaderFileExt'+c+'" value = "'+v+'"/>'+'<input type="hidden" name ="uploaderFileSize" id = "uploaderFileSize'+c+'" value="'+m+'"/>'+'<input type="hidden" name ="uploaderFileSort" id = "uploaderFileSort'+c+'" value="'+o+'"/>'+'<input type="hidden" name ="uploaderFileObjectid" id = "uploaderFileObjectid'+c+'" value = "'+c+'"/>'+"</div>")}}e(".div1").hover(function(){var t=e(this).attr("id");t=t.replace("div_","checkBox");if(!e("#"+t).attr("checked")){y(this)}},function(){var t=e(this).attr("id");t=t.replace("div_","checkBox");if(!e("#"+t).attr("checked")){w(this)}});if(a!="0"&&a!=0){l=WebUploader.create(t);l.on("fileQueued",function(t){var i=t.size;if(i<1024*1024){i=(i/1024).toFixed(2)+"K"}else if(i>1024*1024*1024*1024){i=(i/1024/1024/1024).toFixed(2)+"G"}else{i=(i/1024/1024).toFixed(2)+"M"}var n=t.ext;var l=B(n);o++;e("#fileListContainer").append('<div class="div1" id="div_'+t.id+'">'+'<table class="fileTableStyle">'+"<tr>"+'<td width="20px">'+'<input type="checkbox" name="checkBoxName" id="checkBox'+t.id+'" onclick ="clickCheckBox(\''+t.id+"',"+a+')"/>'+"</td>"+'<td width="20px" onclick ="clickFile(\''+t.id+"',"+a+')">'+'<div class="div2" id="count'+t.id+'">'+o+"</div>"+"</td>"+'<td width="20px" onclick ="clickFile(\''+t.id+"',"+a+')">'+l+"</td>"+"<td onclick =\"clickFile('"+t.id+"',"+a+')">'+'<div class="div2" name = "fileName" id="'+t.id+'">'+t.name+"</div>"+"</td>"+'<td width="50px" onclick ="clickFile(\''+t.id+"',"+a+')">'+'<div class="div2">'+i+"</div>"+"</td>"+"</tr>"+"</table>"+'<input type="hidden" name ="uploaderFileRealName" id = "uploaderFileRealName'+t.id+'"/>'+'<input type="hidden" name ="uploaderFileName" id = "uploaderFileName'+t.id+'"/>'+'<input type="hidden" name ="uploaderFileExt" id = "uploaderFileExt'+t.id+'"/>'+'<input type="hidden" name ="uploaderFileSize" id = "uploaderFileSize'+t.id+'" value="'+t.size+'"/>'+'<input type="hidden" name ="uploaderFileSort" id = "uploaderFileSort'+t.id+'" value="'+o+'"/>'+'<input type="hidden" name ="uploaderFileObjectid" id = "uploaderFileObjectid'+t.id+'" value = "0000"/>'+"</div>");b();e(".div1").hover(function(){var t=e(this).attr("id");t=t.replace("div_","checkBox");if(!e("#"+t).attr("checked")){y(this)}},function(){var t=e(this).attr("id");t=t.replace("div_","checkBox");if(!e("#"+t).attr("checked")){w(this)}})});l.on("uploadProgress",function(t,i){var a=e("#div_"+t.id);var n=a.find(".progress");var l=n.find(".progress-bar");if(!n.length){n=e('<div class="progress">'+'<div class="progress-bar" style="width: 0%;">'+"</div>"+"</div>").appendTo(a).find(".progress-bar");l=n.find(".progress-bar")}l.css("width",i*100+"%");if(i==1){l.html("<center>100%</center>")}else{l.html("<center>"+(i*100).toFixed(2)+"%</center>")}});l.on("uploadSuccess",function(t,i){e("#div_"+t.id).find(".progress").remove();if(i._raw==false||i._raw=="false"){l.removeFile(t);e("#div_"+t.id).remove();top.Dialog.alert("文件类型不匹配")}else{var a=decodeURI(i._raw);e("#uploaderFileRealName"+t.id).val(a.substring(0,a.lastIndexOf(".")));e("#uploaderFileName"+t.id).val(t.name.substring(0,t.name.lastIndexOf(".")));e("#uploaderFileExt"+t.id).val(a.substring(a.lastIndexOf(".")+1));e("#uploaderFileObjectid"+t.id).val("0000")}});l.on("fileDequeued",function(e){});l.on("uploadError",function(e){});l.on("uploadComplete",function(e){})}function y(t){e(t).css("background-color","#E5EBEE")}function w(t){e(t).css("background-color","white")}function b(){var t=e(parent.document.body).find("#frmright");if(!!t.prop("outerHTML")){var i=t.height()>e(window.document.body).height()?t.height():e(window.document.body).height();t.height(i)}if(parent!=top){var a=e(parent.parent.document.body).find("#frmright");if(!!a.prop("outerHTML")){a.height(e(parent.document.body).height())}}}function x(t){var i=e("#fileDelete").attr("class");if(i.indexOf("gray")!=-1){return}var a=document.getElementsByName("checkBoxName");var n=false;var r=new Array;for(var d=0;d<a.length;d++){if(a[d].checked){n=true;r.push(a[d].id.replace("checkBox","div_"))}}if(!n){top.Dialog.alert("请选中要删除的文件");return}top.Dialog.confirm("是否确定要删除选中的文件",function(){for(var t=0;t<r.length;t++){j(e("#"+r[t]));e("#"+r[t]).remove();var i=r[t].replace("div_","");if(i.length==30){F(i)}else{l.removeFile(i)}o--}a=document.getElementsByName("checkBoxName");if(a.length==0){setGray()}else{n=false;for(var t=0;t<a.length;t++){if(a[t].checked){n=true}}if(!n){setGray()}}})}function F(t){e.ajax({url:e.pathname()+"/ws/uploadForm/FileUpDownService/delFiles",type:"post",timeout:15e3,data:{objectid:t},success:function(e){},error:function(e){}})}function E(){var t=e("#fileDown").attr("class");if(t.indexOf("gray")!=-1){return}if(hasChecked()){var i=[];var a=document.getElementsByName("checkBoxName");var n="";var l="";for(var r=0;r<a.length;r++){if(a[r].checked){i.push(a[r]);var o=a[r].id.replace("checkBox","");n+=e("#uploaderFileRealName"+o).val()+"."+e("#uploaderFileExt"+o).val()+";";l+=e("#uploaderFileName"+o).val()+"."+e("#uploaderFileExt"+o).val()+";"}}if(i.length==1){var o=i[0].id.replace("checkBox","");var d=e.pathname()+"/page/common/getFileExc.jsp?objectID="+e("#uploaderFileObjectid"+o).val()+"&filename="+encodeURI(encodeURI(e("#uploaderFileRealName"+o).val()))+"."+e("#uploaderFileExt"+o).val()+"&downfilename="+encodeURI(encodeURI(e("#uploaderFileName"+o).val())+"."+e("#uploaderFileExt"+o).val());window.open(d)}else{var d="/nwyj/page/business/am/org/query/downZipFile.jsp?downfilename="+encodeURI(encodeURI(n))+"&filenames="+encodeURI(encodeURI(l));window.open(d)}}else{top.Dialog.alert("请选中要下载的文件")}}function k(){var t=e("#fileUpdate").attr("class");if(t.indexOf("gray")!=-1){return}var i=$();if(!i){return}else{var a=e(i).attr("id").replace("div_","");var n=new top.Dialog;n.Title="修改标题";n.Width=500;n.Height=100;n.URL="/nwyj/scripts/webUploader/updateTitle.html?"+e("#uploaderFileName"+a).val();n.OKEvent=function(){var t=n.innerFrame.contentWindow.document.getElementById("fileName").value;e("#"+a).text(t+"."+e("#uploaderFileExt"+a).val());e("#uploaderFileName"+a).val(t);n.close()};n.show()}}function I(){var t=e("#setUp").attr("class");if(t.indexOf("gray")!=-1){return}var i=$();if(!i){return}var a=e(i).attr("id");a=a.replace("div_","count");var n=e(i).prev().attr("id");if(e(i).prev().html()!=undefined){n=n.replace("div_","count");var l=e(i).clone(true);var r=e("#"+a).html();var o=e("#"+n).html();e(l).find("#"+a).html(parseInt(r)-1);e(l).find("#"+a.replace("count","uploaderFileSort")).val(parseInt(r)-1);e("#"+n).html(parseInt(o)+1);e("#"+n.replace("count","uploaderFileSort")).val(parseInt(o)+1);e(i).prev().before(l);e(i).remove()}else{top.Dialog.alert("现在已是最上面了,不能再上移了...")}}function D(){var t=e("#setDown").attr("class");if(t.indexOf("gray")!=-1){return}var i=$();if(!i){return}var a=e(i).attr("id");a=a.replace("div_","count");var n=e(i).next().attr("id");if(e(i).next().html()!=undefined){n=n.replace("div_","count");var l=e(i).clone(true);var r=e("#"+a).html();var o=e("#"+n).html();e(l).find("#"+a).html(parseInt(r)+1);e(l).find("#"+a.replace("count","uploaderFileSort")).val(parseInt(r)+1);e("#"+n).html(parseInt(o)-1);e("#"+n.replace("count","uploaderFileSort")).val(parseInt(o)-1);e(i).next().after(l);e(i).remove()}else{top.Dialog.alert("现在已是最下了,不能再下移了...")}}function $(){var t=document.getElementsByName("checkBoxName");var i=false,a=0,n="";if(t){for(var l=0;l<t.length;l++){if(t[l].checked){i=true;a++;n=e("#"+t[l].id.replace("checkBox","div_"))}}}if(!i){top.Dialog.alert("请选择一个文件");return false}if(a>1){top.Dialog.alert("只能选择一个文件");return false}return n}function j(t){if(e(t).next().html()!=undefined){var i=e(t).next().attr("id");i=i.replace("div_","count");var a=e("#"+i).html();e("#"+i).html(parseInt(a)-1);e("#"+i.replace("count","uploaderFileSort")).val(parseInt(a)-1);j(e(t).next())}}function B(e){var t="";e=e.toLowerCase();if(e=="doc"||e=="docx"){t='<img height="16" width="16" src="/nwyj/scripts/webUploader/images/word.png">'}else if(e=="xls"||e=="xlsx"){t='<img height="16" width="16" src="/nwyj/scripts/webUploader/images/excel.png">'}else if(e=="pdf"){t='<img height="16" width="16" src="/nwyj/scripts/webUploader/images/pdf.png">'}else if(e=="rar"||e=="zip"){t='<img height="16" width="16" src="/nwyj/scripts/webUploader/images/rar.png">'}else if(e=="avi"||e=="mov"||e=="mp4"){t='<img height="16" width="16" src="/nwyj/scripts/webUploader/images/video.png">'}else if(e=="txt"){t='<img height="16" width="16" src="/nwyj/scripts/webUploader/images/txt.png">'}else if(e=="mp3"||e=="wma"){t='<img height="16" width="16" src="/nwyj/scripts/webUploader/images/mp3.png">'}else if(e=="png"||e=="jpg"||e=="gif"||e=="jpeg"||e=="bmp"){t='<img height="16" width="16" src="/nwyj/scripts/webUploader/images/pic.png">'}else{t='<img height="16" width="16" src="/nwyj/scripts/webUploader/images/other.png">'}return t}function S(e){var t="";e=e.toLowerCase();if(e=="pdf"){t="/nwyj/page/webOffice/pdfOnline.jsp"}if(e=="doc"||e=="docx"||e=="xls"||e=="xlsx"||e=="pptx"||e=="vsd"||e=="mpp"){t="/nwyj/page/webOffice/officeOnline.jsp"}if(e=="png"||e=="jpg"||e=="gif"||e=="jpeg"||e=="bmp"){t="/nwyj/page/webOffice/img.jsp"}if(e=="txt"){t="/nwyj/page/webOffice/txt.jsp"}return t}}})})(jQuery);function clickFile(e,t){if(t==0||t=="0"){if($("#checkBox"+e).attr("checked")){$("#checkBox"+e).removeAttr("checked");if(!hasChecked()){$("#fileDown").addClass("gray");$("#read").addClass("gray")}}else{$("#checkBox"+e).attr("checked","true");$("#fileDown").removeClass("gray");$("#read").removeClass("gray")}}else{if($("#checkBox"+e).attr("checked")){$("#checkBox"+e).removeAttr("checked");if(!hasChecked()){setGray()}}else{$("#checkBox"+e).attr("checked","true");removeGray()}}}function clickCheckBox(e,t){if(t==0||t=="0"){if($("#checkBox"+e).attr("checked")){$("#fileDown").removeClass("gray")}else{if(!hasChecked()){$("#fileDown").addClass("gray")}else{$("#fileDown").removeClass("gray")}}}else{if($("#checkBox"+e).attr("checked")){removeGray()}else{if(!hasChecked()){setGray()}else{removeGray()}}}}function setGray(){$("#fileUpdate").addClass("gray");$("#fileDelete").addClass("gray");$("#fileDown").addClass("gray");$("#setUp").addClass("gray");$("#setDown").addClass("gray");$("#read").addClass("gray")}function removeGray(){$("#fileUpdate").removeClass("gray");$("#fileDelete").removeClass("gray");$("#fileDown").removeClass("gray");$("#setUp").removeClass("gray");$("#setDown").removeClass("gray");$("#read").removeClass("gray")}function hasChecked(){var e=document.getElementsByName("checkBoxName");if(e){for(var t=0;t<e.length;t++){if(e[t].checked){return true}}return false}}function hasFile(){var e=$("[name='uploaderFileName']");var t=false;var i="";$.each(e,function(e,a){i=$(a).val();if(i!=""){t=true}});return t}function addNewFile(){if($("#filetable").find("tr").length>=10){top.Dialog.alert("最多可上传五个文件",null,null,null,null);return}var e=$('<input type="file" fileWidth="400" contenteditable="false" name="fileData"/>');var t=$('<input type="button" value="删除该行" class="button"/>');var i=$('<input class="button" type="button" value="点击新增" onclick="addNewFile()"/>');var a=$('<tr><td align="right">附件&nbsp;</td><td></td><td></td></tr>');a.find("td").eq(1).append(e);a.find("td").eq(2).append(t).append("&nbsp;&nbsp;").append(i);e.render();t.render();$("#filetable").append(a);t.click(deleteBtnRow)}function deleteBtnRow(){var e=$(this);e.parent().parent().remove()}var fileListGrid=null;function getFileList(e,t){var i={listId:110,condition:"is_Del = '0' and MainId ='"+e+"'"};fileListGrid=$("#maingrid").quiGrid({columns:[{display:"文件名",name:"NAME_110",width:"52%",align:"center"},{display:"文件类型",name:"FILEEXT_110",width:"13%",align:"center"},{display:"操作",width:"30%",isAllowHide:false,align:"center",render:function(e,i,a,n){var l=$.pathname()+"/page/common/getFileExc.jsp?objectID="+e.FD_OBJECTID110+"&filename="+encodeURI(e.SAVENAME_110)+"."+e.FILEEXT_110+"&downfilename="+encodeURI(encodeURI(e.NAME_110)+"."+e.FILEEXT_110);var r=e.FILEEXT_110;if(r=="jpg"||r=="jpeg"||r=="jpe"||r=="JFIF"||r=="png"||r=="gif"||r=="bmp"||r=="dib"||r=="tiff"||r=="tif"||r=="JPG"||r=="JPEG"||r=="JPE"||r=="JFIF"||r=="PNG"||r=="GIF"||r=="BMP"||r=="DIB"||r=="TIFF"||r=="TIF"){if(t==0){return'<div class="padding_top4 padding_left5">'+'<a style="color:blue;" onclick="scanImage(\''+e.SAVENAME_110+"."+e.FILEEXT_110+"')\">查看</a>&nbsp;&nbsp;"+'<a style="color:blue" onclick="javascript:window.open(\''+l+"')\">下载</a>&nbsp;&nbsp;"+"</div>"}else{return'<div class="padding_top4 padding_left5">'+'<a style="color:blue" onclick="scanImage(\''+e.SAVENAME_110+"."+e.FILEEXT_110+"')\">查看</a>&nbsp;&nbsp;"+'<a style="color:blue" onclick="javascript:window.open(\''+l+"')\">下载</a>&nbsp;&nbsp;"+'<a style="color:blue" onclick="deleteFiles_110(\''+e.FD_OBJECTID110+"')\">删除</a>"+"</div>"}}else{if(t==0){return'<div class="padding_top4 padding_left5">'+'<a style="color:blue" onclick="javascript:window.open(\''+l+"')\">下载</a>&nbsp;&nbsp;"+"</div>"}else{return'<div class="padding_top4 padding_left5">'+'<a style="color:blue" onclick="javascript:window.open(\''+l+"')\">下载</a>&nbsp;&nbsp;"+'<a style="color:blue" onclick="deleteFiles_110(\''+e.FD_OBJECTID110+"')\">删除</a>"+"</div>"}}}}],url:$.pathname()+"/ws/uploadForm/FileUpDownService/queryFiles",params:i,width:"99.8%",checkbox:false,pageSize:5,usePager:false})}deleteFiles_110=function(e){top.Dialog.confirm("确定要删除吗?",function(){$.ajax({url:$.pathname()+"/ws/uploadForm/FileUpDownService/delFiles",type:"post",timeout:15e3,data:{objectid:e},success:function(e){top.Dialog.alert("删除成功!");fileListGrid.loadData()},error:function(e){top.Dialog.alert("删除失败!")}})})};scanImage=function(e){var t={title:"查看图片",url:$.pathname()+"/page/common/ShowPic.html?"+e,width:700,ShowCancelButton:false,height:500};$.framework.getWin(t)};var queryImageInfo=function(e,t,i){var a={listId:"110",condition:"is_Del = '0' and MainId = '"+e+"'","pager.pageNo":1};$.ajax({url:$.pathname()+"/ws/uploadForm/FileUpDownService/queryFiles",type:"post",timeout:15e3,data:a,success:function(e){sucFun(e,t,i)},error:function(e){top.Dialog.alert("删除失败!")}})};function sucFun(e,t,i){if(e.rows!=""){var a="";for(var n=0;n<e.rows.length;n++){var l=e.rows[n];var r=l.FILEEXT_110;if(r=="jpg"||r=="png"||r=="jpeg"||r=="JPG"||r=="jpe"||r=="JFIF"||r=="TIFF"||r=="dib"||r=="gif"||r=="bmp"||r=="TIF"||r=="tiff"||r=="tif"||r=="JPEG"||r=="JPE"||r=="PNG"||r=="GIF"||r=="BMP"||r=="DIB"){var o=document.createElement("div");o.innerHTML="<div id='multi_file"+n+"ParentDiv' style='float:left;margin-left:10px;'>"+"<div id='multi_file10"+n+"ImagePreView'></div>"+"<div id='multi_file10"+n+"deleteButton' style='text-align:center'></div>"+"</div>";var d=document.getElementById(t);d.appendChild(o)}}for(var n=0;n<e.rows.length;n++){var l=e.rows[n];var r=l.FILEEXT_110;if(r=="jpg"||r=="png"||r=="jpeg"||r=="JPG"||r=="jpe"||r=="JFIF"||r=="TIFF"||r=="dib"||r=="gif"||r=="bmp"||r=="TIF"||r=="tiff"||r=="tif"||r=="JPEG"||r=="JPE"||r=="PNG"||r=="GIF"||r=="BMP"||r=="DIB"){var s=$.pathname()+"/upload/"+e.rows[n].SAVENAME_110+"."+e.rows[n].FILEEXT_110;var p=document.getElementById("multi_file"+"10"+n+"deleteButton");var o=document.createElement("div");var c=$.pathname()+"/page/common/getFileExc.jsp?objectID="+l.FD_OBJECTID110+"&filename="+encodeURI(l.SAVENAME_110)+"."+l.FILEEXT_110+"&downfilename="+encodeURI(encodeURI(l.NAME_110)+"."+l.FILEEXT_110);o.innerHTML="<a style='color:blue' href='#' onclick=javascript:window.open('"+c+"')>下载</a>";p.appendChild(o);var u=document.getElementById("multi_file10"+n+"ImagePreView");var f=document.createElement("img");f.src=s;f.style.width="100px";f.style.height="100px";f.style.cursor="url("+$.pathname()+"/images/cursor/big.cur), pointer";f.savename=l.SAVENAME_110;f.fileext=l.FILEEXT_110;f.onclick=function(){scanImage(this.savename+"."+this.fileext)};u.appendChild(f)}if(r=="doc"||r=="docx"||r=="xls"||r=="xlsx"||r=="pdf"||r=="html"||r=="txt"){var v=l.NAME_110+"."+r;var m=document.getElementById(i);var c=$.pathname()+"/page/common/getFileExc.jsp?objectID="+l.FD_OBJECTID110+"&filename="+encodeURI(l.SAVENAME_110)+"."+l.FILEEXT_110+"&downfilename="+encodeURI(encodeURI(l.NAME_110)+"."+l.FILEEXT_110);m.innerHTML+="<a style='color:blue' href='#' onclick=javascript:window.open('"+c+"')>"+v+"</a><p>"}}}}function getNowFormatDate(e){var t;if(!e){t=new Date}else{t=pardate}var i="-";var a=":";var n=t.getMonth()+1;var l=t.getDate();if(n>=1&&n<=9){n="0"+n}if(l>=0&&l<=9){l="0"+l}var r=t.getFullYear()+i+n+i+l+" "+t.getHours()+a+t.getMinutes()+a+t.getSeconds();return r}function stringToDate(e,t){if(!t){t="-"}var i=e.split(t);var a=parseInt(i[0]);var n;if(i[1].indexOf("0")==0){n=parseInt(i[1].substring(1))}else{n=parseInt(i[1])}var l;if(i[2].indexOf("0")==0){l=parseInt(i[2].substring(1))}else{l=parseInt(i[1])}var r=new Date(a,n,l);return r}function showButtns1(e){var t="";if(window!=top){t=top.com.sinosoft.lz.system.user.LoginInfo.getRoleids()}else{t=window.opener.top.com.sinosoft.lz.system.user.LoginInfo.getRoleids()}$.ajax({url:$.pathname()+"/ws/button/ButtonService/getRoleButtonByRoleId",type:"post",timeout:15e3,data:{roleId:t},success:function(t){t=t.Msg.info+"";var i=e.options.toolbar;try{if(t!=null&&t!=undefined){var a=new HashMap;var n="";var l=t.split(",");for(var r=0;r<l.length;r++){a.put(l[r],l[r])}for(var r=0;r<i.items.length;r++){n=$("#"+i.items[r].id);if(a.containsKey(i.items[r].id)==true){n.parent().show()}else{n.parent().hide()}}}}catch(o){}},error:function(e){top.Dialog.alert("访问服务失败!")}})}function roleButtonArr(){var e="";if(window!=top){e=top.com.sinosoft.lz.system.user.LoginInfo.getRoleids()}else{e=window.opener.top.com.sinosoft.lz.system.user.LoginInfo.getRoleids()}var t="";$.ajax({url:"/nwyj/ws/button/ButtonService/getRoleButtonByRoleId",type:"post",async:false,data:{roleId:e},success:function(e){e=e.Msg.info+"";if(e!=null&&e!=undefined){t=e.split(",")}},error:function(e){top.Dialog.alert("访问服务失败!")}});return t}function timeStrSort(e,t,i,a){var n="";if(a=="yyyy-MM-dd HH:mm"){var l=e.split(i);l.sort(function(e,i){if(t=="desc"){return new Date(i.replace(/-/g,"/"))-new Date(e.replace(/-/g,"/"))}else{return new Date(e.replace(/-/g,"/"))-new Date(i.replace(/-/g,"/"))}});for(var r=0;r<l.length;r++){n+=l[r];if(r!=l.length-1){n+=i}}}else if(a=="HH:mm"){var l=e.split(i);for(var r=0;r<l.length;r++){l[r]="2016-01-01 "+l[r]}l.sort(function(e,i){if(t=="desc"){return new Date(i.replace(/-/g,"/"))-new Date(e.replace(/-/g,"/"))}else{return new Date(e.replace(/-/g,"/"))-new Date(i.replace(/-/g,"/"))}});for(var r=0;r<l.length;r++){l[r]=l[r].split(" ")[1];n+=l[r];if(r!=l.length-1){n+=i}}}return n}Date.prototype.dateAdd=function(interval,number){var d=this;var k={y:"FullYear",q:"Month",m:"Month",w:"Date",d:"Date",h:"Hours",n:"Minutes",s:"Seconds",ms:"MilliSeconds"};var n={q:3,w:7};eval("d.set"+k[interval]+"(d.get"+k[interval]+"()+"+(n[interval]||1)*number+")");return d};Date.prototype.Format=function(e){var t={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()};if(/(y+)/.test(e))e=e.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length));for(var i in t)if(new RegExp("("+i+")").test(e))e=e.replace(RegExp.$1,RegExp.$1.length==1?t[i]:("00"+t[i]).substr((""+t[i]).length));return e};function getIntegerTime(e,t){var i=t.substring(0,1);var a=t.split(":")[0];var n=i+t.split(":")[1];var l=new Date(Date.parse(e.replace(/-/g,"/")));var r=l.dateAdd("h",a).dateAdd("n",n).Format("yyyy-MM-dd hh:mm:ss");l=new Date(Date.parse(r.replace(/-/g,"/")));if(l.getMinutes()>30){r=l.dateAdd("n",30).Format("yyyy-MM-dd hh")}else{r=l.dateAdd("n",-l.getMinutes()).Format("yyyy-MM-dd hh")}return r+":00:00"}