|
@@ -29,6 +29,43 @@ let rptSignatureHelper = {
|
|
|
}
|
|
|
curPicDom.className = classMap[curPicDom.className][0];
|
|
|
},
|
|
|
+ buildFlowAccount: function() {
|
|
|
+ // 显示:显示当前期(或材差、预付款等)的审核流程里面审批类型为协同的流程
|
|
|
+ // 1. 清理所有选择项
|
|
|
+ const accDiv = $('#assistant_audit_account_div');
|
|
|
+ accDiv.empty();
|
|
|
+ // 2. 获取STAG_FLOW的审核信息(如一审、二审等)
|
|
|
+ const collectedSf = [];
|
|
|
+ STAGE_FLOW.forEach(sf => {
|
|
|
+ // audit_type === 4 // 4是协审
|
|
|
+ if (sf.audit_type === 4) {
|
|
|
+ collectedSf.push(sf);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (collectedSf.length > 0) {
|
|
|
+ const cacheObj = {};
|
|
|
+ collectedSf.forEach(sf => {
|
|
|
+ const chnStr = `${transFormToChinese(sf.audit_order)}审`;
|
|
|
+ if (!cacheObj[chnStr]) {
|
|
|
+ cacheObj[chnStr] = { order: sf.audit_order };
|
|
|
+ }
|
|
|
+ // cacheObj[chnStr].push(sf);
|
|
|
+ });
|
|
|
+ const htmls = ['<ul class="list-group">'];
|
|
|
+ // htmls.push('<optgroup label="审批流程">');
|
|
|
+ htmls.push('<li class="px-2 text-muted"><i class="fa fa-caret-down"></i>审批流程</li>');
|
|
|
+ for (let key in cacheObj) {
|
|
|
+ // cacheObj[key]
|
|
|
+ // htmls.push(`<a class="dropdown-item" href="javascript: void(0)" data-dismiss="modal">${key}(协同)</a>`);
|
|
|
+ htmls.push(`<a class="dropdown-item" href="javascript: void(0)" onclick="rptSignatureHelper.createEsignatureByAssistantFlow('${key}', ${cacheObj[key].order})" data-dismiss="modal">${key}(协同)</a>`);
|
|
|
+ }
|
|
|
+ // htmls.push('</optgroup>');
|
|
|
+ htmls.push('</ul>')
|
|
|
+ accDiv.append(htmls.join(''));
|
|
|
+ } else {
|
|
|
+ // 隐藏这里的div/button?
|
|
|
+ }
|
|
|
+ },
|
|
|
buildSelectableAccount: function () {
|
|
|
//PRJ_ACCOUNT_LIST
|
|
|
//1. 清理所有选择项
|
|
@@ -112,6 +149,107 @@ let rptSignatureHelper = {
|
|
|
}
|
|
|
accDiv.append(prj_accounts.join(''));
|
|
|
},
|
|
|
+ createEsignatureByAssistantFlow: function(assName, order) {
|
|
|
+ const dftSignSrc = '/public/upload/sign/user-sign.PNG';
|
|
|
+ if (rptSignatureHelper.currentSelectedESignAccName !== null) {
|
|
|
+ for (const page of zTreeOprObj.currentRptPageRst.items) {
|
|
|
+ if (page.signature_cells) {
|
|
|
+ for (const sCell of page.signature_cells) {
|
|
|
+ if (sCell.signature_name === rptSignatureHelper.currentSelectedESignAccName) {
|
|
|
+ sCell.pre_path = dftSignSrc;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 1. 删除不需要的child dom
|
|
|
+ $(rptSignatureHelper.currentSelectedESignAccDom).empty();
|
|
|
+ // 2. 创建已选择签名相关 dom
|
|
|
+ rptSignatureHelper.cleanOldSignature(rptSignatureHelper.currentSelectedESignAccName);
|
|
|
+ const elementsStrArr = [];
|
|
|
+ rptSignatureHelper.pushDomElementByFlow(elementsStrArr, `${assName}(协同)`, rptSignatureHelper.currentSelectedESignAccName);
|
|
|
+ let roleRelObj = {};
|
|
|
+ roleRelObj.signature_name = rptSignatureHelper.currentSelectedESignAccName;
|
|
|
+ roleRelObj.type = '流程';
|
|
|
+ roleRelObj.flowOrder = order;
|
|
|
+ roleRelObj.flow_name = `${assName}(协同)`;
|
|
|
+ roleRelObj.assFlowInfos = []; // 这里动态记录流程的协审信息(含:人名、单位、职位、签字签章、签字日期)
|
|
|
+ ROLE_REL_LIST.push(roleRelObj);
|
|
|
+ STAGE_FLOW.forEach(sf => {
|
|
|
+ if (sf.audit_order === order) {
|
|
|
+ const userAcc = rptSignatureHelper.getUserAccount(sf.aid);
|
|
|
+ let dftDate = '';
|
|
|
+ const status = _getStatusByUserId(userAcc.id);
|
|
|
+ if (status === 3) dftDate = _getSignDateByAllScenarios(userAcc.id);
|
|
|
+ const newRoleRel = {
|
|
|
+ signature_name: rptSignatureHelper.currentSelectedESignAccName,
|
|
|
+ acc_id: sf.aid,
|
|
|
+ user_name: sf.name,
|
|
|
+ company: sf.company,
|
|
|
+ role: sf.role,
|
|
|
+ sign_date: dftDate,
|
|
|
+ sign_date_format: 'yyyy年M月d日',
|
|
|
+ sign_output: [NORMAL_SIGN_STR], // , PRIVATE_SIGN_STR, COMPANY_SIGN_STR
|
|
|
+ company_stamp_path: rptSignatureHelper._getCompanySign(sf.company),
|
|
|
+ status, // 记录一下吧,没坏处
|
|
|
+ }
|
|
|
+ newRoleRel.private_stamp_path = rptSignatureHelper._get_newPrivate_stamp_path(newRoleRel, userAcc); // 个人章从PRJ_ACCOUNT_LIST中获取
|
|
|
+ roleRelObj.assFlowInfos.push(newRoleRel);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $(rptSignatureHelper.currentSelectedESignAccDom).append(elementsStrArr.join(' '));
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getFlowRoleRel(signature_name) {
|
|
|
+ let rst = null;
|
|
|
+ for (let idx = 0; idx < ROLE_REL_LIST.length; idx++) {
|
|
|
+ if (ROLE_REL_LIST[idx].signature_name === signature_name) {
|
|
|
+ rst = ROLE_REL_LIST[idx];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return rst;
|
|
|
+ },
|
|
|
+ iniAssFlowDialog(roleRelObj) {
|
|
|
+ if (roleRelObj.type !== '流程') return;
|
|
|
+ // 初始化协同人信息
|
|
|
+ const assFlowDialog = $('#assistant-flow-setting-table')
|
|
|
+ assFlowDialog.empty();
|
|
|
+ const assFlowElements = [];
|
|
|
+ assFlowElements.push('<tr class="text-center"><th width="60px">协同人</th><th>单位</th><th>职位</th><th width="100px">签字</th><th width="100px">个人章</th><th width="100px">公司章</th><th width="120px">签字日期</th></tr>');
|
|
|
+ roleRelObj.assFlowInfos.forEach((flowRoleRel, index) => {
|
|
|
+ const userAcc = rptSignatureHelper.getUserAccount(flowRoleRel.acc_id);
|
|
|
+ assFlowElements.push('<tr class="text-center">');
|
|
|
+ // 栏头
|
|
|
+ assFlowElements.push(`<td>${flowRoleRel.user_name}</td><td>${flowRoleRel.company}</td><td>${flowRoleRel.role}</td>`);
|
|
|
+ // 签字
|
|
|
+ const normalChk = flowRoleRel.sign_output.includes(NORMAL_SIGN_STR) ? 'checked' : '';
|
|
|
+ assFlowElements.push(`<td><input type="checkbox" ${normalChk} onchange="rptSignatureHelper._changeSignType(this, '${roleRelObj.signature_name}', '${NORMAL_SIGN_STR}', '${userAcc.stamp_path || ''}', ${index})" ></td>`);
|
|
|
+ //
|
|
|
+ // 个人章
|
|
|
+ if (flowRoleRel.private_stamp_path && flowRoleRel.private_stamp_path !== '') {
|
|
|
+ const privateChk = flowRoleRel.sign_output.includes(PRIVATE_SIGN_STR) ? 'checked' : '';
|
|
|
+ assFlowElements.push(`<td><input type="checkbox" ${privateChk} onchange="rptSignatureHelper._changeSignType(this, '${roleRelObj.signature_name}', '${PRIVATE_SIGN_STR}', '${userAcc.stamp_path || ''}', ${index})" >
|
|
|
+ <a class="pl-2" href="#chose-private-stamp-path" data-toggle="modal" data-target="#chose-private-stamp-path" onclick="rptSignatureHelper.currentSelectedESignAccDom = this.parentNode;rptSignatureHelper.initChosePrivateStampPath('${userAcc.stamp_path}','${roleRelObj.signature_name}', ${index}) ">选择个人章</a>
|
|
|
+ </td>`);
|
|
|
+ } else {
|
|
|
+ assFlowElements.push(`<td></td>`);
|
|
|
+ }
|
|
|
+ // 公司章 + 签字日期
|
|
|
+ const dateIdSuffixStr = `flowdtp_${roleRelObj.signature_name}_${index}`;
|
|
|
+ if (flowRoleRel.company_stamp_path && flowRoleRel.company_stamp_path !== '') {
|
|
|
+ const companyChk = flowRoleRel.sign_output.includes(COMPANY_SIGN_STR) ? 'checked' : '';
|
|
|
+ assFlowElements.push(`<td><input type="checkbox" ${companyChk} onchange="rptSignatureHelper._changeSignType(this, '${roleRelObj.signature_name}', '${COMPANY_SIGN_STR}', '${userAcc.stamp_path || ''}', ${index})" ></td>`);
|
|
|
+ assFlowElements.push(`<td><input type="text" class="form-control form-control-sm datepicker-here height-inputbox" aria-label="Small" aria-describedby="inputGroup-sizing-sm" data-language="zh"
|
|
|
+ id="${dateIdSuffixStr}" value="${flowRoleRel.sign_date || ''}"></td>`);
|
|
|
+ // elementsStrArr.push(`<input id="${dateIdSuffixStr}" type="text" class="form-control datepicker-here height-inputbox" aria-label="Small" aria-describedby="inputGroup-sizing-sm" data-language="zh" value="${dftDate}"></input>`);
|
|
|
+ } else {
|
|
|
+ assFlowElements.push(`<td></td>`);
|
|
|
+ }
|
|
|
+ // 收尾
|
|
|
+ assFlowElements.push('</tr>');
|
|
|
+ });
|
|
|
+ assFlowDialog.append(assFlowElements.join(' '));
|
|
|
+ },
|
|
|
createEsignatureByAccIdx: function (accIdx) {
|
|
|
rptSignatureHelper.createPreSelectedSignature(PRJ_ACCOUNT_LIST[accIdx], null);
|
|
|
},
|
|
@@ -214,6 +352,7 @@ let rptSignatureHelper = {
|
|
|
console.log(result);
|
|
|
USED_LIST = result.data;
|
|
|
$('#search_account').val('');
|
|
|
+ rptSignatureHelper.buildFlowAccount();
|
|
|
rptSignatureHelper.buildSelectableAccount();
|
|
|
rptSignatureHelper.buildSelectableAccountUsed();
|
|
|
}, function(err){
|
|
@@ -269,17 +408,28 @@ let rptSignatureHelper = {
|
|
|
if (role_rel.signature_name === sCell.signature_name) {
|
|
|
if (role_rel.type === '用户') {
|
|
|
rptSignatureHelper.pushDomElementByUser(elementsStrArr, role_rel.user_name, role_rel.role);
|
|
|
- } else {
|
|
|
- //角色
|
|
|
+ } else if (role_rel.type === '角色') {
|
|
|
rptSignatureHelper.pushDomElementByRole(elementsStrArr, role_rel.role_name, role_rel.user_name);
|
|
|
+ } else {
|
|
|
+ // 流程
|
|
|
+ rptSignatureHelper.pushDomElementByFlow(elementsStrArr, role_rel.flow_name, role_rel.signature_name);
|
|
|
}
|
|
|
- const userAcc = rptSignatureHelper.getUserAccount(role_rel.acc_id);
|
|
|
- if (userAcc) {
|
|
|
- role_rel.private_stamp_path = rptSignatureHelper._get_newPrivate_stamp_path(role_rel,userAcc);
|
|
|
- role_rel.company_stamp_path = rptSignatureHelper._getCompanySign(userAcc.company);
|
|
|
+ if (role_rel.type === '流程') {
|
|
|
+ role_rel.assFlowInfos.forEach(sf => {
|
|
|
+ const userAcc = rptSignatureHelper.getUserAccount(sf.acc_id);
|
|
|
+ if (userAcc) {
|
|
|
+ sf.private_stamp_path = rptSignatureHelper._get_newPrivate_stamp_path(sf, userAcc);
|
|
|
+ sf.company_stamp_path = rptSignatureHelper._getCompanySign(userAcc.company);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ const userAcc = rptSignatureHelper.getUserAccount(role_rel.acc_id);
|
|
|
+ if (userAcc) {
|
|
|
+ role_rel.private_stamp_path = rptSignatureHelper._get_newPrivate_stamp_path(role_rel,userAcc);
|
|
|
+ role_rel.company_stamp_path = rptSignatureHelper._getCompanySign(userAcc.company);
|
|
|
+ }
|
|
|
+ rptSignatureHelper.pushDatePickerDom(elementsStrArr, userAcc, role_rel, idx);
|
|
|
}
|
|
|
-
|
|
|
- rptSignatureHelper.pushDatePickerDom(elementsStrArr, userAcc, role_rel, idx);
|
|
|
hasPic = true;
|
|
|
break;
|
|
|
}
|
|
@@ -321,7 +471,13 @@ let rptSignatureHelper = {
|
|
|
'</i>-<small class="text-muted">' + userName +
|
|
|
'</small></span><a onclick="rptSignatureHelper.removeSignature(this)" class="text-danger"><i class="fa fa-remove" title="移除签名"></i></a></p>');
|
|
|
},
|
|
|
+ pushDomElementByFlow: function (elementsStrArr, flowName, signature_name) {
|
|
|
+ elementsStrArr.push(`<p class=" d-flex justify-content-between m-0"><span><a href="#add-liucheng" data-toggle="modal" data-target="#add-liucheng"
|
|
|
+ onclick="rptSignatureHelper.iniAssFlowDialog(rptSignatureHelper.getFlowRoleRel('${signature_name}'))">${flowName}</a>
|
|
|
+ </span><a onclick="rptSignatureHelper.removeSignature(this)" class="text-danger"><i class="fa fa-remove" title="移除签名"></i></a></p>`);
|
|
|
+ },
|
|
|
pushDatePickerDom: function (elementsStrArr, userAcc, role_rel, seq = 0) {
|
|
|
+ if (role_rel.type === '流程') return;
|
|
|
const dateIdSuffixStr = 'dtp_' + role_rel.signature_name + '_' + rptSignatureHelper.currentSelectedESignParentDivId;
|
|
|
let milliSec = (new Date()).getMilliseconds();
|
|
|
const idSuffixStr = `dtp_${seq}_${milliSec}_${rptSignatureHelper.currentSelectedESignParentDivId}`;
|
|
@@ -445,31 +601,34 @@ let rptSignatureHelper = {
|
|
|
// 调整了下次序,无论有没有签名时间显示,签名对象的sign_date必须得更新及保存
|
|
|
for (let idx = 0; idx < ROLE_REL_LIST.length; idx++) {
|
|
|
const role_rel = ROLE_REL_LIST[idx];
|
|
|
- const idSuffixStr = 'dtp_' + role_rel.signature_name + '_' + signatureDivId;
|
|
|
- // let dtDom = $('#' + idSuffixStr);
|
|
|
- let dtDom = document.getElementById(idSuffixStr); // 考虑到signature_name有括号的情况下,用jQuery会出异常,换成传统的方式取dom对象
|
|
|
- if (dtDom) {
|
|
|
- const dtStr = dtDom.value;
|
|
|
- if (dtStr && dtStr !== '' && dtStr.length >= 8 && dtStr.length <= 10) {
|
|
|
- role_rel.sign_date = new Date(dtStr);
|
|
|
- } else {
|
|
|
- role_rel.sign_date = '';
|
|
|
- }
|
|
|
- // 要处理相关签名Cell属性(默认跟普通cell一样,就多了个signature_name)
|
|
|
- if (page.signature_date_cells) {
|
|
|
- for (const sCell of page.signature_date_cells) {
|
|
|
- // 在重设之前要先清空旧的日期
|
|
|
- sCell.Value = '';
|
|
|
+ if (role_rel.type !== '流程') {
|
|
|
+ const idSuffixStr = 'dtp_' + role_rel.signature_name + '_' + signatureDivId;
|
|
|
+ let dtDom = document.getElementById(idSuffixStr); // 考虑到signature_name有括号的情况下,用jQuery会出异常,换成传统的方式取dom对象
|
|
|
+ if (dtDom) {
|
|
|
+ const dtStr = dtDom.value;
|
|
|
+ if (dtStr && dtStr !== '' && dtStr.length >= 8 && dtStr.length <= 10) {
|
|
|
+ role_rel.sign_date = new Date(dtStr);
|
|
|
+ } else {
|
|
|
+ role_rel.sign_date = '';
|
|
|
}
|
|
|
- for (const sCell of page.signature_date_cells) {
|
|
|
- if (sCell.signature_name === role_rel.signature_name + '_签字日期') {
|
|
|
- sCell.Value = _getSignDateDftName();
|
|
|
- if (role_rel.sign_date !== '') {
|
|
|
- sCell.Value = role_rel.sign_date.Format(role_rel.sign_date_format);
|
|
|
+ // 要处理相关签名Cell属性(默认跟普通cell一样,就多了个signature_name)
|
|
|
+ if (page.signature_date_cells) {
|
|
|
+ for (const sCell of page.signature_date_cells) {
|
|
|
+ // 在重设之前要先清空旧的日期
|
|
|
+ sCell.Value = '';
|
|
|
+ }
|
|
|
+ for (const sCell of page.signature_date_cells) {
|
|
|
+ if (sCell.signature_name === role_rel.signature_name + '_签字日期') {
|
|
|
+ sCell.Value = _getSignDateDftName();
|
|
|
+ if (role_rel.sign_date !== '') {
|
|
|
+ sCell.Value = role_rel.sign_date.Format(role_rel.sign_date_format);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ } else {
|
|
|
+ // 流程的处理不一样
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -731,7 +890,7 @@ let rptSignatureHelper = {
|
|
|
mergeSignature: function (pageData, currRoleRelList, setPic = false, checkAudit = false) {
|
|
|
for (const page of pageData.items) {
|
|
|
if (page.signature_cells) {
|
|
|
- const adHocScells = [];
|
|
|
+ // const adHocScells = [];
|
|
|
for (const sCell of page.signature_cells) {
|
|
|
if (sCell.signature_name.indexOf(JV.SIGNATURE_NAME_DUMMY) < 0) {
|
|
|
sCell.path = null;
|
|
@@ -739,50 +898,41 @@ let rptSignatureHelper = {
|
|
|
sCell.pic = null;
|
|
|
}
|
|
|
for (const role_rel of currRoleRelList) {
|
|
|
- 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; // 有些场景(如:批量归档)需要直接设置签名数据
|
|
|
- }
|
|
|
+ if (role_rel.type !== '流程') {
|
|
|
+ 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:
|
|
|
+ // 搬到了mergetStamp方法那去处理了
|
|
|
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;
|
|
|
}
|
|
|
+ } else {
|
|
|
+ //
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- page.signature_cells = page.signature_cells.concat(adHocScells);
|
|
|
+ // page.signature_cells = page.signature_cells.concat(adHocScells);
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -800,12 +950,16 @@ let rptSignatureHelper = {
|
|
|
passAuditChk = false;
|
|
|
if (roleRel) {
|
|
|
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 (role_rel.type !== '流程') {
|
|
|
+ if (role_rel.signature_name === signatureCell.signatureName) {
|
|
|
+ // signatureName(非signature_name)是印章cell特意给的属性,还有isStamp属性
|
|
|
+ if (rptSignatureHelper._chkIfAudit(role_rel)) {
|
|
|
+ passAuditChk = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
+ } else {
|
|
|
+ //
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -849,29 +1003,33 @@ let rptSignatureHelper = {
|
|
|
for (const sCell of page.signature_audit_cells) {
|
|
|
sCell.Value = ''; // 这里要先清除原有信息
|
|
|
for (const role_rel of currRoleRelList) {
|
|
|
- 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) {
|
|
|
- const isOrAudit = this._chkOrAudit(role_rel.acc_id);
|
|
|
- if (audit_rel.end_time > preDate && audit_rel.status === 3 || isOrAudit) {
|
|
|
- sCell.Value = audit_rel.opinion;
|
|
|
- if (typeof sCell.Value === 'string') {
|
|
|
- sCell.Value = sCell.Value.replace(reg1, '|').replace(reg2, '|').replace(reg3, '|').replace(reg4, '|').replace(reg5, '|').replace(reg6, '|');
|
|
|
+ if (role_rel.type !== '流程') {
|
|
|
+ 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) {
|
|
|
+ const isOrAudit = this._chkOrAudit(role_rel.acc_id);
|
|
|
+ if (audit_rel.end_time > preDate && audit_rel.status === 3 || isOrAudit) {
|
|
|
+ sCell.Value = audit_rel.opinion;
|
|
|
+ if (typeof sCell.Value === 'string') {
|
|
|
+ sCell.Value = sCell.Value.replace(reg1, '|').replace(reg2, '|').replace(reg3, '|').replace(reg4, '|').replace(reg5, '|').replace(reg6, '|');
|
|
|
+ }
|
|
|
+ sCell.Value = (sCell.Value === '' && isOrAudit) ? '同意' : sCell.Value;
|
|
|
+ preDate = audit_rel.end_time;
|
|
|
+ } else {
|
|
|
+ sCell.Value = ''; // 如有匹配,但又不能输出,则需要清空
|
|
|
}
|
|
|
- sCell.Value = (sCell.Value === '' && isOrAudit) ? '同意' : sCell.Value;
|
|
|
- preDate = audit_rel.end_time;
|
|
|
- } else {
|
|
|
- sCell.Value = ''; // 如有匹配,但又不能输出,则需要清空
|
|
|
+ //不能break,实际会有多个审核意见,以最后一个为准
|
|
|
}
|
|
|
- //不能break,实际会有多个审核意见,以最后一个为准
|
|
|
}
|
|
|
+ break;
|
|
|
}
|
|
|
- break;
|
|
|
}
|
|
|
+ } else {
|
|
|
+ // 流程的处理还得看实际数据
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -882,34 +1040,38 @@ let rptSignatureHelper = {
|
|
|
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 === '' || this._chkIfOrgRpt(role_rel.acc_id)) {
|
|
|
- // if (role_rel.sign_date === undefined || role_rel.sign_date === null || role_rel.sign_date === '') {
|
|
|
- if (role_rel.acc_id && (role_rel.sign_date === undefined || role_rel.sign_date === null || role_rel.sign_date === '')) {
|
|
|
- let dftDate = _getSignDateByAllScenarios(role_rel.acc_id);
|
|
|
- if (dftDate !== '' && dftDate.length >= 10) {
|
|
|
- dftDate = new Date(dftDate); // 不Format,保留时分秒
|
|
|
- } else if (dftDate === '') {
|
|
|
- if (current_stage_id <= -300 && current_stage_id > -400 && BGL_OBJ && BGL_OBJ.currentBz && BGL_OBJ.currentBz.status === 3) {
|
|
|
- if (STAGE_AUDIT && STAGE_AUDIT.length > 0) {
|
|
|
- dftDate = new Date(STAGE_AUDIT[STAGE_AUDIT.length - 1].end_time);
|
|
|
+ if (role_rel.type !== '流程') {
|
|
|
+ // if (role_rel.sign_date === undefined || role_rel.sign_date === null || role_rel.sign_date === '' || this._chkIfOrgRpt(role_rel.acc_id)) {
|
|
|
+ // if (role_rel.sign_date === undefined || role_rel.sign_date === null || role_rel.sign_date === '') {
|
|
|
+ if (role_rel.acc_id && (role_rel.sign_date === undefined || role_rel.sign_date === null || role_rel.sign_date === '')) {
|
|
|
+ let dftDate = _getSignDateByAllScenarios(role_rel.acc_id);
|
|
|
+ if (dftDate !== '' && dftDate.length >= 10) {
|
|
|
+ dftDate = new Date(dftDate); // 不Format,保留时分秒
|
|
|
+ } else if (dftDate === '') {
|
|
|
+ if (current_stage_id <= -300 && current_stage_id > -400 && BGL_OBJ && BGL_OBJ.currentBz && BGL_OBJ.currentBz.status === 3) {
|
|
|
+ if (STAGE_AUDIT && STAGE_AUDIT.length > 0) {
|
|
|
+ dftDate = new Date(STAGE_AUDIT[STAGE_AUDIT.length - 1].end_time);
|
|
|
+ } else {
|
|
|
+ dftDate = new Date();
|
|
|
+ }
|
|
|
} else {
|
|
|
dftDate = new Date();
|
|
|
}
|
|
|
- } else {
|
|
|
- dftDate = new Date();
|
|
|
}
|
|
|
- }
|
|
|
- role_rel.sign_date = dftDate;
|
|
|
- if (isMergeOrgAlso) {
|
|
|
- for (const orgRR of rptSignatureHelper.originalRoleRelList) {
|
|
|
- if (orgRR.signature_name === role_rel.signature_name) {
|
|
|
- orgRR.sign_date = dftDate;
|
|
|
- break;
|
|
|
+ role_rel.sign_date = dftDate;
|
|
|
+ if (isMergeOrgAlso) {
|
|
|
+ for (const orgRR of rptSignatureHelper.originalRoleRelList) {
|
|
|
+ if (orgRR.signature_name === role_rel.signature_name) {
|
|
|
+ orgRR.sign_date = dftDate;
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
+ // rptSignatureHelper.originalRoleRelList[rridx].sign_date = dftDate; // 这个在实际情况下originalRoleRelList不一定与currRoleRelList一致
|
|
|
+ //备注:在多选导出的情况下,originalRoleRelList不需要merge
|
|
|
}
|
|
|
- // rptSignatureHelper.originalRoleRelList[rridx].sign_date = dftDate; // 这个在实际情况下originalRoleRelList不一定与currRoleRelList一致
|
|
|
- //备注:在多选导出的情况下,originalRoleRelList不需要merge
|
|
|
}
|
|
|
+ } else {
|
|
|
+ //
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1004,21 +1166,52 @@ let rptSignatureHelper = {
|
|
|
}
|
|
|
return rst;
|
|
|
},
|
|
|
- _changeSignType: function(dom, signature_name, chkStr, userStamp) {
|
|
|
+ _cancelFlowSignDate: function(signature_name) {
|
|
|
+ for (const roleRel of ROLE_REL_LIST) {
|
|
|
+ if (roleRel.signature_name === signature_name && roleRel.type === '流程') {
|
|
|
+ roleRel.assFlowInfos.forEach((asf, index) => {
|
|
|
+ const fdtpId = `flowdtp_${signature_name}_${index}`;
|
|
|
+ let dtDom = document.getElementById(fdtpId); // 考虑到signature_name有括号的情况下,用jQuery会出异常,换成传统的方式取dom对象
|
|
|
+ if (dtDom) {
|
|
|
+ dtDom.value = asf.sign_date || '';
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ _saveFlowSignDate: function(signature_name) {
|
|
|
+ for (const roleRel of ROLE_REL_LIST) {
|
|
|
+ if (roleRel.signature_name === signature_name && roleRel.type === '流程') {
|
|
|
+ roleRel.assFlowInfos.forEach((asf, index) => {
|
|
|
+ const fdtpId = `flowdtp_${signature_name}_${index}`;
|
|
|
+ let dtDom = document.getElementById(fdtpId); // 考虑到signature_name有括号的情况下,用jQuery会出异常,换成传统的方式取dom对象
|
|
|
+ if (dtDom) {
|
|
|
+ asf.sign_date = dtDom.value;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ _changeSignType: function(dom, signature_name, chkStr, userStamp, flowIndex = -1) {
|
|
|
for (const roleRel of ROLE_REL_LIST) {
|
|
|
if (roleRel.signature_name === signature_name) {
|
|
|
+ let newRoleRel = roleRel;
|
|
|
+ if (roleRel.type === '流程') {
|
|
|
+ newRoleRel = roleRel.assFlowInfos[flowIndex];
|
|
|
+ }
|
|
|
+
|
|
|
if (dom.checked) {
|
|
|
- if (roleRel.sign_output.indexOf(chkStr) < 0) {
|
|
|
- roleRel.sign_output.push(chkStr);
|
|
|
+ if (newRoleRel.sign_output.indexOf(chkStr) < 0) {
|
|
|
+ newRoleRel.sign_output.push(chkStr);
|
|
|
}
|
|
|
- if(chkStr==='private_stamp'&&!roleRel.private_stamp_path && userStamp){
|
|
|
- roleRel.private_stamp_path = userStamp.split('!;!')[0] ;
|
|
|
- console.log(roleRel.private_stamp_path);
|
|
|
+ if(chkStr==='private_stamp' && !newRoleRel.private_stamp_path && userStamp){
|
|
|
+ newRoleRel.private_stamp_path = userStamp.split('!;!')[0] ;
|
|
|
+ // console.log(newRoleRel.private_stamp_path);
|
|
|
}
|
|
|
} else {
|
|
|
- let idx = roleRel.sign_output.indexOf(chkStr);
|
|
|
+ let idx = newRoleRel.sign_output.indexOf(chkStr);
|
|
|
if (idx >= 0) {
|
|
|
- roleRel.sign_output.splice(idx, 1);
|
|
|
+ newRoleRel.sign_output.splice(idx, 1);
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
@@ -1055,10 +1248,16 @@ let rptSignatureHelper = {
|
|
|
targetCell.area.Right = pLeft + STD_STAMP_SIZE_WIDTH;
|
|
|
targetCell.area.Bottom = pTop + STD_STAMP_SIZE_HEIGHT;
|
|
|
},
|
|
|
- initChosePrivateStampPath:function(stampPathList,signature_name){
|
|
|
+ initChosePrivateStampPath:function(stampPathList, signature_name, flowIndex = -1){
|
|
|
let currentStamp='';
|
|
|
const targetNode= ROLE_REL_LIST.find(item=>item.signature_name===signature_name);
|
|
|
- if(targetNode) currentStamp=targetNode.private_stamp_path
|
|
|
+ if (targetNode) {
|
|
|
+ if (targetNode.type === '流程') {
|
|
|
+ currentStamp = targetNode.assFlowInfos[flowIndex].private_stamp_path;
|
|
|
+ } else {
|
|
|
+ currentStamp = targetNode.private_stamp_path;
|
|
|
+ }
|
|
|
+ }
|
|
|
let content=`<div class='row justify-content-md-center'>`;
|
|
|
stampPathList.split('!;!').forEach(item=>{
|
|
|
content+=`<div class="card col-3 p-2 m-3 d-flex ${currentStamp===item?'card-gk-active':''} stamp-img">
|
|
@@ -1074,6 +1273,7 @@ let rptSignatureHelper = {
|
|
|
}
|
|
|
|
|
|
content+=` </div><div class='privateStampRoleName' data-name='${signature_name}'></div>`;
|
|
|
+ content += `<div class='privateStampFlowIndex' data-name='${flowIndex}'></div>`;
|
|
|
|
|
|
$('#chose-private-stamp-path .modal-body').empty().append(content);
|
|
|
$('.stamp-img').on('click',(e)=>{
|
|
@@ -1083,24 +1283,28 @@ let rptSignatureHelper = {
|
|
|
$(e.currentTarget).find('.sel-width').addClass('sel-blue');
|
|
|
})
|
|
|
},
|
|
|
- setPrivateStamp(e){
|
|
|
+ setPrivateStamp(e, flowIndex = -1){
|
|
|
const imgSrc= $('.stamp-img.card-gk-active').find('.img-fluid').data('src');
|
|
|
const privateStampRoleName=$('.privateStampRoleName').data('name');
|
|
|
const targetNode= ROLE_REL_LIST.find(item=>item.signature_name==privateStampRoleName);
|
|
|
- targetNode.private_stamp_path=imgSrc;
|
|
|
+ if (targetNode.type = '流程') {
|
|
|
+ const flowIndex = +($('.privateStampFlowIndex').data('name'));
|
|
|
+ targetNode.assFlowInfos[flowIndex].private_stamp_path = imgSrc;
|
|
|
+ } else {
|
|
|
+ targetNode.private_stamp_path = imgSrc;
|
|
|
+ }
|
|
|
$('#chose-private-stamp-path').modal('hide');
|
|
|
},
|
|
|
- _get_newPrivate_stamp_path(roleRelObj,userAcc){
|
|
|
- if(!roleRelObj.private_stamp_path){
|
|
|
- if(!userAcc.stamp_path) return '';
|
|
|
- if(userAcc.stamp_path.split('!;!').length===1){
|
|
|
+ _get_newPrivate_stamp_path(roleRelObj,userAcc) {
|
|
|
+ if (!roleRelObj.private_stamp_path) {
|
|
|
+ if (!userAcc.stamp_path) return '';
|
|
|
+ if (userAcc.stamp_path.split('!;!').length === 1) {
|
|
|
return userAcc.stamp_path;
|
|
|
}else{
|
|
|
return userAcc.stamp_path.split('!;!')[0];
|
|
|
}
|
|
|
}
|
|
|
return roleRelObj.private_stamp_path;
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1144,6 +1348,18 @@ function _getSignDateByAllScenarios(userAccId) {
|
|
|
return rst;
|
|
|
}
|
|
|
|
|
|
+function _getStatusByUserId(userAccId) {
|
|
|
+ let rst = -1;
|
|
|
+ for (const stg_audit of STAGE_AUDIT) {
|
|
|
+ // 或签的也会在此 STAGE_AUDIT 列里面
|
|
|
+ if (stg_audit.aid === userAccId) {
|
|
|
+ rst = stg_audit.status;
|
|
|
+ // break; //因为实际业务中会有反复,所以就不break了,一直判断,以最后一个为准
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return rst;
|
|
|
+}
|
|
|
+
|
|
|
function _getSignDateDftName() {
|
|
|
return ' 年 月 日';
|
|
|
}
|
|
@@ -1179,44 +1395,48 @@ function resetStampSignature(pageData, roleRelList, checkAudit = false) {
|
|
|
for (let scIdx = 0; scIdx < page.signature_cells.length; scIdx++) {
|
|
|
const sCell = page.signature_cells[scIdx];
|
|
|
for (const role_rel of roleRelList) {
|
|
|
- if (!checkAudit || rptSignatureHelper._chkIfAudit(role_rel)) {
|
|
|
- if (sCell.signature_name === role_rel.signature_name) {
|
|
|
- if (Array.isArray(role_rel.sign_output) && role_rel.sign_output.length > 0) {
|
|
|
- for (const signType of role_rel.sign_output) {
|
|
|
- switch (signType) {
|
|
|
- case COMPANY_SIGN_STR:
|
|
|
- case PRIVATE_SIGN_STR:
|
|
|
- // 创建一个新的cell
|
|
|
- let stampPath = (signType === COMPANY_SIGN_STR) ? role_rel.company_stamp_path : role_rel.private_stamp_path;
|
|
|
- stampPath = OSS_PATH + stampPath;
|
|
|
- if (dupPicPaths.indexOf(stampPath) < 0) {
|
|
|
- dupPicPaths.push(stampPath);
|
|
|
- }
|
|
|
- // 签字信息中如果有签章位置信息,则直接用位置信息
|
|
|
- let signatureArea;
|
|
|
- if (role_rel.areaData && role_rel.areaData[signType]){
|
|
|
- signatureArea = role_rel.areaData[signType]
|
|
|
- }
|
|
|
- const newStampCell = {
|
|
|
- signature_name: JV.SIGNATURE_NAME_DUMMY,
|
|
|
- control: sCell.control,
|
|
|
- style: sCell.style,
|
|
|
- path: stampPath,
|
|
|
- isStamp: true,
|
|
|
- maxRect,
|
|
|
- orgArea: sCell.area,
|
|
|
- area: signatureArea || {Left: sCell.area.Left, Right: sCell.area.Right, Top: sCell.area.Top, Bottom: sCell.area.Bottom},
|
|
|
- signatureName: role_rel.signature_name, // 节点名称
|
|
|
- signType, // 签章信息
|
|
|
- isSaveSignature: !!signatureArea, // 是否有签章位置信息
|
|
|
- };
|
|
|
- newStampCells.push(newStampCell);
|
|
|
- break;
|
|
|
- default: break;
|
|
|
+ if (role_rel.type !== '流程') {
|
|
|
+ if (!checkAudit || rptSignatureHelper._chkIfAudit(role_rel)) {
|
|
|
+ if (sCell.signature_name === role_rel.signature_name) {
|
|
|
+ if (Array.isArray(role_rel.sign_output) && role_rel.sign_output.length > 0) {
|
|
|
+ for (const signType of role_rel.sign_output) {
|
|
|
+ switch (signType) {
|
|
|
+ case COMPANY_SIGN_STR:
|
|
|
+ case PRIVATE_SIGN_STR:
|
|
|
+ // 创建一个新的cell
|
|
|
+ let stampPath = (signType === COMPANY_SIGN_STR) ? role_rel.company_stamp_path : role_rel.private_stamp_path;
|
|
|
+ stampPath = OSS_PATH + stampPath;
|
|
|
+ if (dupPicPaths.indexOf(stampPath) < 0) {
|
|
|
+ dupPicPaths.push(stampPath);
|
|
|
+ }
|
|
|
+ // 签字信息中如果有签章位置信息,则直接用位置信息
|
|
|
+ let signatureArea;
|
|
|
+ if (role_rel.areaData && role_rel.areaData[signType]){
|
|
|
+ signatureArea = role_rel.areaData[signType]
|
|
|
+ }
|
|
|
+ const newStampCell = {
|
|
|
+ signature_name: JV.SIGNATURE_NAME_DUMMY,
|
|
|
+ control: sCell.control,
|
|
|
+ style: sCell.style,
|
|
|
+ path: stampPath,
|
|
|
+ isStamp: true,
|
|
|
+ maxRect,
|
|
|
+ orgArea: sCell.area,
|
|
|
+ area: signatureArea || {Left: sCell.area.Left, Right: sCell.area.Right, Top: sCell.area.Top, Bottom: sCell.area.Bottom},
|
|
|
+ signatureName: role_rel.signature_name, // 节点名称
|
|
|
+ signType, // 签章信息
|
|
|
+ isSaveSignature: !!signatureArea, // 是否有签章位置信息
|
|
|
+ };
|
|
|
+ newStampCells.push(newStampCell);
|
|
|
+ break;
|
|
|
+ default: break;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ } else {
|
|
|
+ // 流程数据不一样的判断处理
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1251,15 +1471,19 @@ function resetTextSignature(pageData, checkAudit = false) {
|
|
|
if (fitCell) {
|
|
|
fitCell.Value = '';
|
|
|
for (let role of ROLE_REL_LIST) {
|
|
|
- if (!checkAudit || rptSignatureHelper._chkIfAudit(role)) {
|
|
|
- if (sCell.signature_name === role.signature_name) {
|
|
|
- if (role.sign_output && role.sign_output.indexOf(NORMAL_SIGN_STR) >= 0) {
|
|
|
- fitCell.Value = role.user_name;
|
|
|
- } else {
|
|
|
- fitCell.Value = '';
|
|
|
+ if (role_rel.type !== '流程') {
|
|
|
+ if (!checkAudit || rptSignatureHelper._chkIfAudit(role)) {
|
|
|
+ if (sCell.signature_name === role.signature_name) {
|
|
|
+ if (role.sign_output && role.sign_output.indexOf(NORMAL_SIGN_STR) >= 0) {
|
|
|
+ fitCell.Value = role.user_name;
|
|
|
+ } else {
|
|
|
+ fitCell.Value = '';
|
|
|
+ }
|
|
|
+ break;
|
|
|
}
|
|
|
- break;
|
|
|
}
|
|
|
+ } else {
|
|
|
+ //
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
@@ -1273,11 +1497,15 @@ function resetTextSignature(pageData, checkAudit = false) {
|
|
|
};
|
|
|
if (ROLE_REL_LIST) {
|
|
|
for (let role of ROLE_REL_LIST) {
|
|
|
- if (!checkAudit || rptSignatureHelper._chkIfAudit(role)) {
|
|
|
- if (sCell.signature_name === role.signature_name && role.sign_output && role.sign_output.indexOf(NORMAL_SIGN_STR) >= 0) {
|
|
|
- newCell.Value = role.user_name;
|
|
|
- break;
|
|
|
+ if (role_rel.type !== '流程') {
|
|
|
+ if (!checkAudit || rptSignatureHelper._chkIfAudit(role)) {
|
|
|
+ if (sCell.signature_name === role.signature_name && role.sign_output && role.sign_output.indexOf(NORMAL_SIGN_STR) >= 0) {
|
|
|
+ newCell.Value = role.user_name;
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
+ } else {
|
|
|
+ //
|
|
|
}
|
|
|
}
|
|
|
}
|