GoJS组织结构图2
阅读原文时间:2023年07月15日阅读:1




组织结构图


This editable organizational chart sample color-codes the Nodes according to the tree level in the hierarchy.

Double click on a node in order to add a person or the diagram background to add a new boss. Double clicking the diagram uses the ClickCreatingTool with a custom ClickCreatingTool.insertPart to scroll to the new node and start editing the TextBlock for its name .

Drag a node onto another in order to change relationships. You can also draw a link from a node's background to other nodes that have no "boss". Links can also be relinked to change relationships. Right-click or tap-hold a Node to bring up a context menu which allows you to:

  • Vacate Position - remove the information specfic to the current person in that role
  • Remove Role - removes the role entirely and reparents any children
  • Remove Department - removes the role and the whole subtree
Deleting a Node or Link will orphan the child Nodes and generate a new tree. A custom SelectionDeleting DiagramEvent listener will clear out the boss info when the parent is removed.

Select a node to edit/update node data values. This sample uses the Data Inspector extension to display and modify Part data.

To learn how to build an org chart from scratch with GoJS, see the Getting Started tutorial.

If you want to have some "assistant" nodes on the side, above the regular reports, see the Org Chart Assistants sample, which is a copy of this sample that uses a custom TreeLayout to position "assistants" that way.

Diagram Model saved in JSON format:


参考 学习文档  https://liuxiaofan.com/2018/03/16/3521.html