Merge remote-tracking branch 'origin/master' into master

This commit is contained in:
czx 2020-12-04 08:08:21 +08:00
commit 355258abbb
7 changed files with 281 additions and 226 deletions

View File

@ -1,31 +1,23 @@
package com.ruoyi.system.fantang.controller; package com.ruoyi.system.fantang.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import java.util.List;
import java.util.Arrays;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.common.utils.StringUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.fantang.domain.FtFoodDemandDao; import com.ruoyi.system.fantang.domain.FtFoodDemandDao;
import com.ruoyi.system.fantang.service.IFtFoodDemandDaoService; import com.ruoyi.system.fantang.service.IFtFoodDemandDaoService;
import com.ruoyi.common.utils.poi.ExcelUtil; import lombok.RequiredArgsConstructor;
import com.ruoyi.common.core.page.TableDataInfo; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
/** /**
* 病人报餐Controller * 病人报餐Controller
@ -95,6 +87,7 @@ public class FtFoodDemandDaoController extends BaseController {
@Log(title = "病人报餐" , businessType = BusinessType.UPDATE) @Log(title = "病人报餐" , businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody FtFoodDemandDao ftFoodDemandDao) { public AjaxResult edit(@RequestBody FtFoodDemandDao ftFoodDemandDao) {
ftFoodDemandDao.setUpdateAt(new Date());
return toAjax(iFtFoodDemandDaoService.updateById(ftFoodDemandDao) ? 1 : 0); return toAjax(iFtFoodDemandDaoService.updateById(ftFoodDemandDao) ? 1 : 0);
} }

View File

@ -17,6 +17,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@ -82,7 +83,8 @@ public class FtNutritionFoodDaoController extends BaseController {
@Log(title = "病患营养配餐", businessType = BusinessType.INSERT) @Log(title = "病患营养配餐", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody FtNutritionFoodDao ftNutritionFoodDao) { public AjaxResult add(@RequestBody FtNutritionFoodDao ftNutritionFoodDao) {
ftNutritionFoodDao.setFlag(1); ftNutritionFoodDao.setFlag(true);
ftNutritionFoodDao.setCreateAt(new Date());
return toAjax(iFtNutritionFoodDaoService.save(ftNutritionFoodDao) ? 1 : 0); return toAjax(iFtNutritionFoodDaoService.save(ftNutritionFoodDao) ? 1 : 0);
} }
@ -102,7 +104,7 @@ public class FtNutritionFoodDaoController extends BaseController {
@PutMapping("/deactivate/{id}") @PutMapping("/deactivate/{id}")
public AjaxResult deactivate(@PathVariable("id") Long id) { public AjaxResult deactivate(@PathVariable("id") Long id) {
FtNutritionFoodDao ftNutritionFoodDao = iFtNutritionFoodDaoService.getById(id); FtNutritionFoodDao ftNutritionFoodDao = iFtNutritionFoodDaoService.getById(id);
ftNutritionFoodDao.setFlag(0); ftNutritionFoodDao.setFlag(false);
iFtNutritionFoodDaoService.updateById(ftNutritionFoodDao); iFtNutritionFoodDaoService.updateById(ftNutritionFoodDao);
return AjaxResult.success("停用成功"); return AjaxResult.success("停用成功");
} }

View File

@ -1,23 +1,21 @@
package com.ruoyi.system.fantang.domain; package com.ruoyi.system.fantang.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.ToString; import lombok.ToString;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import com.ruoyi.common.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.math.BigDecimal;
import com.ruoyi.common.core.domain.BaseEntity;
/** /**
* 病人报餐对象 ft_food_demand * 病人报餐对象 ft_food_demand
* *
* @author ft * @author ft
* @date 2020-12-03 * @date 2020-12-03
*/ */
@ -29,61 +27,91 @@ import com.ruoyi.common.core.domain.BaseEntity;
@TableName("ft_food_demand") @TableName("ft_food_demand")
public class FtFoodDemandDao implements Serializable { public class FtFoodDemandDao implements Serializable {
private static final long serialVersionUID=1L; private static final long serialVersionUID = 1L;
/** id */ /**
* id
*/
@TableId(value = "id") @TableId(value = "id")
private Long id; private Long id;
/** 病人id */ /**
* 病人id
*/
private Long patientId; private Long patientId;
/** 正餐清单 */ /**
* 正餐清单
*/
@Excel(name = "正餐清单") @Excel(name = "正餐清单")
private String foods; private String foods;
/** 正餐类型 */ /**
* 正餐类型
*/
@Excel(name = "正餐类型") @Excel(name = "正餐类型")
private Long type; private Long type;
/** 创建时间 */ /**
* 创建时间
*/
private Date createAt; private Date createAt;
/** 创建人 */ /**
* 创建人
*/
private Long createBy; private Long createBy;
/** 更新日期 */ /**
@Excel(name = "更新日期" , width = 30, dateFormat = "yyyy-MM-dd") * 更新日期
*/
@Excel(name = "更新日期", width = 30, dateFormat = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateAt; private Date updateAt;
/** 加菜 */ /**
* 加菜
*/
@Excel(name = "加菜") @Excel(name = "加菜")
private Integer vegetables; private Integer vegetables;
/** 更新操作人 id */ /**
* 更新操作人 id
*/
private Long updateBy; private Long updateBy;
/** 加肉 */ /**
* 加肉
*/
@Excel(name = "加肉") @Excel(name = "加肉")
private Integer meat; private Integer meat;
/** 更新来源 */ /**
* 更新来源
*/
private Integer updateFrom; private Integer updateFrom;
/** 加饭 */ /**
* 加饭
*/
@Excel(name = "加饭") @Excel(name = "加饭")
private Integer rice; private Integer rice;
/** 加蛋 */ /**
* 加蛋
*/
@Excel(name = "加蛋") @Excel(name = "加蛋")
private Integer egg; private Integer egg;
/** 订单详情 */ /**
* 订单详情
*/
private String orderInfo; private String orderInfo;
/** 启用状态 */ /**
* 启用状态
*/
@Excel(name = "启用状态") @Excel(name = "启用状态")
private Integer flag; private Boolean flag;
} }

View File

@ -1,23 +1,21 @@
package com.ruoyi.system.fantang.domain; package com.ruoyi.system.fantang.domain;
import com.fasterxml.jackson.annotation.JsonFormat; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.annotation.Excel;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.ToString; import lombok.ToString;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import com.ruoyi.common.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
import java.math.BigDecimal; import java.math.BigDecimal;
import com.ruoyi.common.core.domain.BaseEntity; import java.util.Date;
/** /**
* 病患营养配餐对象 ft_nutrition_food * 病患营养配餐对象 ft_nutrition_food
* *
* @author ft * @author ft
* @date 2020-12-03 * @date 2020-12-03
*/ */
@ -29,28 +27,40 @@ import com.ruoyi.common.core.domain.BaseEntity;
@TableName("ft_nutrition_food") @TableName("ft_nutrition_food")
public class FtNutritionFoodDao implements Serializable { public class FtNutritionFoodDao implements Serializable {
private static final long serialVersionUID=1L; private static final long serialVersionUID = 1L;
/** id */ /**
* id
*/
@TableId(value = "id") @TableId(value = "id")
private Long id; private Long id;
/** 营养餐名称 */ /**
* 营养餐名称
*/
@Excel(name = "营养餐名称") @Excel(name = "营养餐名称")
private String name; private String name;
/** 价格 */ /**
* 价格
*/
@Excel(name = "价格") @Excel(name = "价格")
private BigDecimal price; private BigDecimal price;
/** 启用标志 */ /**
* 启用标志
*/
@Excel(name = "启用标志") @Excel(name = "启用标志")
private Integer flag; private Boolean flag;
/** 创建日期 */ /**
* 创建日期
*/
private Date createAt; private Date createAt;
/** 创建人 */ /**
* 创建人
*/
private String createBy; private String createBy;
} }

View File

@ -1,15 +1,56 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="启用状态" prop="flag"> <el-form-item label="姓名" prop="patientName">
<el-input <el-input
v-model="queryParams.flag" v-model="queryParams.name"
placeholder="请输入启用状态" placeholder="请输入姓名"
clearable clearable
size="small" size="small"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="床号" prop="bedId">
<el-input
v-model="queryParams.bedId"
placeholder="请输入床号"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="科室" prop="departName">
<el-input
v-model="queryParams.departName"
placeholder="请输入科室"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="住院号" prop="hospitalId">
<el-input
v-model="queryParams.hospitalId"
placeholder="请输入住院号"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="启用状态" prop="flag">
<el-select v-model="queryParams.flag" placeholder="请选择启用状态"
clearable
size="small"
@keyup.enter.native="handleQuery">
<el-option
v-for="item in flagOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@ -24,27 +65,8 @@
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['fantang:foodDemand:add']" v-hasPermi="['fantang:foodDemand:add']"
>新增</el-button> >自动生成
</el-col> </el-button>
<el-col :span="1.5">
<el-button
type="success"
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['fantang:foodDemand:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['fantang:foodDemand:remove']"
>删除</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -53,26 +75,32 @@
size="mini" size="mini"
@click="handleExport" @click="handleExport"
v-hasPermi="['fantang:foodDemand:export']" v-hasPermi="['fantang:foodDemand:export']"
>导出</el-button> >导出
</el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="foodDemandList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="foodDemandList" @selection-change="handleSelectionChange" border>
<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="id" v-if="false"/> <el-table-column label="id" align="center" prop="id" v-if="false"/>
<el-table-column label="正餐类型" align="center" prop="type" :formatter="typeFormat" /> <!-- <el-table-column label="住院号" align="center" prop="hospitalId"/>-->
<el-table-column label="正餐清单" align="center" prop="foods" /> <el-table-column label="姓名" align="center" prop="name" width="100px"/>
<el-table-column label="更新日期" align="center" prop="updateAt" width="180"> <!-- <el-table-column label="科室" align="center" prop="departName"/>-->
<template slot-scope="scope"> <el-table-column label="床号" align="center" prop="bedId" width="100px"/>
<span>{{ parseTime(scope.row.updateAt, '{y}-{m}-{d}') }}</span> <el-table-column label="正餐" align="center" prop="type" :formatter="typeFormat" width="100px"/>
</template> <el-table-column label="正餐清单" align="center" prop="foods" :formatter="formatFoods"/>
</el-table-column> <el-table-column label="加菜" align="center" prop="vegetables" width="80px" :formatter="formatVegetables"/>
<el-table-column label="加菜" align="center" prop="vegetables" /> <el-table-column label="加肉" align="center" prop="meat" width="80px" :formatter="formatMeat"/>
<el-table-column label="加肉" align="center" prop="meat" /> <el-table-column label="加饭" align="center" prop="rice" width="80px" :formatter="formatRice"/>
<el-table-column label="加饭" align="center" prop="rice" /> <el-table-column label="加蛋" align="center" prop="egg" width="80px" :formatter="formatEgg"/>
<el-table-column label="加蛋" align="center" prop="egg" /> <el-table-column label="营养配餐" align="center" prop="nutritionFood" width="120px"/>
<el-table-column label="启用状态" align="center" prop="flag" /> <!-- <el-table-column label="更新日期" align="center" prop="updateAt" width="180">-->
<!-- <template slot-scope="scope">-->
<!-- <span>{{ parseTime(scope.row.updateAt, '{y}-{m}-{d}') }}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="启用状态" align="center" prop="flag" width="80px"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
@ -81,14 +109,8 @@
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['fantang:foodDemand:edit']" v-hasPermi="['fantang:foodDemand:edit']"
>修改</el-button> >修改
<el-button </el-button>
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['fantang:foodDemand:remove']"
>删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -104,6 +126,9 @@
<!-- 添加或修改病人报餐对话框 --> <!-- 添加或修改病人报餐对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <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 ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="姓名">
<el-input label="姓名"></el-input>
</el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
@ -114,14 +139,28 @@
</template> </template>
<script> <script>
import { listFoodDemand, getFoodDemand, delFoodDemand, addFoodDemand, updateFoodDemand, exportFoodDemand } from "@/api/fantang/foodDemand"; import {
addFoodDemand,
delFoodDemand,
exportFoodDemand,
getFoodDemand,
listFoodDemand,
updateFoodDemand
} from "@/api/fantang/foodDemand";
import {listFood} from "../../../api/fantang/food";
export default { export default {
name: "FoodDemand", name: "FoodDemand",
components: { components: {},
},
data() { data() {
return { return {
flagOptions: [{
value: 1,
label: '启用'
}, {
value: 2,
label: '禁用'
}],
// //
loading: true, loading: true,
// //
@ -155,11 +194,12 @@ export default {
// //
rules: { rules: {
type: [ type: [
{ required: true, message: "正餐类型不能为空", trigger: "change" } {required: true, message: "正餐类型不能为空", trigger: "change"}
], ],
} }
}; };
}, },
created() { created() {
this.getList(); this.getList();
this.getDicts("ft_book_type").then(response => { this.getDicts("ft_book_type").then(response => {
@ -169,7 +209,47 @@ export default {
this.updateFromOptions = response.data; this.updateFromOptions = response.data;
}); });
}, },
beforeCreate() {
listFood(this.queryParams).then(response => {
this.foodList = response.rows;
this.loading = false;
});
},
methods: { methods: {
//
formatFoods(row) {
const _this = this;
let arr = row.foods.split(",").map(Number);
let ret = arr.map(item =>{
let obj = _this.foodList.find((value => {
return value.foodId === item;
}));
return obj.name;
});
return ret.toString();
},
formatVegetables(row){
if (row.vegetables === null || row.vegetables === 0)
return "否";
return "是";
},
formatMeat(row) {
if (row.meat === null || row.meat === 0)
return "否";
return "是";
},
formatRice(row) {
if (row.rice === null || row.rice === 0)
return "否";
return "是";
},
formatEgg(row) {
if (row.egg === null || row.egg === 0)
return "否";
return "是";
},
/** 查询病人报餐列表 */ /** 查询病人报餐列表 */
getList() { getList() {
this.loading = true; this.loading = true;
@ -226,7 +306,7 @@ export default {
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.id) this.ids = selection.map(item => item.id)
this.single = selection.length!==1 this.single = selection.length !== 1
this.multiple = !selection.length this.multiple = !selection.length
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
@ -265,32 +345,18 @@ export default {
} }
}); });
}, },
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm('是否确认删除病人报餐编号为"' + ids + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delFoodDemand(ids);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
})
},
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
const queryParams = this.queryParams; const queryParams = this.queryParams;
this.$confirm('是否确认导出所有病人报餐数据项?', "警告", { this.$confirm('是否确认导出所有病人报餐数据项?', "警告", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning"
}).then(function() { }).then(function () {
return exportFoodDemand(queryParams); return exportFoodDemand(queryParams);
}).then(response => { }).then(response => {
this.download(response.msg); this.download(response.msg);
}) })
} }
} }
}; };

