feat:增加美食朋友圈接口
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user