菜品类型多选

This commit is contained in:
huangdeliang
2021-01-19 11:52:57 +08:00
parent 2be6c3c97f
commit 20f82629b1
2 changed files with 12 additions and 7 deletions

View File

@ -39,7 +39,7 @@
<include refid="selectSysDishesVo"/> <include refid="selectSysDishesVo"/>
<where> <where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if> <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="type != null and type != ''"> and type = #{type}</if> <if test="type != null and type != ''"> and FIND_IN_SET(#{type}, type)</if>
<if test="reviewStatus != null and type != ''"> and review_status = #{reviewStatus}</if> <if test="reviewStatus != null and type != ''"> and review_status = #{reviewStatus}</if>
</where> </where>
</select> </select>

View File

@ -11,7 +11,7 @@
/> />
</el-form-item> </el-form-item>
<el-form-item label="菜品类型" prop="type"> <el-form-item label="菜品类型" prop="type">
<el-select v-model="queryParams.type" multiple placeholder="请选择菜品类型" clearable size="small"> <el-select v-model="queryParams.type" placeholder="请选择菜品类型" clearable size="small">
<el-option <el-option
v-for="dict in typeOptions" v-for="dict in typeOptions"
:key="dict.dictValue" :key="dict.dictValue"
@ -75,7 +75,11 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="菜品名称" align="center" prop="name"/> <el-table-column label="菜品名称" align="center" prop="name"/>
<el-table-column label="菜品类型" align="center" prop="type" :formatter="typeFormat"/> <el-table-column label="菜品类型" align="center" prop="type" >
<template slot-scope="scope">
<autohideinfo :data="typeFormat(scope.row)"/>
</template>
</el-table-column>
<el-table-column label="包含食材" align="center"> <el-table-column label="包含食材" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<div v-for="igd in scope.row.igdList" <div v-for="igd in scope.row.igdList"
@ -133,7 +137,7 @@
<el-input v-model="form.name" placeholder="请输入菜品名称"/> <el-input v-model="form.name" placeholder="请输入菜品名称"/>
</el-form-item> </el-form-item>
<el-form-item label="菜品类型" prop="type"> <el-form-item label="菜品类型" prop="type">
<el-select v-model="form.type" placeholder="请选择菜品类型"> <el-select v-model="form.type" placeholder="请选择菜品类型" multiple>
<el-option <el-option
v-for="dict in typeOptions" v-for="dict in typeOptions"
:key="dict.dictValue" :key="dict.dictValue"
@ -402,7 +406,7 @@
}, },
// 菜品类型字典翻译 // 菜品类型字典翻译
typeFormat(row, column) { typeFormat(row, column) {
return this.selectDictLabel(this.typeOptions, row.type); return !row.type ? '' : row.type.split(',').map(type => this.selectDictLabel(this.typeOptions, type));
}, },
cusUnitFormat(row, column) { cusUnitFormat(row, column) {
return this.selectDictLabel(this.cusUnitOptions, row.type); return this.selectDictLabel(this.cusUnitOptions, row.type);
@ -421,7 +425,7 @@
this.form = { this.form = {
id: null, id: null,
name: null, name: null,
type: null, type: [],
methods: null, methods: null,
createBy: null, createBy: null,
createTime: null, createTime: null,
@ -516,6 +520,7 @@
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
this.form.igdList = this.selTableData; this.form.igdList = this.selTableData;
this.form.type = this.form.type.join(',');
if (this.form.id != null) { if (this.form.id != null) {
updateDishes(this.form).then(response => { updateDishes(this.form).then(response => {
if (response.code === 200) { if (response.code === 200) {
@ -624,7 +629,7 @@
const {columns, data} = param; const {columns, data} = param;
return columns.reduce((arr, cur, idx) => { return columns.reduce((arr, cur, idx) => {
if (idx > 1) { if (idx > 1) {
if(idx === 6) { if (idx === 6) {
// 备注 // 备注
return arr; return arr;
} }