1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
   | import type { TableColumnCtx } from 'element-plus'
  const tableData = [   { "Available": 0, "Capacity": 0, "Name": "test05", "Status": 0, "StoAlias": "test", "Type": 0, "Used": 0 },   { "Available": 0, "Capacity": 0, "Name": "test01", "Status": 0, "StoAlias": "169.254.218", "Type": 0, "Used": 0 },   { "Available": 0, "Capacity": 0, "Name": "tset03", "Status": 0, "StoAlias": "test", "Type": 1, "Used": 0 },   { "Available": 0, "Capacity": 0, "Name": "test02", "Status": 0, "StoAlias": "test03", "Type": 0, "Used": 0 },   { "Available": 0, "Capacity": 0, "Name": "test06", "Status": 0, "StoAlias": "test03", "Type": 0, "Used": 0 },   { "Available": 0, "Capacity": 0, "Name": "test04", "Status": 0, "StoAlias": "169.254.218", "Type": 0, "Used": 0 },   { "Available": 0, "Capacity": 0, "Name": "test07", "Status": 0, "StoAlias": "169.254.218", "Type": 1, "Used": 0 } ]
  let cellList: any[] = []  let count: number = 0 
  const computeCell = (tableList: any[]) => {   cellList = []   count = 0   for (let i = 0; i < tableList.length; i++) {     if (i === 0) {              cellList.push(1);        count = 0;      } else {       if (tableList[i].StoAlias == tableList[i - 1].StoAlias) {         cellList[count] += 1;          cellList.push(0);        } else {         cellList.push(1);          count = i;        }     }   } }
  const sortArray = (x: any, y: any) => {   if (x.StoAlias < y.StoAlias) { return -1 }   else if (x.StoAlias > y.StoAlias) { return 1 }   else { return 0 } }
  interface SpanMethodProps {   row: StoragePoolItem   column: TableColumnCtx<StoragePoolItem>   rowIndex: number   columnIndex: number }
  const spanMethod = ({   rowIndex,   columnIndex, }: SpanMethodProps) => {     computeCell(tableData.sort(sortArray))     if (columnIndex === 0) {       const fRow = cellList[rowIndex]       const fCol = fRow > 0 ? 1 : 0       return {         rowspan: fRow,          colspan: fCol        }     } }
  |