|
|
@@ -7,12 +7,38 @@ class Service{
|
|
|
this.cache = [];
|
|
|
this.memory = [];
|
|
|
this.mem_pointer = -1;
|
|
|
+ this.qufei = [];
|
|
|
+ this.qufeiEntry = null;
|
|
|
}
|
|
|
|
|
|
ip() {
|
|
|
return "http://127.0.0.1"
|
|
|
}
|
|
|
|
|
|
+ clearCache() {
|
|
|
+ this.cache = [];
|
|
|
+ this.memory = [];
|
|
|
+ this.mem_pointer = -1;
|
|
|
+ }
|
|
|
+
|
|
|
+ setQufei(data) {
|
|
|
+ let result = [];
|
|
|
+ for(let i = 0; i < data[0]['children'].length; i++) {
|
|
|
+ let child = data[0]['children'][i];
|
|
|
+ for(let j = 0; j < child['children'].length; j++) {
|
|
|
+ let grandchild = child['children'][j];
|
|
|
+ //console.log(grandchild);
|
|
|
+ result.push(grandchild);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.qufei = result;
|
|
|
+ }
|
|
|
+
|
|
|
+ setQufeiEntry(bh) {
|
|
|
+ this.qufeiEntry = this.qufei.filter(x=>x['key'] == bh)[0];
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
processQingdanmingxi(mingxi) {
|
|
|
this.cache = copy(mingxi);
|
|
|
for(let i = 0; i < this.cache.length; i++) {
|
|
|
@@ -521,6 +547,7 @@ class Service{
|
|
|
} else {
|
|
|
const data = await response.json();
|
|
|
this.processQingdanmingxi(data);
|
|
|
+ this.setQufeiEntry(bh);
|
|
|
return copy(this.cache);
|
|
|
}
|
|
|
} else {
|
|
|
@@ -1003,25 +1030,6 @@ async generateQingdanTuijian(name, bh, bt, bm) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- quanbushanchu(qdbm) {
|
|
|
- let newData = this.cache.map(x=>{
|
|
|
- if (x["清单编码"] == qdbm) {
|
|
|
- let y = copy(x);
|
|
|
-
|
|
|
- y["__children"] = [];
|
|
|
- return y;
|
|
|
- } else {
|
|
|
- return x;
|
|
|
- }
|
|
|
- });
|
|
|
- let summarized = this.summarize(newData);
|
|
|
- this.push_op(summarized);
|
|
|
- /////////////////
|
|
|
- this.cache = copy(summarized);
|
|
|
- return copy(this.cache);
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
|
|
|
updateDercj_(row, data, xuhao) {///change 一条定额 inplace, 汇总一条定额的rcj, xuhao is for rename
|
|
|
console.log("data updated");
|
|
|
@@ -1067,7 +1075,7 @@ async generateQingdanTuijian(name, bh, bt, bm) {
|
|
|
}
|
|
|
de['dercj'][j][2] = data[j][2];//名称
|
|
|
de['dercj'][j][1] = data[j][1];//编号
|
|
|
- de['dercj'][j][5] = de['rcjdg'][j][5];
|
|
|
+ de['dercj'][j][5] = de['rcjdg'][j][5];//单价
|
|
|
de['dercj'][j][10] = origin;
|
|
|
de['dercj'][j][11] = Number(de['dercj'][j][5]) * origin;
|
|
|
}
|
|
|
@@ -1125,16 +1133,31 @@ async generateQingdanTuijian(name, bh, bt, bm) {
|
|
|
if(qd["children"][i]['key'] == row) {
|
|
|
let desl = Number(qd["children"][i]['数量']);
|
|
|
let oldname = qd["children"][i]['清单编码'];
|
|
|
- qd["children"][i]['综合单价'] = sum;
|
|
|
- qd["children"][i]['合价'] = (sum * shuliang * desl);
|
|
|
+
|
|
|
qd["children"][i]['辅材费'] = clf_sum;
|
|
|
qd["children"][i]['材料费'] = clf_sum;
|
|
|
qd["children"][i]['人工费'] = rgf_sum;
|
|
|
qd["children"][i]['主材费'] = 0;
|
|
|
qd["children"][i]['设备费'] = 0;
|
|
|
qd["children"][i]['机械费'] = jxf_sum;
|
|
|
- qd["children"][i]['管理费'] = 0;
|
|
|
- qd["children"][i]['利润'] = 0;
|
|
|
+ if (oldname.startsWith("D")) {//单项清单
|
|
|
+ qd["children"][i]['管理费'] = 0;
|
|
|
+ qd["children"][i]['利润'] = 0;
|
|
|
+ } else {
|
|
|
+ if (this.qufeiEntry['备注'].length == 0) {
|
|
|
+ //changuiqufei
|
|
|
+ qd["children"][i]['管理费'] = (rgf_sum + jxf_sum) * Number(this.qufeiEntry['管理费(%)']) / Number(100);
|
|
|
+ qd["children"][i]['利润'] = (rgf_sum + jxf_sum) * Number(this.qufeiEntry['利润(%)']) / Number(100);
|
|
|
+ } else {
|
|
|
+ qd["children"][i]['管理费'] = (rgf_sum) * Number(this.qufeiEntry['管理费(%)']) / Number(100);
|
|
|
+ qd["children"][i]['利润'] = (rgf_sum) * Number(this.qufeiEntry['利润(%)']) / Number(100);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ qd["children"][i]['综合单价'] = sum + qd["children"][i]['管理费'] + qd["children"][i]['利润'];
|
|
|
+ qd["children"][i]['合价'] = (qd["children"][i]['综合单价'] * shuliang * desl);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
qd["children"][i]["dercj"] = copy(data);
|
|
|
qd["children"][i]['清单编码'] = renameDingE(oldname, xuhao, huan);
|
|
|
|