|
@@ -479,44 +479,76 @@ let rptArchiveObj = {
|
|
|
rst[1] = rst[1] + offsetY;
|
|
|
rst[3] = rst[3] + offsetY;
|
|
|
return rst;
|
|
|
- }
|
|
|
+ };
|
|
|
+ const _getStampArea = (stampCell) => {
|
|
|
+ const rst = [0, 0, 0, 0];
|
|
|
+ if (stampCell && stampCell[JV.PROP_AREA]) {
|
|
|
+ const left = Math.round(stampCell[JV.PROP_AREA][JV.PROP_LEFT]);
|
|
|
+ const right = Math.round(stampCell[JV.PROP_AREA][JV.PROP_RIGHT]);
|
|
|
+ const top = Math.round(stampCell[JV.PROP_AREA][JV.PROP_TOP]);
|
|
|
+ const bottom = Math.round(stampCell[JV.PROP_AREA][JV.PROP_BOTTOM]);
|
|
|
+ let width = right - left,
|
|
|
+ height = bottom - top;
|
|
|
+ rst[0] = left;
|
|
|
+ rst[1] = top;
|
|
|
+ rst[2] = rst[0] + width;
|
|
|
+ rst[3] = rst[1] + height;
|
|
|
+ }
|
|
|
+ rst[0] = rst[0] + offsetX;
|
|
|
+ rst[2] = rst[2] + offsetX;
|
|
|
+ rst[1] = rst[1] + offsetY;
|
|
|
+ rst[3] = rst[3] + offsetY;
|
|
|
+ return rst;
|
|
|
+ };
|
|
|
+ const _areaKeyCache = {
|
|
|
+ normal: 'areas',
|
|
|
+ company_stamp: 'company_stamp_areas',
|
|
|
+ private_stamp: 'private_stamp_areas'
|
|
|
+ };
|
|
|
+ const _chkAndSetArea = (sCell, actSignArea, 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: []};
|
|
|
+ let area = {Left: actSignArea[JV.IDX_LEFT] + offsetX, Top: actSignArea[JV.IDX_TOP] + offsetY, width: (actSignArea[JV.IDX_RIGHT] - actSignArea[JV.IDX_LEFT]), height: (actSignArea[JV.IDX_BOTTOM] - actSignArea[JV.IDX_TOP]), pages: []};
|
|
|
+ area.pages.push(pageIdx + 1);
|
|
|
+ newPsInfo[areaKey].push(area);
|
|
|
+ psInfo.push(newPsInfo);
|
|
|
+ } else {
|
|
|
+ let hasArea = false;
|
|
|
+ for (let areaItem of psInfo[idx][areaKey]) {
|
|
|
+ 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);
|
|
|
+ hasArea = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!hasArea) {
|
|
|
+ let area = {Left: actSignArea[JV.IDX_LEFT] + offsetX, Top: actSignArea[JV.IDX_TOP] + offsetY, width: (actSignArea[JV.IDX_RIGHT] - actSignArea[JV.IDX_LEFT]), height: (actSignArea[JV.IDX_BOTTOM] - actSignArea[JV.IDX_TOP]), pages: []};
|
|
|
+ area.pages.push(pageIdx + 1);
|
|
|
+ psInfo[idx][areaKey].push(area);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
for(let i = 0; i < pageData.items.length; i++) {
|
|
|
let page = pageData.items[i];
|
|
|
for (let sCell of page.signature_cells) {
|
|
|
// sCell.signature_name 草图不用加密
|
|
|
if (sCell.signature_name.indexOf('dummy_pic') < 0) {
|
|
|
- // if (sCell.signature_name !== 'dummy_pic') {
|
|
|
let control = null;
|
|
|
if (typeof sCell[JV.PROP_CONTROL] === "string") {
|
|
|
control = controls[sCell[JV.PROP_CONTROL]];
|
|
|
} else {
|
|
|
control = sCell[JV.PROP_CONTROL];
|
|
|
}
|
|
|
- let idx = psInfoStr.indexOf(sCell.signature_name);
|
|
|
let actSignArea = _getProperSignatureArea(sCell, control);
|
|
|
- if (idx < 0) {
|
|
|
- psInfoStr.push(sCell.signature_name);
|
|
|
- let newPsInfo = {'name': sCell.signature_name, areas: []};
|
|
|
- let area = {Left: actSignArea[JV.IDX_LEFT] + offsetX, Top: actSignArea[JV.IDX_TOP] + offsetY, width: (actSignArea[JV.IDX_RIGHT] - actSignArea[JV.IDX_LEFT]), height: (actSignArea[JV.IDX_BOTTOM] - actSignArea[JV.IDX_TOP]), pages: []};
|
|
|
- area.pages.push(i + 1);
|
|
|
- newPsInfo.areas.push(area);
|
|
|
- psInfo.push(newPsInfo);
|
|
|
- } else {
|
|
|
- let hasArea = false;
|
|
|
- for (let areaItem of psInfo[idx].areas) {
|
|
|
- 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(i + 1);
|
|
|
- hasArea = true;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- if (!hasArea) {
|
|
|
- let area = {Left: actSignArea[JV.IDX_LEFT] + offsetX, Top: actSignArea[JV.IDX_TOP] + offsetY, width: (actSignArea[JV.IDX_RIGHT] - actSignArea[JV.IDX_LEFT]), height: (actSignArea[JV.IDX_BOTTOM] - actSignArea[JV.IDX_TOP]), pages: []};
|
|
|
- area.pages.push(i + 1);
|
|
|
- psInfo[idx].areas.push(area);
|
|
|
- }
|
|
|
- }
|
|
|
+ _chkAndSetArea(sCell, actSignArea, i, 'signature_name');
|
|
|
+ } else {
|
|
|
+ let stampArea = _getStampArea(sCell);
|
|
|
+ _chkAndSetArea(sCell, stampArea, i, 'signatureName'); // 注意:这里的判断不是signature_name(含dummy的),而是signatureName属性(之前的章信息设计导致)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -525,27 +557,28 @@ let rptArchiveObj = {
|
|
|
archiveCurrentReport: function (currentRptPageRst, currentNode, cb) {
|
|
|
let picKeys = [], picCells = [], dupPicPath = [], dupPicCell = [];
|
|
|
// 1. 找草图路径
|
|
|
- for (let pageIdx = 0; pageIdx < currentRptPageRst.items.length; pageIdx++) {
|
|
|
- // 每页
|
|
|
- for (let sCellIdx = 0; sCellIdx < currentRptPageRst.items[pageIdx].signature_cells.length; sCellIdx++) {
|
|
|
- let sCell = currentRptPageRst.items[pageIdx].signature_cells[sCellIdx];
|
|
|
- // if (sCell.signature_name === 'dummy_pic' && sCell.path.indexOf('/sign') < 0) {
|
|
|
- if (sCell.signature_name.indexOf('dummy_pic') >= 0) {
|
|
|
- // if (sCell.signature_name === 'dummy_pic') {
|
|
|
- //1. 草图就不考虑重复问题,重复就重复吧;
|
|
|
- //2. 如果是dummy_pic,也不用判断是否为签名了,因为有其他的逻辑直接选择审核人,不经过签名过程,就当草图一样放过去了
|
|
|
- let picIdx = picKeys.indexOf(sCell.path);
|
|
|
- if (picIdx < 0) {
|
|
|
- picKeys.push(sCell.path);
|
|
|
- picCells.push(sCell);
|
|
|
- } else {
|
|
|
- let dPicIdx = dupPicPath.indexOf(sCell.path);
|
|
|
- if (dPicIdx < 0) {
|
|
|
- dupPicPath.push(sCell.path);
|
|
|
- dupPicCell.push([]);
|
|
|
- dPicIdx = dupPicPath.length - 1;
|
|
|
+ if (!PAGE_SHOW.closeArchiveSignature) {
|
|
|
+ for (let pageIdx = 0; pageIdx < currentRptPageRst.items.length; pageIdx++) {
|
|
|
+ // 每页
|
|
|
+ for (let sCellIdx = 0; sCellIdx < currentRptPageRst.items[pageIdx].signature_cells.length; sCellIdx++) {
|
|
|
+ let sCell = currentRptPageRst.items[pageIdx].signature_cells[sCellIdx];
|
|
|
+ // if (sCell.signature_name === 'dummy_pic' && sCell.path.indexOf('/sign') < 0) {
|
|
|
+ if (sCell.signature_name.indexOf('dummy_pic') >= 0) {
|
|
|
+ //1. 草图就不考虑重复问题,重复就重复吧;
|
|
|
+ //2. 如果是dummy_pic,也不用判断是否为签名了,因为有其他的逻辑直接选择审核人,不经过签名过程,就当草图一样放过去了
|
|
|
+ let picIdx = picKeys.indexOf(sCell.path);
|
|
|
+ if (picIdx < 0) {
|
|
|
+ picKeys.push(sCell.path);
|
|
|
+ picCells.push(sCell);
|
|
|
+ } else {
|
|
|
+ let dPicIdx = dupPicPath.indexOf(sCell.path);
|
|
|
+ if (dPicIdx < 0) {
|
|
|
+ dupPicPath.push(sCell.path);
|
|
|
+ dupPicCell.push([]);
|
|
|
+ dPicIdx = dupPicPath.length - 1;
|
|
|
+ }
|
|
|
+ dupPicCell[dPicIdx].push(sCell);
|
|
|
}
|
|
|
- dupPicCell[dPicIdx].push(sCell);
|
|
|
}
|
|
|
}
|
|
|
}
|