|
|
@ -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||[],//设备厂家 |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|