|
@@ -29,6 +29,10 @@ let taxTypeMap = {
|
|
|
2:"简易计税"
|
|
|
};
|
|
|
|
|
|
+function isDef(v) {
|
|
|
+ return typeof v !== 'undefined' && v !== null;
|
|
|
+}
|
|
|
+
|
|
|
const projTreeObj = {
|
|
|
tree: null,
|
|
|
workBook: null,
|
|
@@ -43,12 +47,22 @@ const projTreeObj = {
|
|
|
rootId: -1,
|
|
|
autoUpdate: false
|
|
|
},
|
|
|
+ //0.48 0.13 0.15 0.15 0.09
|
|
|
header: [
|
|
|
- {name: '工程列表', dataCode: 'name', width: 0.48, vAlign: 'center', hAlign: 'left'},
|
|
|
- {name: '工程造价', dataCode: 'engineeringCost', width: 0.13, vAlign: 'center', hAlign: 'right'},
|
|
|
- {name: '单价文件', dataCode: 'unitPriceFile', width: 0.15, vAlign: 'center', hAlign: 'left'},
|
|
|
- {name: '费率文件', dataCode: 'feeRateFile', width: 0.15, vAlign: 'center', hAlign: 'left'},
|
|
|
- {name: '创建日期', dataCode: 'createDateTime', width: 0.09, vAlign: 'center', hAlign: 'center'}
|
|
|
+ {name: '工程列表', dataCode: 'name', width: 300, vAlign: 'center', hAlign: 'left'},
|
|
|
+ {name: '工程造价', dataCode: 'engineeringCost', width: 120, vAlign: 'center', hAlign: 'right', formatter: '0.00'},
|
|
|
+ {name: '分部分项合计', dataCode: 'subEngineering', width: 120, vAlign: 'center', hAlign: 'right', formatter: '0.00'},
|
|
|
+ {name: '措施项目合计', dataCode: 'measure', width: 120, vAlign: 'center', hAlign: 'right', formatter: '0.00'},
|
|
|
+ {name: '其他项目合计', dataCode: 'other', width: 120, vAlign: 'center', hAlign: 'right', formatter: '0.00'},
|
|
|
+ {name: '安全文明施工费', dataCode: 'safetyConstruction', width: 120, vAlign: 'center', hAlign: 'right', formatter: '0.00'},
|
|
|
+ {name: '规费', dataCode: 'charge', width: 120, vAlign: 'center', hAlign: 'right', formatter: '0.00'},
|
|
|
+ {name: '税金', dataCode: 'tax', width: 120, 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'},
|
|
|
+ {name: '单价文件', dataCode: 'unitPriceFile', width: 140, vAlign: 'center', hAlign: 'left'},
|
|
|
+ {name: '费率文件', dataCode: 'feeRateFile', width: 140, vAlign: 'center', hAlign: 'left'},
|
|
|
+ {name: '创建日期', dataCode: 'createDateTime', width: 100, vAlign: 'center', hAlign: 'center'}
|
|
|
],
|
|
|
//选中行颜色
|
|
|
style: {
|
|
@@ -118,8 +132,11 @@ const projTreeObj = {
|
|
|
let workBookWidth = getWorkBookWidth();
|
|
|
for(let i = 0, len = headers.length; i < len; i++){
|
|
|
sheet.setValue(0, i, headers[i].name, GC.Spread.Sheets.SheetArea.colHeader);
|
|
|
- let width = workBookWidth * headers[i].width;
|
|
|
+ let width = headers[i].width;
|
|
|
sheet.setColumnWidth(i, width, GC.Spread.Sheets.SheetArea.colHeader);
|
|
|
+ if (headers[i].formatter) {
|
|
|
+ sheet.setFormatter(-1, i, headers[i].formatter, GC.Spread.Sheets.SheetArea.viewport);
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
me.renderSheetFuc(sheet, fuc);
|
|
@@ -307,6 +324,30 @@ const projTreeObj = {
|
|
|
});
|
|
|
}, 500);
|
|
|
}
|
|
|
+ },
|
|
|
+ "refreshSummary": {
|
|
|
+ name: "刷新当前项目造价",
|
|
|
+ icon: 'fa-refresh',
|
|
|
+ disabled: function () {
|
|
|
+ let selectedItem = projTreeObj.tree.selected;
|
|
|
+ return !(selectedItem && selectedItem.data.projType !== projectType.folder);
|
|
|
+ },
|
|
|
+ callback: function (key, opt) {
|
|
|
+ //获取当前节点的建设项目ID
|
|
|
+ let project = projTreeObj.tree.selected;
|
|
|
+ while (project.data.projType !== projectType.project && project.parent){
|
|
|
+ project = project.parent;
|
|
|
+ }
|
|
|
+ if(project && project.data.ID){
|
|
|
+ $.bootstrapLoading.start();
|
|
|
+ CommonAjax.post('/pm/api/getSummaryInfo', {user_id: userID, projectIDs: [project.data.ID]}, function (summaryInfo) {
|
|
|
+ refreshProjSummary(project, summaryInfo);
|
|
|
+ $.bootstrapLoading.end();
|
|
|
+ }, function () {
|
|
|
+ $.bootstrapLoading.start();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
});
|
|
@@ -819,13 +860,7 @@ const projTreeObj = {
|
|
|
const {row, col} = cell;
|
|
|
let dataCode = this.setting.header[col]['dataCode'];
|
|
|
let value = '';
|
|
|
- if(dataCode === 'engineeringCost'){
|
|
|
- if(node.data.projType !== projectType.folder){//显示除了文件夹节点的工程造价结果 -- vincent
|
|
|
- value = node.data.engineeringCost ? node.data.engineeringCost : '0.00';
|
|
|
- value = scMathUtil.roundToString(value,2);
|
|
|
- }
|
|
|
- }
|
|
|
- else if(dataCode === 'unitPriceFile'){
|
|
|
+ if(dataCode === 'unitPriceFile'){
|
|
|
if(node.data.projType === projectType.tender){
|
|
|
value = node.data.property && node.data.property.unitPriceFile && node.data.property.unitPriceFile.name ? node.data.property.unitPriceFile.name : '';
|
|
|
}
|
|
@@ -839,7 +874,7 @@ const projTreeObj = {
|
|
|
value = node.data.createDateTime ? new Date(node.data.createDateTime).Format('yyyy-MM-dd') : '';
|
|
|
}
|
|
|
else {
|
|
|
- value = node.data[dataCode] ? node.data[dataCode] : '';
|
|
|
+ value = isDef(node.data[dataCode]) ? node.data[dataCode] : '';
|
|
|
}
|
|
|
sheet.setValue(row, col, value);
|
|
|
},
|
|
@@ -1028,7 +1063,7 @@ const projTreeObj = {
|
|
|
$(document).ready(function() {
|
|
|
//列宽随着屏幕改变
|
|
|
$(window).resize(function () {
|
|
|
- autoPmWdith(projTreeObj.workBook, projTreeObj.setting.header);
|
|
|
+ //autoPmWdith(projTreeObj.workBook, projTreeObj.setting.header);
|
|
|
autoPmWdith(gcTreeObj.workBook, gcTreeObj.setting.header);
|
|
|
autoPmWdith(pmShare.spreadObj.workBook, pmShare.headers)
|
|
|
|
|
@@ -1672,12 +1707,30 @@ function getChangedFunc(input, nameInfo){
|
|
|
nameInfo.show();
|
|
|
}
|
|
|
else {
|
|
|
- nameInfo.text('');N
|
|
|
+ nameInfo.text('');
|
|
|
nameInfo.hide();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+//新增节点,初始化汇总数值
|
|
|
+function setInitSummaryData(data) {
|
|
|
+ if(data.projType === projectType.folder){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //just for View
|
|
|
+ data.engineeringCost = 0;
|
|
|
+ data.subEngineering = 0;
|
|
|
+ data.measure = 0;
|
|
|
+ data.safetyConstruction = 0;
|
|
|
+ data.other = 0;
|
|
|
+ data.charge = 0;
|
|
|
+ data.tax = 0;
|
|
|
+ data.rate = data.projType === projectType.project ? 100 : 0;
|
|
|
+ data.buildingArea = '';
|
|
|
+ data.perCost = '';
|
|
|
+}
|
|
|
+
|
|
|
function AddTenderItems(selected, projName, engName, tenderName, property, callback){
|
|
|
const addPath = {p_e_t: 'p_e_t', e_t: 'e_t', t: 't'};
|
|
|
let path, updateDatas = [];
|
|
@@ -1727,6 +1780,7 @@ function AddTenderItems(selected, projName, engName, tenderName, property, callb
|
|
|
let projData, engData, tenderData;
|
|
|
datas.forEach(function (data) {
|
|
|
if (data.updateType === 'new') {
|
|
|
+ setInitSummaryData(data.updateData);
|
|
|
if(data.updateData.projType === projectType.project){
|
|
|
projData = data.updateData;
|
|
|
}
|
|
@@ -1767,6 +1821,7 @@ function AddTenderItems(selected, projName, engName, tenderName, property, callb
|
|
|
let engData, tenderData;
|
|
|
datas.forEach(function (data) {
|
|
|
if (data.updateType === 'new') {
|
|
|
+ setInitSummaryData(data.updateData);
|
|
|
if(data.updateData.projType === projectType.engineering){
|
|
|
engData = data.updateData;
|
|
|
}
|
|
@@ -1794,6 +1849,7 @@ function AddTenderItems(selected, projName, engName, tenderName, property, callb
|
|
|
UpdateProjectData(updateDatas, function (datas) {
|
|
|
datas.forEach(function (data) {
|
|
|
if(data.updateType === 'new') {
|
|
|
+ setInitSummaryData(data.updateData);
|
|
|
projTreeObj.insert(data.updateData, tempEng, null);
|
|
|
}
|
|
|
});
|
|
@@ -1832,6 +1888,7 @@ function AddChildrenItem(selected, name, property, type, existCallback, sucCallb
|
|
|
UpdateProjectData(updateData, function(datas){
|
|
|
datas.forEach(function (data) {
|
|
|
if (data.updateType === 'new') {
|
|
|
+ setInitSummaryData(data.updateData);
|
|
|
projTreeObj.insert(data.updateData, parent, null);
|
|
|
}
|
|
|
});
|
|
@@ -1870,6 +1927,7 @@ function AddSiblingsItem(selected, name, property, type, existCallback, sucCallb
|
|
|
UpdateProjectData(updateData, function(datas){
|
|
|
datas.forEach(function (data) {
|
|
|
if (data.updateType === 'new') {
|
|
|
+ setInitSummaryData(data.updateData);
|
|
|
projTreeObj.insert(data.updateData, parent, next);
|
|
|
}
|
|
|
});
|
|
@@ -3097,3 +3155,34 @@ $('#allowCopy').change(function () {
|
|
|
$('#allowCopyHint').hide();
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+//刷新建设项目汇总金额信息
|
|
|
+function refreshProjSummary(project, summaryInfo) {
|
|
|
+ let refreshNodes = [];
|
|
|
+ refreshNodes.push(project);
|
|
|
+ getNodes(project);
|
|
|
+ function getNodes(node) {
|
|
|
+ if(node.children.length > 0){
|
|
|
+ refreshNodes = refreshNodes.concat(node.children);
|
|
|
+ for(let cNode of node.children){
|
|
|
+ getNodes(cNode);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for(let node of refreshNodes){
|
|
|
+ let nodeInfo = summaryInfo[node.data.ID];
|
|
|
+ if(nodeInfo){
|
|
|
+ node.data.engineeringCost = nodeInfo.engineeringCost;
|
|
|
+ node.data.subEngineering = nodeInfo.subEngineering;
|
|
|
+ node.data.measure = nodeInfo.measure;
|
|
|
+ node.data.safetyConstruction = nodeInfo.safetyConstruction;
|
|
|
+ node.data.other = nodeInfo.other;
|
|
|
+ node.data.charge = nodeInfo.charge;
|
|
|
+ node.data.tax = nodeInfo.tax;
|
|
|
+ node.data.rate = nodeInfo.rate;
|
|
|
+ node.data.buildingArea = nodeInfo.buildingArea;
|
|
|
+ node.data.perCost = nodeInfo.perCost;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ projTreeObj.refreshNodeData(refreshNodes);
|
|
|
+}
|