<el-form
:model="form"
:rules="rules"
ref="form">
<el-form-item label="组织" prop="organizationList">
<el-cascader v-model="form.organizationList"
:options="compOption"
:props="{ multiple: false,checkStrictly: true}"
collapse-tags
is-leaf
clearable/>
</el-form-item>
</el-form>
data(){
const validateOrg = (rule, value, callback) => {
if (!this.form.organizationList.length) {
callback(new Error('组织不能为空'))
} else {
callback()
}
}
return {
rules:{
organizationList: [{ type: 'array', required: true, validator: validateOrg }],
}
}
}
网友评论