From 1305c8f615fb236f037d81e4cd0ec9f5d2b404fe Mon Sep 17 00:00:00 2001 From: zhouyuejun <505127606@qq.com> Date: Wed, 13 Mar 2019 18:06:10 +0800 Subject: [PATCH] =?UTF-8?q?=E9=83=A8=E9=97=A8=E9=80=89=E6=8B=A9bug?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../department-management.component.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/app/pages/system-management/department-management/department-management.component.ts b/src/app/pages/system-management/department-management/department-management.component.ts index d14eb98..b712b47 100644 --- a/src/app/pages/system-management/department-management/department-management.component.ts +++ b/src/app/pages/system-management/department-management/department-management.component.ts @@ -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]) + } } }) }