场景:当文本内容填写为“同意”时允许提交,如否则提示“输入错误”
配置:
if(boData.jmcs.wb=="同意") //jmcs为业务对象别名,wb为字段名 { return true; } else { alert("输入有误"); return false; }
效果:
补充写法:
启动时检查每行子表是否满足要求,若满足,启动流程,不满足则给出弹窗提示
function testcz(newVal) { return new Promise((resolve, reject) => { try { newVal.forEach((item, index) => { if (Number(item.cz) < 0) { debugger throw new Error(`第${index + 1}行,进项税本月计提需小于增值税本月计提`); } }); resolve(true); } catch (e) { _this.$message.warning(e.message); console.log(e.message); reject(e); } }); } return testcz(data.zzsjqfjsjtbybjs.sub_ybjs);