|
@@ -360,7 +360,28 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="modal-footer">
|
|
|
- <button type="button" class="btn btn-secondary" data-dismiss="modal" onclick="revertCustRptCfg();">关闭</button>
|
|
|
+ <button type="button" class="btn btn-secondary" data-dismiss="modal" onclick="revertCommonCustRptCfg();">关闭</button>
|
|
|
+ <!--有结果出现添加-->
|
|
|
+ <button type="button" class="btn btn-primary" data-dismiss="modal" onclick="updateCustRptCfg()">确认</button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</div>
|
|
|
+<!--管理定制报表-->
|
|
|
+<div class="modal fade" id="man-i" data-backdrop="static">
|
|
|
+ <div class="modal-dialog" role="document">
|
|
|
+ <div class="modal-content">
|
|
|
+ <div class="modal-header">
|
|
|
+ <h5 class="modal-title">管理定制报表</h5>
|
|
|
+ </div>
|
|
|
+ <div class="modal-body">
|
|
|
+ <div class="modal-height-500" style="overflow: auto;">
|
|
|
+ <table class="table table-sm table-bordered" id="report_cust_group_individual">
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="modal-footer">
|
|
|
+ <button type="button" class="btn btn-secondary" data-dismiss="modal" onclick="revertIndividualCustRptCfg();">关闭</button>
|
|
|
<!--有结果出现添加-->
|
|
|
<button type="button" class="btn btn-primary" data-dismiss="modal" onclick="updateCustRptCfg()">确认</button>
|
|
|
</div>
|
|
@@ -371,7 +392,8 @@
|
|
|
<script>
|
|
|
zTreeOprObj.getCustomerCfg();
|
|
|
zTreeOprObj.iniFontCfgDom(CUST_CFG);
|
|
|
- buildCommonCustRpt();
|
|
|
+ buildCustRptCommon('report_cust_group_common', ORG_TOP_TREE_NODES[1], CUST_TREE_NODES.common, 'true');
|
|
|
+ buildCustRptCommon('report_cust_group_individual', ORG_TOP_TREE_NODES[0], CUST_TREE_NODES.customize, 'false');
|
|
|
|
|
|
function searchAccount() {
|
|
|
if (event.keyCode == 13) {
|
|
@@ -379,9 +401,8 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- function buildCommonCustRpt() {
|
|
|
- //CUST_TREE_NODES
|
|
|
- let tbDom = $("#report_cust_group_common");
|
|
|
+ function buildCustRptCommon(tbDomId, topTreeNode, checkingArr, isCommonStr) {
|
|
|
+ let tbDom = $("#" + tbDomId);
|
|
|
tbDom.empty();
|
|
|
tbDom.append('<tr><th>类别</th><th>包含报表</th><th>显示</th></tr>');
|
|
|
let _countAvailableTpls = function (tItem) {
|
|
@@ -397,7 +418,7 @@
|
|
|
}
|
|
|
return rst;
|
|
|
};
|
|
|
- let _pushRptLine = function (parentItem, rptItem, level, needChk) {
|
|
|
+ let _pushRptLine = function (parentItem, rptItem, level, needChk, parentNodeIdStr, thisItemSeq) {
|
|
|
if (rptItem.nodeType === 1) {
|
|
|
let amt = _countAvailableTpls(rptItem);
|
|
|
let classStr = '';
|
|
@@ -406,30 +427,35 @@
|
|
|
}
|
|
|
if (needChk) {
|
|
|
let chkName = parentItem.name + FOLDER_SEPERATER + rptItem.name;
|
|
|
- let checkedStr = (CUST_TREE_NODES.common.indexOf(chkName) >= 0) ? ' checked' : '';
|
|
|
- tbDom.append('<tr><td class="' + classStr + '">' + rptItem.name + '</td><td>' + amt + '</td><td><input onchange="changeFolder(this, true)" hiddenval="' + chkName + '" type="checkbox"' + checkedStr + '></td></tr>');
|
|
|
+ let checkedStr = (checkingArr.indexOf(chkName) >= 0) ? ' checked' : '';
|
|
|
+ let sIdStr = parentNodeIdStr + '_sub_' + thisItemSeq;
|
|
|
+ tbDom.append('<tr><td class="' + classStr + '">' + rptItem.name + '</td><td>' + amt + '</td><td><input id="' + sIdStr + '" onchange="changeFolder(this, ' + isCommonStr + ', "' + parentNodeIdStr + '")" hiddenval="' + chkName + '" type="checkbox"' + checkedStr + '></td></tr>');
|
|
|
} else {
|
|
|
tbDom.append('<tr><td class="' + classStr + '">' + rptItem.name + '</td><td>' + amt + '</td><td></td></tr>');
|
|
|
}
|
|
|
- //tbDom.append('<tr><td class="' + classStr + '">' + rptItem.name + '</td><td>' + amt + '</td><td></td></tr>');
|
|
|
if (rptItem.items && rptItem.items.length > 0) {
|
|
|
for (const subItem of rptItem.items) {
|
|
|
- _pushRptLine(rptItem, subItem, level + 1, false);
|
|
|
+ _pushRptLine(rptItem, subItem, level + 1, false, '');
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
let TplAmts = [];
|
|
|
- for (const topItem of ORG_TOP_TREE_NODES[1].items) {
|
|
|
+ let parentIdx = 0;
|
|
|
+ let subCnt = topTreeNode.items.length;
|
|
|
+ for (const topItem of topTreeNode.items) {
|
|
|
TplAmts.push(_countAvailableTpls(topItem));
|
|
|
- let checkedStr = (CUST_TREE_NODES.common.indexOf(topItem.name) >= 0) ? ' checked' : '';
|
|
|
- //let checkedStr = (CUST_TREE_NODES.length > 0) ? ' checked' : '';
|
|
|
- tbDom.append('<tr><td>' + topItem.name + '</td><td>' + TplAmts[TplAmts.length - 1] + '</td><td><input onchange="changeFolder(this, true)" hiddenval="' + topItem.name + '" type="checkbox"' + checkedStr + '></td></tr>');
|
|
|
+ let checkedStr = (checkingArr.indexOf(topItem.name) >= 0) ? ' checked' : '';
|
|
|
+ let pIdStr = tbDomId + '_' + parentIdx + '_' + subCnt;
|
|
|
+ tbDom.append('<tr><td>' + topItem.name + '</td><td>' + TplAmts[TplAmts.length - 1] + '</td><td><input id="' + pIdStr + '" onchange="changeFolder(this, ' + isCommonStr + ', null)" hiddenval="' + topItem.name + '" type="checkbox"' + checkedStr + '></td></tr>');
|
|
|
if (topItem.items && topItem.items.length > 0) {
|
|
|
+ let subSeq = 0;
|
|
|
for (const subItem of topItem.items) {
|
|
|
- _pushRptLine(topItem, subItem, 1, true);
|
|
|
+ _pushRptLine(topItem, subItem, 1, true, pIdStr, subSeq);
|
|
|
}
|
|
|
+ subSeq++;
|
|
|
}
|
|
|
+ parentIdx++;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -441,10 +467,12 @@
|
|
|
try {
|
|
|
// console.log(result);
|
|
|
ORG_CUST_TREE_NODES.common = JSON.parse(JSON.stringify(CUST_TREE_NODES.common));
|
|
|
+ ORG_CUST_TREE_NODES.customize = JSON.parse(JSON.stringify(CUST_TREE_NODES.customize));
|
|
|
//刷新报表模板树
|
|
|
TOP_TREE_NODES = JSON.parse(JSON.stringify(ORG_TOP_TREE_NODES));
|
|
|
// 移除未被选择的模板
|
|
|
- filterUnchkTplTreeNode(TOP_TREE_NODES[1]);
|
|
|
+ filterUnchkTplTreeNode(TOP_TREE_NODES[0], CUST_TREE_NODES.customize);
|
|
|
+ filterUnchkTplTreeNode(TOP_TREE_NODES[1], CUST_TREE_NODES.common);
|
|
|
zTreeOprObj.getReportTemplateTree();
|
|
|
} catch(err) {
|
|
|
}
|
|
@@ -456,28 +484,39 @@
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- function revertCustRptCfg(){
|
|
|
+ function revertCommonCustRptCfg(){
|
|
|
CUST_TREE_NODES.common = JSON.parse(JSON.stringify(ORG_CUST_TREE_NODES.common));
|
|
|
- buildCommonCustRpt();
|
|
|
+ buildCustRptCommon('report_cust_group_common', ORG_TOP_TREE_NODES[1], CUST_TREE_NODES.common, 'true');
|
|
|
+ }
|
|
|
+
|
|
|
+ function revertIndividualCustRptCfg(){
|
|
|
+ CUST_TREE_NODES.customize = JSON.parse(JSON.stringify(ORG_CUST_TREE_NODES.customize));
|
|
|
+ buildCustRptCommon('report_cust_group_individual', ORG_TOP_TREE_NODES[0], CUST_TREE_NODES.customize, 'false');
|
|
|
}
|
|
|
|
|
|
- function changeFolder(dom, isCommon) {
|
|
|
- let idx = CUST_TREE_NODES.common.indexOf(dom.attributes['hiddenval'].value);
|
|
|
+ function changeFolder(dom, isCommon, parentIdStr) {
|
|
|
+ let prop = null;
|
|
|
+ if (isCommon) {
|
|
|
+ prop = CUST_TREE_NODES.common;
|
|
|
+ } else {
|
|
|
+ prop = CUST_TREE_NODES.customize;
|
|
|
+ }
|
|
|
+ let idx = prop.indexOf(dom.attributes['hiddenval'].value);
|
|
|
if (dom.checked) {
|
|
|
- if (isCommon) {
|
|
|
- if (idx < 0) {
|
|
|
- CUST_TREE_NODES.common.push(dom.attributes['hiddenval'].value);
|
|
|
+ if (idx < 0) {
|
|
|
+ prop.push(dom.attributes['hiddenval'].value);
|
|
|
+ if (parentIdStr === null) {
|
|
|
+ //这是父节点,需要把所有子节点都勾上
|
|
|
+ //后期补上
|
|
|
}
|
|
|
- } else {
|
|
|
- //保留定制报表分支
|
|
|
}
|
|
|
} else {
|
|
|
- if (isCommon) {
|
|
|
- if (idx >= 0) {
|
|
|
- CUST_TREE_NODES.common.splice(idx, 1);
|
|
|
+ if (idx >= 0) {
|
|
|
+ prop.splice(idx, 1);
|
|
|
+ if (parentIdStr === null) {
|
|
|
+ //这是父节点,需要把所有子节点都uncheck
|
|
|
+ //后期补上
|
|
|
}
|
|
|
- } else {
|
|
|
- //保留定制报表分支
|
|
|
}
|
|
|
}
|
|
|
}
|