diff --git a/code/VideoAccess-VCMP/web/client/src/components/index.js b/code/VideoAccess-VCMP/web/client/src/components/index.js
index 531e165..959c940 100644
--- a/code/VideoAccess-VCMP/web/client/src/components/index.js
+++ b/code/VideoAccess-VCMP/web/client/src/components/index.js
@@ -1,8 +1,10 @@
'use strict';
import SimpleFileDownButton from './simpleFileDownButton'
import Coming from './coming'
+import ReminderBox from './reminderBox'
export {
SimpleFileDownButton,
- Coming
+ Coming,
+ ReminderBox
};
diff --git a/code/VideoAccess-VCMP/web/client/src/components/reminderBox.jsx b/code/VideoAccess-VCMP/web/client/src/components/reminderBox.jsx
new file mode 100644
index 0000000..162c4a4
--- /dev/null
+++ b/code/VideoAccess-VCMP/web/client/src/components/reminderBox.jsx
@@ -0,0 +1,45 @@
+import { Button, Checkbox, Modal } from "@douyinfe/semi-ui";
+import React from "react";
+
+const ReminderBox = ({title, wait, toadd,visible,onOk}) => {
+ return (
+
+ {title}
+
+ }
+ icon={
+
+ }
+ footer={
+
+
console.log(checked)}
+ aria-label="Checkbox 示例"
+ style={{ width: 100 }}
+ >
+ 不在提醒
+
+
+
+
+
+
+ }
+ // visible={false}
+ visible={visible}
+ >
+ );
+};
+
+export default ReminderBox;
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 1c45006..e833cd9 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
@@ -89,3 +89,17 @@ export function getExport() {
reducer: { name: "" },
});
}
+
+
+export function getCheck(data) {
+ return (dispatch) =>
+ basicAction({
+ type: "post",
+ dispatch: dispatch,
+ data,
+ actionType: "GET_CHECK",
+ url: `${ApiTable.getCheck}`,
+ msg: { option: "" }, //校验nvr信息
+ reducer: { name: "" },
+ });
+}
\ 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 374c715..c3efa6d 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,177 +1,284 @@
-import React, { useState ,useRef} from 'react'
+import React, { useState, useRef, useEffect } from "react";
import { connect } from "react-redux";
-import { Modal,Form,Row,Col,Spin } from '@douyinfe/semi-ui';
-import { IconTickCircle } from '@douyinfe/semi-icons';
-function nvrModal(props){
- const {modalName}=props
- const { dispatch, actions,vender,close } = props;
- const nvrData = props.nvrData||{}//修改时传来的值
+import { Modal, Form, Row, Col, Spin } from "@douyinfe/semi-ui";
+import { IconTickCircle } from "@douyinfe/semi-icons";
+
+import moment from "moment";
+
+function nvrModal(props) {
+ const { modalName } = props;
+ const { dispatch, actions, vender, close } = props;
+ const nvrData = props.nvrData || {}; //修改时传来的值
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 [cancelText,setcancelText] = useState('取消')//取消弹框text 左边
- const [formObj,setformObj] = useState()//接口入参
- function showDialog() {//打开弹框
+ const [visible, setVisible] = useState(false); //是否显示弹框
+ const [isloading, setloading] = useState(false); //是否显示loading
+ const [loadingTip, setloadingTip] = useState("获取中...请稍后..."); //loading tip的值
+ const [step, setstep] = useState("none"); //第几步
+ const [okText, setokText] = useState("测试校验"); //ok弹框text 右边
+ const [cancelText, setcancelText] = useState("取消"); //取消弹框text 左边
+ const [formObj, setformObj] = useState(); //接口入参
+
+ useEffect(() => {
+ console.log(props.user.id);
+ }, []);
+
+ 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 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]
- delete valuesObj.position
- if(nvrData.id){
- valuesObj.id=nvrData.id
- }
- setformObj(valuesObj)
- setloading(true);
- setTimeout(() => {
- setloadingTip('...接受成功')
- setTimeout(()=>{
- setloadingTip('已完成')
- setTimeout(() => {
- setstep(1);
- setokText('确认');
- setcancelText('上一步');
- setloading(false);
- }, 1000);
- }, 1000)
- }, 1000);
- })
- .catch(errors=>{//表单校验失败
- console.log('errors',errors);
- })
- }
- else{
- dispatch(actions.equipmentWarehouse.addchangeNvr(formObj)).then(res => {
+ function handleOk() {
+ //点击弹框确定 右边按钮
+ if (step == "none") {
+ form.current
+ .validate()
+ .then((values) => {
+ //表单校验成功
+ console.log(values);
+
+ 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;
+ }
+ var x = new moment();
+ setloading(true);
+ dispatch(
+ actions.equipmentWarehouse.getCheck({
+ serialNo: valuesObj.serialNo,
+ })
+ ).then((res) => {
+ console.log(res);
+ var y = new moment();
+ var duration = moment.duration(y.diff(x))._data.milliseconds;
+ if (res.success) {
+ setTimeout(
+ () => {
+ setloadingTip("已完成");
+ setTimeout(() => {
+ setstep("block");
+ setloading(false);
+ setokText("确认");
+ setcancelText("上一步");
+ setloadingTip("获取中...请稍后...");
+ }, 1000);
+ },
+ duration > 2000 ? 0 : 2000 - duration
+ );
+ } else {
+ setTimeout(
+ () => {
+ setloadingTip("校验失败");
+ setTimeout(() => {
+ setstep("none");
+ setloading(false);
+ setokText("测试校验");
+ setcancelText("取消");
+ setloadingTip("获取中...请稍后...");
+ }, 1000);
+ },
+ duration > 2000 ? 0 : 2000 - duration
+ );
+ }
+ });
+ setformObj(valuesObj);
+ })
+ .catch((errors) => {
+ //表单校验失败
+ console.log("errors", errors);
+ });
+ } else {
+ dispatch(actions.equipmentWarehouse.addchangeNvr(formObj)).then((res) => {
setVisible(false);
close();
- })
+ });
}
}
- function handleAfterClose(){//在关闭之后
- setstep(0);
- setokText('测试校验');
- setcancelText('取消');
+ function handleAfterClose() {
+ //在关闭之后
+ setstep("none");
+ setokText("测试校验");
+ setcancelText("取消");
}
- function handleCancel() {//点击弹框取消 左边按钮
- if(step==0){
+ function handleCancel() {
+ //点击弹框取消 左边按钮
+ if (step == "none") {
setVisible(false);
- }
- else{
- setstep(0);
- setokText('测试校验');
- setcancelText('取消');
+ } else {
+ setstep("none");
+ setokText("测试校验");
+ setcancelText("取消");
}
}
- function handleLocation(){//高德经纬度
- window.open('https://lbs.amap.com/tools/picker','_blank')
+ function handleLocation() {
+ //高德经纬度
+ window.open("https://lbs.amap.com/tools/picker", "_blank");
}
return (
<>
-
{modalName=='add'?'添加NVR':'修改'}
+ {modalName == "add" ? "添加NVR" : "修改"}
- {step==0?