licp
2024-04-09 d2e610d8814c4f2dbd4f0b8825ae595871668237
src/components/tool/value-table.vue
@@ -100,7 +100,7 @@
            @row-click="rowClick" :show-summary="data.countFleid!=undefined && data.countFleid.length > 0"
            :summary-method="getSummaries" :row-class-name="tableRowClassName"
        :row-key="record=>record.id" :current-row-key="data.currentId"
        highlight-current-row
        :highlight-current-row="data.highlight===undefined||data.highlight"
        :span-method="spanMethod">
            <el-table-column type="selection" width="65" v-if="data.showSelect" :key="Math.random()">
            </el-table-column>
@@ -390,8 +390,12 @@
          //   position:0
          // }
        ],
        testArr: [],
        testPosition: 0,
        specialSpanList:[
          // {
          //   arr:[],
          //   position:0
          // }
        ],
         }
      },
      watch: {
@@ -435,6 +439,7 @@
        });
      },
      spanMethod({ row, column, rowIndex, columnIndex }){
        // 一般的合并行
        if(this.data.spanConfig!=undefined&&this.data.spanConfig.rows&&this.data.spanConfig.rows.length>0){
          let i = null;
          let obj = this.data.spanConfig.rows.find((item,index)=>{
@@ -443,6 +448,22 @@
          })
          if(obj){
            const _row = this.spanList[i].arr[rowIndex];
            const _col = _row > 0 ? 1 : 0;
            return {
              rowspan: _row,
              colspan: _col,
            };
          }
        }
        // 特殊的合并行
        if(this.data.spanConfig!=undefined&&this.data.spanConfig.special&&this.data.spanConfig.special.main&&this.data.spanConfig.special.rows&&this.data.spanConfig.special.rows.length>0){
          let i = null;
          let obj = this.data.spanConfig.special.rows.find((item,index)=>{
            i = index;
            return item.index==columnIndex
          })
          if(obj){
            const _row = this.specialSpanList[i].arr[rowIndex];
            const _col = _row > 0 ? 1 : 0;
            return {
              rowspan: _row,
@@ -519,6 +540,7 @@
                     })
                  }
               }
          // 一般的合并行
          if(this.data.spanConfig!=undefined&&this.data.spanConfig.rows&&this.data.spanConfig.rows.length>0){
            this.spanList = [];
            this.data.spanConfig.rows.forEach((item,index)=>{
@@ -528,9 +550,17 @@
              })
              this.rowspan(this.spanList[index].arr, this.spanList[index].position, item.name);
            })
            // this.testArr = []
            // this.testPosition = 0
            // this.rowspan(this.testArr, this.testPosition, this.data.spanConfig.rows.name);
          }
          // 特殊的合并行
          if(this.data.spanConfig!=undefined&&this.data.spanConfig.special&&this.data.spanConfig.special.main&&this.data.spanConfig.special.rows&&this.data.spanConfig.special.rows.length>0){
            this.specialSpanList = []
            this.data.spanConfig.special.rows.forEach((item,index)=>{
              this.specialSpanList.push({
                arr:[],
                position:0
              })
              this.rowspan(this.specialSpanList[index].arr, this.specialSpanList[index].position, this.data.spanConfig.special.main);
            })
          }
               this.loading = false
            }).catch(e => {