Ver Fonte

根据操作列的按钮来处理是否渲染操作列

lph há 1 ano atrás
pai
commit
9162f1231c
1 ficheiros alterados com 29 adições e 3 exclusões
  1. 29 3
      zkqy-ui/src/views/tablelist/commonTable/listInfo.vue

+ 29 - 3
zkqy-ui/src/views/tablelist/commonTable/listInfo.vue

@@ -433,6 +433,8 @@ export default {
       subTableName: "",
       // 当前点击行的数据
       currentRow: {},
+      // 操作列是否显示隐藏
+      isShowExcuteCol: false,
     };
   },
 
@@ -442,11 +444,31 @@ export default {
   },
   watch: {},
   computed: {
-    isShowExcuteCol() {
-      return !this.excuteBtnArr?.every((arr) => arr.children.length == 0);
-    },
+    // isShowExcuteCol() {
+    //   let res = false;
+    //   if (!this.excuteBtnArr || !this.excuteBtnArr.length) {
+    //     res = false;
+    //   } else {
+    //     res = !this.excuteBtnArr?.every((arr) => arr.children.length == 0);
+    //   }
+    //   this.$nextTick(() => {
+    //     console.log(res);
+    //     this.$refs.tableRef.doLayout();
+    //   });
+    //   return res;
+    // },
   },
   methods: {
+    // 计算操作列的显示与隐藏
+    calcuteExcuteCol() {
+      if (!this.excuteBtnArr || !this.excuteBtnArr.length) {
+        this.isShowExcuteCol = false;
+      } else {
+        this.isShowExcuteCol = !this.excuteBtnArr?.every(
+          (arr) => arr.children.length == 0
+        );
+      }
+    },
     // 获取row-key
     getRowKey(row) {
       return row[
@@ -471,6 +493,10 @@ export default {
           });
           // 获取操作列的按钮数据
           this.excuteBtnArr = res.data.resultMap.button;
+          this.calcuteExcuteCol();
+          this.$nextTick(() => {
+            this.$refs.tableRef.doLayout();
+          });
           this.queryParams.orderByColumn =
             res.data.resultMap.querySql.orderByColumn;
           this.sortOrder = JSON.parse(res.data.resultMap.querySql.sortOrder);