|
@@ -165,6 +165,17 @@ class GLJListModel extends BaseModel {
|
|
* @return {void}
|
|
* @return {void}
|
|
*/
|
|
*/
|
|
combineData(gljList, unitPriceList, quantityList = {}, mixRatioData = {}, totalComposition = {}) {
|
|
combineData(gljList, unitPriceList, quantityList = {}, mixRatioData = {}, totalComposition = {}) {
|
|
|
|
+ // 整理组成物消耗量(只有在总列表显示的时候才需用到,获取单项项目工料机内容则忽略)
|
|
|
|
+ let compositionConsumption = {};
|
|
|
|
+ if (Object.keys(mixRatioData).length > 0 && Object.keys(totalComposition).length > 0) {
|
|
|
|
+ for(let index in mixRatioData) {
|
|
|
|
+ for(let tmp of mixRatioData[index]) {
|
|
|
|
+ compositionConsumption[tmp.glj_id] = compositionConsumption[tmp.glj_id] === undefined ? tmp.consumption :
|
|
|
|
+ compositionConsumption[tmp.glj_id] + tmp.consumption;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
// 循环组合数据
|
|
// 循环组合数据
|
|
for(let glj of gljList) {
|
|
for(let glj of gljList) {
|
|
if (glj.code === undefined) {
|
|
if (glj.code === undefined) {
|
|
@@ -176,15 +187,13 @@ class GLJListModel extends BaseModel {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ let gljId = glj.glj_id + '';
|
|
// 消耗量赋值
|
|
// 消耗量赋值
|
|
glj.quantity = quantityList[glj.id] !== undefined ? quantityList[glj.id] : 0;
|
|
glj.quantity = quantityList[glj.id] !== undefined ? quantityList[glj.id] : 0;
|
|
glj.quantity = totalComposition[glj.code] !== undefined ? totalComposition[glj.code] : glj.quantity;
|
|
glj.quantity = totalComposition[glj.code] !== undefined ? totalComposition[glj.code] : glj.quantity;
|
|
|
|
+ glj.quantity = compositionConsumption[gljId] !== undefined ? glj.quantity + compositionConsumption[gljId] : glj.quantity;
|
|
|
|
|
|
- // 组成物消耗量
|
|
|
|
- let gljId = glj.glj_id + '';
|
|
|
|
- // glj.consumption = mixRatioData[gljId] !== undefined ? mixRatioData[gljId].consumption : 0;
|
|
|
|
- // glj.mix_ratio_id = mixRatioData[gljId] !== undefined ? mixRatioData[gljId].id : 0;
|
|
|
|
- // glj.connect_code = mixRatioData[gljId] !== undefined ? mixRatioData[gljId].connect_code : '';
|
|
|
|
|
|
+ // 组成物数据
|
|
glj.ratio_data = mixRatioData[gljId] !== undefined ? mixRatioData[gljId] : [];
|
|
glj.ratio_data = mixRatioData[gljId] !== undefined ? mixRatioData[gljId] : [];
|
|
|
|
|
|
// 计算调整基价
|
|
// 计算调整基价
|
|
@@ -516,7 +525,7 @@ class GLJListModel extends BaseModel {
|
|
|
|
|
|
let allowType = [GLJTypeConst.MIX_RATIO, GLJTypeConst.CONCRETE, GLJTypeConst.MORTAR,
|
|
let allowType = [GLJTypeConst.MIX_RATIO, GLJTypeConst.CONCRETE, GLJTypeConst.MORTAR,
|
|
GLJTypeConst.GENERAL_MACHINE];
|
|
GLJTypeConst.GENERAL_MACHINE];
|
|
- console
|
|
|
|
|
|
+
|
|
if (projectGLJData.unit_price === null || allowType.indexOf(projectGLJData.unit_price.type) < 0) {
|
|
if (projectGLJData.unit_price === null || allowType.indexOf(projectGLJData.unit_price.type) < 0) {
|
|
throw '找不到相关项目工料机';
|
|
throw '找不到相关项目工料机';
|
|
}
|
|
}
|