feat:增加美食朋友圈接口

This commit is contained in:
2025-06-25 16:27:42 +08:00
parent 71c107f2e5
commit eff6078a98
17 changed files with 243 additions and 183 deletions

View File

@@ -3,7 +3,7 @@
<div class="button-container">
<el-button type="primary" @click="addClick">新增</el-button>
</div>
<el-table :data="foodStore.currentFoodRecipe.materialList"
<el-table :data="foodStore.currentRecipe.materialList"
border stripe class="material-table">
<el-table-column type="index" align="center" width="40" />
<el-table-column prop="type" label="类型" align="center" min-width="10%"/>
@@ -15,35 +15,35 @@
<script setup lang="ts">
import { useFoodStore } from '@/store/food'
import { IFoodMaterial } from '@/types/food'
import { IMaterial } from '@/types/food'
import { deepCopyObject } from 'vue3-common/utils/dataUtil'
import { commonElMessageBox } from 'vue3-common/utils/elUtil'
const foodStore = useFoodStore()
const addClick = () => {
foodStore.foodMaterialApiType = 'ADD'
foodStore.foodMaterialDialog = {
foodStore.materialApiType = 'ADD'
foodStore.materialDialog = {
title: '新增食材',
visible: true,
data: foodStore.getEmptyFoodMaterial()
data: foodStore.getEmptyMaterial()
}
}
const handleEditClick = (index: number, material: IFoodMaterial) => {
foodStore.editFoodMaterialIndex = index
foodStore.foodMaterialApiType = 'UPDATE'
foodStore.foodMaterialDialog = {
const editClick = (index: number, material: IMaterial) => {
foodStore.editMaterialIndex = index
foodStore.materialApiType = 'UPDATE'
foodStore.materialDialog = {
title: '编辑食材',
visible: true,
data: deepCopyObject(material)
}
}
const handleDeleteClick = (index: number, material: IFoodMaterial) => {
foodStore.foodMaterialApiType = 'DELETE'
const deleteClick = (index: number, material: IMaterial) => {
foodStore.materialApiType = 'DELETE'
commonElMessageBox(`确认删除该食材: ${material.name}?`).then(() => {
foodStore.currentFoodRecipe.materialList.splice(index, 1)
foodStore.currentRecipe.materialList.splice(index, 1)
})
}
</script>