|
@@ -235,6 +235,10 @@ module.exports = app => {
|
|
|
if (!params.stage_select && copyCustomSelect) delete copyCustomSelect.stage_select;
|
|
|
|
|
|
const pageRst = await getAllPagesCommon(ctx, rptTpl, params, JV.PAGING_OPTION_NORMAL, JV.OUTPUT_TYPE_NORMAL, this.app.baseDir, copyCustomSelect);
|
|
|
+ if (params.stage_status !== 3) {
|
|
|
+ // 加水印
|
|
|
+ // fillWaterMark([pageRst]);
|
|
|
+ }
|
|
|
// console.log(pageRst);
|
|
|
// const roleRel = (params.stage_status === 3) ? (await ctx.service.roleRptRel.getRoleRptRelByDetailIds(params.tender_id, params.rpt_tpl_id)) : [];
|
|
|
const roleRel = await ctx.service.roleRptRel.getRoleRptRelByDetailIds(params.tender_id, params.rpt_tpl_id, params.stage_id); // 新需求中,允许在非审核状态下设置签名
|
|
@@ -320,6 +324,10 @@ module.exports = app => {
|
|
|
const params = JSON.parse(ctx.request.body.params);
|
|
|
await this._saveCustomSelects(params);
|
|
|
const pageRstArr = await getMultiRptsCommon(ctx, params, JV.OUTPUT_TYPE_NORMAL, this.app.baseDir);
|
|
|
+ if (params.stage_status !== 3) {
|
|
|
+ // 加水印
|
|
|
+ // fillWaterMark(pageRstArr);
|
|
|
+ }
|
|
|
const stgAudit = await ctx.service.stageAudit.getStageAudit(params.stage_id, params.stage_times);
|
|
|
const roleRel = (params.stage_status === 3) ? (await ctx.service.roleRptRel.getRoleRptRelByDetailIds(params.tender_id, params.rpt_ids, params.stage_id)) : [];
|
|
|
// const roleRel = (params.stage_status === 3) ? (await ctx.service.roleRptRel.getRoleRptRelByDetailIds(params.tender_id, params.rpt_tpl_id)) : [];
|
|
@@ -984,6 +992,36 @@ function isFileExisted(file) {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+function fillWaterMark(pageRstArray) {
|
|
|
+ for (const pageRst of pageRstArray) {
|
|
|
+ const orgWaterMarkWidth = 800;
|
|
|
+ const orgWaterMarkHeight = 350;
|
|
|
+ for (const page of pageRst.items) {
|
|
|
+ const w = page[JV.PROP_PAGE_MERGE_BORDER].Right - page[JV.PROP_PAGE_MERGE_BORDER].Left;
|
|
|
+ const h = page[JV.PROP_PAGE_MERGE_BORDER].Bottom - page[JV.PROP_PAGE_MERGE_BORDER].Top;
|
|
|
+ const left = Math.round(page[JV.PROP_PAGE_MERGE_BORDER].Left + w / 2 - orgWaterMarkWidth / 2);
|
|
|
+ const right = left + orgWaterMarkWidth;
|
|
|
+ const top = Math.round(page[JV.PROP_PAGE_MERGE_BORDER].Top + h / 2 - orgWaterMarkHeight / 2);
|
|
|
+ const bottom = top + orgWaterMarkHeight;
|
|
|
+ const warterCell = {
|
|
|
+ signature_name: JV.SIGNATURE_NAME_DUMMY,
|
|
|
+ path: '/public/images/not_Approve.png',
|
|
|
+ pic: null,
|
|
|
+ control: 'Title',
|
|
|
+ style: 'Default_None',
|
|
|
+ area: {
|
|
|
+ Left: left,
|
|
|
+ Right: right,
|
|
|
+ Top: top,
|
|
|
+ Bottom: bottom,
|
|
|
+ },
|
|
|
+ };
|
|
|
+ console.log(page[JV.PROP_PAGE_MERGE_BORDER]);
|
|
|
+ page[JV.PROP_SIGNATURE_CELLS].push(warterCell);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
async function encodeSignatureDataUri(roleRel, baseDir) {
|
|
|
if (roleRel) {
|
|
|
for (const singleRoleRel of roleRel) {
|
|
@@ -1015,7 +1053,7 @@ async function encodeSignatureDataUri(roleRel, baseDir) {
|
|
|
async function encodeDummySignatureDataUri(pageRst, baseDir) {
|
|
|
if (pageRst) {
|
|
|
for (const page of pageRst.items) {
|
|
|
- for (const signature of page.signature_cells) {
|
|
|
+ for (const signature of page[JV.PROP_SIGNATURE_CELLS]) {
|
|
|
if (signature.signature_name === JV.SIGNATURE_NAME_DUMMY) {
|
|
|
if (signature.path !== '') {
|
|
|
const filePath = baseDir + '/app' + signature.path;
|