瀏覽代碼

prepare wechat login and split service

Xiaopeng Zhang 3 月之前
父節點
當前提交
d22463ea8d
共有 11 個文件被更改,包括 927 次插入628 次删除
  1. 2 1
      src/AI.js
  2. 41 40
      src/App2.js
  3. 87 0
      src/AuthService.js
  4. 2 1
      src/Djcs3.js
  5. 9 8
      src/Home2.js
  6. 3 2
      src/Qufei.js
  7. 0 574
      src/Service.js
  8. 99 0
      src/Signin.js
  9. 677 0
      src/SimpleService.js
  10. 3 2
      src/Zjcs2.js
  11. 4 0
      src/index.js

+ 2 - 1
src/AI.js

@@ -2,6 +2,7 @@ import * as React from 'react';
 
 import AIService from './AIService';
 import Service from './Service';
+import SimpleService from './SimpleService';
 import {useNavigate, useLocation} from "react-router";
 import ArrowRightIcon from '@rsuite/icons/ArrowRight';
 import ArrowDownIcon from '@rsuite/icons/ArrowDown';
@@ -361,7 +362,7 @@ export default function AI() {
 
   const handleDelete = () => {
     Service.deleteFiles(itemRef.current).then(x=> {
-      Service.generateFiles2().then(x=>{
+      SimpleService.generateFiles2().then(x=>{
         setDetail(x.map(y=>{return {'id': y[0], 'ID': y[0], '名称': y[1], '创建时间': y[2], '操作': y[0]};}));
       });
     });

+ 41 - 40
src/App2.js

@@ -24,6 +24,7 @@ import Bjhz from './Bjhz';
 import Zjcs2 from './Zjcs2';
 import Djcs3 from './Djcs3';
 import Service from './Service';
+import SimpleService from './SimpleService';
 import Qufei from './Qufei';
 import Rcjhz from './Rcjhz';
 import Qtxm from './Qtxm';
@@ -219,7 +220,7 @@ function a11yProps(index) {
     };
     const handleChangeZhuanye = (event) => {
            //console.log(event.target.value);
-           Service.generateDingeshu(event.target.value).then(x=>{
+           SimpleService.generateDingeshu(event.target.value).then(x=>{
                setOutlineDes_(x);
            });
            setZhuanye(event.target.value);
@@ -286,7 +287,7 @@ function a11yProps(index) {
 
     const qufeiCallback = (id, data) => {
       setOpen(true); 
-      Service.applyFL(id, data).then(x=>{
+      SimpleService.applyFL(id, data).then(x=>{
         Service.clearCache();
         Service.setQufei(data);
         setOpen(false);
@@ -320,7 +321,7 @@ function a11yProps(index) {
 
     const zjcsCallback = (biao_id,bh, row) => {
       setOpen(true); 
-      Service.updateZjcs(biao_id, bh, row).then(x=>{
+      SimpleService.updateZjcs(biao_id, bh, row).then(x=>{
         
         setOpen(false);
       });
@@ -450,7 +451,7 @@ function a11yProps(index) {
           return;
         }
 
-        Service.generateSingleDingeXilie2(zhuanye2, acinputvalue).then(x=>{
+        SimpleService.generateSingleDingeXilie2(zhuanye2, acinputvalue).then(x=>{
           let res = JSON.parse(x);
           let id = res['reverse'];
           if (id && id != "None") {
@@ -502,11 +503,11 @@ function a11yProps(index) {
                     console.log(res["clde"]);
                     setBeizhu(res["bz_selected"]);
                     setBeizhuFK(res["bz_selected2"]);
-                    Service.generateDingeshu(res["actual_zhuanye"]).then(x=>{
+                    SimpleService.generateDingeshu(res["actual_zhuanye"]).then(x=>{
                         setOutlineDes_(x);
                         setSelectedItems(id);
                         setExpandedItems(findparent(id));
-                           Service.generateDingeXilie(res["actual_zhuanye"], id).then(x=>{
+                           SimpleService.generateDingeXilie(res["actual_zhuanye"], id).then(x=>{
                                 let y = JSON.parse(x);
                                 //console.log(y);
                                 let result = [];
@@ -550,7 +551,7 @@ function a11yProps(index) {
           suggestion = 50;
         }  
         setZhuanye(suggestion);
-          Service.generateSingleDingeXilie(suggestion, debh, bt.concat(' ').concat(mc)).then(x=>{
+          SimpleService.generateSingleDingeXilie(suggestion, debh, bt.concat(' ').concat(mc)).then(x=>{
             handleGenerateSingleDingeXilie(x);
            });
        
@@ -560,23 +561,23 @@ function a11yProps(index) {
           suggestion = 60;
         }   
         setZhuanye(suggestion);
-         Service.generateSingleDingeXilie(suggestion, debh, bt.concat(' ').concat(mc)).then(x=>{
+         SimpleService.generateSingleDingeXilie(suggestion, debh, bt.concat(' ').concat(mc)).then(x=>{
           handleGenerateSingleDingeXilie(x);
        });
        } else if (qdbm.startsWith("04")) {////市政
          setZhuanye(20);
-         Service.generateSingleDingeXilie(20, debh, bt.concat(' ').concat(mc)).then(x=>{
+         SimpleService.generateSingleDingeXilie(20, debh, bt.concat(' ').concat(mc)).then(x=>{
           handleGenerateSingleDingeXilie(x);
        });
        }
        else if (qdbm.startsWith("05")) {//园林
         setZhuanye(40);
-        Service.generateSingleDingeXilie(40, debh, bt.concat(' ').concat(mc)).then(x=>{
+        SimpleService.generateSingleDingeXilie(40, debh, bt.concat(' ').concat(mc)).then(x=>{
           handleGenerateSingleDingeXilie(x);
       });
        } else {
          setZhuanye(10);
-        Service.generateSingleDingeXilie(10, debh, bt.concat(' ').concat(mc)).then(x=>{
+        SimpleService.generateSingleDingeXilie(10, debh, bt.concat(' ').concat(mc)).then(x=>{
           handleGenerateSingleDingeXilie(x);
       });
        }
@@ -626,7 +627,7 @@ function a11yProps(index) {
       
         console.log(itemId);
         if (["0", "3", "4", "6", "7", "8", "9", "11", "12", "13", "15", "16", "18", "19", "20", "21"].includes(itemId['id'])) {
-            Service.generatePeibiXilie(itemId['id'], zhuanye).then(x=>{
+            SimpleService.generatePeibiXilie(itemId['id'], zhuanye).then(x=>{
                 let y = JSON.parse(x);
                 console.log(y);
                
@@ -654,7 +655,7 @@ function a11yProps(index) {
       
       console.log(itemId);
       if (true) {
-          Service.generateJixieXilie(itemId['id'], zhuanye).then(x=>{
+          SimpleService.generateJixieXilie(itemId['id'], zhuanye).then(x=>{
               let y = JSON.parse(x);
               console.log(y);
              
@@ -683,7 +684,7 @@ function a11yProps(index) {
       
     console.log(itemId);
     if (true) {
-        Service.generateCailiaoXilie(itemId['id'], zhuanye).then(x=>{
+        SimpleService.generateCailiaoXilie(itemId['id'], zhuanye).then(x=>{
             let y = JSON.parse(x);
             console.log(y);
            
@@ -710,7 +711,7 @@ function a11yProps(index) {
 
     const handleDingEEvent = (row) => {
       
-      Service.generateSingleDingeXilie2(zhuanye, row.id).then(x=>{
+      SimpleService.generateSingleDingeXilie2(zhuanye, row.id).then(x=>{
        
         let res = JSON.parse(x);
         console.log(res);
@@ -725,7 +726,7 @@ function a11yProps(index) {
         //console.log(itemId);
         setSelectedItems(itemId);
         setExpandedItems(findparent(itemId));
-           Service.generateDingeXilie(zhuanye, itemId).then(x=>{
+           SimpleService.generateDingeXilie(zhuanye, itemId).then(x=>{
                 let y = JSON.parse(x);
                 //console.log(y);
                 let result = [];
@@ -756,7 +757,7 @@ function a11yProps(index) {
         if (itemId.includes("bao jia hui zong")) {
           let regex = /[0-9]*/; 
           let id = itemId.match(regex)[0];     
-          Service.generateBaojiahuizong2(location["id"], id).then(x=>{
+          SimpleService.generateBaojiahuizong2(location["id"], id).then(x=>{
                   setBjhzData(x);
                   setNest(true);
                   setQingdan(false);
@@ -778,7 +779,7 @@ function a11yProps(index) {
         else if (itemId.includes("gui fei shui jin")) {
           let regex = /[0-9]*/; 
           let id = itemId.match(regex)[0];     
-          Service.generateGuifeishuijin2(location["id"], id).then(x=>{
+          SimpleService.generateGuifeishuijin2(location["id"], id).then(x=>{
                   setGfsjData(x);
                   setNest(true);
                   setQingdan(false);
@@ -811,7 +812,7 @@ function a11yProps(index) {
               }
             }
           }    
-          Service.generateQingdanxiangmu2(location["id"], id).then(x=>{
+          SimpleService.generateQingdanxiangmu2(location["id"], id).then(x=>{
                   setValue("1");
                   setNest(false);
                   setQingdan(true);
@@ -861,7 +862,7 @@ function a11yProps(index) {
           
           setValue("1");
           //setColumnHeaders(["序号", "名称", "取费基数", "计算基础", "金额", "类别"]);
-          Service.generateQitaxiangmu2(location["id"], id).then(x=>{
+          SimpleService.generateQitaxiangmu2(location["id"], id).then(x=>{
                   //setNestDetail(x);
                   setQtxmData(x);
                   setNest(true);
@@ -886,7 +887,7 @@ function a11yProps(index) {
           let id = itemId.match(regex)[0];     
           setValue("1");
           //setColumnHeaders(["序号", "名称", "取费基数", "计算基础", "金额", "类别"]);
-          Service.generateZygczgj(location["id"], id).then(x=>{
+          SimpleService.generateZygczgj(location["id"], id).then(x=>{
                   setZygczgjData(x);
                   setNest(false);
                   setQingdan(false);
@@ -910,7 +911,7 @@ function a11yProps(index) {
           let id = itemId.match(regex)[0];     
           setValue("1");
           //setColumnHeaders(["序号", "名称", "取费基数", "计算基础", "金额", "类别"]);
-          Service.generateZanliejine2(location["id"], id).then(x=>{
+          SimpleService.generateZanliejine2(location["id"], id).then(x=>{
                   //setDetail(x);
                   setZljeData(x);
                   setNest(false);
@@ -935,7 +936,7 @@ function a11yProps(index) {
           let id = itemId.match(regex)[0];     
           setValue("1");
           //setColumnHeaders(["序号", "名称", "取费基数", "计算基础", "金额", "类别"]);
-          Service.generateJirigong2(location["id"], id).then(x=>{
+          SimpleService.generateJirigong2(location["id"], id).then(x=>{
                   setJrgData(x);
                   setNest(false);
                   setQingdan(false);
@@ -959,7 +960,7 @@ function a11yProps(index) {
           let id = itemId.match(regex)[0];     
           setValue("1");
           //setColumnHeaders(["序号", "名称", "取费基数", "计算基础", "金额", "类别"]);
-          Service.generateZongchengbaofuwufei2(location["id"], id).then(x=>{
+          SimpleService.generateZongchengbaofuwufei2(location["id"], id).then(x=>{
                   setZcbfwfData(x);
                   setNest(false);
                   setQingdan(false);
@@ -983,7 +984,7 @@ function a11yProps(index) {
           let id = itemId.match(regex)[0];     
           setValue("1");
           //setColumnHeaders(["序号", "名称", "取费基数", "计算基础", "金额", "类别"]);
-          Service.generateFabaorengongyingcailiao2(location["id"], id).then(x=>{
+          SimpleService.generateFabaorengongyingcailiao2(location["id"], id).then(x=>{
                   setFbrgyclData(x);
                   setNest(false);
                   setQingdan(false);
@@ -1030,7 +1031,7 @@ function a11yProps(index) {
 
         }
         else if (itemId.includes("TouBiaoXx")) {
-            Service.generateDetail2(location["id"]).then(x=>{
+            SimpleService.generateDetail2(location["id"]).then(x=>{
             setQingdan(false);
             setCuoshi(false);
             setTbxxData(x);
@@ -1054,15 +1055,15 @@ function a11yProps(index) {
     React.useEffect(
       () => {
         console.log(location);
-        Service.generateQufei(location["id"]).then(x=>{
+        SimpleService.generateQufei(location["id"]).then(x=>{
 
           Service.setQufei(x);
           });
-          Service.generateJiagongcai(location["id"]).then(x=>{
+          SimpleService.generateJiagongcai(location["id"]).then(x=>{
 
             Service.setJiagongcai(x);
             });
-        Service.generateOutline2(location["id"]).then(x=>{
+        SimpleService.generateOutline2(location["id"]).then(x=>{
           outlineRef.current = x;
           let y = x.map(z=>{
             z['key'] = z['id'];
@@ -1103,25 +1104,25 @@ function a11yProps(index) {
           });
         setOutline(y2);
         });
-        Service.generateDetail2(location['id']).then(x=>{
+        SimpleService.generateDetail2(location['id']).then(x=>{
 
         setTbxxData(x);
         setTbxx(true);
         });
-           Service.generateDingeshu(10).then(x=>{
+           SimpleService.generateDingeshu(10).then(x=>{
                setOutlineDes_(x);
            });
       }, [location]
     );
     React.useEffect(
       () => {
-        Service.generatePeibishu(zhuanye).then(x=>{
+        SimpleService.generatePeibishu(zhuanye).then(x=>{
             setPeibishu(x);
         });
-        Service.generateJixieshu(zhuanye).then(x=>{
+        SimpleService.generateJixieshu(zhuanye).then(x=>{
           setJixieshu(x);
       });
-      Service.generateCailiaoshu(zhuanye).then(x=>{
+      SimpleService.generateCailiaoshu(zhuanye).then(x=>{
         setCailiaoshu(x);
     });
       }, [zhuanye]
@@ -1136,22 +1137,22 @@ function a11yProps(index) {
 
     const throttled = React.useRef(throttle((zhuanye2, newValue) => {
       if (zhuanye2 == 10) {
-        Service.searchDe('土建', newValue).then(x=>{setOptions(x)});
+        SimpleService.searchDe('土建', newValue).then(x=>{setOptions(x)});
       }
       if (zhuanye2 == 20) {
-        Service.searchDe('市政', newValue).then(x=>{setOptions(x)});
+        SimpleService.searchDe('市政', newValue).then(x=>{setOptions(x)});
       }
       if (zhuanye2 == 30) {
-        Service.searchDe('安装', newValue).then(x=>{setOptions(x)});
+        SimpleService.searchDe('安装', newValue).then(x=>{setOptions(x)});
       }
       if (zhuanye2 == 40) {
-        Service.searchDe('园林', newValue).then(x=>{setOptions(x)});
+        SimpleService.searchDe('园林', newValue).then(x=>{setOptions(x)});
       }
       if (zhuanye2 == 50) {
-        Service.searchDe('修缮(土建)', newValue).then(x=>{setOptions(x)});
+        SimpleService.searchDe('修缮(土建)', newValue).then(x=>{setOptions(x)});
       }
       if (zhuanye2 == 60) {
-        Service.searchDe('修缮(安装)', newValue).then(x=>{setOptions(x)});
+        SimpleService.searchDe('修缮(安装)', newValue).then(x=>{setOptions(x)});
       }
 
       

+ 87 - 0
src/AuthService.js

@@ -0,0 +1,87 @@
+import {copy, danxiangdinge_index, danxiangdinge_index_djcs, renameDingE, extractFuzhu, match_target, azfy, xsazfy, tjazfy, addChildren} from './utils';
+import { v4 as uuidv4 } from 'uuid';
+class AuthService{
+    
+    constructor() {
+        this.footprint = [];
+        this.cache = [];
+        this.memory = [];
+        this.mem_pointer = -1;
+        this.cache_djcs = [];
+        this.memory_djcs = [];
+        this.mem_pointer_djcs = -1;
+        this.qufei = [];
+        this.qufeiEntry = null;
+        this.jiagongcai = [];
+        this.mapper={
+            '99090513' : ['汽车式起重机 50t', 2838.92],
+            '99090509' : ['汽车式起重机 25t', 1174.12],
+            '99090111': ['履带式起重机 提升质量50t', 1755.71],
+            '99090108': ['履带式起重机 提升质量25t', 904.68],
+            '99030306': ['静力压桩机 压力1200kN', 1508.23],
+            '99030124': ['轨道式柴油打桩机 冲击质量2.5t', 1143.91],
+            '99030106' : ['履带式柴油打桩机 冲击质量7t', 2545.82],
+            '10450518' : ['纯铝箔 140×140', 0.35],
+            '10450508' : ['纯银箔 93.3×93.3', 4.5],
+            '04050101' : ['道碴 40~80mm', 47],
+            '04034103' : ['石屑(米砂)', 40]
+        };
+        
+    }
+    
+    ip() {
+        //return "/api"//return "http://127.0.0.1:8000"
+        return "http://127.0.0.1:1313/api"
+    }
+
+    clearCache() {//set qufei will clear cache
+        this.cache = [];
+        this.footprint= [];
+        this.memory = [];
+        this.mem_pointer = -1;
+        this.cache_djcs = [];
+        this.memory_djcs = [];
+        this.mem_pointer_djcs = -1;
+    }
+
+   
+
+
+    async token(query) {
+        const response = await fetch(this.ip().concat( "/token/"), {
+            method : "POST",
+            headers: {
+                "Content-type": "application/json"
+            },
+            body: JSON.stringify(
+                {
+                    "name": query,
+                    
+                    
+                }
+            )
+        });
+        if (!response.ok) {
+            //const error = await response.json();
+            console.error('error');
+        } else {
+            const data = await response.json();
+            return data;
+        }
+    }
+
+    
+
+
+
+
+    
+}
+
+
+
+
+
+
+
+export default new AuthService();

+ 2 - 1
src/Djcs3.js

@@ -13,6 +13,7 @@ import TabList from "@mui/lab/TabList";
 import TabPanel from "@mui/lab/TabPanel";
 import Stack from "@mui/material/Stack";
 import Service from './Service';
+import SimpleService from './SimpleService';
 import {TabulatorFull as Tabulator} from "tabulator-tables"; //import Tabulator library
 import './Tabulator.css';
 import {extractFuzhu, match_target} from './utils';
@@ -164,7 +165,7 @@ export default function Djcs3({name, bh, rgde, jxde, clde, beizhu, beizhuFK, cli
                     isQdrcj.current=true;
                     highlight.current = [];
                });
-               Service.generateQingdanTuijian(name, bh,bt,row._row.data['清单编码']).then(x=>{
+               SimpleService.generateQingdanTuijian(name, bh,bt,row._row.data['清单编码']).then(x=>{
                     setTuijian(x);
                     if (tuijianTable.current) tuijianTable.current.replaceData(x);
                });

+ 9 - 8
src/Home2.js

@@ -1,6 +1,7 @@
 import * as React from 'react';
 
 import Service from './Service';
+import SimpleService from './SimpleService';
 import {useNavigate, useLocation} from "react-router";
 //registerAllModules();
 import { DataGrid, GridActionsCellItem, zhCN} from '@mui/x-data-grid';
@@ -45,8 +46,8 @@ export default function Home2() {
       itemRef.current = id;
       /*
       console.log(id);
-      Service.deleteFiles(id).then(x=> {
-        Service.generateFiles2().then(x=>{
+      SimpleService.deleteFiles(id).then(x=> {
+        SimpleService.generateFiles2().then(x=>{
           setDetail(x.map(y=>{return {'id': y[0], 'ID': y[0], '名称': y[1], '创建时间': y[2], '操作': y[0]};}));
         });
       });*/
@@ -87,7 +88,7 @@ export default function Home2() {
             console.log(value);
             event.stopPropagation();
             setBopen(true);
-            Service.download(value)
+            SimpleService.download(value)
                 .then(blob => {
                 // Create a temporary URL for the Blob
                 const url = URL.createObjectURL(blob);
@@ -160,9 +161,9 @@ export default function Home2() {
          console.log(event.target.files);
          const fd = new FormData();
          fd.append('file', event.target.files[0]);
-         Service.uploadFile(fd).then(x=>{
+         SimpleService.uploadFile(fd).then(x=>{
             console.log("uploaded");
-            Service.generateFiles2().then(x=>{
+            SimpleService.generateFiles2().then(x=>{
               setDetail(x.map(y=>{return {'id': y[0], 'ID': y[0], '名称': y[1], '创建时间': y[2], '操作': y[0]};}));
             });
 
@@ -173,7 +174,7 @@ export default function Home2() {
 
     React.useEffect(
       () => {
-         Service.generateFiles2().then(x=>{
+         SimpleService.generateFiles2().then(x=>{
            setDetail(x.map(y=>{return {'id': y[0], 'ID': y[0], '名称': y[1], '创建时间': y[2], '操作': y[0]};}));
          });
       }, []
@@ -255,8 +256,8 @@ export default function Home2() {
 
 
   const handleDelete = () => {
-    Service.deleteFiles(itemRef.current).then(x=> {
-      Service.generateFiles2().then(x=>{
+    SimpleService.deleteFiles(itemRef.current).then(x=> {
+      SimpleService.generateFiles2().then(x=>{
         setDetail(x.map(y=>{return {'id': y[0], 'ID': y[0], '名称': y[1], '创建时间': y[2], '操作': y[0]};}));
       });
     });

+ 3 - 2
src/Qufei.js

@@ -2,6 +2,7 @@ import * as React from 'react';
 import Box from "@mui/material/Box";
 
 import Service from './Service';
+import SimpleService from './SimpleService';
 
 import Button from '@mui/material/Button';
 import {TabulatorFull as Tabulator} from "tabulator-tables"; //import Tabulator library
@@ -594,7 +595,7 @@ React.useEffect(
 
 
   myTable.current.on("tableBuilt", () => {
-    Service.generateQufei(id).then(x=>{
+    SimpleService.generateQufei(id).then(x=>{
 
       console.log(x);
       let y = x.map(z=>{
@@ -654,4 +655,4 @@ React.useEffect(
 
 
     );
-}
+}

+ 0 - 574
src/Service.js

@@ -153,201 +153,9 @@ class Service{
     }
    
 
-    async uploadFile(fd) {
-        const response = await fetch(this.ip().concat( "/upload/"), {
-            method : "POST",
-            body : fd
-        });
-        if (!response.ok) {
-            //const error = await response.json();
-            console.error('error');
-        } else {
-            const data = await response.json();
-            return data;
-        }
-    }
-
-    async generateQufei(name) {
-        const response = await fetch(this.ip().concat("/qufei/"), {
-            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 generateOutline2(name) {
-        const response = await fetch(this.ip().concat( "/outline2"), {
-            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"), {
-            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 generateBaojiahuizong2(name, id) {
-        const response = await fetch(this.ip().concat(  "/baojiahuizong2/"), {
-            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",
-            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/"), {
-            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 generateZygczgj(name, id) {
-        const response = await fetch(this.ip().concat( "/zygczgj/"), {
-            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/"), {
-            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",
-            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;
-        }
-    }
 
 
 
@@ -396,86 +204,8 @@ class Service{
 
 
 
-    async generateJirigong2(name, id) {
-        const response = await fetch(this.ip().concat("/jirigong2/"), {
-            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/"), {
-            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",
-            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 searchDe(zhuanye, text) {
-        const response = await fetch(this.ip().concat( "/searchde/"), {
-            method : "POST",
-            headers: {
-                "Content-type": "application/json"
-            },
-            body: JSON.stringify({
-                zhuanye: zhuanye,
-                text: text
-            })
-        });
-        if (!response.ok) {
-            //const error = await response.json();
-            console.error('error');
-        } else {
-            const data = await response.json();
-            return data;
-        }
-    }
 
    
 
@@ -569,41 +299,6 @@ class Service{
 
 /////////////////////////////end of qingdan////////////////////////////////////
 
-async generateQingdanTuijian(name, bh, bt, bm) {
-    const response = await fetch(this.ip().concat( "/qingdantuijian/".concat(bm)), {
-        method : "GET",
-       
-       
-    });
-    if (!response.ok) {
-        //const error = await response.json();
-        console.error('error');
-    } else {
-        const data = await response.json();
-        return data;
-    }
-}
-    async generateZjcs(name, bh) {
-        const response = await fetch(this.ip().concat( "/zjcs/"), {
-            method : "POST",
-            headers: {
-                "Content-type": "application/json"
-            },
-            body: JSON.stringify(
-                {
-                    "bh": bh,
-                    "name": name
-                }
-            )
-        });
-        if (!response.ok) {
-            //const error = await response.json();
-            console.error('error');
-        } else {
-            const data = await response.json();
-            return data;
-        }
-    }
     async generateDjcs(name, bh) {
         if (this.cache_djcs.length == 0 || this.cache_djcs[0]["biao_id"] != name || this.cache_djcs[0]["Dwgcbh"] != bh) {
         const response = await fetch(this.ip().concat( "/djcs/"), {
@@ -633,181 +328,6 @@ async generateQingdanTuijian(name, bh, bt, bm) {
     }
 
 
-    async generateFiles2() {
-        const response = await fetch(this.ip().concat( "/files2/"), {
-            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 deleteFiles(id) {
-        const response = await fetch(this.ip().concat( "/deleteFile/"), {
-            method : "POST",
-            headers: {
-                "Content-type": "application/json"
-            },
-            body: JSON.stringify(
-                {
-                    "name": id,
-                    
-                }
-            )
-        });
-        if (!response.ok) {
-            //const error = await response.json();
-            console.error('error');
-        } else {
-            const data = await response.json();
-            return data;
-        }
-    }
-
-    async generatePeibiXilie(id, zhuanye) {
-        const response = await fetch(this.ip().concat( "/pbxl/").concat(id).concat('/').concat(zhuanye.toString()), {
-            method : "GET",
-           
-        });
-        if (!response.ok) {
-            //const error = await response.json();
-            console.error('error');
-        } else {
-            const data = await response.json();
-            return data;
-        }
-    }
-    async generateJixieXilie(id, zhuanye) {
-        const response = await fetch(this.ip().concat( "/jxxl/").concat(id).concat('/').concat(zhuanye.toString()), {
-            method : "GET",
-           
-        });
-        if (!response.ok) {
-            //const error = await response.json();
-            console.error('error');
-        } else {
-            const data = await response.json();
-            return data;
-        }
-    }
-    async generateCailiaoXilie(id, zhuanye) {
-        const response = await fetch(this.ip().concat( "/clxl/").concat(id).concat('/').concat(zhuanye.toString()), {
-            method : "GET",
-           
-        });
-        if (!response.ok) {
-            //const error = await response.json();
-            console.error('error');
-        } else {
-            const data = await response.json();
-            return data;
-        }
-    }
-    async generatePeibishu(zhuanye) {
-        
-        const response = await fetch(this.ip().concat( "/pbs/").concat(zhuanye.toString()), {
-            method : "GET",
-            
-        });
-        if (!response.ok) {
-            //const error = await response.json();
-            console.error('error');
-        } else {
-            const data = await response.json();
-            
-            return data;
-        }
-    }
-    async generateJixieshu(zhuanye) {
-        
-        const response = await fetch(this.ip().concat( "/jxs/").concat(zhuanye.toString()), {
-            method : "GET",
-            
-        });
-        if (!response.ok) {
-            //const error = await response.json();
-            console.error('error');
-        } else {
-            const data = await response.json();
-            
-            return data;
-        }
-    }
-    async generateCailiaoshu(zhuanye) {
-        
-        const response = await fetch(this.ip().concat( "/cls/").concat(zhuanye.toString()), {
-            method : "GET",
-            
-        });
-        if (!response.ok) {
-            //const error = await response.json();
-            console.error('error');
-        } else {
-            const data = await response.json();
-            
-            return data;
-        }
-    }
-    async generateDingeshu(value) {
-        
-        const response = await fetch(this.ip().concat( "/des/").concat(value.toString()), {
-            method : "GET",
-            
-        });
-        if (!response.ok) {
-            //const error = await response.json();
-            console.error('error');
-        } else {
-            const data = await response.json();
-            
-            return data;
-        }
-    }
-    async generateDingeXilie(value, id) {//定额书的一个栏目的所有具体定额
-        const response = await fetch(this.ip().concat("/dexilie/").concat(value.toString()).concat("/").concat(id), {
-            method : "GET",
-            
-        });
-        if (!response.ok) {
-            //const error = await response.json();
-            console.error('error');
-        } else {
-            const data = await response.json();
-            return data;
-        }
-    }
-    async generateSingleDingeXilie(zhuanye, debh, mc) {//清单页面展示用
-        const response = await fetch(this.ip().concat( "/singledexilie/").concat(zhuanye.toString()).concat("/").concat(debh).concat("/").concat(encodeURIComponent(mc.replace(/\//g, ''))), {
-            method : "GET",
-           
-        });
-        if (!response.ok) {
-            //const error = await response.json();
-            console.error('error');
-        } else {
-            const data = await response.json();
-            return data;
-        }
-    }
-    async generateSingleDingeXilie2(zhuanye, debh) {//清单页面展示用
-        const response = await fetch(this.ip().concat( "/singledexilie2/").concat(zhuanye.toString()).concat("/").concat(debh.replace(/\//g, '')), {
-            method : "GET",
-           
-        });
-        if (!response.ok) {
-            //const error = await response.json();
-            console.error('error');
-        } else {
-            const data = await response.json();
-            return data;
-        }
-    }
 
 
     async save() {
@@ -832,27 +352,6 @@ async generateQingdanTuijian(name, bh, bt, bm) {
             return data;
         }
     }
-    async generateJiagongcai(name) {
-        const response = await fetch(this.ip().concat( "/jiagongcai/"), {
-            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 save_djcs() {
         const response = await fetch(this.ip().concat( "/savedjcs/"), {
@@ -876,39 +375,7 @@ async generateQingdanTuijian(name, bh, bt, bm) {
         }
     }
 
-    async applyFL(id, data) {
-        const response = await fetch(this.ip().concat( "/applyFL/"), {
-            method : "POST",
-            headers: {
-                "Content-type": "application/json"
-            },
-            body: JSON.stringify(
-                {
-                    "id": id,
-                    "name": JSON.stringify(data)
-                }
-            )
-        });
-        if (!response.ok) {
-            //const error = await response.json();
-            console.error('error');
-        } else {
-            const data = await response.json();
-            return data;
-        }
-    }
-
-    async download(id) {
-        const response = await fetch(this.ip().concat( "/download/").concat(id.toString()));
 
-        if (!response.ok) {
-            //const error = await response.json();
-            console.error('error');
-        } else {
-            const data = await response.blob();
-            return data;
-        }
-    }
 
     async tiaojia(biao_id, bh, bm, mingcheng, danwei, jiage) {
         let glf = "";
@@ -953,48 +420,7 @@ async generateQingdanTuijian(name, bh, bt, bm) {
     }
 
 
-    async updateZjcs(biao_id, bh, row) {
-      
-        const response = await fetch(this.ip().concat( "/updatezjcs/"), {
-            method : "POST",
-            headers: {
-                "Content-type": "application/json"
-            },
-            body: JSON.stringify(
-                {
-                    "biao_id": biao_id,
-                    "bh": bh,
-                    'mc': row['名称'].toString(),
-                    'fl': row['费率'].toString()
-                    
-                }
-            )
-        });
-        if (!response.ok) {
-            //const error = await response.json();
-            console.error('error');
-        } else {
-            const data = await response.json();
-           
-            return data;
-        }
-    }
 
-    async cankao() { //参考费率
-       
-        const response = await fetch(this.ip().concat( "/cankao/"), {
-            method : "GET",
-            
-        });
-        if (!response.ok) {
-            //const error = await response.json();
-            console.error('error');
-        } else {
-            const data = await response.json();
-            
-            return data;
-        }
-    }
 
 
 

+ 99 - 0
src/Signin.js

@@ -0,0 +1,99 @@
+import * as React from 'react';
+import Avatar from '@mui/material/Avatar';
+import Button from '@mui/material/Button';
+import CssBaseline from '@mui/material/CssBaseline';
+import TextField from '@mui/material/TextField';
+import FormControlLabel from '@mui/material/FormControlLabel';
+import Checkbox from '@mui/material/Checkbox';
+import Link from '@mui/material/Link';
+import Grid from '@mui/material/Grid';
+import Box from '@mui/material/Box';
+import LockOutlinedIcon from '@mui/icons-material/LockOutlined';
+import Typography from '@mui/material/Typography';
+import Container from '@mui/material/Container';
+import { createTheme, ThemeProvider } from '@mui/material/styles';
+import {useSearchParams} from 'react-router-dom';
+import AuthService from './AuthService';
+function Copyright(props) {
+  return (
+    <Typography variant="body2" color="text.secondary" align="center" {...props}>
+      {'Copyright © '}
+      <Link color="inherit" href="http://www.xiaozaotongxue.com/">
+        懂小造
+      </Link>{' '}
+      {new Date().getFullYear()}
+      {'.'}
+    </Typography>
+  );
+}
+
+const theme = createTheme();
+
+
+export default function SignIn() {
+  let [searchParams] = useSearchParams();
+  let code = searchParams.get("code");
+  const handleSubmit = (event) => {
+    event.preventDefault();
+    const data = new FormData(event.currentTarget);
+    console.log({
+      email: data.get('email'),
+      password: data.get('password'),
+    });
+  };
+  React.useEffect(() => {
+    if (code == null) {
+      const script = document.createElement('script');
+      script.src = 'http://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js';
+      script.async = true;
+      script.onload = () => {
+      console.log('Script loaded and executed.');
+      let obj = window.WxLogin({
+         self_redirect:false,
+         id:"login_container", 
+         appid: "wx74b45ac9983e4b3e", 
+         scope: "snsapi_login", 
+         redirect_uri: encodeURIComponent("http://www.xiaozaotongxue.com/editor/signin"),
+         state: "",
+         style: "",
+         href : "",
+         onReady: function(isReady){
+                console.log(isReady);
+            }
+         });
+      };
+      document.body.appendChild(script);
+    } else {
+       console.log(code);
+       AuthService.token(code).then(x=>{
+          console.log(x);
+       });
+    }
+    }, []);
+
+  return (
+    <ThemeProvider theme={theme}>
+      <Container component="main" maxWidth="xs">
+        <CssBaseline />
+        <Box
+          sx={{
+            marginTop: 8,
+            display: 'flex',
+            flexDirection: 'column',
+            alignItems: 'center',
+          }}
+        >
+          <Avatar sx={{ m: 1, bgcolor: 'secondary.main' }}>
+            <LockOutlinedIcon />
+          </Avatar>
+          <Typography component="h1" variant="h5">
+            微信扫码登录
+          </Typography>
+          <div id="login_container">
+        </div>
+        </Box>
+        <Copyright sx={{ mt: 8, mb: 4 }} />
+      </Container>
+    </ThemeProvider>
+  );
+}

+ 677 - 0
src/SimpleService.js

@@ -0,0 +1,677 @@
+import {copy, danxiangdinge_index, danxiangdinge_index_djcs, renameDingE, extractFuzhu, match_target, azfy, xsazfy, tjazfy, addChildren} from './utils';
+import { v4 as uuidv4 } from 'uuid';
+class SimpleService{
+    
+    constructor() {
+        this.footprint = [];
+        this.cache = [];
+        this.memory = [];
+        this.mem_pointer = -1;
+        this.cache_djcs = [];
+        this.memory_djcs = [];
+        this.mem_pointer_djcs = -1;
+        this.qufei = [];
+        this.qufeiEntry = null;
+        this.jiagongcai = [];
+        this.mapper={
+            '99090513' : ['汽车式起重机 50t', 2838.92],
+            '99090509' : ['汽车式起重机 25t', 1174.12],
+            '99090111': ['履带式起重机 提升质量50t', 1755.71],
+            '99090108': ['履带式起重机 提升质量25t', 904.68],
+            '99030306': ['静力压桩机 压力1200kN', 1508.23],
+            '99030124': ['轨道式柴油打桩机 冲击质量2.5t', 1143.91],
+            '99030106' : ['履带式柴油打桩机 冲击质量7t', 2545.82],
+            '10450518' : ['纯铝箔 140×140', 0.35],
+            '10450508' : ['纯银箔 93.3×93.3', 4.5],
+            '04050101' : ['道碴 40~80mm', 47],
+            '04034103' : ['石屑(米砂)', 40]
+        };
+        
+    }
+    
+    ip() {
+        //return "/api"//return "http://127.0.0.1:8000"
+        return "http://127.0.0.1:1313/api"
+    }
+
+    clearCache() {//set qufei will clear cache
+        this.cache = [];
+        this.footprint= [];
+        this.memory = [];
+        this.mem_pointer = -1;
+        this.cache_djcs = [];
+        this.memory_djcs = [];
+        this.mem_pointer_djcs = -1;
+    }
+
+
+
+
+
+
+
+   
+
+    async uploadFile(fd) {
+        const response = await fetch(this.ip().concat( "/upload/"), {
+            method : "POST",
+            body : fd
+        });
+        if (!response.ok) {
+            //const error = await response.json();
+            console.error('error');
+        } else {
+            const data = await response.json();
+            return data;
+        }
+    }
+
+    async generateQufei(name) {
+        const response = await fetch(this.ip().concat("/qufei/"), {
+            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 generateOutline2(name) {
+        const response = await fetch(this.ip().concat( "/outline2"), {
+            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"), {
+            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 generateBaojiahuizong2(name, id) {
+        const response = await fetch(this.ip().concat(  "/baojiahuizong2/"), {
+            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",
+            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/"), {
+            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 generateZygczgj(name, id) {
+        const response = await fetch(this.ip().concat( "/zygczgj/"), {
+            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/"), {
+            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",
+            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) {
+        const response = await fetch(this.ip().concat("/jirigong2/"), {
+            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/"), {
+            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",
+            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 searchDe(zhuanye, text) {
+        const response = await fetch(this.ip().concat( "/searchde/"), {
+            method : "POST",
+            headers: {
+                "Content-type": "application/json"
+            },
+            body: JSON.stringify({
+                zhuanye: zhuanye,
+                text: text
+            })
+        });
+        if (!response.ok) {
+            //const error = await response.json();
+            console.error('error');
+        } else {
+            const data = await response.json();
+            return data;
+        }
+    }
+
+   
+
+
+    /////////////////////////////////////qingdan//////////////////////////////////////
+
+
+
+
+
+/////////////////////////////end of qingdan////////////////////////////////////
+
+async generateQingdanTuijian(name, bh, bt, bm) {
+    const response = await fetch(this.ip().concat( "/qingdantuijian/".concat(bm)), {
+        method : "GET",
+       
+       
+    });
+    if (!response.ok) {
+        //const error = await response.json();
+        console.error('error');
+    } else {
+        const data = await response.json();
+        return data;
+    }
+}
+    async generateZjcs(name, bh) {
+        const response = await fetch(this.ip().concat( "/zjcs/"), {
+            method : "POST",
+            headers: {
+                "Content-type": "application/json"
+            },
+            body: JSON.stringify(
+                {
+                    "bh": bh,
+                    "name": name
+                }
+            )
+        });
+        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/"), {
+            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 deleteFiles(id) {
+        const response = await fetch(this.ip().concat( "/deleteFile/"), {
+            method : "POST",
+            headers: {
+                "Content-type": "application/json"
+            },
+            body: JSON.stringify(
+                {
+                    "name": id,
+                    
+                }
+            )
+        });
+        if (!response.ok) {
+            //const error = await response.json();
+            console.error('error');
+        } else {
+            const data = await response.json();
+            return data;
+        }
+    }
+
+    async generatePeibiXilie(id, zhuanye) {
+        const response = await fetch(this.ip().concat( "/pbxl/").concat(id).concat('/').concat(zhuanye.toString()), {
+            method : "GET",
+           
+        });
+        if (!response.ok) {
+            //const error = await response.json();
+            console.error('error');
+        } else {
+            const data = await response.json();
+            return data;
+        }
+    }
+    async generateJixieXilie(id, zhuanye) {
+        const response = await fetch(this.ip().concat( "/jxxl/").concat(id).concat('/').concat(zhuanye.toString()), {
+            method : "GET",
+           
+        });
+        if (!response.ok) {
+            //const error = await response.json();
+            console.error('error');
+        } else {
+            const data = await response.json();
+            return data;
+        }
+    }
+    async generateCailiaoXilie(id, zhuanye) {
+        const response = await fetch(this.ip().concat( "/clxl/").concat(id).concat('/').concat(zhuanye.toString()), {
+            method : "GET",
+           
+        });
+        if (!response.ok) {
+            //const error = await response.json();
+            console.error('error');
+        } else {
+            const data = await response.json();
+            return data;
+        }
+    }
+    async generatePeibishu(zhuanye) {
+        
+        const response = await fetch(this.ip().concat( "/pbs/").concat(zhuanye.toString()), {
+            method : "GET",
+            
+        });
+        if (!response.ok) {
+            //const error = await response.json();
+            console.error('error');
+        } else {
+            const data = await response.json();
+            
+            return data;
+        }
+    }
+    async generateJixieshu(zhuanye) {
+        
+        const response = await fetch(this.ip().concat( "/jxs/").concat(zhuanye.toString()), {
+            method : "GET",
+            
+        });
+        if (!response.ok) {
+            //const error = await response.json();
+            console.error('error');
+        } else {
+            const data = await response.json();
+            
+            return data;
+        }
+    }
+    async generateCailiaoshu(zhuanye) {
+        
+        const response = await fetch(this.ip().concat( "/cls/").concat(zhuanye.toString()), {
+            method : "GET",
+            
+        });
+        if (!response.ok) {
+            //const error = await response.json();
+            console.error('error');
+        } else {
+            const data = await response.json();
+            
+            return data;
+        }
+    }
+    async generateDingeshu(value) {
+        
+        const response = await fetch(this.ip().concat( "/des/").concat(value.toString()), {
+            method : "GET",
+            
+        });
+        if (!response.ok) {
+            //const error = await response.json();
+            console.error('error');
+        } else {
+            const data = await response.json();
+            
+            return data;
+        }
+    }
+    async generateDingeXilie(value, id) {//定额书的一个栏目的所有具体定额
+        const response = await fetch(this.ip().concat("/dexilie/").concat(value.toString()).concat("/").concat(id), {
+            method : "GET",
+            
+        });
+        if (!response.ok) {
+            //const error = await response.json();
+            console.error('error');
+        } else {
+            const data = await response.json();
+            return data;
+        }
+    }
+    async generateSingleDingeXilie(zhuanye, debh, mc) {//清单页面展示用
+        const response = await fetch(this.ip().concat( "/singledexilie/").concat(zhuanye.toString()).concat("/").concat(debh).concat("/").concat(encodeURIComponent(mc.replace(/\//g, ''))), {
+            method : "GET",
+           
+        });
+        if (!response.ok) {
+            //const error = await response.json();
+            console.error('error');
+        } else {
+            const data = await response.json();
+            return data;
+        }
+    }
+    async generateSingleDingeXilie2(zhuanye, debh) {//清单页面展示用
+        const response = await fetch(this.ip().concat( "/singledexilie2/").concat(zhuanye.toString()).concat("/").concat(debh.replace(/\//g, '')), {
+            method : "GET",
+           
+        });
+        if (!response.ok) {
+            //const error = await response.json();
+            console.error('error');
+        } else {
+            const data = await response.json();
+            return data;
+        }
+    }
+
+
+    async generateJiagongcai(name) {
+        const response = await fetch(this.ip().concat( "/jiagongcai/"), {
+            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 applyFL(id, data) {
+        const response = await fetch(this.ip().concat( "/applyFL/"), {
+            method : "POST",
+            headers: {
+                "Content-type": "application/json"
+            },
+            body: JSON.stringify(
+                {
+                    "id": id,
+                    "name": JSON.stringify(data)
+                }
+            )
+        });
+        if (!response.ok) {
+            //const error = await response.json();
+            console.error('error');
+        } else {
+            const data = await response.json();
+            return data;
+        }
+    }
+
+    async download(id) {
+        const response = await fetch(this.ip().concat( "/download/").concat(id.toString()));
+
+        if (!response.ok) {
+            //const error = await response.json();
+            console.error('error');
+        } else {
+            const data = await response.blob();
+            return data;
+        }
+    }
+
+
+
+    async updateZjcs(biao_id, bh, row) {
+      
+        const response = await fetch(this.ip().concat( "/updatezjcs/"), {
+            method : "POST",
+            headers: {
+                "Content-type": "application/json"
+            },
+            body: JSON.stringify(
+                {
+                    "biao_id": biao_id,
+                    "bh": bh,
+                    'mc': row['名称'].toString(),
+                    'fl': row['费率'].toString()
+                    
+                }
+            )
+        });
+        if (!response.ok) {
+            //const error = await response.json();
+            console.error('error');
+        } else {
+            const data = await response.json();
+           
+            return data;
+        }
+    }
+
+    async cankao() { //参考费率
+       
+        const response = await fetch(this.ip().concat( "/cankao/"), {
+            method : "GET",
+            
+        });
+        if (!response.ok) {
+            //const error = await response.json();
+            console.error('error');
+        } else {
+            const data = await response.json();
+            
+            return data;
+        }
+    }
+
+
+
+
+
+    
+}
+
+
+
+
+
+
+
+export default new SimpleService();

+ 3 - 2
src/Zjcs2.js

@@ -15,6 +15,7 @@ import TabList from "@mui/lab/TabList";
 import TabPanel from "@mui/lab/TabPanel";
 import Stack from "@mui/material/Stack";
 import Service from './Service';
+import SimpleService from './SimpleService';
 import {TabulatorFull as Tabulator} from "tabulator-tables"; //import Tabulator library
 import './Tabulator.css';
 
@@ -89,7 +90,7 @@ export default function Zjcs2({name, bh, zjcsCallback}) {
         
 
 
-          Service.generateZjcs(name, bh).then(x=>{
+          SimpleService.generateZjcs(name, bh).then(x=>{
             let addedkey = x.map(y=>{
               y['key'] = uuidv4();
               if (y.hasOwnProperty('_children')) {
@@ -129,7 +130,7 @@ export default function Zjcs2({name, bh, zjcsCallback}) {
 
                ]
         }); 
-          Service.cankao().then(x=>{
+          SimpleService.cankao().then(x=>{
             allRef.current = x;
             filterData(value);
             

+ 4 - 0
src/index.js

@@ -6,6 +6,7 @@ import {createBrowserRouter, RouterProvider, Route, Link} from "react-router-dom
 const Home2 = React.lazy(() => import('./Home2'));
 const App2 = React.lazy(() => import('./App2'));
 const AI = React.lazy(() => import('./AI'));
+const Signin = React.lazy(() => import('./Signin'));
 
 const router = createBrowserRouter([
    {path: "/editor/qingdan/:id",
@@ -17,6 +18,9 @@ const router = createBrowserRouter([
    {path: "/editor/ai",
    element: (<Suspense fallback={<div></div>}><AI></AI></Suspense>)
    },
+   {path: "/editor/signin",
+   element: (<Suspense fallback={<div></div>}><Signin></Signin></Suspense>)
+   },
 
 ]);
 const root = ReactDOM.render(<RouterProvider router={router}/>, document.getElementById('root'));