|
@@ -556,15 +556,6 @@ let rptSignatureHelper = {
|
|
|
if (result.data && result.data.insertId > 0) {
|
|
|
CURRENT_ROLE_REL_ID = result.data.insertId;
|
|
|
}
|
|
|
- // ROLE_REL_LIST = [];
|
|
|
- // for (const signatureRel of result.signatureRelInfo) {
|
|
|
- // ROLE_REL_LIST.push(JSON.parse(signatureRel.rel_content));
|
|
|
- // }
|
|
|
- // rptSignatureHelper.originalRoleRelList = JSON.parse(JSON.stringify(ROLE_REL_LIST));
|
|
|
-
|
|
|
- // ROLE_REL_LIST = me._parseRoleRelList(result.signatureRelInfo[0].rel_content);
|
|
|
- // rptSignatureHelper.originalRoleRelList = me._parseRoleRelList(result.signatureRelInfo[0].rel_content);
|
|
|
-
|
|
|
if (result.signatureRelInfo && result.signatureRelInfo.length > 0) {
|
|
|
// CURRENT_ROLE_REL_ID = result.signatureRelInfo[0].id;
|
|
|
ROLE_REL_LIST = me._parseRoleRelList(result.signatureRelInfo[0].rel_content);
|
|
@@ -574,8 +565,13 @@ let rptSignatureHelper = {
|
|
|
rptSignatureHelper.mergeSignature(zTreeOprObj.currentRptPageRst, ROLE_REL_LIST, true);
|
|
|
await rptSignatureHelper.resetDummySignature(zTreeOprObj.currentRptPageRst, ROLE_REL_LIST); // 这里重新整理签章坐标信息(因签章大小在后台暂时获取不到,挪到前端处理)
|
|
|
rptSignatureHelper.mergeSignAudit(zTreeOprObj.currentRptPageRst, ROLE_REL_LIST, STAGE_AUDIT);
|
|
|
- zTreeOprObj.showPage(zTreeOprObj.currentPage, zTreeOprObj.canvas);
|
|
|
+ } else {
|
|
|
+ rptSignatureHelper.mergeSignDate(zTreeOprObj.currentRptPageRst, ROLE_REL_LIST, true, true);
|
|
|
+ rptSignatureHelper.mergeSignature(zTreeOprObj.currentRptPageRst, ROLE_REL_LIST, true, true);
|
|
|
+ await rptSignatureHelper.resetDummySignature(zTreeOprObj.currentRptPageRst, ROLE_REL_LIST, true); // 这里重新整理签章坐标信息(因签章大小在后台暂时获取不到,挪到前端处理)
|
|
|
+ rptSignatureHelper.mergeSignAudit(zTreeOprObj.currentRptPageRst, ROLE_REL_LIST, STAGE_AUDIT, true);
|
|
|
}
|
|
|
+ zTreeOprObj.showPage(zTreeOprObj.currentPage, zTreeOprObj.canvas);
|
|
|
} else {
|
|
|
// CURRENT_ROLE_REL_ID = -1;
|
|
|
ROLE_REL_LIST = [];
|
|
@@ -679,7 +675,7 @@ let rptSignatureHelper = {
|
|
|
}
|
|
|
return rst;
|
|
|
},
|
|
|
- mergeSignature: function (pageData, currRoleRelList, setPic = false) {
|
|
|
+ mergeSignature: function (pageData, currRoleRelList, setPic = false, checkAudit = false) {
|
|
|
for (const page of pageData.items) {
|
|
|
if (page.signature_cells) {
|
|
|
const adHocScells = [];
|
|
@@ -690,43 +686,46 @@ let rptSignatureHelper = {
|
|
|
sCell.pic = null;
|
|
|
}
|
|
|
for (const role_rel of currRoleRelList) {
|
|
|
- if (role_rel.signature_name === sCell.signature_name) {
|
|
|
- // 处理签章
|
|
|
- if (!Array.isArray(role_rel.sign_output)) {
|
|
|
- role_rel.sign_output = [];
|
|
|
- role_rel.sign_output.push(NORMAL_SIGN_STR);
|
|
|
- }
|
|
|
- for (const signType of role_rel.sign_output) {
|
|
|
- switch (signType) {
|
|
|
- case NORMAL_SIGN_STR:
|
|
|
- sCell.path = role_rel.sign_path;
|
|
|
- sCell.pre_path = role_rel.sign_path;
|
|
|
- if (setPic) {
|
|
|
- sCell.pic = role_rel.sign_pic; // 有些场景(如:批量归档)需要直接设置签名数据
|
|
|
- }
|
|
|
+ if (!checkAudit || checkAudit && rptSignatureHelper._chkIfAudit(role_rel)) {
|
|
|
+ // 如果签名者是在审核流程中并已审批通过(个人通过,非期通过),则也需要显示
|
|
|
+ if (role_rel.signature_name === sCell.signature_name) {
|
|
|
+ // 处理签章
|
|
|
+ if (!Array.isArray(role_rel.sign_output)) {
|
|
|
+ role_rel.sign_output = [];
|
|
|
+ role_rel.sign_output.push(NORMAL_SIGN_STR);
|
|
|
+ }
|
|
|
+ for (const signType of role_rel.sign_output) {
|
|
|
+ switch (signType) {
|
|
|
+ case NORMAL_SIGN_STR:
|
|
|
+ sCell.path = role_rel.sign_path;
|
|
|
+ sCell.pre_path = role_rel.sign_path;
|
|
|
+ if (setPic) {
|
|
|
+ sCell.pic = role_rel.sign_pic; // 有些场景(如:批量归档)需要直接设置签名数据
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case COMPANY_SIGN_STR:
|
|
|
+ case PRIVATE_SIGN_STR:
|
|
|
+ /*
|
|
|
+ const stampPath = (signType === COMPANY_SIGN_STR) ? role_rel.company_stamp_path : role_rel.private_stamp_path;
|
|
|
+ // 生成一个新的dummy cell(类似草图)
|
|
|
+ const newStampCell = _createDummyCell();
|
|
|
+ newStampCell.signature_name = JV.SIGNATURE_NAME_DUMMY;
|
|
|
+ newStampCell.path = OSS_PATH + stampPath;
|
|
|
+ newStampCell.control = sCell.control;
|
|
|
+ newStampCell.style = sCell.style;
|
|
|
+ newStampCell.isStamp = true; // 这个标记纯属为了刷新用,其他sign cell是没有的
|
|
|
+ // 设置坐标
|
|
|
+ rptSignatureHelper._resetStampPos(sCell, newStampCell, pageData[JV.NODE_CONTROL_COLLECTION]);
|
|
|
+ // 加到cells去
|
|
|
+ adHocScells.push(newStampCell);
|
|
|
+ //*/
|
|
|
break;
|
|
|
- case COMPANY_SIGN_STR:
|
|
|
- case PRIVATE_SIGN_STR:
|
|
|
- /*
|
|
|
- const stampPath = (signType === COMPANY_SIGN_STR) ? role_rel.company_stamp_path : role_rel.private_stamp_path;
|
|
|
- // 生成一个新的dummy cell(类似草图)
|
|
|
- const newStampCell = _createDummyCell();
|
|
|
- newStampCell.signature_name = JV.SIGNATURE_NAME_DUMMY;
|
|
|
- newStampCell.path = OSS_PATH + stampPath;
|
|
|
- newStampCell.control = sCell.control;
|
|
|
- newStampCell.style = sCell.style;
|
|
|
- newStampCell.isStamp = true; // 这个标记纯属为了刷新用,其他sign cell是没有的
|
|
|
- // 设置坐标
|
|
|
- rptSignatureHelper._resetStampPos(sCell, newStampCell, pageData[JV.NODE_CONTROL_COLLECTION]);
|
|
|
- // 加到cells去
|
|
|
- adHocScells.push(newStampCell);
|
|
|
- //*/
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
+ break;
|
|
|
}
|
|
|
- break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -734,7 +733,7 @@ let rptSignatureHelper = {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- resetDummySignature: async function(pageData, roleRel, ifPushRoleRel = false) {
|
|
|
+ resetDummySignature: async function(pageData, roleRel, ifPushRoleRel = false, checkAudit = false) {
|
|
|
// 备注:计算草图等其他图形需要额外做些处理
|
|
|
let dummySignIdx = 0;
|
|
|
const stampPicKeys = [], stampPicFeatures = [];
|
|
@@ -743,111 +742,88 @@ let rptSignatureHelper = {
|
|
|
if (page[JV.PROP_SIGNATURE_CELLS] && page[JV.PROP_SIGNATURE_CELLS].length > 0) {
|
|
|
for (const signatureCell of page[JV.PROP_SIGNATURE_CELLS]) {
|
|
|
if (signatureCell.signature_name.indexOf(JV.SIGNATURE_NAME_DUMMY) >= 0) {
|
|
|
- // 表示这是一个其他类型的非原生电子签名图,只是借用signature的处理机制,每个图都是唯一的,所以需要重新给个唯一的新signature_name
|
|
|
- // signatureCell.signature_name = signatureCell.signature_name + '_' + pageIdx + '_' + dummySignIdx;
|
|
|
- signatureCell.signature_name = signatureCell.signature_name + '_' + page.page_seq + '_' + dummySignIdx; // page_seq在分页后都不会变动
|
|
|
- dummySignIdx++;
|
|
|
- const roleRelItem = { type: '用户', sign_path: signatureCell.path, signature_name: signatureCell.signature_name };
|
|
|
- if (signatureCell.isStamp) {
|
|
|
- let stmpIdx = stampPicKeys.indexOf(signatureCell.path);
|
|
|
- if (stampPicKeys.indexOf(signatureCell.path) < 0) {
|
|
|
- stampPicKeys.push(signatureCell.path);
|
|
|
- stmpIdx = stampPicKeys.length - 1;
|
|
|
- const picRes = await getHttpBlobText(signatureCell.path + '?x-oss-process=image/info');
|
|
|
- stampPicFeatures.push(picRes);
|
|
|
+ let passAuditChk = true;
|
|
|
+ if (checkAudit) {
|
|
|
+ passAuditChk = false;
|
|
|
+ for (const role_rel of roleRel) {
|
|
|
+ if (role_rel.signature_name === signatureCell.signatureName) {
|
|
|
+ // signatureName(非signature_name)是印章cell特意给的属性,还有isStamp属性
|
|
|
+ if (rptSignatureHelper._chkIfAudit(role_rel)) {
|
|
|
+ passAuditChk = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (passAuditChk) {
|
|
|
+ // 表示这是一个其他类型的非原生电子签名图,只是借用signature的处理机制,每个图都是唯一的,所以需要重新给个唯一的新signature_name
|
|
|
+ // signatureCell.signature_name = signatureCell.signature_name + '_' + pageIdx + '_' + dummySignIdx;
|
|
|
+ signatureCell.signature_name = signatureCell.signature_name + '_' + page.page_seq + '_' + dummySignIdx; // page_seq在分页后都不会变动
|
|
|
+ dummySignIdx++;
|
|
|
+ const roleRelItem = { type: '用户', sign_path: signatureCell.path, signature_name: signatureCell.signature_name };
|
|
|
+ if (signatureCell.isStamp) {
|
|
|
+ let stmpIdx = stampPicKeys.indexOf(signatureCell.path);
|
|
|
+ if (stampPicKeys.indexOf(signatureCell.path) < 0) {
|
|
|
+ stampPicKeys.push(signatureCell.path);
|
|
|
+ stmpIdx = stampPicKeys.length - 1;
|
|
|
+ const picRes = await getHttpBlobText(signatureCell.path + '?x-oss-process=image/info');
|
|
|
+ stampPicFeatures.push(picRes);
|
|
|
+ }
|
|
|
+ // { "FileSize": {"value": "2514"}, "Format": {"value": "png"}, "ImageHeight": {"value": "94"}, "ImageWidth": {"value": "94"} }
|
|
|
+ roleRelItem.stampFeature = stampPicFeatures[stmpIdx];
|
|
|
+ // 重新处理cell坐标
|
|
|
+ // 如果签章信息中存在位置信息,则不执行该方法
|
|
|
+ if(!signatureCell.isSaveSignature) _resetStampArea(pageData[JV.NODE_CONTROL_COLLECTION][signatureCell[JV.PROP_CONTROL]], signatureCell, roleRelItem);
|
|
|
}
|
|
|
- // { "FileSize": {"value": "2514"}, "Format": {"value": "png"}, "ImageHeight": {"value": "94"}, "ImageWidth": {"value": "94"} }
|
|
|
- roleRelItem.stampFeature = stampPicFeatures[stmpIdx];
|
|
|
- // 重新处理cell坐标
|
|
|
- // 如果签章信息中存在位置信息,则不执行该方法
|
|
|
- if(!signatureCell.isSaveSignature) _resetStampArea(pageData[JV.NODE_CONTROL_COLLECTION][signatureCell[JV.PROP_CONTROL]], signatureCell, roleRelItem);
|
|
|
+ if (ifPushRoleRel) roleRel.push(roleRelItem);
|
|
|
}
|
|
|
- if (ifPushRoleRel) roleRel.push(roleRelItem);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- mergeSignAudit: function (pageData, currRoleRelList, currAuditList) {
|
|
|
+ mergeSignAudit: function (pageData, currRoleRelList, currAuditList, checkAudit = false) {
|
|
|
for (const page of pageData.items) {
|
|
|
if (page.signature_audit_cells) {
|
|
|
for (const sCell of page.signature_audit_cells) {
|
|
|
sCell.Value = ''; // 这里要先清除原有信息
|
|
|
for (const role_rel of currRoleRelList) {
|
|
|
- if (sCell.signature_name === role_rel.signature_name + '_审核意见') {
|
|
|
- let preDate = '';
|
|
|
- sCell.Value = '同意'; // 只有选择了签名的,才需要初始化一个默认的意见(之前的逻辑在有多个签名,哪怕只选择了一个,其他的意见都会有默认意见)
|
|
|
- for (const audit_rel of currAuditList) {
|
|
|
- if (role_rel.acc_id === audit_rel.aid) {
|
|
|
- if (audit_rel.end_time > preDate && audit_rel.status === 3) {
|
|
|
- sCell.Value = audit_rel.opinion;
|
|
|
- preDate = audit_rel.end_time;
|
|
|
+ if (!checkAudit || checkAudit && rptSignatureHelper._chkIfAudit(role_rel)) {
|
|
|
+ // 如果签名者是在审核流程中并已审批通过(个人通过,非期通过),则也需要显示
|
|
|
+ if (sCell.signature_name === role_rel.signature_name + '_审核意见') {
|
|
|
+ let preDate = '';
|
|
|
+ sCell.Value = '同意'; // 只有选择了签名的,才需要初始化一个默认的意见(之前的逻辑在有多个签名,哪怕只选择了一个,其他的意见都会有默认意见)
|
|
|
+ for (const audit_rel of currAuditList) {
|
|
|
+ if (role_rel.acc_id === audit_rel.aid) {
|
|
|
+ if (audit_rel.end_time > preDate && audit_rel.status === 3) {
|
|
|
+ sCell.Value = audit_rel.opinion;
|
|
|
+ preDate = audit_rel.end_time;
|
|
|
+ }
|
|
|
+ //不能break,实际会有多个审核意见,以最后一个为准
|
|
|
}
|
|
|
- //不能break,实际会有多个审核意见,以最后一个为准
|
|
|
}
|
|
|
+ break;
|
|
|
}
|
|
|
- break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- mergeSignDate: function (pageData, currRoleRelList, isMergeOrgAlso) {
|
|
|
+ mergeSignDate: function (pageData, currRoleRelList, isMergeOrgAlso, checkAudit = false) {
|
|
|
if (currRoleRelList && currRoleRelList.length > 0 && STAGE_AUDIT && STAGE_AUDIT.length > 0) {
|
|
|
for (let rridx = 0; rridx < currRoleRelList.length; rridx++) {
|
|
|
const role_rel = currRoleRelList[rridx];
|
|
|
- if (role_rel.sign_date === undefined || role_rel.sign_date === null || role_rel.sign_date === '') {
|
|
|
- //*
|
|
|
- let dftDate = _getSignDateByAllScenarios(role_rel.acc_id);
|
|
|
- role_rel.sign_date = dftDate;
|
|
|
- if (isMergeOrgAlso) {
|
|
|
- rptSignatureHelper.originalRoleRelList[rridx].sign_date = dftDate;
|
|
|
- //备注:在多选导出的情况下,originalRoleRelList不需要merge
|
|
|
- }
|
|
|
- /*/
|
|
|
- let hasAudit = false;
|
|
|
- for (const stg_audit of STAGE_AUDIT) {
|
|
|
- if (role_rel.acc_id === stg_audit.aid) {
|
|
|
- hasAudit = true;
|
|
|
- if (stg_audit.status === 3) {
|
|
|
- role_rel.sign_date = stg_audit.end_time;
|
|
|
- rptSignatureHelper.originalRoleRelList[rridx].sign_date = stg_audit.end_time;
|
|
|
- } else {
|
|
|
- role_rel.sign_date = '';
|
|
|
- rptSignatureHelper.originalRoleRelList[rridx].sign_date = '';
|
|
|
- }
|
|
|
- // break; //因为实际业务中会有反复,所以就不break了,一直判断,以最后一个为准
|
|
|
- }
|
|
|
- }
|
|
|
- let isOrgRpt = false;
|
|
|
- for (const stg of STAGE_LIST) {
|
|
|
- if (stg.id === current_stage_id) {
|
|
|
- if (stg.user_id === role_rel.acc_id) {
|
|
|
- isOrgRpt = true;
|
|
|
- }
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- if (isOrgRpt && !hasAudit && STAGE_AUDIT_ORG && STAGE_AUDIT_ORG.length > 0) {
|
|
|
- if (STAGE_AUDIT_ORG[0].begin_time && STAGE_AUDIT_ORG[0].begin_time !== '' && STAGE_AUDIT_ORG[0].begin_time.length > 20) {
|
|
|
- role_rel.sign_date = STAGE_AUDIT_ORG[0].begin_time;
|
|
|
- rptSignatureHelper.originalRoleRelList[rridx].sign_date = STAGE_AUDIT_ORG[0].begin_time;
|
|
|
- }
|
|
|
- }
|
|
|
- if (!isOrgRpt && !hasAudit) {
|
|
|
- //非审批流程人员以及非原报,则显示期截至时间
|
|
|
- for (const stg of STAGE_LIST) {
|
|
|
- if (stg.id === current_stage_id && stg.period) {
|
|
|
- const period = stg.period.split(' ~ ');
|
|
|
- if (period.length === 2) {
|
|
|
- role_rel.sign_date = period[1];
|
|
|
- rptSignatureHelper.originalRoleRelList[rridx].sign_date = period[1];
|
|
|
- }
|
|
|
- }
|
|
|
+ if (!checkAudit || checkAudit && rptSignatureHelper._chkIfAudit(role_rel)) {
|
|
|
+ // 如果签名者是在审核流程中并已审批通过(个人通过,非期通过),则也需要显示
|
|
|
+ if (role_rel.sign_date === undefined || role_rel.sign_date === null || role_rel.sign_date === '') {
|
|
|
+ let dftDate = _getSignDateByAllScenarios(role_rel.acc_id);
|
|
|
+ role_rel.sign_date = dftDate;
|
|
|
+ if (isMergeOrgAlso) {
|
|
|
+ rptSignatureHelper.originalRoleRelList[rridx].sign_date = dftDate;
|
|
|
+ //备注:在多选导出的情况下,originalRoleRelList不需要merge
|
|
|
}
|
|
|
}
|
|
|
- //*/
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -872,6 +848,35 @@ let rptSignatureHelper = {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ _chkIfAudit: function(role_rel) {
|
|
|
+ // 检测是否在审核列表中
|
|
|
+ let rst = false;
|
|
|
+ for (const stg_audit of STAGE_AUDIT) {
|
|
|
+ if (role_rel.acc_id === stg_audit.aid) {
|
|
|
+ if (stg_audit.status === 3) {
|
|
|
+ rst = true;
|
|
|
+ } else {
|
|
|
+ rst = false;
|
|
|
+ }
|
|
|
+ // break; //因为实际业务中会有反复,所以就不break了,一直判断,以最后一个为准
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // rst = true; //测试,未来将屏蔽
|
|
|
+ return rst;
|
|
|
+ },
|
|
|
+ _chkIfOrgRpt: function(role_rel) {
|
|
|
+ // 检测是否原报
|
|
|
+ let rst = false;
|
|
|
+ for (const stg of STAGE_LIST) {
|
|
|
+ if (stg.id === current_stage_id) {
|
|
|
+ if (stg.user_id === role_rel.acc_id) {
|
|
|
+ rst = true;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return rst;
|
|
|
+ },
|
|
|
_changeSignType: function(dom, signature_name, chkStr, userStamp) {
|
|
|
for (const roleRel of ROLE_REL_LIST) {
|
|
|
if (roleRel.signature_name === signature_name) {
|