From 981dc894c499d9c26b9aecf22a40f40f435c7ea4 Mon Sep 17 00:00:00 2001
From: deartibers <947466799@qq.com>
Date: Thu, 5 May 2022 17:19:30 +0800
Subject: [PATCH] =?UTF-8?q?nvr=E6=8E=A5=E5=8F=A3=E8=B0=83=E8=AF=95?=
=?UTF-8?q?=E4=BB=A5=E5=8F=8A=E6=91=84=E5=83=8F=E5=A4=B4=E9=A1=B5=E9=9D=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../equipmentWarehouse/actions/nvr.js | 22 +++
.../components/cameraModal.jsx | 140 +++++++++++++++++-
.../components/cameraModal.less | 6 +
.../components/nvrModal.jsx | 65 ++++++--
.../equipmentWarehouse/containers/nvr.jsx | 10 +-
.../web/client/src/utils/webapi.js | 2 +
6 files changed, 229 insertions(+), 16 deletions(-)
create mode 100644 code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/cameraModal.less
diff --git a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/actions/nvr.js b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/actions/nvr.js
index 367fa0e..f51a9a5 100644
--- a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/actions/nvr.js
+++ b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/actions/nvr.js
@@ -13,3 +13,25 @@ export function getMembers (orgId) {
reducer: { name: 'members' }
});
}
+
+export function addchangeNvr (data) {
+ return dispatch => basicAction({
+ type: 'post',
+ dispatch: dispatch,
+ data,
+ actionType: 'ADD_CHANGE_NVR',
+ url: `${ApiTable.nvr}`,
+ msg: { option: '添加/修改' },
+ });
+}
+
+export function getVender () {//获取设备厂商
+ return dispatch => basicAction({
+ type: 'get',
+ dispatch: dispatch,
+ actionType: 'GET_VENDER',
+ url: `${ApiTable.getVender}`,
+ msg: { error: '获取设备厂商失败' },
+ reducer: { name: 'vender' }
+ });
+}
\ No newline at end of file
diff --git a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/cameraModal.jsx b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/cameraModal.jsx
index 0d19d87..b837f96 100644
--- a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/cameraModal.jsx
+++ b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/cameraModal.jsx
@@ -1,15 +1,19 @@
import React, { useState ,useRef} from 'react'
import { Modal,Form,Row,Col,Spin,Notification,Button } from '@douyinfe/semi-ui';
import { IconChevronLeft,IconChevronRight } from '@douyinfe/semi-icons';
+import "./cameraModal.less";
function nvrModal(props){
+ const { TextArea } = Form;
const {modalName,visible,close}=props
const form = useRef();
// const [visible, setVisible] = useState(false);//是否显示弹框
const [isloading,setloading] = useState(false);//是否显示loading
const [loadingTip,setloadingTip] = useState('获取中...请稍后...');//loading tip的值
const [step,setstep] = useState(0)//第几步
- const [okText,setokText] = useState('测试校验')//ok弹框text 右边
+ const [okText,setokText] = useState('确定')//ok弹框text 右边
const [cancelText,setcancelText] = useState('取消')//取消弹框text 左边
+ const [cloud,setcloud] = useState('')
+ const [voice,setvoice] = useState('')
const opts ={//添加完成确认后通知
title:'Hi',
content:'添加成功',
@@ -193,6 +197,140 @@ function nvrModal(props){
+
>
diff --git a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/cameraModal.less b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/cameraModal.less
new file mode 100644
index 0000000..a53e2f0
--- /dev/null
+++ b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/cameraModal.less
@@ -0,0 +1,6 @@
+.semi-radio-cardRadioGroup_checked .cloud{
+ color: #1859C1;
+}
+.semi-radio-cardRadioGroup_checked .voice{
+ color: #1859C1;
+}
\ No newline at end of file
diff --git a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/nvrModal.jsx b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/nvrModal.jsx
index fd36234..b065ac8 100644
--- a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/nvrModal.jsx
+++ b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/nvrModal.jsx
@@ -1,9 +1,12 @@
import React, { useState ,useRef} from 'react'
+import { connect } from "react-redux";
import { Modal,Form,Row,Col,Spin,Notification } from '@douyinfe/semi-ui';
import { IconTickCircle } from '@douyinfe/semi-icons';
function nvrModal(props){
const {modalName}=props
- const nvrData = props.nvrData||{}
+ const { dispatch, actions, user, loading } = props;
+ const venderList=props.venderList||[]//设备厂家
+ const nvrData = props.nvrData||{}//修改时传来的值
const form = useRef();
const [visible, setVisible] = useState(false);//是否显示弹框
const [isloading,setloading] = useState(false);//是否显示loading
@@ -11,6 +14,7 @@ function nvrModal(props){
const [step,setstep] = useState(0)//第几步
const [okText,setokText] = useState('测试校验')//ok弹框text 右边
const [cancelText,setcancelText] = useState('取消')//取消弹框text 左边
+ const [formObj,setformObj] = useState()//接口入参
const opts ={//添加完成确认后通知
title:'Hi',
content:'添加成功',
@@ -19,10 +23,32 @@ function nvrModal(props){
function showDialog() {//打开弹框
setVisible(true);
}
+ function positionForm(val){
+ let zz = /^(-?\d+)(\.\d+)?$/
+ if(!val){
+ return '请输入或拾取高德经纬度坐标'
+ }
+ else if(val.split(',').length!=2){
+ return '请输入格式为116.354169,39.835452的经纬度坐标'
+ }
+ else if(!zz.test(val.split(',')[0])){
+ return '只能填写数字'
+ }
+ else if(!zz.test(val.split(',')[1])){
+ return '只能填写数字'
+ }
+ else{
+ return ''
+ }
+ }
function handleOk() {//点击弹框确定 右边按钮
if(step==0){
form.current.validate()
.then(values=>{//表单校验成功
+ let valuesObj=JSON.parse(JSON.stringify(values))
+ valuesObj.longitude=values.position.split(',')[0]
+ valuesObj.latitude=values.position.split(',')[1]
+ setformObj(valuesObj)
setloading(true);
setTimeout(() => {
setloadingTip('...接受成功')
@@ -43,8 +69,10 @@ function nvrModal(props){
}
else{
- Notification.success(opts)
- setVisible(false);
+ dispatch(actions.equipmentWarehouse.addchangeNvr(formObj)).then(res => {
+ Notification.success(opts)
+ setVisible(false);
+ })
}
}
function handleAfterClose(){//在关闭之后
@@ -63,7 +91,7 @@ function nvrModal(props){
}
}
function handleLocation(){//高德经纬度
- console.log('handleLocationhandleLocation');
+ window.open('https://lbs.amap.com/tools/picker','_blank')
}
return (
<>
@@ -88,29 +116,30 @@ function nvrModal(props){
getFormApi={formApi => form.current = formApi}>
-
-
+
-
-
- Semi
- 轻颜相机
- 今日头条
+
+ {venderList.map((item,index)=>(
+ {item.name}
+ ))}
-
@@ -148,4 +177,14 @@ function nvrModal(props){
);
}
-export default nvrModal
\ No newline at end of file
+function mapStateToProps(state) {
+ const { auth, global, members } = state;
+ return {
+ loading: members.isRequesting,
+ user: auth.user,
+ actions: global.actions,
+ members: members.data,
+ };
+}
+
+export default connect(mapStateToProps)(nvrModal);
\ No newline at end of file
diff --git a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/nvr.jsx b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/nvr.jsx
index 6663347..ed08e7e 100644
--- a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/nvr.jsx
+++ b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/nvr.jsx
@@ -12,6 +12,12 @@ const NvrHeader = (props) => {
const [sideSheet, setSideSheet] = useState(false);
const [setupp, setSetupp] = useState([]);
const SETUPS = "setups";
+ const [venderList,setvenderList] =useState([]);
+ useEffect(() => {
+ dispatch(actions.equipmentWarehouse.getVender()).then(res => {
+ setvenderList(res.payload.data)
+ })
+}, [])
const columns = [
{
@@ -57,7 +63,7 @@ const NvrHeader = (props) => {
return (
<>