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

fix: 组态兼容V1前

parent 730a995b
......@@ -591,7 +591,7 @@ const ConfigurationView = (props) => {
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);
} else {
message.error(response.msg);
......@@ -614,7 +614,7 @@ const ConfigurationView = (props) => {
});
return {
deviceType: list.type,
sensors: sensors.join(','),
sensors: Array.from(new Set(sensors)).join(','),
deviceCode: list.code,
};
});
......@@ -817,7 +817,7 @@ const ConfigurationView = (props) => {
};
/** **********************************画布渲染************************************ */
const diagramRender = (jsonStr) => {
const diagramRender = (jsonStr, chartInfo) => {
myDiagram = goJS(
go.Diagram,
twoID, // must name or refer to the DIV HTML element
......@@ -1919,6 +1919,12 @@ const ConfigurationView = (props) => {
});
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);
};
......
......@@ -756,7 +756,7 @@ const ConfigurationView = (props) => {
controlback: controlData,
})
: null;
diagramRender(typeof fromJson === 'string' ? fromJson : JSON.stringify(fromJson));
diagramRender(typeof fromJson === 'string' ? fromJson : JSON.stringify(fromJson), list);
try {
mqttView && mqttView.saveWaterMqtt();
} catch (e) {
......@@ -1232,7 +1232,7 @@ const ConfigurationView = (props) => {
};
/** **********************************画布渲染************************************ */
const diagramRender = (jsonStr) => {
const diagramRender = (jsonStr, chartInfo) => {
myDiagram = goJS(
go.Diagram,
twoID, // must name or refer to the DIV HTML element
......@@ -2372,6 +2372,12 @@ const ConfigurationView = (props) => {
});
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);
};
......
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