部门选择bug修改

This commit is contained in:
zhouyuejun
2019-03-13 18:06:10 +08:00
parent 948696d907
commit 1305c8f615
@@ -70,9 +70,9 @@ export class DepartmentManagementComponent implements OnInit {
//表单实例化
this.validateForm = this.fb.group({
organization: ['', [Validators.required, Validators.maxLength(20)]],
shortName: ['',[Validators.maxLength(10)]],
code: ['', [Validators.required,Validators.maxLength(10)]],
contact_person: ['',[Validators.maxLength(10)]],
shortName: ['', [Validators.maxLength(10)]],
code: ['', [Validators.required, Validators.maxLength(10)]],
contact_person: ['', [Validators.maxLength(10)]],
contact_method: [''],
organization_type: [''],
address: [''],
@@ -351,8 +351,13 @@ export class DepartmentManagementComponent implements OnInit {
var zTree = $.fn.zTree.getZTreeObj("treeDemo");
let node = zTree.getNodes();
if (json.body.length > 0) {
zTree.selectNode(node[0].children[0])
zTree.setting.callback.onClick(null, zTree.setting.treeId, node[0].children[0])
if (node[0].children && node[0].children.length > 0) {
zTree.selectNode(node[0].children[0])
zTree.setting.callback.onClick(null, zTree.setting.treeId, node[0].children[0])
}else{
zTree.selectNode(node[0])
zTree.setting.callback.onClick(null, zTree.setting.treeId, node[0])
}
}
})
}