<el-form-item label="安全自查列表" prop="selfexam_list">
<!-- :rules="[
{
validator: checkSelectedOptions,
trigger: 'change',
required: true
}
]" -->
<el-select
v-model="dataForm.selfexam_list"
multiple
filterable
@change="changeSelect"
>
<div>
<el-checkbox
v-model="checked"
style="text-align: right; width: 100%; padding-right: 10px"
@change="selectAll"
>全选</el-checkbox
>
</div>
<el-option
v-for="item in supplierDataName"
:key="item.u_id"
:label="item.name"
:value="item.u_id"
/>
</el-select>
</el-form-item>
在methods中
selectAll() {
this.dataForm.selfexam_list = []
if (this.checked) {
this.supplierDataName.map((item) => {
this.dataForm.selfexam_list.push(item.u_id)
})
} else {
this.dataForm.selfexam_list = []
}
},