Commit 26738ceb authored by XieZhiXiong's avatar XieZhiXiong

fix: 修复现有地址无法点击确认的问题

parent aeb13370
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-08-05 10:28:06
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-09 16:52:37
* @LastEditTime: 2021-08-10 10:20:55
* @Description: 地址选择 FormItem
*/
import React, { useState, useEffect, useMemo, useRef } from 'react';
......@@ -204,6 +204,8 @@ const AddressSelect: React.FC<IProps> = (props) => {
const handleSubmit = async (values: SubmitValuesType) => {
let next = values.address;
// 有值表示是新增 或 修改操作
if (values.name) {
const originData = formActions.getFieldState('provinceCode', (fieldState) => {
return fieldState.originData;
});
......@@ -230,7 +232,7 @@ const AddressSelect: React.FC<IProps> = (props) => {
};
// 新增地址
if (values.name && !editAddressId.current) {
if (!editAddressId.current) {
try {
setSubmitLoading(true);
const addRes = addressType === 2
......@@ -265,7 +267,7 @@ const AddressSelect: React.FC<IProps> = (props) => {
}
}
// 编辑地址
if (values.name && editAddressId.current) {
if (editAddressId.current) {
try {
setSubmitLoading(true);
const addRes = addressType === 2
......@@ -299,6 +301,7 @@ const AddressSelect: React.FC<IProps> = (props) => {
console.warn(error)
}
}
}
if (!('value' in props)) {
setInternalValue(next);
}
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-08-05 14:02:46
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-06 14:46:35
* @LastEditTime: 2021-08-10 14:05:13
* @Description:
*/
import { ISchema } from '@formily/antd';
......@@ -35,12 +35,6 @@ export const createSchema = (addressType = 2): ISchema => {
'x-component-props': {
onClickEdit: '{{ handleEditAddress }}',
},
'x-rules': [
{
required: true,
message: '请选择地址',
},
],
},
},
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment