data(){
var validateDeclared = (rule, value, callback) => {
if (value === '') {
callback(new Error('请输入'))
} else {
if (this.addEnterpriseBtn) {
getCompanyByCompanyId({ companyId: this.tableObj.enterpriseCode }).then(res => {
if (res.result) {
callback(new Error('企业编码不唯一'))
}
})
}
}
}
return {
rules: {
enterpriseCode: [
{
validator: validateDeclared,
trigger: 'blur'
}
],
}
}
}