|
@@ -253,7 +253,7 @@ $(document).ready(() => {
|
|
|
})('a[name=showLevel]', xmjSheet);
|
|
|
|
|
|
$('#exportBwtz').click(function () {
|
|
|
- const data = [];
|
|
|
+ const data = [], groupData = [];
|
|
|
const setting = {
|
|
|
cols: [
|
|
|
{title: '项目节编号', colSpan: '1', rowSpan: '2', field: 'code', hAlign: 0, width: 100, formatter: '@'},
|
|
@@ -273,13 +273,32 @@ $(document).ready(() => {
|
|
|
font: '10px 微软雅黑'
|
|
|
};
|
|
|
if (!xmjSheet.zh_tree) return;
|
|
|
+ // xmjSheet.zh_tree.recursiveExe(function(node) {
|
|
|
+ // if (node.children && node.children.length > 0) {
|
|
|
+ // node._export_group = _.sum(node.children.map(x => { return x._export_group; })) + node.children.length;
|
|
|
+ // } else {
|
|
|
+ // if (node.unitTree) {
|
|
|
+ // node.unitTree.recursiveExe(function(node) {
|
|
|
+ // if (node.children && node.children.length > 0) {
|
|
|
+ // node._export_group = _.sum(node.children.map(x => { return x._export_group; })) + node.children.length;
|
|
|
+ // } else {
|
|
|
+ // node._export_group = 0;
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // node._export_group = _.sum(node.unitTree.children.map(x => { return x._export_group; })) + node.unitTree.children.length;
|
|
|
+ // } else {
|
|
|
+ // node._export_group = 0;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // });
|
|
|
for (const node of xmjSheet.zh_tree.nodes) {
|
|
|
data.push({
|
|
|
code: node.code, b_code: node.b_code, name: node.name, unit: node.unit,
|
|
|
unit_price: node.unit_price, quantity: node.quantity, total_price: node.total_price,
|
|
|
drawing_code: node.drawing_code, memo: node.memo
|
|
|
});
|
|
|
- if (node.unitTree) {
|
|
|
+ if (node.unitTree && node.unitTree.nodes.length > 0) {
|
|
|
+ groupData.push({ code: node.code, b_code: node.b_code, start: data.length, count: node.unitTree.nodes.length });
|
|
|
for (const unitNode of node.unitTree.nodes) {
|
|
|
data.push({
|
|
|
code: unitNode.code, b_code: unitNode.b_code,
|
|
@@ -291,6 +310,6 @@ $(document).ready(() => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- SpreadExcelObj.exportSimpleXlsxSheet(setting, data, $('.sidebar-title').attr('data-original-title') + "-部位台账.xlsx");
|
|
|
+ SpreadExcelObj.exportSimpleXlsxSheet(setting, data, $('.sidebar-title').attr('data-original-title') + "-部位台账.xlsx", groupData);
|
|
|
});
|
|
|
});
|