SOURCE

let arguments =[{"shipmentNum":"ck1588440413242994690","pageNumber":"第1/1页","receivingAddress":"广州市","hab":"广州市盈信纸业有限公司","productCount":22,"operator":"admin","allPage":1,"planNum":"1100023","total":6057.600,"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":"烫画材料测试","unit2":"平方","units":"m²","productCount":21,"specifications":"56cm * 100m * 21R","productName":"(卷、张按平方卖)YY-06双面哑光热转印膜100U","number":null,"sizeOther1":null,"bz":"","planId":"1588440413242994690","brand":null,"sizeLength":100.0000000,"sizeWidth":56.0000000,"productBz":null,"sizeWeight":null,"associatedPo":"","subtotal":"3057.6","squareUnitPrice":2.6000000,"salesman":"1111","squareNum":"1176","additionalAttributes":"[]"},{"companyAlias":"烫画材料测试","unit2":"平方","units":"m²","productCount":1,"specifications":"60cm * 50cm * 10000/包 * 1","productName":"YY-01双面哑光热转印膜100U","number":null,"sizeOther1":10000.0000000,"bz":"","planId":"1588440413242994690","brand":null,"sizeLength":0.5000000,"sizeWidth":60.0000000,"productBz":"XX1","sizeWeight":null,"associatedPo":"","subtotal":"3000","squareUnitPrice":1.0000000,"salesman":"1111","squareNum":"3000","additionalAttributes":"[]"},{
  "companyAlias": "烫画材料测试",
  "unit2": "kg",
  "units": "kg",
  "productCount": 1,
  "specifications": "56cm * 0.48m * 10000kg * 1R",
  "productName": "(按单张卖)YY-06双面哑光热转印膜.100U",
  "number": null,
  "sizeOther1": null,
  "bz": "",
  "planId": "1588442142504202242",
  "brand": null,
  "sizeLength": 0.48,
  "sizeWidth": 56,
  "productBz": null,
  "sizeWeight": 10000,
  "associatedPo": "",
  "subtotal": "50000",
  "squareUnitPrice": 5,
  "salesman": "1111",
  "squareNum": "10000",
  "additionalAttributes": "[]"
},{
  "companyAlias": "烫画材料测试",
  "unit2": "平方",
  "units": "m²",
  "productCount": 10,
  "specifications": "100cm * 100m * 10R",
  "productName": "(卷、张按照米卖的)YY-06双面哑光热转印膜100U*1.07M",
  "number": null,
  "sizeOther1": null,
  "bz": "",
  "planId": "1588444629558702082",
  "brand": null,
  "sizeLength": 100,
  "sizeWidth": 100,
  "productBz": null,
  "sizeWeight": null,
  "associatedPo": "",
  "subtotal": "1000",
  "squareUnitPrice": 1,
  "salesman": "1111",
  "squareNum": "1000",
  "additionalAttributes": "[]"
},{
  "companyAlias": "烫画材料测试",
  "unit2": "平方",
  "units": "m²",
  "productCount": 3,
  "specifications": "120cm * 100cm * 1000/包 * 1",
  "productName": "(卷、张按照米卖的)YY-06双面哑光热转印膜100U*1.07M",
  "number": null,
  "sizeOther1": 1000,
  "bz": "",
  "planId": "1588443798688051201",
  "brand": null,
  "sizeLength": 1,
  "sizeWidth": 120,
  "productBz": null,
  "sizeWeight": null,
  "associatedPo": "",
  "subtotal": "2400",
  "squareUnitPrice": 2,
  "salesman": "1111",
  "squareNum": "1200",
  "additionalAttributes": "[]"
}],"companyContacts":"王","allTotal":6057.6,"contactsPhone":"15999999999","capitalChineseAllTotal":"陆仟零伍拾柒元陆角","associatedPo":"","capitalChineseTotal":"陆仟零伍拾柒元陆角","customerTo":"烫画材料测试","shippingAddress":"广州市","signatory":"王","currentPage":1,"totalSquareNum":4176.000,"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 = sizeWidth + "mm * "
    }else if(sizeWidth == 1000){
        data['list'][i].unit2 = "米"
        spe = sizeLength + "m * "
    }
//判断是否有张数 
    if(sizeOther1){
        if(sizeLength == 1 || sizeWidth == 1000){
        spe = spe + "" +  (sizeOther1*productCount) + "张"
        }else{
        spe = sizeWidth + "mm * " + parseFloat((sizeLength*1000).toFixed(2)) + "mm * " +  (sizeOther1*productCount) + "张"
        }
    }else{
        spe = sizeWidth + "mm * " + parseFloat((sizeLength*1000).toFixed(2)) + "mm * "
    }
    if(sizeWeight){
        spe = spe + (sizeWeight*productCount) + "张" 
  
        data['list'][i].unit2 = "张"
    }else if(sizeOther1){
       
    }else{
        spe = spe + productCount +"卷"

    }
    
    data['list'][i].specifications = spe
}

// 判断字符是否存在的方法
function hasText(text,name){
    return text.indexOf(name)!== -1
}

console.log(data['list']);
// return data; //返回处理完的数据
console 命令行工具 X clear

                    
>
console