Prechádzať zdrojové kódy

更改日期时 关联的其他插值单元格不更新

Karsa 10 mesiacov pred
rodič
commit
18efe0acb2

+ 37 - 32
src/views/datasheet_manage/components/MixedTable.vue

@@ -563,44 +563,49 @@ export default {
 
       //去处理每一组关联的情况
       haveRelationArr.forEach( async(relation) => {
-        const { relation_date,relation_edb } = relation;
+        const { relation_date,relation_edb,type } = relation;
   
         if((relation_date.key === key && cell.DataType === 1) || (relation_edb.key === key && cell.DataType === 2)) { //单元格类型不变只变值仍有关联关系 更新值
-  
-          //刷新插入值结果
-          let params = null;
-          if(relation_date.key === key && cell.DataType === 1) { //修改的是依赖日期格
-            let { EdbInfoId } = findCellByKey(this.config.data,relation.key)
-            params = {
-              EdbInfoId,
-              Date: cell.ShowValue
+
+          //类型4的表格插值才调接口刷数据 之后关联的有其他类型插值 区分一下
+          if(type === 4) {
+
+            //刷新插入值结果
+            let params = null;
+            if(relation_date.key === key && cell.DataType === 1) { //修改的是依赖日期格
+              let { EdbInfoId } = findCellByKey(this.config.data,relation.key)
+              params = {
+                EdbInfoId,
+                Date: cell.ShowValue
+              }
+    
+            } else if( relation_edb.key === key && cell.DataType === 2) { //修改的依赖指标格
+              let {ShowValue} = findCellByKey(this.config.data,relation_date.key)
+              params = {
+                EdbInfoId: cell.EdbInfoId,
+                Date: ShowValue
+              }
             }
+    
+            const res = await sheetInterface.insertData(params)
+            if(res.Ret !==200) return
   
-          } else if( relation_edb.key === key && cell.DataType === 2) { //修改的依赖指标格
-            let {ShowValue} = findCellByKey(this.config.data,relation_date.key)
-            params = {
-              EdbInfoId: cell.EdbInfoId,
-              Date: ShowValue
-            }
+            //现在日期无值也不清除关系了
+            // !res.Data && this.updateInsertCell(relation.key);
+            
+            this.config.data.forEach(row => {
+              row.forEach(cell => {
+                if(cell.Uid === relation.key) {
+                    cell.DataType = relation.type;
+                    cell.ShowValue = res.Data;
+                    cell.Value = res.Data;
+                    cell.EdbInfoId = params.EdbInfoId;
+                    cell.DataTime = params.Date;
+                }
+              })
+            })
           }
   
-          const res = await sheetInterface.insertData(params)
-          if(res.Ret !==200) return
-
-          //现在日期无值也不清除关系了
-          // !res.Data && this.updateInsertCell(relation.key);
-          
-          this.config.data.forEach(row => {
-            row.forEach(cell => {
-              if(cell.Uid === relation.key) {
-                  cell.DataType = relation.type;
-                  cell.ShowValue = res.Data;
-                  cell.Value = res.Data;
-                  cell.EdbInfoId = params.EdbInfoId;
-                  cell.DataTime = params.Date;
-              }
-            })
-          })
   
         }else {
           // 清除插入值单元格式和关联关系