代码:
<el-form-item label="上级部门名称:" prop="sDeptId">
<el-select
v-model="addForm.sDeptName"
placeholder="请选择"
ref="selectReport"
>
<el-option
:value="addForm.sDeptId"
:label="addForm.sDeptName"
style="
width: 560px;
height: 200px;
overflow: auto;
background-color: #fff;
"
>
<el-tree
:data="superiorList"
:props="{
value: 'id',
label: 'deptName',
}"
@node-click="handleNodeClick"
></el-tree>
</el-option>
</el-select>
</el-form-item>
// 上级选择
handleNodeClick(val) {
this.$set(this.addForm, "sDeptId", val.id);
this.$set(this.addForm, "sDeptName", val.deptName);
if (!val.children || val.children.length == 0) {
this.$refs.selectReport.blur();
}
},
|