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: '20%',
dataIndex: 'device_name',
},
{
title: '类型',
key: 'template_item_name',
dataIndex: 'template_item_name',
},
{
title: '液位数',
width: '20%',
dataIndex: 'origin_value',
},
{
title: '差值',
width: '16%',
dataIndex: 'value',
},
{
title: '设定值范围',
width: '25%',
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' && (
)}
);
}
function DosingFlowTable(props) {
const { onClickItem, data = {}, items } = props;
const columns = [
{
title: '设备名称',
width: '1.5rem',
dataIndex: 'device_name',
},
{
title: '类型',
key: 'template_item_name',
dataIndex: 'template_item_name',
},
{
title: '实际流量',
dataIndex: 'origin_value',
},
{
title: '计量流量',
dataIndex: 'value',
},
{
title: '差值/比值',
dataIndex: 'value',
},
{
title: '设定值范围',
width: '20%',
render: (record) => (
),
},
{
title: '状态',
dataIndex: 'status',
width: '1.25rem',
render: (status) => {
switch (status) {
case -1:
case 0:
return (
正常
);
case 1:
return (
异常
);
case 2:
return (
警告
);
default:
return null;
}
},
},
];
const handleClickItem = (data) => {
onClickItem(`DeviceTable-${data.device_code}`, {
type: data.status,
deviceCode: data.device_code,
});
};
return (
,
}}
pagination={false}
/>
);
}
function DosingFlowCom(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 = (key) => {
setActiveKey(key);
};
return (
{title}
,
},
{
key: '2',
label: `全部(${allData?.length || 0})`,
children:
,
},
]}
>
{activeKey === '1' && (
)}
{activeKey === '2' && (
)}
);
}
function WaterInTable(props) {
const { onClickItem, data = {}, items } = props;
const columns = [
{
title: '设备名称',
width: '20%',
dataIndex: 'item_alias',
},
{
title: '差值',
// width: '15%',
dataIndex: 'current_val',
},
{
title: '时间',
// width: '15%',
dataIndex: 'create_time',
render: (text) => {
if (text) {
return dayjs(text).format('HH:mm:ss');
}
return '-';
},
},
{
title: '设定值范围',
width: '30%',
render: (record) => (
),
},
{
title: '状态',
dataIndex: 'status',
width: '1.25rem',
render: (status) => {
switch (status) {
case -1:
case 0:
return (
正常
);
case 1:
return (
异常
);
case 2:
return (
警告
);
default:
return (
异常
);
}
},
},
];
const handleClickItem = (params) => {
onClickItem(`DeviceTable-${params.device_code}`, {
type: params.status,
deviceCode: params.device_code,
});
};
return (
,
}}
pagination={false}
/>
);
}
function WaterInCom(props) {
const { sendMessageToUnity, select, allData = [], title } = props;
const [activeKey, setActiveKey] = useState('1');
const errorData = useMemo(() => {
const tempData = allData?.filter((item) => item.status);
return tempData;
}, [allData]);
const handleTabsChange = (key) => {
setActiveKey(key);
};
return (
{title}
,
},
{
key: '2',
label: `全部(${allData?.length || 0})`,
children:
,
},
]}
>
{activeKey === '1' && (
)}
{activeKey === '2' && (
)}
);
}
function PressureGaugeTable(props) {
const { onClickItem, data = {}, items } = props;
const columns = [
{
title: '设备名称',
width: '15%',
dataIndex: 'item_alias',
},
{
title: '时间范围',
key: 'dataRange',
width: '1.5rem',
render: (record) => {
if (record.query_start && record.query_end) {
return (
<>
{dayjs(record.query_start).format('HH:mm:ss')}
{dayjs(record.query_end).format('HH:mm:ss')}
>
);
}
return '-';
},
},
{
title: '仪表最小数',
width: '2rem',
dataIndex: 'data_min',
},
{
title: '仪表最大数',
width: '2rem',
dataIndex: 'data_max',
},
{
title: '可能原因',
dataIndex: 'content',
},
{
title: '状态',
dataIndex: 'status',
width: '1.25rem',
render: (status) => {
switch (status) {
case -1:
case 0:
return (
正常
);
case 1:
return (
异常
);
case 2:
return (
警告
);
default:
return (
异常
);
}
},
},
];
const handleClickItem = (params) => {
onClickItem(`DeviceTable-${params.device_code}`, {
type: params.status,
deviceCode: params.device_code,
});
};
return (
,
}}
pagination={false}
/>
);
}
function PressureGaugeCom(props) {
const { sendMessageToUnity, select, allData = [], title } = props;
const [activeKey, setActiveKey] = useState('2');
const errorData = useMemo(() => {
const tempData = allData?.filter((item) => item.status);
return tempData;
}, [allData]);
const handleTabsChange = (key) => {
setActiveKey(key);
};
return (
{activeKey === '2' && (
)}
);
}
function WaterQualityTable(props) {
const { onClickItem, data = {}, items } = props;
const columns = [
{
title: '设备名称',
width: '15%',
dataIndex: 'item_alias',
},
{
title: '时间范围',
key: 'dataRange',
width: '1.5rem',
render: (record) => {
if (record.query_start && record.query_end) {
return (
<>
{dayjs(record.query_start).format('HH:mm:ss')}
{dayjs(record.query_end).format('HH:mm:ss')}
>
);
}
return '-';
},
},
{
title: '仪表最小数',
width: '2rem',
dataIndex: 'data_min',
},
{
title: '仪表最大数',
width: '2rem',
dataIndex: 'data_max',
},
{
title: '可能原因',
dataIndex: 'content',
},
{
title: '状态',
dataIndex: 'status',
width: '1.25rem',
render: (status) => {
switch (status) {
case -1:
case 0:
return (
正常
);
case 1:
return (
异常
);
case 2:
return (
警告
);
default:
return (
异常
);
}
},
},
];
const handleClickItem = (params) => {
onClickItem(`DeviceTable-${params.device_code}`, {
type: params.status,
deviceCode: params.device_code,
});
};
return (
,
}}
pagination={false}
/>
);
}
function WaterQualityCom(props) {
const { sendMessageToUnity, select, allData = [], title } = props;
const [activeKey, setActiveKey] = useState('2');
const errorData = useMemo(() => {
const tempData = allData?.filter((item) => item.status);
return tempData;
}, [allData]);
const handleTabsChange = (key) => {
setActiveKey(key);
};
return (
{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);