|
|
|
@ -7,11 +7,10 @@ import {
|
|
|
|
|
ProFormText,
|
|
|
|
|
ProFormUploadDragger,
|
|
|
|
|
} from '@ant-design/pro-components';
|
|
|
|
|
import {Button, Form, Image, message, Spin} from 'antd';
|
|
|
|
|
import { Form, Image, Spin, message } from 'antd';
|
|
|
|
|
import React, { useEffect, useState } from 'react';
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
import cookie from 'react-cookies';
|
|
|
|
|
import { API } from 'types';
|
|
|
|
|
const ShowInfoDemo: React.FC = () => {
|
|
|
|
|
const [form] = Form.useForm();
|
|
|
|
|
const [imageUrl, setImageUrl] = useState<string>('');
|
|
|
|
@ -30,8 +29,15 @@ const ShowInfoDemo: React.FC = () => {
|
|
|
|
|
// gender: '男',
|
|
|
|
|
// })
|
|
|
|
|
}
|
|
|
|
|
function doAddField(data) {
|
|
|
|
|
setKeyNameList(data);
|
|
|
|
|
function doAddField(record) {
|
|
|
|
|
console.log('doAddField_data', record);
|
|
|
|
|
setKeyNameList((data) => {
|
|
|
|
|
return record.map((item) => {
|
|
|
|
|
item.valueLabel = item.value;
|
|
|
|
|
item.value = item.key;
|
|
|
|
|
return item
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
@ -63,21 +69,21 @@ const ShowInfoDemo: React.FC = () => {
|
|
|
|
|
onChange: (info) => {
|
|
|
|
|
if (info.file.status === 'done') {
|
|
|
|
|
setIsLoading(false);
|
|
|
|
|
message.success('分析成功').then(r => {});
|
|
|
|
|
message.success('分析成功').then((r) => {});
|
|
|
|
|
console.log(info, 'info');
|
|
|
|
|
doAddField(info.file.response.data)
|
|
|
|
|
doAddField(info.file.response.data);
|
|
|
|
|
}
|
|
|
|
|
if (info.file.status === 'error') {
|
|
|
|
|
setIsLoading(false);
|
|
|
|
|
message.error('请求失败').then(r => {});
|
|
|
|
|
message.error('请求失败').then((r) => {});
|
|
|
|
|
console.log(info, 'info');
|
|
|
|
|
doAddField([])
|
|
|
|
|
doAddField([]);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
beforeUpload: (file) => {
|
|
|
|
|
form.resetFields(['name1']);
|
|
|
|
|
setIsLoading(true);
|
|
|
|
|
doAddField([])
|
|
|
|
|
doAddField([]);
|
|
|
|
|
const reader = new FileReader();
|
|
|
|
|
reader.onload = (e) => {
|
|
|
|
|
setImageUrl(e.target?.result as string);
|
|
|
|
@ -126,7 +132,7 @@ const ShowInfoDemo: React.FC = () => {
|
|
|
|
|
<ProFormDependency name={['name1']}>
|
|
|
|
|
{({ name1 }) => {
|
|
|
|
|
if (name1) {
|
|
|
|
|
form.setFieldValue('activeKey', name1.value);
|
|
|
|
|
form.setFieldValue('activeKey', name1.valueLabel);
|
|
|
|
|
console.log(name1, 'ProFormDependency_name1');
|
|
|
|
|
return (
|
|
|
|
|
<ProFormText
|
|
|
|
|