Xiaopeng Zhang 5 hónapja
szülő
commit
c2fcc84fa9
2 módosított fájl, 28 hozzáadás és 226 törlés
  1. 27 225
      src/Service.js
  2. 1 1
      src/Zjcs2.js

+ 27 - 225
src/Service.js

@@ -12,6 +12,8 @@ class Service{
         this.mem_pointer_djcs = -1;
         this.qufei = [];
         this.qufeiEntry = null;
+        this.peibishu = {};
+        this.dingeshu = {};
     }
     
     ip() {
@@ -132,24 +134,7 @@ class Service{
         this.mem_pointer = 0;
 
     }
-    async generateOutline(name) {
-        const response = await fetch(this.ip().concat( "/outline"), {
-            method : "POST",
-            headers: {
-                "Content-type": "application/json"
-            },
-            body : JSON.stringify({
-                "name": name
-            })
-        });
-        if (!response.ok) {
-            //const error = await response.json();
-            console.error('error');
-        } else {
-            const data = await response.json();
-            return data;
-        }
-    }
+   
 
     async uploadFile(fd) {
         const response = await fetch(this.ip().concat( "/upload/"), {
@@ -201,24 +186,7 @@ class Service{
             return data;
         }
     }
-    async generateDetail(name) {
-        const response = await fetch(this.ip().concat("/detail"), {
-            method : "POST",
-            headers: {
-                "Content-type": "application/json"
-            },
-            body : JSON.stringify({
-                "name": name
-            })
-        });
-        if (!response.ok) {
-            //const error = await response.json();
-            console.error('error');
-        } else {
-            const data = await response.json();
-            return data;
-        }
-    }
+
 
     async generateDetail2(name) {
         const response = await fetch(this.ip().concat("/detail2"), {
@@ -238,25 +206,7 @@ class Service{
             return data;
         }
     }
-    async generateBaojiahuizong(name, id) {
-        const response = await fetch(this.ip().concat(  "/baojiahuizong/"), {
-            method : "POST",
-            headers: {
-                "Content-type": "application/json"
-            }, 
-            body: JSON.stringify({
-                name: name,
-                id : id
-            })
-        });
-        if (!response.ok) {
-            //const error = await response.json();
-            console.error('error');
-        } else {
-            const data = await response.json();
-            return data;
-        }
-    }
+
     async generateBaojiahuizong2(name, id) {
         const response = await fetch(this.ip().concat(  "/baojiahuizong2/"), {
             method : "POST",
@@ -276,25 +226,7 @@ class Service{
             return data;
         }
     }
-    async generateGuifeishuijin(name, id) {
-        const response = await fetch(this.ip().concat( "/guifeishuijin/"), {
-            method : "POST",
-            headers: {
-                "Content-type": "application/json"
-            },
-            body: JSON.stringify({
-                name: name,
-                id: id
-            })
-        });
-        if (!response.ok) {
-            //const error = await response.json();
-            console.error('error');
-        } else {
-            const data = await response.json();
-            return data;
-        }
-    }
+
     async generateGuifeishuijin2(name, id) {
         const response = await fetch(this.ip().concat( "/guifeishuijin2/"), {
             method : "POST",
@@ -315,25 +247,7 @@ class Service{
         }
     }
 
-    async generateQitaxiangmu(name, id) {
-        const response = await fetch(this.ip().concat( "/qitaxiangmu/"), {
-            method : "POST",
-            headers: {
-                "Content-type": "application/json"
-            },
-            body: JSON.stringify({
-                name: name,
-                id : id
-            })
-        });
-        if (!response.ok) {
-            //const error = await response.json();
-            console.error('error');
-        } else {
-            const data = await response.json();
-            return data;
-        }
-    }
+
 
     async generateQitaxiangmu2(name, id) {
         const response = await fetch(this.ip().concat( "/qitaxiangmu2/"), {
@@ -376,25 +290,7 @@ class Service{
     }
 
 
-    async generateZongchengbaofuwufei(name, id) {
-        const response = await fetch(this.ip().concat( "/zongchengbaofuwufei/"), {
-            method : "POST",
-            headers: {
-                "Content-type": "application/json"
-            },
-            body: JSON.stringify({
-                name: name,
-                id: id
-            })
-        });
-        if (!response.ok) {
-            //const error = await response.json();
-            console.error('error');
-        } else {
-            const data = await response.json();
-            return data;
-        }
-    }
+
 
     async generateZongchengbaofuwufei2(name, id) {
         const response = await fetch(this.ip().concat( "/zongchengbaofuwufei2/"), {
@@ -415,25 +311,7 @@ class Service{
             return data;
         }
     }
-    async generateFabaorengongyingcailiao(name, id) {
-        const response = await fetch(this.ip().concat( "/fabaorengongyingcailiao/"), {
-            method : "POST",
-            headers: {
-                "Content-type": "application/json"
-            },
-            body: JSON.stringify({
-                name: name,
-                id : id
-            })
-        });
-        if (!response.ok) {
-            //const error = await response.json();
-            console.error('error');
-        } else {
-            const data = await response.json();
-            return data;
-        }
-    }
+
     async generateFabaorengongyingcailiao2(name, id) {
         const response = await fetch(this.ip().concat( "/fabaorengongyingcailiao2/"), {
             method : "POST",
@@ -454,25 +332,7 @@ class Service{
         }
     }
 
-    async generateRencaijihuizong(name, id) {
-        const response = await fetch(this.ip().concat( "/rencaijihuizong/"), {
-            method : "POST",
-            headers: {
-                "Content-type": "application/json"
-            },
-            body: JSON.stringify({
-                name: name,
-                id: id
-            })
-        });
-        if (!response.ok) {
-            //const error = await response.json();
-            console.error('error');
-        } else {
-            const data = await response.json();
-            return data;
-        }
-    }
+
 
     async generateRencaijihuizong2(name, id) {
         const response = await fetch(this.ip().concat( "/rencaijihuizong2/"), {
@@ -516,25 +376,7 @@ class Service{
             return result;
         }
     }
-    async generateJirigong(name, id) {
-        const response = await fetch(this.ip().concat("/jirigong/"), {
-            method : "POST",
-            headers: {
-                "Content-type": "application/json"
-            },
-            body: JSON.stringify({
-                name: name,
-                id: id
-            })
-        });
-        if (!response.ok) {
-            //const error = await response.json();
-            console.error('error');
-        } else {
-            const data = await response.json();
-            return data;
-        }
-    }
+
 
 
     async generateJirigong2(name, id) {
@@ -556,25 +398,7 @@ class Service{
             return data;
         }
     }
-    async generateZanliejine(name, id) {
-        const response = await fetch(this.ip().concat( "/zanliejine/"), {
-            method : "POST",
-            headers: {
-                "Content-type": "application/json"
-            },
-            body: JSON.stringify({
-                name: name,
-                id: id
-            })
-        });
-        if (!response.ok) {
-            //const error = await response.json();
-            console.error('error');
-        } else {
-            const data = await response.json();
-            return data;
-        }
-    }
+
 
     async generateZanliejine2(name, id) {
         const response = await fetch(this.ip().concat( "/zanliejine2/"), {
@@ -595,25 +419,7 @@ class Service{
             return data;
         }
     }
-    async generateQingdanxiangmu(name, id) {
-        const response = await fetch(this.ip().concat( "/qingdanxiangmu/"), {
-            method : "POST",
-            headers: {
-                "Content-type": "application/json"
-            },
-            body: JSON.stringify({
-                name: name,
-                id: id
-            })
-        });
-        if (!response.ok) {
-            //const error = await response.json();
-            console.error('error');
-        } else {
-            const data = await response.json();
-            return data;
-        }
-    }
+
     async generateQingdanxiangmu2(name, id) {
         const response = await fetch(this.ip().concat( "/qingdanxiangmu2/"), {
             method : "POST",
@@ -792,21 +598,7 @@ async generateQingdanTuijian(name, bh, bt, bm) {
             return copy(this.cache_djcs);
         }
     }
-    async generateFiles() {
-        const response = await fetch(this.ip().concat( "/files/"), {
-            method : "POST",
-            headers: {
-                "Content-type": "application/json"
-            }
-        });
-        if (!response.ok) {
-            //const error = await response.json();
-            console.error('error');
-        } else {
-            const data = await response.json();
-            return data;
-        }
-    }
+
 
     async generateFiles2() {
         const response = await fetch(this.ip().concat( "/files2/"), {
@@ -866,6 +658,9 @@ async generateQingdanTuijian(name, bh, bt, bm) {
         }
     }
     async generatePeibishu(zhuanye) {
+        if (this.peibishu.hasOwnProperty(zhuanye)) {
+            return this.peibishu[zhuanye];
+        }
         const response = await fetch(this.ip().concat( "/pbs/"), {
             method : "POST",
             headers: {
@@ -882,10 +677,14 @@ async generateQingdanTuijian(name, bh, bt, bm) {
             console.error('error');
         } else {
             const data = await response.json();
+            this.peibishu[zhuanye] = data;
             return data;
         }
     }
     async generateDingeshu(value) {
+        if (this.dingeshu.hasOwnProperty(value)) {
+            return this.dingeshu[value];
+        }
         const response = await fetch(this.ip().concat( "/des/"), {
             method : "POST",
             headers: {
@@ -902,6 +701,7 @@ async generateQingdanTuijian(name, bh, bt, bm) {
             console.error('error');
         } else {
             const data = await response.json();
+            this.dingeshu[value] = data;
             return data;
         }
     }
@@ -1124,7 +924,7 @@ async generateQingdanTuijian(name, bh, bt, bm) {
 
 
 
-    ///////////////////////////////////editor//////////////////////////////////
+    ///////////////////////////////////editor_code//////////////////////////////////
 
 
     summarize_one_djcs(qd) {///根据定额汇总清单
@@ -1269,7 +1069,7 @@ async generateQingdanTuijian(name, bh, bt, bm) {
                    qd["_children"][i]['合价'] = qd["_children"][i]['综合单价'] * Number(qd["_children"][i]['数量']) * Number(qd['数量']);
                    let dercj = qd["_children"][i]['dercj'];
                    for (let j = 1; j < dercj.length; j++) {
-                       dercj[j][11] = Number(qd['_children'][i]['综合单价']) * Number(dercj[j][10]) / Number(100);
+                       dercj[j][11] = Number(added) * Number(dercj[j][10]) / Number(100);
                    }
                 }
                 if (tag[0] == '人工费+机械费') {
@@ -1295,7 +1095,9 @@ async generateQingdanTuijian(name, bh, bt, bm) {
                    qd["_children"][i]['合价'] = qd["_children"][i]['综合单价'] * Number(qd["_children"][i]['数量']) * Number(qd["数量"]);
                    let dercj = qd["_children"][i]['dercj'];
                    for (let j = 1; j < dercj.length; j++) {
-                       dercj[j][11] = Number(qd['_children'][i]['综合单价']) * Number(dercj[j][10]) / Number(100);
+                       
+                       dercj[j][11] = Number(added) * Number(dercj[j][10]) / Number(100);
+                       
                    }
                 }
             }

+ 1 - 1
src/Zjcs2.js

@@ -214,7 +214,7 @@ export default function Zjcs2({name, bh, zjcsCallback}) {
         while(row.modules.dataTree.parent) {
           row = row.modules.dataTree.parent;
         }
-        if (row.data['名称'] == '现场安全文明施工') return false;
+        if (row.data['名称'].includes('安全文明施工')) return false;
     
         return true; // only allow the name cell to be edited if the age is over 18
     }