Commit 44648b45 authored by 李纪文's avatar 李纪文

fix: 组态兼容V1前

parent 730a995b
...@@ -591,7 +591,7 @@ const ConfigurationView = (props) => { ...@@ -591,7 +591,7 @@ const ConfigurationView = (props) => {
type: siteInfo && siteInfo[name] ? siteInfo[name].Type : '', type: siteInfo && siteInfo[name] ? siteInfo[name].Type : '',
}); });
}); });
diagramRender(typeof fromJson === 'string' ? fromJson : JSON.stringify(fromJson)); diagramRender(typeof fromJson === 'string' ? fromJson : JSON.stringify(fromJson), list);
getHistoryData(true); getHistoryData(true);
} else { } else {
message.error(response.msg); message.error(response.msg);
...@@ -614,7 +614,7 @@ const ConfigurationView = (props) => { ...@@ -614,7 +614,7 @@ const ConfigurationView = (props) => {
}); });
return { return {
deviceType: list.type, deviceType: list.type,
sensors: sensors.join(','), sensors: Array.from(new Set(sensors)).join(','),
deviceCode: list.code, deviceCode: list.code,
}; };
}); });
...@@ -817,7 +817,7 @@ const ConfigurationView = (props) => { ...@@ -817,7 +817,7 @@ const ConfigurationView = (props) => {
}; };
/** **********************************画布渲染************************************ */ /** **********************************画布渲染************************************ */
const diagramRender = (jsonStr) => { const diagramRender = (jsonStr, chartInfo) => {
myDiagram = goJS( myDiagram = goJS(
go.Diagram, go.Diagram,
twoID, // must name or refer to the DIV HTML element twoID, // must name or refer to the DIV HTML element
...@@ -1919,6 +1919,12 @@ const ConfigurationView = (props) => { ...@@ -1919,6 +1919,12 @@ const ConfigurationView = (props) => {
}); });
if (device) item.text = device; if (device) item.text = device;
} }
// 兼容V1之前版本(部分展示可支持)
if (chartInfo.version === 'V1') return false;
item.shName = item.showName || '';
item.hbControl = item.authoControl || '否';
if (item.controlType === '开关展示') item.switch = '是';
if (item.category === 'valCase') item.shType = '值显示';
}); });
myDiagram.model = go.Model.fromJson(json); myDiagram.model = go.Model.fromJson(json);
}; };
......
...@@ -756,7 +756,7 @@ const ConfigurationView = (props) => { ...@@ -756,7 +756,7 @@ const ConfigurationView = (props) => {
controlback: controlData, controlback: controlData,
}) })
: null; : null;
diagramRender(typeof fromJson === 'string' ? fromJson : JSON.stringify(fromJson)); diagramRender(typeof fromJson === 'string' ? fromJson : JSON.stringify(fromJson), list);
try { try {
mqttView && mqttView.saveWaterMqtt(); mqttView && mqttView.saveWaterMqtt();
} catch (e) { } catch (e) {
...@@ -1232,7 +1232,7 @@ const ConfigurationView = (props) => { ...@@ -1232,7 +1232,7 @@ const ConfigurationView = (props) => {
}; };
/** **********************************画布渲染************************************ */ /** **********************************画布渲染************************************ */
const diagramRender = (jsonStr) => { const diagramRender = (jsonStr, chartInfo) => {
myDiagram = goJS( myDiagram = goJS(
go.Diagram, go.Diagram,
twoID, // must name or refer to the DIV HTML element twoID, // must name or refer to the DIV HTML element
...@@ -2372,6 +2372,12 @@ const ConfigurationView = (props) => { ...@@ -2372,6 +2372,12 @@ const ConfigurationView = (props) => {
}); });
if (device) item.text = device; if (device) item.text = device;
} }
// 兼容V1之前版本(部分展示可支持)
if (chartInfo.version === 'V1') return false;
item.shName = item.showName || '';
item.hbControl = item.authoControl || '否';
if (item.controlType === '开关展示') item.switch = '是';
if (item.category === 'valCase') item.shType = '值显示';
}); });
myDiagram.model = go.Model.fromJson(json); myDiagram.model = go.Model.fromJson(json);
}; };
......
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