|
@@ -3,8 +3,7 @@ import TabsContent from '@/components/TabsContent';
|
|
|
import ThresholdDetail from '@/components/ThresholdDetail';
|
|
|
import { UnityAction } from '@/utils/utils';
|
|
|
import { Collapse, Spin, Table, Tabs } from 'antd';
|
|
|
-import { useEffect, useState } from 'react';
|
|
|
-import ThresholdBar from './ThresholdBar';
|
|
|
+import { useEffect, useMemo, useState } from 'react';
|
|
|
import styles from './VideoAnalysis.less';
|
|
|
|
|
|
const { TabPane } = Tabs;
|
|
@@ -21,14 +20,25 @@ function VideoAnalysis(props) {
|
|
|
const [prevKey, setPrevKey] = useState();
|
|
|
const [selectedName, setSelectedName] = useState('');
|
|
|
|
|
|
- const handleCollapse = (key) => {
|
|
|
- if (key === prevKey) return;
|
|
|
- setPrevKey(key);
|
|
|
- const device = data.list.find((item) => item.id === key)?.device_name;
|
|
|
- if (device) {
|
|
|
- UnityAction.sendMsg('SynCam', device);
|
|
|
- }
|
|
|
- };
|
|
|
+ const errorData = useMemo(() => {
|
|
|
+ const list1 =
|
|
|
+ videoData.dumu_list?.map((item) => {
|
|
|
+ return { ...item, type_name: '视频报警', type: 1 };
|
|
|
+ }) || [];
|
|
|
+ const list2 =
|
|
|
+ videoData.environment_list
|
|
|
+ ?.filter((item) => item.status)
|
|
|
+ .map((item) => {
|
|
|
+ return { ...item, type_name: '环境监测', type: 2 };
|
|
|
+ }) || [];
|
|
|
+ const list3 =
|
|
|
+ videoData.fluid_level_list
|
|
|
+ ?.filter((item) => item.status)
|
|
|
+ .map((item) => {
|
|
|
+ return { ...item, type_name: '液位监测', type: 3 };
|
|
|
+ }) || [];
|
|
|
+ return [...list1, ...list2, ...list3];
|
|
|
+ }, [videoData]);
|
|
|
|
|
|
useEffect(() => {
|
|
|
UnityAction.on('SynCam', selectedItem);
|
|
@@ -47,7 +57,7 @@ function VideoAnalysis(props) {
|
|
|
|
|
|
const onTabChange = (tab) => {
|
|
|
setTab(tab);
|
|
|
- // UnityAction.sendMsg('ProcessAnalysisType', tab);
|
|
|
+ UnityAction.sendMsg('SensorAnalysisType', tab);
|
|
|
};
|
|
|
|
|
|
return (
|
|
@@ -62,10 +72,8 @@ function VideoAnalysis(props) {
|
|
|
key: '1',
|
|
|
children: (
|
|
|
<AnalysisContent
|
|
|
- data={data}
|
|
|
- videoData={videoData}
|
|
|
+ errorData={errorData}
|
|
|
selectedName={selectedName}
|
|
|
- prevKey={prevKey}
|
|
|
/>
|
|
|
),
|
|
|
},
|
|
@@ -81,11 +89,18 @@ function VideoAnalysis(props) {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
-function AnalysisContent({ data, selectedName, prevKey }) {
|
|
|
+function AnalysisContent({ errorData, selectedName }) {
|
|
|
+ const [prevKey, setPrevKey] = useState();
|
|
|
const handleImgClick = (item) => {
|
|
|
localStorage.setItem('preview', JSON.stringify(item.data));
|
|
|
UnityAction.sendMsg('SensorPic');
|
|
|
};
|
|
|
+ const handleCollapse = (item) => {
|
|
|
+ const key = item.type == 1 ? item.device_name : item.device_code;
|
|
|
+ if (key === prevKey) return;
|
|
|
+ setPrevKey(key);
|
|
|
+ UnityAction.sendMsg('SynCam', key);
|
|
|
+ };
|
|
|
|
|
|
const renderContent = (key, item) => {
|
|
|
let content = '';
|
|
@@ -98,7 +113,7 @@ function AnalysisContent({ data, selectedName, prevKey }) {
|
|
|
{item.event_type}
|
|
|
<img
|
|
|
className={styles.img}
|
|
|
- src={item.url}
|
|
|
+ src={item.path}
|
|
|
onClick={() => handleImgClick(item)}
|
|
|
/>
|
|
|
</div>
|
|
@@ -109,16 +124,28 @@ function AnalysisContent({ data, selectedName, prevKey }) {
|
|
|
content = (
|
|
|
<>
|
|
|
<div className={styles.contentFlex}>
|
|
|
- <div>参数:温度</div>
|
|
|
+ <div>参数:{item.patrol_name}</div>
|
|
|
<div className={styles.threshold}>
|
|
|
<span>阈值范围:</span>
|
|
|
<div style={{ width: '180px' }}>
|
|
|
- <ThresholdBar current={0.5} thresholds={[0, 1]} />
|
|
|
+ <ThresholdDetail
|
|
|
+ current={item.value || 0}
|
|
|
+ data={{
|
|
|
+ JsonNumThreshold: item?.json_num_threshold,
|
|
|
+ Type: 2,
|
|
|
+ }}
|
|
|
+ />
|
|
|
</div>
|
|
|
</div>
|
|
|
-
|
|
|
<div>
|
|
|
- 状态:<span className={styles.textAbnormal}>异常</span>
|
|
|
+ 状态:
|
|
|
+ {item?.status <= 0 ? (
|
|
|
+ <span className={styles.textNormal}>正常</span>
|
|
|
+ ) : item.status == 1 ? (
|
|
|
+ <span className={styles.textAbnormal}>异常</span>
|
|
|
+ ) : (
|
|
|
+ <span className={styles.textWarning}>警告</span>
|
|
|
+ )}
|
|
|
</div>
|
|
|
</div>
|
|
|
</>
|
|
@@ -128,11 +155,29 @@ function AnalysisContent({ data, selectedName, prevKey }) {
|
|
|
content = (
|
|
|
<>
|
|
|
<div className={styles.contentFlex}>
|
|
|
- <div>原液位:12.01</div>
|
|
|
- <div> 仪表液位:12.12 </div>
|
|
|
-
|
|
|
+ <div>原液位:{item.origin_value}</div>
|
|
|
+ <div> 差值:{item.value} </div>
|
|
|
+ <div className={styles.threshold}>
|
|
|
+ <span>阈值范围:</span>
|
|
|
+ <div style={{ width: '180px' }}>
|
|
|
+ <ThresholdDetail
|
|
|
+ current={item.value || 0}
|
|
|
+ data={{
|
|
|
+ JsonNumThreshold: item?.json_num_threshold,
|
|
|
+ Type: 2,
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
<div>
|
|
|
- 状态:<span className={styles.textAbnormal}>异常</span>
|
|
|
+ 状态:
|
|
|
+ {item?.status <= 0 ? (
|
|
|
+ <span className={styles.textNormal}>正常</span>
|
|
|
+ ) : item.status == 1 ? (
|
|
|
+ <span className={styles.textAbnormal}>异常</span>
|
|
|
+ ) : (
|
|
|
+ <span className={styles.textWarning}>警告</span>
|
|
|
+ )}
|
|
|
</div>
|
|
|
</div>
|
|
|
</>
|
|
@@ -141,31 +186,36 @@ function AnalysisContent({ data, selectedName, prevKey }) {
|
|
|
}
|
|
|
return content;
|
|
|
};
|
|
|
-
|
|
|
+ const getClassName = (item) => {
|
|
|
+ const key = item.type == 1 ? item.device_name : item.device_code;
|
|
|
+ return selectedName == key || prevKey == key
|
|
|
+ ? styles.tableSelect
|
|
|
+ : styles.table;
|
|
|
+ };
|
|
|
return (
|
|
|
<div
|
|
|
className={styles.page}
|
|
|
style={{ height: 'calc(100vh - 630px)', overflow: 'auto' }}
|
|
|
>
|
|
|
- {data?.length > 0 ? (
|
|
|
- data?.map((item) => (
|
|
|
+ {errorData?.length > 0 ? (
|
|
|
+ errorData?.map((item) => (
|
|
|
<div data-name={item.device_name}>
|
|
|
<Collapse
|
|
|
- defaultActiveKey={[item.id]}
|
|
|
- key={item.id}
|
|
|
- className={
|
|
|
- selectedName == item.device_name || prevKey == item.id
|
|
|
- ? styles.tableSelect
|
|
|
- : styles.table
|
|
|
- }
|
|
|
- expandIcon={() => <div className={styles.typeText}>视频报警</div>}
|
|
|
+ defaultActiveKey={[item.device_name]}
|
|
|
+ key={item.device_name}
|
|
|
+ className={getClassName(item)}
|
|
|
+ expandIcon={() => (
|
|
|
+ <div className={styles.typeText}>{item.type_name}</div>
|
|
|
+ )}
|
|
|
onChange={(e) => {
|
|
|
- handleCollapse(item.id);
|
|
|
+ handleCollapse(item);
|
|
|
}}
|
|
|
>
|
|
|
- <Panel header={item.device_name} key={item.id}>
|
|
|
+ <Panel header={item.device_name} key={item.device_name}>
|
|
|
<div className={styles.box}>
|
|
|
- <div className={styles.item}>{renderContent(1, item)}</div>
|
|
|
+ <div className={styles.item}>
|
|
|
+ {renderContent(item.type, item)}
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</Panel>
|
|
|
</Collapse>
|
|
@@ -179,7 +229,11 @@ function AnalysisContent({ data, selectedName, prevKey }) {
|
|
|
}
|
|
|
|
|
|
function AllContent({ data = [], videoData = {} }) {
|
|
|
- const { environment_list = [], fluid_level_list = [] } = videoData;
|
|
|
+ const {
|
|
|
+ environment_list = [],
|
|
|
+ fluid_level_list = [],
|
|
|
+ dumu_list = [],
|
|
|
+ } = videoData;
|
|
|
const [selectedRowKeys, setSelectedRowKeys] = useState([]);
|
|
|
const columns1 = [
|
|
|
{
|
|
@@ -339,7 +393,7 @@ function AllContent({ data = [], videoData = {} }) {
|
|
|
render: (item) => (
|
|
|
<img
|
|
|
className={styles.img}
|
|
|
- src={item.url}
|
|
|
+ src={item.path}
|
|
|
onClick={() => handleImgClick(item)}
|
|
|
/>
|
|
|
),
|