From 97b766c054d69660d6abf0b949c37eb13ed5df30 Mon Sep 17 00:00:00 2001
From: "chscls@163.com" <chscls@163.com>
Date: Tue, 7 Apr 2020 12:47:16 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 one_stop_public/tableCompon/index.jsx | 70 +++++++++++++++++++--------
 1 file changed, 50 insertions(+), 20 deletions(-)

diff --git a/one_stop_public/tableCompon/index.jsx b/one_stop_public/tableCompon/index.jsx
index 093888a..a6f2d43 100644
--- a/one_stop_public/tableCompon/index.jsx
+++ b/one_stop_public/tableCompon/index.jsx
@@ -479,8 +479,15 @@ export default class tableCom extends Component {
       return
     }
 
-    var dataColumn
-    if (this.props.fatherCode != null) {
+    const bindObj=this.getColumn('c1');
+
+   let dataColumn = this.props.fatherCode != null ? (bindObj?{...bindObj,base52: `${this.props.fatherCode}.[${this.props.index}].${bindObj.base52}`}:
+
+    { base52: `${this.props.fatherCode}.[${this.props.index}].${this.props.uuid}` })
+
+    : bindObj;
+    if (this.props.fatherCode == null&&dataColumn == null)   dataColumn = { base52: this.props.uuid }
+/*     if (this.props.fatherCode != null) {
       dataColumn = { base52: `${this.props.fatherCode}.[${this.props.index}].${this.props.uuid}` }
     } else {
       dataColumn = { base52: this.props.uuid }
@@ -494,9 +501,17 @@ export default class tableCom extends Component {
           }
         }
       }
-    }
-
-    var base52 = dataColumn.base52
+    } */
+    if (!this.props.isEdit&&this.props.fatherCode) {
+  
+      if(bindObj!=null){
+        dataColumn.base52 = bindObj.base52
+      }else{
+        dataColumn.base52 = this.props.uuid
+      }
+    
+  }
+    
     if (this.dataFilter.includes(json.comName) || json.comName == "TableSelect") {
       const obj2 = { ...obj, ...props.form.getFieldsValue(), ...props.defaultValues[this.props.formKey] }
       this.getData(json, dataColumn, obj2)
@@ -659,9 +674,10 @@ export default class tableCom extends Component {
           }
           break;
         case "func":
-
+          
           if (json.funcs != null && json.funcs != "") {
             let enu;
+            
             try {
               this.getFunctionValue(json.funcs, { base52: this.props.uuid }, json,()=>{
                 if (init != null && Object.keys(init).length > 0) {
@@ -687,11 +703,10 @@ export default class tableCom extends Component {
               
                   this.setState({labels:labs})
                }else if (!this.props.isEdit && Object.keys(obj).length > 0) {
+               
                  let base52 = dataColumn.base52
-                 if (this.props.fatherCode) {
-                   const x = base52.split(".")
-                   base52 = x[x.length - 1]
-                 }
+                 
+                
                  const vlu=obj[base52]
                 
                  const labs=[]
@@ -1098,7 +1113,7 @@ export default class tableCom extends Component {
        return
      } */
     const base52 = column.base52
-
+  
     try {
       var fun1 = new Function("obj","init", "defaultValues", "env", "index", "fatherCode", "utils", fun);
       const obj = { ...this.props.obj, ...this.props.form.getFieldsValue(), ...this.props.defaultValues[this.props.formKey] }
@@ -1180,8 +1195,16 @@ export default class tableCom extends Component {
         }
       })
     }
-    var dataColumn
-    if (this.props.fatherCode != null) {
+  
+    const bindObj=this.getColumn('c1');
+
+    let dataColumn = this.props.fatherCode != null ? (bindObj?{...bindObj,base52: `${this.props.fatherCode}.[${this.props.index}].${bindObj.base52}`}:
+ 
+     { base52: `${this.props.fatherCode}.[${this.props.index}].${this.props.uuid}` })
+ 
+     : bindObj;
+     if (this.props.fatherCode == null&&dataColumn == null)   dataColumn = { base52: this.props.uuid }
+  /*   if (this.props.fatherCode != null) {
       dataColumn = { base52: `${this.props.fatherCode}.[${this.props.index}].${this.props.uuid}` }
     } else {
       dataColumn = { base52: this.props.uuid }
@@ -1195,10 +1218,17 @@ export default class tableCom extends Component {
           }
         }
       }
+    } */
+    if (!this.props.isEdit&&this.props.fatherCode) {
+  
+        if(bindObj!=null){
+          dataColumn.base52 = bindObj.base52
+        }else{
+          dataColumn.base52 = this.props.uuid
+        }
+      
     }
-
-
-
+ 
     this.getData(json, dataColumn, obj)
     if (json.formula != null && json.formula != "") {
       this.getFunctionValue(json.formula, dataColumn, json)
@@ -1237,7 +1267,7 @@ export default class tableCom extends Component {
       });
 
     } else if (!this.props.isEdit && Object.keys(obj).length > 0) {
-
+     
       let base52 = dataColumn.base52
       if (this.props.fatherCode) {
         const x = base52.split(".")
@@ -1373,7 +1403,7 @@ export default class tableCom extends Component {
       columnIds[key] == null ||
       mapData == null
     ) {
-      return <></>;
+      return null;
     }
 
     const dataColumn = mapData[columnIds[key][columnIds[key].length - 1]];
@@ -1653,7 +1683,7 @@ export default class tableCom extends Component {
     var required = false;
     const bindObj=this.getColumn('c1');
 
-    var dataColumn = this.props.fatherCode != null ? (bindObj?{...bindObj,base52: `${this.props.fatherCode}.[${this.props.index}].${bindObj.base52}`}:
+    let dataColumn = this.props.fatherCode != null ? (bindObj?{...bindObj,base52: `${this.props.fatherCode}.[${this.props.index}].${bindObj.base52}`}:
 
     { base52: `${this.props.fatherCode}.[${this.props.index}].${this.props.uuid}` })
 
@@ -1677,7 +1707,7 @@ export default class tableCom extends Component {
     var initValue;
     if (init != null) {
       if (this.props.fatherCode != null) {
-        initValue = init[this.props.index] != null ? init[this.props.index][this.props.uuid] : null;
+        initValue = init[this.props.index] != null ? init[this.props.index][bindObj?bindObj.base52:this.props.uuid] : null;
 
       } else {
         initValue = init[dataColumn.base52];
-- 
2.17.1