调整删除错误
This commit is contained in:
parent
14f7113765
commit
297a97db9e
@ -95,7 +95,6 @@ const actions = {
|
||||
startNum: startNumDay,
|
||||
endNum: endNumDay
|
||||
});
|
||||
|
||||
getDicts("cus_cus_unit").then(response => {
|
||||
commit("updateStateData", { cusUnitOptions: response.data });
|
||||
});
|
||||
@ -269,6 +268,13 @@ const actions = {
|
||||
// console.log(params);
|
||||
},
|
||||
async addDishes({ commit, state }, payload) {
|
||||
const tarDishesList = state.recipesData[payload.num].dishes.filter(
|
||||
obj => obj.type === payload.type
|
||||
);
|
||||
if (tarDishesList.some(obj => obj.dishesId === payload.dishesId)) {
|
||||
console.log("目标餐类已有相同的菜品");
|
||||
throw new Error("目标餐类已有相同的菜品");
|
||||
}
|
||||
if (state.recipesId) {
|
||||
const tarRecipesObj = state.recipesData[payload.num];
|
||||
if (tarRecipesObj && payload.data) {
|
||||
|
@ -99,9 +99,7 @@ export default {
|
||||
if (idx === 0) {
|
||||
this.selDishes.type = cur;
|
||||
}
|
||||
const tarOpt = this.typeOptions.find(
|
||||
(obj) => obj.dictValue === cur
|
||||
);
|
||||
const tarOpt = this.typeOptions.find((obj) => obj.dictValue === cur);
|
||||
if (tarOpt) {
|
||||
arr.push(tarOpt);
|
||||
}
|
||||
@ -134,7 +132,7 @@ export default {
|
||||
igdList,
|
||||
} = this.selDishes;
|
||||
this.$emit("onConfirm", {
|
||||
id: -1,
|
||||
id: new Date().getTime(),
|
||||
dishesId: id,
|
||||
methods,
|
||||
name,
|
||||
|
@ -350,6 +350,8 @@ export default {
|
||||
this.addDishes({
|
||||
num: this.num,
|
||||
data,
|
||||
}).catch((err) => {
|
||||
this.$message.error(err.message);
|
||||
});
|
||||
},
|
||||
...mapActions(["updateDishes", "addDishes", "deleteDishes"]),
|
||||
|
Loading…
x
Reference in New Issue
Block a user