Commit 1f7ceecb authored by XieZhiXiong's avatar XieZhiXiong

chore: 添加 catch

parent 2d14cf14
...@@ -163,6 +163,8 @@ const Analysis: React.FC<AnalysisProps> = ({ ...@@ -163,6 +163,8 @@ const Analysis: React.FC<AnalysisProps> = ({
setEvaluateSum(evaluate); setEvaluateSum(evaluate);
setEvaluatePie(evaluatePieData); setEvaluatePie(evaluatePieData);
} }
}).catch((err) => {
console.warn(err);
}); });
}; };
......
...@@ -57,23 +57,25 @@ const ReceivedDetail: React.FC = () => { ...@@ -57,23 +57,25 @@ const ReceivedDetail: React.FC = () => {
if (res.code === 1000) { if (res.code === 1000) {
setEvaluationInfo({ setEvaluationInfo({
good: { good: {
pic: res.data.productImgUrl, pic: res.data?.productImgUrl,
productName: res.data.product, productName: res.data?.product,
price: res.data.price, price: res.data?.price,
purchaseCount: res.data.purchaseCount, purchaseCount: res.data?.purchaseCount,
unit: res.data.unit, unit: res.data?.unit,
}, },
star: res.data.star, star: res.data?.star,
comment: res.data.comment, comment: res.data?.comment,
picture: res.data.pics ? res.data.pics.map(item => normalizeFiledata(item)) : [], picture: res.data?.pics ? res.data.pics.map(item => normalizeFiledata(item)) : [],
smile: res.data.star, smile: res.data?.star,
}); });
setOrderInfo({ setOrderInfo({
orderNo: res.data.orderNo, orderNo: res.data?.orderNo,
dealTime: res.data.dealTime as string, dealTime: res.data?.dealTime as string,
memberName: res.data.memberName, memberName: res.data?.memberName,
}); });
} }
}).catch((err) => {
console.warn(err);
}).finally(() => { }).finally(() => {
setEvaluationInfoLoading(false); setEvaluationInfoLoading(false);
}); });
......
...@@ -72,23 +72,25 @@ const DetailInfo: React.FC<DetailInfoProps> = ({ ...@@ -72,23 +72,25 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
if (res.code === 1000) { if (res.code === 1000) {
setEvaluationInfo({ setEvaluationInfo({
good: { good: {
pic: res.data.productImgUrl, pic: res.data?.productImgUrl,
productName: res.data.product, productName: res.data?.product,
price: res.data.price, price: res.data?.price,
purchaseCount: res.data.purchaseCount, purchaseCount: res.data?.purchaseCount,
unit: res.data.unit, unit: res.data?.unit,
}, },
star: res.data.star, star: res.data?.star,
comment: res.data.comment, comment: res.data?.comment,
picture: res.data.pics ? res.data.pics.map(item => normalizeFiledata(item)) : [], picture: res.data?.pics ? res.data.pics.map(item => normalizeFiledata(item)) : [],
smile: res.data.star, smile: res.data?.star,
}); });
setOrderInfo({ setOrderInfo({
orderNo: res.data.orderNo, orderNo: res.data?.orderNo,
dealTime: res.data.dealTime as string, dealTime: res.data?.dealTime as string,
memberName: res.data.memberName, memberName: res.data?.memberName,
}); });
} }
}).catch((err) => {
console.warn(err);
}).finally(() => { }).finally(() => {
setEvaluationInfoLoading(false); setEvaluationInfoLoading(false);
}); });
......
...@@ -59,7 +59,7 @@ const EvaluateOrder: React.FC = () => { ...@@ -59,7 +59,7 @@ const EvaluateOrder: React.FC = () => {
PublicApi.getOrderProcurementOrderDetails({ PublicApi.getOrderProcurementOrderDetails({
id, id,
orderNo: '', orderNo: '',
}).then(res => { } as any).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
const { orderProductRequests } = res.data; const { orderProductRequests } = res.data;
setOrderInfo({ setOrderInfo({
......
...@@ -349,7 +349,7 @@ export const useBusinessEffects = (context, actions) => { ...@@ -349,7 +349,7 @@ export const useBusinessEffects = (context, actions) => {
PublicApi.getOrderProcurementOrderProductList({ PublicApi.getOrderProcurementOrderProductList({
id: first.id, id: first.id,
orderNo: '', orderNo: '',
}).then(res => { } as any).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
const goodOptions = res.data.map(item => ({ const goodOptions = res.data.map(item => ({
label: item.productName, label: item.productName,
...@@ -360,6 +360,8 @@ export const useBusinessEffects = (context, actions) => { ...@@ -360,6 +360,8 @@ export const useBusinessEffects = (context, actions) => {
FormPath.setIn(state, 'props.enum', goodOptions); FormPath.setIn(state, 'props.enum', goodOptions);
}); });
} }
}).catch((err) => {
console.warn(err);
}); });
break; break;
} }
...@@ -395,6 +397,8 @@ export const useBusinessEffects = (context, actions) => { ...@@ -395,6 +397,8 @@ export const useBusinessEffects = (context, actions) => {
}))); })));
FormPath.setIn(state, 'props.enum', goodOptions); FormPath.setIn(state, 'props.enum', goodOptions);
}); });
}).catch((err) => {
console.warn(err);
}); });
break; break;
} }
...@@ -425,6 +429,8 @@ export const useBusinessEffects = (context, actions) => { ...@@ -425,6 +429,8 @@ export const useBusinessEffects = (context, actions) => {
}))); })));
FormPath.setIn(state, 'props.enum', goodOptions); FormPath.setIn(state, 'props.enum', goodOptions);
}); });
}).catch((err) => {
console.warn(err);
}); });
break; break;
} }
...@@ -465,6 +471,8 @@ export const useBusinessEffects = (context, actions) => { ...@@ -465,6 +471,8 @@ export const useBusinessEffects = (context, actions) => {
}))); })));
FormPath.setIn(state, 'props.enum', goodOptions); FormPath.setIn(state, 'props.enum', goodOptions);
}); });
}).catch((err) => {
console.warn(err);
}); });
break; break;
} }
...@@ -501,6 +509,8 @@ export const useBusinessEffects = (context, actions) => { ...@@ -501,6 +509,8 @@ export const useBusinessEffects = (context, actions) => {
}))); })));
FormPath.setIn(state, 'props.enum', goodOptions); FormPath.setIn(state, 'props.enum', goodOptions);
}); });
}).catch((err) => {
console.warn(err);
}); });
break; break;
} }
......
...@@ -24,7 +24,7 @@ export const fetchOrderPurchaseReceiptAddList = async (params: any) => { ...@@ -24,7 +24,7 @@ export const fetchOrderPurchaseReceiptAddList = async (params: any) => {
total: res.data.totalCount, total: res.data.totalCount,
}; };
} }
return []; return { data: [], total: 0 };
}; };
// 获取销售发货单相关数据 // 获取销售发货单相关数据
...@@ -43,7 +43,7 @@ export const getOrderSalesInvoiceOrderList = async (params: any) => { ...@@ -43,7 +43,7 @@ export const getOrderSalesInvoiceOrderList = async (params: any) => {
total: res.data.totalCount, total: res.data.totalCount,
}; };
} }
return []; return { data: [], total: 0 };
}; };
// 获取加工入库单单相关数据 // 获取加工入库单单相关数据
...@@ -67,7 +67,7 @@ export const getMachiningWarehousingList = async (params: any) => { ...@@ -67,7 +67,7 @@ export const getMachiningWarehousingList = async (params: any) => {
total: res.data.totalCount, total: res.data.totalCount,
}; };
} }
return []; return { data: [], total: 0 };
}; };
// 获取加工发货单单相关数据 // 获取加工发货单单相关数据
...@@ -91,7 +91,7 @@ export const getMachiningDeliveryList = async (params: any) => { ...@@ -91,7 +91,7 @@ export const getMachiningDeliveryList = async (params: any) => {
total: res.data.totalCount, total: res.data.totalCount,
}; };
} }
return []; return { data: [], total: 0 };
}; };
// 获取售后退货发货单单相关数据 // 获取售后退货发货单单相关数据
...@@ -122,7 +122,7 @@ export const getRefundDeliveryList = async (params: any) => { ...@@ -122,7 +122,7 @@ export const getRefundDeliveryList = async (params: any) => {
total: res.data.totalCount, total: res.data.totalCount,
}; };
} }
return []; return { data: [], total: 0 };
}; };
// 获取售后退货入库单单相关数据 // 获取售后退货入库单单相关数据
...@@ -153,7 +153,7 @@ export const getRefundWarehousingList = async (params: any) => { ...@@ -153,7 +153,7 @@ export const getRefundWarehousingList = async (params: any) => {
total: res.data.totalCount, total: res.data.totalCount,
}; };
} }
return []; return { data: [], total: 0 };
}; };
// 获取售后换货退货发货单单相关数据 // 获取售后换货退货发货单单相关数据
...@@ -184,7 +184,7 @@ export const getExchangeReturnDeliveryList = async (params: any) => { ...@@ -184,7 +184,7 @@ export const getExchangeReturnDeliveryList = async (params: any) => {
total: res.data.totalCount, total: res.data.totalCount,
}; };
} }
return []; return { data: [], total: 0 };
}; };
// 获取售后换货退货入库单单相关数据 // 获取售后换货退货入库单单相关数据
...@@ -215,7 +215,7 @@ export const getExchangeReturnWarehousingList = async (params: any) => { ...@@ -215,7 +215,7 @@ export const getExchangeReturnWarehousingList = async (params: any) => {
total: res.data.totalCount, total: res.data.totalCount,
}; };
} }
return []; return { data: [], total: 0 };
}; };
// 获取售后换货发货单单相关数据 // 获取售后换货发货单单相关数据
...@@ -246,7 +246,7 @@ export const getExchangeDeliveryList = async (params: any) => { ...@@ -246,7 +246,7 @@ export const getExchangeDeliveryList = async (params: any) => {
total: res.data.totalCount, total: res.data.totalCount,
}; };
} }
return []; return { data: [], total: 0 };
}; };
// 获取售后换货入库单单相关数据 // 获取售后换货入库单单相关数据
...@@ -277,5 +277,5 @@ export const getExchangeWarehousingList = async (params: any) => { ...@@ -277,5 +277,5 @@ export const getExchangeWarehousingList = async (params: any) => {
total: res.data.totalCount, total: res.data.totalCount,
}; };
} }
return []; return { data: [], total: 0 };
}; };
\ No newline at end of file
...@@ -170,7 +170,7 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -170,7 +170,7 @@ const BillsForm: React.FC<BillsFormProps> = ({
PublicApi.getProductInvoicesDetails({ PublicApi.getProductInvoicesDetails({
invoicesId: `${id}`, invoicesId: `${id}`,
invoicesNo, invoicesNo,
}).then(res => { } as any).then(res => {
if (res.code !== 1000) { if (res.code !== 1000) {
return; return;
} }
...@@ -236,6 +236,8 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -236,6 +236,8 @@ const BillsForm: React.FC<BillsFormProps> = ({
invoicesDetailsRequests: details, invoicesDetailsRequests: details,
...rest, ...rest,
}); });
}).catch((err) => {
console.warn(err);
}).finally(() => { }).finally(() => {
setInfoLoading(false); setInfoLoading(false);
}); });
...@@ -265,7 +267,7 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -265,7 +267,7 @@ const BillsForm: React.FC<BillsFormProps> = ({
PublicApi.getOrderProcurementOrderDetails({ PublicApi.getOrderProcurementOrderDetails({
id: relevanceInvoicesId, id: relevanceInvoicesId,
orderNo: '', orderNo: '',
}).then(res => { } as any).then(res => {
if (res.code !== 1000) { if (res.code !== 1000) {
return; return;
} }
...@@ -300,6 +302,8 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -300,6 +302,8 @@ const BillsForm: React.FC<BillsFormProps> = ({
[] []
, ,
}); });
}).catch((err) => {
console.warn(err);
}).finally(() => { }).finally(() => {
setInfoLoading(false); setInfoLoading(false);
}); });
...@@ -347,6 +351,8 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -347,6 +351,8 @@ const BillsForm: React.FC<BillsFormProps> = ({
[] []
, ,
}); });
}).catch((err) => {
console.warn(err);
}).finally(() => { }).finally(() => {
setInfoLoading(false); setInfoLoading(false);
}); });
...@@ -393,6 +399,8 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -393,6 +399,8 @@ const BillsForm: React.FC<BillsFormProps> = ({
[] []
, ,
}); });
}).catch((err) => {
console.warn(err);
}).finally(() => { }).finally(() => {
setInfoLoading(false); setInfoLoading(false);
}); });
...@@ -439,6 +447,8 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -439,6 +447,8 @@ const BillsForm: React.FC<BillsFormProps> = ({
[] []
, ,
}); });
}).catch((err) => {
console.warn(err);
}).finally(() => { }).finally(() => {
setInfoLoading(false); setInfoLoading(false);
}); });
...@@ -486,6 +496,8 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -486,6 +496,8 @@ const BillsForm: React.FC<BillsFormProps> = ({
[] []
, ,
}); });
}).catch((err) => {
console.warn(err);
}).finally(() => { }).finally(() => {
setInfoLoading(false); setInfoLoading(false);
}); });
...@@ -533,6 +545,8 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -533,6 +545,8 @@ const BillsForm: React.FC<BillsFormProps> = ({
[] []
, ,
}); });
}).catch((err) => {
console.warn(err);
}).finally(() => { }).finally(() => {
setInfoLoading(false); setInfoLoading(false);
}); });
...@@ -581,6 +595,8 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -581,6 +595,8 @@ const BillsForm: React.FC<BillsFormProps> = ({
[] []
, ,
}); });
}).catch((err) => {
console.warn(err);
}).finally(() => { }).finally(() => {
setInfoLoading(false); setInfoLoading(false);
}); });
...@@ -628,6 +644,8 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -628,6 +644,8 @@ const BillsForm: React.FC<BillsFormProps> = ({
[] []
, ,
}); });
}).catch((err) => {
console.warn(err);
}).finally(() => { }).finally(() => {
setInfoLoading(false); setInfoLoading(false);
}); });
...@@ -677,6 +695,8 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -677,6 +695,8 @@ const BillsForm: React.FC<BillsFormProps> = ({
[] []
, ,
}); });
}).catch((err) => {
console.warn(err);
}).finally(() => { }).finally(() => {
setInfoLoading(false); setInfoLoading(false);
}); });
...@@ -725,6 +745,8 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -725,6 +745,8 @@ const BillsForm: React.FC<BillsFormProps> = ({
[] []
, ,
}); });
}).catch((err) => {
console.warn(err);
}).finally(() => { }).finally(() => {
setInfoLoading(false); setInfoLoading(false);
}); });
......
...@@ -31,19 +31,25 @@ const Bills: React.FC<{}> = () => { ...@@ -31,19 +31,25 @@ const Bills: React.FC<{}> = () => {
if (res.code === 1000) { if (res.code === 1000) {
return res.data; return res.data;
} }
return []; return { data: [], totalCount: 0 };
}; };
// 获取单据类型 // 获取单据类型
const fetchInvoicesType = async () => { const fetchInvoicesType = async () => {
const { data } = await PublicApi.getProductInvoicesTypeAll(); const { data, code } = await PublicApi.getProductInvoicesTypeAll();
return data.map(v => ({ label: v.name, value: v.id })); if (code === 1000) {
return data?.map(v => ({ label: v.name, value: v.id }));
}
return [];
}; };
// 获取对应仓库 // 获取对应仓库
const fetchInventory = async () => { const fetchInventory = async () => {
const { data } = await PublicApi.getProductWarehouseAll(); const { data, code } = await PublicApi.getProductWarehouseAll();
return data.map(v => ({ label: v.name, value: v.id })); if (code === 1000) {
return data?.map(v => ({ label: v.name, value: v.id }));
}
return [];
}; };
const deleteInvoices = (ids: number[], callback?: () => void) => { const deleteInvoices = (ids: number[], callback?: () => void) => {
......
...@@ -120,8 +120,11 @@ const Inventory: React.FC<{}> = () => { ...@@ -120,8 +120,11 @@ const Inventory: React.FC<{}> = () => {
// 获取对应仓库 // 获取对应仓库
const fetchInventory = async () => { const fetchInventory = async () => {
const { data } = await PublicApi.getProductWarehouseAll(); const { data, code } = await PublicApi.getProductWarehouseAll();
if (code === 1000) {
return data.map(v => ({ label: v.name, value: v.id })); return data.map(v => ({ label: v.name, value: v.id }));
}
return [];
}; };
// 修改安全库存 // 修改安全库存
......
...@@ -77,8 +77,11 @@ const WarehouseForm: React.FC<WarehouseFormProps> = ({ ...@@ -77,8 +77,11 @@ const WarehouseForm: React.FC<WarehouseFormProps> = ({
// 获取手机code // 获取手机code
const fetchTelCode = async () => { const fetchTelCode = async () => {
const { data } = await PublicApi.getManageCountryAreaGetTelCode(); const { data, code } = await PublicApi.getManageCountryAreaGetTelCode();
if (code === 1000) {
return data; return data;
}
return [];
}; };
const handleSubmit = value => { const handleSubmit = value => {
......
...@@ -163,6 +163,8 @@ const Analysis: React.FC<AnalysisProps> = ({ ...@@ -163,6 +163,8 @@ const Analysis: React.FC<AnalysisProps> = ({
setEvaluateSum(evaluate); setEvaluateSum(evaluate);
setEvaluatePie(evaluatePieData); setEvaluatePie(evaluatePieData);
} }
}).catch((err) => {
console.warn(err);
}); });
}; };
......
...@@ -76,6 +76,8 @@ const ReceivedDetail: React.FC = () => { ...@@ -76,6 +76,8 @@ const ReceivedDetail: React.FC = () => {
memberName: res.data.memberName, memberName: res.data.memberName,
}); });
} }
}).catch((err) => {
console.warn(err);
}).finally(() => { }).finally(() => {
setEvaluationInfoLoading(false); setEvaluationInfoLoading(false);
}); });
......
...@@ -89,6 +89,8 @@ const DetailInfo: React.FC<DetailInfoProps> = ({ ...@@ -89,6 +89,8 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
memberName: res.data.memberName, memberName: res.data.memberName,
}); });
} }
}).catch((err) => {
console.warn(err);
}).finally(() => { }).finally(() => {
setEvaluationInfoLoading(false); setEvaluationInfoLoading(false);
}); });
......
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