236 lines
7.6 KiB
JavaScript
236 lines
7.6 KiB
JavaScript
var SAVE_TMP = false;
|
||
var bEditHtml = false;
|
||
var bEditHtmlChange = false;
|
||
var bEditHtmlChange2= false;
|
||
var oldFormValues = new Array();
|
||
var newFormValues = new Array();
|
||
var _user_validator;
|
||
|
||
$().ready(function(){
|
||
try{
|
||
setOldValue();
|
||
//绑定快捷键
|
||
jQuery.initObjectKeyArray();
|
||
}catch(e){}
|
||
});
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
function iV_allF(){
|
||
var result = true;
|
||
//alert("_user_validator="+ _user_validator);
|
||
if(_user_validator){
|
||
try{
|
||
result = $("#frmFDDataContent").validate(_user_validator).form();
|
||
}
|
||
catch(e){
|
||
alert("校验参数错误:" + e.message);
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
function setOldValue(){
|
||
oldFormValues = document.getElementById('frmFDDataContent').innerHTML;
|
||
}
|
||
function setNewValue(){
|
||
newFormValues = document.getElementById('frmFDDataContent').innerHTML;
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
function fillFormatDoc(docID,objectNo,objectType,excludeDirIds){
|
||
if(excludeDirIds==undefined) excludeDirIds="";
|
||
return AsControl.RunJsp("/AppConfig/FormatDoc/AddData.jsp","DocID="+docID+"&ObjectNo="+objectNo+"&ObjectType="+objectType+"&ExcludeDirIds="+excludeDirIds);
|
||
}
|
||
|
||
function fillFormatDocWithOpen(docID,objectNo,objectType,excludeDirIds){
|
||
var sReturn = fillFormatDoc(docID,objectNo,objectType,excludeDirIds);
|
||
if(typeof(sReturn)!='undefined' && sReturn!="" && sReturn =="SUCCESS"){
|
||
AsControl.OpenNewWin("/AppConfig/FormatDoc/FormatDocView.jsp","DocID="+docID+"&ObjectNo="+objectNo+"&ObjectType="+objectType);
|
||
}
|
||
}
|
||
|
||
function productFormatDoc(docID,objectNo,objectType,excludeDirIds){
|
||
if(excludeDirIds==undefined) excludeDirIds="";
|
||
return AsControl.RunJsp("/AppConfig/FormatDoc/ProduceFile.jsp","DocID="+docID+"&ObjectNo="+objectNo+"&ObjectType="+objectType+"&ExcludeDirIds="+excludeDirIds);
|
||
}
|
||
|
||
function previewFormatDoc(docID,objectNo,objectType,excludeDirIds){
|
||
if(excludeDirIds==undefined) excludeDirIds="";
|
||
AsControl.OpenNewWin("/AppConfig/FormatDoc/PreviewFile.jsp","DocID="+docID+"&ObjectNo="+objectNo+"&ObjectType="+objectType+"&ExcludeDirIds="+excludeDirIds+"&rand="+randomNumber(),"");
|
||
}
|
||
|
||
function scoreFormatDoc(docID,objectNo,objectType,excludeDirIds){
|
||
if(excludeDirIds==undefined) excludeDirIds="";
|
||
return AsControl.RunJsp("/AppConfig/FormatDoc/AddData.jsp","Method=7&DocID="+docID+"&ObjectNo="+objectNo+"&ObjectType="+objectType+"&ExcludeDirIds="+excludeDirIds);
|
||
}
|
||
|
||
function checkFormatDoc(docID,objectNo,objectType,excludeDirIds){
|
||
if(excludeDirIds==undefined) excludeDirIds="";
|
||
return AsControl.RunJsp("/AppConfig/FormatDoc/AddData.jsp","Method=8&DocID="+docID+"&ObjectNo="+objectNo+"&ObjectType="+objectType+"&ExcludeDirIds="+excludeDirIds);
|
||
}
|
||
|
||
function refreshFormatDoc(typeNo,objectNo,objectType,usedocid){
|
||
if(usedocid)
|
||
return AsControl.RunJsp("/AppConfig/FormatDoc/RefreshData.jsp","DocID="+typeNo+"&ObjectNo="+objectNo+"&ObjectType="+objectType);
|
||
else
|
||
return AsControl.RunJsp("/AppConfig/FormatDoc/RefreshData.jsp","TypeNo="+typeNo+"&DocID="+typeNo+"&ObjectNo="+objectNo+"&ObjectType="+objectType);
|
||
}
|
||
|
||
function importOfflineFormatDoc(){
|
||
OpenPage('/AppConfig/FormatDoc/SelUploadFile.jsp','','width=400,height=150');
|
||
}
|
||
|
||
function importOfflineModelFormatDoc(){
|
||
OpenPage('/AppConfig/FormatDoc/SelUploadModelFile.jsp','','width=400,height=150');
|
||
}
|
||
|
||
function exportOfflineModelFormatDoc(docID){
|
||
exportOfflineFormatDoc(docID,"999999999","999999999","");
|
||
}
|
||
|
||
function generateIframe(){
|
||
iframeName=randomNumber().toString();
|
||
iframeName = "frame"+iframeName.substring(2);
|
||
|
||
//modify in 2008/04/10,2008/02/14 for https
|
||
//var sHTML="<iframe name='"+iframeName+"' style='display:none'>";
|
||
var sHTML="<iframe name='"+iframeName+"' src='"+sWebRootPath+"/amarsoft.html' style='display:none'>";
|
||
|
||
document.body.insertAdjacentHTML("afterBegin",sHTML);
|
||
//alert(sHTML);
|
||
return iframeName;
|
||
}
|
||
|
||
function exportOfflineFormatDoc(docID,objectNo,objectType,excludeDirIds){
|
||
if(excludeDirIds==undefined) excludeDirIds="";
|
||
var sReturn = AsControl.RunJsp("/AppConfig/FormatDoc/ProductOfflineFile.jsp","DocID="+docID+"&ObjectNo="+objectNo+"&ObjectType="+objectType+"&ExcludeDirIds="+excludeDirIds);
|
||
if(typeof(sReturn)!='undefined' && sReturn!="" && sReturn!="FAILED"){
|
||
//alert("已生成离线文件:"+ sReturn);
|
||
var sFormName="form"+randomNumber();
|
||
var targetFrameName=generateIframe();
|
||
var sHTML = "";
|
||
sHTML+="<form method='post' name='"+sFormName+"' id='"+sFormName+"' target='"+targetFrameName+"' action="+sWebRootPath+"/servlet/view/file?CompClientID="+sCompClientID+" > ";
|
||
sHTML+="<div style='display:none'>";
|
||
sHTML+="<input name=filename value='"+sReturn+"' >";
|
||
sHTML+="<input name=contenttype value='unknown'>";
|
||
sHTML+="<input name=viewtype value='save'>";
|
||
sHTML+="</div>";
|
||
sHTML+="</form>";
|
||
document.body.insertAdjacentHTML("afterBegin",sHTML);
|
||
var oForm = document.forms[sFormName];
|
||
oForm.submit();
|
||
}
|
||
}
|
||
|
||
function exportToPdf(docID,objectNo,objectType,excludeDirIds){
|
||
if(excludeDirIds==undefined) excludeDirIds="";
|
||
var sReturn = AsControl.RunJsp("/AppConfig/FormatDoc/ProducePdf.jsp","DocID="+docID+"&ObjectNo="+objectNo+"&ObjectType="+objectType+"&ExcludeDirIds="+excludeDirIds);
|
||
if(typeof(sReturn)!='undefined' && sReturn!="" && sReturn!="FAILED"){
|
||
//alert("已生成pdf:"+ sReturn);
|
||
var sFormName="form"+randomNumber();
|
||
var targetFrameName=generateIframe();
|
||
var sHTML = "";
|
||
sHTML+="<form method='post' name='"+sFormName+"' id='"+sFormName+"' target='"+targetFrameName+"' action="+sWebRootPath+"/servlet/view/file?CompClientID="+sCompClientID+" > ";
|
||
sHTML+="<div style='display:none'>";
|
||
sHTML+="<input name=filename value='"+sReturn+"' >";
|
||
sHTML+="<input name=contenttype value='application/pdf'>";
|
||
sHTML+="<input name=viewtype value='save'>";
|
||
sHTML+="</div>";
|
||
sHTML+="</form>";
|
||
document.body.insertAdjacentHTML("afterBegin",sHTML);
|
||
var oForm = document.forms[sFormName];
|
||
oForm.submit();
|
||
}else{
|
||
alert("报告还未生成,请确认已填写报告!");
|
||
}
|
||
}
|
||
function amarCopy(){
|
||
try {
|
||
var frame = parent.frames["ObjectList"].frames["formatdoc"];
|
||
var sel = frame.document.body.createTextRange();
|
||
var oTblExport = frame.document.getElementById('als7fdall');
|
||
if (oTblExport != null) {
|
||
sel.moveToElementText(oTblExport);
|
||
sel.execCommand('Copy');
|
||
}
|
||
} catch (e) { }
|
||
}
|
||
function autoCopy(){
|
||
amarCopy();
|
||
alert("已经复制到粘贴板!");
|
||
}
|
||
function exportToWord(){
|
||
var oWD = null;
|
||
try{
|
||
oWD = new ActiveXObject('word.application');
|
||
}catch(e){
|
||
try{
|
||
oWD = new ActiveXObject('wps.application');
|
||
}catch(e2){
|
||
alert("暂不支持当前浏览器导出Word,请设置正确或更换浏览器!");
|
||
return;
|
||
}
|
||
}
|
||
oWD.Application.Visible = true;
|
||
var oDC =oWD.Documents.Add('',0,1);
|
||
var oRange =oDC.Range(0,1);
|
||
amarCopy();
|
||
oRange.Paste();
|
||
}
|
||
|
||
//——UEditor————————————————————————————————————————————————————————————————————————————————————————————
|
||
console = window.console || null;
|
||
function editor_generate(textarea_name, readonly, baseConfig){
|
||
var config = {
|
||
serverUrl:sWebRootPath+"/Frame/page/resources/ueditor/jsp/controller.jsp?CompClientID="+sCompClientID
|
||
,elementPathEnabled:false
|
||
,wordCount:false
|
||
,autoFloatEnabled:false
|
||
,enableContextMenu:false
|
||
,tableDragable:false
|
||
,imagePopup:false
|
||
,toolbars: []
|
||
};
|
||
if(baseConfig) for(var o in baseConfig){
|
||
config[o] = baseConfig[o];
|
||
}
|
||
if(readonly) config.readonly = true;
|
||
var editor = UE.getEditor(textarea_name,config);
|
||
if(!config.readonly) editor.addListener("focus", function(){
|
||
editor.destroy();
|
||
config.toolbars = [[
|
||
/*'fullscren',*/ 'source', 'undo', 'redo', 'fontfamily', 'fontsize', 'bold', 'italic', 'underline', 'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', 'selectall', 'cleardoc', 'pasteplain', 'forecolor', 'backcolor', 'insertimage', 'unlink'
|
||
]];
|
||
UE.getEditor(textarea_name,config);
|
||
});
|
||
return editor;
|
||
} |