|
@@ -1,10 +1,11 @@
|
|
|
import { PageContainer } from '@ant-design/pro-components';
|
|
|
-import { Button, Card, Form, Input, Select, Space, Table } from 'antd';
|
|
|
+import { Button, Card, Form, Input, Space, Table } from 'antd';
|
|
|
import React, { useEffect, useState } from 'react';
|
|
|
import { ReloadOutlined, SearchOutlined } from '@ant-design/icons';
|
|
|
import { history } from 'umi';
|
|
|
import type { ColumnsType } from 'antd/es/table';
|
|
|
import { queryHomeList } from '@/services/home';
|
|
|
+import Overwrite from '@/pages/home/overwrite';
|
|
|
|
|
|
interface DataType {
|
|
|
name: string;
|
|
@@ -23,6 +24,8 @@ const Home: React.FC = () => {
|
|
|
const [searchData, setSearchData] = useState<object | null>({});
|
|
|
const [dataList, setDataList] = useState([]);
|
|
|
const [pagination, setPagination] = useState({ total: 0, current: 1, pageSize: 10 });
|
|
|
+ const [visible, setVisible] = useState(false);
|
|
|
+ const [editData, setEditData] = useState(null);
|
|
|
|
|
|
const getData = () => {
|
|
|
const params = {
|
|
@@ -82,6 +85,18 @@ const Home: React.FC = () => {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+ // 下发
|
|
|
+ const onOverwrite = (data: any) => {
|
|
|
+ setVisible(true);
|
|
|
+ setEditData(data);
|
|
|
+ };
|
|
|
+
|
|
|
+ // 下发弹框回调
|
|
|
+ const overwriteCallback = () => {
|
|
|
+ setVisible(false);
|
|
|
+ getData();
|
|
|
+ };
|
|
|
+
|
|
|
// 跳转到房间
|
|
|
const toRoom = (record: DataType) => {
|
|
|
history.push({ pathname: '/roomList', state: record.record_id });
|
|
@@ -96,9 +111,22 @@ const Home: React.FC = () => {
|
|
|
},
|
|
|
{
|
|
|
title: '名称',
|
|
|
+ width: 200,
|
|
|
dataIndex: 'name',
|
|
|
key: 'name',
|
|
|
},
|
|
|
+ {
|
|
|
+ title: '设备编号',
|
|
|
+ width: 100,
|
|
|
+ dataIndex: 'gateway',
|
|
|
+ key: 'gateway',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '设备是否在线',
|
|
|
+ dataIndex: 'is_online',
|
|
|
+ key: 'is_online',
|
|
|
+ render: (v) => <span>{v ? '在线' : '离线'}</span>,
|
|
|
+ },
|
|
|
{
|
|
|
title: '成员人数',
|
|
|
dataIndex: 'member',
|
|
@@ -110,16 +138,6 @@ const Home: React.FC = () => {
|
|
|
dataIndex: 'district',
|
|
|
key: 'district',
|
|
|
},
|
|
|
- {
|
|
|
- title: '状态',
|
|
|
- dataIndex: 'power',
|
|
|
- key: 'power',
|
|
|
- render: (v) => (
|
|
|
- <span style={{ color: `${{ 1: 'red', 2: '#00a650' }[v]}` }}>
|
|
|
- {{ 0: '离线', 1: '在线' }[v]}
|
|
|
- </span>
|
|
|
- ),
|
|
|
- },
|
|
|
{
|
|
|
title: '操作',
|
|
|
key: 'action',
|
|
@@ -132,6 +150,13 @@ const Home: React.FC = () => {
|
|
|
>
|
|
|
查看房间
|
|
|
</a>
|
|
|
+ <a
|
|
|
+ onClick={() => {
|
|
|
+ onOverwrite(record);
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 远程配置
|
|
|
+ </a>
|
|
|
</Space>
|
|
|
),
|
|
|
},
|
|
@@ -150,18 +175,11 @@ const Home: React.FC = () => {
|
|
|
<PageContainer>
|
|
|
<Card>
|
|
|
<Form form={form} layout="inline" onFinish={onFinish}>
|
|
|
- <Form.Item name="name" label="名称">
|
|
|
- <Input placeholder="请输入姓名" />
|
|
|
+ <Form.Item name="like_name" label="名称">
|
|
|
+ <Input placeholder="请输入名称" />
|
|
|
</Form.Item>
|
|
|
- <Form.Item name="status" label="状态">
|
|
|
- <Select style={{ width: '175px' }} placeholder="请选择状态">
|
|
|
- <Select.Option key={1} value={1}>
|
|
|
- 在线
|
|
|
- </Select.Option>
|
|
|
- <Select.Option key={2} value={2}>
|
|
|
- 离线
|
|
|
- </Select.Option>
|
|
|
- </Select>
|
|
|
+ <Form.Item name="like_gateway" label="设备编号">
|
|
|
+ <Input placeholder="请输入设备编号" />
|
|
|
</Form.Item>
|
|
|
<Form.Item style={{ marginBottom: '10px' }}>
|
|
|
<Space>
|
|
@@ -185,6 +203,9 @@ const Home: React.FC = () => {
|
|
|
onChange={tableChange}
|
|
|
style={{ marginTop: '20px' }}
|
|
|
/>
|
|
|
+ {visible && (
|
|
|
+ <Overwrite visible={visible} editCallback={overwriteCallback} params={editData} />
|
|
|
+ )}
|
|
|
</Card>
|
|
|
</PageContainer>
|
|
|
);
|