|
@@ -171,6 +171,8 @@
|
|
|
const PROJECT_ID = <%- project_id %>;
|
|
|
const TENDER_ID = <%- tender_id %>;
|
|
|
const STAGE_ID = <%- stg_id %>;
|
|
|
+ const USER_ID = <%- ctx.session.sessionUser.accountId %>;
|
|
|
+ const USER_NAME = '<%- ctx.session.sessionUser.name %>';
|
|
|
const STAGE_ORDER = <%- stg_order %>;
|
|
|
const STAGE_LIST = <%- stage_list %>;
|
|
|
const can_netcasign = <%- can_netcasign %>;
|
|
@@ -353,6 +355,7 @@
|
|
|
|
|
|
const _self = $(this);
|
|
|
const params={};
|
|
|
+ let curr_sign_page = 1;
|
|
|
NetcaPKI.GetCertList(params)
|
|
|
.Then(function(res){
|
|
|
if (res && res.deviceCount === 0) {
|
|
@@ -384,13 +387,14 @@
|
|
|
} else {
|
|
|
// 开始签名!
|
|
|
const encrypt = rptArchiveObj.currentEncryptionList.encryption[val];
|
|
|
+ console.log(encrypt);
|
|
|
const requestJson = {
|
|
|
width: encrypt.areas[0].width,
|
|
|
height: encrypt.areas[0].height,
|
|
|
- x: encrypt.areas[0].Top,
|
|
|
- y: encrypt.areas[0].Left,
|
|
|
- page: rptArchiveObj.currentEncryptionList.total_page ? rptArchiveObj.currentEncryptionList.total_page : 1,
|
|
|
- // page: 0,
|
|
|
+ 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',
|
|
@@ -398,11 +402,12 @@
|
|
|
imageBase64: netcaSignData.sign_base64,
|
|
|
certContent: res.certCode,
|
|
|
}
|
|
|
+ console.log(requestJson);
|
|
|
// 先获取摘要值
|
|
|
postData('/tender/'+ TENDER_ID +'/signReport/post', { type: 'assemblyDigest', requestJson}, function (result) {
|
|
|
if(result.code === 0) {
|
|
|
signDigest = result.data;
|
|
|
- signPdf();
|
|
|
+ signPdf(res);
|
|
|
} else {
|
|
|
failedCallBack(result);
|
|
|
}
|
|
@@ -413,7 +418,7 @@
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
- function signPdf() {
|
|
|
+ function signPdf(res) {
|
|
|
const certEncode = "";
|
|
|
const tbs = utf8_to_b64(signDigest);
|
|
|
const _tsaURL = "http://tsa.cnca.net/NETCATimeStampServer/TSAServer.jsp";
|
|
@@ -433,9 +438,10 @@
|
|
|
tsaURL: _tsaURL,
|
|
|
includeCertOption: _includeCertOption//整数 包含证书的标识
|
|
|
};
|
|
|
+ const curr_res = res;
|
|
|
NetcaPKI.signedDataSign(params)
|
|
|
.Then(function (res) {
|
|
|
- _self.text('签名中...');
|
|
|
+ _self.text('签名中,请勿关闭本页...');
|
|
|
let retSignValue = res.signValue;
|
|
|
|
|
|
//处理base填充问题,这里去掉Base64的填充内容
|
|
@@ -473,14 +479,28 @@
|
|
|
p7Base64: retSignValue,
|
|
|
}
|
|
|
const encrypt = rptArchiveObj.currentEncryptionList.encryption[val];
|
|
|
+ // rptArchiveObj.currentEncryptionList.total_page = rptArchiveObj.currentEncryptionList.total_page ? rptArchiveObj.currentEncryptionList.total_page : 1;
|
|
|
+ const end = rptArchiveObj.currentEncryptionList.total_page === curr_sign_page;
|
|
|
// 生成pdf
|
|
|
- postData('/tender/'+ TENDER_ID +'/signReport/post', { type: 'assemblyPdf', requestJson: rJson, role: encrypt.name }, function (result) {
|
|
|
- toastr.success("已成功签名");
|
|
|
- signLogList = result;
|
|
|
- rptArchiveObj._updateSignHtmlAndFrame(true);
|
|
|
- $('#sign').modal('hide');
|
|
|
- _self.attr('disabled', false);
|
|
|
- _self.text('确定');
|
|
|
+ postData('/tender/'+ TENDER_ID +'/signReport/post', { type: 'assemblyPdf', requestJson: rJson, role: encrypt.name, end }, function (result) {
|
|
|
+ if (end) {
|
|
|
+ toastr.success("已成功签名");
|
|
|
+ signLogList = result;
|
|
|
+ signDigest = '';
|
|
|
+ rptArchiveObj._updateSignHtmlAndFrame(true);
|
|
|
+ $('#sign').modal('hide');
|
|
|
+ _self.attr('disabled', false);
|
|
|
+ _self.text('确定');
|
|
|
+ } else {
|
|
|
+ signDigest = '';
|
|
|
+ rptArchiveObj.currentArchivePdfPath = oss_path + '/sign/'+ rptArchiveObj.currentArchiveUuid +'.PDF';
|
|
|
+ let uhtml = ' <span class="text-success"><i class="fa fa-check"></i> '+ encrypt.name +'('+ USER_NAME +')</span>';
|
|
|
+ $('#page-list tr').eq(curr_sign_page - 1).children('td').eq(2).append(uhtml);
|
|
|
+ ++curr_sign_page;
|
|
|
+ setTimeout(function () {
|
|
|
+ successGetCertEncodeCallBack(curr_res);
|
|
|
+ }, 3000);
|
|
|
+ }
|
|
|
}, function () {
|
|
|
_self.attr('disabled', false);
|
|
|
_self.text('确定');
|
|
@@ -516,6 +536,16 @@
|
|
|
return false;
|
|
|
});
|
|
|
})
|
|
|
+
|
|
|
+ $('#sign-remove').click(function () {
|
|
|
+ // 移除签名并更新
|
|
|
+ postData('/tender/'+ TENDER_ID +'/signReport/post', { type: 'removeSign', uuid: rptArchiveObj.currentArchiveUuid }, function (result) {
|
|
|
+ signLogList = result;
|
|
|
+ rptArchiveObj._updateSignHtmlAndFrame(true);
|
|
|
+ $('#sign2').modal('hide');
|
|
|
+ }, function () {
|
|
|
+ })
|
|
|
+ })
|
|
|
})
|
|
|
|
|
|
rptArchiveObj.iniPage();
|