View File

@ -1,39 +1,5 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="营养餐名称" prop="name">
<el-input
v-model="queryParams.name"
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="flag">
<el-input
v-model="queryParams.flag"
placeholder="请输入启用标志"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -45,28 +11,6 @@
>新增 >新增
</el-button> </el-button>
</el-col> </el-col>
<el-col :span="1.5">
<el-button
type="success"
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['fantang:nutritionFood:edit']"
>修改
</el-button>
</el-col>
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="danger"-->
<!-- icon="el-icon-delete"-->
<!-- size="mini"-->
<!-- :disabled="multiple"-->
<!-- @click="handleDelete"-->
<!-- v-hasPermi="['fantang:nutritionFood:remove']"-->
<!-- >删除</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<el-button <el-button
type="warning" type="warning"
icon="el-icon-download" icon="el-icon-download"
@ -75,17 +19,32 @@
v-hasPermi="['fantang:nutritionFood:export']" v-hasPermi="['fantang:nutritionFood: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-row>
<el-table v-loading="loading" :data="nutritionFoodList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="nutritionFoodList" @selection-change="handleSelectionChange" fit border>
<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="id" v-if="false"/> <el-table-column label="id" align="center" prop="id" v-if="false"/>
<el-table-column label="营养餐名称" align="center" prop="name"/> <el-table-column label="营养餐名称" align="center" prop="name" width="200px" fixed="left">
<el-table-column label="价格" align="center" prop="price"/> <template slot-scope="scope">
<el-table-column label="启用标志" align="center" prop="flag"/> <el-input v-model="scope.row.name"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> </template>
</el-table-column>
<el-table-column label="价格" align="center" prop="price" fixed="left" width="250px">
<template slot-scope="scope">
<el-input-number v-model="scope.row.price" :min="0" :precision="2"/>
</template>
</el-table-column>
<el-table-column label="启用标志" align="center" prop="flag" width="180px" fixed="left">
<template slot-scope="scope">
<el-switch
v-model="scope.row.flag"
active-text="启用"
inactive-text="禁用">
</el-switch>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="left" width="100px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
@ -93,16 +52,16 @@
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['fantang:nutritionFood:edit']" v-hasPermi="['fantang:nutritionFood:edit']"
>修改 >保存
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['fantang:nutritionFood:remove']"
>停用
</el-button> </el-button>
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-delete"-->
<!-- @click="handleDelete(scope.row)"-->
<!-- v-hasPermi="['fantang:nutritionFood:remove']"-->
<!-- >停用-->
<!-- </el-button>-->
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -117,16 +76,13 @@
<!-- 添加或修改病患营养配餐对话框 --> <!-- 添加或修改病患营养配餐对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <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 ref="form" :model="form" :rules="rules" label-width="120px">
<el-form-item label="营养餐名称" prop="name"> <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>
<el-form-item label="价格" prop="price"> <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>
<el-form-item label="启用标志" prop="flag">
<el-input v-model="form.flag" placeholder="请输入启用标志"/>
</el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
@ -141,7 +97,6 @@ import {
addNutritionFood, addNutritionFood,
deactivate, deactivate,
exportNutritionFood, exportNutritionFood,
getNutritionFood,
listNutritionFood, listNutritionFood,
updateNutritionFood updateNutritionFood
} from "@/api/fantang/nutritionFood"; } from "@/api/fantang/nutritionFood";
@ -223,12 +178,7 @@ export default {
}; };
this.resetForm("form"); this.resetForm("form");
}, },
/** 搜索按钮操作 */ /** 重置按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() { resetQuery() {
this.resetForm("queryForm"); this.resetForm("queryForm");
this.handleQuery(); this.handleQuery();
@ -247,13 +197,18 @@ export default {
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); console.log(row);
const id = row.id || this.ids updateNutritionFood(row).then(response => {
getNutritionFood(id).then(response => { this.msgSuccess("保存成功");
this.form = response.data; this.getList();
this.open = true; })
this.title = "修改病患营养配餐"; // this.reset();
}); // const id = row.id || this.ids
// getNutritionFood(id).then(response => {
// this.form = response.data;
// this.open = true;
// this.title = "";
// });
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {

View File

@ -333,6 +333,7 @@
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
row.foods = row.foods.toLocaleString(); row.foods = row.foods.toLocaleString();
console.log(row)
updateWeekMenu(row).then(response => { updateWeekMenu(row).then(response => {
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
row.foods = row.foods.split(',').map(Number); row.foods = row.foods.split(',').map(Number);