|
@@ -16,6 +16,7 @@ const pmShare = (function () {
|
|
|
//操作类型
|
|
|
const oprType = {copy: 'copy', cancel: 'cancel'};
|
|
|
let tree = null;
|
|
|
+ const treeCol = 0;
|
|
|
const treeSetting = {
|
|
|
tree: {
|
|
|
id: 'ID',
|
|
@@ -26,11 +27,20 @@ const pmShare = (function () {
|
|
|
}
|
|
|
};
|
|
|
const headers = [
|
|
|
- {name: '工程列表', dataCode: 'name', width: 0.55, rateWidth: 0.55, vAlign: 'center', hAlign: 'left'},
|
|
|
- {name: '由...分享', dataCode: 'from', width: 0.15, rateWidth: 0.15, vAlign: 'center', hAlign: 'left'},
|
|
|
- {name: '分享给...', dataCode: 'to', width: 0.15, rateWidth: 0.15, vAlign: 'center', hAlign: 'left'},
|
|
|
- {name: '拷贝工程', dataCode: 'copy', width: 0.075, rateWidth: 0.075, vAlign: 'center', hAlign: 'left'},
|
|
|
- {name: '清除', dataCode: 'cancel', width: 0.075, rateWidth: 0.075, vAlign: 'center', hAlign: 'left'},
|
|
|
+ {name: '工程列表', dataCode: 'name', width: 300, rateWidth: 0.55, vAlign: 'center', hAlign: 'left'},
|
|
|
+ {name: '由...分享', dataCode: 'from', width: 100, rateWidth: 0.15, vAlign: 'center', hAlign: 'left'},
|
|
|
+ {name: '拷贝工程', dataCode: 'copy', width: 100, rateWidth: 0.075, vAlign: 'center', hAlign: 'left'},
|
|
|
+ {name: '清除', dataCode: 'cancel', width: 100, rateWidth: 0.075, vAlign: 'center', hAlign: 'left'},
|
|
|
+ {name: '工程造价', dataCode: 'engineeringCost', width: 100, vAlign: 'center', hAlign: 'right', formatter: '0.00'},
|
|
|
+ {name: '分部分项合计', dataCode: 'subEngineering', width: 100, vAlign: 'center', hAlign: 'right', formatter: '0.00'},
|
|
|
+ {name: '措施项目合计', dataCode: 'measure', width: 100, vAlign: 'center', hAlign: 'right', formatter: '0.00'},
|
|
|
+ {name: '其他项目合计', dataCode: 'other', width: 100, vAlign: 'center', hAlign: 'right', formatter: '0.00'},
|
|
|
+ {name: '规费', dataCode: 'charge', width: 100, vAlign: 'center', hAlign: 'right', formatter: '0.00'},
|
|
|
+ {name: '税金', dataCode: 'tax', width: 100, vAlign: 'center', hAlign: 'right', formatter: '0.00'},
|
|
|
+ {name: '占造价比例(%)', dataCode: 'rate', width: 100, vAlign: 'center', hAlign: 'right', formatter: '0.00'},
|
|
|
+ {name: '建筑面积', dataCode: 'buildingArea', width: 100, vAlign: 'center', hAlign: 'right', formatter: '0.00'},
|
|
|
+ {name: '单方造价', dataCode: 'perCost', width: 100, vAlign: 'center', hAlign: 'right', formatter: '0.00'},
|
|
|
+ {name: '工程专业', dataCode: 'feeStandardName', width: 100, vAlign: 'center', hAlign: 'left'},
|
|
|
];
|
|
|
const spreadOpts = {
|
|
|
workBook: {
|
|
@@ -107,9 +117,9 @@ const pmShare = (function () {
|
|
|
let fuc = function () {
|
|
|
sheet.setColumnCount(headers.length);
|
|
|
sheet.setRowHeight(0, 40, GC.Spread.Sheets.SheetArea.colHeader);
|
|
|
- let spreadWidth = getWorkBookWidth();
|
|
|
+ //let spreadWidth = getWorkBookWidth();
|
|
|
for(let i = 0, len = headers.length; i < len; i++){
|
|
|
- sheet.setColumnWidth(i, spreadWidth * headers[i].width, GC.Spread.Sheets.SheetArea.colHeader);
|
|
|
+ sheet.setColumnWidth(i, headers[i].width, GC.Spread.Sheets.SheetArea.colHeader);
|
|
|
if(headers[i].formatter){
|
|
|
sheet.setFormatter(-1, i, headers[i].formatter);
|
|
|
}
|
|
@@ -559,7 +569,7 @@ const pmShare = (function () {
|
|
|
sheet.setRowCount(nodes.length);
|
|
|
for(let i = 0; i < nodes.length; i++){
|
|
|
let treeNodeCell = getTreeNodeCell(tree);
|
|
|
- sheet.getCell(i, 0).cellType(treeNodeCell);
|
|
|
+ sheet.getCell(i, treeCol).cellType(treeNodeCell);
|
|
|
for(let j = 0; j < headers.length; j++){
|
|
|
sheet.getRange(-1, j, -1, 1).hAlign(GC.Spread.Sheets.HorizontalAlign[headers[j]['hAlign']]);
|
|
|
sheet.getRange(-1, j, -1, 1).vAlign(GC.Spread.Sheets.VerticalAlign[headers[j]['vAlign']]);
|
|
@@ -592,7 +602,7 @@ const pmShare = (function () {
|
|
|
sheet.getCell(i, j).cellType(getInteractionCell());
|
|
|
}
|
|
|
}
|
|
|
- sheet.setValue(i, j, nodes[i].data[dataCode] ? nodes[i].data[dataCode] : '');
|
|
|
+ sheet.setValue(i, j, nodes[i].data[dataCode] !== null && typeof nodes[i].data[dataCode] !== 'undefined' ? nodes[i].data[dataCode] : '');
|
|
|
}
|
|
|
}
|
|
|
};
|
|
@@ -640,6 +650,32 @@ const pmShare = (function () {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ //给项目设置汇总信息
|
|
|
+ //@param {Array}projs {Object}summaryInfo
|
|
|
+ function setSummaryInfo(grouped, summaryInfo) {
|
|
|
+ let allDatas = [];
|
|
|
+ for (let data of grouped) {
|
|
|
+ allDatas.push(data);
|
|
|
+ if (data.children && data.children.length > 0) {
|
|
|
+ allDatas = allDatas.concat(data.children);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for(let proj of allDatas){
|
|
|
+ let summaryProj = summaryInfo[proj.ID];
|
|
|
+ if(summaryProj){
|
|
|
+ proj.engineeringCost = summaryProj.engineeringCost;
|
|
|
+ proj.subEngineering = summaryProj.subEngineering;
|
|
|
+ proj.measure = summaryProj.measure;
|
|
|
+ proj.safetyConstruction = summaryProj.safetyConstruction;
|
|
|
+ proj.other = summaryProj.other;
|
|
|
+ proj.charge = summaryProj.charge;
|
|
|
+ proj.tax = summaryProj.tax;
|
|
|
+ proj.rate = summaryProj.rate;
|
|
|
+ proj.buildingArea = summaryProj.buildingArea;
|
|
|
+ proj.perCost = summaryProj.perCost;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
//获取可成树的数据
|
|
|
//@param {Array}datas @return {Array}
|
|
|
function getTreeDatas(groupedDatas, ungroupedDatas){
|
|
@@ -706,7 +742,10 @@ const pmShare = (function () {
|
|
|
// 排序 --分享的文件按照时间先后顺序排序,分享文件下的子文件,按照原本树结构显示,不需要排序
|
|
|
sortByDate(rstData.grouped);
|
|
|
sortByDate(rstData.ungrouped);
|
|
|
+ //设置汇总信息
|
|
|
+ setSummaryInfo(rstData.grouped, rstData.summaryInfo);
|
|
|
let treeDatas = getTreeDatas(rstData.grouped, rstData.ungrouped);
|
|
|
+ console.log(treeDatas);
|
|
|
tree = pmTree.createNew(treeSetting, treeDatas);
|
|
|
console.log(tree);
|
|
|
tree.selected = tree.items[0];
|
|
@@ -715,6 +754,7 @@ const pmShare = (function () {
|
|
|
let initSel = spreadObj.sheet.getSelections()[0] ? spreadObj.sheet.getSelections()[0] : {row: 0, rowCount: 1};
|
|
|
initSelection(initSel);
|
|
|
autoFlashHeight();
|
|
|
+ spreadObj.sheet.frozenColumnCount(4);
|
|
|
spreadObj.workBook.refresh();
|
|
|
$.bootstrapLoading.end();
|
|
|
});
|