|
@@ -1,18 +1,30 @@
|
|
|
import PageContent from '@/components/PageContent';
|
|
|
import TabsContent from '@/components/TabsContent';
|
|
|
-import { useNavigate, useParams } from '@umijs/max';
|
|
|
-import { Space } from 'antd';
|
|
|
+import { queryGateList, queryGateOverView } from '@/services/safety';
|
|
|
+import { useNavigate, useParams, useRequest } from '@umijs/max';
|
|
|
+import { Button, Space } from 'antd';
|
|
|
import styles from './index.less';
|
|
|
const img = require('@/assets/deviceManager/device01.png');
|
|
|
const chartIcon = require('@/assets/deviceManager/chartIcon.png');
|
|
|
const DeviceManager = () => {
|
|
|
const { projectId } = useParams();
|
|
|
|
|
|
+ const { data, run, loading } = useRequest(() =>
|
|
|
+ queryGateList({ project_id: projectId }),
|
|
|
+ );
|
|
|
+ const { data: dataOver, loading: loadingOver } = useRequest(() =>
|
|
|
+ queryGateOverView({ project_id: projectId }),
|
|
|
+ );
|
|
|
+ console.log(dataOver);
|
|
|
+
|
|
|
+ const handleTabChange = (tab) => {
|
|
|
+ tab == '1' ? '' : run();
|
|
|
+ };
|
|
|
return (
|
|
|
<PageContent style={{ backgroundColor: 'gray' }}>
|
|
|
<TabsContent
|
|
|
defaultActiveKey="1"
|
|
|
- onChange={() => {}}
|
|
|
+ onChange={handleTabChange}
|
|
|
items={[
|
|
|
{
|
|
|
label: `视频监控`,
|
|
@@ -22,7 +34,14 @@ const DeviceManager = () => {
|
|
|
{
|
|
|
label: `门禁`,
|
|
|
key: '2',
|
|
|
- children: <Door />,
|
|
|
+ children: (
|
|
|
+ <Door
|
|
|
+ data={data?.list}
|
|
|
+ dataOver={dataOver}
|
|
|
+ loading={loading}
|
|
|
+ projectId={projectId}
|
|
|
+ />
|
|
|
+ ),
|
|
|
},
|
|
|
]}
|
|
|
/>
|
|
@@ -30,6 +49,22 @@ const DeviceManager = () => {
|
|
|
);
|
|
|
};
|
|
|
const Video = ({ projectId }) => {
|
|
|
+ const renderRed = () => {
|
|
|
+ return (
|
|
|
+ <div style={{ display: 'flex', alignItems: 'center' }}>
|
|
|
+ <div
|
|
|
+ style={{
|
|
|
+ backgroundColor: 'red',
|
|
|
+ width: '10px',
|
|
|
+ height: '10px',
|
|
|
+ borderRadius: '5px',
|
|
|
+ marginRight: '10px',
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ <span>哈哈哈</span>
|
|
|
+ </div>
|
|
|
+ );
|
|
|
+ };
|
|
|
return (
|
|
|
<Space direction="vertical" className={styles.sparePart}>
|
|
|
<div className={`card-box ${styles.titleContent}`}>
|
|
@@ -38,14 +73,122 @@ const Video = ({ projectId }) => {
|
|
|
<div className={styles.num}>{0}</div>
|
|
|
<div>在库数量(个)</div>
|
|
|
</div>
|
|
|
+ <div>{[1, 2, 3].map((item) => renderRed())}</div>
|
|
|
</div>
|
|
|
</Space>
|
|
|
);
|
|
|
};
|
|
|
-const Door = () => {
|
|
|
+const Door = ({ data, dataOver, loading, projectId }) => {
|
|
|
const navigate = useNavigate();
|
|
|
|
|
|
- return <div>8888</div>;
|
|
|
+ const handleClick = () => {
|
|
|
+ navigate(`/safety/detail/${projectId}`);
|
|
|
+ };
|
|
|
+
|
|
|
+ const renderRed = (item) => {
|
|
|
+ return (
|
|
|
+ <div style={{ display: 'flex', alignItems: 'center' }}>
|
|
|
+ <div
|
|
|
+ style={{
|
|
|
+ backgroundColor: item?.status ? '12ceb3' : 'red',
|
|
|
+ width: '10px',
|
|
|
+ height: '10px',
|
|
|
+ borderRadius: '5px',
|
|
|
+ marginRight: '10px',
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ <span>{item?.name}</span>
|
|
|
+ </div>
|
|
|
+ );
|
|
|
+ };
|
|
|
+ return (
|
|
|
+ <div>
|
|
|
+ <div
|
|
|
+ style={{
|
|
|
+ display: 'flex',
|
|
|
+ justifyContent: 'space-between',
|
|
|
+ marginBottom: '10px',
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <div className="card-box" style={{ width: '49%' }}>
|
|
|
+ <div
|
|
|
+ className={styles.titleTwoContent}
|
|
|
+ style={{ width: '100%', marginBottom: '10px' }}
|
|
|
+ >
|
|
|
+ <img className={styles.img} src={img} />
|
|
|
+ <div>
|
|
|
+ <div className={styles.num}>{dataOver?.total}</div>
|
|
|
+ <div>在库数量(个)</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div style={{ display: 'flex', justifyContent: 'space-around' }}>
|
|
|
+ <div style={{ display: 'flex', alignItems: 'center' }}>
|
|
|
+ <div
|
|
|
+ style={{
|
|
|
+ backgroundColor: '#12ceb3',
|
|
|
+ width: '10px',
|
|
|
+ height: '10px',
|
|
|
+ borderRadius: '5px',
|
|
|
+ marginRight: '10px',
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ <span>在线:{dataOver.online}</span>
|
|
|
+ </div>
|
|
|
+ <div style={{ display: 'flex', alignItems: 'center' }}>
|
|
|
+ <div
|
|
|
+ style={{
|
|
|
+ backgroundColor: 'gray',
|
|
|
+ width: '10px',
|
|
|
+ height: '10px',
|
|
|
+ borderRadius: '5px',
|
|
|
+ marginRight: '10px',
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ <span>离线:{dataOver.offline}</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div className={`card-box ${styles.titleTwoContent}`}>
|
|
|
+ <div
|
|
|
+ style={{ display: 'flex', flexDirection: 'column', height: '80%' }}
|
|
|
+ >
|
|
|
+ <div style={{ display: 'flex', alignItems: 'center' }}>
|
|
|
+ <div
|
|
|
+ style={{
|
|
|
+ backgroundColor: '#4a90e2',
|
|
|
+ width: '10px',
|
|
|
+ height: '10px',
|
|
|
+ borderRadius: '5px',
|
|
|
+ marginRight: '10px',
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ <span>今日进厂人数:{dataOver.online}</span>
|
|
|
+ </div>
|
|
|
+ <div style={{ display: 'flex', alignItems: 'center' }}>
|
|
|
+ <div
|
|
|
+ style={{
|
|
|
+ backgroundColor: '#f5a623',
|
|
|
+ width: '10px',
|
|
|
+ height: '10px',
|
|
|
+ borderRadius: '5px',
|
|
|
+ marginRight: '10px',
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ <span>今日出厂人数:{dataOver.online}</span>
|
|
|
+ </div>
|
|
|
+ <Button onClick={handleClick}>门禁日志</Button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <Space direction="vertical" className={styles.sparePart}>
|
|
|
+ {data?.map((item) => (
|
|
|
+ <div className="card-box" style={{ padding: '10px' }}>
|
|
|
+ {renderRed(item)}
|
|
|
+ </div>
|
|
|
+ ))}
|
|
|
+ </Space>
|
|
|
+ </div>
|
|
|
+ );
|
|
|
};
|
|
|
|
|
|
export default DeviceManager;
|