|
|
@@ -563,6 +563,15 @@ let rptArchiveObj = {
|
|
|
rst[3] = rst[3] + offsetY;
|
|
|
return rst;
|
|
|
};
|
|
|
+ const _getProperSignDateArea = (orgArea) => {
|
|
|
+ const rst = [0, 0, 0, 0]; // left, top, right, bottom
|
|
|
+ // 给全部空间,不考虑对齐方式了
|
|
|
+ rst[0] = orgArea[JV.PROP_LEFT];
|
|
|
+ rst[1] = orgArea[JV.PROP_TOP];
|
|
|
+ rst[2] = orgArea[JV.PROP_RIGHT];
|
|
|
+ rst[3] = orgArea[JV.PROP_BOTTOM];
|
|
|
+ return rst;
|
|
|
+ };
|
|
|
const _getStampArea = (stampCell) => {
|
|
|
const rst = [0, 0, 0, 0];
|
|
|
if (stampCell && stampCell[JV.PROP_AREA]) {
|
|
|
@@ -588,23 +597,34 @@ let rptArchiveObj = {
|
|
|
company_stamp: 'company_stamp_areas',
|
|
|
private_stamp: 'private_stamp_areas'
|
|
|
};
|
|
|
- const _chkAndSetArea = (sCell, actSignArea, pageIdx, signNameKey) => {
|
|
|
+ const _chkAndSetArea = (sCell, actSignArea, signDateArea, pageIdx, signNameKey) => {
|
|
|
let idx = psInfoStr.indexOf(sCell[signNameKey]);
|
|
|
const signType = sCell.signType || 'normal';
|
|
|
const areaKey = _areaKeyCache[signType] || 'areas';
|
|
|
if (idx < 0) {
|
|
|
psInfoStr.push(sCell[signNameKey]);
|
|
|
- let newPsInfo = {'name': sCell[signNameKey], areas: [], company_stamp_areas: [], private_stamp_areas: [], order: signatureOrderObj[sCell[signNameKey]]};
|
|
|
+ let newPsInfo = {'name': sCell[signNameKey], areas: [], company_stamp_areas: [], private_stamp_areas: [], sign_date_areas: [], order: signatureOrderObj[sCell[signNameKey]]};
|
|
|
const area = _getAreasProperty(actSignArea);
|
|
|
area.pages.push(pageIdx + 1);
|
|
|
newPsInfo[areaKey].push(area);
|
|
|
+ // 新需求:要把签名日期的坐标也记录下来,增加 sign_date_areas 属性
|
|
|
+ if (signDateArea) {
|
|
|
+ const sArea = _getAreasProperty(signDateArea);
|
|
|
+ sArea.pages.push(pageIdx + 1);
|
|
|
+ newPsInfo.sign_date_areas.push(area);
|
|
|
+ }
|
|
|
+
|
|
|
psInfo.push(newPsInfo);
|
|
|
} else {
|
|
|
let hasArea = false;
|
|
|
- for (let areaItem of psInfo[idx][areaKey]) {
|
|
|
+ for (let aIdx = 0; aIdx < psInfo[idx][areaKey].length; aIdx++) {
|
|
|
+ const areaItem = psInfo[idx][areaKey][aIdx];
|
|
|
if (areaItem.Left === actSignArea[JV.IDX_LEFT] + offsetX && areaItem.Top === actSignArea[JV.IDX_TOP] + offsetX &&
|
|
|
areaItem.width === actSignArea[JV.IDX_RIGHT] - actSignArea[JV.IDX_LEFT] && areaItem.height === actSignArea[JV.IDX_BOTTOM] - actSignArea[JV.IDX_TOP]) {
|
|
|
areaItem.pages.push(pageIdx + 1);
|
|
|
+ if (signDateArea) {
|
|
|
+ psInfo[idx].sign_date_areas[aIdx].pages.push(pageIdx + 1); // 这里签名的位置不变,那么也假设签字日期的位置也不变
|
|
|
+ }
|
|
|
hasArea = true;
|
|
|
break;
|
|
|
}
|
|
|
@@ -613,6 +633,11 @@ let rptArchiveObj = {
|
|
|
const area = _getAreasProperty(actSignArea);
|
|
|
area.pages.push(pageIdx + 1);
|
|
|
psInfo[idx][areaKey].push(area);
|
|
|
+ if (signDateArea) {
|
|
|
+ const sArea = _getAreasProperty(signDateArea);
|
|
|
+ sArea.pages.push(pageIdx + 1);
|
|
|
+ psInfo[idx].sign_date_areas.push(area);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
@@ -628,6 +653,9 @@ let rptArchiveObj = {
|
|
|
if (maxX > maxY) ptChkHeight = pageSize === 'A4' ? A4_PIXEL_WIDTH : A3_PIXEL_WIDTH;
|
|
|
}
|
|
|
for (let sCell of page.signature_cells) {
|
|
|
+ const dtCell = page.signature_date_cells.find(cell => cell.signature_name === `${sCell.signature_name}_签字日期`);
|
|
|
+ const signDateArea = dtCell ? _getProperSignDateArea(dtCell.area) : null;
|
|
|
+ // sign_date_areas
|
|
|
// sCell.signature_name 草图不用加密
|
|
|
if (sCell.signature_name.indexOf('dummy_pic') < 0) {
|
|
|
let control = null;
|
|
|
@@ -637,10 +665,10 @@ let rptArchiveObj = {
|
|
|
control = sCell[JV.PROP_CONTROL];
|
|
|
}
|
|
|
let actSignArea = _getProperSignatureArea(sCell, control);
|
|
|
- _chkAndSetArea(sCell, actSignArea, i, 'signature_name');
|
|
|
+ _chkAndSetArea(sCell, actSignArea, signDateArea, i, 'signature_name');
|
|
|
} else {
|
|
|
let stampArea = _getStampArea(sCell);
|
|
|
- _chkAndSetArea(sCell, stampArea, i, 'signatureName'); // 注意:这里的判断不是signature_name(含dummy的),而是signatureName属性(之前的章信息设计导致)
|
|
|
+ _chkAndSetArea(sCell, stampArea, signDateArea, i, 'signatureName'); // 注意:这里的判断不是signature_name(含dummy的),而是signatureName属性(之前的章信息设计导致)
|
|
|
}
|
|
|
}
|
|
|
}
|