//获取所有行
var allRows = $grid.datagrid('getRows');
//定义一个比较器,比对这些行的样本号和顺序,如果有重复,不能提交
function customizer(objValue, othValue) {
console.log(objValue.orders===othValue.orders)
if (objValue.sampleNo===othValue.sampleNo || objValue.orders+''===othValue.orders+'') {
return true;
}
}

var uniqWith = _.uniqWith(allRows, customizer);
if (allRows.length!=uniqWith.length) {
alert('样本号或顺序有重复记录,不能保存!');
return false;
}