SOURCE

let arguments =[
    {
        "shipmentNum": "ck1588440413242994690", 
        "pageNumber": "第1/1页", 
        "receivingAddress": "广州市", 
        "hab": "广州市盈信纸业有限公司", 
        "productCount": 22, 
        "operator": "admin", 
        "allPage": 1, 
        "planNum": "1100023", 
        "total": 6057.6, 
        "allProductCount": 22, 
        "companyPhone": "02084305189", 
        "routeBz": null, 
        "bz": "", 
        "allSquareNum": 4176, 
        "lines": 6, 
        "day": "2022-11-04", 
        "qq": "196113390", 
        "address": "广东省广州市白云区钟落潭镇马新路140号301", 
        "printSum": 0, 
        "signatoryPhone": "15999999999", 
        "list": [{
"companyAlias": null, 
"unit2": "平方", 
"units": "m²", 
"productCount": 2, 
"specifications": "330mm * 100m * 2R", 
"productName": "DTF-transferfilm(单面)75U", 
"number": null, 
"sizeOther1": null, 
"bz": "", 
"planId": "1590948879909937153", 
"brand": null, 
"sizeLength": 100, 
"sizeWidth": 330, 
"productBz": null, 
"sizeWeight": null, 
"associatedPo": "", 
"subtotal": "343.2", 
"squareUnitPrice": 5.2, 
"salesman": "老黄", 
"squareNum": "66", 
"additionalAttributes": null
}

        ], 
        "companyContacts": "王", 
        "allTotal": 6057.6, 
        "contactsPhone": "15999999999", 
        "capitalChineseAllTotal": "陆仟零伍拾柒元陆角", 
        "associatedPo": "", 
        "capitalChineseTotal": "陆仟零伍拾柒元陆角", 
        "customerTo": "烫画材料测试", 
        "shippingAddress": "广州市", 
        "signatory": "王", 
        "currentPage": 1, 
        "totalSquareNum": 4176, 
        "customer": "烫画材料测试"
    }
]
let data = arguments[0]; //获取传入的原始数据
//你的代码,推荐在线编辑器https://jsrun.net/

// console.log(data)
// 从明细里面把数据拿出来
let dataList = data['list'];
// 如果有明细才进行判断和排序
for (let i = 0;i < dataList.length;i++)
{  

let row = data['行'+(i+1)]
    // if(hasText(row,"/")){
    //     row = row.replaceAll('/','<br>')
    // }
    // data['list'][i]["row"] = row
    let base = dataList[i];
    // 定义规格
    let spe = '';
    // 长度
    let sizeLength = base.sizeLength;
    // 宽度
    let sizeWidth = base.sizeWidth;
    // 张数
    let sizeOther1 = base.sizeOther1;
    // 数量
    let productCount = base.productCount;
    // 重量
    let sizeWeight = base.sizeWeight;
  
    // 如果宽度或者长度刚好等于1m,则判定为 按米下单
    if(sizeLength == 1 ){
        data['list'][i].unit2 = "米"
        spe = parseFloat((sizeWidth/10).toFixed(2)) + "cm * "
    }else if(sizeWidth == 1000){
        data['list'][i].unit2 = "米"
        spe = parseFloat((sizeLength*100).toFixed(2)) + "cm * "
    }
    //判断是否有张数 
    if(sizeOther1){
        if(sizeLength == 1 || sizeWidth == 1000){
        spe = spe + "" +  (sizeOther1*productCount) + "张"
        }else{
        spe = parseFloat((sizeWidth/10).toFixed(2)) + "cm * " + parseFloat((sizeLength*100).toFixed(2)) + "cm * " +  (sizeOther1*productCount) + "张"
        }
    }else{
        spe = parseFloat((sizeWidth/10).toFixed(2)) + "cm * " + parseFloat((sizeLength*100).toFixed(2)) + "cm * "
    }
    if(sizeWeight){
        spe = spe + (sizeWeight*productCount) + "张" 

        data['list'][i].unit2 = "张"
    }else if(sizeOther1){
    
    }else{
        spe = spe + productCount +"卷"

    }

    // 其他费用的判断与新字段的生成,把品名和规格合并成一个字段
    let productName = base.productName
    data['list'][i].pmgg = productName + '*' + spe
    if(productName == '其他费用'){
        data['list'][i].unit2 = "元"
        data['list'][i].pmgg  = productName
    }else if (productName == ''){
        spe = ''
        data['list'][i].pmgg = ''
    }
    data['list'][i].specifications = spe
}

// 判断字符是否存在的方法
function hasText(text,name){
    return text.indexOf(name)!== -1
}
console.log(data['list']);
// return data; //返回处理完的数据
console 命令行工具 X clear

                    
>
console