@@ -3,6 +3,7 @@ import { Button, Typography, Card, Input, Space, Tooltip, Empty, Collapse } from
33import { InfoCircleOutlined , EditOutlined , SaveOutlined , CloseOutlined } from '@ant-design/icons'
44import { ObjectChat , ObjectNode as ObjectNodeType } from '../../../types'
55import { useAppContext } from '../../../store/AppContext'
6+ import PropertyTableEditor from './PropertyTableEditor'
67
78const { Title, Text } = Typography
89const { TextArea } = Input
@@ -71,6 +72,20 @@ const ObjectPropertyView: React.FC<ObjectPropertyViewProps> = ({ chatId }) => {
7172 setEditValue ( '' )
7273 }
7374
75+ // 保存属性
76+ const handlePropertiesSave = ( properties : { [ key : string ] : any } ) => {
77+ if ( ! selectedNode ) return
78+
79+ dispatch ( {
80+ type : 'UPDATE_OBJECT_NODE' ,
81+ payload : {
82+ chatId : chat . id ,
83+ nodeId : selectedNode . id ,
84+ updates : { properties }
85+ }
86+ } )
87+ }
88+
7489 // 格式化显示值
7590 const formatDisplayValue = ( value : any ) : string => {
7691 if ( value === null || value === undefined ) {
@@ -189,16 +204,15 @@ const ObjectPropertyView: React.FC<ObjectPropertyViewProps> = ({ chatId }) => {
189204 </ Card >
190205
191206 { /* 属性信息 */ }
192- { selectedNode . properties && Object . keys ( selectedNode . properties ) . length > 0 && (
193- < Card size = "small" style = { { marginBottom : '16px' } } >
194- < Title level = { 5 } style = { { margin : '0 0 12px 0' } } >
195- 属性信息
196- </ Title >
197- < div style = { { background : '#fafafa' , padding : '12px' , borderRadius : '4px' } } >
198- { renderPropertyItem ( '属性' , selectedNode . properties , 'properties' , true ) }
199- </ div >
200- </ Card >
201- ) }
207+ < Card size = "small" style = { { marginBottom : '16px' } } >
208+ < Title level = { 5 } style = { { margin : '0 0 12px 0' } } >
209+ 属性信息
210+ </ Title >
211+ < PropertyTableEditor
212+ properties = { selectedNode . properties || { } }
213+ onSave = { handlePropertiesSave }
214+ />
215+ </ Card >
202216
203217 { /* 元数据 */ }
204218 { selectedNode . metadata && (
0 commit comments