Commit fe9c373d authored by 涂茜's avatar 涂茜

Merge branch 'fix/bug' into 'dev'

fix: bug See merge request !47
parents 68223663 34fb99e6
Pipeline #28729 passed with stages
in 5 minutes 5 seconds
......@@ -12,7 +12,7 @@ const Demo = () => {
const fetchData = (params = {}) => {
// eslint-disable-next-line no-use-before-define
request(`${baseUrl}/Publish/Monitor/Device/DeviceTree`, {
request(`${baseUrl}/Publish/GCK/Device/DeviceTree`, {
method: 'post',
data: {
pageIndex: 1,
......@@ -29,7 +29,7 @@ const Demo = () => {
// eslint-disable-next-line no-nested-ternary
const data = response.data
? response.data.list && response.data.list.length > 0
? response.data.list[0].DeviceList
? response.data.list[0].deviceList
: []
: [];
// eslint-disable-next-line no-use-before-define
......@@ -41,9 +41,9 @@ const Demo = () => {
// eslint-disable-next-line array-callback-return
data.map((item) => {
// eslint-disable-next-line no-param-reassign
item.title = item.DeviceName;
item.title = item.deviceName;
// eslint-disable-next-line no-param-reassign
item.key = item.StationID;
item.key = item.stationID;
// eslint-disable-next-line no-param-reassign
item.children = handleData(item.children);
});
......
......@@ -20,6 +20,20 @@
white-space: nowrap;
}
.ant-tree-treenode {
width: 100%;
}
.ant-tree-switcher-noop {
width: 14px;
}
.ant-tree-node-content-wrapper {
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
}
&-content {
flex: 1;
overflow-y: scroll;
......
......@@ -20,25 +20,25 @@ const Demo = () => {
}, []);
const fetchData = (params = {}) => {
request(baseUrl + '/Publish/Monitor/Device/SensorsDataForStation', {
request(baseUrl + '/PandaCore/Monitor/Device/SensorsDataForStation', {
method: 'post',
data: params,
}).then((res) => {
let resData = res.data;
let columnsData = resData.map((item, index) => {
return {
title: `${item.EquipmentName}-${item.sensorName}${
title: `${item.equipmentName}-${item.sensorName}${
item.unit ? '(' + item.unit + ')' : ''
}`,
dataIndex: `value${index + 1}`,
key: `value${index + 1}`,
};
});
let tableData = resData[0].dataModel.map((item, index) => ({ key: index, time: item.PT }));
let tableData = resData[0].dataModel.map((item, index) => ({ key: index, time: item.pt }));
tableData.forEach((item, i) => {
resData.forEach((child, index) => {
child.dataModel.forEach((value, j) => {
if (i === j) item[`value${index + 1}`] = value.PV;
if (i === j) item[`value${index + 1}`] = value.pv;
});
});
});
......@@ -54,10 +54,10 @@ const Demo = () => {
resData.forEach((item) => {
let data = [];
item.dataModel.forEach((child) => {
data.push([moment(child.PT).valueOf(), child.PV]);
data.push([moment(child.pt).valueOf(), child.pv]);
});
let obj = {
name: item.EquipmentName + item.sensorName,
name: item.equipmentName + item.sensorName,
sensorName: item.sensorName,
decimalPoint: item.decimalPoint,
unit: item.unit,
......
......@@ -9,7 +9,7 @@ const Demo = () => {
const [selectData, setSelectData] = useState([]);
const fetchData = () => {
request(baseUrl + '/Publish/Monitor/Device/GetQuotaList', {
request(baseUrl + '/Publish/GCK/Device/GetQuotaList', {
method: 'get',
params: {
accountName: '二供泵房',
......
......@@ -10,7 +10,7 @@ const Demo = () => {
const [updateTime, setUpdateTime] = useState('');
const GetPointAddressEntry = (params = {}) => {
return request(baseUrl + '/Publish/Monitor/PointAddress/GetPointAddressEntry', {
return request(baseUrl + '/Publish/GCK/PointAddress/GetPointAddressEntry', {
method: 'get',
params: {
versionID: 4,
......@@ -19,14 +19,14 @@ const Demo = () => {
};
const GetSensorType = (params = {}) => {
return request(baseUrl + '/Publish/Monitor/Scada/GetSensorType', {
return request(baseUrl + '/Publish/GCK/Sensor/GetSensorType', {
method: 'get',
params: {},
});
};
const GetDeviceRealInfo = (params = {}) => {
return request(baseUrl + '/Publish/Monitor/Device/DeviceRealInfo', {
return request(baseUrl + '/Publish/GCK/Device/DeviceRealInfo', {
method: 'post',
data: {
userID: '1',
......@@ -44,33 +44,33 @@ const Demo = () => {
let data2 = await GetSensorType();
let data3 = await GetDeviceRealInfo();
setUpdateTime(data3.data.list[0].PT);
setGuid(data3.data.list[0].Child[0].GUID);
setGuid(data3.data.list[0].child[0].guid);
handleData(data1.data, data2.data, data3.data);
};
const handleData = (data1 = [], data2 = [], data3 = []) => {
let newData = data1.map((item, index) => {
return {
id: item.ID,
key: item.ID,
id: item.id,
key: item.id,
index: index + 1,
name: item.Name,
value: 0,
unit: '--',
type: '--',
time: data3.list[0].PT,
time: data3.list[0].pt,
...item,
};
});
newData.forEach((item) => {
let curData1 = data2.filter((child) => child.ID == item.SensorTypeID);
let curData2 = data3.list[0].DataList.filter((child) => child.PAID == item.ID);
let curData1 = data2.filter((child) => child.id == item.sensorTypeID);
let curData2 = data3.list[0].dataList.filter((child) => child.paid == item.id);
if (curData1.length) {
item.unit = curData1[0].Unit || '--';
item.type = curData1[0].Name || '--';
item.unit = curData1[0].unit || '--';
item.type = curData1[0].name || '--';
}
if (curData2.length) {
item.value = curData2[0].PV || '--';
item.value = curData2[0].pv || '--';
}
});
setData(newData);
......
......@@ -305,7 +305,7 @@ const QuotaSelect = ({
return (
<div className={classNames(prefixCls)}>
<div className={classNames(`${prefixCls}-btn-wrap`)}>
{deviceList.length &&
{!!deviceList.length &&
deviceList.map((item, index) => (
<Button
key={index}
......
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