|
@@ -162,15 +162,34 @@ function Detail(props) {
|
|
key="liquid"
|
|
key="liquid"
|
|
type={'liquid'}
|
|
type={'liquid'}
|
|
userList={userList}
|
|
userList={userList}
|
|
- title={'液位异常'}
|
|
|
|
|
|
+ title="液位异常"
|
|
/>
|
|
/>
|
|
{/* 加药流量校验 */}
|
|
{/* 加药流量校验 */}
|
|
- {/* <FlowCom
|
|
|
|
|
|
+ <DosingFlowCom
|
|
sendMessageToUnity={sendMessageToUnity}
|
|
sendMessageToUnity={sendMessageToUnity}
|
|
select={select}
|
|
select={select}
|
|
allData={data?.FluidLevelList}
|
|
allData={data?.FluidLevelList}
|
|
- title={<ModuleTitle title="加药流量校验" />}
|
|
|
|
- /> */}
|
|
|
|
|
|
+ title="加药流量校验"
|
|
|
|
+ />
|
|
|
|
+ <WaterInCom
|
|
|
|
+ sendMessageToUnity={sendMessageToUnity}
|
|
|
|
+ select={select}
|
|
|
|
+ allData={data?.WaterInCheckList}
|
|
|
|
+ title="进出水流量校验"
|
|
|
|
+ />
|
|
|
|
+ <PressureGaugeCom
|
|
|
|
+ sendMessageToUnity={sendMessageToUnity}
|
|
|
|
+ select={select}
|
|
|
|
+ allData={data?.PressureCompareList}
|
|
|
|
+ title="压力仪表校验"
|
|
|
|
+ />
|
|
|
|
+ <WaterQualityCom
|
|
|
|
+ sendMessageToUnity={sendMessageToUnity}
|
|
|
|
+ select={select}
|
|
|
|
+ allData={data?.WaterQualityCompareList}
|
|
|
|
+ title="水质仪表校验"
|
|
|
|
+ />
|
|
|
|
+
|
|
{/* 工艺自检报告"> */}
|
|
{/* 工艺自检报告"> */}
|
|
<div className={styles.content}>
|
|
<div className={styles.content}>
|
|
<div className={styles.tableStatus}>
|
|
<div className={styles.tableStatus}>
|
|
@@ -799,9 +818,14 @@ export function LiquidTable(props) {
|
|
const columns = [
|
|
const columns = [
|
|
{
|
|
{
|
|
title: '设备名称',
|
|
title: '设备名称',
|
|
- width: '25%',
|
|
|
|
|
|
+ width: '20%',
|
|
dataIndex: 'device_name',
|
|
dataIndex: 'device_name',
|
|
},
|
|
},
|
|
|
|
+ {
|
|
|
|
+ title: '类型',
|
|
|
|
+ key: 'template_item_name',
|
|
|
|
+ dataIndex: 'template_item_name',
|
|
|
|
+ },
|
|
{
|
|
{
|
|
title: '液位数',
|
|
title: '液位数',
|
|
width: '20%',
|
|
width: '20%',
|
|
@@ -814,7 +838,7 @@ export function LiquidTable(props) {
|
|
},
|
|
},
|
|
{
|
|
{
|
|
title: '设定值范围',
|
|
title: '设定值范围',
|
|
- width: '30%',
|
|
|
|
|
|
+ width: '25%',
|
|
render: (record) => (
|
|
render: (record) => (
|
|
<ThresholdDetail
|
|
<ThresholdDetail
|
|
current={record.value || 0}
|
|
current={record.value || 0}
|
|
@@ -904,7 +928,7 @@ function LiquidLevelCom(props) {
|
|
<TabsContent
|
|
<TabsContent
|
|
defaultActiveKey="1"
|
|
defaultActiveKey="1"
|
|
onChange={handleTabsChange}
|
|
onChange={handleTabsChange}
|
|
- small={true}
|
|
|
|
|
|
+ small
|
|
items={[
|
|
items={[
|
|
{
|
|
{
|
|
key: '1',
|
|
key: '1',
|
|
@@ -939,67 +963,37 @@ function LiquidLevelCom(props) {
|
|
/>
|
|
/>
|
|
)}
|
|
)}
|
|
</div>
|
|
</div>
|
|
- // <div className={styles.detailCard}>
|
|
|
|
- // <Tabs
|
|
|
|
- // defaultActiveKey="1"
|
|
|
|
- // tabBarExtraContent={<div className={styles.tabBarExtraContent}>{title} </div>}
|
|
|
|
- // onChange={handleTabsChange}
|
|
|
|
- // >
|
|
|
|
- // <Tabs.TabPane tab={`异常/警告(${errorData.length || 0})`} key="1">
|
|
|
|
- // {activeKey == '1' && (
|
|
|
|
- // <LiquidTable
|
|
|
|
- // onClickItem={sendMessageToUnity}
|
|
|
|
- // select={select}
|
|
|
|
- // items={errorData}
|
|
|
|
- // key={type}
|
|
|
|
- // // data={data}
|
|
|
|
- // type={type}
|
|
|
|
- // />
|
|
|
|
- // )}
|
|
|
|
- // </Tabs.TabPane>
|
|
|
|
- // <Tabs.TabPane tab={`全部(${allData.length || 0})`} key="2">
|
|
|
|
- // {activeKey == '2' && (
|
|
|
|
- // <LiquidTable
|
|
|
|
- // onClickItem={sendMessageToUnity}
|
|
|
|
- // select={select}
|
|
|
|
- // items={allData}
|
|
|
|
- // // data={data}
|
|
|
|
- // key={type}
|
|
|
|
- // type={type}
|
|
|
|
- // />
|
|
|
|
- // )}
|
|
|
|
- // </Tabs.TabPane>
|
|
|
|
- // </Tabs>
|
|
|
|
- // </div>
|
|
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
-function FlowTable(props) {
|
|
|
|
|
|
+function DosingFlowTable(props) {
|
|
const { onClickItem, data = {}, items } = props;
|
|
const { onClickItem, data = {}, items } = props;
|
|
const columns = [
|
|
const columns = [
|
|
{
|
|
{
|
|
title: '设备名称',
|
|
title: '设备名称',
|
|
- width: '20%',
|
|
|
|
|
|
+ width: '1.5rem',
|
|
dataIndex: 'device_name',
|
|
dataIndex: 'device_name',
|
|
},
|
|
},
|
|
|
|
+ {
|
|
|
|
+ title: '类型',
|
|
|
|
+ key: 'template_item_name',
|
|
|
|
+ dataIndex: 'template_item_name',
|
|
|
|
+ },
|
|
{
|
|
{
|
|
title: '实际流量',
|
|
title: '实际流量',
|
|
- width: '20%',
|
|
|
|
dataIndex: 'origin_value',
|
|
dataIndex: 'origin_value',
|
|
},
|
|
},
|
|
{
|
|
{
|
|
title: '计量流量',
|
|
title: '计量流量',
|
|
- width: '16%',
|
|
|
|
dataIndex: 'value',
|
|
dataIndex: 'value',
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- title: '差值',
|
|
|
|
- width: '15%',
|
|
|
|
|
|
+ title: '差值/比值',
|
|
dataIndex: 'value',
|
|
dataIndex: 'value',
|
|
},
|
|
},
|
|
{
|
|
{
|
|
title: '设定值范围',
|
|
title: '设定值范围',
|
|
- width: '30%',
|
|
|
|
|
|
+ width: '20%',
|
|
render: (record) => (
|
|
render: (record) => (
|
|
<ThresholdDetail
|
|
<ThresholdDetail
|
|
current={record.value || 0}
|
|
current={record.value || 0}
|
|
@@ -1013,6 +1007,7 @@ function FlowTable(props) {
|
|
{
|
|
{
|
|
title: '状态',
|
|
title: '状态',
|
|
dataIndex: 'status',
|
|
dataIndex: 'status',
|
|
|
|
+ width: '1.25rem',
|
|
render: (status) => {
|
|
render: (status) => {
|
|
switch (status) {
|
|
switch (status) {
|
|
case -1:
|
|
case -1:
|
|
@@ -1022,7 +1017,7 @@ function FlowTable(props) {
|
|
<i
|
|
<i
|
|
className={styles.iconStatus}
|
|
className={styles.iconStatus}
|
|
style={{ background: '#12CEB3' }}
|
|
style={{ background: '#12CEB3' }}
|
|
- ></i>
|
|
|
|
|
|
+ />
|
|
正常
|
|
正常
|
|
</div>
|
|
</div>
|
|
);
|
|
);
|
|
@@ -1031,8 +1026,8 @@ function FlowTable(props) {
|
|
<div>
|
|
<div>
|
|
<i
|
|
<i
|
|
className={styles.iconStatus}
|
|
className={styles.iconStatus}
|
|
- style={{ background: '#FFE26D' }}
|
|
|
|
- ></i>
|
|
|
|
|
|
+ style={{ background: '#FF8600' }}
|
|
|
|
+ />
|
|
异常
|
|
异常
|
|
</div>
|
|
</div>
|
|
);
|
|
);
|
|
@@ -1042,10 +1037,12 @@ function FlowTable(props) {
|
|
<i
|
|
<i
|
|
className={styles.iconStatus}
|
|
className={styles.iconStatus}
|
|
style={{ background: '#FFE26D' }}
|
|
style={{ background: '#FFE26D' }}
|
|
- ></i>
|
|
|
|
|
|
+ />
|
|
警告
|
|
警告
|
|
</div>
|
|
</div>
|
|
);
|
|
);
|
|
|
|
+ default:
|
|
|
|
+ return null;
|
|
}
|
|
}
|
|
},
|
|
},
|
|
},
|
|
},
|
|
@@ -1070,7 +1067,7 @@ function FlowTable(props) {
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
-function FlowCom(props) {
|
|
|
|
|
|
+function DosingFlowCom(props) {
|
|
const { sendMessageToUnity, select, allData = [], type, title } = props;
|
|
const { sendMessageToUnity, select, allData = [], type, title } = props;
|
|
const [activeKey, setActiveKey] = useState('1');
|
|
const [activeKey, setActiveKey] = useState('1');
|
|
|
|
|
|
@@ -1079,8 +1076,8 @@ function FlowCom(props) {
|
|
return errorData;
|
|
return errorData;
|
|
}, [allData]);
|
|
}, [allData]);
|
|
|
|
|
|
- const handleTabsChange = (activeKey) => {
|
|
|
|
- setActiveKey(activeKey);
|
|
|
|
|
|
+ const handleTabsChange = (key) => {
|
|
|
|
+ setActiveKey(key);
|
|
};
|
|
};
|
|
return (
|
|
return (
|
|
<div className={styles.detailCard}>
|
|
<div className={styles.detailCard}>
|
|
@@ -1089,7 +1086,7 @@ function FlowCom(props) {
|
|
<TabsContent
|
|
<TabsContent
|
|
defaultActiveKey="1"
|
|
defaultActiveKey="1"
|
|
onChange={handleTabsChange}
|
|
onChange={handleTabsChange}
|
|
- small={true}
|
|
|
|
|
|
+ small
|
|
items={[
|
|
items={[
|
|
{
|
|
{
|
|
key: '1',
|
|
key: '1',
|
|
@@ -1105,22 +1102,482 @@ function FlowCom(props) {
|
|
></TabsContent>
|
|
></TabsContent>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
- {activeKey == '1' && (
|
|
|
|
- <FlowTable
|
|
|
|
|
|
+ {activeKey === '1' && (
|
|
|
|
+ <DosingFlowTable
|
|
onClickItem={sendMessageToUnity}
|
|
onClickItem={sendMessageToUnity}
|
|
select={select}
|
|
select={select}
|
|
items={errorData}
|
|
items={errorData}
|
|
- key={type}
|
|
|
|
- type={type}
|
|
|
|
/>
|
|
/>
|
|
)}
|
|
)}
|
|
- {activeKey == '2' && (
|
|
|
|
- <FlowTable
|
|
|
|
|
|
+ {activeKey === '2' && (
|
|
|
|
+ <DosingFlowTable
|
|
|
|
+ onClickItem={sendMessageToUnity}
|
|
|
|
+ select={select}
|
|
|
|
+ items={allData}
|
|
|
|
+ />
|
|
|
|
+ )}
|
|
|
|
+ </div>
|
|
|
|
+ );
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+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) => (
|
|
|
|
+ <ThresholdDetail
|
|
|
|
+ current={record.current_val || 0}
|
|
|
|
+ data={{
|
|
|
|
+ JsonNumThreshold: {
|
|
|
|
+ exception: [
|
|
|
|
+ { ThresholdValue: record?.thresholds, ThresholdType: 1 },
|
|
|
|
+ ],
|
|
|
|
+ },
|
|
|
|
+ Type: 2,
|
|
|
|
+ }}
|
|
|
|
+ />
|
|
|
|
+ ),
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ title: '状态',
|
|
|
|
+ dataIndex: 'status',
|
|
|
|
+ width: '1.25rem',
|
|
|
|
+ render: (status) => {
|
|
|
|
+ switch (status) {
|
|
|
|
+ case -1:
|
|
|
|
+ case 0:
|
|
|
|
+ return (
|
|
|
|
+ <div>
|
|
|
|
+ <i
|
|
|
|
+ className={styles.iconStatus}
|
|
|
|
+ style={{ background: '#12CEB3' }}
|
|
|
|
+ />
|
|
|
|
+ 正常
|
|
|
|
+ </div>
|
|
|
|
+ );
|
|
|
|
+ case 1:
|
|
|
|
+ return (
|
|
|
|
+ <div>
|
|
|
|
+ <i
|
|
|
|
+ className={styles.iconStatus}
|
|
|
|
+ style={{ background: '#FF8600' }}
|
|
|
|
+ />
|
|
|
|
+ 异常
|
|
|
|
+ </div>
|
|
|
|
+ );
|
|
|
|
+ case 2:
|
|
|
|
+ return (
|
|
|
|
+ <div>
|
|
|
|
+ <i
|
|
|
|
+ className={styles.iconStatus}
|
|
|
|
+ style={{ background: '#FFE26D' }}
|
|
|
|
+ />
|
|
|
|
+ 警告
|
|
|
|
+ </div>
|
|
|
|
+ );
|
|
|
|
+ default:
|
|
|
|
+ return (
|
|
|
|
+ <div>
|
|
|
|
+ <i
|
|
|
|
+ className={styles.iconStatus}
|
|
|
|
+ style={{ background: '#FF8600' }}
|
|
|
|
+ />
|
|
|
|
+ 异常
|
|
|
|
+ </div>
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ ];
|
|
|
|
+ const handleClickItem = (params) => {
|
|
|
|
+ onClickItem(`DeviceTable-${params.device_code}`, {
|
|
|
|
+ type: params.status,
|
|
|
|
+ deviceCode: params.device_code,
|
|
|
|
+ });
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ return (
|
|
|
|
+ <Table
|
|
|
|
+ columns={columns}
|
|
|
|
+ dataSource={items}
|
|
|
|
+ rowKey="device_code"
|
|
|
|
+ locale={{
|
|
|
|
+ emptyText: <Empty />,
|
|
|
|
+ }}
|
|
|
|
+ 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 (
|
|
|
|
+ <div className={styles.detailCard}>
|
|
|
|
+ <div className={styles.tableTop}>
|
|
|
|
+ {title}
|
|
|
|
+ <TabsContent
|
|
|
|
+ defaultActiveKey="1"
|
|
|
|
+ onChange={handleTabsChange}
|
|
|
|
+ small
|
|
|
|
+ items={[
|
|
|
|
+ {
|
|
|
|
+ key: '1',
|
|
|
|
+ label: `异常/警告(${errorData?.length || 0})`,
|
|
|
|
+ children: <div></div>,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ key: '2',
|
|
|
|
+ label: `全部(${allData?.length || 0})`,
|
|
|
|
+ children: <div></div>,
|
|
|
|
+ },
|
|
|
|
+ ]}
|
|
|
|
+ ></TabsContent>
|
|
|
|
+ </div>
|
|
|
|
+ {activeKey === '1' && (
|
|
|
|
+ <WaterInTable
|
|
|
|
+ onClickItem={sendMessageToUnity}
|
|
|
|
+ select={select}
|
|
|
|
+ items={errorData}
|
|
|
|
+ />
|
|
|
|
+ )}
|
|
|
|
+ {activeKey === '2' && (
|
|
|
|
+ <WaterInTable
|
|
|
|
+ onClickItem={sendMessageToUnity}
|
|
|
|
+ select={select}
|
|
|
|
+ items={allData}
|
|
|
|
+ />
|
|
|
|
+ )}
|
|
|
|
+ </div>
|
|
|
|
+ );
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+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')}
|
|
|
|
+ <br />
|
|
|
|
+ {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 (
|
|
|
|
+ <div>
|
|
|
|
+ <i
|
|
|
|
+ className={styles.iconStatus}
|
|
|
|
+ style={{ background: '#12CEB3' }}
|
|
|
|
+ />
|
|
|
|
+ 正常
|
|
|
|
+ </div>
|
|
|
|
+ );
|
|
|
|
+ case 1:
|
|
|
|
+ return (
|
|
|
|
+ <div>
|
|
|
|
+ <i
|
|
|
|
+ className={styles.iconStatus}
|
|
|
|
+ style={{ background: '#FF8600' }}
|
|
|
|
+ />
|
|
|
|
+ 异常
|
|
|
|
+ </div>
|
|
|
|
+ );
|
|
|
|
+ case 2:
|
|
|
|
+ return (
|
|
|
|
+ <div>
|
|
|
|
+ <i
|
|
|
|
+ className={styles.iconStatus}
|
|
|
|
+ style={{ background: '#FFE26D' }}
|
|
|
|
+ />
|
|
|
|
+ 警告
|
|
|
|
+ </div>
|
|
|
|
+ );
|
|
|
|
+ default:
|
|
|
|
+ return (
|
|
|
|
+ <div>
|
|
|
|
+ <i
|
|
|
|
+ className={styles.iconStatus}
|
|
|
|
+ style={{ background: '#FF8600' }}
|
|
|
|
+ />
|
|
|
|
+ 异常
|
|
|
|
+ </div>
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ ];
|
|
|
|
+ const handleClickItem = (params) => {
|
|
|
|
+ onClickItem(`DeviceTable-${params.device_code}`, {
|
|
|
|
+ type: params.status,
|
|
|
|
+ deviceCode: params.device_code,
|
|
|
|
+ });
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ return (
|
|
|
|
+ <Table
|
|
|
|
+ columns={columns}
|
|
|
|
+ dataSource={items}
|
|
|
|
+ rowKey="device_code"
|
|
|
|
+ locale={{
|
|
|
|
+ emptyText: <Empty />,
|
|
|
|
+ }}
|
|
|
|
+ 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 (
|
|
|
|
+ <div className={styles.detailCard}>
|
|
|
|
+ <div className={styles.tableTop}>
|
|
|
|
+ {title}
|
|
|
|
+ <TabsContent
|
|
|
|
+ defaultActiveKey="2"
|
|
|
|
+ onChange={handleTabsChange}
|
|
|
|
+ small
|
|
|
|
+ items={[
|
|
|
|
+ {
|
|
|
|
+ key: '2',
|
|
|
|
+ label: `异常/警告(${errorData?.length || 0})`,
|
|
|
|
+ children: <div></div>,
|
|
|
|
+ },
|
|
|
|
+ ]}
|
|
|
|
+ ></TabsContent>
|
|
|
|
+ </div>
|
|
|
|
+ {activeKey === '2' && (
|
|
|
|
+ <PressureGaugeTable
|
|
|
|
+ onClickItem={sendMessageToUnity}
|
|
|
|
+ select={select}
|
|
|
|
+ items={allData}
|
|
|
|
+ />
|
|
|
|
+ )}
|
|
|
|
+ </div>
|
|
|
|
+ );
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+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')}
|
|
|
|
+ <br />
|
|
|
|
+ {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 (
|
|
|
|
+ <div>
|
|
|
|
+ <i
|
|
|
|
+ className={styles.iconStatus}
|
|
|
|
+ style={{ background: '#12CEB3' }}
|
|
|
|
+ />
|
|
|
|
+ 正常
|
|
|
|
+ </div>
|
|
|
|
+ );
|
|
|
|
+ case 1:
|
|
|
|
+ return (
|
|
|
|
+ <div>
|
|
|
|
+ <i
|
|
|
|
+ className={styles.iconStatus}
|
|
|
|
+ style={{ background: '#FF8600' }}
|
|
|
|
+ />
|
|
|
|
+ 异常
|
|
|
|
+ </div>
|
|
|
|
+ );
|
|
|
|
+ case 2:
|
|
|
|
+ return (
|
|
|
|
+ <div>
|
|
|
|
+ <i
|
|
|
|
+ className={styles.iconStatus}
|
|
|
|
+ style={{ background: '#FFE26D' }}
|
|
|
|
+ />
|
|
|
|
+ 警告
|
|
|
|
+ </div>
|
|
|
|
+ );
|
|
|
|
+ default:
|
|
|
|
+ return (
|
|
|
|
+ <div>
|
|
|
|
+ <i
|
|
|
|
+ className={styles.iconStatus}
|
|
|
|
+ style={{ background: '#FF8600' }}
|
|
|
|
+ />
|
|
|
|
+ 异常
|
|
|
|
+ </div>
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ ];
|
|
|
|
+ const handleClickItem = (params) => {
|
|
|
|
+ onClickItem(`DeviceTable-${params.device_code}`, {
|
|
|
|
+ type: params.status,
|
|
|
|
+ deviceCode: params.device_code,
|
|
|
|
+ });
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ return (
|
|
|
|
+ <Table
|
|
|
|
+ columns={columns}
|
|
|
|
+ dataSource={items}
|
|
|
|
+ rowKey="device_code"
|
|
|
|
+ locale={{
|
|
|
|
+ emptyText: <Empty />,
|
|
|
|
+ }}
|
|
|
|
+ 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 (
|
|
|
|
+ <div className={styles.detailCard}>
|
|
|
|
+ <div className={styles.tableTop}>
|
|
|
|
+ {title}
|
|
|
|
+ <TabsContent
|
|
|
|
+ defaultActiveKey="2"
|
|
|
|
+ onChange={handleTabsChange}
|
|
|
|
+ small
|
|
|
|
+ items={[
|
|
|
|
+ {
|
|
|
|
+ key: '2',
|
|
|
|
+ label: `异常/警告(${errorData?.length || 0})`,
|
|
|
|
+ children: <div></div>,
|
|
|
|
+ },
|
|
|
|
+ ]}
|
|
|
|
+ ></TabsContent>
|
|
|
|
+ </div>
|
|
|
|
+ {activeKey === '2' && (
|
|
|
|
+ <WaterQualityTable
|
|
onClickItem={sendMessageToUnity}
|
|
onClickItem={sendMessageToUnity}
|
|
select={select}
|
|
select={select}
|
|
items={allData}
|
|
items={allData}
|
|
- key={type}
|
|
|
|
- type={type}
|
|
|
|
/>
|
|
/>
|
|
)}
|
|
)}
|
|
</div>
|
|
</div>
|