172 lines
6.5 KiB
TypeScript
172 lines
6.5 KiB
TypeScript
|
// import { useState } from 'react'
|
|||
|
import { Button, Form, Upload, message, Select } from "antd"
|
|||
|
import { uploadFileUrl } from '../../../../request/request'
|
|||
|
import { UploadOutlined } from '@ant-design/icons';
|
|||
|
export default function EditAppDes(props: any) {
|
|||
|
|
|||
|
const token = sessionStorage.getItem('token')
|
|||
|
const height = window.innerHeight - 460;
|
|||
|
const [form] = Form.useForm();
|
|||
|
const handleSubmit = () => {
|
|||
|
// console.log(form);
|
|||
|
props.setEditProcess(3);
|
|||
|
// 调用表单实例的 submit 方法
|
|||
|
form.submit();
|
|||
|
|
|||
|
};
|
|||
|
|
|||
|
// // 存储文件上传成功状态
|
|||
|
// const [fileUploadSuccess, setFileUploadSuccess] = useState(false);
|
|||
|
// // 上传状态改变时的回调
|
|||
|
// const handleUploadChange = (info: any) => {
|
|||
|
// if (info.file.status === 'done') {
|
|||
|
// setFileUploadSuccess(true);
|
|||
|
// message.success('文件上传成功');
|
|||
|
// } else if (info.file.status === 'error') {
|
|||
|
// setFileUploadSuccess(false);
|
|||
|
// message.error('文件上传失败,请重试');
|
|||
|
// }
|
|||
|
// };
|
|||
|
// // 自定义验证规则,确保文件上传成功
|
|||
|
// const validateFileUpload = (_rule: any, _value: any, callback: (error?: string) => void) => {
|
|||
|
// if (fileUploadSuccess) {
|
|||
|
// callback();
|
|||
|
// } else {
|
|||
|
// callback('请确保文件上传成功');
|
|||
|
// }
|
|||
|
// };
|
|||
|
const submitInfo = (values: any) => {
|
|||
|
message.success('提交成功');
|
|||
|
console.log(values);
|
|||
|
props.setEditProcess(3);
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
const onFinish = (values: any) => {
|
|||
|
// 处理表单提交逻辑
|
|||
|
console.log('表单提交成功', values);
|
|||
|
submitInfo(values)
|
|||
|
};
|
|||
|
return (
|
|||
|
<div>
|
|||
|
<div className='bigLine'></div>
|
|||
|
<div className='appInfoFormBox' style={{
|
|||
|
height: height,
|
|||
|
justifyContent: 'flex-start',
|
|||
|
marginLeft: '100px',
|
|||
|
}}>
|
|||
|
|
|||
|
<Form form={form} onFinish={onFinish}
|
|||
|
onFinishFailed={() => {
|
|||
|
message.error('请完善信息')
|
|||
|
}}
|
|||
|
>
|
|||
|
<div className='appInfoFormInput'>
|
|||
|
<div className='FormInputTitle' style={{
|
|||
|
width: '160px',
|
|||
|
}}>权力取得方式:</div>
|
|||
|
<Form.Item name="gettype" label="" rules={[{ required: true, message: '请选择权力取得方式' },
|
|||
|
|
|||
|
]}>
|
|||
|
<Select
|
|||
|
allowClear
|
|||
|
style={{
|
|||
|
width: '300px',
|
|||
|
height: '42px',
|
|||
|
}}
|
|||
|
|
|||
|
options={[
|
|||
|
// { value: '', label: '全部项目' },
|
|||
|
{ value: '1', label: '取得方式1' },
|
|||
|
{ value: '2', label: '取得方式2' },
|
|||
|
{ value: '3', label: '取得方式3' },
|
|||
|
]}
|
|||
|
// defaultValue=""
|
|||
|
placeholder={'请选择权力取得方式'}
|
|||
|
/>
|
|||
|
</Form.Item>
|
|||
|
</div>
|
|||
|
<div className='appInfoFormInput'>
|
|||
|
<div className='FormInputTitle' style={{
|
|||
|
width: '160px',
|
|||
|
}}>权力范围:</div>
|
|||
|
<Form.Item name="fw" label="" rules={[{ required: true, message: '请选择权力范围' },
|
|||
|
|
|||
|
]}>
|
|||
|
<Select
|
|||
|
allowClear
|
|||
|
style={{
|
|||
|
width: '300px',
|
|||
|
height: '42px',
|
|||
|
}}
|
|||
|
|
|||
|
options={[
|
|||
|
{ value: '1', label: '全部权力' },
|
|||
|
{ value: '2', label: '部分权力' },
|
|||
|
|
|||
|
]}
|
|||
|
// defaultValue=""
|
|||
|
placeholder={'请选择权力范围'}
|
|||
|
/>
|
|||
|
</Form.Item>
|
|||
|
|
|||
|
</div>
|
|||
|
<div className='appInfoFormInput' >
|
|||
|
<div className='FormInputTitle' style={{
|
|||
|
width: '160px',
|
|||
|
}}>上传其他相关文件:</div>
|
|||
|
<div style={{
|
|||
|
maxWidth: '500px',
|
|||
|
}}>
|
|||
|
<Form.Item name="file" label="" rules={[{ required: true, message: '请选择上传文件' },
|
|||
|
// { validator: validateFileUpload }
|
|||
|
]}>
|
|||
|
<Upload
|
|||
|
name="file"
|
|||
|
action={uploadFileUrl()}
|
|||
|
// onChange={handleUploadChange}
|
|||
|
headers={{ 'Auth': `Bearer ${token}` }}
|
|||
|
|
|||
|
>
|
|||
|
<Button icon={<UploadOutlined />} style={{
|
|||
|
marginTop:4
|
|||
|
}}>上传附件</Button>
|
|||
|
</Upload>
|
|||
|
</Form.Item>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
|
|||
|
|
|||
|
|
|||
|
</Form>
|
|||
|
|
|||
|
</div>
|
|||
|
|
|||
|
<div className='bigLine'></div>
|
|||
|
<div className='nextBtnBxo'>
|
|||
|
<Button
|
|||
|
style={{
|
|||
|
width: '235px',
|
|||
|
height: '46px',
|
|||
|
borderRadius: '5px',
|
|||
|
}}
|
|||
|
onClick={() => {
|
|||
|
props.setEditProcess(1)
|
|||
|
}}>上一步</Button>
|
|||
|
<Button
|
|||
|
style={{
|
|||
|
width: '235px',
|
|||
|
height: '46px',
|
|||
|
borderRadius: '5px',
|
|||
|
marginLeft: '10px',
|
|||
|
}}
|
|||
|
type='primary'
|
|||
|
onClick={() => {
|
|||
|
handleSubmit()
|
|||
|
}}>下一步</Button>
|
|||
|
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
)
|
|||
|
}
|