Răsfoiți Sursa

联动表格修改问题处理

lph 1 an în urmă
părinte
comite
d429310ce4
1 a modificat fișierele cu 10 adăugiri și 7 ștergeri
  1. 10 7
      zkqy-ui/src/views/relateTable/index.vue

+ 10 - 7
zkqy-ui/src/views/relateTable/index.vue

@@ -212,7 +212,7 @@
                           size="mini"
                           type="text"
                           icon="el-icon-edit"
-                          @click="relateOne(scope.row)"
+                          @click="relateOne(scope.row, scope.$index)"
                           >修改
                         </el-button>
                       </el-dropdown-item>
@@ -545,6 +545,7 @@ export default {
   dicts: ["sys_time_format", "table_statistic_type"],
   data() {
     return {
+      editIndex: 0,
       isInputInvalid: false,
 
       // 包含查询依赖字段dialog
@@ -787,7 +788,7 @@ export default {
       } else {
         if (this.tableDataList.length !== 0) {
           this.relyFileds.tableName =
-            this.tableDataList[this.tableDataList.length - 1].dtTableName;
+            this.tableDataList[this.editIndex - 1]?.dtTableName;
         }
         this.conditionDefault[this.isSearchIndex] =
           "#{" +
@@ -1124,6 +1125,7 @@ export default {
             this.tableDataList.forEach((item, index) => {
               if (item.tId == this.tableItemForm.tId) {
                 item.conditionDefaultValueMap = this.conditionDefault;
+                console.log(this.conditionDefault);
                 item.echoData = JSON.stringify(echoData);
                 item.sortOrder = this.tableItemForm.isAsc;
                 item.orderByColumn = this.tableItemForm.orderByColumn;
@@ -1150,7 +1152,8 @@ export default {
       });
     },
     // 修改一个表格数据
-    relateOne(row) {
+    relateOne(row, index) {
+      this.editIndex = index;
       console.log(row);
       // console.log(this.orderByFieldList)
       if (row.tableKey) {
@@ -1173,10 +1176,10 @@ export default {
         });
         this.tableFieldList = echoData.tableFieldData;
         this.tableItemForm.tId = row.tId;
-        (this.tableItemForm.rowId = row.tableKey),
-          (this.tableItemForm.isAsc = false),
-          (this.tableItemForm.orderByColumn = row.orderByColumn),
-          (this.tableItemForm.title = row.dtName);
+        this.tableItemForm.rowId = row.tableKey;
+        this.tableItemForm.isAsc = false;
+        this.tableItemForm.orderByColumn = row.orderByColumn;
+        this.tableItemForm.title = row.dtName;
         this.tableItemForm.tableName = row.dtTableName;
         this.tableItemForm.selectFields = row.primaryKey;
         this.tableItemForm.timeFormate = row.timeFormat;