jQuery().ready(function () {
//提交或保存时触发判断,是否明细行有重复
WfForm.registerCheckEvent(WfForm.OPER_SAVE + "," + WfForm.OPER_SUBMIT, function (callback) {
//获取明细行field14806字段的值
var fieldMark = []
var rowArr = WfForm.getDetailAllRowIndexStr("detail_1").split(",");
for (var i = 0; i < rowArr.length; i++) {
var rowIndex = rowArr[i];
if (rowIndex !== "") {
fieldMark[i] = WfForm.getFieldValue("field14806_" + rowIndex); //遍历明细行字段
//console.log(fieldMark[i]);
}
}
//判断是否有重复,如有重复值,则赋值给cfx
var cfx = []
var x = 0
var cf = fieldMark.join(",") + ",";
for (var i = 0; i < fieldMark.length; i++) {
if (cf.replace(fieldMark[i] + ",", "").indexOf(fieldMark[i] + ",") > -1) {
if (fieldMark[i] != "") {
cfx[x] = "第" + (i + 1) + "行";
x += 1
};
//break;
}
}
//根据cfx长度判断是否有重复,如有重复则提示,无重复则通过提交或保存
//console.log("重复的值", cfx);
if (cfx.length > 0) {
WfForm.showMessage("明细表存在重复行:" + cfx, 2, 3); //错误信息,3s后消失
}
else {
//WfForm.showMessage("提交" + cfx); //错误信息,5s后消失
callback();
};
});
});
console