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