Răsfoiți Sursa

feat: 添加行类名逻辑以处理子行缩进样式

xieyong 4 zile în urmă
părinte
comite
82b3ebe727
1 a modificat fișierele cu 12 adăugiri și 1 ștergeri
  1. 12 1
      src/views/financialManage/invoiceManage/index.vue

+ 12 - 1
src/views/financialManage/invoiceManage/index.vue

@@ -14,6 +14,7 @@
         :page-size="20"
         row-key="id"
         :tree-props="{ children: 'childrenList', hasChildren: 'hasChildren' }"
+        :row-class-name="getRowClassName"
         @columns-change="handleColumnChange"
         :cache-key="cacheKeyUrl"
       >
@@ -227,7 +228,6 @@
             label: '发票编码',
             slot: 'code',
             align: 'center',
-            showOverflowTooltip: true
           },
           {
             minWidth: 120,
@@ -380,6 +380,10 @@
     },
     created() {},
     methods: {
+      // 子行加 is-sub-row 类名,用于去掉 el-table__indent 缩进
+      getRowClassName({ row }) {
+        return row._level > 0 ? 'is-sub-row' : '';
+      },
       //新增、修改
       handleAddOrEdit(row = {}, type) {
         this.addOrEditDialogFlag = true;
@@ -530,8 +534,14 @@
     }
   }
 
+  /* 子行不需要 el-table__indent 缩进(已经有 sub-order-tag 标识身份) */
+  :deep(.is-sub-row .el-table__indent) {
+    display: none;
+  }
+
   /* 子单标识 */
   .sub-order-tag {
+    flex-shrink: 0;
     display: inline-block;
     margin-right: 4px;
     padding: 0 4px;
@@ -550,5 +560,6 @@
     display: inline-flex;
     align-items: center;
     white-space: nowrap;
+    direction: ltr;
   }
 </style>