fix(订单编辑): 添加重置订单明细前的确认提示和必要字段校验
在重置订单明细前添加确认提示框,避免误操作删除数据 增加styleNo和quality字段的校验,防止空值导致错误
This commit is contained in:
parent
7311cc8dc9
commit
5af2a0714a
@ -684,11 +684,24 @@ export default defineComponent({
|
||||
params: params,
|
||||
});
|
||||
|
||||
// 删除当前tab页的明细
|
||||
for (const dtl of dtlsRes.data) {
|
||||
await axios.delete(`api/orderdtls/${dtl.id}`);
|
||||
if (dtlsRes.data && dtlsRes.data.length > 0) {
|
||||
const type = await VXETable.modal.confirm({
|
||||
id: 'resetOrderDtlsConfirm',
|
||||
content: $t('jewpmsApp.order.detail.reset.confirmDelete'), // '检测到已有订单明细记录,是否需要删除并根据当前款式重新生成?'
|
||||
status: 'warning',
|
||||
escClosable: true,
|
||||
});
|
||||
if (type !== 'confirm') {
|
||||
// 用户取消,不执行操作
|
||||
return;
|
||||
}
|
||||
// 删除当前tab页的明细
|
||||
for (const dtl of dtlsRes.data) {
|
||||
await axios.delete(`api/orderdtls/${dtl.id}`);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (order.value.styleNo && order.value.quality) {
|
||||
// 2. 从jhi_styledtl表中获取相应的明细信息
|
||||
let styleDtlParams = {
|
||||
number: { name: '', op: '=', value: order.value.styleNo },
|
||||
@ -741,10 +754,12 @@ export default defineComponent({
|
||||
|
||||
await axios.post('api/orderdtls', newOrderDtl);
|
||||
}
|
||||
|
||||
// 4. 刷新订单明细
|
||||
await loadOrderDtls();
|
||||
alertService.showSuccess($t('jewpmsApp.order.detail.reset.success'));
|
||||
} else {
|
||||
alertService.showError($t('jewpmsApp.order.styleNo.required'));
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
alertService.showHttpError(e);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user