Commit 1f7ceecb authored by XieZhiXiong's avatar XieZhiXiong

chore: 添加 catch

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