Zn 1 жил өмнө
parent
commit
19cb5666d2

+ 22 - 4
ruoyi-ui/src/views/relateTable/components/RelateTableCard.vue

@@ -150,6 +150,9 @@ export default {
       dtName: '',
       // 下拉框动态数据
       dynamicData: {},
+      row: null,
+      myContion:null,
+      preRow:{}
     };
   },
 
@@ -197,6 +200,7 @@ export default {
     // 请求数据
     async gettableListHandler(tableKey, paramsContion = [], defaultVal ={}){
       const res = await dragTableInfo({queryMap: {tableKey : tableKey }})
+      console.log(123456);
       this.getTableHandle(res, paramsContion = [],defaultVal = {})
     },
     async getTableHandle(res){
@@ -235,9 +239,14 @@ export default {
             if(this.newsort == 0){
               this.getDataHandler()
               // this.queryParams.queryMap.sqlkey = this.templateInfo.template.sqlKey;
+            }else{
+
+              if(this.myContion){
+                this.getDataHandler(this.myContion,this.preRow)
+              }
             }
             let k;
-            
+             
             // console.log('conditions', this.tableCondition);
            this.contion = this.templateInfo.template.dtTableName + '.' + this.templateInfo.template.primaryKey
             // this.tableCondition.forEach((item, i) => {
@@ -258,7 +267,9 @@ export default {
     // 获取表数据
     async getDataHandler(contion, list){
       // console.log(contion);
-      // console.log(list);
+      this.myContion=contion;
+      this.preRow=list;
+      console.log(list);
       if(contion){
         let key = contion.split('.')
         this.queryParams.queryMap['#{' + contion] = "'" + list[key[1]] + "'";
@@ -304,6 +315,7 @@ export default {
     },
     // 调用父组件方法更新表格数据
     handleCurrentChange(row,event,column,val) {
+      this.row = row
       // console.log(row);
       this.$emit(
         "updateData",
@@ -334,6 +346,9 @@ export default {
         });
       });
     },
+    getNextCardData(){
+      this.handleCurrentChange(this.row)
+    },
     // 使用提交数据类型的按钮获取数据
     tempSubBtn(getData) {
       getData()
@@ -388,10 +403,13 @@ export default {
               this.$modal.msgError("添加失败");
             }
           }
-          this.tableList = []
-          this.gettableListHandler(this.tableKey)
+          // this.tableList = []
+          this.$emit('getChildData', this.index)
+          // this.getDataHandler(this.contion, this.row)
+          // this.gettableListHandler(this.tableKey)
           this.defaultValue = {};
           this.open = false;
+
         })
         .catch((res) => {
           console.log(res)

+ 17 - 1
ruoyi-ui/src/views/relateTable/relateTableEdit.vue

@@ -11,6 +11,7 @@
             <TableCard
               :ref="'childComponent' + index"
               @updateData="updateDataList"
+              @getChildData="getChildData"
               :tableKey="cardData.tableKey"
               :sort="cardData.sort"
               :cardData="cardData"
@@ -163,7 +164,7 @@ export default {
       // let tableKey = this.tableLists[index+1].tableKey
       let beforeChild = this.$refs['childComponent'+index][0]
       index++
-      console.log(beforeChild);
+      // console.log(beforeChild);
       const chlid = this.$refs['childComponent'+index][0]
       // console.log(chlid);
       if(!chlid) return
@@ -172,6 +173,21 @@ export default {
       // console.log(contion,tableList);
       chlid.getDataHandler(beforeChild.contion,row)
     },
+    // 
+    getChildData(index) {
+      console.log(index);
+      let targetRef = 'childComponent'
+      if(index == 0){
+        targetRef += index
+      }else{
+        targetRef += (index - 1)
+      }
+      this.$nextTick(()=>{
+        console.log( this.$refs[targetRef][0]);
+
+        this.$refs[targetRef][0].getNextCardData()
+      })
+    }
   },
 };
 </script>