|  | @@ -317,14 +317,135 @@
 | 
	
		
			
				|  |  |          </div>
 | 
	
		
			
				|  |  |      </div>
 | 
	
		
			
				|  |  |  </div>
 | 
	
		
			
				|  |  | +<!--管理通用报表-->
 | 
	
		
			
				|  |  | +<div class="modal fade" id="man-c" 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_common">
 | 
	
		
			
				|  |  | +                    </table>
 | 
	
		
			
				|  |  | +                </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-primary" data-dismiss="modal" onclick="updateCustRptCfg()">确认</button>
 | 
	
		
			
				|  |  | +            </div>
 | 
	
		
			
				|  |  | +        </div>
 | 
	
		
			
				|  |  | +    </div>
 | 
	
		
			
				|  |  | +</div>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  <script>
 | 
	
		
			
				|  |  |      zTreeOprObj.getCustomerCfg();
 | 
	
		
			
				|  |  |      zTreeOprObj.iniFontCfgDom(CUST_CFG);
 | 
	
		
			
				|  |  | +    buildCommonCustRpt();
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      function searchAccount() {
 | 
	
		
			
				|  |  |          if (event.keyCode == 13) {
 | 
	
		
			
				|  |  |              rptSignatureHelper.buildSelectableAccount(this);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    function buildCommonCustRpt() {
 | 
	
		
			
				|  |  | +        //CUST_TREE_NODES
 | 
	
		
			
				|  |  | +        let tbDom = $("#report_cust_group_common");
 | 
	
		
			
				|  |  | +        tbDom.empty();
 | 
	
		
			
				|  |  | +        tbDom.append('<tr><th>类别</th><th>包含报表</th><th>显示</th></tr>');
 | 
	
		
			
				|  |  | +        let _countAvailableTpls = function (tItem) {
 | 
	
		
			
				|  |  | +            let rst = 0;
 | 
	
		
			
				|  |  | +            if (tItem.nodeType === 1 && tItem.items && tItem.items.length > 0) {
 | 
	
		
			
				|  |  | +                for (const dItem of tItem.items) {
 | 
	
		
			
				|  |  | +                    if (dItem.nodeType === 2) {
 | 
	
		
			
				|  |  | +                        if (dItem.released) rst++;
 | 
	
		
			
				|  |  | +                    } else {
 | 
	
		
			
				|  |  | +                        rst += _countAvailableTpls(dItem);
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            return rst;
 | 
	
		
			
				|  |  | +        };
 | 
	
		
			
				|  |  | +        let _pushRptLine = function (rptItem, level) {
 | 
	
		
			
				|  |  | +            if (rptItem.nodeType === 1) {
 | 
	
		
			
				|  |  | +                let amt = _countAvailableTpls(rptItem);
 | 
	
		
			
				|  |  | +                let classStr = '';
 | 
	
		
			
				|  |  | +                if (level > 0) {
 | 
	
		
			
				|  |  | +                    classStr = 'pl-' + (level + 3);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                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(subItem, level + 1);
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        let TplAmts = [];
 | 
	
		
			
				|  |  | +        for (const topItem of ORG_TOP_TREE_NODES[1].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>');
 | 
	
		
			
				|  |  | +            if (topItem.items && topItem.items.length > 0) {
 | 
	
		
			
				|  |  | +                for (const subItem of topItem.items) {
 | 
	
		
			
				|  |  | +                    _pushRptLine(subItem, 1);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    function updateCustRptCfg(){
 | 
	
		
			
				|  |  | +        let params = {};
 | 
	
		
			
				|  |  | +        params.nodeItems = CUST_TREE_NODES;
 | 
	
		
			
				|  |  | +        CommonAjax.postXsrfEx("/tender/report_api/updateCustNode", params, 60000, true, getCookie('csrfToken'),
 | 
	
		
			
				|  |  | +            function(result){
 | 
	
		
			
				|  |  | +                try {
 | 
	
		
			
				|  |  | +                    // console.log(result);
 | 
	
		
			
				|  |  | +                    ORG_CUST_TREE_NODES.common = JSON.parse(JSON.stringify(CUST_TREE_NODES.common));
 | 
	
		
			
				|  |  | +                    //刷新报表模板树
 | 
	
		
			
				|  |  | +                    TOP_TREE_NODES = JSON.parse(JSON.stringify(ORG_TOP_TREE_NODES));
 | 
	
		
			
				|  |  | +                    // 移除未被选择的模板
 | 
	
		
			
				|  |  | +                    for (let rIdx = TOP_TREE_NODES[1].items.length - 1; rIdx >= 0; rIdx--) {
 | 
	
		
			
				|  |  | +                        if (CUST_TREE_NODES.common.indexOf(TOP_TREE_NODES[1].items[rIdx].name) < 0) {
 | 
	
		
			
				|  |  | +                            TOP_TREE_NODES[1].items.splice(rIdx, 1);
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    zTreeOprObj.getReportTemplateTree();
 | 
	
		
			
				|  |  | +                } catch(err) {
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }, function(err){
 | 
	
		
			
				|  |  | +                // hintBox.unWaitBox();
 | 
	
		
			
				|  |  | +            }, function(ex){
 | 
	
		
			
				|  |  | +                // hintBox.unWaitBox();
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        );
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    function revertCustRptCfg(){
 | 
	
		
			
				|  |  | +        CUST_TREE_NODES.common = JSON.parse(JSON.stringify(ORG_CUST_TREE_NODES.common));
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    function changeFolder(dom, isCommon) {
 | 
	
		
			
				|  |  | +        let idx = CUST_TREE_NODES.common.indexOf(dom.attributes['hiddenval'].value);
 | 
	
		
			
				|  |  | +        if (dom.checked) {
 | 
	
		
			
				|  |  | +            if (isCommon) {
 | 
	
		
			
				|  |  | +                if (idx < 0) {
 | 
	
		
			
				|  |  | +                    CUST_TREE_NODES.common.push(dom.attributes['hiddenval'].value);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +                //保留定制报表分支
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            if (isCommon) {
 | 
	
		
			
				|  |  | +                if (idx >= 0) {
 | 
	
		
			
				|  |  | +                    CUST_TREE_NODES.common.splice(idx, 1);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +                //保留定制报表分支
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |  </script>
 |