diff --git a/src/components/Food/FoodCard.vue b/src/components/Food/FoodCard.vue
index b4e6580..3f3cd8b 100644
--- a/src/components/Food/FoodCard.vue
+++ b/src/components/Food/FoodCard.vue
@@ -69,6 +69,7 @@ import { formatDate } from 'vue3-common/utils/dateUtil'
import { deepCopyObject } from 'vue3-common/utils/dataUtil'
import { commonElMessageBox } from 'vue3-common/utils/elUtil'
import { serviceFileRootPath } from '@/utils'
+import { ElMessage } from 'element-plus'
const router = useRouter()
const foodStore = useFoodStore()
@@ -94,14 +95,9 @@ const getRecord = (recordList: IRecord[]) => {
}
const editClick = async () => {
- const id = props.foodItem?.id
foodStore.recipeApiType = 'UPDATE'
- // await foodStore.queryRecipe(id as number)
- // foodStore.foodRecipeDialog = {
- // title: '编辑菜谱',
- // visible: true,
- // data: deepCopyObject(foodStore.currentFoodRecipe)
- // }
+ await foodStore.queryRecipe(props.foodItem.id as number)
+ await router.push('/record/recipeForm')
}
const viewClick = async () => {
@@ -111,7 +107,7 @@ const viewClick = async () => {
const deleteClick = () => {
foodStore.recipeApiType = 'DELETE'
commonElMessageBox(`请确认是否删除该菜谱: ${props.foodItem?.name}?`).then(() => {
- // foodStore.handleRecipeApi(props.foodItem as IRecipe)
+ foodStore.handleRecipeApi(props.foodItem as IRecipe)
})
}
diff --git a/src/components/Food/FoodMaterialDialog.vue b/src/components/Food/FoodMaterialDialog.vue
new file mode 100644
index 0000000..72fcbe2
--- /dev/null
+++ b/src/components/Food/FoodMaterialDialog.vue
@@ -0,0 +1,100 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/Food/FoodMaterialForm.vue b/src/components/Food/FoodMaterialForm.vue
index b608368..cb81bad 100644
--- a/src/components/Food/FoodMaterialForm.vue
+++ b/src/components/Food/FoodMaterialForm.vue
@@ -4,7 +4,7 @@
新增
+ border stripe @row-click="handleRowClick" class="material-table">
@@ -17,7 +17,6 @@
import { useFoodStore } from '@/store/food'
import type { IMaterial } from '@/types/food'
import { deepCopyObject } from 'vue3-common/utils/dataUtil'
-import { commonElMessageBox } from 'vue3-common/utils/elUtil'
const foodStore = useFoodStore()
@@ -30,22 +29,15 @@ const addClick = () => {
}
}
-const editClick = (index: number, material: IMaterial) => {
- foodStore.editMaterialIndex = index
+const handleRowClick = (row: IMaterial) => {
+ foodStore.editMaterialIndex = foodStore.currentRecipe.materialList.indexOf(row)
foodStore.materialApiType = 'UPDATE'
foodStore.materialDialog = {
title: '编辑食材',
visible: true,
- data: deepCopyObject(material)
+ data: deepCopyObject(row)
}
}
-
-const deleteClick = (index: number, material: IMaterial) => {
- foodStore.materialApiType = 'DELETE'
- commonElMessageBox(`确认删除该食材: ${material.name}?`).then(() => {
- foodStore.currentRecipe.materialList.splice(index, 1)
- })
-}
diff --git a/src/components/Food/FoodStepForm.vue b/src/components/Food/FoodStepForm.vue
index 4beb445..58890b4 100644
--- a/src/components/Food/FoodStepForm.vue
+++ b/src/components/Food/FoodStepForm.vue
@@ -5,7 +5,7 @@
+ border stripe @row-click="handleRowClick" class="food-step-table">
@@ -22,7 +22,6 @@
import { useFoodStore } from '@/store/food'
import type { IStep } from '@/types/food'
import { deepCopyObject } from 'vue3-common/utils/dataUtil'
-import { commonElMessageBox } from 'vue3-common/utils/elUtil'
import { serviceFileRootPath } from '@/utils'
const foodStore = useFoodStore()
@@ -37,27 +36,15 @@ const addClick = () => {
}
}
-const editClick = (index: number, step: IStep) => {
- foodStore.editStepIndex = index
+const handleRowClick = (row: IStep) => {
+ foodStore.editStepIndex = foodStore.currentRecipe.stepList.indexOf(row)
foodStore.stepApiType = 'UPDATE'
foodStore.stepDialog = {
title: '编辑步骤',
visible: true,
- data: deepCopyObject(step)
+ data: deepCopyObject(row)
}
}
-
-const deleteClick = (index: number) => {
- commonElMessageBox('确认删除该步骤?').then(() => {
- foodStore.stepApiType = 'DELETE'
- foodStore.currentRecipe.stepList.splice(index, 1)
- foodStore.currentRecipe.stepList.forEach((item) => {
- if (item.sort > index) {
- item.sort -= 1
- }
- })
- })
-}
diff --git a/src/views/login/index.vue b/src/views/login/index.vue
index ebc0f6a..714c69b 100644
--- a/src/views/login/index.vue
+++ b/src/views/login/index.vue
@@ -42,19 +42,20 @@ onUnmounted(() => {