Przeglądaj źródła

add fuzhuEnable in data structure, need add 附注底稿

Xiaopeng Zhang 6 miesięcy temu
rodzic
commit
3bdc759060
5 zmienionych plików z 40 dodań i 12 usunięć
  1. 7 6
      front/src/Qingdan.js
  2. 5 3
      front/src/Service.js
  3. 25 2
      front/src/editor.js
  4. 1 0
      subdir/db.py
  5. 2 1
      test.py

+ 7 - 6
front/src/Qingdan.js

@@ -155,6 +155,7 @@ export default function Qingdan({name, bh, bt, rgde, jxde, clde, beizhu, beizhuF
     const [rcjhl2, setRcjhl2] = React.useState([]);
     const [fuzhu, setFuzhu] = React.useState([]);
     const [tuijian, setTuijian] = React.useState([]);
+    const [fuzhuEnable, setFuzhuEnable] = React.useState(false);
     const highlight = React.useRef([]);
     const selectedRow = React.useRef(-1);
     const hotRef = React.useRef(null);
@@ -417,12 +418,13 @@ export default function Qingdan({name, bh, bt, rgde, jxde, clde, beizhu, beizhuF
                              clickCallback(qdbm, debm);
                              Service.generateDingercj(name, bh,bt,qdbm, debm, danwei).then(x=>{
                                console.log(x);
-                               setRcjhl(x);
+                               setRcjhl(x[0]);
+                               setFuzhuEnable(x[1]);
                                //hotRcjRef.current?.hotInstance?.loadData(x);
                                isQdrcj.current = false;
                                let toHighlight = [];
-                               for(let i = 1; i < x.length; i++) {
-                                   let entry = x[i];
+                               for(let i = 1; i < x[0].length; i++) {
+                                   let entry = x[0][i];
                                    let bianhao = entry[1];
                                    let rcjlb = entry[8];
                                    let hit = false;
@@ -709,12 +711,11 @@ export default function Qingdan({name, bh, bt, rgde, jxde, clde, beizhu, beizhuF
                              }
                          rows={fuzhu}
                          hideFooter={true}
-                         checkboxSelection
+                         checkboxSelection={fuzhuEnable}
                          rowSelectionModel={rowSelectionModel}
-                         isRowSelectable={(params) => false}
                          onRowSelectionModelChange={(newRowSelectionModel) => {
                               setRowSelectionModel(newRowSelectionModel);
-                              handleBeizhu(beizhuFKRef.current, selectedRowKeys[0]);
+                              handleBeizhu(beizhuFKRef.current, selectedRowKeys[0], newRowSelectionModel.ids, fuzhu);
                             }}
                            />
 

+ 5 - 3
front/src/Service.js

@@ -565,7 +565,7 @@ class Service{
         }
         let qd = this.cache.filter(x=>x["清单编码"] == qdbm)[0];
         let de = qd["children"].filter(x=>x["清单编码"]==debm)[0];
-        return copy(de["dercj"]);
+        return [copy(de["dercj"]), de["fuzhuEnable"]];
         
         
           
@@ -1101,7 +1101,8 @@ async generateQingdanTuijian(name, bh, bt, bm) {
                     '综合人工工日': null,
                     '备注': null,
                     "dercj": dercj,
-                    'key' :   newKey
+                    'key' :   newKey,
+                    "fuzhuEnable": true
     
                     
                 });
@@ -1152,7 +1153,8 @@ async generateQingdanTuijian(name, bh, bt, bm) {
                 "供应厂商", "人材机类别", "甲供标志", "含量", "合价", "暂估价标志", "主要材料标志", "主材标志", "设备标志" ],
                    ['', bh, '', '', danwei, '', '', '', '2', '', '1', '', '',  '', '', '' ]
                       ],
-                'key' :   uuidv4()
+                'key' :   uuidv4(),
+                "fuzhuEnable": false
 
                 
             });

+ 25 - 2
front/src/editor.js

@@ -53,8 +53,31 @@ export const changguidinge = (dingeclick, selectedRow) => {
 
 };
 
-export const handleBeizhu = (beizhuFK, ) => {
-    
+export const handleBeizhu = (beizhuFK, derow, fuzhuSelect, fuzhu ) => {
+    console.log(beizhuFK);
+    let bianma = [];
+    let fuzhuSelect_ = Array.from(fuzhuSelect);
+    let keys = beizhuFK['BZBH'];
+    for(let j = 0; j < fuzhuSelect_.length; j++) {
+        let entry = fuzhuSelect_[j];
+        for(let i = 0; i < fuzhu.length; i++) {
+            if (fuzhu[i]['id'] == entry) {
+                bianma.push(fuzhu[i]['编号']);
+            }
+        }
+    }
+    let result = [];
+    for(let i = 0; i < bianma.length; i++) {
+        let bh = bianma[i];
+        for(let j = 0; j < Object.keys(keys).length; j++) {
+            let BZBH_ = Object.keys(keys)[j];
+            let BZBH = keys[BZBH_];
+            if (BZBH == bh) {
+                result.push([beizhuFK['BH'][BZBH_], beizhuFK['MC'][BZBH_], beizhuFK['LB'][BZBH_], beizhuFK['SL'][BZBH_], beizhuFK['DW'][BZBH_]]);
+            }
+        }
+    }
+    console.log(result);
 };
 
 

+ 1 - 0
subdir/db.py

@@ -397,6 +397,7 @@ async def resolve(manager, websocket, data, client):
                     for child in children:
                         dercj = getDingercj_(root, entry["bh"], bt, qd["清单编码"], child["清单编码"])
                         child["dercj"] = dercj
+                        child['fuzhuEnable'] = False
                 await collection.insert_one(qd)
             
 

+ 2 - 1
test.py

@@ -396,6 +396,7 @@ async def resolve(data):
                     for child in children:
                         dercj = getDingercj_(root, entry["bh"], bt, qd["清单编码"], child["清单编码"])
                         child["dercj"] = dercj
+                        child['fuzhuEnable'] = False
                 await collection.insert_one(qd)
 import os
 ttt = []
@@ -404,7 +405,7 @@ for root, dirs, files in os.walk("/Users/xiaopengzhang/Downloads/qingdan/data",
         ##print(os.path.join(root, name))
         file_data = os.path.join(root, name)
         ttt.append(file_data)
-asyncio.run(resolve(ttt[0]))
+asyncio.run(resolve(ttt[2]))