这个是前端的问题我是后端的不晓得怎嘛做来请教各位

我的需求

同一物料名称合并展示报价情况,无需将中标和未中标分开;相同物料采购组织合并展示;
将物料信息列表下相同的物料信息合并
就是
眼镜
账单
眼镜
账单
合并成
眼镜
账单

this.pdResultDetailTable = new $.DataTable(pdResultDetailTable)
                detailDataTable.rows.subscribe(function (rows) {
                    Common.setSimpleData(this.pdResultDetailTable, Common.getSimpleData(detailDataTable))
                }.bind(this))
                this.rows = detailDataTable.rows
                this.columns = ko.observableArray([
                    {
这里是源代码
                        title: '物料信息',
                        field: 'materialName',
                        width: 240,
                        lock: true,
                        sortIndex: 1,
                        type: 'component',
                        compFn: function (rows) {
                            return {
                                name: 'td-materielinfor',
                                params: {
                                    rows: rows,
                                    state: that.stateMaterials
                                }
                            }
                        }

不晓得你说的采购合并是合并为数组还是拼接,都附上

var matArr = [
        {
            "id":"01",//物料编码
            "name":"眼镜",//物料名称
            "purchase": "采购部",//采购组织
        },
        {"id":"02","name":"水杯","purchase": "财务部"},
        {"id":"03","name":"表计","purchase": "计量部"},
        {"id":"01","name":"眼镜","purchase": "检测部"},
        {"id":"02","name":"水杯","purchase": "人事部"},
        {"id":"03","name":"表计","purchase": "设备部"},
    ];
function sortArr(arr) {
        let arrIndex = [];
        let result = [];
        for (let item of arr) {
            if (arrIndex.includes(item.id) == false) {    //判断物料id是否已存在
                let obj = {
                    name: item.name,
                    id: item.id,
                    list: "",   //拼接
//                    list: []    //数组
                };
                obj.list = item.purchase;
//                obj.list.push(item.purchase);
                result.push(obj);
                arrIndex.push(item.id);
            } else {
                let index = arrIndex.indexOf(item.id)
                result[index].list = result[index].list+","+item.purchase;
//                result[index].list.push(item.purchase)
            }
        }
        return result
    }
console.log(sortArr(matArr));

在渲染前对this.rows进行处理

this.rows.forEach((item,index)=>{
     if(item.title == 'xx物料'){
     // 物料信息相同物料报价相加
         item.xx += item.xx
     }
 })

有用的话请点个采纳~

this.rows 做一个去重操作?

里面的person 就是对应的数据,你的眼镜账单字段就是id?切换一下字段

let person = [
     {id: 0, name: "小明"},
     {id: 1, name: "小张"},
     {id: 2, name: "小李"},
     {id: 3, name: "小孙"},
     {id: 1, name: "小周"},
     {id: 2, name: "小陈"},   
];

let obj = {};

let peon = person.reduce((cur,next) => {
    obj[next.id] ? "" : obj[next.id] = true && cur.push(next);
    return cur;
},[]) //设置cur默认类型为数组,并且初始值为空的数组
console.log(peon);

可以做一个数据集,然后循环去渲染拿数据

对数据进行 去重 或者 分组