|
|
@@ -563,7 +563,7 @@ class Service{
|
|
|
}
|
|
|
let qd = this.cache.filter(x=>x["清单编码"] == qdbm)[0];
|
|
|
let de = qd["children"].filter(x=>x["清单编码"]==debm)[0];
|
|
|
- return de["dercj"];
|
|
|
+ return copy(de["dercj"]);
|
|
|
|
|
|
|
|
|
|
|
|
@@ -773,6 +773,84 @@ async generateQingdanTuijian(name, bh, bt, bm) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ ///////////////////////////////////editor//////////////////////////////////
|
|
|
+
|
|
|
+
|
|
|
+ summarize_one(qd) {
|
|
|
+ let dict = {};
|
|
|
+ for(let i = 0; i < qd["children"].length; i++) {
|
|
|
+ let de = qd["children"][i];
|
|
|
+ let dercj = de['dercj'];
|
|
|
+ for (let j = 1; j < dercj.length; j++) {
|
|
|
+ let hl = dercj[j];
|
|
|
+ let a = hl[1];//"人材机编码",
|
|
|
+ let b = a.concat(hl[2]);//"名称",
|
|
|
+ let c = b.concat(hl[4]);// "单位"
|
|
|
+ if (dict.hasOwnProperty(c)) {
|
|
|
+ dict[c].push(hl);
|
|
|
+ } else {
|
|
|
+ dict[c] = [hl];
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let result = [];
|
|
|
+ for(const key in dict) {
|
|
|
+ let list = dict[key];
|
|
|
+ let sum = 0;
|
|
|
+ let danjia = Number(list[0][5]);
|
|
|
+ for (let i =0 ;i < list.length; i++) {
|
|
|
+ sum += Number(list[i][10]);
|
|
|
+ }
|
|
|
+ let entry = [list[0][0], list[0][1], list[0][2], list[0][3], list[0][4], danjia,
|
|
|
+ list[0][6], list[0][7], list[0][8], list[0][9], sum, sum * danjia, list[0][12],
|
|
|
+ list[0][13], list[0][14], list[0][15]
|
|
|
+ ];
|
|
|
+ result.push(entry);
|
|
|
+
|
|
|
+ }
|
|
|
+ let gongri = 0;
|
|
|
+ for(let i = 0; i < result.length; i++) {
|
|
|
+ if (result[i][4] == '工日') {
|
|
|
+ gongri += result[i][10];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ result.sort((a, b) => Number(a[8]) - Number(b[8]));
|
|
|
+ qd['rcj'] = [["ID", "人材机编码", "名称", "规格型号", "单位", "单价", "产地",
|
|
|
+ "供应厂商", "人材机类别", "甲供标志", "含量", "合价", "暂估价标志", "主要材料标志", "主材标志", "设备标志" ]].concat(result);
|
|
|
+ qd["综合人工工日"] = gongri;
|
|
|
+ qd['综合单价'] = 0;
|
|
|
+ qd['合价'] = 0;
|
|
|
+ qd['人工费'] = 0;
|
|
|
+ qd['主材费'] = 0;
|
|
|
+ qd['设备费'] = 0;
|
|
|
+ qd['辅材费'] = 0;
|
|
|
+ qd['材料费'] = 0;
|
|
|
+ qd['机械费'] = 0;
|
|
|
+ qd['管理费'] = 0;
|
|
|
+ qd['利润'] = 0;
|
|
|
+ for(let i = 0; i < qd["children"].length; i++) {
|
|
|
+ qd['综合单价'] += Number(qd['children'][i]['数量']) * Number(qd['children'][i]['综合单价']);
|
|
|
+ qd['合价'] += Number(qd['children'][i]['合价']);
|
|
|
+ qd['人工费'] += Number(qd['children'][i]['数量']) * Number(qd['children'][i]['人工费']);
|
|
|
+ qd['主材费'] += Number(qd['children'][i]['数量']) * Number(qd['children'][i]['主材费']);
|
|
|
+ qd['设备费'] += Number(qd['children'][i]['数量']) * Number(qd['children'][i]['设备费']);
|
|
|
+ qd['辅材费'] += Number(qd['children'][i]['数量']) * Number(qd['children'][i]['辅材费']);
|
|
|
+ qd['材料费'] += Number(qd['children'][i]['数量']) * Number(qd['children'][i]['材料费']);
|
|
|
+ qd['机械费'] += Number(qd['children'][i]['数量']) * Number(qd['children'][i]['机械费']);
|
|
|
+ qd['管理费'] += Number(qd['children'][i]['数量']) * Number(qd['children'][i]['管理费']);
|
|
|
+ qd['利润'] += Number(qd['children'][i]['数量']) * Number(qd['children'][i]['利润']);
|
|
|
+ }
|
|
|
+
|
|
|
+ return qd;
|
|
|
+ }
|
|
|
+ summarize(data) {
|
|
|
+ return data.map(x=>this.summarize_one(x));
|
|
|
+ }
|
|
|
+
|
|
|
push_op(newData) {
|
|
|
if(this.memory.length == this.mem_pointer + 1) {
|
|
|
this.memory.push(copy(newData));
|
|
|
@@ -791,7 +869,7 @@ async generateQingdanTuijian(name, bh, bt, bm) {
|
|
|
let newData = this.memory[this.mem_pointer - 1];
|
|
|
this.mem_pointer = this.mem_pointer - 1;
|
|
|
this.cache = copy(newData);
|
|
|
- return newData;
|
|
|
+ return copy(newData);
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -803,7 +881,7 @@ async generateQingdanTuijian(name, bh, bt, bm) {
|
|
|
let newData = this.memory[this.mem_pointer + 1];
|
|
|
this.mem_pointer = this.mem_pointer + 1;
|
|
|
this.cache = copy(newData);
|
|
|
- return newData;
|
|
|
+ return copy(newData);
|
|
|
}
|
|
|
|
|
|
return copy(this.cache);
|
|
|
@@ -822,11 +900,11 @@ async generateQingdanTuijian(name, bh, bt, bm) {
|
|
|
return x;
|
|
|
}
|
|
|
});
|
|
|
- //////////push op
|
|
|
- this.push_op(newData);
|
|
|
- /////////////////
|
|
|
- this.cache = copy(newData);
|
|
|
- return newData;
|
|
|
+ let summarized = this.summarize(newData);
|
|
|
+ this.push_op(summarized);
|
|
|
+ /////////////////
|
|
|
+ this.cache = copy(summarized);
|
|
|
+ return copy(this.cache);
|
|
|
|
|
|
} else {
|
|
|
let qd = this.cache.filter(x=>x["children"].filter(y=>y['key'] == key).length > 0)[0];
|
|
|
@@ -842,11 +920,11 @@ async generateQingdanTuijian(name, bh, bt, bm) {
|
|
|
return x;
|
|
|
}
|
|
|
});
|
|
|
- //////////push op
|
|
|
- this.push_op(newData);
|
|
|
- /////////////////
|
|
|
- this.cache = copy(newData);
|
|
|
- return newData;
|
|
|
+ let summarized = this.summarize(newData);
|
|
|
+ this.push_op(summarized);
|
|
|
+ /////////////////
|
|
|
+ this.cache = copy(summarized);
|
|
|
+ return copy(this.cache);
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -865,17 +943,57 @@ async generateQingdanTuijian(name, bh, bt, bm) {
|
|
|
return x;
|
|
|
}
|
|
|
});
|
|
|
- //////////push op
|
|
|
- this.push_op(newData);
|
|
|
+ let summarized = this.summarize(newData);
|
|
|
+ this.push_op(summarized);
|
|
|
/////////////////
|
|
|
- this.cache = copy(newData);
|
|
|
- return newData;
|
|
|
+ this.cache = copy(summarized);
|
|
|
+ return copy(this.cache);
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
- updateDercj(row, change) {
|
|
|
- //this.cache[row]
|
|
|
+ updateDercj(row, data) {
|
|
|
+ console.log("data updated");
|
|
|
+ console.log(this.cache);
|
|
|
+ let sum = 0;
|
|
|
+ for(let i = 1; i < data.length; i++) {
|
|
|
+ sum += Number(data[i][11]);//11-> hejia
|
|
|
+ }
|
|
|
+ console.log("sum=".concat(sum));
|
|
|
+ let qd = this.cache.filter(x=>x["children"].filter(y=>y['key']==row).length > 0)[0];
|
|
|
+ let shuliang = Number(qd['数量']);
|
|
|
+ for(let i = 0; i< qd["children"].length; i++) {
|
|
|
+ if(qd["children"][i]['key'] == row) {
|
|
|
+ qd["children"][i]['综合单价'] = sum;
|
|
|
+ qd["children"][i]['合价'] = sum * shuliang;
|
|
|
+ qd["children"][i]['辅材费'] = sum;
|
|
|
+ qd["children"][i]['材料费'] = sum;
|
|
|
+ qd["children"][i]['人工费'] = 0;
|
|
|
+ qd["children"][i]['主材费'] = 0;
|
|
|
+ qd["children"][i]['设备费'] = 0;
|
|
|
+ qd["children"][i]['机械费'] = 0;
|
|
|
+ qd["children"][i]['管理费'] = 0;
|
|
|
+ qd["children"][i]['利润'] = 0;
|
|
|
+ qd["children"][i]["dercj"] = copy(data);
|
|
|
+ for (let j = 1; j < qd["children"][i]["dercj"].length; j++) {
|
|
|
+ qd["children"][i]["dercj"][j][11] = "=F2*K2";
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let newData = this.cache.map(x=>{
|
|
|
+ if (x['key'] == qd['key']) {
|
|
|
+ return qd;
|
|
|
+ } else {
|
|
|
+ return x;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ let summarized = this.summarize(newData);
|
|
|
+ this.push_op(summarized);
|
|
|
+ /////////////////
|
|
|
+ this.cache = copy(summarized);
|
|
|
+ return copy(this.cache);
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -915,10 +1033,11 @@ async generateQingdanTuijian(name, bh, bt, bm) {
|
|
|
|
|
|
|
|
|
});
|
|
|
-
|
|
|
- this.cache = copy(this.cache);
|
|
|
- this.push_op(copy(this.cache));
|
|
|
- return [true, this.cache];
|
|
|
+ let summarized = this.summarize(this.cache);
|
|
|
+ this.push_op(summarized);
|
|
|
+ this.cache = copy(summarized);
|
|
|
+
|
|
|
+ return [true, copy(this.cache)];
|
|
|
} else {
|
|
|
return [false,null];
|
|
|
}
|