食品管理添加用餐类型字段
This commit is contained in:
parent
6bd7ea834f
commit
150676a9ad
@ -10,15 +10,15 @@
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="售价" prop="price">-->
|
||||
<!-- <el-input-->
|
||||
<!-- v-model="queryParams.price"-->
|
||||
<!-- placeholder="请输入售价"-->
|
||||
<!-- clearable-->
|
||||
<!-- size="small"-->
|
||||
<!-- @keyup.enter.native="handleQuery"-->
|
||||
<!-- />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="售价" prop="price">-->
|
||||
<!-- <el-input-->
|
||||
<!-- v-model="queryParams.price"-->
|
||||
<!-- placeholder="请输入售价"-->
|
||||
<!-- clearable-->
|
||||
<!-- size="small"-->
|
||||
<!-- @keyup.enter.native="handleQuery"-->
|
||||
<!-- />-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item label="食品分类" prop="type">
|
||||
<el-select v-model="queryParams.type" placeholder="请选择食品分类" clearable size="small">
|
||||
<el-option
|
||||
@ -43,7 +43,8 @@
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['fantang:food:add']"
|
||||
>新增</el-button>
|
||||
>新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
@ -53,7 +54,8 @@
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['fantang:food:edit']"
|
||||
>修改</el-button>
|
||||
>修改
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
@ -63,7 +65,8 @@
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['fantang:food:remove']"
|
||||
>删除</el-button>
|
||||
>删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
@ -72,17 +75,19 @@
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['fantang:food:export']"
|
||||
>导出</el-button>
|
||||
>导出
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="foodList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column type="selection" width="55" align="center"/>
|
||||
<el-table-column label="食品id" align="center" prop="foodId" v-if="false"/>
|
||||
<el-table-column label="食品名称" align="center" prop="name" />
|
||||
<el-table-column label="售价" align="center" prop="price" />
|
||||
<el-table-column label="食品分类" align="center" prop="type" :formatter="typeFormat" />
|
||||
<el-table-column label="食品名称" align="center" prop="name"/>
|
||||
<el-table-column label="售价" align="center" prop="price"/>
|
||||
<el-table-column label="用餐类型" align="center" prop="dinnerType" :formatter="dinnerTypeFormat"/>
|
||||
<el-table-column label="食品分类" align="center" prop="type" :formatter="typeFormat"/>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
@ -91,14 +96,16 @@
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['fantang:food:edit']"
|
||||
>修改</el-button>
|
||||
>修改
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['fantang:food:remove']"
|
||||
>删除</el-button>
|
||||
>删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@ -115,13 +122,23 @@
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="食品名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入食品名称" />
|
||||
<el-input v-model="form.name" placeholder="请输入食品名称"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="图片">
|
||||
<uploadImage v-model="form.pictureUrl"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="售价" prop="price">
|
||||
<el-input v-model="form.price" placeholder="请输入售价" />
|
||||
<el-input v-model="form.price" placeholder="请输入售价"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="用餐类型" prop="dinnerType">
|
||||
<el-select v-model="form.dinnerType" placeholder="请选择用餐类型">
|
||||
<el-option
|
||||
v-for="dict in dinnerTypeOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="parseInt(dict.dictValue)"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="食品分类" prop="type">
|
||||
<el-select v-model="form.type" placeholder="请选择食品分类">
|
||||
@ -143,7 +160,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listFood, getFood, delFood, addFood, updateFood, exportFood } from "@/api/fantang/food";
|
||||
import {addFood, delFood, exportFood, getFood, listFood, updateFood} from "@/api/fantang/food";
|
||||
import UploadImage from '@/components/UploadImage';
|
||||
|
||||
export default {
|
||||
@ -153,6 +170,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dinnerTypeOptions: [],
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
@ -186,13 +204,13 @@ export default {
|
||||
// 表单校验
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: "食品名称不能为空", trigger: "blur" }
|
||||
{required: true, message: "食品名称不能为空", trigger: "blur"}
|
||||
],
|
||||
price: [
|
||||
{ required: true, message: "售价不能为空", trigger: "blur" }
|
||||
{required: true, message: "售价不能为空", trigger: "blur"}
|
||||
],
|
||||
type: [
|
||||
{ required: true, message: "食品分类不能为空", trigger: "change" }
|
||||
{required: true, message: "食品分类不能为空", trigger: "change"}
|
||||
]
|
||||
}
|
||||
};
|
||||
@ -202,6 +220,9 @@ export default {
|
||||
this.getDicts("ft_food_type").then(response => {
|
||||
this.typeOptions = response.data;
|
||||
});
|
||||
this.getDicts("ft_book_type").then(response => {
|
||||
this.dinnerTypeOptions = response.data;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
/** 查询食品管理列表 */
|
||||
@ -213,6 +234,10 @@ export default {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 用餐类型
|
||||
dinnerTypeFormat(row) {
|
||||
return this.selectDictLabel(this.dinnerTypeOptions, row.dinnerType);
|
||||
},
|
||||
// 食品分类字典翻译
|
||||
typeFormat(row, column) {
|
||||
return this.selectDictLabel(this.typeOptions, row.type);
|
||||
@ -247,7 +272,7 @@ export default {
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.foodId)
|
||||
this.single = selection.length!==1
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
@ -290,28 +315,28 @@ export default {
|
||||
handleDelete(row) {
|
||||
const foodIds = row.foodId || this.ids;
|
||||
this.$confirm('是否确认删除食品管理编号为"' + foodIds + '"的数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(function() {
|
||||
return delFood(foodIds);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.msgSuccess("删除成功");
|
||||
})
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(function () {
|
||||
return delFood(foodIds);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.msgSuccess("删除成功");
|
||||
})
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
const queryParams = this.queryParams;
|
||||
this.$confirm('是否确认导出所有食品管理数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(function() {
|
||||
return exportFood(queryParams);
|
||||
}).then(response => {
|
||||
this.download(response.msg);
|
||||
})
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(function () {
|
||||
return exportFood(queryParams);
|
||||
}).then(response => {
|
||||
this.download(response.msg);
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user