Commit 1e8221b6 authored by XieZhiXiong's avatar XieZhiXiong

fixbug

parent 06131bf4
......@@ -25,30 +25,41 @@ const AddWarehouse: React.FC<{}> = (props: any) => {
const [submitLoading, setSubmitLoading] = useState(false);
const getWarehouseInfo = async () => {
if (!id) {
return;
}
setInfoLoading(true);
const infoRes = await PublicApi.getWarehouseWarehouseDetails({
id,
});
const areaRes = await PublicApi.getManageAreaAll();
if (areaRes.code === 1000) {
const { data } = areaRes;
formActions.setFieldState('provinceId', targetState => {
targetState.originData = data;
targetState.props.enum = data.map(v => ({
label: v.name,
value: v.id,
}));
if (id) {
setInfoLoading(true);
const infoRes = await PublicApi.getWarehouseWarehouseDetails({
id,
});
const areaRes = await PublicApi.getManageAreaAll();
if (areaRes.code === 1000) {
const { data } = areaRes;
formActions.setFieldState('provinceId', targetState => {
targetState.originData = data;
targetState.props.enum = data.map(v => ({
label: v.name,
value: v.id,
}));
});
}
if (infoRes.code === 1000) {
setInfo(infoRes.data);
}
setInfoLoading(false);
} else {
const areaRes = await PublicApi.getManageAreaAll();
if (areaRes.code === 1000) {
const { data } = areaRes;
formActions.setFieldState('provinceId', targetState => {
targetState.originData = data;
targetState.props.enum = data.map(v => ({
label: v.name,
value: v.id,
}));
});
}
}
if (infoRes.code === 1000) {
setInfo(infoRes.data);
}
setInfoLoading(false);
};
useEffect(() => {
......
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