Commit d4be2158 authored by 李纪文's avatar 李纪文

fix: 组态增加图片模型、功能跳转方法

parent cec7238f
...@@ -541,6 +541,10 @@ const ConfigurationView = (props) => { ...@@ -541,6 +541,10 @@ const ConfigurationView = (props) => {
onlineMethod(`${url}civweb4/assets/images/bootPage/熊猫图标.png`, url); onlineMethod(`${url}civweb4/assets/images/bootPage/熊猫图标.png`, url);
return () => { return () => {
isClose = true; isClose = true;
if (myDiagram) {
myDiagram.div = null;
myDiagram = null;
}
}; };
}, []); }, []);
...@@ -791,8 +795,10 @@ const ConfigurationView = (props) => { ...@@ -791,8 +795,10 @@ const ConfigurationView = (props) => {
/** **************************************跳转方法****************************************** */ /** **************************************跳转方法****************************************** */
const menuJumpMethod = (node) => { const menuJumpMethod = (node) => {
const list = querySkipUrl(globalConfig?.widgets || [], node?.widget || ''); const opRule = JSON.parse(data.opRule);
if (!list || !node?.widget) return false; const widget = opRule && opRule.widget ? opRule.widget : '';
const list = querySkipUrl(globalConfig?.widgets || [], widget);
if (!list || !widget) return false;
window.history.pushState({}, null, `/civbase/${list.product || 'civweb4'}/${list.url}`); window.history.pushState({}, null, `/civbase/${list.product || 'civweb4'}/${list.url}`);
}; };
......
...@@ -97,6 +97,7 @@ const ConfigurationView = (props) => { ...@@ -97,6 +97,7 @@ const ConfigurationView = (props) => {
const [spinning, setSpinning] = useState(true); // 画板loading const [spinning, setSpinning] = useState(true); // 画板loading
const [isEmpty, setIsEmpty] = useState(false); // 画板无数据状态 const [isEmpty, setIsEmpty] = useState(false); // 画板无数据状态
const [description, setDescription] = useState(''); // 画板无数据描述 const [description, setDescription] = useState(''); // 画板无数据描述
const [first, setFirst] = useState(true); // 第一次加载
twoID = `TDG${Date.now().toString(36)}`; twoID = `TDG${Date.now().toString(36)}`;
const AdjustControlInput = useRef(); const AdjustControlInput = useRef();
...@@ -665,14 +666,17 @@ const ConfigurationView = (props) => { ...@@ -665,14 +666,17 @@ const ConfigurationView = (props) => {
/** ************************************联网判断******************************* */ /** ************************************联网判断******************************* */
const onlineMethod = (pathImg, url) => { const onlineMethod = (pathImg, url) => {
if (!first) return getConfiguraList();
const ImgObj = new Image(); const ImgObj = new Image();
ImgObj.src = pathImg; ImgObj.src = pathImg;
ImgObj.onload = () => { ImgObj.onload = () => {
online = ImgObj.fileSize > 0 || (ImgObj.width > 0 && ImgObj.height > 0); online = ImgObj.fileSize > 0 || (ImgObj.width > 0 && ImgObj.height > 0);
setFirst(false);
getConfiguraList(); getConfiguraList();
}; };
ImgObj.onerror = () => { ImgObj.onerror = () => {
online = false; online = false;
setFirst(false);
getConfiguraList(); getConfiguraList();
}; };
}; };
...@@ -690,8 +694,12 @@ const ConfigurationView = (props) => { ...@@ -690,8 +694,12 @@ const ConfigurationView = (props) => {
isClose = true; isClose = true;
mqttView && mqttView.disSaveWaconnect(); mqttView && mqttView.disSaveWaconnect();
mqttView = null; mqttView = null;
if (myDiagram) {
myDiagram.div = null;
myDiagram = null;
}
}; };
}, []); }, [props.name, props.devices]);
useEffect(() => { useEffect(() => {
if (!isModalVisible) { if (!isModalVisible) {
...@@ -1166,9 +1174,11 @@ const ConfigurationView = (props) => { ...@@ -1166,9 +1174,11 @@ const ConfigurationView = (props) => {
}; };
/** **************************************跳转方法****************************************** */ /** **************************************跳转方法****************************************** */
const menuJumpMethod = (node) => { const menuJumpMethod = (data) => {
const list = querySkipUrl(globalConfig?.widgets || [], node?.widget || ''); const opRule = JSON.parse(data.opRule);
if (!list || !node?.widget) return false; const widget = opRule && opRule.widget ? opRule.widget : '';
const list = querySkipUrl(globalConfig?.widgets || [], widget);
if (!list || !widget) return false;
window.history.pushState({}, null, `/civbase/${list.product || 'civweb4'}/${list.url}`); window.history.pushState({}, null, `/civbase/${list.product || 'civweb4'}/${list.url}`);
}; };
......
import React from 'react'; import React, { useState } from 'react';
import { Button } from 'antd';
import PandaConfiguration from '../index'; import PandaConfiguration from '../index';
// import PandaConfigurationView from '../../es/index'; // import PandaConfigurationView from '../../es/index';
const Demo = () => { const Demo = () => {
const [name, setName] = useState('水厂工艺流程段');
const [devices, setDevices] = useState(
'EQZT00000008,EQZT00000007,CPDA00000001,JYBZ00000003,JYBZ00000005,JYBZ00000004,SC00000003',
);
return ( return (
<div style={{ width: '100%', height: '600px', background: '#242835' }}> <>
<PandaConfiguration <div style={{ width: '100%', height: '600px', background: '#242835' }}>
name={'水厂工艺流程段'} <PandaConfiguration
devices={'EQZT00000008,EQZT00000007,CPDA00000001,JYBZ00000003,JYBZ00000005,JYBZ00000004,SC00000003'.split( name={name}
',', devices={devices.split(',')}
)} // name={'崇左丽江水厂原水泵房'}
// name={'崇左丽江水厂原水泵房'} // devices={'EQZT00000007,CPBA00000001,CPAA00000001,EQZT00000008,CPDA00000001,CPAD00000001,LJSC00000002,EQZT00000005,EQZT00000004,EQZT00000002,EQZT00000003'.split(
// devices={'EQZT00000007,CPBA00000001,CPAA00000001,EQZT00000008,CPDA00000001,CPAD00000001,LJSC00000002,EQZT00000005,EQZT00000004,EQZT00000002,EQZT00000003'.split( // ',',
// ',', // )}
// )} // name={'丽江水厂原水提升泵D单元'}
// name={'丽江水厂原水提升泵D单元'} // devices={'CPAA00000001, CPAD00000001, LJSC00000002'.split(',')}
// devices={'CPAA00000001, CPAD00000001, LJSC00000002'.split(',')} config={globalConfig}
config={globalConfig} deviceName={['工艺流程1', '工艺流程2', '工艺流程3']}
deviceName={['工艺流程1', '工艺流程2', '工艺流程3']} // isZoom={true}
// isZoom={true} // flowShow={false}
// flowShow={false} />
/> </div>
</div> <Button
onClick={() => {
setName('崇左丽江水厂原水泵房');
setDevices(
'EQZT00000007,CPBA00000001,CPAA00000001,EQZT00000008,CPDA00000001,CPAD00000001,LJSC00000002,EQZT00000005,EQZT00000004,EQZT00000002,EQZT00000003',
);
}}
style={{ margin: '10px' }}
>
改变组态名称
</Button>
</>
); );
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment