From ee8881a661b5b2acdcfdb72091db9d1a9b371e0f Mon Sep 17 00:00:00 2001 From: deartibers <947466799@qq.com> Date: Fri, 6 May 2022 11:35:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9nvr?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/cameraModal.jsx | 22 +++++++++++---- .../components/nvrModal.jsx | 28 ++++++++++++------- .../equipmentWarehouse/containers/nvr.jsx | 14 ++++------ 3 files changed, 40 insertions(+), 24 deletions(-) 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 b837f96..f9cd3c6 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,8 +1,9 @@ import React, { useState ,useRef} from 'react' +import { connect } from "react-redux"; 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){ +function cameraModal(props){ const { TextArea } = Form; const {modalName,visible,close}=props const form = useRef(); @@ -12,8 +13,8 @@ function nvrModal(props){ const [step,setstep] = useState(0)//第几步 const [okText,setokText] = useState('确定')//ok弹框text 右边 const [cancelText,setcancelText] = useState('取消')//取消弹框text 左边 - const [cloud,setcloud] = useState('') - const [voice,setvoice] = useState('') + const [cloud,setcloud] = useState('')//云台支持 + const [voice,setvoice] = useState('')//语音支持 const opts ={//添加完成确认后通知 title:'Hi', content:'添加成功', @@ -59,7 +60,7 @@ function nvrModal(props){ setcancelText('上一步'); setloading(false); }, 2000); - },2000) + }, 2000) }, 2000); }) .catch(errors=>{//表单校验失败 @@ -90,7 +91,7 @@ function nvrModal(props){ } } function handleLocation(){//高德经纬度 - console.log('handleLocationhandleLocation'); + window.open('https://lbs.amap.com/tools/picker','_blank') } function handleChoose(id){//选择摄像头接入类型 setclickNum(id); @@ -336,5 +337,14 @@ function nvrModal(props){ ); } +function mapStateToProps(state) { + const { auth, global, members } = state; + return { + loading: members.isRequesting, + user: auth.user, + actions: global.actions, + members: members.data, + }; +} -export default nvrModal \ No newline at end of file +export default connect(mapStateToProps)(cameraModal); \ 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 b065ac8..09c230a 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,12 +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 { Modal,Form,Row,Col,Spin,Notification,close } from '@douyinfe/semi-ui'; import { IconTickCircle } from '@douyinfe/semi-icons'; function nvrModal(props){ const {modalName}=props - const { dispatch, actions, user, loading } = props; - const venderList=props.venderList||[]//设备厂家 + const { dispatch, actions, user, loading,vender } = props; const nvrData = props.nvrData||{}//修改时传来的值 + console.log('nvrDatanvrDatanvrData',nvrData); const form = useRef(); const [visible, setVisible] = useState(false);//是否显示弹框 const [isloading,setloading] = useState(false);//是否显示loading @@ -48,6 +48,11 @@ function nvrModal(props){ let valuesObj=JSON.parse(JSON.stringify(values)) valuesObj.longitude=values.position.split(',')[0] valuesObj.latitude=values.position.split(',')[1] + delete valuesObj.position + if(nvrData.id){ + valuesObj.id=nvrData.id + } + console.log('valuesObjvaluesObj',valuesObj); setformObj(valuesObj) setloading(true); setTimeout(() => { @@ -72,6 +77,7 @@ function nvrModal(props){ dispatch(actions.equipmentWarehouse.addchangeNvr(formObj)).then(res => { Notification.success(opts) setVisible(false); + close(); }) } } @@ -109,6 +115,7 @@ function nvrModal(props){ {step==0?
form.current = formApi}> - - + - - - {venderList.map((item,index)=>( + + {vender.map((item,index)=>( {item.name} ))} - { - const { dispatch, actions, user, loading, equipmentWarehouseNvr } = props; + const { dispatch, actions, user, loading, equipmentWarehouseNvr,vender } = props; const { equipmentWarehouse } = actions; const [setup, setSetup] = useState(false); const [sideSheet, setSideSheet] = useState(false); @@ -15,11 +15,8 @@ const NvrHeader = (props) => { const [pagination, setPagination] = useState({limit:10,page:0}); const SETUPS = "setups"; - const [venderList,setvenderList] =useState([]); useEffect(() => { - dispatch(actions.equipmentWarehouse.getVender()).then(res => { - setvenderList(res.payload.data) - }) + dispatch(actions.equipmentWarehouse.getVender()) }, []) const columns = [ @@ -63,7 +60,7 @@ const NvrHeader = (props) => { return ( <>
@@ -422,13 +419,14 @@ console.log(equipmentWarehouseNvr); }; function mapStateToProps(state) { - const { auth, global, members, equipmentWarehouseNvr } = state; + const { auth, global, members, equipmentWarehouseNvr,vender } = state; return { loading: members.isRequesting, user: auth.user, actions: global.actions, members: members.data, equipmentWarehouseNvr: equipmentWarehouseNvr.data || [], + vender:vender.data||[],//设备厂家 }; }