Commit 911646dd authored by 皮倩雯's avatar 皮倩雯

视频管理模块

parent ad97f550
Pipeline #34702 passed with stages
in 22 minutes 9 seconds
......@@ -43,6 +43,7 @@ const OmsLog = () => {
title: '接口名称',
dataIndex: 'Function',
key: 'Function',
ellipsis: 'true',
width: 200,
// filters: functionNameFilters,
// onFilter: (value, record) => record.functionName === value,
......@@ -51,13 +52,14 @@ const OmsLog = () => {
title: '标签',
dataIndex: 'Label',
key: 'Label',
ellipsis: 'true',
width: 300,
},
{
title: '操作信息',
dataIndex: 'ShortInfo',
key: 'ShortInfo',
width: 900,
width: 850,
ellipsis: 'true',
render: record => (
<Tooltip placement="left" title={decodeURI(record)}>
......
......@@ -586,7 +586,6 @@ const AddModal = props => {
destroyOnClose
okText="确认"
cancelText="取消"
maskClosable={false}
{...props}
onOk={() => onSubmit()}
// confirmLoading={loading}
......
import React, { useEffect, useState } from 'react';
import { Form, Modal, Row, Col, Input, Select, notification } from 'antd';
import { addInsertVideoConfig, editInsertVideoConfig } from '@/services/platform/videoManger';
const AddModal = props => {
const { callBackSubmit = () => { }, visible, onCancel, type, type1, kind, obj } = props;
const [form] = Form.useForm();
const { Item } = Form;
const { TextArea } = Input;
const [selectChange, setSelectChange] = useState('轻应用')
const [selectChange1, setSelectChange1] = useState('否')
const [selectChange2, setSelectChange2] = useState('主码流')
const onChange = value => {
setSelectChange(value)
}
const onChange1 = value => {
setSelectChange1(value)
}
const onChange2 = value => {
setSelectChange2(value)
}
useEffect(() => {
if (kind === 'add') {
form.resetFields();
} else {
form.setFieldsValue({ ...obj })
}
}, [visible])
const onSubmit = () => {
form.validateFields().then(validate => {
if (validate) {
let getValue = form.getFieldsValue();
console.log(getValue)
if (getValue.PlayModel === undefined) {
getValue.PlayModel = '轻应用'
}
if (getValue.PlayZeroChannel === undefined) {
getValue.PlayZeroChannel = '否'
}
if (getValue.StreamType === undefined) {
getValue.StreamType = '主码流'
}
getValue.VideoManufacturer = type
if (kind === 'add') {
addInsertVideoConfig(getValue).then(res => {
if (res.msg === 'Ok') {
form.resetFields();
callBackSubmit();
notification.success({
message: '提示',
duration: 3,
description: '新增成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
})
}
if(kind === 'edit'){
editInsertVideoConfig({
...getValue,
Id:obj.Id
}).then(res => {
if (res.msg === 'Ok') {
form.resetFields();
callBackSubmit();
notification.success({
message: '提示',
duration: 3,
description: '编辑成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
})
}
}
});
}
if (type1 == 'aa') {
return (
<Modal
visible={visible}
title={
kind === 'add' ? <span style={{ fontSize: '18px' }}>新增配置</span> : <span style={{ fontSize: '18px' }}>编辑配置</span>
}
width="1000px"
destroyOnClose
maskClosable={false}
onCancel={onCancel}
onOk={onSubmit}
>
<p style={{ fontSize: '16px', marginLeft: '16px' }}>基本信息</p>
<Form form={form} labelCol={{ span: 7 }} style={{ height: '25rem', overflowY: 'scroll' }} autocomplete='off'>
<Row>
<Col span={11}>
<Item
label="名称"
name="Name"
rules={[
{
required: true,
message: '请输入名称',
},
]}
>
<Input placeholder="请输入名称" />
</Item>
</Col>
{(() => {
switch (type) {
case '海康1.2':
return <>
<Col span={12}>
<span style={{ position: 'absolute', left: '12%', top: '9%', color: 'red', fontSize: '16px' }}>*</span>
<Item
label="视频厂商"
name="VideoManufacturer"
>
<Input placeholder="海康1.2" disabled />
</Item>
</Col>
</>
case '海康NVR':
return <>
<Col span={12}>
<span style={{ position: 'absolute', left: '12%', top: '9%', color: 'red', fontSize: '16px' }}>*</span>
<Item
label="视频厂商"
name="VideoManufacturer"
>
<Input placeholder="海康NVR" disabled />
</Item>
</Col>
</>
}
})()}
<Col span={11}>
<Item
label="设备编码"
name="EquipmentCode"
rules={[
{
required: true,
message: '请输入设备编码',
},
]}
>
<Input placeholder="设备台账对应设备编码字段" />
</Item>
</Col>
<Col span={12}>
<Item
label="通道ID"
name="PassageId"
rules={[
{
required: true,
message: '请输入通道ID',
},
]}
>
<TextArea placeholder="视频监控点ID,请用英文逗好分隔" />
</Item>
</Col>
<Col span={24}>
<p style={{ fontSize: '16px', marginLeft: '16px' }}>{type}</p>
</Col>
{(() => {
switch (type) {
case '海康1.2':
return <>
<Col span={11}>
<Item
label="设备序列号"
name="EquipmentNumber"
rules={[
{
required: true,
message: '请输入设备序列号',
},
]}
>
<Input placeholder="视频设备序列号" />
</Item>
</Col>
</>
case '海康NVR':
return <>
<Col span={11}>
<Item
label="视频流地址"
name="HLSPath"
rules={[
{
required: true,
message: '请输入视频流地址',
},
]}
>
<TextArea placeholder="视频流地址" />
</Item>
</Col>
</>
}
})()}
<Col span={12}>
<Item
label="刻录机名称"
name="RecorderName"
>
<Input placeholder="刻录机名称" />
</Item>
</Col>
<Col span={11}>
<Item
label="视频名称"
name="VideoName"
rules={[
{
required: true,
message: '请输入视频名称',
},
]}
>
<Input placeholder="视频监控点名称" />
</Item>
</Col>
<Col span={12}>
<Item
label="默认通道ID"
name="DefaultPassageId"
>
<TextArea placeholder="默认视频监控点ID,请用英文逗好分隔" />
</Item>
</Col>
<Col span={11}>
<Item
label="视频服务地址"
name="VideoPath"
rules={[
{
required: true,
message: '请输入视频名称',
},
]}
>
<Input placeholder="视频服务地址" />
</Item>
</Col>
</Row>
</Form>
</Modal>
)
} else {
return (
<Modal
visible={visible}
title={
kind === 'add' ? <span style={{ fontSize: '18px' }}>新增配置</span> : <span style={{ fontSize: '18px' }}>编辑配置</span>
}
width="1000px"
destroyOnClose
maskClosable={false}
onCancel={onCancel}
onOk={onSubmit}
>
<p style={{ fontSize: '16px', marginLeft: '16px' }}>基本信息</p>
<Form form={form} labelCol={{ span: 7 }} style={{ height: '27rem', overflowY: 'scroll' }} autocomplete='off'>
<Row>
<Col span={11}>
<Item
label="名称"
name="Name"
rules={[
{
required: true,
message: '请输入名称',
},
]}
>
<Input placeholder="请输入名称" />
</Item>
</Col>
{(() => {
switch (type) {
case '萤石云':
return <>
<Col span={12}>
<span style={{ position: 'absolute', left: '12%', top: '9%', color: 'red', fontSize: '16px' }}>*</span>
<Item
label="视频厂商"
name="VideoManufacturer"
>
<Input placeholder="萤石云" disabled />
</Item>
</Col>
</>
case '海康':
return <>
<Col span={12}>
<span style={{ position: 'absolute', left: '12%', top: '9%', color: 'red', fontSize: '16px' }}>*</span>
<Item
label="视频厂商"
name="VideoManufacturer"
>
<Input placeholder="海康" disabled />
</Item>
</Col>
</>
}
})()}
<Col span={11}>
<Item
label="登录名"
name="LoginName"
rules={[
{
required: true,
message: '请输入登录名',
},
]}
>
<Input placeholder="账户登录名" />
</Item>
</Col>
<Col span={12}>
<Item
label="登录密码"
name="LoginPwd"
rules={[
{
required: true,
message: '请输入登录密码',
},
]}
>
<Input placeholder="请输入登录密码" />
</Item>
</Col>
<Col span={11}>
<Item
label="设备编码"
name="EquipmentCode"
rules={[
{
required: true,
message: '请输入设备编码',
},
]}
>
<Input placeholder="设备台账对应设备编码字段" />
</Item>
</Col>
<Col span={12}>
<Item
label="通道ID"
name="PassageId"
rules={[
{
required: true,
message: '请输入通道ID',
},
]}
>
<Input placeholder="视频设备通道ID" />
</Item>
</Col>
<Col span={24}>
<p style={{ fontSize: '16px', marginLeft: '16px' }}>{type}</p>
</Col>
{(() => {
switch (type) {
case '萤石云':
return <>
<Row>
<Col span={11}>
<Item
label="视频路径"
name="VideoPath"
rules={[
{
required: true,
message: '请输入视频路径',
},
]}
>
<TextArea placeholder="视频Rtmp路径,请使用英文逗号分隔" />
</Item>
</Col>
<Col span={12}>
<Item
label="HLS路径"
name="HLSPath"
rules={[
{
required: true,
message: '请输入HLS路径',
},
]}
>
<TextArea placeholder="视频HLS路径,请使用英文逗号分隔" />
</Item>
</Col>
<Col span={11}>
<Item
label="设备序列号"
name="EquipmentNumber"
rules={[
{
required: true,
message: '请输入设备序列号',
},
]}
>
<Input placeholder="视频设备序列号" />
</Item>
</Col>
<Col span={12}>
<Item
label="刻录机名称"
name="RecorderName"
>
<Input placeholder="刻录机名称" />
</Item>
</Col>
<Col span={11}>
<Item
label="默认播放方式"
name="PlayModel"
>
<Select
defaultValue="轻应用"
value={selectChange}
onChange={onChange}
>
<Option value="轻应用">轻应用</Option>
<Option value="直播流">直播流</Option>
</Select>
</Item>
</Col>
<Col span={12}>
<Item
label="默认通道ID"
name="DefaultPassageId"
>
<Input placeholder="默认通道ID" />
</Item>
</Col>
</Row>
</>
case '海康':
return <>
<Row>
<Col span={11}>
<Item
label="登录IP"
name="LoginIp"
rules={[
{
required: true,
message: '请输入登录ID',
},
]}
>
<Input placeholder="登录ID" />
</Item>
</Col>
<Col span={12}>
<span style={{ position: 'absolute', left: '9%', top: '9%', color: 'red', fontSize: '16px' }}>*</span>
<Item
label="播放零通道"
name="PlayZeroChannel"
rules={[
{
validator: (rule, value) => {
if (form.getFieldsValue().PlayZeroChannel == '') {
return Promise.reject('请输入设备端口')
}
return Promise.resolve();
}
}
]}
>
<Select
defaultValue="否"
value={selectChange1}
onChange={onChange1}
>
<Option value="否"></Option>
<Option value="是"></Option>
</Select>
</Item>
</Col>
<Col span={11}>
<Item
label="设备端口"
name="EquipmentPort"
rules={[
{
required: true,
message: '请输入设备端口',
},
]}
>
<Input placeholder="设备端口" />
</Item>
</Col>
<Col span={12}>
<Item
label="视频端口"
name="VideoPort"
rules={[
{
required: true,
message: '请输入视频端口',
},
]}
>
<Input placeholder="视频端口" />
</Item>
</Col>
<Col span={11}>
<Item
label="媒体流端口"
name="StreamingMediaPort"
rules={[
{
required: true,
message: '请输入媒体流端口',
},
]}
>
<Input placeholder="媒体流端口" />
</Item>
</Col>
<Col span={12}>
<span style={{ position: 'absolute', left: '12%', top: '9%', color: 'red', fontSize: '16px' }}>*</span>
<Item
label="码流类型"
name="StreamType"
rules={[
{
validator: (rule, value) => {
if (form.getFieldsValue().StreamType == '') {
return Promise.reject('请选择码流类型')
}
return Promise.resolve();
}
}
]}
>
<Select
defaultValue="主码流"
value={selectChange2}
onChange={onChange2}
>
<Option value="主码流">主码流</Option>
<Option value="子码流">子码流</Option>
</Select>
</Item>
</Col>
<Col span={11}>
<Item
label="视频名称"
name="VideoName"
rules={[
{
required: true,
message: '请输入视频名称',
},
]}
>
<Input placeholder="视频名称" />
</Item>
</Col>
<Col span={12}>
<Item
label="刻录机名称"
name="RecorderName"
>
<Input placeholder="刻录机名称" />
</Item>
</Col>
<Col span={11}>
<Item
label="默认通道ID"
name="DefaultPassageId"
>
<Input placeholder="默认通道ID" />
</Item>
</Col>
</Row>
</>
}
}
)()}
</Row>
</Form>
</Modal>
)
}
}
export default AddModal;
\ No newline at end of file
import React, { useEffect, useState } from 'react';
import { Form, Modal, Row, Col, Input, Select} from 'antd';
const CheckModal = props => {
const { callBackSubmit = () => { }, visible, onCancel, type, type1, obj } = props;
const [form] = Form.useForm();
const { Item } = Form;
const { TextArea } = Input;
useEffect(()=>{
form.setFieldsValue({ ...obj })
},[visible])
if (type1 == 'aa') {
return (
<Modal
visible={visible}
title={
<span style={{ fontSize: '18px' }}>查看配置</span>
}
width="1000px"
destroyOnClose
maskClosable={false}
onCancel={onCancel}
footer={[]}
>
<p style={{ fontSize: '16px', marginLeft: '16px' }}>基本信息</p>
<Form form={form} labelCol={{ span: 7 }} style={{ height: '25rem', overflowY: 'scroll' }}>
<Row>
<Col span={11}>
<Item
label="名称"
name="Name"
rules={[
{
required: true,
message: '请输入名称',
},
]}
>
<Input placeholder={obj.Name} disabled/>
</Item>
</Col>
{(() => {
switch (type) {
case '海康1.2':
return <>
<Col span={12}>
<span style={{ position: 'absolute', left: '12%', top: '9%', color: 'red', fontSize: '16px' }}>*</span>
<Item
label="视频厂商"
name="VideoManufacturer"
>
<Input placeholder="海康1.2" disabled />
</Item>
</Col>
</>
case '海康NVR':
return <>
<Col span={12}>
<span style={{ position: 'absolute', left: '12%', top: '9%', color: 'red', fontSize: '16px' }}>*</span>
<Item
label="视频厂商"
name="VideoManufacturer"
>
<Input placeholder="海康NVR" disabled />
</Item>
</Col>
</>
}
})()}
<Col span={11}>
<Item
label="设备编码"
name="EquipmentCode"
rules={[
{
required: true,
message: '请输入设备编码',
},
]}
>
<Input placeholder={obj.EquipmentCode} disabled/>
</Item>
</Col>
<Col span={12}>
<Item
label="通道ID"
name="PassageId"
rules={[
{
required: true,
message: '请输入通道ID',
},
]}
>
<TextArea placeholder={obj.PassageId} disabled/>
</Item>
</Col>
<Col span={24}>
<p style={{ fontSize: '16px', marginLeft: '16px' }}>{type}</p>
</Col>
{(() => {
switch (type) {
case '海康1.2':
return <>
<Col span={11}>
<Item
label="设备序列号"
name="EquipmentNumber"
rules={[
{
required: true,
message: '请输入设备序列号',
},
]}
>
<Input placeholder={obj.EquipmentNumber} disabled/>
</Item>
</Col>
</>
case '海康NVR':
return <>
<Col span={11}>
<Item
label="视频流地址"
name="HLSPath"
rules={[
{
required: true,
message: '请输入视频流地址',
},
]}
>
<TextArea placeholder={obj.HLSPath} disabled/>
</Item>
</Col>
</>
}
})()}
<Col span={12}>
<Item
label="刻录机名称"
name="RecorderName"
>
<Input placeholder={obj.RecorderName} disabled/>
</Item>
</Col>
<Col span={11}>
<Item
label="视频名称"
name="VideoName"
rules={[
{
required: true,
message: '请输入视频名称',
},
]}
>
<Input placeholder={obj.VideoName} disabled/>
</Item>
</Col>
<Col span={12}>
<Item
label="默认通道ID"
name="DefaultPassageId"
>
<TextArea placeholder={obj.DefaultPassageId} disabled/>
</Item>
</Col>
<Col span={11}>
<Item
label="视频服务地址"
name="VideoPath"
rules={[
{
required: true,
message: '请输入视频名称',
},
]}
>
<Input placeholder={obj.VideoPath} disabled/>
</Item>
</Col>
</Row>
</Form>
</Modal>
)
} else {
return (
<Modal
visible={visible}
title={
<span style={{ fontSize: '18px' }}>查看配置</span>
}
width="1000px"
destroyOnClose
maskClosable={false}
onCancel={onCancel}
footer={[]}
>
<p style={{ fontSize: '16px', marginLeft: '16px' }}>基本信息</p>
<Form form={form} labelCol={{ span: 7 }} style={{ height: '27rem', overflowY: 'scroll' }}>
<Row>
<Col span={11}>
<Item
label="名称"
name="Name"
rules={[
{
required: true,
message: '请输入名称',
},
]}
>
<Input placeholder={obj.Name} disabled/>
</Item>
</Col>
{(() => {
switch (type) {
case '萤石云':
return <>
<Col span={12}>
<span style={{ position: 'absolute', left: '12%', top: '9%', color: 'red', fontSize: '16px' }}>*</span>
<Item
label="视频厂商"
name="VideoManufacturer"
>
<Input placeholder="萤石云" disabled />
</Item>
</Col>
</>
case '海康':
return <>
<Col span={12}>
<span style={{ position: 'absolute', left: '12%', top: '9%', color: 'red', fontSize: '16px' }}>*</span>
<Item
label="视频厂商"
name="VideoManufacturer"
>
<Input placeholder="海康" disabled />
</Item>
</Col>
</>
}
})()}
<Col span={11}>
<Item
label="登录名"
name="LoginName"
rules={[
{
required: true,
message: '请输入登录名',
},
]}
>
<Input placeholder={obj.LoginName} disabled/>
</Item>
</Col>
<Col span={12}>
<Item
label="登录密码"
name="LoginPwd"
rules={[
{
required: true,
message: '请输入登录密码',
},
]}
>
<Input placeholder={obj.LoginPwd} disabled/>
</Item>
</Col>
<Col span={11}>
<Item
label="设备编码"
name="EquipmentCode"
rules={[
{
required: true,
message: '请输入设备编码',
},
]}
>
<Input placeholder={obj.EquipmentCode} disabled/>
</Item>
</Col>
<Col span={12}>
<Item
label="通道ID"
name="PassageId"
rules={[
{
required: true,
message: '请输入通道ID',
},
]}
>
<Input placeholder={obj.PassageId} disabled/>
</Item>
</Col>
<Col span={24}>
<p style={{ fontSize: '16px', marginLeft: '16px' }}>{type}</p>
</Col>
{(() => {
switch (type) {
case '萤石云':
return <>
<Row>
<Col span={11}>
<Item
label="视频路径"
name="VideoPath"
rules={[
{
required: true,
message: '请输入视频路径',
},
]}
>
<TextArea placeholder={obj.VideoPath} disabled/>
</Item>
</Col>
<Col span={12}>
<Item
label="HLS路径"
name="HLSPath"
rules={[
{
required: true,
message: '请输入HLS路径',
},
]}
>
<TextArea placeholder={obj.HLSPath} disabled/>
</Item>
</Col>
<Col span={11}>
<Item
label="设备序列号"
name="EquipmentNumber"
rules={[
{
required: true,
message: '请输入设备序列号',
},
]}
>
<Input placeholder={obj.EquipmentNumber} disabled/>
</Item>
</Col>
<Col span={12}>
<Item
label="刻录机名称"
name="RecorderName"
>
<Input placeholder={obj.RecorderName} disabled/>
</Item>
</Col>
<Col span={11}>
<Item
label="默认播放方式"
name="PlayModel"
>
<Select
placeholder={obj.PlayModel}
disabled
>
</Select>
</Item>
</Col>
<Col span={12}>
<Item
label="默认通道ID"
name="DefaultPassageId"
>
<Input placeholder={obj.DefaultPassageId} disabled/>
</Item>
</Col>
</Row>
</>
case '海康':
return <>
<Row>
<Col span={11}>
<Item
label="登录IP"
name="LoginIp"
rules={[
{
required: true,
message: '请输入登录ID',
},
]}
>
<Input placeholder={obj.LoginIp} disabled/>
</Item>
</Col>
<Col span={12}>
<Item
label="播放零通道"
name="PlayZeroChannel"
rules={[
{
required: true,
message: '请输入设备端口',
},
]}
>
<Select
placeholder={obj.PlayZeroChannel}
disabled
>
</Select>
</Item>
</Col>
<Col span={11}>
<Item
label="设备端口"
name="EquipmentPort"
rules={[
{
required: true,
message: '请输入设备端口',
},
]}
>
<Input placeholder={obj.EquipmentPort} disabled/>
</Item>
</Col>
<Col span={12}>
<Item
label="视频端口"
name="VideoPort"
rules={[
{
required: true,
message: '请输入视频端口',
},
]}
>
<Input placeholder={obj.VideoPort} disabled/>
</Item>
</Col>
<Col span={11}>
<Item
label="媒体流端口"
name="StreamingMediaPort"
rules={[
{
required: true,
message: '请输入媒体流端口',
},
]}
>
<Input placeholder={obj.StreamingMediaPort} disabled/>
</Item>
</Col>
<Col span={12}>
<Item
label="码流类型"
name="StreamType"
rules={[
{
required: true,
message: '请选择码流类型',
},
]}
>
<Select
placeholder={obj.StreamType}
disabled
>
</Select>
</Item>
</Col>
<Col span={11}>
<Item
label="视频名称"
name="VideoName"
rules={[
{
required: true,
message: '请输入视频名称',
},
]}
>
<Input placeholder={obj.VideoName} disabled/>
</Item>
</Col>
<Col span={12}>
<Item
label="刻录机名称"
name="RecorderName"
>
<Input placeholder={obj.RecorderName} disabled/>
</Item>
</Col>
<Col span={11}>
<Item
label="默认通道ID"
name="DefaultPassageId"
>
<Input placeholder={obj.DefaultPassageId} disabled/>
</Item>
</Col>
</Row>
</>
}
}
)()}
</Row>
</Form>
</Modal>
)
}
}
export default CheckModal;
\ No newline at end of file
import React, { useEffect, useState } from 'react';
import { Form, Modal, Row, Col, Input, Select, notification } from 'antd';
const VideoModal = props => {
const { callBackSubmit = () => { }, visible, onCancel, obj } = props;
// useEffect(()=>{
// getData()
// },[visible])
// const getData =()=>{
// var url = `http://127.0.0.1:8085/web4/video/indexAll.html?ID=${obj.EquipmentCode}&skipCheck=true&name=${obj.Name}&disk=${obj.RecorderName}&site=null`
// let bodyHtml = `<iframe style= {{ border: 0, width: "100%", height: 630,}} src="${url}"/>`;
// let y=document.getElementsByClassName("pp")
// console.log(y)
// let x=document.getElementsByClassName("pp").innerHTML=bodyHtml
// console.log(x)
// // var url = `http://127.0.0.1:8085/web4/video/indexAll.html?ID=${obj.EquipmentCode}&skipCheck=true&name=${obj.Name}&disk=${obj.RecorderName}&site=null`
// // var x = document.getElementsByClassName("pp")
// // var iframe = document.createElement('iframe');
// // console.log(url)
// // iframe.src=url
// // x.appendChild(iframe);
// }
return (
<Modal
visible={visible}
title={obj.Name}
onCancel={onCancel}
destroyOnClose
width="1000px"
maskClosable={false}
footer={[]}
>
<div className="pp">
< iframe style= {{ border: 0, width: "100%", height: 630,} } src={"http://127.0.0.1:8085"+`/web4/video/indexAll.html?ID=${obj.EquipmentCode}&skipCheck=true&name=${obj.Name}&disk=${obj.RecorderName}&site=null`}/>
</div>
</Modal>
)
}
export default VideoModal
\ No newline at end of file
/*
* @Description:
* @Author: leizhe
* @Date: 2021-08-03 11:38:03
* @LastEditTime: 2021-08-04 10:29:01
* @LastEditors: leizhe
*/
import React, { useState, useEffect } from 'react';
import styles from './index.less';
import { Row, Col, Select, Spin, Table, Input, Button } from 'antd';
import { SyncOutlined, PlusOutlined, ArrowUpOutlined } from '@ant-design/icons';
import { Row, Col, Select, Spin, Table, Input, Button, Space, Tooltip, Popconfirm, notification } from 'antd';
import { SyncOutlined, PlusOutlined, ArrowUpOutlined, EditTwoTone, DeleteOutlined, VideoCameraOutlined, ZoomInOutlined, CaretUpFilled, CaretDownFilled } from '@ant-design/icons';
import { GetVideoConfigList, deleteInsertVideoConfig } from '@/services/platform/videoManger';
import AddModal from './AddModal';
import CheckModal from './CheckModal';
import VideoModal from './VideoModal';
import voca from 'voca';
const videoManager = () => {
const [configurationType, setConfigurationType] = useState('1')
const [loading, setLoading] = useState(false); // 加载
const [data, setData] = useState([]); // 源数据
const [searchWord, setSearchWord] = useState(''); // 关键字
const { Search } = Input;
const [addVisible, setAddVisible] = useState(false)
const [checkVisible, setCheckVisible] = useState(false)
const [videoVisible, setVideoVisible] = useState(false)
const [type, setType] = useState('萤石云')//视频厂商类型
const [type1, setType1] = useState('bb')//表单样式
const [kind, setKind] = useState('')
const [tableData, setTableData] = useState('')
const [flag, setFlag] = useState(0)
const [obj, setObj] = useState({})
const [show1, setShow1] = useState('block')
const [show2, setShow2] = useState('none')
const columns = [
{
title: '名称',
dataIndex: 'Name',
key: 'Name',
width: 200,
align: 'center'
}, {
title: '视频厂商',
dataIndex: 'VideoManufacturer',
key: 'VideoManufacturer',
width: 150,
align: 'center'
}, {
title: '登录名',
dataIndex: 'LoginName',
key: 'LoginName',
width: 350,
align: 'center'
}, {
title: '登录密码',
dataIndex: 'LoginPwd',
key: 'LoginPwd',
width: 350,
align: 'center'
}, {
title: '设备编码',
dataIndex: 'EquipmentCode',
key: 'EquipmentCode',
width: 150,
align: 'center'
}, {
title: '通道ID',
dataIndex: 'PassageId',
key: 'PassageId',
width: 100,
align: 'center'
}, {
title: '刻录机名称',
dataIndex: 'RecorderName',
key: 'RecorderName',
width: 100,
align: 'center'
}, {
// title: '录入时间',
dataIndex: 'CreateTime',
key: 'CreateTime',
width: 150,
align: 'center',
title: (
<div>录入时间<Tooltip title="升序"><CaretUpFilled style={{display:show1,color:'#1890ff',marginTop: '-18px', marginLeft: '60%'}} onClick={()=> shengxu()}/></Tooltip><Tooltip title="降序"><CaretDownFilled style={{display:show2,color:'#1890ff',marginTop: '-18px', marginLeft: '60%'}} onClick={()=> jiangxu()}/></Tooltip></div>
)
}, {
title: '操作',
dataIndex: '',
key: '',
align: 'center',
render: record => (
<Space size="middle">
<Tooltip title="编辑">
<EditTwoTone
onClick={() => edit(record)}
style={{ fontSize: '16px' }}
/>
</Tooltip>
<Tooltip title="预览">
<VideoCameraOutlined
onClick={() => preView(record)}
style={{ fontSize: '16px', color: '#1890FF' }}
/>
</Tooltip>
<Tooltip title="查看">
<ZoomInOutlined
onClick={() => check(record)}
style={{ fontSize: '16px', color: '#1890FF' }}
/>
</Tooltip>
<Tooltip title="删除">
<Popconfirm
placement="bottomRight"
title={
<p>
即将删除{' '}
<span className={styles.redText}>
{voca.stripTags(record.Name)}
</span>
,是否确认删除?
</p>
}
okText="确认"
cancelText="取消"
onConfirm={() => delete1(record)}
>
<DeleteOutlined style={{ fontSize: '16px', color: '#e86060' }} />
</Popconfirm>
</Tooltip>
</Space>
),
}
]
const edit = record =>{
setAddVisible(true)
setKind('edit')
setObj(record)
}
const preView = record =>{
setVideoVisible(true)
setObj(record)
}
const check = record =>{
setCheckVisible(true)
setObj(record)
console.log(record)
}
const delete1 = record =>{
deleteInsertVideoConfig({Id:record.Id}).then(res =>{
if (res.msg === 'Ok') {
notification.success({
message: '提示',
duration: 3,
description: '删除成功',
});
setFlag(flag + 1);
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
})
}
const shengxu =()=>{
setShow1('none')
setShow2('block')
setLoading(true)
GetVideoConfigList({
VideoType: type,
pageIndex: 1,
pageSize: 1000,
IsAsc:true
}).then(res=>{
setLoading(false)
if(res.msg ==='Ok'){
setTableData(res.data.list)
}
})
}
const jiangxu =()=>{
setShow2('none')
setShow1('block')
setLoading(true)
GetVideoConfigList({
VideoType: type,
pageIndex: 1,
pageSize: 1000,
IsAsc:false
}).then(res=>{
setLoading(false)
if(res.msg ==='Ok'){
setTableData(res.data.list)
}
})
}
useEffect(()=>{
setLoading(true)
getData()
},[])
useEffect(()=>{
setLoading(true)
getData()
},[type,flag])
const getData =() =>{
GetVideoConfigList({
VideoType: type,
pageIndex: 1,
pageSize: 1000
}).then(res=>{
setLoading(false)
if(res.msg ==='Ok'){
setTableData(res.data.list)
}
})
}
const selectChange = value => {
setConfigurationType(value)
switch (value) {
case '1':
setType('萤石云')
setType1('bb')
break;
case '2':
setType('海康')
setType1('bb')
break;
case '3':
setType('海康1.2')
setType1('aa')
break;
case '4':
setType('海康NVR')
setType1('aa')
break;
}
}
// 获取搜索框的值
......@@ -35,22 +240,37 @@ const videoManager = () => {
};
//搜索
const submitSearchUser = () => {
GetVideoConfigList({
VideoType: type,
pageIndex: 1,
pageSize: 1000,
QueryWhere: searchWord
}).then(res=>{
if(res.msg ==='Ok'){
setTableData(res.data.list)
}
})
}
//重置
const handleReset = () =>{
const handleReset = () => {
setConfigurationType('1')
setSearchWord('')
setType('萤石云')
setType1('bb')
setFlag(flag+1)
}
//升级
const upgrade = () =>{
}
//新增
const addVideo = () =>{
const addVideo = () => {
setAddVisible(true)
setKind('add')
}
const onSubmit =()=>{
setAddVisible(false)
setFlag(flag+1)
}
return (
return (
<div className={styles.videoManagerContainer}>
<Row className={styles.head}>
<Col span={24}>
......@@ -65,7 +285,6 @@ const videoManager = () => {
<Option value="2">海康</Option>
<Option value="3">海康1.2</Option>
<Option value="4">海康NVR</Option>
<Option value="5">大华</Option>
</Select>
<span style={{ marginLeft: '50px' }}>快速搜索:</span>
<Search
......@@ -79,10 +298,7 @@ const videoManager = () => {
<Button icon={<SyncOutlined className={styles.icon} />} onClick={handleReset} style={{ marginLeft: '30px', verticalAlign: 'middle', marginTop: '-3px' }}>
重置
</Button>
<Button icon={<ArrowUpOutlined className={styles.icon} />} onClick={upgrade} style={{ marginLeft: '30px', verticalAlign: 'middle', marginTop: '-3px' }}>
一键升级
</Button>
<Button icon={<PlusOutlined className={styles.icon} />} onClick={addVideo} style={{ marginLeft: '30px', verticalAlign: 'middle', marginTop: '-3px' }}>
<Button icon={<PlusOutlined className={styles.icon} />} onClick={addVideo} style={{ marginLeft: '49%', verticalAlign: 'middle', marginTop: '-3px' }}>
新增
</Button>
</Col>
......@@ -92,9 +308,15 @@ const videoManager = () => {
<Table
size="small"
bordered
rowKey={record => record.Id}
columns={columns}
dataSource={data}
scroll={{ x: 'max-content', y: 'calc(100vh - 230px)' }}
dataSource={tableData}
scroll={{y: 'calc(100vh - 210px)' }}
onRow={record => {
return {
onDoubleClick: event => {event.stopPropagation(); edit(record)}, //双击
};
}}
pagination={{
showTotal: (total, range) =>
`第${range[0]}-${range[1]} 条/共 ${total} 条`,
......@@ -106,6 +328,38 @@ const videoManager = () => {
/>
</div>
</Spin>
<AddModal
visible={addVisible}
onCancel={() => {
setAddVisible(false)
}}
okText="确认"
cancelText="取消"
type={type}
type1={type1}
kind={kind}
obj={obj}
callBackSubmit={onSubmit}
/>
<CheckModal
visible={checkVisible}
onCancel={() => {
setCheckVisible(false)
}}
okText="确认"
cancelText="取消"
type={type}
type1={type1}
obj={obj}
/>
<VideoModal
visible={videoVisible}
onCancel={() => {
setVideoVisible(false)
}}
obj={obj}
/>
</div>
)
};
......
.videoManagerContainer{
.ant-table-pagination.ant-pagination {
margin: 2px 0;
}
.head{
padding: 10px;
background: white;
......@@ -15,4 +18,14 @@
margin-top: -5px !important;
vertical-align: text-bottom;
}
}
\ No newline at end of file
.redText{
color: red;
}
}
.ant-input[disabled] {
color: rgba(0, 0, 0, 0.5);
}
.ant-select-disabled.ant-select:not(.ant-select-customize-input) .ant-select-selector {
color: rgba(0, 0, 0, 0.5);
}
import { get, post, PUBLISH_SERVICE, CITY_SERVICE } from '@/services/index';
//获取视频配置列表
export const GetVideoConfigList = param =>
get(`${PUBLISH_SERVICE}/VideoManager/GetVideoConfigList`, param);
//添加配置
export const addInsertVideoConfig = data =>
post(`${PUBLISH_SERVICE}/VideoManager/InsertVideoConfig?type=add`, data);
//修改配置
export const editInsertVideoConfig = data =>
post(`${PUBLISH_SERVICE}/VideoManager/InsertVideoConfig?type=edit`, data);
//删除配置
export const deleteInsertVideoConfig = data =>
post(`${PUBLISH_SERVICE}/VideoManager/InsertVideoConfig?type=delete`, data);
\ No newline at end of file
......@@ -2,7 +2,7 @@
* @Description:
* @Author: leizhe
* @Date: 2021-07-23 10:42:58
* @LastEditTime: 2021-09-01 10:50:55
* @LastEditTime: 2021-09-16 16:57:48
* @LastEditors: leizhe
*/
import { CITY_SERVICE, get, PUBLISH_SERVICE, post, postForm } from '../index';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment