|
@ -18,7 +18,7 @@ const Network = ({ |
|
|
const [projectList, setProjectList] = useState([]) //项目列表 |
|
|
const [projectList, setProjectList] = useState([]) //项目列表 |
|
|
const [projectValue, setProjectValue] = useState() //选中的项目 |
|
|
const [projectValue, setProjectValue] = useState() //选中的项目 |
|
|
const [thingId, setThingId] = useState() //结构物thingId |
|
|
const [thingId, setThingId] = useState() //结构物thingId |
|
|
|
|
|
const [spinning, setSpinning] = useState(true) |
|
|
const form = useRef();//表单 |
|
|
const form = useRef();//表单 |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -59,6 +59,21 @@ const Network = ({ |
|
|
} |
|
|
} |
|
|
}, [organizationsStruc]) |
|
|
}, [organizationsStruc]) |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
|
// 获取iframe元素 |
|
|
|
|
|
const iframe = document.getElementById('myIframe'); |
|
|
|
|
|
console.log(4324, iframe); |
|
|
|
|
|
if (iframe) { |
|
|
|
|
|
// 监听iframe的load事件 |
|
|
|
|
|
iframe.addEventListener('load', function () { |
|
|
|
|
|
console.log('IFrame is loaded'); |
|
|
|
|
|
setSpinning(false) |
|
|
|
|
|
// 在这里可以执行一些处理,表示iframe加载完毕 |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}, []) |
|
|
|
|
|
|
|
|
return ( |
|
|
return ( |
|
|
<> |
|
|
<> |
|
|
<div style={{ background: '#FFFFFF', margin: '8px 12px', padding: '20px 20px 0px 20px', height: clientHeight - 72, display: 'flex', flexDirection: 'column' }}> |
|
|
<div style={{ background: '#FFFFFF', margin: '8px 12px', padding: '20px 20px 0px 20px', height: clientHeight - 72, display: 'flex', flexDirection: 'column' }}> |
|
@ -87,6 +102,7 @@ const Network = ({ |
|
|
optionList={projectList || []} |
|
|
optionList={projectList || []} |
|
|
onSelect={v => { |
|
|
onSelect={v => { |
|
|
setProjectValue(v) |
|
|
setProjectValue(v) |
|
|
|
|
|
setSpinning(true) |
|
|
form.current.setValue('projectId', v) |
|
|
form.current.setValue('projectId', v) |
|
|
}} |
|
|
}} |
|
|
/> |
|
|
/> |
|
@ -100,6 +116,7 @@ const Network = ({ |
|
|
showClear |
|
|
showClear |
|
|
optionList={organizationsStruc?.map(d => ({ value: d.thingId, label: d.strucName })) || []} |
|
|
optionList={organizationsStruc?.map(d => ({ value: d.thingId, label: d.strucName })) || []} |
|
|
onSelect={v => { |
|
|
onSelect={v => { |
|
|
|
|
|
setSpinning(true) |
|
|
setThingId(v) |
|
|
setThingId(v) |
|
|
form.current.setValue('thingId', v) |
|
|
form.current.setValue('thingId', v) |
|
|
}} |
|
|
}} |
|
@ -109,8 +126,14 @@ const Network = ({ |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div id='show' style={{ width: "100%", height: "calc(100% - 106px)" }}> |
|
|
|
|
|
|
|
|
<Spin |
|
|
|
|
|
// style={{ }} |
|
|
|
|
|
childStyle={{ width: "100%", height: clientHeight - 188 }} |
|
|
|
|
|
spinning={spinning}> |
|
|
|
|
|
<div id='show' style={{ width: "100%", height: "100%" }}> |
|
|
<iframe |
|
|
<iframe |
|
|
|
|
|
id="myIframe" |
|
|
style={{ |
|
|
style={{ |
|
|
width: '100%', |
|
|
width: '100%', |
|
|
height: '100%', |
|
|
height: '100%', |
|
@ -121,9 +144,11 @@ const Network = ({ |
|
|
> |
|
|
> |
|
|
<p>你的浏览器不支持 iframe 。</p> |
|
|
<p>你的浏览器不支持 iframe 。</p> |
|
|
</iframe> |
|
|
</iframe> |
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
</Spin> |
|
|
|
|
|
|
|
|
{/* <div id='show' style={{ width: "100%", height: "calc(100% - 106px)" }}> |
|
|
{/* <div id='show' style={{ width: "100%", height: "calc(100% - 106px)" }}> |
|
|
<div style={{ |
|
|
<div style={{ |
|
|
display: "flex", alignItems: 'center', justifyContent: "space-between", |
|
|
display: "flex", alignItems: 'center', justifyContent: "space-between", |
|
|