var version = 0;// 版本号
var pwdCallBack = null;// 密码输入点击确定后回调函数
var obj22 = null;// 22类型传值对象
var shx=false;
var leftWidth="0";
var gridId=[];
//var uploadObj = null;
//var edit='';
var pic={};// 格线附件上传参数属性
var rsakey={
pubkey:"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkRupiYcKVGGUtDBDoR1t/1zm3ZtZgnte39iTJW6hlqjdY0UagKjpNiIv7J6XjtgfX7SgsR4AWnivqQHAICIvdPKfGZZzIs62OQ19MqrDTMoB/LvK5teNWhClv23WMUfRbP+EHgprT6hTw8U5apw1IB6i/y57NkLav792wiYBYRU4X45NoTaT+aiTSLFEflbfm94EXnhSS3vFkBmrZGy5BRNI8gmzafroslGx2Hk90CqlNdeKYxgZQ6xtvj+u33yrszWvPT6F9fsJT8aMjtvH050iYKRVct+x6Q7VRJgCI4MgvAexnTKdxW54YzvXCuO5bDiy5la7CgerWkTAq9dzXwIDAQAB"
};
//拼接附件url
function getAttachmentUrl(staticUrl,formid,unid,domain,dbid,isShowOrgPic,width,height,fileExt,isDownLoad){
// if (staticUrl != null && staticUrl != "") {
// if (isDownLoad) {
// return unid + "_" + dbid + "_" + formid + "_" + fileExt;
// } else {
// return domain + staticUrl;
// }
// }
width = width || 80;
height = height || 80;
isShowOrgPic = isShowOrgPic || false;
fileExt = "." + fileExt || "";
return domain + "/uploads/attachment/" + dbid + "/" + formid + "/" + unid + (isShowOrgPic ? ("_" + width + "x" + height) : "") + fileExt;
}
//31类型新增sqlWhere设置,拼接sql,在可编辑状态时调用
//dysql:select * from gfield where formid=120201 order by statisid desc, sqlWhere: formname='xxx'
//返回 select * from gfield where (formid=120201) and (formname='xxx') order by statisid desc
// by danaus 2019/12/21 16:46
function processDysqlV2(dysql,sqlWhere){
if(sqlWhere!=undefined&&sqlWhere!=""){//存在sqlWhere
var patt1=new RegExp(/where.*/i);//判断有没where部分
var whereArry=patt1.exec(dysql);
if(whereArry!=null){//表示原sql有where条件 where formid=120201 order by statisid desc
var where=whereArry[0];
dysql=dysql.replace(where,"");
patt1=new RegExp(/order by.*/i);//判断有没order by部分
var orderby=patt1.exec(where);
if(orderby!=null){//order by statisid desc
where=" where ("+where.replace(patt1,"").replace(/where/i,"")+") and ("+sqlWhere+") "+orderby[0];
}else{
where=" where ("+where.replace(/where/i,"")+") and ("+sqlWhere+") ";
}
dysql=dysql+where;
}else{//是否有order by
//直接在原sql上加sqlWhere
patt1=new RegExp(/order by.*/i);//判断有没order by部分
var orderby=patt1.exec(dysql);
if(orderby!=null){//order by statisid desc
dysql=dysql.replace(orderby,"")+" where (1=1) and ("+sqlWhere+") "+orderby[0];
}else{
dysql=dysql+" where (1=1) and ("+sqlWhere+") ";
}
}
}
return dysql;
}
function generateUUID() {
var d = new Date().getTime();
if (window.performance && typeof window.performance.now === "function") {
d += performance.now(); //use high-precision timer if available
}
var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = (d + Math.random() * 16) % 16 | 0;
d = Math.floor(d / 16);
return (c == 'x' ? r : (r & 0x3 | 0x8)).toString(16);
});
return uuid;
}
// 2类型树节点,显示图片
function createUploadDiv(colname, value) {
if ((";" + nodejs.uploadColName + ";").match(";" + colname + ";")) {
$("#uploadDiv_" + colname).empty();
var photo = $('
')
.append(
'');
$("#uploadDiv_" + colname).append(photo);
onfileiput(formId, colname, panMain[0].panInfo[colname].controltype,
"", "", nodejs.usercode, value);
picevent(colname); // 事件
$doc(colname).val(value);
}
}
/**
*下面的方法是针对9/19附件控件类型 xin 2021-5-13 09:59:58
*/
//渲染出附件界面出来
var BootstrapFileInputOption = function(id){
let o = {
e: $('#' + id + '_up'),
id:$('#'+id),
name:id,
NumberofSummary:[],//更新次数集合
option: {//属性
uploadUrl: '#', // String,用于上传处理操作的URL(通常是基于Ajax的处理)
uploadIdEvnt:$('#'+id),
language: 'zh', // 语言
uploadAsync: false, // bool是否多文件批量上传将并行异步/。默认为true
showCaption: false,//是否显示被选文件的简介
showBrowse: false,//是否显示文件浏览按钮
showBatchDownload:true,//显示批量下载按钮
showUpload: false,//是否显示上传按钮
showCancel: false,//是否显示取消按钮
showRemove: false,//是否显示移除按钮
showDrag:false,//是否显示拖动按钮
showClose: false,//是否显示关闭按钮
dropZoneEnabled: true, //是否显示拖拽区域
browseOnZoneClick: false, //布尔值,是否在点击预览区域时触发文件浏览/选择。默认为false
showUploadedThumbs: true, // 是否在预览窗口中持续显示已经上传的文件缩略图(用于ajax上传),直到按下删除/清除按钮
maxFilesNum: 10, // 上传最大的文件数量
maxFileCount: 0, // 为每个多次上载允许的最大文件数。如果设置为0,则意味着允许的文件数是无限的。默认值为0。
isNine: false, // 19类型就为false,9类型就为true,下面有判断
validateInitialCount: false, // 是否包括初始预览文件数(服务器上传文件)验证minfilecount和maxfilecount。默认为false.
overwriteInitial: true, // 是否要覆盖初始预览内容和标题设置
initialPreviewAsData:true,
allowedFileExtensions:null,//允许上传的文件扩展名列表。默认情况下设置为 null
dropZoneTitle:'点击或拖拽文件',
dropZoneClickTitle:'',
layoutTemplates : {
indicator:''//去掉上传状态图标
,actionUpload: ''//去除缩略图中文件上传操作按钮的模板
,actionDrag:''//去掉缩略图拖动图标
,footer : ''
},
//自定义按钮(权限)
otherActionButtons:''
,previewSettings: { // 设置显示的图片相同的宽度高度
image: {width: '110px', height: '110px'},
html: {width: "110px", height: "110px"},
text: {width: "110px", height: "110px"},
office: {width: "110px", height: "110px"},
gdocs: {width: "110px", height: "110px"},
video: {width: "110px", height: "110px"},
audio: {width: "110px", height: "110px"},
flash: {width: "110px", height: "110px"},
object: {width: "110px", height: "110px"},
pdf: {width: "110px", height: "110px"},
other: {width: "110px", height: "110px"}
},
previewSettingsSmall: {
image: {width: '110px', height: '110px', 'max-width': '110px', 'max-height': '110px'},
html: {width: '110px', height: '110px'},
text: {width: '110px', height: '110px'},
office: {width: '110px', height: '110px'},
gdocs: {width: '110px', height: '110px'},
video: {width: '110px', height: '110px'},
audio: {width: '110px', height: '110px'},
flash: {width: '110px', height: '110px'},
object: {width: '110px', height: '110px'},
pdf: {width: '110px', height: '110px'},
other: {width: '110px', height: '110px'}
},
preferIconicPreview: true,
previewFileIconSettings: {
'doc': '',
'xls': '',
'ppt': '',
'pdf': '',
'zip': '',
'htm': '',
'txt': '',
'mov': '',
'mp3': ''
},
previewFileExtSettings: {
'doc': function(ext) {
return ext.match(/(doc|docx)$/i);
},
'xls': function(ext) {
return ext.match(/(xls|xlsx)$/i);
},
'ppt': function(ext) {
return ext.match(/(ppt|pptx)$/i);
},
'zip': function(ext) {
return ext.match(/(zip|rar|tar|gzip|gz|7z)$/i);
},
'htm': function(ext) {
return ext.match(/(htm|html)$/i);
},
'txt': function(ext) {
return ext.match(/(txt|ini|csv|java|php|js|css)$/i);
},
'mov': function(ext) {
return ext.match(/(avi|mpg|mkv|mov|mp4|3gp|webm|wmv)$/i);
},
'mp3': function(ext) {
return ext.match(/(mp3|wav)$/i);
}
},
isNodragging:false,//自定义属性,在只读状态是否可以执行拖拽
fileActionSettings:{//用于在预览窗口中为新选择的文件缩略图设置文件操作的配置
// showDownload:false,//是否在缩略图中显示下载按钮
showUpload:false//是否在缩略图中显示上传按钮
},
// usePdfRenderer: true,//启动自定义的内部插件,false值或不设置这个属性将是默认的插件
// pdfRendererUrl: '',//'/general/pdf/web/viewer.jsp',//预览pdf格式的插件路径
initialPreview: [], // 字符串或者数组,要显示的初始预览内容
initialPreviewConfig: [], // 数组,为每个initialPreview条目(就是initialPreview中的每个预览)设置重要属性的配置
showPreview: true, // 布尔值,是否显示文件预览。默认值为true
maxFileSize: 0//允许上传的文件大小(默认为0,不限制)
},
fileInput: function () {//渲染,并且绑定事件
this.e.fileinput(this.option);
},
events:function (isGrid,g) {
let fileInputId=this.e;
let id=this.id;
let name=this.name;
let Event=this;
let datas={};
fileInputId.on("filebatchselected", function(event, files) {
// 在预览中选择并显示一批文件后触发此事件(选择结束后触发的事件)
if(!g){ // 不是格线
// 触发修改(面板有内容改动,刷新界面时候有提示)
upSub(name);
}
//触发上传功能
fileInputId.fileinput('upload');
}).on('filebatchuploadsuccess', function(event, data) {
// 此事件仅在ajax上传且文件批量上传成功之后触发
let tmp={};
let oldKey=id.val();// 旧的值
let newKey=data.response.uuid?data.response.uuid+";":""; // 新的值
if(oldKey!=""){
var keys=oldKey.split(";");
for(var i=1;i 1) {
uuid = val.key.split(";")[0];
seq = val.key.split(";")[1];
}
$.ajax({
type: "POST",
dataType: 'json',
url: '/attachment/deleteOwnerAttachment.do?type=' + val.type + '&unid=' + uuid + '&seq=' + seq, // 删除路径
success: function (data) {
let newUid = val.oldKey == "" ? "" : val.oldKey.replace(";" + seq, "");
id.val(newUid);
}
});
}
}).on('filezoomshown', function(event, params) {
//此事件在模态对用户可见后触发(将等待 CSS 转换完成)
Event.NumberofSummary=params.NumberofSummary||[];
Event.imageEvent(params);
}).on('filezoomprev', function(event, params) {
//事件在缩放预览模式下,当点击上一个导航按钮查看上一个文件时触发(也在缩放模式下按下键盘左箭头时触发)
setTimeout(function(){//这个事件不是渲染完进入,导致提前渲染图片查看器。 没什么决绝办法用setTimeout吧
Event.imageEvent(params)
},300);
}).on('filezoomnext', function(event, params) {
//该事件在缩放预览模式下,当点击下一个导航按钮查看下一个文件时触发(也在缩放模式下按下键盘右箭头时触发)。
setTimeout(function(){
Event.imageEvent(params)
},300);
});
},imageEvent:function (param) {
try {
let that=this;
isFileInputImage = new Viewer(param.modal.find('ul')[0], {
title: true, inline: true, button: false,
viewed: function (e) {// 图片渲染完后进入,旋转大图片
if(typeof isFileInputImage!='undefined' && isFileInputImage!=null){
that.imageAjax(param.modal,isFileInputImage);
}
}
});
isFileInputImage.imageCurrent = 0
isFileInputImage.view(param.viewerIndex || 0);
if(typeof isFileInputImage!='undefined' && isFileInputImage!=null){
that.imageAjax(param.modal,isFileInputImage);
}
} catch (e) {
isFileInputImage = null;
}
},imageAjax:function (modal,isfile) {
let seq = 0;
let number = this.NumberofSummary;
let image = isfile.image.currentSrc;
let i = image.split("/");
i = i[i.length - 1];
let p = i.split('@p@');
if (p.length == 2) {
seq = p[1].split('.')[0];
}
if (number.length > 0) {
for (let s = 0; s < number.length; s++) {
if (seq == number[s].seq) {
if(number[s].state==-1){//没有查看次数后隐藏
modal.find('.viewer-canvas').find('img').hide();
modal.find('.viewer-canvas').html(''+number[s].describe+'
');
}
modal.find('.kv-zoom-caption').html(number[s].fileName);
modal.find('.kv-zoom-caption').attr('title', number[s].fileName);
modal.find('.viewsNumber').html(number[s].totaViewNums);
modal.find('.downNumber').html(number[s].totaDownNums);
break;
}
}
}
}
}
return o;
}
/**
*-----end-----上面的方法是针对9/19附件控件类型 xin 2021-5-13 09:59:58
*/
/**
* 加载面板附件内容
* @param formid 功能号
* @param id 控件ID
* @param controlType 控件类型
* @param docstatus 单据状态值
* @param rowid rowId
* @param usercode 账号
* @param uuid uuId
* @param maxFileSize 上传附件大小限制值
*/
function onfileiput(formid,id,controlType,docstatus,rowid,usercode,uuid,maxFileSize){
//获取到插件基本属性
let fileInput = BootstrapFileInputOption(id);
var isReadOnly = false;
try {
// 上传附件需要的参数
var param = {};
var panelautoSave = "";//标记是否为单据
var readerUserCodes = $('#readerusercodes').val();
var uid = $('#' + id).val();
uid = uid == undefined ? "" : uid.replace(/^;+/g, "");//处理值是;;;这样1个或多个的情况
param.fieldid = id;
param.controltype = controlType;
param.formid = formid;
param.unid = (uuid == undefined ? uid : uuid);
param.maxFileSize = maxFileSize;
param.docstatus = docstatus;
param.rowid = rowid;
param.usercode = usercode;
try {
param.doccode = $('#doccode').val();
if (param.doccode == undefined) {
param.doccode = panMain[panIndex].panelAuditValue.doccode;
}
if (param.doccode && readerUserCodes != undefined && readerUserCodes != '') {
param.readerusercodes = readerUserCodes;
}
} catch (e) {
param.doccode = panMain[panIndex].panelAuditValue.doccode;
}
if (formType && (formType == 5 || formType == 9
|| formType == 15 || formType == 8
|| formType == 496 || formType == 497
|| formType == 16 || formType == 17)) {
panelautoSave = "&is16=1";
for (var i in panMain) { // 循环状态值,如果面板有这个0或1就循环下去,没有就直接跳过
if (panMain[i].picState[id] != undefined) {
var ed = panMain[i].picState[id].split(";pb#");
param.headflag = ed[0];
param.editstatus = (ed.length > 1 && ed[1] != null ? ed[1] : ed[0]);
if (param.editstatus != "") {
if ((";" + param.editstatus + ";").indexOf(";" + docstatus + ";") > -1) {
isReadOnly = false;
} else {
isReadOnly = true;
}
}
}
}
}
// 请求后台数据信息
$.ajax({
url: '/attachment/getAttachmentList.do',
type: "POST",
async: false,
data: {pant: JSON.stringify(param)},
dataType: 'json',
success: function (jsons) {
if (isReadOnly) {//只读状态时候
fileInput.option.layoutTemplates.actionDelete = '';//隐藏删除
fileInput.option.otherActionButtons = '';//隐藏权限
fileInput.option.isNodragging=true;//禁止拖拽(自定义)
}
fileInput.option.browseOnZoneClick = !isReadOnly;//是只读状态就禁用点击区域上传附件功能
fileInput.option.maxFileSize = maxFileSize;//上传大小(kb)
var encrypt = new JSEncrypt();
encrypt.setPublicKey(rsakey.pubkey);
for (var i = 0; i < jsons.length; i++) {
//表示返回的新单需要的数据,而不是附件的内容
if (jsons.length == 1 && jsons[0].isNewAttachment == 1) {
param.domain = jsons[0].domain;
param.dbid = jsons[0].dbid;
param.usercode = jsons[0].userCode;
param.username = jsons[0].userName;
break;
}
// 图片属性
if (i == 0) {
param.domain = jsons[i].domain;
param.usercode = jsons[i].userCode;
param.username = jsons[i].userName;
param.dbid = jsons[i].dbid;
}
//文件路径
let fileURL = getAttachmentUrl(jsons[i].staticUrl, jsons[i].formid,
jsons[i].unid + "@p@" + jsons[i].seq, jsons[i].domain, jsons[i].dbid,
false, 60, 60, jsons[i].orgFileType);
//文件显示信息
let title = '文件名: ' + jsons[i].originalFileName +
' \n类型: ' + jsons[i].fileType +
' \n大小: ' + jsons[i].fileSizeStr +
' \n上传者: ' + jsons[i].authorName +
' \n上传时间: ' + jsons[i].uploadTimeStr+
' \n允许查看次数: ' + (jsons[i].allowViewNums == 0?'无限制':jsons[i].allowViewNums) +
' \n已查看次数: ' + jsons[i].viewNums +
' \n允许下载次数: ' + (jsons[i].allowDownNums == 0 ? '无限制' : jsons[i].allowDownNums) +
' \n已下载次数: ' + jsons[i].downNums;
//下载地址
let Down = jsons[i].domain + "/attachment/downLoadAttachment.do?filePath=" +
jsons[i].unid + "@p@" + jsons[i].seq + "_" + jsons[i].dbid + "_" +
jsons[i].formid + "_" + jsons[i].orgFileType;
//删除地址
let deleURL = '#';
if (!isReadOnly) {//不是只读
deleURL = jsons[i].domain + '/attachment/deleteAttachmentV2.do?' +
'type=' + (controlType == 9 ? '1' : '3') + '&formid=' + param.formid +
'&doccode=' + param.doccode + '&fieldid=' + id + '&unid=' + jsons[i].unid + '&seq=' +
jsons[i].seq + '&docstatus=' + param.docstatus + '&ishd=1&usercode=' +
encodeURIComponent(encrypt.encrypt(jsons[i].authorCode)) + '&readerusercodes=' +
readerUserCodes + '&dbid=' + encodeURIComponent(encrypt.encrypt(jsons[i].dbid)) +
'&curUsername=' + encodeURIComponent(encrypt.encrypt(jsons[i].userName)) + '&curUsercode=' +
encodeURIComponent(encrypt.encrypt(jsons[i].userCode));
}
//注释,不用viewer.jsp打开pdf文件,因为用这个打开有印章的pdf,印章会被屏蔽 xin 2022-6-23 09:44:07
// if (jsons[i].fileType.toLowerCase() == 'pdf') {//pdf格式调用插件
// fileURL = jsons[i].domain + '/general/pdf/web/viewer.jsp?file=' + fileURL;
// }
if (jsons[i].orgFileType == 'doc' || jsons[i].orgFileType == 'docx' || jsons[i].orgFileType == 'xls'
|| jsons[i].orgFileType == 'xlsx' || jsons[i].orgFileType == 'ppt' || jsons[i].orgFileType == 'pptx') {
jsons[i].fileType = 'office';
fileURL = encodeURIComponent(fileURL);
}
fileInput.option.initialPreview.push(fileURL);
fileInput.option.initialPreviewConfig.push({
'caption': jsons[i].originalFileName, // 上传的图片名称
'time': jsons[i].uploadTimeStr, //上传开始时间
'name': jsons[i].authorName, //作者名称
'size': jsons[i].fileSizeStr, // 上传的图片大小
'type': jsons[i].fileType, // 上传的图片类型
'filename': jsons[i].originalFileName,//jsons[i].physicalFile, //物理文件
'filetype': jsons[i].fileType + '/' + jsons[i].orgFileType,
'title': title,//title
'key': jsons[i].unid + ';' + jsons[i].seq,//key
'seq':jsons[i].seq,
'downloadUrl': jsons[i].allowDownload ? Down : false, // true值时候设置下载地址,否则设置false不显示下载按钮
'downClick':'downFile(this,\''+jsons[i].unid+'\',\''+jsons[i].seq+'\')',//下载按钮onclick事件 xin 2022-12-2 08:40:35
'url': deleURL,// 附件删除路径
'hasZoom': jsons[i].allowView,//是否能查看
// 'hasDwn': jsons[i].allowDownload,//是否能下载
'hasDel': jsons[i].allowDelete,//是否能删除
'hasLock': jsons[i].authorCode != null && jsons[i].authorCode == param.usercode ? true : false,//是否能显示权限
'viewsNumber':jsons[i].viewNums,//查看次数
'downNumber':jsons[i].downNums//下载次数
});
}
// 附件上传路径(组装参数)
let upURL = '';
if(!isReadOnly) {//不是只读
upURL= param.domain + '/attachment/uploadAttachmentV2.do?' +
'type=' + (controlType == 9 ? '1' : '3') + '&formid=' + param.formid +
'&doccode=' + param.doccode + '&fieldid=' + id + '&rowid=' + Math.random() +
'&usercode=' + encodeURIComponent(encrypt.encrypt(param.usercode)) +
'&username=' + encodeURIComponent(encrypt.encrypt(param.username)) +
'&ishd=1' + panelautoSave + '&dbid=' + encodeURIComponent(encrypt.encrypt(param.dbid));
// '&uuid=' + uid;//$('#' + id).val();
}
fileInput.option.uploadUrl = upURL;
// 判断如果是9类型就输出,如果是19类型就不输出
if (controlType == 9) {
fileInput.option.maxTotalFileCount = 1;// 为每个多次上载允许的最大文件数。如果设置为0,则意味着允许的文件数是无限的。默认值为0。
fileInput.option.isNine = true; // 19类型就为false,9类型就为true---(忽略验证检查)
fileInput.option.validateInitialCount = true; // 是否包括初始预览文件数(服务器上传文件)验证minfilecount和maxfilecount。默认为false.
fileInput.option.overwriteInitial = false; // 是否要覆盖初始预览内容和标题设置
}
}
});
} catch (e) {
$.messager.alert("提示", "未能加载附件信息!" + e, "warning");
} finally {
// 渲染显示
fileInput.fileInput();
if (isReadOnly) {//是只读
$("#"+id+"_show_type .file-preview").css("background", "#CCC");
$("#"+id+"_show_type .file-footer-buttons").find("a").css("background", "#CCC").css("color","#6c757d");
$("#"+id+"_show_type .file-footer-buttons").find("button").css("background", "#CCC");
}
}
}
//更新下载次数
function downFile(e,unid,seq) {
let json={};
json.unid=unid;
json.seqArray=[];
json.seqArray.push(seq);
json.type="down";
$.ajax({
url: '/attachmentOa/getAllowOa.do',
type: 'POST',
data: JSON.stringify(json),
dataType: 'json',
// async: false,
contentType: 'application/json',
success: function (res) {
if (res != null && res.code == 0) {
let dat=res.data;
if(dat[0]!=null){
if((dat[0].state==-1 || dat[0].allowDownNums==dat[0].downNums) && dat[0].allowDownNums!=0){
// layui.layer.msg("你在此附件允许下载的次数已经用完");
$(e).hide();
}
}
}
}, error: function (xmlHttpRequest, textStatus, errorThrown) {
layui.layer.alert(xmlHttpRequest.responseText);
}
})
}
/******图片在图片框内按宽高比例自动缩放!!!***/
// Img:要放图片的img元素,onload时传参可用this
// maxHeight :img元素的高度,像素(图片框 最大高度)
// maxWidth:img元素的宽度,像素(图片框 最大宽度)
function AutoSize(Img, maxWidth, maxHeight) {
var image = new Image();
// 原图片原始地址(用于获取原图片的真实宽高,当标签指定了宽、高时不受影响)
image.src = Img.src;
// 当图片比图片框小时不做任何改变
if (image.width < maxWidth&& image.height < maxHeight) {
Img.width = image.width;
Img.height = image.height;
}
else{ // 原图片宽高比例 大于 图片框宽高比例,则以框的宽为标准缩放,反之以框的高为标准缩放
if (maxWidth/ maxHeight <= image.width / image.height){ // 原图片宽高比例 大于 图片框宽高比例
Img.width = maxWidth; // 以框的宽度为标准
Img.height = maxWidth* (image.height / image.width);
}
else { // 原图片宽高比例 小于 图片框宽高比例
Img.width = maxHeight * (image.width / image.height);
Img.height = maxHeight ; // 以框的高度为标准
}
}
}
// 40类型 查看图片(旧的,可放弃)
function showModalImg(value,controlType,callback){
// try{
// var pant=value.split("?")[1];
// var pants=pant.split("&");
// var pic={};
// for(var i=0;i4){
// fileExt="unknown";
// }
// if('jpge;jpg;png;gif'.indexOf(fileExt.toLowerCase())==-1){//不是图片后缀的
// callback();//执行回调
// return true;//如果不是图片的后缀那就返回true xin 2021-7-15 10:11:50
// }
// if(seq!=null&&seq!=undefined&&seq!=""){
// unid=unid+"@p@"+seq;
// }
// results=getAttachmentUrl(pic.staticUrl,pic.formid,unid,pic.domain,pic.dbid,false,80,80,fileExt);
// }
// }else{
// return false;
// }
// $("#bimg").attr("src",results);
// document.getElementById("uploadForm").style.display="none";
// document.getElementById("bimg").style.display="inline-block";
// //AutoSize($("#bimg"),600,500);
// return true ;
// }catch(e){alert(e);}
}
// 格线执行 附件 进入的函数,主要是9类型(旧的,可以放弃)
function showModal(id,value){
// var controlType = 9; // 专用于格线
// var readerUserCodes = $('#readerusercodes').val();
// // 加载图片需要的属性(固定ID)
// let fileInput = BootstrapFileInputOption('fileUpload');
// // 定义属性,拆分值
// document.getElementById("uploadForm").style.display = "block";
// document.getElementById("bimg").style.display = "none";
// var picPer = [];
// var authBtn = '';
// var c;
// var unid;
// var seq;
// pic = {};
// var pant = value.split("?")[1];
// var pants = pant.split("&");
// for (var i = 0; i < pants.length; i++) {
// c = pants[i].split("=");
// pic[c[0]] = c[1];
// }
// var encrypt = new JSEncrypt();
// encrypt.setPublicKey(rsakey.pubkey);
// var picpant = {};
// try {// 赋值
// if ((pic.uuid == undefined || pic.uuid == '') && (pic.oldgrid != null &&
// pic.oldgrid != undefined && pic.oldgrid != '')) {
// var unid = pic.oldgrid.split(';');
// pic['uuid'] = unid[0] + ";" + unid[1];//uuid+seq
// if (unid.length >= 4 && unid[0].indexOf('.do') != -1) {
// if (unid.length > 4) {
// if (unid[unid.length - 2] != null && !isNaN(unid[unid.length - 2])) {
// controlType = 19;//存在多个seq,表示是多附件
// }
// }
// pic['uuid'] = unid[1] + ";" + unid[2];//uuid+seq
// }
// picpant['unid'] = pic['uuid'].replace("|48|48|", "");
// }
// picpant['fieldid'] = pic["fieldid"];
// picpant['controltype'] = controlType;
// picpant['formid'] = pic["formid"];
//
// picpant['ishd'] = pic['ishd'];
// var strIs = "";
// if (pic["is1"] != undefined && pic["is1"] != "") {
// strIs = "&is1=" + pic['is1'] + "&ishd=" + pic['ishd'];
// } else if (pic["is8"] != undefined && pic["is8"] != "") {
// strIs = "&is8=" + pic['is8'] + "&ishd=" + pic['ishd'];
// } else {
// strIs = "&ishd=" + pic['ishd'];
// }
// picpant['docstatus'] = pic["docstatus"] == undefined ? 0 : pic["docstatus"];
// picpant['rowid'] = pic["rowid"];
// picpant['usercode'] = pic["usercode"];
// picpant['doccode'] = pic["doccode"];
// picpant['headflag'] = (pic['ishd'] == 0) ? 1 : 0;
// try {
// if (picpant.doccode == undefined) {
// picpant['doccode'] = $('#doccode').val();
// if (picpant.doccode == undefined)
// picpant.doccode = panMain[panIndex].panelAuditValue.doccode;
// }
// if (picpant['doccode'] && readerUserCodes != undefined && readerUserCodes != '') {
// picpant['readerusercodes'] = readerUserCodes;
// }
// } catch (e) {
// picpant.doccode = "";
// }
// try {
// var picpants = JSON.stringify(picpant);
// } catch (e) {
// alert(e);
// }
// // 图片显示的方法
// $.ajax({
// url: '/attachment/getAttachmentList.do',
// type: "POST",
// async: false,
// data: {pant: picpants},
// dataType: 'json',
// success: function (data) {
// try {
// var jsons = data;
// if ((pic.uuid != undefined && pic.uuid != '') || (pic.oldgrid != null &&
// pic.oldgrid != undefined && pic.oldgrid != '')) {
// for (var i = 0; i < jsons.length; i++) {
// // 图片属性
// if (picpant.usercode == "") {
// picpant.usercode = jsons[i].userCode;
// }
// if (i == 0) {
// picpant.username = jsons[i].userName;
// picpant.dbid = jsons[i].dbid;
// picpant.domain = jsons[i].domain;
// }
// var deleToken = 'type=' + (controlType == 9 ? '1' : '3') + '&formid=' + picpant.formid + '&doccode=' + picpant.doccode + '&fieldid=' + id + '&unid=' + jsons[i].unid + '&seq=' +
// jsons[i].seq + '&docstatus=' + picpant.docstatus + '&ishd=' + picpant.ishd + '&usercode=' + encodeURIComponent(encrypt.encrypt(jsons[i].authorCode)) + '&readerusercodes=' + readerUserCodes + '&dbid=' + encodeURIComponent(encrypt.encrypt(jsons[i].dbid)) + '&curUsername=' + encodeURIComponent(encrypt.encrypt(jsons[i].userName)) + '&curUsercode=' + encodeURIComponent(encrypt.encrypt(jsons[i].userCode));
// fileInput.option.initialPreviewConfig.push({
// 'caption': jsons[i].originalFileName, // 上传的图片名称
// 'filename': jsons[i].physicalFile, // 上传文件名
// 'time': jsons[i].uploadTimeStr, //上传开始时间
// 'name': jsons[i].authorName, //作者名称
// 'size': jsons[i].fileSizeStr, // 上传的图片大小
// 'type': jsons[i].fileType, // 上传的图片类型
// 'key': jsons[i].unid +';'+jsons[i].seq,
// 'downloadUrl': jsons[i].domain + "/attachment/downLoadAttachment.do?filePath=" + getAttachmentUrl(jsons[i].staticUrl, jsons[i].formid, jsons[i].unid + "@p@" + jsons[i].seq, "", jsons[i].dbid, false, 60, 60, jsons[i].orgFileType, true),
// 'url': jsons[i].domain + '/attachment/deleteAttachmentV2.do?' + deleToken
// }); // 附件删除路径
//
// // 判断是否需要权限,如果要那么就加载权限按钮属性
// if (jsons[i].authorCode != null && jsons[i].authorCode == picpant.usercode) { // authorCode 作者
// authBtn = '' +
// ''; // 授权按钮
// }
// // 添加图片权限
// picPer.push({
// key: jsons[i].seq, isAllowDelete: jsons[i].hasDelete, isAllowUpdate: jsons[i].hasUpdate,
// isAllowDownload: jsons[i].hasDownload, authBtn: authBtn
// });
// // 图片
// let t='文件名:' + jsons[i].originalFileName +
// ' \n类型:' + jsons[i].fileType +
// ' \n大小:' + jsons[i].fileSizeStr +
// ' \n上传者:' + jsons[i].authorName +
// ' \n上传时间:' + jsons[i].uploadTimeStr ;
// // let img='';
// let img=getAttachmentUrl(jsons[i].staticUrl, jsons[i].formid,
// jsons[i].unid + "@p@" + jsons[i].seq, jsons[i].domain, jsons[i].dbid,
// false, 60, 60, jsons[i].orgFileType);
// fileInput.option.initialPreview.push(img);
// }
// var upToken = 'type=' + (controlType == 9 ? '1' : '3') + '&formid=' + picpant.formid
// + '&doccode=' + picpant.doccode + '&fieldid=' + picpant.fieldid
// + '&usercode=' + encodeURIComponent(encrypt.encrypt(picpant.usercode)) + '&username=' + encodeURIComponent(encrypt.encrypt(picpant.username)) + '&dbid=' + encodeURIComponent(encrypt.encrypt(picpant.dbid))
// + strIs + '&rowid=' + picpant.rowid + '&uuid=' + (picpant.unid == undefined ? "" : picpant.unid);
// fileInput.option.uploadUrl = picpant.domain + '/attachment/uploadAttachmentV2.do?' + upToken; // 附件上传路径
// // $('#'+id).val(pic.unid);
// fileInput.option.otherActionButtons='';
// fileInput.option.maxFileCount = 1; // 为每个多次上载允许的最大文件数。如果设置为0,则意味着允许的文件数是无限的。默认值为0。
// fileInput.option.isNine = true;
// fileInput.option.validateInitialCount = true; // 是否包括初始预览文件数(服务器上传文件)验证minfilecount和maxfilecount。默认为false.
// fileInput.option.overwriteInitial = false; // 是否要覆盖初始预览内容和标题设置
// } else {
// fileInput.option.maxFileSize = jsons[0].allowMaxFileSize;//从后台取数回来 by danaus 2020/8/7 10:47
// fileInput.option.initialPreviewConfig.push({
// 'caption': '', // 上传的图片名称
// 'filename': '', // 上传文件名
// 'time': '', //上传开始时间
// 'name': '', //作者名称
// 'size': '', // 上传的图片大小
// 'type': '', // 上传的图片类型
// 'key': ''
// });
// fileInput.option.uploadUrl = pic.domain + '/attachment/uploadAttachmentV2.do?type=' + (controlType == 9 ? '1' : '3') + '&formid=' + pic.formid
// + '&doccode=' + pic.doccode + '&fieldid=' + pic.fieldid
// + '&usercode=' + encodeURIComponent(encrypt.encrypt(pic.usercode)) + '&username=' + encodeURIComponent(encrypt.encrypt(pic.username)) + '&dbid=' + encodeURIComponent(encrypt.encrypt(pic.dbid))
// + strIs + '&rowid=' + pic.rowid + '&uuid=' + (pic.unid == undefined ? "" : pic.unid); // 附件上传路径
// fileInput.option.maxFileCount = 1; // 为每个多次上载允许的最大文件数。如果设置为0,则意味着允许的文件数是无限的。默认值为0。
// fileInput.option.isNine = true;
// fileInput.option.validateInitialCount = true; // 是否包括初始预览文件数(服务器上传文件)验证minfilecount和maxfilecount。默认为false.
// fileInput.option.overwriteInitial = false; // 是否要覆盖初始预览内容和标题设置
// }
// fileInput.destroy();// 销毁文件输入控件并恢复到普通的本地文件输入
// fileInput.fileInput();// 加载图片显示
// // others();
// // picBtn(picPer, fileInput.option, id); //fileInput.option 控制审核后不能删除
// } catch (e) {
// alert(e);
// }
// }
// });
// } catch (e) {
// alert(e);
// }
}
var uploadKey=[];
//图片上传触发事件
function picevent(id,isGrid,obj){
//绑定事件 xin 2022-2-26 10:06:25
BootstrapFileInputOption(id).events(isGrid,obj);
// if(typeof(myFresh)=="undefined") myFresh={};
// myFresh.mygrid=obj;
// $('#'+id+'_up').on('fileuploaderror', function(event, data, msg) {
// var temp=data;
//
// }).on('filesuccessremove', function(event, id) { // 使用缩略图删除按钮删除成功上传的缩略图后,会触发此事件
// var unid=$('#'+id ).find("img").attr("unid");
// var val=JSON.parse(unid);
// var uuid=val.key.split(";")[0];
// var seq=val.key.split(";")[1];
// $.ajax({
// type:"POST",
// dataType:'json',
// url:'/attachment/deleteOwnerAttachment.do?type='+val.type+'&unid='+uuid+'&seq='+seq, // 删除路径
// success: function(data){
// var newUid=val.oldKey==""?"":val.oldKey.replace(";"+seq,"");
// $('#'+val.filedId).val(newUid);
// }
// });
// // $.each(uploadKey,function(i,val) {
// // if(val.md5==img_md5){
// // var uuid=val.key.split(";")[0];
// // var seq=val.key.split(";")[1];
// // $.ajax({
// // type:"POST",
// // dataType:'json',
// // url:'/attachment/deleteOwnerAttachment.do?type='+val.type+'&unid='+uuid+'&seq='+seq, // 删除路径
// // success: function(data){
// // var newUid=val.oldKey==""?"":val.oldKey.replace(";"+seq,"");
// // $('#'+val.filedId).val(newUid);
// // }
// // });
// // }
// // });
//
// }).on('filepredelete', function(event, params) { // 在删除initialPreview内容集中的每个缩略图文件之前触发此事件
// event.stopImmediatePropagation();
// if(!confirm("您确定要删除吗?")){
// //处理不删除图片操作
// return false;
// }
//
// }).on('filedeleted', function(event, key) { // 在删除initialPreview内容集中的每个缩略图文件之后触发此事件
// if(isGrid=='grid'){ // 格线
// try{
// if(myFresh.mygrid){
// var grid=myFresh.mygrid.id;
// var obj="";
// grid.SetValue(myFresh.mygrid.row, myFresh.mygrid.col,obj,0);
// grid.RefreshCell(myFresh.mygrid.row, myFresh.mygrid.col);
// }
// }catch(e){alert(e);}
// }else{ // 面板
// var va =$('#'+id).val();
// va = va.replace(";"+key,"");
// if(va.indexOf(";")<0) va="";
// $('#'+id).val(va);
// panMain[panIndex].isChange =1; //解决110101上传后删除附件不成功,而出现多个序号的问题
// }
// $('#'+id+'_up').fileinput({uuidkey:key});
//
// }).on('filebatchuploadsuccess', function(event, data, previewId, index) { // 此事件仅在ajax上传且文件批量上传成功之后触发
// // get_filemd5sum(data,id);
// // console.log("tmp.md5:"+tmp.md5);
// // tmp.md5=$.md5(data.reader.result);
// var tmp={};
// var oldKey=$('#'+id).val(); // 旧的值
// var newKey=data.response.uuid?data.response.uuid+";":""; // 新的值
// if(oldKey!=""){
// var keys=oldKey.split(";");
// for(var i=1;i0){
// // modeal.show();
// // params.modal.find(".file-zoom-content").find("img").hide();
// // }
// }).on('filezoomshown', function(event, params) { // 在模态框已被用户看到之后触发此事件(将等待CSS转换完成)
// $(".modal-backdrop").attr("class", "");
// $(".modal-content").css( "zIndex", 999999);
//
// }).on('filebrowse', function(event) { // 单击文件浏览按钮以打开文件选择对话框时触发此事件
// try{
// if(typeof(fileupload_config)=="undefined"){
// if(myFresh.mygrid){
// var grid=myFresh.mygrid.id;
// if(grid.Cols[myFresh.mygrid.col].CanEdit==0){
// event.preventDefault=false;
// return false;
// }
// }
// }else{
// if(!fileupload_config.browseOnZoneClick){
// // if(typeof(event.preventDefault)!=="function")
// event.preventDefault();
// // event.preventDefault=false;
// // return false;
// }
// }
// }catch(e){
// alert(e);
// }
//
// }).on('fileuploaderror', function(event, data, msg) { // 此事件仅在ajax上传时触发,并且主要针对ajax上传时遇到上载或文件输入验证错误
// var form = data.form, files = data.files, extra = data.extra,
// response = data.response, reader = data.reader;
// });
}
function get_filemd5sum(data, id) {
var tmp = {};
var file = data.files[0];
var tmp_md5;
var blobSlice = File.prototype.slice || File.prototype.mozSlice
|| File.prototype.webkitSlice,
// file = this.files[0],
chunkSize = 8097152, // Read in chunks of 2MB
chunks = Math.ceil(file.size / chunkSize), currentChunk = 0, spark = new SparkMD5.ArrayBuffer();
var fileReader = data.reader;
fileReader.onload = function(e) {
// console.log('read chunk nr', currentChunk + 1, 'of', chunks);
spark.append(e.target.result); // Append array buffer 追加数组缓冲器
currentChunk++;
var md5_progress = Math.floor((currentChunk / chunks) * 100);
console.log(file.name + " 正在处理,请稍等," + "已完成" + md5_progress + "%");
// var handler_info = document.getElementById("handler_info");
// var progressbar = document.getElementsByClassName("progressbar")[0];
// handler_info.innerHTML = file.name + " 正在处理,请稍等," + "已完成" +
// md5_progress + "%"
// progressbar.value = md5_progress;
if (currentChunk < chunks) {
loadNext();
} else {
tmp.md5 = spark.end();
console.log("-------------tmp.md5:" + tmp.md5)
var oldKey = $('#' + id).val(); // 旧的值
var newKey = data.response.uuid ? data.response.uuid : ""; // 新的值
if (oldKey != "") {
var keys = oldKey.split(";");
for (var i = 1; i < keys.length; i++) {
newKey = newKey.replace(";" + keys[i], "");
}
}
tmp.key = newKey;
tmp.type = data.response.type;
tmp.filedId = id;
tmp.oldKey = oldKey;
uploadKey.push(tmp);
var unid = data.response.uuid ? data.response.uuid : "";
this.uuidkey = unid;
$('#' + id).val(unid);
if (myFresh.mygrid) { // 格线
var grid = myFresh.mygrid.id;
var obj = data.response.path ? data.response.path : "";
grid.SetValue(myFresh.mygrid.row, myFresh.mygrid.col, obj, 0);
grid.RefreshCell(myFresh.mygrid.row, myFresh.mygrid.col);
}
}
};
fileReader.onerror = function() {
console.warn('oops, something went wrong.');
};
function loadNext() {
var start = currentChunk * chunkSize, end = ((start + chunkSize) >= file.size) ? file.size
: start + chunkSize;
fileReader.readAsArrayBuffer(blobSlice.call(file, start, end));
}
loadNext();
}
function others() {
// 上传控件的一些控制
$(".file-footer-caption").css("display", "none");
$(".file-thumbnail-footer").css("height", "10px");
$(".glyphicon-download").css("padding-top", "6px");
$(".btn").css("padding", "0px");
$(".fileinput-remove").css("display", "none"); // 隐藏控件右上角的清除按钮(叉号)
$(".glyphicon-move").css("display", "none"); // 隐藏控件的移动按钮
try {
$(".file-caption-main").css("display", "none");
} catch (e) {
alert(e);
}
}
function getReturnValue(str) {
if (window.ActiveXObject) { // IE
window.returnValue = str;
window.close();
} else { // 非IE
if (window.opener) {
window.opener.setValue(str); // 直接调用父页面的方法来操作处理
window.close();
}
}
}
// 9 ,19控件授权
function authorize(unid,seq){
// parent.addTab('',9763,10,'wherePan=unid=\''+unid+'\' and seq='+seq);
}
function mylockFile(e){
let u = $(e).data("key");
if (u != null) {
let s = u.split(";");
if (s.length == 2) {
layerIndex = layer.open({
type: 2,//可传入的值有:0(信息框,默认)1(页面层)2(iframe层)3(加载层)4(tips层)。 若你采用layer.open({type: 1})方式调用
shade: 0.1,
title: "维护附件上传权限", //不显示标题
area: ['1280px', '650px'], //宽高
content: '/general/fileInputoa/uploadPromission.html?unid='+s[0]+'&seq='+s[1],
cancel: function () {
layer.closeAll();
},
success: function(){
}
});
// parent.addTab('', 9763, 10, 'wherePan=unid=\'' + s[0] + '\' and seq=' + s[1]);
}
}
}
// 权限按钮属性显示
function picBtn(picPer,uploadObj,fieldid) {
// var findObj = "#uploadDiv_" + fieldid + " .kv-file-remove";
// var delBtn = $(findObj); // 删除
// for (var i = 0; i < delBtn.length; i++) {
// var dataKey = $(delBtn[i]).attr("data-key");
// for (var j = 0; j < picPer.length; j++) {
// if ((dataKey == picPer[j].key && !picPer[j].isAllowDelete)
// || !uploadObj.browseOnZoneClick) { //控制删除按钮在最终审核后,所有人都不能进行删除
// $(delBtn[i]).hide();
// }
// }
// }
// var downBtn = $(".glyphicon-download"); // 下载
// for (var i = 0; i < downBtn.length; i++) {
// var a = $(downBtn[i]).parent();
// var href = $(a).attr("href");
// if (href == null)
// continue;
// for (var j = 0; j < picPer.length; j++) {
// if (href.indexOf(";" + picPer[j].key) >= 0) {
// if (!picPer[j].isAllowDownload) {
// $(a).hide();
// }
// if (picPer[j].authBtn != "") {
// $(a).before(picPer[j].authBtn)
// }
// }
// }
// }
}
function openNewDoc() {
var flag = checkSession();// session失效后弹出登录框,flag为true时表示已经失效
if(flag){
return;
}
openByType($(this).attr("docType"));
}
function openByType(type) {
try {
if(type==undefined) type=$("#tpNewDoc").attr("docType");
parent.addTab('', formId, type);
} catch (e) {
alert(e);
showWindow("/app" + spellPath + formId + "/" + type + "/index.jsp");
}
}
function openOldXlsImport(title,doccode){
//旧版本调用
try {
var url = "/general/xlsImport.jsp";
url+="?title="+title+"&doccode="+doccode+"&formid="+formId+"&formType="+formType;
parent.changFrame = inThisFrame;
parent.addTab(formId + "数据导入管理", '', '', '', url);
} catch (e) {
window.open(url);
}
}
$( function() {
try{top.myFresh.formType=formType;top.myFresh.panel[top.tabindex]=formType;}catch(e){}//关闭页卡排除的窗体类型。
$("#loading").css("opacity", '0.8');
if (typeof (formId) != "undefined") {
if (parent.getTabSelected!=undefined&&parent.getTabSelected().panel!=undefined&&parent.getTabSelected().panel("options").title.indexOf("加载中") != -1) {
var title = $("title").html() + "--" + formId;
parent.resetTabName(title);
}
}
$("#tpNewDoc,#tpDocList").click(openNewDoc);
$.getScript("/js/index/query.js"); // 加载查询js
setTimeout( function() {
closeLoading();
}, 400);
$("#otherFormat").click(function(){
var flag = checkSession(); // session失效后弹出登录框,flag为true时表示已经失效
if(flag){
return;
}
var url = "/general/report.jsp?formId=" + formId + "&formType="
+ formType;
try {
parent.addTab(formId + "报表格式管理", '', '', '', url);
} catch (e) {
window.open(url);
}
moreWindowClose(); // 2、3类型更多按钮的关闭事件
});
$("#importXls").click(function() {
var url = "/general/xlsImport1.jsp";
var title = $('#title_top').html();
var doccode = $('#doccode').val();
doccode = (doccode != null ? doccode : "");
url += "?title=" + title + "&doccode=" + doccode + "&formid=" + formId + "&formType=" + formType;
try {
var xlsContent = layer.open({
type: 2,
title: '',
maxmin: false,
skin: 'layui-layer-molv',
shadeClose: true, //点击遮罩关闭层
area: ['700px', '350px'],
content: url
});
} catch (e) {
openOldXlsImport(title, doccode);
}
});
$("#tpbuild").click( function() {
var flag = checkSession();//session失效后弹出登录框,flag为true时表示已经失效
if(flag){
return;
}
var fid = $("#formid").val();
if (undefined == fid || fid == null || fid == "") {
$.messager.alert("操作提示", "请输入功能号!","warning");
return;
}
try {
parent.addTab("生成" + fid, "", "", "", "/buildv2.do?formID=" + fid);
} catch (e) {
}
});
$("#tpselect").click( function() { // 选择按钮
var flag = checkSession(); // session失效后弹出登录框,flag为true时表示已经失效
if(flag){
return;
}
if (2 == formType || 20 == formType) {
$(".simpleTree").find(".active").dblclick(); // 获取返回值在simple.tree.js文件执行
} else {
try {
mygrid.buttonClicked();
} catch (e) {
}
}
});
$("#func").menu( {
onShow : function() {
setBackGournd4ie6("#func");
},
onHide : function() {
hideBackGournd4ie6();
}
});
$("#print").menu( {
onShow : function() {
setBackGournd4ie6("#print");
},
onHide : function() {
hideBackGournd4ie6();
}
});
// parent.openByFormId({formId:9802,formType:9901});
});
function setBackGournd4ie6(id) {
var iframe = $("#bg4ie6");
if (null == iframe.html()) {
iframe = $(
"")
.appendTo($("body"));
}
var off = $(id).offset();
var h = $(id).height() + 5;
var w = $(id).width();
var t = off.top;
var l = off.left;
iframe.css( {
width :w,
height :h,
top :t,
left :l
}).show();
}
function hideBackGournd4ie6() {
$("#bg4ie6").hide();
}
var self_datafields=""; // 返回自表字段的值
// f:功能号 t:功能类型 sf:自身字段 lf:外表字段 lk:为1时执行存储过程,0显示界面,3弹出层
// sd:自表字段 ld:外表字段 isp: ef:where条件语句 mes:提示信息
// clo:1表示关闭
function funcLink(f, t, sf, lf, lk, sd, ld, isp, ef, mes, ref, clo, autoSave,sortid,messageTip) {
var flag = checkSession(); // session失效后弹出登录框,flag为true时表示已经失效
if(flag){
return;
}
showLoading();
self_datafields=sd;
// lqc
if(typeof(f)=="string" && f.toLowerCase()=="formid" && formId!="" && typeof(formId)=="number" ){
f=formId;
}
// end
// 为了兼容以前代码,先判断是否存在以;分隔。没有则按新的处理方式,以@p@分隔
// by danaus 2017-8-21
var sfs =null;
var lfs =null;
var split=";";
if(sf.indexOf("@p@")>0) split="@p@";
lfs=lf.split(";"); // 字段分隔固定用;
sfs=sf.split(split);
if (sfs.length != lfs.length) {
$.messager.alert('警告', "请检查外表字段与自身字段是否设置正确!", 'error');
return;
}
if (mes&&mes.indexOf("&") != -1 && t == "22") {
if (typeof (mygrid) != "undefined") {
var rows = mygrid.getFieldForNew();
var strTi = mes;
var lit = new Array()
var str1 = "";
var tv = "";
var ti = 0;
while (strTi.indexOf("&") != -1) {
strTi = strTi.substring(strTi.indexOf("&") + 1);
if (mes.indexOf("&") != -1) {
str1 = strTi.substring(0, strTi.indexOf("&"));// .trim()
if (str1 != "") {
lit[ti] = str1;
ti++;
strTi = strTi.substring(strTi.indexOf("&") + 1);
}
}
}
for (var i = 0; i < lit.length; i++) {
tv = getValue((lit[i]).toLowerCase(), null, rows[0]);
mes = mes.replace("&" + lit[i] + "&", tv);
}
}
}
if (mes && $.trim(mes) != "") { // 有提示信息
//$.messager.defaults = { ok: "是", cancel: "否" };
$.messager.confirm('提示', mes, function(r) {
if (r) {
funcLink$(f, t, sfs, lfs, lk, sd, ld, isp, ef, ref, clo,
autoSave, sortid, messageTip, mes);
$('.panel-tool-close').show();
}else {
closeLoading(); //更新客户状态的取消
$('.panel-tool-close').show();
}
}, "warning");
$('.panel-tool-close').hide(); //取消更新客户状态的弹出框红叉 yang 2020-04-26
} else {
funcLink$(f, t, sfs, lfs, lk, sd, ld, isp, ef, ref, clo, autoSave,sortid,messageTip);
}
// 系统消息
if(messageTip!=null && messageTip.indexOf(",")!=-1){
var value=messageTip.split(",");
if(value[1]=="message"){
$.post("/usrReaded.do",{"messid":value[0]});
// $.messagerTip.close();
}
}
//moreWindowClose(); // 2、3类型更多按钮的关闭事件
}
function funcLink$(f, t, sfs, lfs, lk, sd, ld, isp, ef, ref, clo, autoSave, sortid, messageTip, mes) {
if (isp && isp == "1") {
showPwd(f, t, function () {
funcLink$$(f, t, sfs, lfs, lk, sd, ld, ef, ref, clo, autoSave, sortid, messageTip, mes);
});
} else {
funcLink$$(f, t, sfs, lfs, lk, sd, ld, ef, ref, clo, autoSave, sortid, messageTip, mes);
}
}
var savedExecFunclink;
function funcLink$$(f, t, sfs, lfs, lk, sd, ld, ef, ref, clo, autoSave, sortid, messageTip, mes) {
savedExecFunclink = null;
if (t == "22") {
// autoSave=='1'是要先执行保存
if (typeof (autoSave) != 'undefined' && '1' == autoSave) {
var param = arguments;
if (typeof (sortid) != 'undefined' && (formType == "16" || formType == "5")) {
savedFunclink16 = param[0] + ";" + param[1] + ";" + sortid + ";taobao";
save(2);
} else {
savedExecFunclink = $(function () {
execProc(param[0], param[1], param[2], param[3], param[4],
param[8], param[9], messageTip, mes);
});
}
} else {
execProc(f, t, sfs, lfs, lk, ref, clo, messageTip, mes);
}
} else {
// autoSave=='1'是要先执行保存
if (typeof (autoSave) != 'undefined' && '1' == autoSave) {
var param = arguments;
savedExecFunclink = $(function(){
funclink$$$(param[0], param[1], param[2], param[3], param[4],
param[5], param[6], param[7], param[8], param[9]);
});
} else {
var lfsStr=lfs.join(","); // 把传进来的外表字段(数组类型)跟自表字段(数组类型)转换成字符串
var sfsStr=sfs.join(",")
var _={}
_.formParm=ld; // 外表字段
_.toParm=sd; // 自表字段
if(typeof(mygrid)!="undefined"){
try{
mygrid.setGridInfoTOPop(_,mygrid);
}catch(e){
}
}
funclink$$$(f, t, sfs, lfs, lk, sd, ld, ef, ref, clo,messageTip);
}
}
}
function prossDate(key,mygrid,rows,k) {
try{
key = key.toLowerCase();
if(mygrid.Cols[key].Type&&mygrid.Cols[key].Type=="Date"&&DateToString){//增加处理日期问题,时间有可能是用毫秒数表示的情况,by danaus 2019/11/25 15:45
rows[k][key]=DateToString(rows[k][key],mygrid.Cols[key].Format);
}
}catch(e){}
}
function funclink$$$(f, t, sfs, lfs, lk, sd, ld, ef, ref, clo,messageTip) {
var rows=[];
var num=0;
if (typeof (mygrid) != "undefined") {
rows=mygrid.getFieldForNew();
if(rows.length==0){
num=1;
}else {
num = rows.length;
}
}else{ // 没格线则取0;
num=1;
}
var temp = null;
var strPam="";
for (i = 0; i < sfs.length; i++) {
var selfStr ="";
for(var k=0;k 0 ? ("wherePan=" + strPam) : "";
if (ef != undefined && ef != null && ef != "")
wp = (wp == "") ? "wherePan=" + encodeURI(encodeURI(ef)) : wp + " and "
+ encodeURI(encodeURI(ef));
try {
closeLoading();
parent.addTab("", f, t, wp);
} catch (e) {
closeLoading();
showWindow("/app" + spellPath + f + "/" + t + "/index.jsp?" + wp, "");
}
}
var execParams = []; // 22窗体传值 lk表示是否打开界面或弹出层
function execProc(f, ft, sfs, lfs, lk, ref, clo, exec, mes) { // 储存过程
var paramVa = "";
var t = null;
var rows = [];
var num = 0;
if (typeof (mygrid) != "undefined") {
rows = mygrid.getFieldForNew();
if(rows.length==0){
num=1;
}else {
num = rows.length;
}
} else { // 没格线则取0;
num = 1;
}
var sp=";";
for(var s=0;s0){
sp="@p@";
break;
}
}
for(var k=0;k0) paramVa += "こ"; // 把用来隔开字段的逗号(,)替换成こ 逗号的使用率高 做字段的隔开不好 有时出现错误 所以改成こ 2014-9-26
for (i = 0; i < sfs.length; i++) {
if(i>0) paramVa += sp;
if ($.trim(sfs[i]) == "") {
continue;
}
if (sfs[i].indexOf("@") != -1 || $.trim(sfs[i]) == "") {
paramVa += sfs[i];
continue;
}
var key=sfs[i];
try{
if (typeof (mygrid) != "undefined") {
prossDate(key, mygrid, rows, k);
}
}catch(e){}
t = getValue(key,null,rows[k]);
if(typeof t!="string"&&typeof t!="number"&&t==false){
//没选中格线行数据,返回不执行
closeLoading();
return;
}
if (t==null||t=="null")
t = sfs[i];
if(isNaN(t)&&t.indexOf(";")>0){ // 当内容存在;情况,需要替换 by danaus
sp="@p@";
paramVa=paramVa.replace(/;/g,sp); // 把之前的;也替换
}
paramVa += t;
}
}
if(typeof (formId)!="undefined") {
paramVa = paramVa.replaceAll("@formid", formId).replaceAll(
"'", "");
}
var temp=paramVa.split("こ");
var st="";
var ln=sfs.length;
for(var m=0;m0) st+=sp;
for(var v=0;v0) st+=",";
st+=(ss[m]==""?"\'\'":ss[m]); // 为""串时需要增加单引号
}
}
paramVa=st;
if (lk == "1") { // 直接执行存储过程
//注释,执行自定义.do在后台执行,不需要在这里处理 xin 2020-5-14 11:01:40
exec = ((exec != undefined && exec.indexOf(".do") != -1) ? exec : "/execProcV2.do");///execProc.do
/*
$.post(exec, {
"formid" :f,
"param" :paramVa,
"disableDuplicateSubmitUUID":systemUuid.uuid //by danaus 2019/11/22 11:12
}, function(data) {
procCallBack(data, ref, clo);
});
*/
$.ajax({
type: 'post',
url: exec,
data: {
"formid": f,
"param": paramVa,
"disableDuplicateSubmitUUID": systemUuid.uuid //by danaus 2019/11/22 11:12
},
beforeSend: function (XMLHttpRequest) {
//ShowLoading();
if (mes != null && mes != "" && $.messager.progress != undefined) {
$.messager.progress({
title: '提示',
msg: '处理数据',
text: '努力中...',
interval: '300'
});
}
},
success: function (data, textStatus) {
procCallBack(data, ref, clo);
if (mes != null && mes != ""&& $.messager.progress != undefined) {
$.messager.progress('close');
}
},
complete: function (XMLHttpRequest, textStatus) {
// $.messager.progress('close');
},
error: function () {
//请求出错处理
if (mes != null && mes != ""&& $.messager.progress != undefined) {
$.messager.progress('close');
}
}
});
} else {
var stemp=paramVa.split("こ");
var values =stemp[0].split(sp); // 只取第一个,因为新实现已可以选多行传值, paramVa.split(";");// 通过功能连接打开22类型直接通过execParams数组赋值
parent.changFrame = inThisFrame;
var t = [];
var param = "";
for (i = 0; i < values.length; i++) {
t = [ lfs[i], values[i] ];
execParams[i] = t;
var value=values[i]; // isNaN(values[i])?(values[i].match(/&/)?values[i].replace(/&/,"@W@"):values[i]):values[i];
if(value.indexOf("?")>0) value=value.replace("?","#p#");//处理有问号时 url传递有问题
param += lfs[i].toLowerCase() + "=" +value+ "&";
}
if (param.length > 0) {
param = param.substring(0, param.length - 1);
}
//if (param.indexOf("@") != -1) { // 去掉调用,因为在加载页面已实现
// replaceSessonKey(param, function(d) {
// parent.addTab('', f, ft, d);
// });
// } else {
if(lk==3){//弹出层
var url = "/app" + spellPath + f + "/" + ft + "/index.jsp?"+encodeURIComponent(param);
// hotkey.js
showLayerGrid(url,ref);
}else{
closeLoading();
parent.addTab('', f, ft, param);
}
// }
}
closeLoading();
}
function procCallBack(data, ref, clo) {
if (data.state != null && data.state == 0) {
let info = data.data;
if (info == null) {
$.messager.alert('提示', '返回错误:' + info, "info");
refreshOrClose(ref, clo);
return;
}
let doc = info.linkdocinfo;
let msg = info.memo;
if (doc == null || doc == '') {
var msgInfo = "";
if(msg!=null) {
msgInfo = msg.split("@p@");
if(msgInfo.length==2){
//有跳转参数
$.messager.alert('提示', msgInfo[0], "info", function () {
redirect( msgInfo[1]);
});
return;
}
}
$.messager.alert('提示', msg || '进程处理完毕', "info", function () {
if (typeof (savedExecFunclink) == "function") {
location.reload();
}
refreshOrClose(ref, clo);
return;
});
}else {
if (msg != null && msg != '') {
$.messager.alert('提示', msg, "info", function () {
redirect(doc);
});
return;
}else {
redirect(doc);
}
}
} else if (data.state != null && data.state == -1) {
//错误信息
let msg = data.error || data.msg;
if (data.data != null && data.data.isuuid) {
$.messager.show({
title: '提示',
msg: msg,
showType: 'show',
//timeout:3,
style: {
right: '',
top: document.body.scrollTop + document.documentElement.scrollTop,
bottom: ''
}
});
return;
}
if(msg!=null) {
var msgInfo = msg.split("@p@");
if(msgInfo.length==2){
//有跳转参数
$.messager.alert('提示', msgInfo[0], "info", function () {
redirect( msgInfo[1]);
});
return;
}
}
$.messager.alert('提示', msg || '出现错误', "info");
} else {
try{
var obj=JSON.parse(data);
$.messager.alert('提示', obj.msg, "info");
}catch (e) {
$.messager.alert('提示', data || '状态无法识别:' + data.state, "info");
}
}
// if(data.state!=null && data.state==0){
//
//
// }else if(data.state!=null && data.state==-1){
//
// }else{
//
// }
// if (data == null || data == "") {// 什么也没返回
// $.messager.alert('提示', "进程处理完毕.", "info", function () {
// if (typeof (savedExecFunclink) == "function") {
// location.reload();
// }
// refreshOrClose(ref, clo);
// }
// );
// } else {
// try {
// if (data.error != null && data.error != '') {
// $.messager.alert('提示', data.error, "info");
// return;
// }
// // if (data.replace(/\s+/g, "") === "(null)") {
// // $.messager.alert('提示', data, "info");
// // return;
// // }
// // data = JSON.parse(data);
// // if ((data.msg != undefined && data.msg == "") && (data.data == undefined || data.data == "")) {
// if (data.data == null || data.data == "") {
// $.messager.alert('提示', "进程处理完毕.", "info", function () {
// if (typeof (savedExecFunclink) == "function") {
// location.reload();
// }
// refreshOrClose(ref, clo);
// }
// );
// }
// } catch (e) {
// alert(data.data.memo || data);
// refreshOrClose(ref, clo);
// return;
// }
// try {//by danaus 2019/11/22 17:42
// if (data.state = -1 && JSON.parse(data.data).isuuid) {
// $.messager.show({
// title: '提示',
// msg: data.msg,
// showType: 'show',
// //timeout:3,
// style: {
// right: '',
// top: document.body.scrollTop + document.documentElement.scrollTop,
// bottom: ''
// }
// });
//
// return;
// }
// } catch (e) {
// }
// // let memo=data.data.memo;
// // if (memo!=null && memo!="") {
// // alert(memo);
// // if (data.state != null && data.state == 0) {
// // refreshOrClose(ref, clo);
// // }
// // }
// // if (data.msg!=undefined&&data.msg != ""&&data.msg!=null&&data.msg!="null"){
// // alert(data.msg);
// // if(data.state!=undefined&&data.state==0) {
// // refreshOrClose(ref, clo);
// // }
// // return;
// // }
// // if (data.msg!=undefined&&data.msg != ""&&data.msg!=null&&data.msg!="null"){
// // alert(data.msg);
// // if(data.state!=undefined&&data.state==0) {
// // refreshOrClose(ref, clo);
// // }
// // // return;
// // }
// if (data.state == 0 && data.data != null) {
// refreshOrClose(ref, clo);
// let msg = data.data.memo;
// $.messager.alert('提示', msg, "info", function () {
// redirect(data.data.linkdocinfo);
// });
// return;
// }
// // if (data.data!=undefined&&data.data!=null&&data.data !=""&&data.data !="null") {
// // redirect(data.data);
// // return;
// // }
// }
}
function redirect(info) {
if(info.indexOf("buildv2.do") > -1){ // 生成页面 by danaus 13-6-28 增加返回生成页面和打开多个功能号多张单的功能
$.get(info);
}else if(info.indexOf("open.callBack|") ==0){//处理第三方返回的数据,打开另一个页卡
var url=info.replace("open.callBack|","");
// showLayerGrid(url,1,'900px','600px');
var perContent= layer.open({
type: 2,
title: '德立测量单信息',
maxmin: false,
skin: 'layui-layer-molv',
shadeClose: true, //点击遮罩关闭层
area : ['1300px' , '800px'],
content: url //'/app/67/0/cnzh/110502/1/index.jsp'
});
layer.full(perContent);
}else{ // 打开页面
var tt=info.split("|");
for(var i=0;i';
// }
// }});
// }catch(e){
// options.msg='加载信息失败【错误信息:'+e+'】
';
// }
// $.messager.show(options);
//}
function showLoading() {
$("#loading").show();
}
function closeLoading() {
$("#loading").hide();
}
/** ***************************************** */
Object.extend = function(destination, source) {
for ( var property in source) {
destination[property] = source[property];
}
return destination;
}
var myapp = function(o) {
this.options = {
url :"", // 你要打开的页面url
vArguments :"window", // 你要向打开的页面传递的数据
dialogWidth :500, // 打开窗口的宽度
dialogHeight :500, // 你打开窗口的高度
center :"yes", // center: {yes | no | 1 | 0 }:窗口是否居中,默认yes,但仍可以指定高度和宽度。
help :"no", // {yes | no | 1 | 0 }:是否显示帮助按钮,默认yes
resizable :"yes", // {yes | no | 1 | 0 } [IE5+]:是否可被改变大小。默认no
status :"yes", // {yes | no | 1 | 0 } [IE5+]:是否显示状态栏。默认为yes[
// Modeless]或no[Modal]。
scroll :"yes", // { yes | no | 1 | 0 | on | off }:指明对话框是否显示滚动条。默认为yes。
callBack :false
};
Object.extend(this.options, o || {});
}
myapp.prototype = {
openNewWin : function(url) {
var options = this.options;
var l = (screen.availWidth - options["dialogWidth"]) / 2;
var h = (screen.availHeight - options["dialogHeight"]) / 2;
var sp = "dialogTop:" + h + "px;dialogLeft:" + l + "px;dialogWidth:"
+ options["dialogWidth"] + "px;dialogHeight:"
+ options["dialogHeight"] + "px;center:" + options["center"]
+ ";help:" + options["help"] + ";resizable:"
+ options["resizable"] + ";status:" + options["status"]
+ ";scroll:" + options["scroll"];
var newWin = null;
if(window.showModalDialog!=undefined){
newWin = window.showModalDialog(options["url"],options["vArguments"], sp);
var call = options["callBack"];
if (typeof call == "function") { // 调用 数据处理函数
call(newWin);
}
}else{
window.open(options["url"],options["vArguments"], "height="+options["dialogHeight"]+",width="+options["dialogWidth"]+",top=300,left=350");
}
// var newWin = window.showModalDialog(options["url"],
// options["vArguments"], sp);
// var call = options["callBack"];
// if (typeof call == "function") {// 调用 数据处理函数
// call(newWin);
//}
},
setOptions : function() {
}
}
/** *************************************************************** */
function encodeURL(url) {
try {
url = parent.encodeURL(url);
} catch (e) {
}
return url;
}
function encodeText(t) {
try {
t = parent.encodeText(t);
} catch (e) {
}
return t;
}
// 为String类添加replaceAll函数
String.prototype.replaceAll = function(AFindText, ARepText) {
raRegExp = new RegExp(AFindText, "g");
return this.replace(raRegExp, ARepText)
}
Array.prototype.del = function(n) { // 为数组添加删除元素的函数
if (n < 0)
return this;
else
return this.slice(0, n).concat(this.slice(n + 1, this.length));
}
function replaceSessonKey(str, callback) { // 替换session值
$.post("/replaceSessionKey.do", {
"paramter" :str
}, function(data) {
callback(data);
});
}
function replacePageValue(str) { // 替换页面值
var list = new Array();
var i = 0;
var temp = null;
var postion = 0;
while (str.indexOf("&", i) != -1) {
i = str.indexOf("&", i) + 1;
postion = str.indexOf("&", i);
if (postion == -1)
break;
temp = str.substring(i, postion);
i = postion + 1;
list.push(temp);
}
for (i = 0; i < list.length; i++) {
temp = getValue(list[i]);
str = str.replaceAll("&" + list[i] + "&",
(temp == null || temp == "null") ? list[i] : temp);
}
return str;
}
function getValue(str,format,row) { // 获取页面值
var t;
try {
t = getDoc(str.toLowerCase(), ".value");
} catch (e) {
t=undefined; // by danaus 出现异常赋值 作为判断识别
}
if(t==null){ // 只有是这种情况才需要继续向下查找 by danaus 原则:如果页面上有这个字段定义,不管它是什么值,都把它替换,如果没有这个字段,就继续向下查找,直到没有 则不用替(传什么就是什么)
if (typeof (mygrid) != "undefined") {
try {
if(row==undefined){
var tempRow=mygrid.getFristRow(1);//再判断一次,以确定这个字段是否存在于表格,存在才需要提示
if(tempRow!=null&&tempRow[str.toLowerCase()]!=undefined) {
alert("请从表格选中需要执行的行");
return false;
}
}
var d=t; // 保存原值
if(row!=undefined){
t = (row[str.toLowerCase()+"Link"]!==undefined)?row[str.toLowerCase()+"Link"]:((row[str.toLowerCase()]==undefined)?null:row[str.toLowerCase()]);
}else{
t=mygrid.getField(str.toLowerCase());
}
if (t==null&&d==null) return str;
} catch (e) {
return str;
}
}
return t;
}else{
if(t=='null'){t="";}
return t;
}
}
function centerPopup(ctype, callback) { // 2确认 3通过驳回
if (typeof (createPopupPwd) != 'function') {
$.getScript("/js/pwd/inputPwd.js", function() {
createPopupPwd(formId, ctype, callback);
});
} else {
createPopupPwd(formId, ctype, callback);
}
}
var hq={
createPopSelect:function(fid, cfid, doccode, callback) {
if (typeof (openLeaderSelect) != 'function') {
$.getScript("/js/selectLeader/selectLeader.js", function() {
openLeaderSelect(fid, cfid, doccode, callback);
});
} else {
openLeaderSelect(fid, cfid, doccode, callback);
}
}
}
//报表打印
function printButtonLink(formid, reportid, format, param, formtype,
Warnnessage, isDirectPrinter, isSelectPrinter, formats, isFont,isbeforerefreshcontent) {
var flag = checkSession(); // session失效后弹出登录框,flag为true时表示已经失效
if(flag){
return;
}
var Warn =function(){ // 打印前抛出的信息
var json=JSON.parse(Warnnessage.replace(/'/g, "\""));
if(json.parameters != ""){
var temp=json.parameters.split(";");// getSymbol(Warnnessage,'&');
var war=[];
for(var i in temp){
war.push(getDoc(temp[i],'.value'));
}
json.parameters=war.join(";");
}
// else{
// return confirm(Warnnessage);
// }
var warbol=false;
$.ajax({url:'/printReport.do?m=Warnnessage',data:json,type:"POST",async:false,dataType:'json',
success:function(r) {
if(r.state==0){
if(confirm(r.msg)){
warbol=true;
}
} else{
warbol=true;
}
}});
return warbol;
}
if (Warnnessage == "" || Warn()) {
var proParam = "";
if ($.trim(param) != "") {
if (param.indexOf("@formid") != -1) {
param = param.replaceAll("@formid", formId);
}
var temp = param.split(";");
for (i = 0; i < temp.length; i++) { // 循环获取报表设置参数的值,从面板和格线里面获取。 2014-10-25
var temp2 = temp[i].split("=");
if (temp2.length < 2) {
if (temp2.length == 1 && temp2[0] == "")
continue;
$.messager.alert("操作提示", formid + "报表参数配置有误:" + param,"warning");
return;
}
var t = null;
var rows=[];
var num=0;
if (typeof (mygrid) != "undefined") {
rows=mygrid.getFieldForNew();
if(rows.length==0){
num=1;
}else {
num = rows.length;
}
}else{ // 没格线则取0;
num=1;
}
proParam += temp2[0]+"=";
var tempx=(temp2[1].replaceAll("&", "")).toLowerCase();
for(var k=0;k0) proParam += ","; // 多个值的时候用逗号(,)隔开。
if ($.trim(tempx) == "") {
continue;
}
t = getValue(tempx.toLowerCase(),null,rows[k]);
if (t==null)
t = tempx;
proParam += t; // 组装值
}
proParam +=";";
}
proParam = proParam.substring(0, proParam.length - 1);
proParam = encodeURI(encodeURI(proParam)); // 对参数进行编码。(进行二次编码)
}
// var servlet = "/" + format.toLowerCase() + ".do?"
var servlet="/printReport.do?m="+format.toLowerCase()
var doccode = getDoc("doccode", ".value");//只取表头 by danaus 2022/8/17 11:10 getValue('doccode');
var url = "formId=" + formid + "&reportId=" + reportid + "¶meter=" + proParam+";"
+ "&p=" + Math.round(Math.random() * 100000);
//html方法打印
if (format.toLowerCase() == "html") {
parent.addTab("flash打印", "", "", "", encodeURL("/swf.jsp?parm="
+ url.replaceAll("=", "_pb").replaceAll("&", "_fen")
+ "&format=" + format + "&reportId=" + reportid
+ "&formId=" + formid + "&formtype=" + formtype
+ "&doccode=" + doccode + "&print=" + isDirectPrinter
+ "&Formats=" + formats));
return false;
}
if(isbeforerefreshcontent==1){
//执行更新密码的程序
$.ajax({url:'/printReport.do?m=updatepwd',
data:{'formId':formid,'doccode':doccode},
type:"POST",
async:false,
dataType:'json',
success:function(r) {
if(r.state==-1){
$.messager.alert("操作提示", r.msg,"warning");
}
}
});
}
//如果谷歌浏览器高于50版本才执行最新打印方式否则执行旧版打印方式
if(format.toLowerCase() == "pdf" && getChromeVersion()>50){
//执行pdf打印,添加一个页卡显示。
//viewer.jsp是pdfjs提供的加载pdf文件的容器 -xin 2020-6-12 15:00:30
parent.addTab("PDF报表打印", "", "", "", "/general/pdf/web/viewer.jsp?file="+encodeURL(servlet
+"&"+ url)+"&formId="+formid+"&formType="+formtype+"&reportId="+reportid
+"&printFormat="+format+"&doccode="+doccode+"¶meter="+proParam+"&isDirectPrinter="+isDirectPrinter);
return false;
}
//执行pdf打印,添加一个页卡显示。
parent.addTab(format + "打印", "", "", "", encodeURL(servlet +"&"+url));
//更新打印次数
$.post("/printReport.do?m=number", {
"formId" :formid,
"formType" :formtype,
"reportId" :reportid,
"printFormat" :format,
"doccode" :doccode,
"parameter":proParam
},function(r){
if(r.state==-1){
$.messager.alert("操作提示", r.msg,"warning");
}
});
}
}
//获取谷歌浏览器版本
function getChromeVersion() {
var arr = navigator.userAgent.split(' ');
var chromeVersion = '';
for(var i=0;i < arr.length;i++){
if(/chrome/i.test(arr[i]))
chromeVersion = arr[i]
}
if(chromeVersion){
return Number(chromeVersion.split('/')[1].split('.')[0]);
} else {
return false;
}
}
function getSymbol(sql,split){ // 获取有符号的字段
var splitLength=split.length;
//List list=new ArrayList();
var i=0;
var postion=0;
var list = new Array();
while(sql.indexOf(split,i)!=-1){
i=sql.indexOf(split,i)+splitLength;
postion=sql.indexOf(split, i);
if(postion==-1)break;
var temp=getDoc(sql.substring(i,postion),'.value');
var tefu=sql.substring(i-1,postion+1);
sql=sql.replace(tefu,temp);
i=postion+splitLength;
}
return sql;
}
function getReportPage(fid, rptid, fun) {
$.post("/reportGetPage.do", {
"formId" :fid,
"reportId" :rptid
}, function(d) {
if (typeof fun == "function")
fun(d);
});
}
function recentFilesTo() {
if (typeof formId != "undefined" && typeof formType != "undefined") {
var url = "/recentfiles.do";
var formname = document.title;
var query_string = document.URL;
query_string = (query_string.indexOf("?") == -1) ? "" : query_string
.substring(query_string.indexOf("?") + 1);
$.post(url, {
"formid" :formId,
"formtype" :formType,
"formname" :formname,
"query_string" :query_string
}, '');
}
}
function getDocURL(isNext) {
var doccode = doc('doccode').value;
panIndex = "0";
$.post("/getDoc.do", {
"t_doc" :isNext,
"doccode" :doccode,
"where" :"",
"tUrl" :document.URL
}, function(data) {
if (data != null && data != "") {
location.href = data;
} else {
alert(data);
}
});
}
var postToThis = null; // 接受字段 父页面
var panelToPost = null; // 所需字段 子页面
var inThisFrame = "";
var inChangFrame = "";
var C_Grid = "";
var ispop="";
$( function($) {
if (typeof parent.getIframeAttr != 'undefined') {
inThisFrame = parent.getIframeAttr("id");
inChangFrame = parent.getIframeAttr("pframe");
panelToPost = parent.getIframeAttr("paneltopost")!=undefined?parent.getIframeAttr("paneltopost").split(";"):"";
postToThis = parent.getIframeAttr("posttothis")!=undefined?parent.getIframeAttr("posttothis").split(";"):"";
C_Grid = parent.getIframeAttr("t_grid");
}
//recentFilesTo();
});
// 【帮助】按钮事件函数,点击打开该功能的帮助页面
function openHelpPage(tabtitle)
{
var flag = checkSession(); // session失效后弹出登录框,flag为true时表示已经失效
if(flag){
return;
}
// 获取帮助文件所在目录路径
var a = location.href;
a=a.replace(/(.+\/).*$/g, '$1');
//alert(tabtitle);
//var tabtile=.getElementById("tab_title").value;
// 组合路径并在tab打开页面
try {
//alert("1");
var url=a+"help.jsp";
//alert(url);
parent.addTab(tabtitle+"-"+formId+"-帮助", formId, '','', url);
} catch (e) {
alert(e); // window.open("help.jsp");
}
}
//选择按钮的隐藏和显示
$(function(){
$("#tpselect").hide();
if ((C_Grid != undefined && C_Grid != "" && eval('(' + C_Grid + ')').toP != "" && eval('(' + C_Grid + ')').toP != "null")
|| $.trim(postToThis).length > 0 || self_datafields != "") {
$("#tpselect").show();
}
parent.numId = ""; // 设置单号的值
})
// TW添加
function showrestmenu(){
var offset = $('#showRestmenuDiv').offset()
var top = parseInt(offset.top+$('#showRestmenuDiv').height()+5);
if(isTopFixed()) {//固定头部用到 xin 2020-11-10 10:54:20
top=67;
}
$('#restmenuDiv').css({"top":top,"left":offset.left});
$('#restmenuDiv').show();
}
function restmenuclose(){
$('#restmenuDiv').hide();
}
// 打开搜索框和更多
$(function(){
if (navigator.userAgent.match(/iPad|iPhone|Android/i)){
$("#showRestmenuDiv").toggle(function(){
$("#restmenuDiv").bind('touchstart',function(){
showrestmenu();
})
},function(){
if($('div').hasClass("restmenuDiv")){
restmenuclose();
}
});
}
$('#selectinfo').mousedown(function(){
var flag = checkSession(); // session失效后弹出登录框,flag为true时表示已经失效
if(flag){
return;
}
$('#selectDiv').show();
})
$('#selectinfo').mouseup(function(){
$('#queryValue').focus();
})
// 按下回车键执行的函数,先解除绑定,再绑定。解决事件累加而执行二次
$('#queryValue').unbind('keydown').keydown(function(event){
if(event.keyCode == 13){
tw.simpConfirm(); // query.js里面的一个方法
windowClose();
}
})
//更多里面的收藏按钮 -xin 2020-6-23 16:39:45
// if(typeof(formId)!='undefined'){
// try{
// var Evt= $('#layoutIcon');
// $.post('/setIconMenu.do',{'formid':formId},function(data){
// Evt.linkbutton({
// iconCls: (data.state==1?'icon-scok':'icon-scno'),
// text:(data.state==1?'已添加':'添加'),
// title:'为此功能号添加到图标菜单',
// plain:true
// });
// },'json');
// Evt.bind('click',function(){
// alert('进入收藏');
// })
// }catch(e){}
// }
})
function showselectDiv(){
$('#queryValue').focus();
}
// 2、3类型搜索确认事件
function selectSimpConfirm(){
tw.simpConfirm();//query.js里面的一个方法
windowClose();
}
// 2、3类型搜索确认事件
function selectSimpConfirm2(){
tw.confirm2();//query.js里面的一个方法
windowClose();
}
// 2、3类型搜索弹出事件
function select(){
$('#selectDiv').window('open');
}
// 2、3类型搜索的关闭事件
function windowClose(){
$('#selectDiv').dialog('close');
}
// 2、3类型更多按钮弹出事件
function moreSelect(){
var offset = $('#showRestmenuDiv').offset();
var top = parseInt(offset.top+$('#showRestmenuDiv').height()+5);
$('#restmenuDiv').window({"top":top,"left":offset.left});
$('#restmenuDiv').window('open');
}
// 2、3类型更多按钮的关闭事件
function moreWindowClose(){
$('#restmenuDiv').dialog('close');
}
// 设置头部标题的高度
$(function(){
var a = $("#title_top").html();
if(a!=null && typeof($('#top2').val())!="undefined"){
$('#top2').layout('panel', 'north').panel('resize',{height:68});
$('#top2').layout('resize');
}
})
// 窗体类型为20的头部标题的高度设置
function formtype(){
var a = $("#title_top").html();
if(a!=null && typeof($('#top20').val())!="undefined"){
$('#top20').layout('panel', 'north').panel('resize',{height:110});
// $('#h_all').layout('panel', 'north').panel('resize',{height:68});
$('#top20').layout('resize');
//$('#h_all').layout('resize');
}else{
//$('#h_all').layout('panel', 'north3').panel('resize',{height:0});
$('#h_all').layout('panel', 'north').panel('resize',{height:33});
$('#h_all').layout('resize');
}
}
// 系统消息
var flag=false;
function funB(){
var init = $.cookie(userCode);
if(init==null){
$.cookie(userCode,flag);
}
if( $.cookie(userCode)=="false"){
$.post("/messageTip.do",function(data){
var message = data.message;
if(message!=""){
$.messagerTip.lays(300, 220);
$.messagerTip.show(0, message);
flag= $("input[name='isTip']").is(":checked");
$.cookie(userCode,flag,{expires: 1})
}
setTimeout(funB, 300000); // 5分钟调用一次
},"json")
}
}
function isChecked(){
flag= $("input[name='isTip']").is(":checked");
$.cookie(userCode,flag);
}
function checkSession(){
var flag = false;
$.ajax({
type : "post",
url : "/checkSession.do",
async : false,
dataType: "json",
success : function(data){
if(data.status=="fail"){
if($.cookie("dbid")!=null&&$.cookie("dbid")!=""){
parent.deskTopShow('重新登录','/sessionFail.jsp',400,220,'');
flag=true;
}else{ // 不存在cookie,会出错,所以直接返回login页面
location.href="/login.jsp";
}
}
}
});
return flag;
}
function gridSave(){
var flag = checkSession();
if(flag){
return;
}else{
showLoading();
mygrid.save('',function(){
closeLoading();
})
}
}
// 重启服务后生成功能号
$(function(){
$.post("/getRealUrl.do",function(data){
if(data.error=="true"){
alert(data.info);
}else{
if(data.formId!=""){ // 获取需要重新生成的功能号
if(data.formId=="all"){
// addTab('一键生成','','','','/buildv2.do?m=a','',{isFlowChart:true})
$.post('/buildv2.do?m=a');
}else{
$.post('/buildv2.do?m=a',{'list':data.formId});
}
// 将需要生成 的功能号进行清空
$.post('/property.do',{'formId':''});
}
}
},'json')
})
function checkVersion(){
setTimeout(checkVersion, 86400000);
setTimeout(checkVersion2, 86400000);//24小时调用一次
}
function checkVersion2(){
parent.deskTopShow('版本升级','/versionUpdate/isupdate.jsp?active=zhudong',550,520,'')
}
// 测试$.post
function testfunc(){
$.ajaxError($.post("treeData.jsp"));
}
// 根据单据报表设置的状态显示于隐藏
function reportsdiv(dj,doctaout){
try{
var ent=$('.ReportStatus');
if(ent !=undefined){
$('.ReportStatus').each(function(i){
var status=$(this).data('status')+'';
status=status.split(';');
if(status.indexOf(doctaout)==-1 && status[0]!=""){
$(this).remove();
}
})
}else{
var djs=dj.substring(0,dj.length-1).split("#");
for(var j=0;j>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}function o(t){for(var e=0;0!=t;)t&=t-1,++e;return e}var h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function c(t){var e,i,r="";for(e=0;e+3<=t.length;e+=3)i=parseInt(t.substring(e,e+3),16),r+=h.charAt(i>>6)+h.charAt(63&i);for(e+1==t.length?(i=parseInt(t.substring(e,e+1),16),r+=h.charAt(i<<2)):e+2==t.length&&(i=parseInt(t.substring(e,e+2),16),r+=h.charAt(i>>2)+h.charAt((3&i)<<4));0<(3&r.length);)r+="=";return r}function f(t){var e,i="",r=0,n=0;for(e=0;e>2),n=3&s,r=1):1==r?(i+=a(n<<2|s>>4),n=15&s,r=2):2==r?(i+=a(n),i+=a(s>>2),n=3&s,r=3):(i+=a(n<<2|s>>4),i+=a(15&s),r=0))}return 1==r&&(i+=a(n<<2)),i}var l,p=function(t,e){return(p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)};var g,d=function(t){var e;if(void 0===l){var i="0123456789ABCDEF",r=" \f\n\r\t \u2028\u2029";for(l={},e=0;e<16;++e)l[i.charAt(e)]=e;for(i=i.toLowerCase(),e=10;e<16;++e)l[i.charAt(e)]=e;for(e=0;e>16,r[r.length]=n>>8&255,r[r.length]=255&n,s=n=0):n<<=6}}switch(s){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:r[r.length]=n>>10;break;case 3:r[r.length]=n>>16,r[r.length]=n>>8&255}return r},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(t){var e=v.re.exec(t);if(e)if(e[1])t=e[1];else{if(!e[2])throw new Error("RegExp out of sync");t=e[2]}return v.decode(t)}},m=1e13,y=function(){function t(t){this.buf=[+t||0]}return t.prototype.mulAdd=function(t,e){var i,r,n=this.buf,s=n.length;for(i=0;ie&&(t=t.substring(0,e)+b),t}var w,D=function(){function i(t,e){this.hexDigits="0123456789ABCDEF",t instanceof i?(this.enc=t.enc,this.pos=t.pos):(this.enc=t,this.pos=e)}return i.prototype.get=function(t){if(void 0===t&&(t=this.pos++),t>=this.enc.length)throw new Error("Requesting byte offset "+t+" on a stream of length "+this.enc.length);return"string"==typeof this.enc?this.enc.charCodeAt(t):this.enc[t]},i.prototype.hexByte=function(t){return this.hexDigits.charAt(t>>4&15)+this.hexDigits.charAt(15&t)},i.prototype.hexDump=function(t,e,i){for(var r="",n=t;n>u&1?"1":"0";if(s.length>i)return n+E(s,i)}return n+s},i.prototype.parseOctetString=function(t,e,i){if(this.isASCII(t,e))return E(this.parseStringISO(t,e),i);var r=e-t,n="("+r+" byte)\n";(i/=2)i)return E(r,i);n=new y,s=0}}return 0>6,this.tagConstructed=0!=(32&e),this.tagNumber=31&e,31==this.tagNumber){for(var i=new y;e=t.get(),i.mulAdd(128,127&e),128&e;);this.tagNumber=i.simplify()}}return t.prototype.isUniversal=function(){return 0===this.tagClass},t.prototype.isEOC=function(){return 0===this.tagClass&&0===this.tagNumber},t}(),B=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],A=(1<<26)/B[B.length-1],O=function(){function b(t,e,i){null!=t&&("number"==typeof t?this.fromNumber(t,e,i):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}return b.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var i,r=(1<>h)&&(n=!0,s=a(i));0<=o;)h>(h+=this.DB-e)):(i=this[o]>>(h-=e)&r,h<=0&&(h+=this.DB,--o)),0>24},b.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},b.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},b.prototype.toByteArray=function(){var t=this.t,e=[];e[0]=this.s;var i,r=this.DB-t*this.DB%8,n=0;if(0>r)!=(this.s&this.DM)>>r&&(e[n++]=i|this.s<>(r+=this.DB-8)):(i=this[t]>>(r-=8)&255,r<=0&&(r+=this.DB,--t)),0!=(128&i)&&(i|=-256),0==n&&(128&this.s)!=(128&i)&&++n,(0=this.t?0!=this.s:0!=(this[e]&1<>n-a&u:(f=(t[p]&(1<>this.DB+n-a)),h=i;0==(1&f);)f>>=1,--h;if((n-=h)<0&&(n+=this.DB,--p),g)o[f].copyTo(s),g=!1;else{for(;1this.DB?(this[this.t-1]|=(o&(1<>this.DB-s):this[this.t-1]|=o<=this.DB&&(s-=this.DB))}8==i&&0!=(128&+t[0])&&(this.s=-1,0>r|o,o=(this[h]&n)<=this.t)e.t=0;else{var r=t%this.DB,n=this.DB-r,s=(1<>r;for(var o=i+1;o>r;0>=this.DB;if(t.t>=this.DB;r+=this.s}else{for(r+=this.s;i>=this.DB;r-=t.s}e.s=r<0?-1:0,r<-1?e[i++]=this.DV+r:0=e.DV&&(t[i+e.t]-=e.DV,t[i+e.t+1]=1)}0>this.F2:0),l=this.FV/f,p=(1<=i&&(this.dMultiply(r),this.dAddOffset(o,0),o=s=0))}0t&&this.subTo(b.ONE.shiftLeft(t-1),this);else{var r=[],n=7&t;r.length=1+(t>>3),e.nextBytes(r),0>=this.DB;if(t.t>=this.DB;r+=this.s}else{for(r+=this.s;i>=this.DB;r+=t.s}e.s=r<0?-1:0,0=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},b.prototype.multiplyLowerTo=function(t,e,i){var r=Math.min(this.t+t.t,e);for(i.s=0,i.t=r;0>1)&&(t=B.length);for(var n=M(),s=0;st&&n.subTo(b.ONE.shiftLeft(t-1),n),n.isProbablePrime(e)?setTimeout(function(){r()},0):setTimeout(s,0)};setTimeout(s,0)}else{var o=[],h=7&t;o.length=1+(t>>3),e.nextBytes(o),0>15,this.um=(1<>15)*this.mpl&this.um)<<15)&t.DM;for(t[i=e+this.m.t]+=this.m.am(0,r,t,e,0,this.m.t);t[i]>=t.DV;)t[i]-=t.DV,t[++i]++}t.clamp(),t.drShiftTo(this.m.t,t),0<=t.compareTo(this.m)&&t.subTo(this.m,t)},t.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i),this.reduce(i)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}(),P=function(){function t(t){this.m=t,this.r2=M(),this.q3=M(),O.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t)}return t.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=M();return t.copyTo(e),this.reduce(e),e},t.prototype.revert=function(t){return t},t.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);0<=t.compareTo(this.m);)t.subTo(this.m,t)},t.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i),this.reduce(i)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}();function M(){return new O(null)}function q(t,e){return new O(t,e)}"Microsoft Internet Explorer"==navigator.appName?(O.prototype.am=function(t,e,i,r,n,s){for(var o=32767&e,h=e>>15;0<=--s;){var a=32767&this[t],u=this[t++]>>15,c=h*a+u*o;n=((a=o*a+((32767&c)<<15)+i[r]+(1073741823&n))>>>30)+(c>>>15)+h*u+(n>>>30),i[r++]=1073741823&a}return n},w=30):"Netscape"!=navigator.appName?(O.prototype.am=function(t,e,i,r,n,s){for(;0<=--s;){var o=e*this[t++]+i[r]+n;n=Math.floor(o/67108864),i[r++]=67108863&o}return n},w=26):(O.prototype.am=function(t,e,i,r,n,s){for(var o=16383&e,h=e>>14;0<=--s;){var a=16383&this[t],u=this[t++]>>14,c=h*a+u*o;n=((a=o*a+((16383&c)<<14)+i[r]+n)>>28)+(c>>14)+h*u,i[r++]=268435455&a}return n},w=28),O.prototype.DB=w,O.prototype.DM=(1<>>16)&&(t=e,i+=16),0!=(e=t>>8)&&(t=e,i+=8),0!=(e=t>>4)&&(t=e,i+=4),0!=(e=t>>2)&&(t=e,i+=2),0!=(e=t>>1)&&(t=e,i+=1),i}O.ZERO=F(0),O.ONE=F(1);var K=function(){function t(){this.i=0,this.j=0,this.S=[]}return t.prototype.init=function(t){var e,i,r;for(e=0;e<256;++e)this.S[e]=e;for(e=i=0;e<256;++e)i=i+this.S[e]+t[e%t.length]&255,r=this.S[e],this.S[e]=this.S[i],this.S[i]=r;this.i=0,this.j=0},t.prototype.next=function(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]},t}();var k,_,z=256,Z=null;if(null==Z){Z=[];var G=void(_=0);if(window.crypto&&window.crypto.getRandomValues){var $=new Uint32Array(256);for(window.crypto.getRandomValues($),G=0;G<$.length;++G)Z[_++]=255&$[G]}var Y=function(t){if(this.count=this.count||0,256<=this.count||z<=_)window.removeEventListener?window.removeEventListener("mousemove",Y,!1):window.detachEvent&&window.detachEvent("onmousemove",Y);else try{var e=t.x+t.y;Z[_++]=255&e,this.count+=1}catch(t){}};window.addEventListener?window.addEventListener("mousemove",Y,!1):window.attachEvent&&window.attachEvent("onmousemove",Y)}function J(){if(null==k){for(k=new K;_>6|192):(i[--e]=63&n|128,i[--e]=n>>6&63|128,i[--e]=n>>12|224)}i[--e]=0;for(var s=new X,o=[];2>3);if(null==e)return null;var i=this.doPublic(e);if(null==i)return null;var r=i.toString(16);return 0==(1&r.length)?r:"0"+r},t.prototype.setPrivate=function(t,e,i){null!=t&&null!=e&&0>1;this.e=parseInt(e,16);for(var n=new O(e,16);;){for(;this.p=new O(t-r,1,i),0!=this.p.subtract(O.ONE).gcd(n).compareTo(O.ONE)||!this.p.isProbablePrime(10););for(;this.q=new O(r,1,i),0!=this.q.subtract(O.ONE).gcd(n).compareTo(O.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var s=this.p;this.p=this.q,this.q=s}var o=this.p.subtract(O.ONE),h=this.q.subtract(O.ONE),a=o.multiply(h);if(0==a.gcd(n).compareTo(O.ONE)){this.n=this.p.multiply(this.q),this.d=n.modInverse(a),this.dmp1=this.d.mod(o),this.dmq1=this.d.mod(h),this.coeff=this.q.modInverse(this.p);break}}},t.prototype.decrypt=function(t){var e=q(t,16),i=this.doPrivate(e);return null==i?null:function(t,e){var i=t.toByteArray(),r=0;for(;r=i.length)return null;var n="";for(;++r>3)},t.prototype.generateAsync=function(t,e,n){var s=new X,o=t>>1;this.e=parseInt(e,16);var h=new O(e,16),a=this,u=function(){var e=function(){if(a.p.compareTo(a.q)<=0){var t=a.p;a.p=a.q,a.q=t}var e=a.p.subtract(O.ONE),i=a.q.subtract(O.ONE),r=e.multiply(i);0==r.gcd(h).compareTo(O.ONE)?(a.n=a.p.multiply(a.q),a.d=h.modInverse(r),a.dmp1=a.d.mod(e),a.dmq1=a.d.mod(i),a.coeff=a.q.modInverse(a.p),setTimeout(function(){n()},0)):setTimeout(u,0)},i=function(){a.q=M(),a.q.fromNumberAsync(o,1,s,function(){a.q.subtract(O.ONE).gcda(h,function(t){0==t.compareTo(O.ONE)&&a.q.isProbablePrime(10)?setTimeout(e,0):setTimeout(i,0)})})},r=function(){a.p=M(),a.p.fromNumberAsync(t-o,1,s,function(){a.p.subtract(O.ONE).gcda(h,function(t){0==t.compareTo(O.ONE)&&a.p.isProbablePrime(10)?setTimeout(i,0):setTimeout(r,0)})})};setTimeout(r,0)};setTimeout(u,0)},t.prototype.sign=function(t,e,i){var r=function(t,e){if(e=e?t:new Array(e-t.length+1).join("0")+t},this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=stohex(t)},this.setByDateValue=function(t,e,i,r,n,s){var o=new Date(Date.UTC(t,e-1,i,r,n,s,0));this.setByDate(o)},this.getFreshValueHex=function(){return this.hV}},tt.lang.extend(et.asn1.DERAbstractTime,et.asn1.ASN1Object),et.asn1.DERAbstractStructured=function(t){et.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array=t},this.appendASN1Object=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array.push(t)},this.asn1Array=new Array,void 0!==t&&void 0!==t.array&&(this.asn1Array=t.array)},tt.lang.extend(et.asn1.DERAbstractStructured,et.asn1.ASN1Object),et.asn1.DERBoolean=function(){et.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"},tt.lang.extend(et.asn1.DERBoolean,et.asn1.ASN1Object),et.asn1.DERInteger=function(t){et.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=et.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new O(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.bigint?this.setByBigInteger(t.bigint):void 0!==t.int?this.setByInteger(t.int):"number"==typeof t?this.setByInteger(t):void 0!==t.hex&&this.setValueHex(t.hex))},tt.lang.extend(et.asn1.DERInteger,et.asn1.ASN1Object),et.asn1.DERBitString=function(t){if(void 0!==t&&void 0!==t.obj){var e=et.asn1.ASN1Util.newObject(t.obj);t.hex="00"+e.getEncodedHex()}et.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(t){this.hTLV=null,this.isModified=!0,this.hV=t},this.setUnusedBitsAndHexValue=function(t,e){if(t<0||7