个人信息修改
This commit is contained in:
@ -1,9 +1,13 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { Modal, Form, Input, Button, Upload, message, Row, Col, Descriptions, Cascader } from 'antd';
|
||||
import { Modal, Form, Input, Button, Upload, message, Row, Col, Descriptions, Cascader, Select } from 'antd';
|
||||
import type { UploadProps } from 'antd';
|
||||
import { UploadOutlined } from '@ant-design/icons';
|
||||
import { getDictList } from '@/servers/api/dicts';
|
||||
import { uploadFile, bankView, bankAdd, bankEdit, coscoSupplierBase } from '../services';
|
||||
import { getRegionTree, getregionInternational } from '@/servers/api/register';
|
||||
import type { DictItem } from '@/servers/api/dicts';
|
||||
|
||||
// 地区字段转换
|
||||
function convertToCascaderOptions(data: any[]): any[] {
|
||||
return data.map(item => ({
|
||||
label: item.name,
|
||||
@ -52,6 +56,8 @@ const InvoiceFormModal: React.FC<props> = ({
|
||||
// 地区
|
||||
const [addressOptions, setAddressOptions] = useState<API.RegionOption[]>([]);
|
||||
|
||||
const [currency, setCurrency] = useState<DictItem[]>([]);
|
||||
|
||||
useEffect(() => {
|
||||
if (visible) {
|
||||
if (initialValues) {
|
||||
@ -61,6 +67,11 @@ const InvoiceFormModal: React.FC<props> = ({
|
||||
const fields = {
|
||||
...data,
|
||||
id: data.id ? data.id : null,
|
||||
address: [
|
||||
Number(data.province),
|
||||
Number(data.city),
|
||||
Number(data.nation)
|
||||
]
|
||||
};
|
||||
console.log(fields);
|
||||
|
||||
@ -76,6 +87,15 @@ const InvoiceFormModal: React.FC<props> = ({
|
||||
setAddressOptions(convertToCascaderOptions(res.data));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
getDictList('currency').then((res) => {
|
||||
if (res.code === 200) {
|
||||
setCurrency(res.data);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}, [visible, initialValues]);
|
||||
|
||||
@ -87,10 +107,10 @@ const InvoiceFormModal: React.FC<props> = ({
|
||||
...values,
|
||||
supplierId: userId,
|
||||
};
|
||||
payload.province = payload.address[0];
|
||||
payload.city = payload.address[1];
|
||||
payload.nation = payload.address[2];
|
||||
|
||||
payload.province = payload.address[1];
|
||||
payload.city = payload.address[2];
|
||||
payload.nation = payload.address[0];
|
||||
|
||||
if (!values.id) {
|
||||
bankAdd(payload).then((res) => {
|
||||
if (res.code == 200) {
|
||||
@ -230,7 +250,13 @@ const InvoiceFormModal: React.FC<props> = ({
|
||||
</Col> */}
|
||||
<Col span={24}>
|
||||
<Form.Item name="currency" label="币种" rules={[{ required: true }]}>
|
||||
<Input />
|
||||
<Select placeholder="请选择币种">
|
||||
{currency.map((item) => (
|
||||
<Select.Option key={item.code} value={item.code}>
|
||||
{item.dicName}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Form.Item name="id" noStyle>
|
||||
|
Reference in New Issue
Block a user