|
@@ -29,14 +29,7 @@ let visualJumbo = {
|
|
let border = new GC.Spread.Sheets.LineBorder;
|
|
let border = new GC.Spread.Sheets.LineBorder;
|
|
border.color = "Black";
|
|
border.color = "Black";
|
|
border.style = GC.Spread.Sheets.LineStyle.thin;
|
|
border.style = GC.Spread.Sheets.LineStyle.thin;
|
|
- sheet.suspendPaint();
|
|
|
|
- sheet.setRowCount(0);
|
|
|
|
- sheet.setColumnCount(0);
|
|
|
|
- //1. put the pos into array
|
|
|
|
- let xPos = [0], yPos = [0];
|
|
|
|
let pageH, pageW;
|
|
let pageH, pageW;
|
|
- let bandMappingObj = {};
|
|
|
|
- me.bandMappingObj = bandMappingObj;
|
|
|
|
let pIdx = JV.PAGES_SIZE_STR.indexOf(rptTpl[JV.NODE_MAIN_INFO][JV.NODE_PAGE_INFO][JV.PROP_PAGE_SIZE]);
|
|
let pIdx = JV.PAGES_SIZE_STR.indexOf(rptTpl[JV.NODE_MAIN_INFO][JV.NODE_PAGE_INFO][JV.PROP_PAGE_SIZE]);
|
|
pageW = Math.round(JV.PAGES_SIZE[pIdx][0] * 96 - (parseFloat(rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_LEFT]) + parseFloat(rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_RIGHT])) /2.54*96 );
|
|
pageW = Math.round(JV.PAGES_SIZE[pIdx][0] * 96 - (parseFloat(rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_LEFT]) + parseFloat(rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_RIGHT])) /2.54*96 );
|
|
pageH = Math.round(JV.PAGES_SIZE[pIdx][1] * 96 - (parseFloat(rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_TOP]) + parseFloat(rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_BOTTOM])) /2.54*96 );
|
|
pageH = Math.round(JV.PAGES_SIZE[pIdx][1] * 96 - (parseFloat(rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_TOP]) + parseFloat(rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_BOTTOM])) /2.54*96 );
|
|
@@ -45,46 +38,66 @@ let visualJumbo = {
|
|
pageW = Math.round(JV.PAGES_SIZE[pIdx][1] * 96 - (parseFloat(rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_LEFT]) + parseFloat(rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_RIGHT])) /2.54*96 );
|
|
pageW = Math.round(JV.PAGES_SIZE[pIdx][1] * 96 - (parseFloat(rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_LEFT]) + parseFloat(rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_RIGHT])) /2.54*96 );
|
|
pageH = Math.round(JV.PAGES_SIZE[pIdx][0] * 96 - (parseFloat(rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_TOP]) + parseFloat(rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_BOTTOM])) /2.54*96 );
|
|
pageH = Math.round(JV.PAGES_SIZE[pIdx][0] * 96 - (parseFloat(rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_TOP]) + parseFloat(rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_BOTTOM])) /2.54*96 );
|
|
}
|
|
}
|
|
- xPos.push(pageW);
|
|
|
|
- // pageH = Math.round(pageH / 2);
|
|
|
|
- yPos.push(pageH);
|
|
|
|
- visualCommonOprObj.addBandPos(rptTpl, pageW, pageH, xPos, yPos, bandMappingObj);
|
|
|
|
- visualCommonOprObj.addTplTxtFldPos(rptTpl, dataInfoMapTreeOprObj.treeObj, xPos, yPos, bandMappingObj);
|
|
|
|
- //2. 设置spreadjs
|
|
|
|
- xPos.sort(function(x1, x2){ return (x1 - x2); });
|
|
|
|
- yPos.sort(function(y1, y2){ return (y1 - y2); });
|
|
|
|
- sheet.setRowCount(yPos.length - 1);
|
|
|
|
- sheet.setColumnCount(xPos.length - 1);
|
|
|
|
- for (let idx = 1; idx < xPos.length; idx++) {
|
|
|
|
- sheet.setColumnWidth(idx - 1, xPos[idx] - xPos[idx - 1]);
|
|
|
|
- }
|
|
|
|
- for (let idx = 1; idx < yPos.length; idx++) {
|
|
|
|
- sheet.setRowHeight(idx - 1, yPos[idx] - yPos[idx - 1]);
|
|
|
|
- sheet.getRange(idx - 1, -1, 1, -1).backColor(undefined);
|
|
|
|
|
|
+ sheet.suspendPaint();
|
|
|
|
+ sheet.setRowCount(0);
|
|
|
|
+ sheet.setColumnCount(0);
|
|
|
|
+ if (rptTpl[JV.NODE_FLOW_INFO] || rptTpl[JV.NODE_BILL_INFO]) {
|
|
|
|
+ //流水式/账单式
|
|
|
|
+ me.setupFlowBillTpl(rptTpl, sheet, border, pageW, pageH);
|
|
|
|
+ } else if (rptTpl[JV.NODE_CROSS_INFO]) {
|
|
|
|
+ //交叉式
|
|
|
|
+ //目前暂缓
|
|
|
|
+ me.setupCrossTpl(rptTpl, sheet, border, pageW, pageH);
|
|
}
|
|
}
|
|
- visualCommonOprObj.brushSheet(bandMappingObj, sheet, xPos, yPos);
|
|
|
|
- visualCommonOprObj.setupTplTxtFld(rptTpl, dataInfoMapTreeOprObj.treeObj, sheet, xPos, yPos, bandMappingObj)
|
|
|
|
- for (let idx = 1; idx < yPos.length; idx++) {
|
|
|
|
- let bkc = sheet.getCell(idx - 1, 0).backColor();
|
|
|
|
- if (bkc === 'White') {
|
|
|
|
- sheet.setRowHeight(idx - 1, 30);
|
|
|
|
- }
|
|
|
|
|
|
+ sheet.clearSelection();
|
|
|
|
+ sheet.resumePaint();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ setupFlowBillTpl: function (rptTpl, sheet, border, pageW, pageH) {
|
|
|
|
+ let me = this;
|
|
|
|
+ //1. put the pos into array
|
|
|
|
+ let xPos = [0], yPos = [0];
|
|
|
|
+ xPos.push(pageW);
|
|
|
|
+ yPos.push(pageH);
|
|
|
|
+ let bandMappingObj = {};
|
|
|
|
+ me.bandMappingObj = bandMappingObj;
|
|
|
|
+ visualCommonOprObj.addBandPos(rptTpl, pageW, pageH, xPos, yPos, bandMappingObj);
|
|
|
|
+ visualCommonOprObj.addTplTxtFldPos(rptTpl, dataInfoMapTreeOprObj.treeObj, xPos, yPos, bandMappingObj);
|
|
|
|
+ //2. 设置spreadjs
|
|
|
|
+ xPos.sort(function(x1, x2){ return (x1 - x2); });
|
|
|
|
+ yPos.sort(function(y1, y2){ return (y1 - y2); });
|
|
|
|
+ sheet.setRowCount(yPos.length - 1);
|
|
|
|
+ sheet.setColumnCount(xPos.length - 1);
|
|
|
|
+ for (let idx = 1; idx < xPos.length; idx++) {
|
|
|
|
+ sheet.setColumnWidth(idx - 1, xPos[idx] - xPos[idx - 1]);
|
|
|
|
+ }
|
|
|
|
+ for (let idx = 1; idx < yPos.length; idx++) {
|
|
|
|
+ sheet.setRowHeight(idx - 1, yPos[idx] - yPos[idx - 1]);
|
|
|
|
+ sheet.getRange(idx - 1, -1, 1, -1).backColor(undefined);
|
|
|
|
+ }
|
|
|
|
+ visualCommonOprObj.brushSheet(bandMappingObj, sheet, xPos, yPos);
|
|
|
|
+ visualCommonOprObj.setupTplTxtFld(rptTpl, dataInfoMapTreeOprObj.treeObj, sheet, xPos, yPos, bandMappingObj)
|
|
|
|
+ for (let idx = 1; idx < yPos.length; idx++) {
|
|
|
|
+ let bkc = sheet.getCell(idx - 1, 0).backColor();
|
|
|
|
+ if (bkc === 'White') {
|
|
|
|
+ sheet.setRowHeight(idx - 1, 30);
|
|
}
|
|
}
|
|
- for (let iRow = 0; iRow < sheet.getRowCount(); iRow++) {
|
|
|
|
- for (let iCol = 0; iCol < sheet.getColumnCount(); iCol++) {
|
|
|
|
- let cell = sheet.getCell(iRow, iCol);
|
|
|
|
- if (cell.backColor() === 'LightGray' || cell.backColor() === 'LightCyan') {
|
|
|
|
- visualCommonOprObj.setupBorder(sheet.getCell(iRow, iCol), border);
|
|
|
|
- } else if (cell.backColor() === 'White') {
|
|
|
|
- sheet.addSpan(iRow, 0, 1, sheet.getColumnCount());
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+ for (let iRow = 0; iRow < sheet.getRowCount(); iRow++) {
|
|
|
|
+ for (let iCol = 0; iCol < sheet.getColumnCount(); iCol++) {
|
|
|
|
+ let cell = sheet.getCell(iRow, iCol);
|
|
|
|
+ if (cell.backColor() === 'LightGray' || cell.backColor() === 'LightCyan') {
|
|
|
|
+ visualCommonOprObj.setupBorder(sheet.getCell(iRow, iCol), border);
|
|
|
|
+ } else if (cell.backColor() === 'White') {
|
|
|
|
+ sheet.addSpan(iRow, 0, 1, sheet.getColumnCount());
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- sheet.clearSelection();
|
|
|
|
- sheet.resumePaint();
|
|
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ setupCrossTpl: function (rptTpl, sheet, border) {
|
|
|
|
+
|
|
|
|
+ },
|
|
onCellEnter: function (sender, args) {
|
|
onCellEnter: function (sender, args) {
|
|
let me = visualJumbo,
|
|
let me = visualJumbo,
|
|
sheet = me.tplWorkBook.getActiveSheet();
|
|
sheet = me.tplWorkBook.getActiveSheet();
|
|
@@ -1000,17 +1013,66 @@ let visualJumbo = {
|
|
},
|
|
},
|
|
applyBack_Bill: function (rptTpl, sheet, xPos, yPos) {
|
|
applyBack_Bill: function (rptTpl, sheet, xPos, yPos) {
|
|
let me = this;
|
|
let me = this;
|
|
- let pageWith = xPos[xPos.length - 1];
|
|
|
|
|
|
+ // let pageWith = xPos[xPos.length - 1];
|
|
//先清除所有相关text/field节点,然后再重新生成
|
|
//先清除所有相关text/field节点,然后再重新生成
|
|
me.private_clear_bill_txt_fld_nodes();
|
|
me.private_clear_bill_txt_fld_nodes();
|
|
//1. 锚定content
|
|
//1. 锚定content
|
|
- let cotentBand = visualCommonOprObj.getBandEx(rptTpl[JV.NODE_FLOW_INFO][JV.NODE_FLOW_CONTENT][JV.PROP_BAND_NAME], rptTpl);
|
|
|
|
|
|
+ let cotentBand = visualCommonOprObj.getBandEx(rptTpl[JV.NODE_BILL_INFO][JV.NODE_BILL_CONTENT][JV.PROP_BAND_NAME], rptTpl);
|
|
|
|
+ let textFldArr = [], colWidthArr = [], rowHeightArr = [];
|
|
|
|
+ let startRow = me.collectSheetTxtFldByArea(sheet, me.bandMappingObj[cotentBand[JV.PROP_NAME]][JV.PROP_COLOR] , textFldArr, colWidthArr, rowHeightArr);
|
|
|
|
+ let contentNodes = [];
|
|
|
|
+ for (let field of textFldArr) {
|
|
|
|
+ let node = me.private_create_field_param_node(sheet, field, startRow, colWidthArr, rowHeightArr, rptTpl);
|
|
|
|
+ contentNodes.push(node);
|
|
|
|
+ }
|
|
//2. 其他就归类到离散去了
|
|
//2. 其他就归类到离散去了
|
|
|
|
+ let discreteNodesArr = [];
|
|
|
|
+ if (me.bandMappingObj && me.bandMappingObj.items && me.bandMappingObj.items.length > 0) {
|
|
|
|
+ for (let sBandMap of me.bandMappingObj.items) {
|
|
|
|
+ let sArr = {Name: "子项", BandName: sBandMap[JV.PROP_BAND_NAME], items: [[],[]], isParent: true};
|
|
|
|
+ let sBand = visualCommonOprObj.getBandEx(sBandMap[JV.PROP_BAND_NAME], rptTpl);
|
|
|
|
+ if (sBand) {
|
|
|
|
+ me.private_build_txt_fld_nodes(sBand, sheet, rptTpl, sArr.items);
|
|
|
|
+ }
|
|
|
|
+ if (sArr.items[0].length > 0 || sArr.items[1].length > 0) {
|
|
|
|
+ discreteNodesArr.push(sArr);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //3. 最后生成节点
|
|
|
|
+ me.private_create_tpl_bill_nodes(contentNodes, discreteNodesArr);
|
|
|
|
+ displayMessage("应用提交成功!", "green", 5000, "id_vis_setup_lbl");
|
|
},
|
|
},
|
|
private_clear_bill_txt_fld_nodes: function () {
|
|
private_clear_bill_txt_fld_nodes: function () {
|
|
let nodes = dataInfoMapTreeOprObj.treeObj.getNodes();
|
|
let nodes = dataInfoMapTreeOprObj.treeObj.getNodes();
|
|
for (let node of nodes) {
|
|
for (let node of nodes) {
|
|
dataInfoMapTreeOprObj.treeObj.removeChildNodes(node);
|
|
dataInfoMapTreeOprObj.treeObj.removeChildNodes(node);
|
|
|
|
+ //bill类型可以直接remove child nodes
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ private_create_tpl_bill_nodes: function (contentNodes, discreteNodesArr) {
|
|
|
|
+ let nodes = dataInfoMapTreeOprObj.treeObj.getNodes();
|
|
|
|
+ for (let node of nodes) {
|
|
|
|
+ if (node[JV.PROP_NAME].indexOf('数据') >= 0) {
|
|
|
|
+ //数据
|
|
|
|
+ dataInfoMapTreeOprObj.treeObj.addNodes(node, -1, contentNodes, true);
|
|
|
|
+ } else if (node[JV.PROP_NAME].indexOf('离散') >= 0) {
|
|
|
|
+ //离散信息
|
|
|
|
+ if (discreteNodesArr) {
|
|
|
|
+ for (let dNode of discreteNodesArr) {
|
|
|
|
+ let discreteNode = {"Name": "子项", "BandName": dNode[JV.PROP_BAND_NAME], "items": [{"Name": "离散字段集", "items": [], "isParent": true},{"Name": "离散文本集", "items": [], "isParent": true}], "isParent": true};
|
|
|
|
+ if (dNode.items[0].length > 0) {
|
|
|
|
+ // dataInfoMapTreeOprObj.treeObj.addNodes(node.items[0], -1, segSummaryNodes[0], true);
|
|
|
|
+ discreteNode.items[0].items = dNode.items[0];
|
|
|
|
+ }
|
|
|
|
+ if (dNode.items[1].length > 0) {
|
|
|
|
+ // dataInfoMapTreeOprObj.treeObj.addNodes(node.items[1], -1, segSummaryNodes[1], true);
|
|
|
|
+ discreteNode.items[1].items = dNode.items[1];
|
|
|
|
+ }
|
|
|
|
+ dataInfoMapTreeOprObj.treeObj.addNodes(node, -1, discreteNode, true);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
},
|
|
},
|
|
applyBack_Cross: function (rptTpl, sheet, xPos, yPos) {
|
|
applyBack_Cross: function (rptTpl, sheet, xPos, yPos) {
|
|
@@ -1109,6 +1171,12 @@ let visualJumbo = {
|
|
isField = true;
|
|
isField = true;
|
|
} else {
|
|
} else {
|
|
isBlank = stringUtil.isEmptyString(textValue);
|
|
isBlank = stringUtil.isEmptyString(textValue);
|
|
|
|
+ if (isBlank) {
|
|
|
|
+ let border = cell.borderBottom();
|
|
|
|
+ if (border && border.style === GC.Spread.Sheets.LineStyle.thin) {
|
|
|
|
+ isBlank = false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
if (!isBlank) {
|
|
if (!isBlank) {
|
|
textArr.push({"row": row, "col": col, "rowCount": rowCount, "colCount": colCount, "text": textValue, "isField": isField});
|
|
textArr.push({"row": row, "col": col, "rowCount": rowCount, "colCount": colCount, "text": textValue, "isField": isField});
|
|
@@ -1157,6 +1225,11 @@ let visualJumbo = {
|
|
let border = cell.borderLeft();
|
|
let border = cell.borderLeft();
|
|
if (border && border.style === GC.Spread.Sheets.LineStyle.thin) {
|
|
if (border && border.style === GC.Spread.Sheets.LineStyle.thin) {
|
|
rst = 'Default_Normal'
|
|
rst = 'Default_Normal'
|
|
|
|
+ } else {
|
|
|
|
+ border = cell.borderBottom();
|
|
|
|
+ if (border && border.style === GC.Spread.Sheets.LineStyle.thin) {
|
|
|
|
+ rst = 'Label_Underline'
|
|
|
|
+ }
|
|
}
|
|
}
|
|
return rst;
|
|
return rst;
|
|
},
|
|
},
|