'use strict';
/**
*
*
* @author Mai
* @date
* @version
*/
const rptCustomObj = (function () {
const sAuditSelect = 'audit_select';
let stageFlow = [];
const getStageFlowSelectHtml = function (select) {
const html = [];
html.push('');
return html.join('');
};
const initAuditSelect = function (asSetting, asSelect) {
const setting = JSON.parse(asSetting), select = asSelect;
$('#audit-select-title').html(setting.title);
const html = [];
for (const [i, s] of setting.select.entries()) {
html.push('
');
html.push('', s.title, ' | ');
html.push('', getStageFlowSelectHtml(select[i]), ' | ');
html.push('
');
}
$('#audit-select-list').html(html.join(''));
};
const init = function (cDefine, sfData, cSelect) {
stageFlow = sfData;
if (cDefine && cDefine.enable && cDefine[sAuditSelect] && cDefine[sAuditSelect] !== '') {
$('#pnl_audit_select').show();
initAuditSelect(cDefine[sAuditSelect].setting, cSelect.audit_select);
} else {
$('#pnl_audit_select').hide();
}
};
const reloadReportData = function (result) {
// hintBox.unWaitBox();
let pageRst = result.data;
if (result.signatureRelInfo && result.signatureRelInfo.length > 0) {
CURRENT_ROLE_REL_ID = result.signatureRelInfo[0].id;
ROLE_REL_LIST = zTreeOprObj._parseRoleRelList(result.signatureRelInfo[0].rel_content);
STAGE_AUDIT = result.stageAudit;
rptSignatureHelper.originalRoleRelList = zTreeOprObj._parseRoleRelList(result.signatureRelInfo[0].rel_content);
if (current_stage_status === 3) {
rptSignatureHelper.mergeSignDate(pageRst);
rptSignatureHelper.mergeSignature(pageRst);
}
} else {
CURRENT_ROLE_REL_ID = -1;
ROLE_REL_LIST = [];
}
// if (ROLE_REL_LIST)
let canvas = zTreeOprObj.canvas;
if (pageRst && pageRst.items && pageRst.items.length > 0) {
zTreeOprObj.resetAfter(pageRst);
zTreeOprObj.currentRptPageRst = pageRst;
zTreeOprObj.maxPages = pageRst.items.length;
zTreeOprObj.currentPage = 1;
zTreeOprObj.displayPageValue();
let size = JpcCanvasOutput.getReportSizeInPixel(zTreeOprObj.currentRptPageRst, getScreenDPI());
canvas.width = size[0] + 20;
if (size[1] > size[0]) {
canvas.height = size[1] + 100;
} else {
canvas.height = size[1] + 50;
}
// zTreeOprObj.resetESignature(zTreeOprObj.currentRptPageRst);
rptSignatureHelper.buildSelectableAccount();
rptSignatureHelper.buildSelectableAccountUsed();
rptSignatureHelper.buildRoleDom(ROLE_LIST);
zTreeOprObj.showPage(1, canvas);
} else {
//返回了无数据表
JpcCanvasOutput.cleanCanvas(canvas);
JpcCanvasOutput.drawPageBorder(zTreeOprObj.currentRptPageRst, canvas, getScreenDPI());
}
rptCustomObj.init(result.customDefine, result.stageFlow, result.customSelect);
try {
if (is_debug && result.debugInfo) {
console.log('含有key的debug信息:');
for (const k in result.debugInfo.key) {
console.log(k + ':', ...result.debugInfo.key[k]);
}
//console.log(result.debugInfo.key);
console.log('其他debug信息:');
for (const di of result.debugInfo.other) {
console.log(...di);
}
}
} catch(err) {
}
};
const resetAuditSelect = function () {
const selObj = $('select', '#audit-select-list');
const data = { audit_select: [] };
data.pageSize = rptControlObj.getCurrentPageSize();
data.orientation = rptControlObj.getCurrentOrientation();
data.rpt_tpl_id = zTreeOprObj.currentNode.refId;
data.custCfg = CUST_CFG;
data.project_id = PROJECT_ID;
data.tender_id = TENDER_ID;
data.stage_id = getStageId();
data.stage_status = getStageStatus();
data.stage_order = getStageOrder();
data.stage_times = getStageTimes();
for (const s of selObj) {
data.audit_select.push(stageFlow[s.selectedIndex]);
}
postData('/report/cDefine', data, function (result) {
reloadReportData(result);
$('#audit-select').modal('hide');
});
};
return {init, resetAuditSelect};
})();