解决合并冲突
This commit is contained in:
@@ -459,3 +459,46 @@ export async function selectPrinterAndPrint(data, template, showPrinterDialog, m
|
||||
modal.msgError(error.message || '获取打印机列表失败');
|
||||
}
|
||||
}
|
||||
|
||||
// 分组标记处理
|
||||
export function getGroupMarkers(tableData) {
|
||||
// 初始化所有行的 groupIcon 为 null
|
||||
tableData.forEach((item) => {
|
||||
item.groupIcon = null;
|
||||
});
|
||||
|
||||
// 创建一个映射来存储每个 groupId 对应的行索引
|
||||
const groupMap = {};
|
||||
|
||||
// 遍历列表,按 groupId 分组(忽略无 groupId 的项)
|
||||
tableData.forEach((item, index) => {
|
||||
if (!item.groupId) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!groupMap[item.groupId]) {
|
||||
groupMap[item.groupId] = [];
|
||||
}
|
||||
groupMap[item.groupId].push(index);
|
||||
});
|
||||
|
||||
// 为每个组设置 groupIcon
|
||||
Object.values(groupMap).forEach((indices) => {
|
||||
// 只有当组内元素大于1个时才需要显示分组标记
|
||||
if (indices.length > 1) {
|
||||
indices.forEach((index, i) => {
|
||||
if (i === 0) {
|
||||
// 第一行
|
||||
tableData[index].groupIcon = '┏';
|
||||
} else if (i === indices.length - 1) {
|
||||
// 最后一行
|
||||
tableData[index].groupIcon = '┗';
|
||||
} else {
|
||||
// 中间行
|
||||
tableData[index].groupIcon = '┃';
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
return tableData;
|
||||
}
|
||||
Reference in New Issue
Block a user