|
|
@@ -950,59 +950,52 @@ const XMLStandard = (function () {
|
|
|
}
|
|
|
|
|
|
//目前的数据
|
|
|
- let curPMData = {project: null, engineering: null, tender: null}, //项目管理项目数据
|
|
|
- curProjectEle = null, //建设项目节点
|
|
|
+ let curProjectEle = null, //建设项目节点
|
|
|
curTenderEle = null; //单位工程节点
|
|
|
|
|
|
- //记录拉取的单位工程项目详细数据,导出的时候,可能会导出多个文件,只有导出第一个文件的时候需要请求数据
|
|
|
- let tenderDetailMap = {}; //ID映射 ID: data
|
|
|
-
|
|
|
//获取需要导出的项目数据
|
|
|
//@param {Number}tenderID(当前界面的单位工程ID,后台根据这个单位工程,去找其建设项目下所有数据)
|
|
|
//@return {Object}(eleObj)
|
|
|
async function loadProject(tenderID) {
|
|
|
//拉取标段数据:建设项目、单项工程、单位工程数据
|
|
|
- let projectData = curPMData.project;
|
|
|
- if (!projectData) { //没有数据,需要拉取
|
|
|
- projectData = curPMData.project = await ajaxPost('/pm/api/getProjectByGranularity', {user_id: userID, tenderID: tenderID, granularity: granularity});
|
|
|
- }
|
|
|
- if (!projectData) {
|
|
|
+ let projectsData = await _util.getProjectByGranularity(granularity, tenderID, userID);
|
|
|
+ if (!projectsData) {
|
|
|
throw '获取项目数据错误';
|
|
|
}
|
|
|
//单项工程、单位工程按照树结构数据进行排序
|
|
|
- projectData.children = _util.sortByNext(projectData.children);
|
|
|
- for (let engData of projectData.children) {
|
|
|
+ projectsData.children = _util.sortByNext(projectsData.children);
|
|
|
+ for (let engData of projectsData.children) {
|
|
|
engData.children = _util.sortByNext(engData.children);
|
|
|
}
|
|
|
//标段
|
|
|
let project = new Project({
|
|
|
- basicInformation: projectData.property.basicInformation,
|
|
|
- name: projectData.name,
|
|
|
+ basicInformation: projectsData.property.basicInformation,
|
|
|
+ name: projectsData.name,
|
|
|
fileKind: FILE_KIND[exportKind],
|
|
|
- taxType: projectData.property.taxType ? _config.TAX_TYPE[projectData.property.taxType] : ''
|
|
|
+ taxType: projectsData.property.taxType ? _config.TAX_TYPE[projectsData.property.taxType] : ''
|
|
|
});
|
|
|
curProjectEle = project;
|
|
|
//项目信息
|
|
|
- let projectInfo = new ProjectInfo({basicInformation: projectData.property.basicInformation});
|
|
|
+ let projectInfo = new ProjectInfo({basicInformation: projectsData.property.basicInformation});
|
|
|
project.children.push(projectInfo);
|
|
|
//招标信息
|
|
|
- let biddingInfo = new BiddingInfo({basicInformation: projectData.property.basicInformation, summaryInfo: projectData.summaryInfo[projectData.ID]});
|
|
|
+ let biddingInfo = new BiddingInfo({basicInformation: projectsData.property.basicInformation, summaryInfo: projectsData.summaryInfo[projectsData.ID]});
|
|
|
projectInfo.children.push(biddingInfo);
|
|
|
//投标信息 导出类型为投标时,才导出
|
|
|
if (exportKind === _config.EXPORT_KIND.Tender) {
|
|
|
- let bidInfo = new BidInfo({basicInformation: projectData.property.basicInformation, summaryInfo: projectData.summaryInfo[projectData.ID]});
|
|
|
+ let bidInfo = new BidInfo({basicInformation: projectsData.property.basicInformation, summaryInfo: projectsData.summaryInfo[projectsData.ID]});
|
|
|
projectInfo.children.push(bidInfo);
|
|
|
}
|
|
|
//编制说明
|
|
|
- let compilationIll = new CompilationIllustration({compilationIllustration: projectData.property.compilationIllustration});
|
|
|
+ let compilationIll = new CompilationIllustration({compilationIllustration: projectsData.property.compilationIllustration});
|
|
|
project.children.push(compilationIll);
|
|
|
//系统信息
|
|
|
let generatedTime = moment(Date.now()).format('YYYY-MM-DDTHH:mm:ss'),
|
|
|
- sysInfoSource = {softInfo: projectData.softInfo, generatedTime},
|
|
|
+ sysInfoSource = {softInfo: projectsData.softInfo, generatedTime},
|
|
|
sysInfo = new SystemInfo(sysInfoSource);
|
|
|
project.children.push(sysInfo);
|
|
|
//费用构成
|
|
|
- let feeForm = new FeeFrom(projectData.summaryInfo[projectData.ID]);
|
|
|
+ let feeForm = new FeeFrom(projectsData.summaryInfo[projectsData.ID]);
|
|
|
project.children.push(feeForm);
|
|
|
//主要清单汇总 主要清单明细在loadTender中设置
|
|
|
let mainBillsSummaryEle = new MainBillsSummary();
|
|
|
@@ -1011,9 +1004,8 @@ const XMLStandard = (function () {
|
|
|
let appraisalSummary = new AppraisalSummary();
|
|
|
project.children.unshift(appraisalSummary);
|
|
|
//单项工程
|
|
|
- for (let eng of projectData.children) {
|
|
|
- curPMData.engineering = eng;
|
|
|
- let engElement = await loadEngineering(projectData.summaryInfo, eng);
|
|
|
+ for (let eng of projectsData.children) {
|
|
|
+ let engElement = await loadEngineering(projectsData.summaryInfo, eng);
|
|
|
project.children.push(engElement);
|
|
|
}
|
|
|
//主要清单汇总、评审材料汇总 排在后面
|
|
|
@@ -1042,8 +1034,8 @@ const XMLStandard = (function () {
|
|
|
let feeForm = new FeeFrom(summaryInfo[engData.ID]);
|
|
|
engineering.children.push(feeForm);
|
|
|
//分批次获取单位工程
|
|
|
+ let tenderDetailMap = _cache.getItem('tenderDetailMap');
|
|
|
for (let tenderData of engData.children) {
|
|
|
- curPMData.tender = tenderData;
|
|
|
//需要请求项目详细数据的时候,间隔一段时间再初始单位工程数据,减少服务器压力
|
|
|
if (!tenderDetailMap[tenderData.ID]) {
|
|
|
await _util.setTimeoutSync(() => {}, _config.TIMEOUT_TIME);
|
|
|
@@ -1067,12 +1059,7 @@ const XMLStandard = (function () {
|
|
|
* */
|
|
|
async function loadTender(summaryInfo, tenderData) {
|
|
|
//获取单位工程详细数据
|
|
|
- let tenderDetail = tenderDetailMap[tenderData.ID];
|
|
|
- if (!tenderDetail) {
|
|
|
- tenderDetail = PROJECT.createNew(tenderData.ID, userID);
|
|
|
- await tenderDetail.loadDataSync();
|
|
|
- tenderDetailMap[tenderData.ID] = tenderDetail;
|
|
|
- }
|
|
|
+ let tenderDetail = await _util.getTenderDetail(tenderData.ID, userID);
|
|
|
//设置定额库编码
|
|
|
tenderDetail.rationLibMap = {};
|
|
|
let defaultLib = null;
|
|
|
@@ -1096,7 +1083,7 @@ const XMLStandard = (function () {
|
|
|
let tender = curTenderEle = new Tender(tenderSource);
|
|
|
//工程特征
|
|
|
let featureObj = _util.arrayToObj(tenderData.property.projectFeature);
|
|
|
- let engFeature = new EngFeature({feature:featureObj, basicInformation: curPMData.project.property.basicInformation});
|
|
|
+ let engFeature = new EngFeature({feature:featureObj, basicInformation: tenderDetail.projectInfo.property.basicInformation});
|
|
|
tender.children.push(engFeature);
|
|
|
//特征项:每一项工程特征
|
|
|
for (let data of tenderData.property.projectFeature) {
|
|
|
@@ -1105,7 +1092,7 @@ const XMLStandard = (function () {
|
|
|
}
|
|
|
//工程信息 : 筛选设置了编码的基本信息数据
|
|
|
let constructInfo = new XML_EXPORT_BASE.Element('工程信息', []);
|
|
|
- curPMData.project.property.basicInformation.forEach(pItem => {
|
|
|
+ tenderDetail.projectInfo.property.basicInformation.forEach(pItem => {
|
|
|
pItem.items.forEach(info => {
|
|
|
if (info.code) {
|
|
|
constructInfo.children.push(new InfoItem(info));
|
|
|
@@ -1208,7 +1195,7 @@ const XMLStandard = (function () {
|
|
|
rowCode: `F${serialNo}`,
|
|
|
name: node.data.name,
|
|
|
calcBase: _util.transformCalcBase(detail, node, {CalcBaseMap, FlagCalcBaseMap}),
|
|
|
- feeRate: node.data.feeRate ? node.data.feeRate : 100,
|
|
|
+ feeRate: _util.hasValue(node.data.feeRate) ? node.data.feeRate : 100,
|
|
|
fees: node.data.fees,
|
|
|
feeType: FEE_TYPE[flag] || FEE_TYPE['0'],
|
|
|
remark: node.data.remark
|
|
|
@@ -1514,7 +1501,7 @@ const XMLStandard = (function () {
|
|
|
code: node.data.code,
|
|
|
name: node.data.name,
|
|
|
calcBase: _util.transformCalcBase(detail, node, {CalcBaseMap, FlagCalcBaseMap}),
|
|
|
- feeRate: node.data.feeRate ? node.data.feeRate : 100,
|
|
|
+ feeRate: _util.hasValue(node.data.feeRate) ? node.data.feeRate : 100,
|
|
|
fees: node.data.fees,
|
|
|
remark: node.data.remark,
|
|
|
feeType: FEE_TYPE[node.getFlag()] || FEE_TYPE['0']
|
|
|
@@ -1743,7 +1730,7 @@ const XMLStandard = (function () {
|
|
|
name: node.data.name,
|
|
|
serviceContent: node.data.serviceContent,
|
|
|
calcBaseValue: node.data.calcBase,
|
|
|
- feeRate: node.data.feeRate ? node.data.feeRate : 100,
|
|
|
+ feeRate: _util.hasValue(node.data.feeRate) ? node.data.feeRate : 100,
|
|
|
fees: node.data.fees,
|
|
|
remark: node.data.remark
|
|
|
};
|
|
|
@@ -1777,13 +1764,13 @@ const XMLStandard = (function () {
|
|
|
}
|
|
|
//汇总其他列项金额
|
|
|
let totalFee = _util.getFee(node.data.fees, 'common.totalFee');
|
|
|
- summaryFee = scMathUtil.roundForObj(summaryFee + totalFee, curPMData.tender.property.decimal.bills.totalPrice);
|
|
|
+ summaryFee = scMathUtil.roundForObj(summaryFee + totalFee, detail.projectInfo.property.decimal.bills.totalPrice);
|
|
|
let otherItemSource = {
|
|
|
row: detail.mainTree.nodes[detail.mainTree.prefix + node.data.ID].serialNo() + 1,
|
|
|
code: node.data.code,
|
|
|
name: node.data.name,
|
|
|
calcBase: _util.transformCalcBase(detail, node, {CalcBaseMap, FlagCalcBaseMap}),
|
|
|
- feeRate: node.data.feeRate ? node.data.feeRate : 100,
|
|
|
+ feeRate: _util.hasValue(node.data.feeRate) ? node.data.feeRate : 100,
|
|
|
commonTotalFee: totalFee,
|
|
|
notSummary: belongFlag && belongFlag === fixedFlag.MATERIAL_PROVISIONAL, //不计入合价,只有材料(工程设备)暂估价固定节点
|
|
|
remark: node.data.remark
|
|
|
@@ -1834,7 +1821,7 @@ const XMLStandard = (function () {
|
|
|
rowCode: `F${serialNo}`,
|
|
|
name: node.data.name,
|
|
|
calcBase: _util.transformCalcBase(detail, node, {CalcBaseMap, FlagCalcBaseMap}),
|
|
|
- feeRate: node.data.feeRate ? node.data.feeRate : 100,
|
|
|
+ feeRate: _util.hasValue(node.data.feeRate) ? node.data.feeRate : 100,
|
|
|
fees: node.data.fees,
|
|
|
feeType: feeType,
|
|
|
remark: node.data.remark
|
|
|
@@ -1892,7 +1879,7 @@ const XMLStandard = (function () {
|
|
|
let allGljs = gljUtil.sortRationGLJ(gljList); //人材机汇总排序
|
|
|
//计算总消耗量
|
|
|
gljUtil.calcProjectGLJQuantity(detail.projectGLJ.datas,
|
|
|
- detail.ration_glj.datas, detail.Ration.datas, detail.Bills.datas, curPMData.tender.property.decimal.glj.quantity, _, scMathUtil);
|
|
|
+ detail.ration_glj.datas, detail.Ration.datas, detail.Bills.datas, detail.projectInfo.property.decimal.glj.quantity, _, scMathUtil);
|
|
|
//类型-配比类别映射
|
|
|
let ratioMapping = {
|
|
|
'202': '1', //为“混凝土”时,取“1”;
|
|
|
@@ -1911,12 +1898,11 @@ const XMLStandard = (function () {
|
|
|
'6': '400'
|
|
|
};
|
|
|
for (let glj of allGljs) {
|
|
|
- //gljUtil.getAdjustPrice(glj,proGLJ.datas,calcOptions,labourCoeDatas,decimalObj,isRadio,_,scMathUtil);
|
|
|
let price = gljUtil.getGLJPrice(glj, detail.projectGLJ.datas,
|
|
|
- curPMData.tender.property.calcOptions, detail.labourCoe.datas, curPMData.tender.property.decimal, false, _, scMathUtil);
|
|
|
+ detail.projectInfo.property.calcOptions, detail.labourCoe.datas, detail.projectInfo.property.decimal, false, _, scMathUtil);
|
|
|
//调整价
|
|
|
/*let adjPrice = gljUtil.getAdjustPrice(glj, detail.projectGLJ.datas,
|
|
|
- curPMData.tender.property.calcOptions, detail.labourCoe.datas, curPMData.tender.property.decimal, false, _, scMathUtil);*/
|
|
|
+ detail.projectInfo.property.calcOptions, detail.labourCoe.datas, detail.projectInfo.property.decimal, false, _, scMathUtil);*/
|
|
|
let adjPrice = 0;
|
|
|
//获取人材机费用类别: 1=人工费 2=材料费 3=机械费 4=未计价费
|
|
|
let feeType = String(glj.type)[0];
|
|
|
@@ -2012,7 +1998,7 @@ const XMLStandard = (function () {
|
|
|
name: calcItem.name,
|
|
|
calcBase: calcBase,
|
|
|
statement: calcItem.statement,
|
|
|
- feeRate: calcItem.feeRate ? calcItem.feeRate : 100,
|
|
|
+ feeRate: _util.hasValue(calcItem.feeRate) ? calcItem.feeRate : 100,
|
|
|
feeType: feeType,
|
|
|
remark: calcItem.memo
|
|
|
};
|
|
|
@@ -2033,17 +2019,15 @@ const XMLStandard = (function () {
|
|
|
* */
|
|
|
this.transformData = async function (tenderID, curExportKind) {
|
|
|
if (curExportKind) {
|
|
|
- // 更新缓存中的导出文件类型
|
|
|
+ //更新缓存中的导出文件类型
|
|
|
//_cache.setItem('exportKind', +curExportKind);
|
|
|
exportKind = parseInt(curExportKind);
|
|
|
}
|
|
|
let eleData = await loadProject(tenderID);
|
|
|
- this.datas = eleData;
|
|
|
- this.PMData = curPMData.project;
|
|
|
if (!eleData) {
|
|
|
return;
|
|
|
}
|
|
|
- this.originalDatas.push({data: this.datas, fileName: `重庆标准交换数据(${FILE_KIND[exportKind]}).QTF`});
|
|
|
+ this.originalDatas.push({data: eleData, fileName: `重庆标准交换数据(${FILE_KIND[exportKind]}).QTF`});
|
|
|
};
|
|
|
}
|
|
|
})();
|