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

feat: 刷新组态不出现问题

parent 6ed78a9d
......@@ -114,7 +114,7 @@ const ConfigurationView = (props) => {
const { devices = [], config, isZoom = false, flowShow = true, deviceName = [] } = props;
let devicesCode = [];
const globalConfig = window.globalConfig || config;
let isClose = useRef(false);
let isClose = false;
// 子应用包名查找
const widgets = queryProduct(globalConfig?.widgets || [], decodeURI(window.location.pathname));
const _JessibucaObj = {
......@@ -474,7 +474,7 @@ const ConfigurationView = (props) => {
/** *********************************MQTT请求数据回调****************************** */
const refreshData = (mqttDatas, code) => {
if (isClose.current || !myDiagram) return false;
if (isClose || !myDiagram) return false;
const bindList = bindData.find((item) => {
return item.code === code;
});
......@@ -687,7 +687,7 @@ const ConfigurationView = (props) => {
let timer;
const stime = +new Date();
const myLoop = () => {
if (isClose.current) return timer && cancelAnimationFrame(timer);
if (isClose) return timer && cancelAnimationFrame(timer);
const etime = +new Date();
if (stime + delay <= etime) {
fn();
......@@ -707,7 +707,7 @@ const ConfigurationView = (props) => {
let etime;
let myLoop = () => {
etime = +new Date();
if (isClose.current) return timer && cancelAnimationFrame(timer);
if (isClose) return timer && cancelAnimationFrame(timer);
timer = requestAnimationFrame(myLoop);
if (etime - stime >= interval) {
stime = etime = +new Date();
......@@ -884,6 +884,7 @@ const ConfigurationView = (props) => {
const url = globalConfig.mainserver ? globalConfig.mainserver : 'https://panda-water.cn/';
onlineMethod(`${url}civweb4/assets/images/bootPage/熊猫图标.png`, url);
return () => {
isClose = true;
mqttView && mqttView.disSaveWaconnect();
mqttView = null;
if (myDiagram) {
......@@ -894,13 +895,6 @@ const ConfigurationView = (props) => {
};
}, [props.name, numerals]);
useEffect(() => {
isClose.current = false;
return () => {
isClose.current = true;
}
}, []);
useEffect(() => {
if (!isModalVisible) {
modalConfirmFn = null;
......@@ -998,7 +992,7 @@ const ConfigurationView = (props) => {
});
setSpinning(false);
if (response.code === 0) {
if (isClose.current) return false;
if (isClose) return false;
const fromJson = response.data
? response.data
: {
......
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