|
|
@ -3,6 +3,8 @@ import { Input, Form, Button, Table, Row,Pagination, Col,Modal,Select,TimePicker |
|
|
|
import ajax from "@/services"; |
|
|
|
import { DeleteOutlined, UploadOutlined } from "@ant-design/icons"; |
|
|
|
import { dictionary, utils } from "@/config/common"; |
|
|
|
import { useImperativeHandle } from "react"; |
|
|
|
import moment from "moment"; |
|
|
|
const {TextArea}=Input |
|
|
|
function GateControlManagement(props) { |
|
|
|
const {id}=props |
|
|
@ -97,12 +99,15 @@ function GateControlManagement(props) { |
|
|
|
} |
|
|
|
//编辑 |
|
|
|
const operateData=(row)=>{ |
|
|
|
let arr=row.s_e_time?.split(",") |
|
|
|
let s_e_time=[moment(arr[0],"HH:mm:ss"),moment(arr[1],"HH:mm:ss")] |
|
|
|
console.log(arr[0],arr[1],s_e_time); |
|
|
|
openForm.setFieldsValue({ |
|
|
|
group_id:row.group_id, |
|
|
|
option_id:row.option_id, |
|
|
|
channel_id:row.channel_id, |
|
|
|
note:row.note, |
|
|
|
// s_e_time:row.s_e_time?.split(",")||null |
|
|
|
s_e_time:s_e_time |
|
|
|
}) |
|
|
|
setOpenId(row.id) |
|
|
|
setOpenVisible(true) |
|
|
@ -142,7 +147,7 @@ function GateControlManagement(props) { |
|
|
|
//获取下拉框所有数据 |
|
|
|
const getOptionData=()=>{ |
|
|
|
ajax |
|
|
|
.getOpenAllOption() |
|
|
|
.getOpenAllOption({road_id:id}) |
|
|
|
.then((res) => { |
|
|
|
if (res.status === 20000) { |
|
|
|
|
|
|
@ -156,34 +161,59 @@ function GateControlManagement(props) { |
|
|
|
const onFinish=(value)=>{ |
|
|
|
let s_e_time="" |
|
|
|
value.s_e_time?.map((item,index)=>{ |
|
|
|
let str=item.format("HH-mm-ss"); |
|
|
|
let str=item.format("HH:mm:ss"); |
|
|
|
index!=1?s_e_time=str+",":s_e_time+=str; |
|
|
|
}) |
|
|
|
let ajaxData={ |
|
|
|
...value, |
|
|
|
s_e_time:"", |
|
|
|
id:openId |
|
|
|
s_e_time:s_e_time, |
|
|
|
id:openId, |
|
|
|
road_id:id, |
|
|
|
} |
|
|
|
ajax.addOpenData(ajaxData).then((res) => { |
|
|
|
if (res.status === 20000) { |
|
|
|
message.success(res.message) |
|
|
|
setOpenVisible(false) |
|
|
|
openForm.setFieldsValue({ |
|
|
|
group_id:null, |
|
|
|
option_id:null, |
|
|
|
channel_id:null, |
|
|
|
note:"", |
|
|
|
s_e_time:null |
|
|
|
}) |
|
|
|
getOpenData() |
|
|
|
setOpenId("") |
|
|
|
}else{ |
|
|
|
message.warning(res.message) |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
console.error(err); |
|
|
|
}); |
|
|
|
if(!ajaxData.id){ |
|
|
|
ajax.addOpenData(ajaxData).then((res) => { |
|
|
|
if (res.status === 20000) { |
|
|
|
message.success(res.message) |
|
|
|
setOpenVisible(false) |
|
|
|
openForm.setFieldsValue({ |
|
|
|
group_id:null, |
|
|
|
option_id:null, |
|
|
|
channel_id:null, |
|
|
|
note:"", |
|
|
|
s_e_time:null |
|
|
|
}) |
|
|
|
getOpenData() |
|
|
|
setOpenId("") |
|
|
|
}else{ |
|
|
|
message.warning(res.message) |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
console.error(err); |
|
|
|
}); |
|
|
|
}else{ |
|
|
|
ajax.editOpenData(ajaxData).then((res) => { |
|
|
|
if (res.status === 20000) { |
|
|
|
message.success(res.message) |
|
|
|
setOpenVisible(false) |
|
|
|
openForm.setFieldsValue({ |
|
|
|
group_id:null, |
|
|
|
option_id:null, |
|
|
|
channel_id:null, |
|
|
|
note:"", |
|
|
|
s_e_time:null |
|
|
|
}) |
|
|
|
getOpenData() |
|
|
|
setOpenId("") |
|
|
|
}else{ |
|
|
|
message.warning(res.message) |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
console.error(err); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
const onCancel=()=>{ |
|
|
|
setOpenVisible(false) |
|
|
@ -231,7 +261,15 @@ function GateControlManagement(props) { |
|
|
|
return ( |
|
|
|
<div className="open-modal-page"> |
|
|
|
<header style={{ margin: "10px 0" }}> |
|
|
|
<Button type="primary" onClick={()=>{setOpenVisible(true)}}>添加入场开闸流程</Button> |
|
|
|
<Button type="primary" onClick={()=>{ |
|
|
|
setOpenVisible(true); |
|
|
|
openForm.setFieldsValue({ |
|
|
|
group_id:null, |
|
|
|
option_id:null, |
|
|
|
channel_id:null, |
|
|
|
note:"", |
|
|
|
s_e_time:null |
|
|
|
})}}>添加入场开闸流程</Button> |
|
|
|
</header> |
|
|
|
<main> |
|
|
|
<Table |
|
|
|