|
|
@ -13,10 +13,13 @@ import { |
|
|
|
Dropdown |
|
|
|
} from "antd"; |
|
|
|
import ajax from "@/services"; |
|
|
|
import { useSafeState } from "ahooks"; |
|
|
|
function VideoMonitor(props) { |
|
|
|
const { id } = props; |
|
|
|
const [form] = Form.useForm(); |
|
|
|
const [editform] = Form.useForm(); |
|
|
|
|
|
|
|
const [currentRecord, setCurrentRecord] = useState({}) |
|
|
|
// 操作-下拉 |
|
|
|
const items = [ |
|
|
|
// { key: "1", label: <span>查看监控</span> }, |
|
|
@ -92,48 +95,7 @@ function VideoMonitor(props) { |
|
|
|
); |
|
|
|
}, |
|
|
|
} |
|
|
|
// { |
|
|
|
// title: "操作", |
|
|
|
// dataIndex: "action", |
|
|
|
// key: "action", |
|
|
|
// align: "center", |
|
|
|
// render: (_, record) => { |
|
|
|
// return ( |
|
|
|
// <Popover |
|
|
|
// trigger="hover" |
|
|
|
// content={ |
|
|
|
// <div> |
|
|
|
// <div> |
|
|
|
// <a |
|
|
|
// onClick={() => { |
|
|
|
// setModalData({ ...modalData, visible: true }); |
|
|
|
// editform.setFieldsValue({ |
|
|
|
// vehicle_type: record.rule_id, |
|
|
|
// vehicle_type: record.vehicle_type, |
|
|
|
// group_ids: +record.group_ids, |
|
|
|
// }); |
|
|
|
// }} |
|
|
|
// > |
|
|
|
// 编辑 |
|
|
|
// </a> |
|
|
|
// </div> |
|
|
|
// <div> |
|
|
|
// <a |
|
|
|
// onClick={() => { |
|
|
|
// setDelModal({ id: record.id, visible: true }); |
|
|
|
// }} |
|
|
|
// > |
|
|
|
// 删除 |
|
|
|
// </a> |
|
|
|
// </div> |
|
|
|
// </div> |
|
|
|
// } |
|
|
|
// > |
|
|
|
// <Button type="primary">操作</Button> |
|
|
|
// </Popover> |
|
|
|
// ); |
|
|
|
// }, |
|
|
|
// }, |
|
|
|
|
|
|
|
]; |
|
|
|
// 操作 |
|
|
|
const clickDropDown = (param, record) => { |
|
|
@ -145,12 +107,16 @@ function VideoMonitor(props) { |
|
|
|
} else if (param.key == "2") { |
|
|
|
// 编辑 |
|
|
|
// doEditOutNvr(record); |
|
|
|
setModalData({ ...modalData, visible: true }); |
|
|
|
setModalData({ status: 'edit', visible: true }); |
|
|
|
editform.setFieldsValue({ |
|
|
|
// vehicle_type: record.rule_id, |
|
|
|
// vehicle_type: record.vehicle_type, |
|
|
|
// group_ids: +record.group_ids, |
|
|
|
name: record.name, |
|
|
|
ip_address: record.ip_address, |
|
|
|
port: record.port, |
|
|
|
video_port: record.video_port, |
|
|
|
user_name: record.user_name, |
|
|
|
password: record.password |
|
|
|
}); |
|
|
|
setCurrentRecord(record) |
|
|
|
} else { |
|
|
|
// 删除 |
|
|
|
// doDelOutNvr(record); |
|
|
@ -180,14 +146,14 @@ function VideoMonitor(props) { |
|
|
|
id: "", |
|
|
|
}); |
|
|
|
const addNvr = () => { |
|
|
|
setModalData({ ...modalData, visible: true }); |
|
|
|
setModalData({ status: "add", visible: true }); |
|
|
|
}; |
|
|
|
|
|
|
|
//搜索方法 name: "", // 设备名称 operator_id: "", //运营商 road_id: "", //路段名称 |
|
|
|
const search = () => { |
|
|
|
const params = form.getFieldsValue(); |
|
|
|
ajax |
|
|
|
.getOutNvrList({ road_id: id, operator_id: '', ...pageData, ...params }) |
|
|
|
.getOutNvrList({ road_id: '', operator_id: '', ...pageData, ...params }) |
|
|
|
.then((res) => { |
|
|
|
if (res.status === 20000) { |
|
|
|
setTableData(res.data.list); |
|
|
@ -226,9 +192,9 @@ function VideoMonitor(props) { |
|
|
|
.validateFields() |
|
|
|
.then((values) => { |
|
|
|
if (modalData.status === "add") { |
|
|
|
doAddOutNvr({ ...values, road_id: id, ...pageData }); |
|
|
|
doAddOutNvr({ ...values, road_id: currentRecord.road_id ,operator_id: currentRecord.operator_id, address: '', lng_lat: '' }); |
|
|
|
} else if (modalData.status === "edit") { |
|
|
|
doEditOutNvr({ ...values, road_id: id, ...pageData }); |
|
|
|
doEditOutNvr({ ...values, road_id: currentRecord.road_id ,operator_id: currentRecord.operator_id, address: '', lng_lat: '' }); |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch((err) => console.error(err)); |
|
|
@ -264,13 +230,13 @@ function VideoMonitor(props) { |
|
|
|
<Form form={form}> |
|
|
|
<Row gutter={[30]}> |
|
|
|
<Col span="4_8" style={{ width: "30%" }}> |
|
|
|
<Form.Item label="视频设备名称" name="device_name"> |
|
|
|
<Form.Item label="视频设备名称" name="name"> |
|
|
|
<Input></Input> |
|
|
|
</Form.Item> |
|
|
|
</Col> |
|
|
|
<Form.Item> |
|
|
|
<div className="bottom-button"> |
|
|
|
<Button type="primary">查询</Button> |
|
|
|
<Button type="primary" onClick={search}>查询</Button> |
|
|
|
<Button type="primary" onClick={addNvr}> |
|
|
|
添加 |
|
|
|
</Button> |
|
|
@ -298,7 +264,7 @@ function VideoMonitor(props) { |
|
|
|
></Table> |
|
|
|
</main> |
|
|
|
<Modal |
|
|
|
title="添加监控设备" |
|
|
|
title="添加设备" |
|
|
|
open={modalData.visible} |
|
|
|
onCancel={() => { |
|
|
|
setModalData({ ...modalData, visible: false }); |
|
|
@ -309,7 +275,7 @@ function VideoMonitor(props) { |
|
|
|
<Form labelCol={{ span: 6 }} form={editform}> |
|
|
|
<Form.Item |
|
|
|
label="设备名称" |
|
|
|
name="device_name" |
|
|
|
name="name" |
|
|
|
rules={[{ required: true }]} |
|
|
|
> |
|
|
|
<Input></Input> |
|
|
@ -323,14 +289,14 @@ function VideoMonitor(props) { |
|
|
|
</Form.Item> |
|
|
|
<Form.Item |
|
|
|
label="端口号" |
|
|
|
name="port_id" |
|
|
|
name="port" |
|
|
|
rules={[{ required: true }]} |
|
|
|
> |
|
|
|
<Input></Input> |
|
|
|
</Form.Item> |
|
|
|
<Form.Item |
|
|
|
label="视频端口号" |
|
|
|
name="video_port_id" |
|
|
|
name="video_port" |
|
|
|
rules={[{ required: true }]} |
|
|
|
> |
|
|
|
<Input></Input> |
|
|
|