licp
2024-04-09 d2e610d8814c4f2dbd4f0b8825ae595871668237
特殊的表格合并
已修改3个文件
96 ■■■■ 文件已修改
src/components/tool/value-table.vue 42 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/view/b1-expenses.vue 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/view/b1-inspect-order-plan.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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 => {
src/components/view/b1-expenses.vue
@@ -40,6 +40,12 @@
    }
</style>
<style>
  .el-table tbody tr:hover > td {
      background-color: transparent !important;
  }
</style>
<template>
    <div class="inspection_order">
        <div style="width: 100%;height: 100%;">
@@ -112,8 +118,52 @@
                    isIndex: true,
                    showSelect: false,
                    select: false,
          highlight:false,
                    do: [],
                    linkEvent:{},
          spanConfig:{
            //合并行
            rows:[
              {
                name:'createTime',
                index:1
              },
              {
                name:'entrustCode',
                index:2
              },
              {
                name:'company',
                index:8
              },
              {
                name:'name',
                index:9
              },
            ],
            // 特殊的合并行,根据main和rows的name来合并
            special:{
              main:'insSampleId',
              rows:[
                {
                  name:'sample',
                  index:3
                },
                {
                  name:'model',
                  index:4
                },
                {
                  name:'num',
                  index:5
                },
                {
                  name:'price',
                  index:6
                },
              ]
            }
          },
                    tagField: {
                        type: {
                            select: [{
src/components/view/b1-inspect-order-plan.vue
@@ -286,10 +286,6 @@
                            }]
                        }
                    },
          spanConfig:{
            rows:'entrustCode',//合并行,通常涉及一个字段
            cols:[],//合并列,通常涉及几个字段
          },
                    selectField: {},
                    requiredAdd: [],
                    requiredUp: []