Xiaopeng Zhang 5 mesi fa
parent
commit
569fe1380a
4 ha cambiato i file con 64 aggiunte e 8 eliminazioni
  1. 3 2
      src/App2.js
  2. 1 1
      src/Bjhz.js
  3. 40 1
      src/Rcjhz.js
  4. 20 4
      src/Service.js

+ 3 - 2
src/App2.js

@@ -74,7 +74,7 @@ import Tooltip from '@mui/material/Tooltip';
 
   export default function App2() {
 
-
+    const [updatetime, setUpdatetime] = React.useState(null);//tiaojia callback
     const [outline, setOutline] = React.useState([]);
     const [peibishu, setPeibishu] = React.useState([]);
     const [outlineDes, setOutlineDes] = React.useState([]);
@@ -239,7 +239,7 @@ import Tooltip from '@mui/material/Tooltip';
     const tiaojiaCallback = (bh, bm, mingcheng, danwei, jiage) => {
       setOpen(true); 
       Service.tiaojia(location['id'], bh, bm, mingcheng, danwei, jiage).then(x=>{
-        
+        setUpdatetime(x);
         setOpen(false);
       });
     };
@@ -1012,6 +1012,7 @@ import Tooltip from '@mui/material/Tooltip';
               id={location['id']} 
               bh={qdbh}
               tiaojiaCallback={tiaojiaCallback}
+              updatetime={updatetime}
               /></Box>}
 
                {!nest && !qingdan && !cuoshi && !qufei && !rcjhz && !gfsj && !bjhz && !tbxx && !qtxm && zlje && !zygczgj && !jrg && !zcbfwf && !fbrgycl && <Zlje 

+ 1 - 1
src/Bjhz.js

@@ -25,7 +25,7 @@ export default function Bjhz({data}) {
              return true; //expand rows where the "driver" data field is true;
          },
          columns: [ //Define Table Columns 序号", "名称", "取费基数", "计算基础","费率", "金额", "类别
-                      {title:"序号", field:"序号", width:80, headerSort:false,}, //never hide this column
+                      {title:"序号", field:"序号", width:120, headerSort:false,}, //never hide this column
                       {title:"名称", field:"名称", width:150, headerSort:false, formatter:"textarea"}, //hide this column first
                       {title:"金额", field:"金额", width:100,   formatter:"money", },
                       {title:"暂估价", field:"暂估价", width:100,   formatter:"textarea"},

+ 40 - 1
src/Rcjhz.js

@@ -1,13 +1,14 @@
 import * as React from 'react';
 
 import Service from './Service';
+import { v4 as uuidv4 } from 'uuid';
 
 
 import {copy} from './utils';
 import {TabulatorFull as Tabulator} from "tabulator-tables"; //import Tabulator library
 import "tabulator-tables/dist/css/tabulator.min.css"; //import Tabulator stylesheet
 import './Tabulator.css';
-export default function Rcjhz({id, bh, tiaojiaCallback}) {
+export default function Rcjhz({id, bh, tiaojiaCallback, updatetime}) {
   const myTable = React.useRef(null);
   const myRef = React.useRef(null);
   const [detail, setDetail] = React.useState([]);
@@ -22,6 +23,15 @@ export default function Rcjhz({id, bh, tiaojiaCallback}) {
     if (cell._cell.row.getData()['编码'].includes('000FE')) {//安装费用
          return false;
     }
+    if (cell._cell.row.getData()['编码'].includes('00EXP001')) {//回程费用
+      return false;
+    }
+    if (cell._cell.row.getData()['编码'].includes('99EXP007')) {//回程费用
+       return false;
+    }
+    if (cell._cell.row.getData()['编码'].includes('31130104')) {//回程费用
+      return false;
+   }
 
     return true;
   }
@@ -31,6 +41,35 @@ export default function Rcjhz({id, bh, tiaojiaCallback}) {
   }
 
 
+  React.useEffect(() => {
+    if (myTable.current != null) {
+      let result = [];
+            for (let i = 1; i < updatetime.length; i++) {
+                result.push({
+                    'key': uuidv4(),
+                    'ID' : updatetime[i][0],
+                    '编码' : updatetime[i][1],
+                    '名称': updatetime[i][2],
+                    '规格型号' : updatetime[i][3],
+                    '单位' : updatetime[i][4],
+                    '数量' : updatetime[i][5],
+                    '单价' : updatetime[i][6],
+                    '合价' : updatetime[i][7],
+                    '产地' : updatetime[i][8],
+                    '供应厂商' : updatetime[i][9],
+                    '人材机类别' : updatetime[i][10],
+                    '主要材料标志' : updatetime[i][11],
+                    '主材标志' : updatetime[i][12],
+                    '设备标志' : updatetime[i][13],
+                    '甲供标志' : updatetime[i][14],
+                    '暂估价标志' : updatetime[i][15]
+                });
+            }
+      myTable.current.replaceData(result);
+    }
+    
+  }, [updatetime]);
+
 
   React.useEffect(() => {
     myTable.current = new Tabulator(myRef.current, {

+ 20 - 4
src/Service.js

@@ -1129,12 +1129,25 @@ async generateQingdanTuijian(name, bh, bt, bm) {
 
     summarize_one_djcs(qd) {///根据定额汇总清单
         let dict = {};
+        let left = [];
         for(let i = 0; i < qd["_children"].length; i++) {
             let de = qd["_children"][i];
             let desl = Number(de['数量']);
             let dercj = de['dercj'];
             for (let j = 1; j < dercj.length; j++) {
                 let hl = copy(dercj[j]);
+                if (hl[1] == '00EXP001' && hl[4] == '%') {
+                    left.push(hl);
+                    continue;
+                }
+                if (hl[1] == '99EXP007' && hl[4] == '%') {
+                    left.push(hl);
+                    continue;
+                }
+                if (hl[1] == '31130104' && hl[4] == '%') {
+                    left.push(hl);
+                    continue;
+                }
                 hl[10] = desl * Number(hl[10]);
                 hl[11] = desl * Number(hl[11]);
                 let a = hl[1];//"人材机编码", 
@@ -1163,6 +1176,9 @@ async generateQingdanTuijian(name, bh, bt, bm) {
              result.push(entry);
 
         }
+        for (let i = 0; i < left.length; i++) {
+            result.push(left[i]);
+        }
         let gongri = 0;
         for(let i = 0; i < result.length; i++) {
             if (result[i][4] == '工日') {
@@ -1314,7 +1330,7 @@ async generateQingdanTuijian(name, bh, bt, bm) {
             let dercj = de['dercj'];
             for (let j = 1; j < dercj.length; j++) {
                 let hl = copy(dercj[j]);
-                if (hl[1].includes('000FE')) {
+                if (hl[1].includes('000FE') && hl[4] == '%') {
                     left.push(hl);
                     continue;
                 }
@@ -1643,15 +1659,15 @@ async generateQingdanTuijian(name, bh, bt, bm) {
         console.log("sum=".concat(sum));
         //处理百分比费用
         for(let i = 1; i < data.length; i++) {
-            if (data[i][1]=='00EXP001'){//回程费占人工费
+            if (data[i][1]=='00EXP001' && data[i][4] == '%'){//回程费占人工费
                 data[i][11] = Number(data[i][10]) * rgf_sum / Number(100);
                 
             }
-            if (data[i][1]=='99EXP007'){//回程费占机械费
+            if (data[i][1]=='99EXP007' && data[i][4] == '%'){//回程费占机械费
                 data[i][11] = Number(data[i][10]) * jxf_sum / Number(100);
                 
             }
-            if (data[i][1]=='31130104'){//回程费占材料费
+            if (data[i][1]=='31130104' && data[i][4] == '%'){//回程费占材料费
                 data[i][11] = Number(data[i][10]) * clf_sum / Number(100);
                 
             }