onClickThreshold(record)}
/>
),
},
{
title: '状态',
dataIndex: 'Status',
render: (Status) => {
switch (Status) {
case -1:
case 0:
return (
正常
);
case 1:
return (
异常
);
case 2:
return (
警告
);
}
},
},
];
const handleClickItem = (data) => {
if (!isSensor) {
onClickItem(`DeviceTable-${data.Id}`, {
type: data.Status,
deviceCode: data.DeviceCode,
});
} else {
onClickItem(`DeviceTable-${data.Id}`, {
// type: data.Status,
deviceCode: data.DeviceCode,
value: Number(data.Value || 0),
threshold: data.JsonNumThreshold,
});
UnityAction.sendMsg('SinglePowerEnvironFromWeb', JSON.stringify(data));
}
};
if (!isSensor) {
columns.push({
title: '操作',
render: (record) =>
record.Status == 1 && (
onClickError(record)}>
异常处理
),
});
}
useEffect(() => {
if (isSensor)
UnityAction.sendMsg('PowerEnvironsFromWeb', JSON.stringify(items));
}, [items]);
return (
,
}}
pagination={false}
/>
setVisible(false)}
/>
setErrVisible(false)}
onOk={handleError}
/>
);
}
function ReportCom(props) {
const {
sendMessageToUnity,
select,
waringData = [],
allData = [],
userList,
type,
title,
data,
} = props;
const [activeKey, setActiveKey] = useState('1');
const handleTabsChange = (activeKey) => {
setActiveKey(activeKey);
};
return (
{title}
,
},
{
key: '2',
label: `全部(${allData.length || 0})`,
children:
,
},
]}
>
{activeKey == '1' && (
)}
{activeKey == '2' && (
)}
);
}
export function LiquidTable(props) {
const { onClickItem, data = {}, items, select, type } = props;
const { ProjectId, Id } = data;
const [loading, setLoading] = useState(false);
const [currentItem, setCurrentItem] = useState({});
const columns = [
{
title: '设备名称',
width: '25%',
dataIndex: 'device_name',
},
{
title: '液位数',
width: '20%',
dataIndex: 'origin_value',
},
{
title: '差值',
width: '16%',
dataIndex: 'value',
},
{
title: '设定值范围',
width: '30%',
render: (record) => (
),
},
{
title: '状态',
dataIndex: 'status',
render: (status) => {
switch (status) {
case -1:
case 0:
return (
正常
);
case 1:
return (
异常
);
case 2:
return (
警告
);
}
},
},
];
const handleClickItem = (data) => {
onClickItem(`DeviceTable-${data.device_code}`, {
type: data.status,
deviceCode: data.device_code,
});
};
return (
,
}}
pagination={false}
/>
);
}
function LiquidLevelCom(props) {
const { sendMessageToUnity, select, allData = [], type, title } = props;
const [activeKey, setActiveKey] = useState('1');
const errorData = useMemo(() => {
const errorData = allData?.filter((item) => item.status);
return errorData;
}, [allData]);
const handleTabsChange = (activeKey) => {
setActiveKey(activeKey);
};
return (
{title}
,
},
{
key: '2',
label: `全部(${allData?.length || 0})`,
children:
,
},
]}
>
{activeKey == '1' && (
)}
{activeKey == '2' && (
)}
//
// {title}
}
// onChange={handleTabsChange}
// >
//
// {activeKey == '1' && (
//
// )}
//
//
// {activeKey == '2' && (
//
// )}
//
//
//
);
}
function FlowTable(props) {
const { onClickItem, data = {}, items } = props;
const columns = [
{
title: '设备名称',
width: '20%',
dataIndex: 'device_name',
},
{
title: '实际流量',
width: '20%',
dataIndex: 'origin_value',
},
{
title: '计量流量',
width: '16%',
dataIndex: 'value',
},
{
title: '差值',
width: '15%',
dataIndex: 'value',
},
{
title: '设定值范围',
width: '30%',
render: (record) => (
),
},
{
title: '状态',
dataIndex: 'status',
render: (status) => {
switch (status) {
case -1:
case 0:
return (
正常
);
case 1:
return (
异常
);
case 2:
return (
警告
);
}
},
},
];
const handleClickItem = (data) => {
onClickItem(`DeviceTable-${data.device_code}`, {
type: data.status,
deviceCode: data.device_code,
});
};
return (
,
}}
pagination={false}
/>
);
}
function FlowCom(props) {
const { sendMessageToUnity, select, allData = [], type, title } = props;
const [activeKey, setActiveKey] = useState('1');
const errorData = useMemo(() => {
const errorData = allData?.filter((item) => item.status);
return errorData;
}, [allData]);
const handleTabsChange = (activeKey) => {
setActiveKey(activeKey);
};
return (
{title}
,
},
{
key: '2',
label: `全部(${allData?.length || 0})`,
children:
,
},
]}
>
{activeKey == '1' && (
)}
{activeKey == '2' && (
)}
);
}
function ReportDumCom(props) {
const { data = [], title } = props;
const columns = [
{
title: '报警时间',
dataIndex: 'event_time',
render: (time) => dayjs(time).format('YYYY-MM-DD HH:mm:ss'),
},
{
title: '设备名称',
dataIndex: 'device_name',
},
{
title: '报警类型',
dataIndex: 'event_type',
// render: type => alarmType[type],
},
{
title: '报警图片',
render: (item) => (
),
},
];
return (
,
}}
pagination={false}
/>
);
}
function base64ToImageUrl(base64String) {
const byteCharacters = atob(base64String);
const byteArrays = [];
for (let i = 0; i < byteCharacters.length; i++) {
byteArrays.push(byteCharacters.charCodeAt(i));
}
const byteArray = new Uint8Array(byteArrays);
const blob = new Blob([byteArray], { type: 'image/png' });
const imageUrl = URL.createObjectURL(blob);
return imageUrl;
}
function Empty() {
return (
自检正常
);
}
export default connect(({ eqSelfInspection }) => ({
userList: eqSelfInspection.userList,
mandateInfo: eqSelfInspection.mandateInfo,
}))(Detail);