You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
112 lines
3.4 KiB
112 lines
3.4 KiB
import React, { useEffect, useState } from 'react';
|
|
import { connect } from 'react-redux';
|
|
import { Form, Spin, Table } from 'antd';
|
|
import { ModalForm, ProForm, ProFormText, ProFormSelect } from '@ant-design/pro-form';
|
|
import { putOperaTional, putHighways } from "../../actions/infor"
|
|
import _ from 'lodash'
|
|
|
|
const HightModal = (props) => {
|
|
const { visible, onVisibleChange, typecard, rewkeys, recortd, dispatch, setRecortd, setDelet } = props
|
|
const [success, setSuccess] = useState()
|
|
|
|
useEffect(() => {
|
|
return () => {
|
|
setRecortd()
|
|
}
|
|
}, [setRecortd])
|
|
// console.log(recortd)
|
|
return (
|
|
<Spin spinning={false}>
|
|
{/* {
|
|
newlysay ? */}
|
|
<ModalForm
|
|
width={'90rem'}
|
|
visible={visible}
|
|
onVisibleChange={onVisibleChange}
|
|
onFinish={(values) => {
|
|
if (rewkeys === 'passenger') {
|
|
setDelet(values)
|
|
const query = { ...values, id: recortd?.id }
|
|
dispatch(putOperaTional(query)).then((res) => {
|
|
setSuccess(res.success)
|
|
})
|
|
return true
|
|
|
|
}
|
|
if (rewkeys === 'highways') {
|
|
setDelet(values)
|
|
|
|
const query = { ...values, id: recortd?.id }
|
|
dispatch(putHighways(query)).then((res) => {
|
|
setSuccess(res.success)
|
|
})
|
|
return true
|
|
|
|
}
|
|
|
|
}}
|
|
initialValues={recortd}
|
|
>
|
|
{/* {typecard == 'compile' ? */}
|
|
<ProForm.Group
|
|
>
|
|
<ProFormText
|
|
name='name'
|
|
width="md"
|
|
label='类型'
|
|
|
|
placeholder="请输入名称"
|
|
// value={recortd?.[0]?.value}
|
|
disabled
|
|
|
|
/>
|
|
<ProFormText
|
|
name='count'
|
|
width="md"
|
|
label='数量'
|
|
|
|
placeholder="请输入数量"
|
|
rules={[
|
|
{
|
|
required: true,
|
|
message: '请输入整数',
|
|
pattern: RegExp(/^[0-9]\d*$/, 'g'),
|
|
|
|
},
|
|
// getValueFromEvent=(event)=>{
|
|
// return event.target.value.replace(/\D/g,'')
|
|
// }
|
|
]}
|
|
|
|
/>
|
|
|
|
</ProForm.Group>
|
|
{/* : <ProForm.Group>
|
|
vfdscfd
|
|
</ProForm.Group>} */}
|
|
|
|
</ModalForm>
|
|
{/* : ''
|
|
} */}
|
|
|
|
</Spin>
|
|
)
|
|
}
|
|
function mapStateToProps(state) {
|
|
const { depMessage } = state;
|
|
const pakData = (dep) => {
|
|
return dep.map((d) => {
|
|
return {
|
|
title: d.name,
|
|
value: d.id,
|
|
children: pakData(d.subordinate)
|
|
}
|
|
})
|
|
}
|
|
let depData = pakData(depMessage.data || [])
|
|
return {
|
|
loading: depMessage.isRequesting,
|
|
depData,
|
|
};
|
|
}
|
|
export default connect(mapStateToProps)(HightModal);
|