Browse Source

弹框修改

release_0.0.1
deartibers 3 years ago
parent
commit
27594bada8
  1. 80
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/nvrModal.jsx
  2. 2
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/nvr.jsx

80
code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/nvrModal.jsx

@ -1,16 +1,27 @@
import React, { useState } from 'react'
import { Modal,Form,Row,Col,Spin } from '@douyinfe/semi-ui';
import React, { useState ,useRef} from 'react'
import { Modal,Form,Row,Col,Spin,Notification } from '@douyinfe/semi-ui';
import { IconTickCircle } from '@douyinfe/semi-icons';
function nvrModal(props){
const {modalName}=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 [step,setstep] = useState(0)//
const [okText,setokText] = useState('测试校验')//oktext
const [cancelText,setcancelText] = useState('取消')//text
const opts ={//
title:'Hi',
content:'添加成功',
duration:3
}
function showDialog() {//
setVisible(true);
}
function handleOk() {//
// setVisible(false);
function handleOk() {//
if(step==0){
form.current.validate()
.then(values=>{//
setloading(true);
setTimeout(() => {
setloadingTip('...接受成功')
@ -18,38 +29,62 @@ function nvrModal(props){
setloadingTip('已完成')
setTimeout(() => {
setstep(1);
setokText('确认');
setcancelText('上一步');
setloading(false);
}, 2000);
},2000)
}, 2000);
})
.catch(errors=>{//
console.log('errors',errors);
})
}
else{
Notification.success(opts)
setVisible(false);
}
}
function handleAfterClose(){//
console.log('after');
setstep(0);
setokText('测试校验');
setcancelText('取消');
}
function handleCancel() {//
function handleCancel() {//
if(step==0){
setVisible(false);
}
else{
setstep(0);
setokText('测试校验');
setcancelText('取消');
}
}
function handleLocation(){//
console.log('handleLocationhandleLocation');
}
return (
<>
<div onClick={showDialog}>{props.modalName}</div>
<div onClick={showDialog}>{modalName}</div>
<Modal
title="添加NVR"
okText="测试校验"
// cancelText
okText={okText}
cancelText={cancelText} //
visible={visible}
onOk={handleOk}
height={386}
width={607}
afterClose={handleAfterClose} //>=1.16.0
afterClose={handleAfterClose}
onCancel={handleCancel}
>
<Spin tip={loadingTip} spinning={isloading}>
{step==0?<div style={{paddingLeft:16+'px'}}>
{step==0?<div style={{paddingLeft:16}}>
<Form
labelPosition='left'
labelAlign='left'
labelWidth= '90px'
onValueChange={values=>console.log(values)}>
onValueChange={values=>console.log(values)}
getFormApi={formApi => form.current = formApi}>
<Row>
<Col span={12}>
<Form.Input field='UserName' label='设备编号:' placeholder='请输入设备编号' style={{ width:149 }}
@ -67,13 +102,13 @@ function nvrModal(props){
]}/>
</Col>
<Col span={24}>
<Form.Select label="设备厂家:" field='business2' placeholder='请选择设备厂家' style={{ width: 421+'px' }}>
<Form.Select label="设备厂家:" field='business2' placeholder='请选择设备厂家' style={{ width: 421 }}>
<Form.Select.Option value="abc">Semi</Form.Select.Option>
<Form.Select.Option value="ulikeCam">轻颜相机</Form.Select.Option>
<Form.Select.Option value="toutiao">今日头条</Form.Select.Option>
</Form.Select>
</Col>
<Col span={24} style={{display:'flex',alignItems:'center'}}>
<Col span={24} style={{display:'flex'}}>
<Form.Input field='Use11rName131' label='安装位置:' placeholder='请输入或拾取高德经纬度坐标' style={{ width:386 }}
rules={[
{ required: true, message: '请输入或拾取高德经纬度坐标' }
@ -82,20 +117,23 @@ function nvrModal(props){
width:32,
height:32,
background:"#1859C1",
marginLeft:4+'px',
marginLeft:4,
display:'flex',
justifyContent: 'center',
alignItems: 'center',
cursor: "pointer",
borderRadius: 3+'px'}}>
marginTop:12,
borderRadius: 3+'px'}}
onClick={handleLocation}>
<img src="../../../assets/images/background/location.png" width={16} height={20}/>
</div>
</Col>
</Row>
</Form>
</div>:
<div >
<div style={{marginTop:50,display: 'flex', justifyContent: 'center'}}>
</div>
://
<div style={{height:224}}>
<div style={{paddingTop:50,display: 'flex', justifyContent: 'center'}}>
<IconTickCircle style={{color:'#04B234',fontSize:60}}/>
</div>
<div style={{marginTop:20,display: 'flex', justifyContent: 'center'}}>

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

@ -67,7 +67,7 @@ const NvrHeader = (props) => {
render: (y) => {
return (
<>
<Button theme="borderless">修改</Button>
<Button theme="borderless"><NvrModal modalName="修改" /></Button>
<Button theme="borderless">查看</Button>
<Button theme="borderless">删除</Button>
</>

Loading…
Cancel
Save