import { getTableHeight } from '@/views/components/mixins'
export default {
    mixins:[getTableHeight],
    props:{
        //表格数据
        tableData:{
            default:()=>{
                return []
            }
        },
        //显示类型0：全部展示；1：主权要展示
        showType:{
            default:0
        },
        //表头
        tableHeader:{
            default:()=>{
                return []
            }
        }
    },
    data() {
        return {
            mergeObj: {},
            mergeArr: ['id', 'pRightName'],
        }
    },
    methods: {
        tableRowClassName({ row, rowIndex }){},
        getSpanArr(data) {
            this.mergeArr.forEach((key, index1) => {
              let count = 0;
              this.mergeObj[key] = [];
              data.forEach((item, index) => {
      
                if (index === 0) {
                  this.mergeObj[key].push(1);
                } else {
                  if (item[key] === data[index - 1][key]&& item[key] !== 'explainText' ) {
                    this.mergeObj[key][count] += 1;
                    this.mergeObj[key].push(0);
                  } else {
                    count = index;
                    this.mergeObj[key].push(1);
                  }
                }
              })
            })
          },
          objectSpanMethod({ row, column, rowIndex, columnIndex }) {
            if (this.mergeArr.indexOf(column.property) !== -1) {
                if (this.mergeObj[column.property][rowIndex]) {
                
                return [this.mergeObj[column.property][rowIndex], 1]
              } else {
                return [0, 0];
              }
            }
          }
    },
}