SOURCE

let arguments =[
    {
        "address": "广西壮族自治区北海市铁山港区广西壮族自治区北海市铁山港区营盘镇铁山港工业园7号", 
        "purCompanyName": "广东楷诚纸业有限公司", 
        "companyName": "斯道拉恩索(广西)浆纸有限公司", 
        "sendTime": "2022-07-22", 
        "countSum": 3, 
        "totalSum": 1730, 
        "companyId": "1540530104069173248", 
        "createBy": "pengyeqiang", 
        "createTime": "2022-07-22 00:00:00", 
        "phone": "0769-38841601", 
        "bz": null, 
        "purAddress": "广东省东莞市洪梅镇望沙路红梅段66号", 
        "id": "1550320106067668994", 
        "DetailsList": [
            {
                "sizeLength": null, 
                "sizeWidth": 1820, 
                "productId": "1550320106206081026", 
                "companyName": "斯道拉恩索(广西)浆纸有限公司", 
                "unit2": "kg", 
                "productCount": 1, 
                "warehouseName": "次品仓", 
                "number": "", 
                "companyId": "1540530104069173248", 
                "unit": "平方", 
                "sizeWeight": 80, 
                "sizeOther1": null, 
                "warehousefullName": "次品仓", 
                "warehouseId": "1541261649138069505", 
                "totalNum": 80, 
                "price": 0, 
                "subtotal": "0", 
                "name": "食品级包装卷纸270g(kg)", 
                "bz": null, 
                "id": "1550320106084446210"
            }, 
            {
                "sizeLength": null, 
                "sizeWidth": 1820, 
                "productId": "1550320106457739265", 
                "companyName": "斯道拉恩索(广西)浆纸有限公司", 
                "unit2": "kg", 
                "productCount": 1, 
                "warehouseName": "次品仓", 
                "number": "", 
                "companyId": "1540530104069173248", 
                "unit": "平方", 
                "sizeWeight": 850, 
                "sizeOther1": null, 
                "warehousefullName": "次品仓", 
                "warehouseId": "1541261649138069505", 
                "totalNum": 850, 
                "price": 0, 
                "subtotal": "0", 
                "name": "食品级包装卷纸270g(kg)", 
                "bz": null, 
                "id": "1550320106336104450"
            }, 
            {
                "sizeLength": null, 
                "sizeWidth": 1820, 
                "productId": "1550320106696814593", 
                "companyName": "斯道拉恩索(广西)浆纸有限公司", 
                "unit2": "kg", 
                "productCount": 1, 
                "warehouseName": "次品仓", 
                "number": "", 
                "companyId": "1540530104069173248", 
                "unit": "平方", 
                "sizeWeight": 800, 
                "sizeOther1": null, 
                "warehousefullName": "次品仓", 
                "warehouseId": "1541261649138069505", 
                "totalNum": 800, 
                "price": 0, 
                "subtotal": "0", 
                "name": "食品级包装卷纸270g(kg)", 
                "bz": null, 
                "id": "1550320106575179777"
            }
        ]
    }
]

let data = arguments[0]; //获取传入的原始数据
//你的代码,推荐在线编辑器https://jsrun.net/

// 获取当前时间的方法
let t=new Date();
// 组合日期 YYYY - MM - DD
let yeah = t.getFullYear();
// 因为js中月份的获取是0~11,所以要加一个1
let month = t.getMonth()+1;
let day = t.getDay();
let time = yeah + '-' + checkTime(month)  + '-' + checkTime(day);
// 把时间加到data中返回
data['time'] = time;


// 时间处理方法:在小于10的数字前加一个‘0’
function checkTime(i){
	if (i<10){
		i="0" + i;
	}
	return i;
}


// 把规格详细数据拿出来并组合
let detail = data["DetailsList"];
for(let i = 0;i < detail.length;i++){
    let d = detail[i];
    let specification = '';
    // 根据宽度、长度、重量组合成规格
    // 宽度
    if(d['sizeWidth']){
        specification = d['sizeWidth'] + 'mm';
    };
    // 长度
    if(d['sizeLength']){
        if(specification){
            specification = specification + ' * ' + d['sizeLength'] + 'm';
        }else{
            specification = d['sizeLength'] + 'm';
        }
    };
    // 重量
    if(d['sizeWeight']){
        if(specification){
            specification = specification + ' * ' +  d['sizeWeight'] + 'kg';
        }else{
            specification = d['sizeWeight'] + 'kg';
        }
    };
    data["DetailsList"][i]['specification'] = specification;
}

console.log(data);
console 命令行工具 X clear

                    
>
console