|
@@ -1520,29 +1520,41 @@ const importXML = (() => {
|
|
|
rationQuantityDetails: [],
|
|
|
};
|
|
|
billsData
|
|
|
- .filter(bills => bills.rations && bills.rations.length)
|
|
|
.forEach(bills => {
|
|
|
- bills.rations.forEach(ration => {
|
|
|
- // TODO 取费专业不知如何取,暂时取单位工程取费专业(导出的文件没有可用的取费专业字段,因此需要后端匹配标准定额)
|
|
|
- // 如果标准定额有取费专业,则会替换掉这里设置的取费专业
|
|
|
- ration.programID = tenderData.property.projectEngineering;
|
|
|
- ration.ID = uuid.v1();
|
|
|
- ration.projectID = tenderData.ID;
|
|
|
- ration.billsItemID = bills.ID;
|
|
|
- ration.contain = getContain(bills, ration);
|
|
|
- // 工程量明细
|
|
|
- transformQuantityDetails(tenderData.ID, ration.quantityDetails, ration.ID, 'rationID');
|
|
|
- ration.quantityEXP = getQuantityEXP(bills, ration);
|
|
|
- if (ration.quantityDetails) {
|
|
|
- rst.rationQuantityDetails.push(...ration.quantityDetails);
|
|
|
- }
|
|
|
- rst.ration.push(ration);
|
|
|
- // 定额人材机
|
|
|
- rst.rationGLJ.push(...transformRationGLJs(bills, ration));
|
|
|
- // 定额系数
|
|
|
- rst.rationCoe.push(generateRationCoe(ration));
|
|
|
- });
|
|
|
- });
|
|
|
+ if (bills.rations && bills.rations.length) {
|
|
|
+ bills.rations.forEach(ration => {
|
|
|
+ // TODO 取费专业不知如何取,暂时取单位工程取费专业(导出的文件没有可用的取费专业字段,因此需要后端匹配标准定额)
|
|
|
+ // 如果标准定额有取费专业,则会替换掉这里设置的取费专业
|
|
|
+ ration.programID = tenderData.property.projectEngineering;
|
|
|
+ ration.ID = uuid.v1();
|
|
|
+ ration.projectID = tenderData.ID;
|
|
|
+ ration.billsItemID = bills.ID;
|
|
|
+ ration.contain = getContain(bills, ration);
|
|
|
+ // 工程量明细
|
|
|
+ transformQuantityDetails(tenderData.ID, ration.quantityDetails, ration.ID, 'rationID');
|
|
|
+ ration.quantityEXP = getQuantityEXP(bills, ration);
|
|
|
+ if (ration.quantityDetails) {
|
|
|
+ rst.rationQuantityDetails.push(...ration.quantityDetails);
|
|
|
+ }
|
|
|
+ rst.ration.push(ration);
|
|
|
+ // 定额人材机
|
|
|
+ rst.rationGLJ.push(...transformRationGLJs(bills, ration));
|
|
|
+ // 定额系数
|
|
|
+ rst.rationCoe.push(generateRationCoe(ration));
|
|
|
+ });
|
|
|
+ } else if (importFileKind !== FileKind.tender && bills.type === billType.FX) {
|
|
|
+ // 如果导入招标、控制价文件、每个分项底下自动生成一条空定额
|
|
|
+ const emptyRation = {
|
|
|
+ projectID: tenderData.ID,
|
|
|
+ ID: uuid.v1(),
|
|
|
+ billsItemID: bills.ID,
|
|
|
+ serialNo: 1,
|
|
|
+ type: rationType.ration,
|
|
|
+ jobContentText: bills.jobContent && bills.jobContent[0] && bills.jobContent[0].content || ''
|
|
|
+ };
|
|
|
+ rst.ration.push(emptyRation);
|
|
|
+ }
|
|
|
+ })
|
|
|
return rst;
|
|
|
|
|
|
// 含量:定额工程量/清单工程量
|