部件结构
“部件结构”是项列表组件的预定义配置。部件结构包含一个结构树,可显示部件或 CAD 文档及其子代之间的层级关系。对于树中的每个项,部件结构均会显示可通过配置进行选择的属性。默认属性为编号、名称和状态。
可以配置部件结构以设置树的初始展开层级。默认情况下,初始展开层级设置为 3。用户可以展开和折叠树中的元素。
部件结构树包含缩进,以便直观显示结构层级。您可以通过配置来定义表格的第一列。默认情况下,第一列为“编号”。
“部件结构”与项列表类似,具有导出功能。导出文件中的一列显示结构中各项的层级数值,并包含缩进以直观显示结构层级。
下面的示例图示为“部件结构”预定义配置:
* 
如果查看结构树的用户对结构中的某一项没有访问权限,则该项不显示,并显示以下消息:“一些项已隐藏,因为您没有权限访问它们”。
绑定特性 
有关绑定“部件结构”的信息,请参阅项列表组件。
* 
对于“部件结构”,输入绑定特性支持 PTC.ProdMgmt.PartPTC.CADDocumentMgmt.CADDocument 对象类型。
selectedItems 绑定特性的输出包含对象类型为 PTC.ProdMgmt.PartStructureItemPTC.CADDocumentMgmt.CADStructure 的项。
配置特性 
有关“部件结构”的所有可用配置特性的列表,请参阅项列表组件的配置特性表。下表提供了“部件结构”的相关配置特性的其他信息。
有关详情,请参阅组件配置结构
有关子特性的详情,请参阅子特性和容器键
特性名称
说明
特性类型
默认值
必需或可选
attributes
有关详情,请参阅项列表
接受 PTC.ProdMgmt.PartStructureItemPTC.CADDocumentMgmt.CADStructure 对象类型的属性。
默认情况下,部件结构树按第一个属性 (即具有最小非负顺序值的属性) 进行排序。
不适用
必需
配置示例 
{
"attributes":{
"inTailoring":true,
"selectedValues":{
"data":[
{
"itemListsData":[
{
"items":[
{
"id":"Part|Number",
"ordinal":0
},
{
"id":"Part|Name",
"ordinal":1
},
{
"id":"Part|State#Display",
"ordinal":2
}
],
"objectType":"PTC.ProdMgmt.PartStructureItem"
},
{
"items":[
{
"id":"CADDocument|Number",
"ordinal":0
},
{
"id":"CADDocument|Name",
"ordinal":1
},
{
"id":"CADDocument|State#Display",
"ordinal":2
}
],
"objectType":"PTC.CADDocumentMgmt.CADStructure"
}
],
"adapter":{
"instanceName":"windchill",
"thingName":"PTC.WCAdapter"
}
}
]
}
},
"defaultExpansionLevel":{
"selectedKey":[
"3"
],
"inTailoring":true
},
"label":{
"value":""
},
"selectionType":{
"selectedKey":"multi"
},
"showExportAction":{
"additionalData":{
"itemListExportDefinition":{
"exportTypes":{
"selected":[
{
"key":"exportToCsv"
},
{
"key":"exportToExcel"
}
]
},
"exportUnFilteredData":{
"value":true
}
}
},
"value":true
},
"waitForInput":{
"value":true
},
"baseConfigurationVersion":{
"value":"nav.3"
},
"implementationConfigurationVersion":{
"value":"nav.1"
}
}
自定义服务 
除配置外,每个组件还支持通过扩展其业务逻辑来自定义组件。每个组件的业务逻辑在事物模板中都包含可改写服务,您可以对这些服务进行扩展和改写。下表对此组件的可改写服务进行了详细说明。
有关每个服务的返回值和参数的示例,请参阅自定义服务的输入/输出示例
名称
说明
ComputeMessages
计算要显示在“部件结构”中的所需消息。该属性会接收当前消息 JSON 和建议的消息 JSON,并返回通知消息 JSON,其中包含要在项列表中显示的消息。
参数:
getItemsResponse (必需) - CCO 格式的 JSON 对象,其中包含从 getItems 服务返回的项。
currentMessages (必需) - JSON 对象,其中包含显示在用户界面中的当前通知消息。
suggestedMessages (必需) - JSON 对象,其中包含一系列建议的消息。推荐您使用建议的消息。
input (可选) - CCO 格式的 JSON,其中包含位于结构根节点处的项的输入 ID。
configuration (可选) - 包含配置的 JSON。
scope (可选) - 用于指示 getItemsResponse 中数据范围的 JSON。JSON 对象中包含的 scope 键可接受值 rootchild。适用于层次结构数据。示例:
{
"scope": "root"
}
返回:JSON 对象,其中包含要显示在项列表网格中的消息。示例:
"INFO":{
{
"messages":[
"[[PTC.Nav.ItemList.HiddenItemsBecauseAccessRightMessage]]"
]
}
}
DefHookAttributesTypesInfo
返回 JSON 数组,其中包含“部件结构”支持的适配器信息和属性的对象类型。
参数:
返回:JSON 数组
GetChildren
接收部件或 CAD 文档,并返回 CCO 格式的 JSON,其中包含该项的子项,即层次数据结构中比该部件和 CAD 文档低一级的所有项。返回的 JSON 将以单级列表形式而非层次结构数据形式包含子项。
参数:
input (可选) - CCO 格式的 JSON,其中包含位于结构根节点处的部件或 CAD 文档的输入 ID。
configuration (必需) - 包含配置的 JSON。
item (必需) - JSON,其中包含要返回子项的父项。
返回:CCO 格式的 JSON
GetConfigurations
返回部件结构的可用配置。
参数:
返回:JSON
GetImplementationSettings
返回“部件结构”实施的设置数据。实施可通过改写此服务来提供其自己的设置。有关详情,请参阅有关项列表的 GetImplementationSettings 服务的其他信息 主题。
参数:
返回:JSON 对象
GetItems
返回在输入中指定的部件或 CAD 文档的结构。
参数:
input (必需) - CCO 格式的 JSON,其中包含要从后端系统获取的数据的输入 ID,以及后端系统的适配器信息。
configuration (必需) - JSON,其中包含从“定制管理器”资源获得的最终合并配置。
返回:CCO 格式的 JSON
GetItemsByExpansionPath
返回的层次结构 CCO 中包含路径上从根节点到所请求项的所有项,包括所有请求属性 itemIdentifierKeysitemExpansionKeys。层次结构 CCO 包括路径上的所有同级。
selectedItems 绑定特性接收到用来指定未加载项的输入时,将调用该服务。
参数:
input (可选) - CCO 格式的 JSON,其中包含位于结构根节点处的部件或 CAD 文档的输入 ID。
configuration (必需) - 包含配置的 JSON。
itemExpansionValues (必需) - JSON 数组,其中包含请求展开的部件或 CAD 文档的 itemExpansionKeys。数组值根据树中的路径排序,从根部件或 CAD 文档开始。
返回:CCO 格式的 JSON
GetStructureSkeleton
返回 CCO 格式的层次结构的所有层级,其中结构中的每个部件或 CAD 文档均包含 itemExpansionKeysGetImplementationSettings,如 itemIdentifierKeys 服务中所定义。
参数:
input (可选) - CCO 格式的 JSON,其中包含位于结构根节点处的部件或 CAD 文档的输入 ID。
configuration (必需) - 包含配置的 JSON。
返回:CCO 格式的 JSON
MapItemToInputObject
将部件结构项或 CAD 文档结构项映射到部件或 CAD 文档输入,随后此输入可供 GetItems 服务使用。
参数:
input (可选) - CCO 格式的 JSON,其中包含位于结构根节点处的部件或 CAD 文档的输入 ID。
item (必需) - JSON,其中包含要映射的部件或 CAD 文档。
返回:CCO 格式的 JSON,其中的单个部件或 CAD 文档仅包含 id 属性。
实施定义 
{
"array": [
{
"property": {},
"value": {
"initializationData": {
"version": "1.0.0",
"constraints": {},
"properties": {
"directDefinition": [
{
"property": {},
"value": {
"initializationData": {
"version": "1.0.0",
"constraints": {},
"properties": {}
},
"elementVersion": "1.0.0",
"elementName": "PTC.Nav.DynamicForm.Textbox"
},
"mandatory": false,
"key": "actionBarConfigurationJSON"
}
]
}
},
"elementVersion": "1.0.0",
"elementName": "PTC.Nav.DynamicForm.DefinitionGroup"
},
"mandatory": false,
"key": "actionBarConfiguration"
},
{
"property": {},
"value": {
"initializationData": {
"version": "1.0.0",
"constraints": {},
"properties": {
"additionalDefinition": [
{
"directDefinition": [
{
"property": {},
"value": {
"initializationData": {
"version": "1.0.0",
"constraints": {},
"properties": {}
},
"elementVersion": "1.0.0",
"elementName": "PTC.Nav.DynamicForm.Textbox"
},
"mandatory": false,
"key": "fieldTitleOverride"
}
],
"key": "itemListAttributesDefinition"
},
{
"directDefinition": [],
"key": "implementationAttributesDefinition"
}
],
"updateServiceName": "",
"minimumSelectedAttributes": null,
"supportedTypes": {
"data": [
{
"itemListsData": [
{
"selectionGroupIds": [
"PSI"
],
"objectType": "PTC.ProdMgmt.PartStructureItem"
},
{
"selectionGroupIds": [
"CS"
],
"objectType": "PTC.CADDocumentMgmt.CADStructure"
}
],
"adapter": {
"instanceName": "windchill",
"thingName": "PTC.WCAdapter"
}
}
],
"allowSubsetForTailoring": false
},
"addServiceName": "",
"maximumSelectedAttributes": null
}
},
"elementVersion": "1.0.0",
"elementName": "PTC.Nav.DynamicForm.AttributesSelector"
},
"mandatory": true,
"key": "attributes"
},
{
"property": {},
"value": {
"initializationData": {
"version": "1.0.0",
"constraints": {},
"properties": {
"options": [
{
"label": "-1",
"key": "-1"
},
{
"label": "1",
"key": "1"
},
{
"label": "2",
"key": "2"
},
{
"label": "3",
"key": "3"
},
{
"label": "4",
"key": "4"
},
{
"label": "5",
"key": "5"
},
{
"label": "6",
"key": "6"
},
{
"label": "7",
"key": "7"
},
{
"label": "8",
"key": "8"
},
{
"label": "9",
"key": "9"
}
],
"updateServiceName": null,
"addServiceName": null
}
},
"elementVersion": "1.0.0",
"elementName": "PTC.Nav.DynamicForm.Dropdown"
},
"mandatory": false,
"key": "defaultExpansionLevel"
},
{
"property": {},
"value": {
"initializationData": {
"version": "1.0.0",
"constraints": {},
"properties": {
"additionalDefinition": [
{
"directDefinition": [
{
"property": {},
"value": {
"initializationData": {
"version": "1.0.0",
"constraints": {},
"properties": {
"options": [
{
"description": "Sort column in ascending order",
"label": "[[PTC.Nav.ItemList.SortOrder.Asc]]",
"key": "asc"
},
{
"description": "Sort column in descending order",
"label": "[[PTC.Nav.ItemList.SortOrder.Dsc]]",
"key": "dsc"
}
],
"updateServiceName": null,
"addServiceName": null
}
},
"elementVersion": "1.0.0",
"elementName": "PTC.Nav.DynamicForm.RadioButton"
},
"mandatory": false,
"key": "defaultSortDirection"
}
],
"key": "itemListDefaultSortFieldDefinition"
}
],
"updateServiceName": "",
"minimumSelectedAttributes": null,
"supportedTypes": {
"data": [
{
"itemListsData": [
{
"selectionGroupIds": [
"PSI"
],
"objectType": "PTC.ProdMgmt.PartStructureItem"
},
{
"selectionGroupIds": [
"CS"
],
"objectType": "PTC.CADDocumentMgmt.CADStructure"
}
],
"adapter": {
"instanceName": "windchill",
"thingName": "PTC.WCAdapter"
}
}
],
"allowSubsetForTailoring": false
},
"addServiceName": "",
"maximumSelectedAttributes": null
}
},
"elementVersion": "1.0.0",
"elementName": "PTC.Nav.DynamicForm.AttributesSelector"
},
"mandatory": false,
"key": "defaultSortFields"
},
{
"property": {},
"value": {
"initializationData": {
"version": "1.0.0",
"constraints": {},
"properties": {
"default": true,
"true": {
"additionalDefinition": [
{
"directDefinition": [
{
"property": {},
"value": {
"initializationData": {
"version": "1.0.0",
"constraints": {},
"properties": {}
},
"elementVersion": "1.0.0",
"elementName": "PTC.Nav.DynamicForm.Textbox"
},
"mandatory": false,
"key": "searchHintText"
}
],
"key": "itemListSearchDefinition"
}
],
"label": "[[PTC.Nav.Yes]]"
},
"false": {
"additionalDefinition": [],
"label": "[[PTC.Nav.No]]"
}
}
},
"elementVersion": "1.0.0",
"elementName": "PTC.Nav.DynamicForm.Toggle"
},
"mandatory": false,
"key": "enableSearch"
},
{
"property": {},
"value": {
"initializationData": {
"version": "1.0.0",
"constraints": {},
"properties": {
"additionalDefinition": [
{
"directDefinition": [
{
"property": {},
"value": {
"initializationData": {
"version": "1.0.0",
"constraints": {},
"properties": {
"dynamicallySetTypeServiceName": "GetFilterTypeDefinitionForFilterField",
"type": {
"enum": {
"options": [],
"updateServiceName": null,
"dynamicallySetOptionsServiceName": null,
"addServiceName": null,
"multiSelect": null
}
}
}
},
"elementVersion": "1.0.0",
"elementName": "PTC.Nav.DynamicForm.FieldFilter"
},
"mandatory": false,
"key": "defaultSelectedFilterValues"
},
{
"property": {},
"value": {
"initializationData": {
"version": "1.0.0",
"constraints": {},
"properties": {}
},
"elementVersion": "1.0.0",
"elementName": "PTC.Nav.DynamicForm.Textbox"
},
"mandatory": false,
"key": "filterLabelOverride"
}
],
"key": "itemListFilterFieldDefinition"
}
],
"updateServiceName": "",
"minimumSelectedAttributes": 0,
"supportedTypes": {
"data": [
{
"itemListsData": [
{
"selectionGroupIds": [
"PSI"
],
"objectType": "PTC.ProdMgmt.PartStructureItem"
},
{
"selectionGroupIds": [
"CS"
],
"objectType": "PTC.CADDocumentMgmt.CADStructure"
}
],
"adapter": {
"instanceName": "windchill",
"thingName": "PTC.WCAdapter"
}
}
],
"allowSubsetForTailoring": false
},
"addServiceName": "",
"maximumSelectedAttributes": 1
}
},
"elementVersion": "1.0.0",
"elementName": "PTC.Nav.DynamicForm.AttributesSelector"
},
"mandatory": false,
"key": "filterFields"
},
{
"property": {},
"value": {
"initializationData": {
"version": "1.0.0",
"constraints": {},
"properties": {}
},
"elementVersion": "1.0.0",
"elementName": "PTC.Nav.DynamicForm.DefinitionGroup"
},
"mandatory": false,
"key": "implementationConfiguration"
},
{
"property": {},
"value": {
"initializationData": {
"version": "1.0.0",
"constraints": {},
"properties": {}
},
"elementVersion": "1.0.0",
"elementName": "PTC.Nav.DynamicForm.Textbox"
},
"mandatory": false,
"key": "label"
},
{
"property": {},
"value": {
"initializationData": {
"version": "1.0.0",
"constraints": {},
"properties": {
"minValue": 50,
"default": 500,
"maxValue": 10000,
"step": 50
}
},
"elementVersion": "1.0.0",
"elementName": "PTC.Nav.DynamicForm.Number"
},
"mandatory": false,
"key": "maxNumberOfRowsInGrid"
},
{
"property": {},
"value": {
"initializationData": {
"version": "1.0.0",
"constraints": {},
"properties": {
"options": [
{
"description": "Disallow items selection",
"label": "[[PTC.Nav.ItemList.SelectionType.None]]",
"key": "none"
},
{
"description": "Allow single item selection",
"label": "[[PTC.Nav.ItemList.SelectionType.Single]]",
"key": "single"
},
{
"description": "Allow multiple items selection",
"label": "[[PTC.Nav.ItemList.SelectionType.Multiple]]",
"key": "multi"
}
],
"updateServiceName": null,
"addServiceName": null
}
},
"elementVersion": "1.0.0",
"elementName": "PTC.Nav.DynamicForm.RadioButton"
},
"mandatory": false,
"key": "selectionType"
},
{
"property": {},
"value": {
"initializationData": {
"version": "1.0.0",
"constraints": {},
"properties": {
"default": true,
"true": {
"additionalDefinition": [
{
"directDefinition": [
{
"property": {
"options": [
[
{
"label": "[[PTC.Nav.ItemList.ExportCSVActionLabel]]",
"key": "exportToCsv"
},
{
"label": "[[PTC.Nav.ItemList.ExportCSVAsExcelActionLabel]]",
"key": "exportToExcel"
}
]
]
},
"value": {
"initializationData": {
"version": "1.0.0",
"constraints": {},
"properties": {
"default": "",
"overflow": null,
"minimumSelectedItems": null,
"options": [],
"updateServiceName": null,
"addServiceName": null,
"constraints": {}
}
},
"elementVersion": "1.0.0",
"elementName": "PTC.Nav.DynamicForm.CheckboxArray"
},
"mandatory": false,
"key": "exportTypes"
},
{
"property": {},
"value": {
"initializationData": {
"version": "1.0.0",
"constraints": {},
"properties": {
"default": false,
"true": {
"additionalDefinition": [],
"label": null
},
"false": {
"additionalDefinition": [],
"label": null
}
}
},
"elementVersion": "1.0.0",
"elementName": "PTC.Nav.DynamicForm.Toggle"
},
"mandatory": false,
"key": "exportUnFilteredData"
}
],
"key": "itemListExportDefinition"
}
],
"label": "[[PTC.Nav.Yes]]"
},
"false": {
"additionalDefinition": [],
"label": "[[PTC.Nav.No]]"
}
}
},
"elementVersion": "1.0.0",
"elementName": "PTC.Nav.DynamicForm.Toggle"
},
"mandatory": false,
"key": "showExportAction"
},
{
"property": {},
"value": {
"initializationData": {
"version": "1.0.0",
"constraints": {},
"properties": {
"default": false,
"true": {
"additionalDefinition": [],
"label": "[[PTC.Nav.Yes]]"
},
"false": {
"additionalDefinition": [],
"label": "[[PTC.Nav.No]]"
}
}
},
"elementVersion": "1.0.0",
"elementName": "PTC.Nav.DynamicForm.Toggle"
},
"mandatory": false,
"key": "waitForInput"
}
]
}
这对您有帮助吗?