|
@@ -9,6 +9,7 @@ let rptTplObj = {
|
|
|
|
|
|
let zTreeOprObj = {
|
|
|
treeObj: null,
|
|
|
+ bandTreeObj: null,
|
|
|
currentNode: null,
|
|
|
getReportTemplateTree: function(grpType) {
|
|
|
let me = zTreeOprObj, params = {};
|
|
@@ -279,12 +280,95 @@ let zTreeOprObj = {
|
|
|
}
|
|
|
$("#rpt_tpl_display_label")[0].innerText = showText;
|
|
|
if (treeNode.refId < 0) {
|
|
|
- $('#rptTypeSelectionModal').modal('show');
|
|
|
//创建新报表模板
|
|
|
+ $('#rptTypeSelectionModal').modal('show');
|
|
|
+ } else {
|
|
|
+ //显示报表模板
|
|
|
+ me.getRefTpl();
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
createNewTpl: function () {
|
|
|
- alert('创建中。。。')
|
|
|
+ let me = zTreeOprObj, params = {};
|
|
|
+ if (me.currentNode && me.currentNode.nodeType == RT.NodeType.TEMPLATE) {
|
|
|
+ params.treeNodeId = me.currentNode.ID;
|
|
|
+ let rptTypeId = common_rpt_type_ids.flow;
|
|
|
+ if ($("#crossTypeOpt")[0].checked) rptTypeId = common_rpt_type_ids.cross;
|
|
|
+ if ($("#billTypeOpt")[0].checked) rptTypeId = common_rpt_type_ids.bill;
|
|
|
+ params.rptDftTplId = rptTypeId
|
|
|
+ CommonAjax.postEx("report_tpl_api/createDftRptTpl", params, 20000, true, function(result){
|
|
|
+ me.currentNode.rptTpl = result;
|
|
|
+ }, null, null
|
|
|
+ );
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getRefTpl: function() {
|
|
|
+ let me = zTreeOprObj, params = {};
|
|
|
+ if (me.currentNode && me.currentNode.nodeType == RT.NodeType.TEMPLATE && me.currentNode.refId > 0) {
|
|
|
+ if (!(me.currentNode.rptTpl)) {
|
|
|
+ params.rptTplId = me.currentNode.refId;
|
|
|
+ CommonAjax.postEx("report_tpl_api/getRefRptTpl", params, 20000, true, function(result){
|
|
|
+ me.currentNode.rptTpl = result;
|
|
|
+ me.refreshTplView(me.currentNode.rptTpl);
|
|
|
+ }, null, null
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ me.refreshTplView(me.currentNode.rptTpl);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ refreshTplView: function (rptTpl) {
|
|
|
+ let me = zTreeOprObj;
|
|
|
+ if (rptTpl) {
|
|
|
+ //1. 模板信息
|
|
|
+ $("#rptTplName")[0].value = rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MAIN_INFO_RPT_NAME];
|
|
|
+ $("#rptTplPageSize")[0].selectedIndex = JV.PAGES_SIZE_STR.indexOf(rptTpl[JV.NODE_MAIN_INFO][JV.NODE_PAGE_INFO][JV.PROP_PAGE_SIZE]);
|
|
|
+ if (rptTpl[JV.NODE_MAIN_INFO][JV.NODE_PAGE_INFO][JV.PROP_ORIENTATION] === JV.ORIENTATION_PORTRAIT ||
|
|
|
+ rptTpl[JV.NODE_MAIN_INFO][JV.NODE_PAGE_INFO][JV.PROP_ORIENTATION] === JV.ORIENTATION_PORTRAIT_CHN) {
|
|
|
+ $("#rptTplPageOrientation")[0].selectedIndex = 1;
|
|
|
+ } else {
|
|
|
+ $("#rptTplPageOrientation")[0].selectedIndex = 0;
|
|
|
+ }
|
|
|
+ $("#rptTplMarginLeft")[0].value = rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_LEFT];
|
|
|
+ $("#rptTplMarginRight")[0].value = rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_RIGHT];
|
|
|
+ $("#rptTplMarginTop")[0].value = rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_TOP];
|
|
|
+ $("#rptTplMarginBottom")[0].value = rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_BOTTOM];
|
|
|
+ //2. 模板布局
|
|
|
+ let bandList = rptTpl[JV.NODE_BAND_COLLECTION];
|
|
|
+ me.buildTreeData(bandList);
|
|
|
+ me.bandTreeObj = $.fn.zTree.init($("#band_tree_reversed"), bandSetting, bandList);
|
|
|
+ me.bandTreeObj.expandAll(true);
|
|
|
+ //3. 指标映射
|
|
|
+ //4. 指标摆放
|
|
|
+ //5. 计算式
|
|
|
+ }
|
|
|
+ },
|
|
|
+ buildTreeData: function(bandList){
|
|
|
+ let rst = [], startIdx = 1;
|
|
|
+ //zTreeHelper.createTree(result, setting, "rptTplTree", me);
|
|
|
+ let private_setBandId = function (parentBand) {
|
|
|
+ if (parentBand.band_s) {
|
|
|
+ for (let band of parentBand.band_s) {
|
|
|
+ band.ID = startIdx;
|
|
|
+ band.ParentID = parentBand.ID;
|
|
|
+ startIdx++;
|
|
|
+ private_setBandId(band);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (let band of bandList) {
|
|
|
+ band.ID = startIdx;
|
|
|
+ band.ParentID = -1;
|
|
|
+ startIdx++;
|
|
|
+ private_setBandId(band);
|
|
|
+ }
|
|
|
+
|
|
|
+ return rst;
|
|
|
+ },
|
|
|
+ previewRptTpl: function (rptTpl) {
|
|
|
+ let me = zTreeOprObj;
|
|
|
+ if (rptTpl) {
|
|
|
+ //
|
|
|
+ }
|
|
|
}
|
|
|
}
|