|
@@ -0,0 +1,524 @@
|
|
|
+<% if (stg_id === -1) {%>
|
|
|
+<% include ../tender/tender_sub_menu.ejs %>
|
|
|
+<% } else { %>
|
|
|
+<% include ../stage/stage_sub_menu.ejs %>
|
|
|
+<% } %>
|
|
|
+<div class="panel-content">
|
|
|
+ <div class="panel-title">
|
|
|
+ <div class="title-main d-flex">
|
|
|
+ <% if(stg_id === -1) { %>
|
|
|
+ <% include ../tender/tender_sub_mini_menu.ejs %>
|
|
|
+ <% } else { %>
|
|
|
+ <% include ../stage/stage_sub_mini_menu.ejs %>
|
|
|
+ <% } %>
|
|
|
+ <div>
|
|
|
+ <div class="d-inline-block">
|
|
|
+ <div class="dropdown" id="divSelectableStages">
|
|
|
+ <button class="btn btn-sm btn-light dropdown-toggle text-primary" type="button" id="btnCurrentStage" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></button>
|
|
|
+ <div class="dropdown-menu" aria-labelledby="dropdownMenuButton" id="optionSelectableStages"></div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="content-wrap">
|
|
|
+ <div class="c-header p-0"></div>
|
|
|
+ <div class="c-body">
|
|
|
+ <div class="row">
|
|
|
+ <div class="col-auto pr-0" id="tree-view" style="width: 17%">
|
|
|
+ <div class="sjs-height-1" style="overflow: auto">
|
|
|
+ <div class="text-center"></div>
|
|
|
+ <ul id="rptTplTree" class="ztree"></ul>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="col-auto" id="main-view" style="width: 83%">
|
|
|
+ <div class="resize-x" id="right-spr" r-Type="width" div1="#tree-view" div2="#main-view" title="调整大小" a-type="percent"><!--调整左右高度条--></div>
|
|
|
+ <div class="toolsbar-f d-flex justify-content-between position-absolute bg-light m-1">
|
|
|
+ <div class="print-toolsbar p-0">
|
|
|
+ <div class="panel">
|
|
|
+ <div class="panel-body" id="print_div">
|
|
|
+ <div class="btn-group" role="group">
|
|
|
+ <button class="btn btn-outline-primary btn-sm" type="button" id="print_file">
|
|
|
+ <i class="fa fa-print"></i><br>
|
|
|
+ 打印 <span class="badge badge-primary">0</span>
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="panel">
|
|
|
+ <div class="panel-body" id="export_div">
|
|
|
+ <div class="btn-group" role="group">
|
|
|
+ <button class="btn btn-outline-primary btn-sm" type="button" id="download_file">
|
|
|
+ <i class="fa fa-download"></i><br>
|
|
|
+ 下载 <span class="badge badge-primary">0</span>
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="panel">
|
|
|
+ <div class="panel-body">
|
|
|
+ <div class="btn-group" role="group">
|
|
|
+ <div>
|
|
|
+ <button id="currentDrpArchiveSelect" type="button" class="btn btn-outline-primary btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></button>
|
|
|
+ <div class="dropdown-menu" aria-labelledby="btnGroupDrop1" style="min-width:112px" id="drpArchiveSelect">
|
|
|
+ <!--
|
|
|
+ <a class="dropdown-item" href="#">#1 2021-02-01</a>
|
|
|
+ <a class="dropdown-item" href="#">#2 2021-02-27</a>
|
|
|
+ <a class="dropdown-item" href="javascript: void(0);" onclick="zTreeOprObj.changeOrientation(this)">横向</a>
|
|
|
+ -->
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="panel-foot text-muted">
|
|
|
+ 历史归档
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <% if (can_netcasign) { %>
|
|
|
+ <div class="panel">
|
|
|
+ <div class="panel-body">
|
|
|
+ <div class="btn-group" role="group">
|
|
|
+ <button class="btn btn-outline-primary btn-sm" type="button" data-toggle="modal" data-target="#sign">
|
|
|
+ <i class="fa fa-pencil"></i><br>
|
|
|
+ 电子签名 <span id="sign_num" class="badge badge-primary">0</span>
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <% } %>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="print-view form-view">
|
|
|
+ <div class="pageContainer" id="iframe_made">
|
|
|
+ <iframe src="/archive/pdf/show" class="sjs-height-0 border-0" width="100%"></iframe>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</div>
|
|
|
+
|
|
|
+<script src="/public/js/sub_menu.js"></script>
|
|
|
+<script src="/public/js/div_resizer.js"></script>
|
|
|
+<script>
|
|
|
+ $.subMenu({
|
|
|
+ menu: '#sub-menu', miniMenu: '#sub-mini-menu', miniMenuList: '#mini-menu-list',
|
|
|
+ toMenu: '#to-menu', toMiniMenu: '#to-mini-menu',
|
|
|
+ key: 'menu.1.0.0',
|
|
|
+ miniHint: '#sub-mini-hint', hintKey: 'menu.hint.1.0.1',
|
|
|
+ callback: function (info) {
|
|
|
+ if (info.mini) {
|
|
|
+ $('.panel-title').addClass('fluid');
|
|
|
+ $('#sub-menu').removeClass('panel-sidebar');
|
|
|
+ } else {
|
|
|
+ $('.panel-title').removeClass('fluid');
|
|
|
+ $('#sub-menu').addClass('panel-sidebar');
|
|
|
+ }
|
|
|
+ autoFlashHeight();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $.divResizer({
|
|
|
+ select: '#right-spr',
|
|
|
+ callback: function () {
|
|
|
+ autoFlashHeight();
|
|
|
+ }
|
|
|
+ });
|
|
|
+</script>
|
|
|
+<script type="text/javascript"> autoFlashHeight();</script>
|
|
|
+<script src="/public/js/shares/cs_tools.js"></script>
|
|
|
+
|
|
|
+<!-- zTree -->
|
|
|
+<script type="text/javascript" src="/public/js/ztree/jquery.ztree.core.js"></script>
|
|
|
+<script type="text/javascript" src="/public/js/ztree/jquery.ztree.excheck.js"></script>
|
|
|
+<script type="text/javascript" src="/public/js/string_util_light.js"></script>
|
|
|
+<!--
|
|
|
+-->
|
|
|
+<script type="text/javascript" src="/public/js/rpt_tpl_def.js"></script>
|
|
|
+<script type="text/javascript" src="/public/js/common_ajax.js"></script>
|
|
|
+<script type="text/javascript" src="/public/js/treeDataHelper.js"></script>
|
|
|
+<script type="text/javascript" src="/public/js/ztree_common.js"></script>
|
|
|
+<script type="text/javascript" src="/public/js/storageUtil.js"></script>
|
|
|
+
|
|
|
+<script type="text/javascript" src="/public/report/js/rpt_archive.js"></script>
|
|
|
+<script type="text/javascript" src="/public/report/js/rpt_main.js"></script>
|
|
|
+<script type="text/javascript" src="/public/report/js/rpt_cfg_const.js"></script>
|
|
|
+
|
|
|
+<!--
|
|
|
+<script type="text/javascript" src="/public/report/js/rpt_custom.js"></script>
|
|
|
+-->
|
|
|
+
|
|
|
+<script src="/public/netcasign/js/base64.min.js"></script>
|
|
|
+<script src="/public/netcasign/js/netcawebsocket.js"></script>
|
|
|
+<script src="/public/netcasign/js/appPackage.js"></script>
|
|
|
+<script type="text/javascript">
|
|
|
+ let current_stage_order = -1;
|
|
|
+ let current_stage_id = -1;
|
|
|
+ let current_stage_status = -1;
|
|
|
+
|
|
|
+ let ARCHIVE_LIST = JSON.parse('<%- JSON.stringify(archiveList) %>');
|
|
|
+ let ARCHIVE_ENCRYPTION_LIST = JSON.parse('<%- JSON.stringify(archiveEncryptionList) %>');
|
|
|
+ let TOP_TREE_NODES = <%- rpt_tpl_data %>;
|
|
|
+
|
|
|
+ const CUST_TREE_NODES = <%- cust_tpl_data %>;
|
|
|
+ if (!(CUST_TREE_NODES.customize instanceof Array)) {
|
|
|
+ CUST_TREE_NODES.customize = [];
|
|
|
+ }
|
|
|
+ const ORG_CUST_TREE_NODES = JSON.parse(JSON.stringify(CUST_TREE_NODES));
|
|
|
+ //
|
|
|
+ const PROJECT_ID = <%- project_id %>;
|
|
|
+ const TENDER_ID = <%- tender_id %>;
|
|
|
+ const STAGE_ID = <%- stg_id %>;
|
|
|
+ const STAGE_ORDER = <%- stg_order %>;
|
|
|
+ const STAGE_LIST = <%- stage_list %>;
|
|
|
+ const can_netcasign = <%- can_netcasign %>;
|
|
|
+ const oss_path = JSON.parse('<%- JSON.stringify(ossPath) %>');
|
|
|
+ let signLogList = JSON.parse('<%- JSON.stringify(signLogList) %>');
|
|
|
+
|
|
|
+ const FOLDER_SEPERATER = '->';
|
|
|
+
|
|
|
+ if (STAGE_ORDER > 0) {
|
|
|
+ current_stage_order = STAGE_ORDER;
|
|
|
+ current_stage_id = STAGE_ID;
|
|
|
+// current_stage_status = STAGE_STATUS;
|
|
|
+ } else if (STAGE_LIST.length > 0) {
|
|
|
+ current_stage_order = STAGE_LIST[STAGE_LIST.length - 1].order;
|
|
|
+ current_stage_id = STAGE_LIST[STAGE_LIST.length - 1].id;
|
|
|
+// current_stage_status = STAGE_LIST[STAGE_LIST.length - 1].status;
|
|
|
+ }
|
|
|
+
|
|
|
+ buildStageSelection();
|
|
|
+
|
|
|
+ for (let item of TOP_TREE_NODES) {
|
|
|
+ if (item.name === '通用报表') {
|
|
|
+ item.name = '推荐报表';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const ORG_TOP_TREE_NODES = JSON.parse(JSON.stringify(TOP_TREE_NODES));
|
|
|
+ for (let item of TOP_TREE_NODES) {
|
|
|
+ item.items = JSON.parse(item.items);
|
|
|
+ if (item.items && item.items.length > 0) {
|
|
|
+ for (let dtlItem of item.items) {
|
|
|
+ chkAndSetNode(dtlItem);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (let item of ORG_TOP_TREE_NODES) {
|
|
|
+ item.items = JSON.parse(item.items);
|
|
|
+ if (item.items && item.items.length > 0) {
|
|
|
+ for (let dtlItem of item.items) {
|
|
|
+ chkAndSetNode(dtlItem);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ buildTplTree();
|
|
|
+
|
|
|
+ function chkAndSetNode(parentItem) {
|
|
|
+ if (parentItem.nodeType === 1) {
|
|
|
+ parentItem.isParent = true;
|
|
|
+ }
|
|
|
+ if (parentItem.items) {
|
|
|
+ for (let dtlItem of parentItem.items) {
|
|
|
+ chkAndSetNode(dtlItem);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ function buildTplTree() {
|
|
|
+ if (TOP_TREE_NODES.length > 0) {
|
|
|
+ //1. 整理模板树 (原始状态的TOP_TREE_NODES包含了推荐报表与定制表,需要分割)
|
|
|
+ const individualNode = {id: 99999, name: '定制报表', pid: -1, rpt_type: 0, items: [], isParent: true};
|
|
|
+ for (let tnIdx = TOP_TREE_NODES.length - 1; tnIdx >= 0; tnIdx--) {
|
|
|
+ if (TOP_TREE_NODES[tnIdx].pid !== -1) {
|
|
|
+ TOP_TREE_NODES[tnIdx].isParent = true;
|
|
|
+ TOP_TREE_NODES[tnIdx].nodeType = 1;
|
|
|
+ individualNode.items.unshift(TOP_TREE_NODES[tnIdx]);
|
|
|
+ TOP_TREE_NODES.splice(tnIdx, 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 1.1 移除未被选择的模板
|
|
|
+ // filterUnchkTplTreeNode(TOP_TREE_NODES[0], CUST_TREE_NODES.common);
|
|
|
+ TOP_TREE_NODES.unshift(individualNode); //定制在前
|
|
|
+ // filterUnchkTplTreeNode(TOP_TREE_NODES[0], CUST_TREE_NODES.customize);
|
|
|
+ //2. 原始的模板树(恢复用)
|
|
|
+ const individualNodeOrg = {id: 99999, name: '定制报表', pid: -1, rpt_type: 0, items: [], isParent: true};
|
|
|
+ for (let tnIdx = ORG_TOP_TREE_NODES.length - 1; tnIdx >= 0; tnIdx--) {
|
|
|
+ if (ORG_TOP_TREE_NODES[tnIdx].pid !== -1) {
|
|
|
+ ORG_TOP_TREE_NODES[tnIdx].isParent = true;
|
|
|
+ ORG_TOP_TREE_NODES[tnIdx].nodeType = 1;
|
|
|
+ individualNodeOrg.items.unshift(ORG_TOP_TREE_NODES[tnIdx]);
|
|
|
+ ORG_TOP_TREE_NODES.splice(tnIdx, 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //ORG_TOP_TREE_NODES.push(individualNode);
|
|
|
+ ORG_TOP_TREE_NODES.unshift(individualNodeOrg);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ function buildStageSelection() {
|
|
|
+ if (STAGE_LIST.length === 0) {
|
|
|
+ $("#optionSelectableStages")[0].style.display = 'none';
|
|
|
+ } else {
|
|
|
+ $("#optionSelectableStages")[0].style.display = '';
|
|
|
+ $("#btnCurrentStage")[0].innerText = '第' + current_stage_order + '期';
|
|
|
+ $("#optionSelectableStages").empty();
|
|
|
+ if (STAGE_LIST.length > 0 && STAGE_ID < 0) {
|
|
|
+ for (let i = STAGE_LIST.length; i > 0; i--) {
|
|
|
+ if (parseInt(STAGE_LIST[i - 1].order) !== current_stage_order) {
|
|
|
+ const str = '<a class="dropdown-item" style="cursor:pointer" onclick="changeCurrentStage(this)" stg_id = "' + STAGE_LIST[i - 1].id + '" stg_order="' + STAGE_LIST[i - 1].order + '">第' + STAGE_LIST[i - 1].order + '期</a>';
|
|
|
+ $("#optionSelectableStages").append(str);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (STAGE_ID > 0) {
|
|
|
+ $("#divSelectableStages")[0].style.display = 'none';
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ function changeCurrentStage(ele) {
|
|
|
+ // alert('you are selecting: ' + ele.innerText);
|
|
|
+ current_stage_order = parseInt(ele.attributes.stg_order.value);
|
|
|
+ current_stage_id = parseInt(ele.attributes.stg_id.value);
|
|
|
+ for (let i = STAGE_LIST.length; i > 0; i--) {
|
|
|
+ if (parseInt(STAGE_LIST[i - 1].order) === current_stage_order) {
|
|
|
+ current_stage_status = STAGE_LIST[i - 1].status;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ buildStageSelection();
|
|
|
+ //还有必要触发归档报表刷新!
|
|
|
+ //rptArchiveObj.onClick(null, null, rptArchiveObj.currentNode);
|
|
|
+ const params = {prjId: PROJECT_ID, stgId: current_stage_id};
|
|
|
+ $.bootstrapLoading.start();
|
|
|
+ CommonAjax.postXsrfEx("/tender/report_api/getReportArchive", params, 10000, true, getCookie('csrfToken_j'),
|
|
|
+ function(result){
|
|
|
+ $.bootstrapLoading.end();
|
|
|
+ // console.log(result);
|
|
|
+ ARCHIVE_LIST = result.data;
|
|
|
+ ARCHIVE_ENCRYPTION_LIST = result.encryptionData;
|
|
|
+ TOP_TREE_NODES = JSON.parse(JSON.stringify(ORG_TOP_TREE_NODES));
|
|
|
+ rptArchiveObj.iniPage();
|
|
|
+ }, function(err){
|
|
|
+ $.bootstrapLoading.end();
|
|
|
+ }, function(ex){
|
|
|
+ $.bootstrapLoading.end();
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ const netcaSignData = JSON.parse(unescape('<%- escape(JSON.stringify(netcaSignData)) %>'));
|
|
|
+ $(function () {
|
|
|
+ // 多层modal关闭后的滚动bug修复
|
|
|
+ $('#add-sign').on('hidden.bs.modal', function (e) {
|
|
|
+ $(document.body).addClass('modal-open');
|
|
|
+ });
|
|
|
+
|
|
|
+ let signDigest = '';
|
|
|
+
|
|
|
+ $('#sign_pdf').click(function () {
|
|
|
+ $(this).attr('disabled', true);
|
|
|
+ $(this).text('签名条件判断中...')
|
|
|
+ // 判断是否已选中签名位置
|
|
|
+ const val = $("input[name='sign_role']:checked").val();
|
|
|
+ if (!val) {
|
|
|
+ toastr.error('请选择签名位置');
|
|
|
+ $(this).attr('disabled', false);
|
|
|
+ $(this).text('确定')
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ console.log(val);
|
|
|
+ // 判断是否已绑定ukey
|
|
|
+ if (!netcaSignData || !netcaSignData.keyId) {
|
|
|
+ // toastr.error('未绑定网证通ukey,请前往个人页面-签字管理绑定后刷新页面再试');
|
|
|
+ $('#netcasign-link h6').html('未绑定网证通ukey,请前往<a href="/profile/sign/netca" target="_blank">个人页面-签字管理</a>绑定后刷新页面再试');
|
|
|
+ $('#netcasign-link').modal('show');
|
|
|
+ $(this).attr('disabled', false);
|
|
|
+ $(this).text('确定')
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ // 判断是否已上传签名图
|
|
|
+ if (!netcaSignData || !netcaSignData.sign_base64) {
|
|
|
+ // toastr.error('未设置签名图,请前往个人页面-签字管理设置后刷新页面再试');
|
|
|
+ $('#netcasign-link h6').html('未设置签名图,请前往<a href="/profile/sign/netca" target="_blank">个人页面-签字管理</a>设置后刷新页面再试');
|
|
|
+ $('#netcasign-link').modal('show');
|
|
|
+ $(this).attr('disabled', false);
|
|
|
+ $(this).text('确定');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ // 判断是否有驱动,并禁止多个ukey插入
|
|
|
+
|
|
|
+ const _self = $(this);
|
|
|
+ const params={};
|
|
|
+ NetcaPKI.GetCertList(params)
|
|
|
+ .Then(function(res){
|
|
|
+ if (res && res.deviceCount === 0) {
|
|
|
+ toastr.error('请插入UKey获取证书');
|
|
|
+ _self.attr('disabled', false);
|
|
|
+ _self.text('确定');
|
|
|
+ return false;
|
|
|
+ return;
|
|
|
+ } else if (res.deviceCount === 1) {
|
|
|
+ const cert = res.certInfo[0];
|
|
|
+ const keyId = getNetcaKeyId(cert);
|
|
|
+ // data.name = cert.subjectCN;
|
|
|
+ // 判断插入的ukey是否对应上已绑用户
|
|
|
+ if (keyId !== netcaSignData.keyId) {
|
|
|
+ toastr.error('检测到UKey与已绑定的值不相同,请插入对应用户的UKey');
|
|
|
+ _self.attr('disabled', false);
|
|
|
+ _self.text('确定');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ const selectType = "{\"UIFlag\":\"default\", \"InValidity\":true,\"Type\":\"signature\", \"Method\":\"device\",\"Value\":\"any\"}";
|
|
|
+ const selectCondition = "IssuerCN~'NETCA' && InValidity='True' && CertType='Signature'";
|
|
|
+
|
|
|
+ netca_getCertStringAttribute(null, selectType, selectCondition, -1, successGetCertEncodeCallBack,
|
|
|
+ failedCallBack);
|
|
|
+
|
|
|
+ function successGetCertEncodeCallBack(res) {
|
|
|
+ if (signDigest !== '') {
|
|
|
+ signPdf();
|
|
|
+ } else {
|
|
|
+ // 开始签名!
|
|
|
+ const encrypt = rptArchiveObj.currentEncryptionList.encryption[val];
|
|
|
+ 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,
|
|
|
+ // url: 'https://measure-sign-pdf.oss-cn-shenzhen.aliyuncs.com/archive/'+ rptArchiveObj.currentArchiveUuid + '.PDF',
|
|
|
+ url: rptArchiveObj.currentArchivePdfPath,
|
|
|
+ hashAlgo: 'SHA256',
|
|
|
+ documentId: new Date().getTime(),
|
|
|
+ imageBase64: netcaSignData.sign_base64,
|
|
|
+ certContent: res.certCode,
|
|
|
+ }
|
|
|
+ // 先获取摘要值
|
|
|
+ postData('/tender/'+ TENDER_ID +'/signReport/post', { type: 'assemblyDigest', requestJson}, function (result) {
|
|
|
+ if(result.code === 0) {
|
|
|
+ signDigest = result.data;
|
|
|
+ signPdf();
|
|
|
+ } else {
|
|
|
+ failedCallBack(result);
|
|
|
+ }
|
|
|
+ }, function () {
|
|
|
+ _self.attr('disabled', false);
|
|
|
+ _self.text('确定');
|
|
|
+ return false;
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ function signPdf() {
|
|
|
+ const certEncode = "";
|
|
|
+ const tbs = utf8_to_b64(signDigest);
|
|
|
+ const _tsaURL = "http://tsa.cnca.net/NETCATimeStampServer/TSAServer.jsp";
|
|
|
+ const _includeCertOption = 2;
|
|
|
+ const params = {
|
|
|
+ cert: { //证书(CertificateParams)
|
|
|
+ encode: certEncode, //可选字段但不能为空
|
|
|
+ type: selectType,
|
|
|
+ condition: selectCondition
|
|
|
+ },
|
|
|
+ data: { //数据(DataParams)
|
|
|
+ text: tbs
|
|
|
+ },
|
|
|
+ useSubjectKeyId: 0, //是否使用主体密钥标识符来标识证书,默认为true
|
|
|
+ useQ7: false, //布尔值 是否使用国密Q7的方式,默认为false
|
|
|
+ detached: 0,
|
|
|
+ tsaURL: _tsaURL,
|
|
|
+ includeCertOption: _includeCertOption//整数 包含证书的标识
|
|
|
+ };
|
|
|
+ NetcaPKI.signedDataSign(params)
|
|
|
+ .Then(function (res) {
|
|
|
+ _self.text('签名中...');
|
|
|
+ let retSignValue = res.signValue;
|
|
|
+
|
|
|
+ //处理base填充问题,这里去掉Base64的填充内容
|
|
|
+ if(retSignValue!=null&&retSignValue.length>2)
|
|
|
+ {
|
|
|
+ var paddingCount=0;
|
|
|
+ if(retSignValue[retSignValue.length-1]=="=")
|
|
|
+ {
|
|
|
+ paddingCount++;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(retSignValue[retSignValue.length-2]=="=")
|
|
|
+ {
|
|
|
+ paddingCount++;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(paddingCount>0)
|
|
|
+ {
|
|
|
+ //裁剪后面的=号
|
|
|
+ retSignValue=retSignValue.substring(0,retSignValue.length-paddingCount);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(res.result==-5||res.result==-81)
|
|
|
+ {
|
|
|
+ toastr.error("密码错误,密码重试次数为:"+res.retrynum);
|
|
|
+ _self.attr('disabled', false);
|
|
|
+ _self.text('确定');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ // 签名pdf
|
|
|
+ const rJson = {
|
|
|
+ fileName: rptArchiveObj.currentArchiveUuid,
|
|
|
+ returnType: 2,
|
|
|
+ digest : signDigest,
|
|
|
+ p7Base64: retSignValue,
|
|
|
+ }
|
|
|
+ const encrypt = rptArchiveObj.currentEncryptionList.encryption[val];
|
|
|
+ // 生成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('确定');
|
|
|
+ }, function () {
|
|
|
+ _self.attr('disabled', false);
|
|
|
+ _self.text('确定');
|
|
|
+ return false;
|
|
|
+ })
|
|
|
+ })
|
|
|
+ .Catch(function (res) {
|
|
|
+ failedCallBack(res);
|
|
|
+ })
|
|
|
+ }
|
|
|
+ function failedCallBack(res) {
|
|
|
+ toastr.error(res.msg);
|
|
|
+ _self.attr('disabled', false);
|
|
|
+ _self.text('确定');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ } else if (res.deviceCount === 2) {
|
|
|
+ toastr.error('请拔出多个UKey,保留一个并获取证书信息');
|
|
|
+ _self.attr('disabled', false);
|
|
|
+ _self.text('确定');
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ toastr.error('获取证书失败');
|
|
|
+ _self.attr('disabled', false);
|
|
|
+ _self.text('确定');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .Catch(function (res) {
|
|
|
+ getCertListFail(res);
|
|
|
+ _self.attr('disabled', false);
|
|
|
+ _self.text('确定');
|
|
|
+ return false;
|
|
|
+ });
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
+ rptArchiveObj.iniPage();
|
|
|
+
|
|
|
+</script>
|
|
|
+
|