Browse Source

修改nvr

release_0.0.1
deartibers 3 years ago
parent
commit
ee8881a661
  1. 22
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/cameraModal.jsx
  2. 28
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/nvrModal.jsx
  3. 14
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/nvr.jsx

22
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('确定')//oktext
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
export default connect(mapStateToProps)(cameraModal);

28
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){
<Spin tip={loadingTip} spinning={isloading}>
{step==0?<div style={{paddingLeft:16}}>
<Form
allowEmpty
labelPosition='left'
labelAlign='left'
labelWidth= '90px'
@ -116,29 +123,29 @@ function nvrModal(props){
getFormApi={formApi => form.current = formApi}>
<Row>
<Col span={12}>
<Form.Input maxLength='39' field='serialNo' label='设备编号:' initValue={nvrData.name||''} placeholder='请输入设备编号' style={{ width:149 }}
<Form.Input maxLength='39' field='serialNo' label='设备编号:' initValue={nvrData.serialNo||''} placeholder='请输入设备编号' style={{ width:149 }}
rules={[
{ required: true, message: '请输入设备编号' }
]}/>
</Col>
<Col span={12}>
<Form.Input maxLength='15' field='regionCode' label='行政区区码:' placeholder='请输入行政区区码' style={{ width:149 }}/>
<Form.Input maxLength='15' field='regionCode' label='行政区区码:' initValue={nvrData.regionCode||''} placeholder='请输入行政区区码' style={{ width:149 }}/>
</Col>
<Col span={24}>
<Form.Input maxLength='36' field='name' label='设备名称:' placeholder='请输入设备名称、常用项目或位置定义' style={{ width:421 }}
<Form.Input maxLength='36' field='name' label='设备名称:' initValue={nvrData.name||''} placeholder='请输入设备名称、常用项目或位置定义' style={{ width:421 }}
rules={[
{ required: true, message: '请输入设备名称、常用项目或位置定义' }
]}/>
</Col>
<Col span={24}>
<Form.Select label="设备厂家:" field='venderId' placeholder='请选择设备厂家' style={{ width: 421 }}>
{venderList.map((item,index)=>(
<Form.Select label="设备厂家:" field='venderId' initValue={nvrData.venderId||''} placeholder='请选择设备厂家' style={{ width: 421 }}>
{vender.map((item,index)=>(
<Form.Select.Option key={index} value={item.id}>{item.name}</Form.Select.Option>
))}
</Form.Select>
</Col>
<Col span={24} style={{display:'flex'}}>
<Form.Input maxLength='39' field='position' label='安装位置:' placeholder='请输入或拾取高德经纬度坐标' style={{ width:386 }}
<Form.Input maxLength='39' field='position' label='安装位置:' initValue={nvrData.longitude&&nvrData.latitude?nvrData.longitude+','+nvrData.latitude:''} placeholder='请输入或拾取高德经纬度坐标' style={{ width:386 }}
validate={positionForm}
rules={[
{ required: true, message: '请输入或拾取高德经纬度坐标' }
@ -178,12 +185,13 @@ function nvrModal(props){
}
function mapStateToProps(state) {
const { auth, global, members } = state;
const { auth, global, members,vender } = state;
return {
loading: members.isRequesting,
user: auth.user,
actions: global.actions,
members: members.data,
vender:vender.data||[],//
};
}

14
code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/nvr.jsx

@ -7,7 +7,7 @@ import Setup from "../components/setup";
import SideSheets from "../components/sideSheet";
const NvrHeader = (props) => {
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 (
<>
<Button theme="borderless">
<NvrModal nvrData={row} modalName="revise" venderList={venderList}/>
<NvrModal nvrData={row} modalName="revise"/>
</Button>
<Button
theme="borderless"
@ -204,7 +201,7 @@ console.log(equipmentWarehouseNvr);
cursor: "pointer",
}}
>
<NvrModal modalName="add" venderList={venderList} />
<NvrModal modalName="add"/>
</div>
</div>
</div>
@ -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||[],//
};
}

Loading…
Cancel
Save