|
@ -1,10 +1,11 @@ |
|
|
import React, { useState,useEffect } from "react"; |
|
|
import React, { useState,useEffect } from "react"; |
|
|
import { Input, Form, Button, Table, Row, Col,Modal,Select,TimePicker } from "antd"; |
|
|
|
|
|
|
|
|
import { Input, Form, Button, Table, Row, Col,Modal,Select,TimePicker,message } from "antd"; |
|
|
import ajax from "@/services"; |
|
|
import ajax from "@/services"; |
|
|
const {TextArea}=Input |
|
|
const {TextArea}=Input |
|
|
function GateControlManagement() { |
|
|
function GateControlManagement() { |
|
|
//添加入场开闸流程弹框 |
|
|
//添加入场开闸流程弹框 |
|
|
const [openVisible,setOpenVisible]=useState(false) |
|
|
const [openVisible,setOpenVisible]=useState(false) |
|
|
|
|
|
const [dataSource,setDataSource]=useState([]) |
|
|
const columns = [ |
|
|
const columns = [ |
|
|
{ |
|
|
{ |
|
|
title: "序号", |
|
|
title: "序号", |
|
@ -53,6 +54,12 @@ function GateControlManagement() { |
|
|
dataIndex: "action", |
|
|
dataIndex: "action", |
|
|
key: "action", |
|
|
key: "action", |
|
|
align: "center", |
|
|
align: "center", |
|
|
|
|
|
render:(item,row)=>{ |
|
|
|
|
|
return <> |
|
|
|
|
|
<span>编辑</span> |
|
|
|
|
|
<span>删除</span> |
|
|
|
|
|
</> |
|
|
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
]; |
|
|
]; |
|
|
//表单 |
|
|
//表单 |
|
@ -88,33 +95,57 @@ function GateControlManagement() { |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
const onFinish=(value)=>{ |
|
|
const onFinish=(value)=>{ |
|
|
console.log(value); |
|
|
|
|
|
|
|
|
let start_stop_time="" |
|
|
|
|
|
value.start_stop_time.map((item,index)=>{ |
|
|
|
|
|
let str=item.format("HH-mm-ss"); |
|
|
|
|
|
index!=1?start_stop_time=str+",":start_stop_time+=str; |
|
|
|
|
|
}) |
|
|
|
|
|
let ajaxData={ |
|
|
|
|
|
...value, |
|
|
|
|
|
start_stop_time:start_stop_time |
|
|
|
|
|
} |
|
|
|
|
|
ajax.addOpenData(ajaxData).then((res) => { |
|
|
|
|
|
if (res.status === 20000) { |
|
|
|
|
|
message.success(res.message) |
|
|
|
|
|
setOpenVisible(false) |
|
|
|
|
|
openForm.setFieldsValue({ |
|
|
|
|
|
car_group:null, |
|
|
|
|
|
open_method:null, |
|
|
|
|
|
pass_name:null, |
|
|
|
|
|
remark:"", |
|
|
|
|
|
start_stop_time:null |
|
|
|
|
|
}) |
|
|
|
|
|
getOpenData() |
|
|
|
|
|
}else{ |
|
|
|
|
|
message.warning(res.message) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
.catch((err) => { |
|
|
|
|
|
console.error(err); |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
const onCancel=()=>{ |
|
|
const onCancel=()=>{ |
|
|
setOpenVisible(false) |
|
|
setOpenVisible(false) |
|
|
} |
|
|
} |
|
|
// 表单改变事件 |
|
|
|
|
|
const handleForm = async (changedValues, allValues) => { |
|
|
|
|
|
// console.log(changedValues, allValues); |
|
|
|
|
|
let obj = {}; |
|
|
|
|
|
let key = Object.keys(changedValues)[0]; |
|
|
|
|
|
let val = Object.values(changedValues)[0]; |
|
|
|
|
|
console.log(key,val); |
|
|
|
|
|
switch (key) { |
|
|
|
|
|
case "nvr_id": |
|
|
|
|
|
obj[key] = val; |
|
|
|
|
|
getBerthDataByNvr(val); |
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
default: |
|
|
|
|
|
obj[key] = val; |
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
const getOpenData=()=>{ |
|
|
|
|
|
ajax.getOpenData().then((res) => { |
|
|
|
|
|
if (res.status === 20000) { |
|
|
|
|
|
setDataSource(res.data) |
|
|
|
|
|
}else{ |
|
|
|
|
|
message.warning(res.message) |
|
|
} |
|
|
} |
|
|
// openForm.setFieldsValue(); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
.catch((err) => { |
|
|
|
|
|
console.error(err); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(()=>{ |
|
|
useEffect(()=>{ |
|
|
getOptionData() |
|
|
getOptionData() |
|
|
|
|
|
getOpenData() |
|
|
},[]) |
|
|
},[]) |
|
|
|
|
|
|
|
|
return ( |
|
|
return ( |
|
|
<div> |
|
|
<div> |
|
|
<header style={{ margin: "10px 0" }}> |
|
|
<header style={{ margin: "10px 0" }}> |
|
@ -123,6 +154,7 @@ function GateControlManagement() { |
|
|
<main> |
|
|
<main> |
|
|
<Table |
|
|
<Table |
|
|
columns={columns} |
|
|
columns={columns} |
|
|
|
|
|
dataSource={dataSource} |
|
|
// className="yisa-table" |
|
|
// className="yisa-table" |
|
|
></Table> |
|
|
></Table> |
|
|
</main> |
|
|
</main> |
|
@ -141,7 +173,6 @@ function GateControlManagement() { |
|
|
<Form |
|
|
<Form |
|
|
form={openForm} |
|
|
form={openForm} |
|
|
onFinish={onFinish} |
|
|
onFinish={onFinish} |
|
|
onValuesChange={handleForm} |
|
|
|
|
|
> |
|
|
> |
|
|
<Form.Item |
|
|
<Form.Item |
|
|
label="车辆组" |
|
|
label="车辆组" |
|
@ -182,7 +213,7 @@ function GateControlManagement() { |
|
|
<Button className="cancel" onClick={onCancel}> |
|
|
<Button className="cancel" onClick={onCancel}> |
|
|
取消 |
|
|
取消 |
|
|
</Button> |
|
|
</Button> |
|
|
<Button type="primary" className="submit" htmlType="submit"> |
|
|
|
|
|
|
|
|
<Button type="primary" className="submit" htmlType="submit" > |
|
|
确定 |
|
|
确定 |
|
|
</Button> |
|
|
</Button> |
|
|
|
|
|
|
|
|