|
@@ -23,20 +23,47 @@ let executeObj = {
|
|
|
|
|
|
if (base != null) {
|
|
|
let price = 0, aprice = 0, mprice = 0, tmpSum = 0;
|
|
|
- for (let glj of me.treeNode.data.gljList) {
|
|
|
- if (base.gljTypes.indexOf(glj.type) >= 0) {
|
|
|
- if (base.calcType == baseCalc){ price = glj["basePrice"];}
|
|
|
- else if (base.calcType == adjustCalc){price = glj["adjustPrice"];}
|
|
|
- else if (base.calcType == budgetCalc){price = glj["marketPrice"];}
|
|
|
- else if (base.calcType == diffCalc){
|
|
|
- aprice = glj["adjustPrice"];
|
|
|
- if (!aprice) aprice = 0;
|
|
|
- mprice = glj["marketPrice"];
|
|
|
- if (!mprice) mprice = 0;
|
|
|
- price = mprice - aprice;
|
|
|
+
|
|
|
+ function isSubset(sub, arr){
|
|
|
+ // if(!(sub instanceof Array) || !(arr instanceof Array)) return false;
|
|
|
+ // if(sub.length > arr.length) return false;
|
|
|
+ for(var i = 0, len = sub.length; i < len; i++){
|
|
|
+ if(arr.indexOf(sub[i]) == -1) return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 机上人工费:多一层
|
|
|
+ if (isSubset(base.gljTypes, [gljType.MACHINE_LABOUR])) {
|
|
|
+ for (let glj of me.treeNode.data.gljList) {
|
|
|
+ if (glj.type == gljType.GENERAL_MACHINE) {
|
|
|
+ // 获取机械组成物
|
|
|
+ let mds = projectObj.project.composition.getCompositionByCode(glj.code);
|
|
|
+ for (let md of mds){
|
|
|
+ if (base.gljTypes.indexOf(md.glj_type) >= 0) {
|
|
|
+ price = md["base_price"];
|
|
|
+ if (!price) price = 0;
|
|
|
+ tmpSum = tmpSum + glj["quantity"] * md["consumption"] * price;
|
|
|
+ }
|
|
|
+ };
|
|
|
+ }
|
|
|
+ };
|
|
|
+ }else{
|
|
|
+ for (let glj of me.treeNode.data.gljList) {
|
|
|
+ if (base.gljTypes.indexOf(glj.type) >= 0) {
|
|
|
+ if (base.calcType == baseCalc){ price = glj["basePrice"];}
|
|
|
+ else if (base.calcType == adjustCalc){price = glj["adjustPrice"];}
|
|
|
+ else if (base.calcType == budgetCalc){price = glj["marketPrice"];}
|
|
|
+ else if (base.calcType == diffCalc){
|
|
|
+ aprice = glj["adjustPrice"];
|
|
|
+ if (!aprice) aprice = 0;
|
|
|
+ mprice = glj["marketPrice"];
|
|
|
+ if (!mprice) mprice = 0;
|
|
|
+ price = mprice - aprice;
|
|
|
+ };
|
|
|
+ if (!price) price = 0;
|
|
|
+ tmpSum = tmpSum + glj["quantity"] * price;
|
|
|
};
|
|
|
- if (!price) price = 0;
|
|
|
- tmpSum = tmpSum + glj["quantity"] * price;
|
|
|
};
|
|
|
};
|
|
|
rst = tmpSum;
|