|
@@ -154,6 +154,7 @@
|
|
|
|
|
|
<script src="/public/netcasign/js/base64.min.js"></script>
|
|
|
<script src="/public/netcasign/js/netcawebsocket.js"></script>
|
|
|
+<script src="/public/netcasign/js/netcaseal.js"></script>
|
|
|
<script src="/public/netcasign/js/appPackage.js"></script>
|
|
|
<script type="text/javascript">
|
|
|
let current_stage_order = -1;
|
|
@@ -382,6 +383,11 @@
|
|
|
|
|
|
let signDigest = '';
|
|
|
|
|
|
+ function clock() {
|
|
|
+ let t = new Date();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
$('#sign_pdf').click(function () {
|
|
|
$(this).attr('disabled', true);
|
|
|
$(this).text('签名条件判断中...');
|
|
@@ -432,7 +438,7 @@
|
|
|
$(this).text('确定');
|
|
|
return false;
|
|
|
}
|
|
|
- // 判断是否有驱动,并禁止多个ukey插入
|
|
|
+ // 判断是否有驱动,并禁止多个ukey同时插入
|
|
|
|
|
|
const _self = $(this);
|
|
|
const params={};
|
|
@@ -444,7 +450,6 @@
|
|
|
_self.attr('disabled', false);
|
|
|
_self.text('确定');
|
|
|
return false;
|
|
|
- return;
|
|
|
} else if (res.deviceCount === 1) {
|
|
|
const cert = res.certInfo[0];
|
|
|
const keyId = getNetcaKeyId(cert);
|
|
@@ -463,41 +468,89 @@
|
|
|
failedCallBack);
|
|
|
|
|
|
function successGetCertEncodeCallBack(res) {
|
|
|
- if (signDigest !== '') {
|
|
|
- signPdf();
|
|
|
- } else {
|
|
|
- // 开始签名!
|
|
|
+ const path = rptArchiveObj.currentArchivePdfPath.split('/').slice(3).join('/').split('?')[0];
|
|
|
+ console.time();
|
|
|
+ postData('/tender/'+ TENDER_ID +'/signReport/post', {type: 'getPdfBase64', path}, function (result2) {
|
|
|
+ // 生成签名后的base64并上传到oss上,文件太大可能会有bug,需要观察
|
|
|
+ // 开始签名, 页数如果太多要循环调用,以30页为1个循环,防止签太久内存过大溢出
|
|
|
const encrypt = rptArchiveObj.currentEncryptionList.encryption[val];
|
|
|
- console.log(encrypt);
|
|
|
+ const roundNum = 30;
|
|
|
+ const signRound = Math.ceil(rptArchiveObj.currentEncryptionList.total_page/roundNum);
|
|
|
+ _self.text('签名中,请勿关闭本页...');
|
|
|
const requestJson = {
|
|
|
- width: encrypt.areas[0].width*0.75,
|
|
|
- height: encrypt.areas[0].height*0.75,
|
|
|
- x: encrypt.areas[0].Left*0.75,
|
|
|
- y: encrypt.areas[0].Top*0.75,
|
|
|
- // page: rptArchiveObj.currentEncryptionList.total_page ? rptArchiveObj.currentEncryptionList.total_page : 1,
|
|
|
- page: curr_sign_page,
|
|
|
- // url: 'https://measure-sign-pdf.oss-cn-shenzhen.aliyuncs.com/archive/'+ rptArchiveObj.currentArchiveUuid + '.PDF',
|
|
|
- url: rptArchiveObj.currentArchivePdfPath,
|
|
|
- hashAlgo: 'SHA256',
|
|
|
- documentId: new Date().getTime(),
|
|
|
- imageBase64: base64Set(netcaSignData.sign_base64),
|
|
|
- certContent: res.certCode,
|
|
|
+ srcBytes: result2,
|
|
|
+ certEncode: res.certCode,
|
|
|
+ selMode: 1,
|
|
|
+ sealImageEncode: base64Set(netcaSignData.sign_base64),
|
|
|
+ revInfoIncludeFlag: false,
|
|
|
+ SignPosition: {
|
|
|
+ startPage: 1,
|
|
|
+ endPage: -1,
|
|
|
+ xPos: parseInt(encrypt.areas[0].Left*0.75),
|
|
|
+ yPos: parseInt(encrypt.areas[0].Top*0.75),
|
|
|
+ width: parseInt(encrypt.areas[0].width*0.75),
|
|
|
+ height: parseInt(encrypt.areas[0].height*0.75),
|
|
|
+ },
|
|
|
}
|
|
|
- console.log(requestJson);
|
|
|
- // 先获取摘要值
|
|
|
- postData('/tender/'+ TENDER_ID +'/signReport/post', { type: 'assemblyDigest', requestJson}, function (result) {
|
|
|
- if(result.code === 0) {
|
|
|
- signDigest = result.data;
|
|
|
- signPdf(res);
|
|
|
+ signPdfRound(requestJson, 1, signRound, roundNum, encrypt.name);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ function signPdfRound(requestJson, num, round, roundNum, name) {
|
|
|
+ if (num !== round) {
|
|
|
+ requestJson.SignPosition.startPage = (num-1)*roundNum + 1;
|
|
|
+ requestJson.SignPosition.endPage = num+1 > round ? -1 : num*roundNum;
|
|
|
+ }
|
|
|
+ console.log((num-1)*roundNum + 1, num+1 > round ? -1 : num*roundNum);
|
|
|
+ NetcaPKI.SignatureCreatorSignSealEx(requestJson)
|
|
|
+ .Then(function (res)
|
|
|
+ {
|
|
|
+ if (num !== round) {
|
|
|
+ requestJson.srcBytes = res.destFileEncode;
|
|
|
+ let uhtml = ' <span class="text-success"><i class="fa fa-check"></i> '+ name +'('+ USER_NAME +')</span>';
|
|
|
+ const nowRound = (num-1)*roundNum;
|
|
|
+ for (let i = 0; i < roundNum; i++) {
|
|
|
+ $('#page-list tr').eq(nowRound + i).children('td').eq(2).append(uhtml);
|
|
|
+ }
|
|
|
+ ++num;
|
|
|
+ signPdfRound(requestJson, num, round, roundNum, name);
|
|
|
} else {
|
|
|
- failedCallBack(result);
|
|
|
+ const doc = convertBase64UrlToBlob(res.destFileEncode);
|
|
|
+ const formData = new FormData();
|
|
|
+ formData.append('uuid', rptArchiveObj.currentArchiveUuid);
|
|
|
+ formData.append('role', name);
|
|
|
+ formData.append('file', doc, 'test.pdf');
|
|
|
+ postDataWithFile('/tender/'+ TENDER_ID +'/signReport/file', formData, function (result) {
|
|
|
+ toastr.success("已成功签名");
|
|
|
+ signLogList = result;
|
|
|
+ signDigest = '';
|
|
|
+ rptArchiveObj._updateSignHtmlAndFrame(true);
|
|
|
+ $('#sign').modal('hide');
|
|
|
+ _self.attr('disabled', false);
|
|
|
+ _self.text('确定');
|
|
|
+ console.timeEnd();
|
|
|
+ return true;
|
|
|
+ }, function () {
|
|
|
+ console.timeEnd();
|
|
|
+ _self.attr('disabled', false);
|
|
|
+ _self.text('确定');
|
|
|
+ return false;
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .Catch(function (res)
|
|
|
+ {
|
|
|
+ if (res.status === -1915) {
|
|
|
+ toastr.warning('您已取消签名');
|
|
|
+ } else {
|
|
|
+ toastr.error('网证通签名报错:' + res.msg);
|
|
|
}
|
|
|
- }, function () {
|
|
|
_self.attr('disabled', false);
|
|
|
_self.text('确定');
|
|
|
+ console.log(res.msg);
|
|
|
+ console.timeEnd();
|
|
|
return false;
|
|
|
- })
|
|
|
- }
|
|
|
+ });
|
|
|
}
|
|
|
function signPdf(res2) {
|
|
|
const certEncode = "";
|