SOURCE

var taskGroups = {};
for (var i = 0; i < tasks.Count; i++) {

if (tasks[i].WorkGroupName === "物理组"||tasks[i].WorkGroupName === "安全组"||tasks[i].WorkGroupName === "色牢度组"||tasks[i].WorkGroupName === "羽绒组"||tasks[i].WorkGroupName === "纤维含量组"||tasks[i].WorkGroupName === "功能组"||tasks[i].WorkGroupName === "轻工组"||tasks[i].WorkGroupName === "纤检组"||tasks[i].WorkGroupName === "开样组") continue;
    var taskGroup = taskGroups[tasks[i].Title] || {};
    taskGroup.Title = tasks[i].Title;
    taskGroup.DetectionCodeActual = tasks[i].DetectionCodeActual;
    taskGroup.Colors = taskGroup.Colors || [];
    taskGroup.TitleParts = taskGroup.TitleParts || [];
    if (tasks[i].Color && taskGroup.Colors.indexOf(tasks[i].Color) == -1) taskGroup.Colors.push(tasks[i].Color);
    if (tasks[i].TitlePart && taskGroup.TitleParts.indexOf(tasks[i].TitlePart) == -1) taskGroup.TitleParts.push(tasks[i].TitlePart);
    taskGroups[tasks[i].Title] = taskGroup;
}
var strs = [];
for (var propertyName in taskGroups) {
    var taskGroup = taskGroups[propertyName];
    if (taskGroup.Colors.length && taskGroup.TitleParts.length) {
        var str = taskGroup.Title + '[' + taskGroup.Colors.join(',') + ']' + '(' + taskGroup.TitleParts.join(',') + ')' + '(' + taskGroup.DetectionCodeActual + ')';
    } else if (taskGroup.Colors.length && !taskGroup.TitleParts.length) {
        var str = taskGroup.Title + '[' + taskGroup.Colors.join(',') + ']' + '(' + taskGroup.DetectionCodeActual + ')';
    } else if (!taskGroup.Colors.length && taskGroup.TitleParts.length) {
        var str = taskGroup.Title + '(' + taskGroup.TitleParts.join(',') + ')' + '(' + taskGroup.DetectionCodeActual + ')';
    } else {
        var str = taskGroup.Title + '(' + taskGroup.DetectionCodeActual + ')';
    }
    strs.push(str);
}
current.Range.Value2 =strs.join('、');
console 命令行工具 X clear

                    
>
console