|
@@ -26,25 +26,31 @@ const Cat = observer((props: Props) => {
|
|
|
const [value, setValue] = useState(metadata);
|
|
const [value, setValue] = useState(metadata);
|
|
|
const _path = location.pathname.split('/');
|
|
const _path = location.pathname.split('/');
|
|
|
const id = _path[_path.length - 1];
|
|
const id = _path[_path.length - 1];
|
|
|
|
|
+
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
service.codecs().subscribe({
|
|
service.codecs().subscribe({
|
|
|
next: (data) => {
|
|
next: (data) => {
|
|
|
setCodecs([{ id: 'jetlinks', name: 'jetlinks' }].concat(data));
|
|
setCodecs([{ id: 'jetlinks', name: 'jetlinks' }].concat(data));
|
|
|
},
|
|
},
|
|
|
});
|
|
});
|
|
|
-
|
|
|
|
|
if (props.type === 'device' && id) {
|
|
if (props.type === 'device' && id) {
|
|
|
instanceService.detail(id).then((resp) => {
|
|
instanceService.detail(id).then((resp) => {
|
|
|
if (resp.status === 200) {
|
|
if (resp.status === 200) {
|
|
|
InstanceModel.current = resp.result;
|
|
InstanceModel.current = resp.result;
|
|
|
const _metadata = resp.result?.metadata;
|
|
const _metadata = resp.result?.metadata;
|
|
|
|
|
+ console.log(_metadata, '11111');
|
|
|
setValue(_metadata);
|
|
setValue(_metadata);
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
}, [id]);
|
|
}, [id]);
|
|
|
|
|
|
|
|
|
|
+ useEffect(() => {
|
|
|
|
|
+ console.log(value, '22222');
|
|
|
|
|
+ }, [value]);
|
|
|
|
|
+
|
|
|
const convertMetadata = (key: string) => {
|
|
const convertMetadata = (key: string) => {
|
|
|
|
|
+ console.log(key);
|
|
|
if (key === 'alink') {
|
|
if (key === 'alink') {
|
|
|
setValue('');
|
|
setValue('');
|
|
|
if (metadata) {
|
|
if (metadata) {
|
|
@@ -55,6 +61,7 @@ const Cat = observer((props: Props) => {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
|
|
+ console.log(metadata, 'metadata');
|
|
|
setValue(metadata);
|
|
setValue(metadata);
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
@@ -62,7 +69,7 @@ const Cat = observer((props: Props) => {
|
|
|
<Drawer
|
|
<Drawer
|
|
|
maskClosable={false}
|
|
maskClosable={false}
|
|
|
title="查看物模型"
|
|
title="查看物模型"
|
|
|
- width={'40%'}
|
|
|
|
|
|
|
+ width={700}
|
|
|
onClose={() => props.close()}
|
|
onClose={() => props.close()}
|
|
|
visible={props.visible}
|
|
visible={props.visible}
|
|
|
extra={
|
|
extra={
|
|
@@ -92,11 +99,12 @@ const Cat = observer((props: Props) => {
|
|
|
<Tabs onChange={convertMetadata}>
|
|
<Tabs onChange={convertMetadata}>
|
|
|
{codecs?.map((item) => (
|
|
{codecs?.map((item) => (
|
|
|
<Tabs.TabPane tab={item.name} tabKey={item.id} key={item.id}>
|
|
<Tabs.TabPane tab={item.name} tabKey={item.id} key={item.id}>
|
|
|
- <div style={{ border: '1px solid #eee' }}>
|
|
|
|
|
|
|
+ <div style={{ border: '1px solid #eee', height: 670, width: 650 }}>
|
|
|
<MonacoEditor
|
|
<MonacoEditor
|
|
|
- height={670}
|
|
|
|
|
|
|
+ height={'100%'}
|
|
|
theme="vs"
|
|
theme="vs"
|
|
|
language="json"
|
|
language="json"
|
|
|
|
|
+ key={item.id}
|
|
|
value={value}
|
|
value={value}
|
|
|
editorDidMount={(editor) => {
|
|
editorDidMount={(editor) => {
|
|
|
editor.getAction('editor.action.formatDocument').run();
|
|
editor.getAction('editor.action.formatDocument').run();
|