|
@@ -27,6 +27,7 @@ class Service{
|
|
|
'04050101' : ['道碴 40~80mm', 47],
|
|
'04050101' : ['道碴 40~80mm', 47],
|
|
|
'04034103' : ['石屑(米砂)', 40]
|
|
'04034103' : ['石屑(米砂)', 40]
|
|
|
};
|
|
};
|
|
|
|
|
+ this.task={};
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
setToken(token) {
|
|
setToken(token) {
|
|
@@ -46,6 +47,7 @@ class Service{
|
|
|
this.cache_djcs = [];
|
|
this.cache_djcs = [];
|
|
|
this.memory_djcs = [];
|
|
this.memory_djcs = [];
|
|
|
this.mem_pointer_djcs = -1;
|
|
this.mem_pointer_djcs = -1;
|
|
|
|
|
+ this.task={};
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
setQufei(data) {
|
|
setQufei(data) {
|
|
@@ -292,7 +294,7 @@ class Service{
|
|
|
if (bt == 'Djcs') {
|
|
if (bt == 'Djcs') {
|
|
|
let qd = this.cache_djcs.filter(x=>x["清单编码"] == qdbm)[0];
|
|
let qd = this.cache_djcs.filter(x=>x["清单编码"] == qdbm)[0];
|
|
|
let de = qd["_children"].filter(x=>x["清单编码"]==debm && x['key'] == key)[0];
|
|
let de = qd["_children"].filter(x=>x["清单编码"]==debm && x['key'] == key)[0];
|
|
|
- return [copy(de["dercj"]), de["fuzhuEnable"]];
|
|
|
|
|
|
|
+ return [copy(de["dercj"]), de["fuzhuEnable"], de['yuban']];
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
let qd = this.cache.filter(x=>x["清单编码"] == qdbm)[0];
|
|
let qd = this.cache.filter(x=>x["清单编码"] == qdbm)[0];
|
|
@@ -893,9 +895,11 @@ class Service{
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- //没有预拌砂浆,没有补充
|
|
|
|
|
- updateDercj_djcs_(row, data, xuhao, mode=0/**0->update by view; 1-> config change */) {///change 一条定额 inplace, 汇总一条定额的rcj, xuhao is for rename
|
|
|
|
|
|
|
+ //有预拌砂浆,没有补充
|
|
|
|
|
+ updateDercj_djcs_(row, data, xuhao, yuban, mode=0/**0->update by view; 1-> config change */) {///change 一条定额 inplace, 汇总一条定额的rcj, xuhao is for rename
|
|
|
console.log("data updated");
|
|
console.log("data updated");
|
|
|
|
|
+ let data_normal = [["ID", "人材机编码", "名称", "规格型号", "单位", "单价", "产地",
|
|
|
|
|
+ "供应厂商", "人材机类别", "甲供标志", "含量", "合价", "暂估价标志", "主要材料标志", "主材标志", "设备标志", 'key', 'bc' ]];//正常部分,不包括补充
|
|
|
//处理附注
|
|
//处理附注
|
|
|
let huan = false;
|
|
let huan = false;
|
|
|
let qd = this.cache_djcs.filter(x=>x["_children"].filter(y=>y['key']==row).length > 0)[0];
|
|
let qd = this.cache_djcs.filter(x=>x["_children"].filter(y=>y['key']==row).length > 0)[0];
|
|
@@ -990,23 +994,30 @@ class Service{
|
|
|
for(let j = 1; j < de['dercj'].length; j++) {
|
|
for(let j = 1; j < de['dercj'].length; j++) {
|
|
|
for (let k = 0; k < data.length; k++) {
|
|
for (let k = 0; k < data.length; k++) {
|
|
|
if (data[k][16] == de['dercj'][j][16]) {
|
|
if (data[k][16] == de['dercj'][j][16]) {
|
|
|
- if (de['dercj'][j][2] == data[k][2]) {//名称
|
|
|
|
|
-
|
|
|
|
|
- } else {
|
|
|
|
|
- huan = true;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ let datak2 = data[k][2];
|
|
|
|
|
+ if (datak2.includes('(湿拌砂浆)')) {
|
|
|
|
|
+ datak2 = datak2.replace('(湿拌砂浆)', '');
|
|
|
|
|
+ }
|
|
|
|
|
+ if (datak2.includes('(干拌(混)砂浆)')) {
|
|
|
|
|
+ datak2 = datak2.replace('(干拌(混)砂浆)', '');
|
|
|
|
|
+ }
|
|
|
|
|
+ if (de['dercj'][j][2] == datak2) {//名称
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+ huan = true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mode == 1) {
|
|
if (mode == 1) {
|
|
|
- data = de['dercj'];
|
|
|
|
|
|
|
+ data_normal = de['dercj'];
|
|
|
huan = false;
|
|
huan = false;
|
|
|
} else {
|
|
} else {
|
|
|
de['dercj'] = copy(data);
|
|
de['dercj'] = copy(data);
|
|
|
- data = de['dercj'];
|
|
|
|
|
|
|
+ data_normal = de['dercj'];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1015,8 +1026,236 @@ class Service{
|
|
|
} else {////单项定额没有底稿,老数据没底搞,无法判断换部换,暂时统一认为不换
|
|
} else {////单项定额没有底稿,老数据没底搞,无法判断换部换,暂时统一认为不换
|
|
|
//强行改含量
|
|
//强行改含量
|
|
|
de['dercj'] = copy(data);
|
|
de['dercj'] = copy(data);
|
|
|
- data = de['dercj'];
|
|
|
|
|
|
|
+ data_normal = de['dercj'];
|
|
|
}
|
|
}
|
|
|
|
|
+ if (yuban.length > 0) {//处理预拌砂浆
|
|
|
|
|
+ if (yuban.includes('1')) {//与换无关
|
|
|
|
|
+ for(let i = 1; i < data_normal.length; i++) {
|
|
|
|
|
+ if (data_normal[i][4]=='工日') {
|
|
|
|
|
+ data_normal[i][10] = Number(data_normal[i][10]) - 0.45;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (data_normal[i][2].includes('搅拌机')) {
|
|
|
|
|
+ data_normal[i][10] = 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (data_normal[i][2].includes('砂浆') && !data_normal[i][2].includes('搅拌机')) {
|
|
|
|
|
+ data_normal[i][2] = data_normal[i][2].concat('(湿拌砂浆)')
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (mode == 0) {
|
|
|
|
|
+ data_normal = copy(data);
|
|
|
|
|
+ } else if (mode == 1) {
|
|
|
|
|
+ //data_normal = data_normal.filter(x=>x[17]!='true');
|
|
|
|
|
+ //data_normal = data_normal.concat(data.filter(x=> x[17] == 'true'));
|
|
|
|
|
+ } else if (mode == 2) {
|
|
|
|
|
+ let data_normal_2 = copy(data_normal);
|
|
|
|
|
+ data_normal = data.filter(x=>x[17]!='true');
|
|
|
|
|
+ data_normal = data_normal.concat(data_normal_2.filter(x=> x[17] == 'true'));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ } else if (yuban.includes('2')) {//与换无关
|
|
|
|
|
+
|
|
|
|
|
+ let added = [];
|
|
|
|
|
+ for(let i = 1; i < data_normal.length; i++) {
|
|
|
|
|
+ let origin = 0;
|
|
|
|
|
+ if (data_normal[i][4]=='工日') {
|
|
|
|
|
+ data_normal[i][10] = Number(data_normal[i][10]) - 0.3;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (data_normal[i][2].includes('搅拌机')) {
|
|
|
|
|
+ data_normal[i][10] = 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (data_normal[i][2].includes('砂浆') && !data_normal[i][2].includes('搅拌机')) {
|
|
|
|
|
+ data_normal[i][2] = data_normal[i][2].concat('(干拌(混)砂浆)');
|
|
|
|
|
+ origin = Number(data_normal[i][10]);
|
|
|
|
|
+ data_normal[i][10] = origin * 1.75;
|
|
|
|
|
+ added.push(['', 'S00001', '水', '', 't', '4.70', '', '', '2', 'false', (origin * 0.29).toString(), ''/**hj */, ''/**zgj */,''/**zycl */,''/**zc */,''/**sb */,'',data_normal[i][17]]);
|
|
|
|
|
+ added.push(['', 'JD0001', '其他机械费(电)', '', '度', '0.65', '', '', '3', 'false', (origin * 2.15).toString(), ''/**hj */, ''/**zgj */,''/**zycl */,''/**zc */,''/**sb */, '',data_normal[i][17]]);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ data_normal = data_normal.concat(added);
|
|
|
|
|
+ if (mode == 0) {
|
|
|
|
|
+ data_normal = copy(data);
|
|
|
|
|
+ } else if (mode == 1) {
|
|
|
|
|
+ //data_normal = data_normal.filter(x=>x[17]!='true');
|
|
|
|
|
+ //data_normal = data_normal.concat(data.filter(x=> x[17] == 'true'));
|
|
|
|
|
+ } else if (mode == 2) {
|
|
|
|
|
+ let data_normal_2 = copy(data_normal);
|
|
|
|
|
+ data_normal = data.filter(x=>x[17]!='true');
|
|
|
|
|
+ data_normal = data_normal.concat(data_normal_2.filter(x=> x[17] == 'true'));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ } else if (yuban.includes('3')) {//与换无关
|
|
|
|
|
+ let added = [];
|
|
|
|
|
+ for(let i = 1; i < data_normal.length; i++) {
|
|
|
|
|
+ let origin = 0;
|
|
|
|
|
+ if (data_normal[i][4]=='工日') {
|
|
|
|
|
+ data_normal[i][10] = Number(data_normal[i][10]) - 0.2;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (data_normal[i][2].includes('砂浆') && !data_normal[i][2].includes('搅拌机')) {
|
|
|
|
|
+ data_normal[i][2] = data_normal[i][2].concat('(干拌(混)砂浆)');
|
|
|
|
|
+ origin = Number(data_normal[i][10]);
|
|
|
|
|
+ data_normal[i][10] = origin * 1.75;
|
|
|
|
|
+ added.push(['', 'S00001', '水', '', 't', '4.70', '', '', '2', 'false', (origin * 0.29).toString(), '', '','','','','',data_normal[i][17]]);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ data_normal = data_normal.concat(added);
|
|
|
|
|
+ if (mode == 0) {
|
|
|
|
|
+ data_normal = copy(data);
|
|
|
|
|
+ } else if (mode == 1) {
|
|
|
|
|
+ //data_normal = data_normal.filter(x=>x[17]!='true');
|
|
|
|
|
+ //data_normal = data_normal.concat(data.filter(x=> x[17] == 'true'));
|
|
|
|
|
+ } else if (mode == 2) {
|
|
|
|
|
+ let data_normal_2 = copy(data_normal);
|
|
|
|
|
+ data_normal = data.filter(x=>x[17]!='true');
|
|
|
|
|
+ data_normal = data_normal.concat(data_normal_2.filter(x=> x[17] == 'true'));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+ let data_normal_2 = [["ID", "人材机编码", "名称", "规格型号", "单位", "单价", "产地",
|
|
|
|
|
+ "供应厂商", "人材机类别", "甲供标志", "含量", "合价", "暂估价标志", "主要材料标志", "主材标志", "设备标志", 'key', 'bc' ]];
|
|
|
|
|
+ for(let i = 1; i < data_normal.length; i++) {
|
|
|
|
|
+ let bc = data_normal[i][17];
|
|
|
|
|
+ let child = addChildren(10, data_normal[i][1], data_normal[i][10], data_normal[i][17], data_normal[i][16]);
|
|
|
|
|
+ if (child.length > 0) {
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+ child = addChildren(40, data_normal[i][1], data_normal[i][10], data_normal[i][17], data_normal[i][16]);
|
|
|
|
|
+ if (child.length > 0) {
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+ child = addChildren(50, data_normal[i][1], data_normal[i][10], data_normal[i][17], data_normal[i][16]);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (child.length > 0) {//拆分
|
|
|
|
|
+ for(let j = 0; j < child.length; j++) {
|
|
|
|
|
+ data_normal_2.push(child[j]);
|
|
|
|
|
+ if (bc == 'true') {
|
|
|
|
|
+ for (let k = 0; k < data.length; k++) {
|
|
|
|
|
+ if (data[k][16] == child[j][16]) {
|
|
|
|
|
+ let datak2 = data[k][2];
|
|
|
|
|
+
|
|
|
|
|
+ if (child[j][2] == datak2) {//名称
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (mode > 0) {
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+ huan = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if (mode != 1){
|
|
|
|
|
+ for (let k = 0; k < data.length; k++) {
|
|
|
|
|
+ if (data[k][16] == child[j][16]) {
|
|
|
|
|
+ let datak2 = data[k][2];
|
|
|
|
|
+
|
|
|
|
|
+ if (child[j][2] == datak2) {//名称
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+ huan = true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+ data_normal_2.push(data_normal[i]);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (mode == 0) {
|
|
|
|
|
+ data_normal = copy(data);
|
|
|
|
|
+ } else if (mode == 2) {
|
|
|
|
|
+ data_normal = data.filter(x=>x[17]!='true');
|
|
|
|
|
+ data_normal = data_normal.concat(data_normal_2.filter(x=> x[17] == 'true'));
|
|
|
|
|
+ } else if (mode == 1) {
|
|
|
|
|
+ data_normal = data_normal_2;
|
|
|
|
|
+ //data_normal = data_normal.concat(data.filter(x=> x[17] == 'true'));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ } else {//没有预拌
|
|
|
|
|
+ let data_normal_2 = [["ID", "人材机编码", "名称", "规格型号", "单位", "单价", "产地",
|
|
|
|
|
+ "供应厂商", "人材机类别", "甲供标志", "含量", "合价", "暂估价标志", "主要材料标志", "主材标志", "设备标志", 'key', 'bc' ]];
|
|
|
|
|
+ for(let i = 1; i < data_normal.length; i++) {
|
|
|
|
|
+ let bc = data_normal[i][17];
|
|
|
|
|
+ let child = addChildren(10, data_normal[i][1], data_normal[i][10], data_normal[i][17], data_normal[i][16]);
|
|
|
|
|
+ if (child.length > 0) {
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+ child = addChildren(40, data_normal[i][1], data_normal[i][10], data_normal[i][17], data_normal[i][16]);
|
|
|
|
|
+ if (child.length > 0) {
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+ child = addChildren(50, data_normal[i][1], data_normal[i][10], data_normal[i][17], data_normal[i][16]);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (child.length > 0) {//拆分
|
|
|
|
|
+ for(let j = 0; j < child.length; j++) {
|
|
|
|
|
+ data_normal_2.push(child[j]);
|
|
|
|
|
+ if (bc == 'true') {
|
|
|
|
|
+ for (let k = 0; k < data.length; k++) {
|
|
|
|
|
+ if (data[k][16] == child[j][16]) {
|
|
|
|
|
+ let datak2 = data[k][2];
|
|
|
|
|
+
|
|
|
|
|
+ if (child[j][2] == datak2) {//名称
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (mode > 0) {
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+ huan = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if (mode != 1){
|
|
|
|
|
+ for (let k = 0; k < data.length; k++) {
|
|
|
|
|
+ if (data[k][16] == child[j][16]) {
|
|
|
|
|
+ let datak2 = data[k][2];
|
|
|
|
|
+
|
|
|
|
|
+ if (child[j][2] == datak2) {//名称
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+ huan = true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+ data_normal_2.push(data_normal[i]);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (mode == 0) {
|
|
|
|
|
+ data_normal = copy(data);
|
|
|
|
|
+ } else if (mode == 2) {
|
|
|
|
|
+ data_normal = data.filter(x=>x[17]!='true');
|
|
|
|
|
+ data_normal = data_normal.concat(data_normal_2.filter(x=> x[17] == 'true'));
|
|
|
|
|
+ } else if (mode == 1) {
|
|
|
|
|
+ data_normal = data_normal_2;
|
|
|
|
|
+ //data_normal = data_normal.concat(data.filter(x=> x[17] == 'true'));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ data = copy(data_normal);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
//模拟formula计算每一行的合价
|
|
//模拟formula计算每一行的合价
|
|
|
for(let i = 1; i < data.length; i++) {
|
|
for(let i = 1; i < data.length; i++) {
|
|
|
data[i][11] = Number(data[i][10]) * Number(data[i][5]);
|
|
data[i][11] = Number(data[i][10]) * Number(data[i][5]);
|
|
@@ -1653,7 +1892,7 @@ class Service{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- this.updateDercj_djcs_(row, data, alreadyFuzhu);
|
|
|
|
|
|
|
+ this.updateDercj_djcs_(row, data, alreadyFuzhu, []);
|
|
|
//let qd = this.cache.filter(x=>x["children"].filter(y=>y['key']==row).length > 0)[0];
|
|
//let qd = this.cache.filter(x=>x["children"].filter(y=>y['key']==row).length > 0)[0];
|
|
|
|
|
|
|
|
let newData = this.cache_djcs.map(x=>{
|
|
let newData = this.cache_djcs.map(x=>{
|
|
@@ -1714,7 +1953,7 @@ class Service{
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
de['fuzhu'] = copy(selected);
|
|
de['fuzhu'] = copy(selected);
|
|
|
- this.updateDercj_djcs_(row, de['dercj'], xuhao, 1);
|
|
|
|
|
|
|
+ this.updateDercj_djcs_(row, de['dercj'], xuhao, [], 1);
|
|
|
|
|
|
|
|
let newData = this.cache_djcs.map(x=>{
|
|
let newData = this.cache_djcs.map(x=>{
|
|
|
if (x['key'] == qd['key']) {
|
|
if (x['key'] == qd['key']) {
|
|
@@ -1937,7 +2176,7 @@ class Service{
|
|
|
|
|
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- this.updateDercj_djcs_(newKey, dercj, []);
|
|
|
|
|
|
|
+ this.updateDercj_djcs_(newKey, dercj, [], []);
|
|
|
let summarized = this.summarize_djcs(this.cache_djcs);
|
|
let summarized = this.summarize_djcs(this.cache_djcs);
|
|
|
this.push_op_djcs(copy(summarized));
|
|
this.push_op_djcs(copy(summarized));
|
|
|
this.cache_djcs = copy(summarized);
|
|
this.cache_djcs = copy(summarized);
|
|
@@ -2039,7 +2278,7 @@ class Service{
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
});
|
|
|
- this.updateDercj_djcs_(newKey, newdercj, []);
|
|
|
|
|
|
|
+ this.updateDercj_djcs_(newKey, newdercj, [], [], 1);
|
|
|
let summarized = this.summarize_djcs(this.cache_djcs);
|
|
let summarized = this.summarize_djcs(this.cache_djcs);
|
|
|
this.push_op_djcs(copy(summarized));
|
|
this.push_op_djcs(copy(summarized));
|
|
|
/////////////////
|
|
/////////////////
|
|
@@ -2053,7 +2292,82 @@ class Service{
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ handleAI_djcs(result) {
|
|
|
|
|
+ let keys = Object.keys(result);
|
|
|
|
|
+ let datakey = null;
|
|
|
|
|
+ for (let i = 0; i < keys.length; i++) {
|
|
|
|
|
+ let key = keys[i]
|
|
|
|
|
+ let hits = this.cache_djcs.filter(x=>x['清单编码']==key);
|
|
|
|
|
+ let qd = hits[0]
|
|
|
|
|
+ if (qd == null)continue;
|
|
|
|
|
+ let r = result[key]
|
|
|
|
|
+ let rr = r['result']
|
|
|
|
|
+ let rrr = rr['result'][0]
|
|
|
|
|
+ //console.log(rrr)
|
|
|
|
|
+ //console.log(qd)
|
|
|
|
|
+ datakey = qd['key']
|
|
|
|
|
+ qd['rcj']=rrr['rcj']
|
|
|
|
|
+ qd['主材费'] = String(rrr['主材费'])
|
|
|
|
|
+ qd['人工费'] = String(rrr['人工费'])
|
|
|
|
|
+ qd['利润'] = String(rrr['利润'])
|
|
|
|
|
+ qd['合价'] = String(rrr['合价'])
|
|
|
|
|
+ qd['暂估价'] = String(rrr['暂估价'])
|
|
|
|
|
+ qd['机械费'] = String(rrr['机械费'])
|
|
|
|
|
+ qd['材料费'] = String(rrr['材料费'])
|
|
|
|
|
+ qd['管理费'] = String(rrr['管理费'])
|
|
|
|
|
+ qd['综合人工工日'] = String(rrr['综合人工工日'])
|
|
|
|
|
+ qd['综合单价'] = String(rrr['综合单价'])
|
|
|
|
|
+ qd['设备费'] = String(rrr['设备费'])
|
|
|
|
|
+ qd['辅材费'] = String(rrr['辅材费'])
|
|
|
|
|
+ qd['_children'] = rrr['_children']
|
|
|
|
|
+ }
|
|
|
|
|
+ this.push_op_djcs(copy(this.cache_djcs));
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
+ return [true, copy(this.cache_djcs), datakey];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ handleAI(result) {
|
|
|
|
|
+ let keys = Object.keys(result);
|
|
|
|
|
+ let datakey = null;
|
|
|
|
|
+ let changed = false;
|
|
|
|
|
+ for (let i = 0; i < keys.length; i++) {
|
|
|
|
|
+ let key = keys[i]
|
|
|
|
|
+ let hits = this.cache.filter(x=>x['清单编码']==key);
|
|
|
|
|
+ let qd = hits[0]
|
|
|
|
|
+ if (qd == null)continue;
|
|
|
|
|
+ changed = true;
|
|
|
|
|
+ let r = result[key]
|
|
|
|
|
+ let rr = r['result']
|
|
|
|
|
+ let rrr = rr['result'][0]
|
|
|
|
|
+ //console.log(rrr)
|
|
|
|
|
+ //console.log(qd)
|
|
|
|
|
+ datakey = qd['key']
|
|
|
|
|
+ qd['rcj']=rrr['rcj']
|
|
|
|
|
+ qd['主材费'] = String(rrr['主材费'])
|
|
|
|
|
+ qd['人工费'] = String(rrr['人工费'])
|
|
|
|
|
+ qd['利润'] = String(rrr['利润'])
|
|
|
|
|
+ qd['合价'] = String(rrr['合价'])
|
|
|
|
|
+ qd['暂估价'] = String(rrr['暂估价'])
|
|
|
|
|
+ qd['机械费'] = String(rrr['机械费'])
|
|
|
|
|
+ qd['材料费'] = String(rrr['材料费'])
|
|
|
|
|
+ qd['管理费'] = String(rrr['管理费'])
|
|
|
|
|
+ qd['综合人工工日'] = String(rrr['综合人工工日'])
|
|
|
|
|
+ qd['综合单价'] = String(rrr['综合单价'])
|
|
|
|
|
+ qd['设备费'] = String(rrr['设备费'])
|
|
|
|
|
+ qd['辅材费'] = String(rrr['辅材费'])
|
|
|
|
|
+ qd['_children'] = rrr['_children']
|
|
|
|
|
+ }
|
|
|
|
|
+ if (changed) {
|
|
|
|
|
+ this.push_op(copy(this.cache));
|
|
|
|
|
+
|
|
|
|
|
+ this.updateFootprint(datakey);
|
|
|
|
|
+
|
|
|
|
|
+ return [true, copy(this.cache), datakey];
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return [false, null, null];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
changguidinge(dingeclick, row) {
|
|
changguidinge(dingeclick, row) {
|
|
|
if (this.cache.filter(x=>x['key'] == row).length > 0) {
|
|
if (this.cache.filter(x=>x['key'] == row).length > 0) {
|
|
@@ -2285,6 +2599,35 @@ class Service{
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ handleYuban_djcs(row, selected) {
|
|
|
|
|
+ let qd = this.cache_djcs.filter(x=>x["_children"].filter(y=>y['key']==row).length > 0)[0];
|
|
|
|
|
+ if (!qd) return [null, null];
|
|
|
|
|
+ let de = qd["_children"].filter(x=>x['key'] == row)[0];
|
|
|
|
|
+ let bm = de['清单编码'];
|
|
|
|
|
+ let alreadyFuzhu = extractFuzhu(bm);//[xuhao]
|
|
|
|
|
+ if (de.hasOwnProperty("rcjdg")) {//底稿
|
|
|
|
|
+
|
|
|
|
|
+ } else {///老数据不能有底稿,附注功能也不使能,预拌也不能使
|
|
|
|
|
+ //de['rcjdg'] = copy(de['dercj']);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ de['yuban'] = copy(selected);
|
|
|
|
|
+ this.updateDercj_djcs_(row, de['dercj'], alreadyFuzhu, selected, 1);
|
|
|
|
|
+
|
|
|
|
|
+ let newData = this.cache_djcs.map(x=>{
|
|
|
|
|
+ if (x['key'] == qd['key']) {
|
|
|
|
|
+ return qd;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return x;
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ let summarized = this.summarize_djcs(newData);
|
|
|
|
|
+ this.push_op_djcs(summarized);
|
|
|
|
|
+ /////////////////
|
|
|
|
|
+ this.cache_djcs = copy(summarized);
|
|
|
|
|
+ return [copy(this.cache_djcs), copy(de['dercj'])];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
handleYuban(row, selected) {
|
|
handleYuban(row, selected) {
|
|
|
let qd = this.cache.filter(x=>x["_children"].filter(y=>y['key']==row).length > 0)[0];
|
|
let qd = this.cache.filter(x=>x["_children"].filter(y=>y['key']==row).length > 0)[0];
|
|
|
if (!qd) return [null, null];
|
|
if (!qd) return [null, null];
|
|
@@ -2363,6 +2706,95 @@ class Service{
|
|
|
return input;
|
|
return input;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ async pushTask(data, maxN, label, navigate) {
|
|
|
|
|
+ let data2 = copy(data);
|
|
|
|
|
+ data2['now'] = Date.now();
|
|
|
|
|
+ const response = await fetch(this.ip().concat( "/pushtask/"), {
|
|
|
|
|
+ method : "POST",
|
|
|
|
|
+ headers: {
|
|
|
|
|
+ "Content-type": "application/json",
|
|
|
|
|
+ 'Authorization': `Bearer ${this.token_}`
|
|
|
|
|
+
|
|
|
|
|
+ },
|
|
|
|
|
+ body: JSON.stringify({
|
|
|
|
|
+ "bianma": data['清单编码'],
|
|
|
|
|
+ "mc" : data['名称'],
|
|
|
|
|
+ "tz" : data['项目特征'],
|
|
|
|
|
+ "dw" : data['单位'] ,
|
|
|
|
|
+ "sl" : data['数量'],
|
|
|
|
|
+ "n" : maxN,
|
|
|
|
|
+ "label": label
|
|
|
|
|
+ } )
|
|
|
|
|
+ });
|
|
|
|
|
+ if (!response.ok) {
|
|
|
|
|
+ if (response.status == 401) {
|
|
|
|
|
+ navigate("/editor/signin");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+
|
|
|
|
|
+ const r = await response.json();
|
|
|
|
|
+ data2['celery_id']=r['id'];
|
|
|
|
|
+ this.task[data['清单编码']]=data2;
|
|
|
|
|
+ return r;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+clearTask() {
|
|
|
|
|
+ this.task={};
|
|
|
|
|
+
|
|
|
|
|
+}
|
|
|
|
|
+getTaskResult() {
|
|
|
|
|
+ return copy(this.task);
|
|
|
|
|
+}
|
|
|
|
|
+async checkTask() {
|
|
|
|
|
+ let keys = Object.keys(this.task);
|
|
|
|
|
+ if (keys.length == 0)return "empty";
|
|
|
|
|
+ for(let i = 0; i < keys.length; i++){
|
|
|
|
|
+ let entry = this.task[keys[i]];
|
|
|
|
|
+ if (entry.hasOwnProperty("result")) {
|
|
|
|
|
+ if (entry["result"]=='failed') return "failed";
|
|
|
|
|
+ else continue;
|
|
|
|
|
+ }else {
|
|
|
|
|
+ let now = entry['now'];
|
|
|
|
|
+ let current = Date.now();
|
|
|
|
|
+ if (current - now > 300000){
|
|
|
|
|
+ entry['result']="failed";
|
|
|
|
|
+ return "failed";
|
|
|
|
|
+ } else {
|
|
|
|
|
+ const response = await fetch(this.ip().concat( "/checktask/".concat(entry['celery_id'])), {
|
|
|
|
|
+ method : "GET",
|
|
|
|
|
+ headers : {
|
|
|
|
|
+ 'Authorization': `Bearer ${this.token_}`
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ });
|
|
|
|
|
+ if (!response.ok) {
|
|
|
|
|
+ console.error('error');
|
|
|
|
|
+ entry['result'] = "failed";
|
|
|
|
|
+ return "failed";
|
|
|
|
|
+ } else {
|
|
|
|
|
+ const data = await response.json();
|
|
|
|
|
+ console.log(data);
|
|
|
|
|
+ if (data['status']=='FAILURE') {
|
|
|
|
|
+ entry['result']='failed';
|
|
|
|
|
+ return 'failed';
|
|
|
|
|
+ } else if (data['status']=='SUCCESS') {
|
|
|
|
|
+ entry['result']=data['result'];
|
|
|
|
|
+ return "progress";
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return "progress";
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return "success";
|
|
|
|
|
+
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|