validatorTagTypeValue(rule, value, callback) { const errors = [] if (value !== ‘‘ && value !== undefined) { uniqueTagTypeValue({ noDictCode: this.dictCode, dictValue: value, dictType: ‘t_penetration_tag_type‘ }).then(res => { if (res.code !== 0) { errors.push(‘类型值‘ + value + ‘已存在‘) } callback(errors) }) .catch(() => { this.$message.error(‘系统错误,请稍后再试‘) errors.push(‘系统错误,请稍后再试‘) callback(errors) }) .finally(() => { this.confirmLoading = false }) } else { callback() } },
formValidatorRules: { typeValue: [{ required: true, message: ‘标签类型值不能为空‘ }, { validator: this.validatorTagTypeValue }] },
<a-input v-decorator="[‘dictValue‘,{rules: formValidatorRules.typeValue}]"
placeholder="标签类型值" />