perf: refs #7553 removeSales function
This commit is contained in:
parent
f025b4361e
commit
3716507f93
|
@ -388,17 +388,18 @@ const removeSelectedSales = () => {
|
|||
};
|
||||
|
||||
const removeSales = async () => {
|
||||
let paramsOk = true;
|
||||
try {
|
||||
const params = { sales: selectedRows.value, ticketId: store.data.id };
|
||||
params.sales.forEach((sale) => {
|
||||
if (!sale.itemFk) {
|
||||
tableRef.value.reload();
|
||||
paramsOk = false;
|
||||
}
|
||||
});
|
||||
const params = {
|
||||
sales: selectedRows.value.filter((sale) => sale.id),
|
||||
ticketId: store.data.id,
|
||||
};
|
||||
selectedRows.value
|
||||
.filter((sale) => !sale.id)
|
||||
.forEach((sale) =>
|
||||
tableRef.value.CrudModelRef.formData.splice(sale.$index, 1)
|
||||
);
|
||||
|
||||
if (!paramsOk) return;
|
||||
if (params.sales.length == 0) return;
|
||||
await axios.post('Sales/deleteSales', params);
|
||||
removeSelectedSales();
|
||||
notify('globals.dataSaved', 'positive');
|
||||
|
|
Loading…
Reference in New Issue