赣州市做网站设计,怎么做网站扫描,珠海做网站的网络公司,奢侈品商城网站建设场景#xff1a; 混批名称相同合并混批名称#xff0c;在混批名称相同条件下合并相同的混批类型#xff1b;在混混批类型相同条件下合并相同的混批值#xff1b;在混批值相同条件下合并相同的单位
实现根据四个不同的key值#xff0c;当四个key值对应相等时#xff0c;合…场景 混批名称相同合并混批名称在混批名称相同条件下合并相同的混批类型在混混批类型相同条件下合并相同的混批值在混批值相同条件下合并相同的单位
实现根据四个不同的key值当四个key值对应相等时合并行。并且值合并前四col 想要实现的结果如下图 解决方案代码如下先简单实现了合并。代码可以后续优化
mergeMixedSku ({row, _rowIndex, column, visibleData}) {const fields [mixedName, mixedType, mixedValue, mixedValueUnit]const cellValue row[column.property]if (cellValue fields.includes(column.property)) {const prevRow visibleData[_rowIndex - 1]let nextRow visibleData[_rowIndex 1]if (column.property mixedName) {if (prevRow prevRow[column.property] cellValue) {return {rowspan: 0,colspan: 0}} else {let countRowspan 1while (nextRow nextRow[column.property] cellValue) {nextRow visibleData[countRowspan _rowIndex]}if (countRowspan 1) {return {rowspan: countRowspan,colspan: 1}}}} else if (column.property mixedType) {if (prevRow prevRow[column.property] cellValue prevRow.mixedName row.mixedName) {return {rowspan: 0,colspan: 0}} else {let countRowspan 1while (nextRow nextRow[column.property] cellValue nextRow.mixedName row.mixedName) {nextRow visibleData[countRowspan _rowIndex]}if (countRowspan 1) {return {rowspan: countRowspan,colspan: 1}}}} else if (column.property mixedValue) {if (prevRow prevRow[column.property] cellValue prevRow.mixedName row.mixedName prevRow.mixedType row.mixedType) {return {rowspan: 0,colspan: 0}} else {let countRowspan 1while (nextRow nextRow[column.property] cellValue nextRow.mixedName row.mixedName nextRow.mixedType row.mixedType) {nextRow visibleData[countRowspan _rowIndex]}if (countRowspan 1) {return {rowspan: countRowspan,colspan: 1}}}} else if (column.property mixedValueUnit) {if (prevRow prevRow[column.property] cellValue prevRow.mixedName row.mixedName prevRow.mixedType row.mixedType prevRow.mixedValue row.mixedValue) {return {rowspan: 0,colspan: 0}} else {let countRowspan 1while (nextRow nextRow[column.property] cellValue nextRow.mixedName row.mixedName nextRow.mixedType row.mixedType nextRow.mixedValue row.mixedValue) {nextRow visibleData[countRowspan _rowIndex]}if (countRowspan 1) {return {rowspan: countRowspan,colspan: 1}}}}}} 最终实现效果