background:
When using the form, you need to add validation rules for required fields. But if there is a case that is the cell door, you must select the name of the unit, if the unit is not a door, it is not necessary to select the cell door.
<el-form-item label="单元" label-width="120px" prop="unitId" v-if="detailData.unitFlag=='1'" :rules="{required: true, message: '请选择单元'}"> <el-select v-model="detailData.unitId" filterable placeholder="请选择单元"> <el-option v-for="item in unitList" :key="item.unitId" :label="item.unitFullName" :value="item.unitId" /> </el-select> </el-form-item>
This allows individual design rules for this form field