|
|
@@ -41,7 +41,7 @@ class Service{
|
|
|
|
|
|
x["key"] = x["序号"];
|
|
|
x["children"] = x["children"].map(y=>{
|
|
|
- if (y.hasOwnProperty('key')) {
|
|
|
+ if (!y.hasOwnProperty('key')) {
|
|
|
y['key'] = uuidv4();
|
|
|
}
|
|
|
return y;
|
|
|
@@ -804,13 +804,16 @@ async generateQingdanTuijian(name, bh, bt, bm) {
|
|
|
///////////////////////////////////editor//////////////////////////////////
|
|
|
|
|
|
|
|
|
- summarize_one(qd) {
|
|
|
+ summarize_one(qd) {///根据定额汇总清单
|
|
|
let dict = {};
|
|
|
for(let i = 0; i < qd["children"].length; i++) {
|
|
|
let de = qd["children"][i];
|
|
|
+ let desl = Number(de['数量']);
|
|
|
let dercj = de['dercj'];
|
|
|
for (let j = 1; j < dercj.length; j++) {
|
|
|
let hl = dercj[j];
|
|
|
+ hl[10] = desl * Number(hl[10]);
|
|
|
+ hl[11] = desl * Number(hl[11]);
|
|
|
let a = hl[1];//"人材机编码",
|
|
|
let b = a.concat(hl[2]);//"名称",
|
|
|
let c = b.concat(hl[4]);// "单位"
|
|
|
@@ -977,35 +980,57 @@ async generateQingdanTuijian(name, bh, bt, bm) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- updateDercj(row, data) {
|
|
|
+ updateDercj_(row, data) {///change qd inplace
|
|
|
console.log("data updated");
|
|
|
console.log(this.cache);
|
|
|
let sum = 0;
|
|
|
+ let rgf_sum = 0;
|
|
|
+ let jxf_sum = 0;
|
|
|
+ let clf_sum = 0;
|
|
|
for(let i = 1; i < data.length; i++) {
|
|
|
sum += Number(data[i][11]);//11-> hejia
|
|
|
+ if (Number(data[i][8]) == 1) {
|
|
|
+ rgf_sum += Number(data[i][11]);
|
|
|
+ }
|
|
|
+ if (Number(data[i][8]) == 2) {
|
|
|
+ clf_sum += Number(data[i][11]);
|
|
|
+ }
|
|
|
+ if (Number(data[i][8]) == 3) {
|
|
|
+ jxf_sum += Number(data[i][11]);
|
|
|
+ }
|
|
|
}
|
|
|
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;
|
|
|
+ let desl = Number(qd["children"][i]['数量']);
|
|
|
+ qd["children"][i]['综合单价'] = sum.toFixed(2);
|
|
|
+ qd["children"][i]['合价'] = (sum * shuliang * desl).toFixed(2);
|
|
|
+ qd["children"][i]['辅材费'] = clf_sum.toFixed(2);
|
|
|
+ qd["children"][i]['材料费'] = clf_sum.toFixed(2);
|
|
|
+ qd["children"][i]['人工费'] = rgf_sum.toFixed(2);
|
|
|
qd["children"][i]['主材费'] = 0;
|
|
|
qd["children"][i]['设备费'] = 0;
|
|
|
- qd["children"][i]['机械费'] = 0;
|
|
|
+ qd["children"][i]['机械费'] = jxf_sum.toFixed(2);
|
|
|
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 A = "=F".concat((j+1).toString());
|
|
|
+ let B = A.concat("*K");//2";
|
|
|
+ let C = B.concat((j+1).toString());
|
|
|
+ qd["children"][i]["dercj"][j][11] = C;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
+
|
|
|
+ updateDercj(row, data) {
|
|
|
+ this.updateDercj_(row, data);
|
|
|
+
|
|
|
let newData = this.cache.map(x=>{
|
|
|
if (x['key'] == qd['key']) {
|
|
|
return qd;
|
|
|
@@ -1022,6 +1047,74 @@ async generateQingdanTuijian(name, bh, bt, bm) {
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ changguidinge(dingeclick, row) {
|
|
|
+ if (this.cache.filter(x=>x['key'] == row).length > 0) {
|
|
|
+
|
|
|
+ let res =dingeclick;
|
|
|
+ let keys = Object.keys(res['DEBH']);
|
|
|
+ let key = keys[0];
|
|
|
+ //console.log(res);
|
|
|
+ let qd = this.cache.filter(x=>x['key'] == row)[0];
|
|
|
+ let dercj = [["ID", "人材机编码", "名称", "规格型号", "单位", "单价", "产地",
|
|
|
+ "供应厂商", "人材机类别", "甲供标志", "含量", "合价", "暂估价标志", "主要材料标志", "主材标志", "设备标志" ]];
|
|
|
+ for(let i = 0; i < res['rgde'].length; i++) {
|
|
|
+ dercj.push(['', res['rgde'][i]['CLBH'], res['rgde'][i]['CLMC'], '', res['rgde'][i]['JLDW'],
|
|
|
+ res['rgde'][i]['YSJG'], '', '', '1', '', res['rgde'][i]['gr'], res['rgde'][i]['gf'],
|
|
|
+ '', '', '', '' ]);
|
|
|
+ }
|
|
|
+ for(let i = 0; i < res['clde'].length; i++) {
|
|
|
+ dercj.push(['', res['clde'][i]['CLBH'], res['clde'][i]['CLMC'], '', res['clde'][i]['JLDW'],
|
|
|
+ res['clde'][i]['YSJG'], '', '', '2', '', res['clde'][i]['SL'], res['clde'][i]['HJ'],
|
|
|
+ '', '', '', '' ]);
|
|
|
+ }
|
|
|
+ for(let i = 0; i < res['jxde'].length; i++) {
|
|
|
+ dercj.push(['', res['jxde'][i]['jxbh'], res['jxde'][i]['jxmc'], '', res['jxde'][i]['DW'],
|
|
|
+ res['jxde'][i]['tbdj'], '', '', '3', '', res['jxde'][i]['sl'], res['jxde'][i]['hj'],
|
|
|
+ '', '', '', '' ]);
|
|
|
+ }
|
|
|
+ let newKey = uuidv4();
|
|
|
+ qd["children"].push({
|
|
|
+ '操作': '',
|
|
|
+ '序号': null,
|
|
|
+ '清单编码': res['DEBH'][key],
|
|
|
+ '名称': res['GCLMC'][key],
|
|
|
+ '项目特征': null,
|
|
|
+ '计算规则': null,
|
|
|
+ '单位': res['DW'][key],
|
|
|
+ '数量': '1',
|
|
|
+ '综合单价': '0',
|
|
|
+ '合价': '0',
|
|
|
+ '人工费': '0',
|
|
|
+ '主材费': '0',
|
|
|
+ '设备费': '0',
|
|
|
+ '辅材费': '0',
|
|
|
+ '材料费': '0',
|
|
|
+ '机械费': '0',
|
|
|
+ '管理费': '0',
|
|
|
+ '利润': '0',
|
|
|
+ '暂估价': null,
|
|
|
+ '综合人工工日': null,
|
|
|
+ '备注': null,
|
|
|
+ "dercj": dercj,
|
|
|
+ 'key' : newKey
|
|
|
+
|
|
|
+
|
|
|
+ });
|
|
|
+ this.updateDercj_(newKey, dercj);
|
|
|
+ let summarized = this.summarize(this.cache);
|
|
|
+ this.push_op(copy(summarized));
|
|
|
+ /////////////////
|
|
|
+ this.cache = copy(summarized);
|
|
|
+ //return copy(this.cache);
|
|
|
+
|
|
|
+
|
|
|
+ return [true, copy(this.cache)];
|
|
|
+ } else {
|
|
|
+ return [false, null];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
danxiangdinge(row) {
|
|
|
let bh = danxiangdinge_index(this.cache);
|
|
|
|