<template>
|
<div class="app-container">
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
<el-form-item label="配餐名称" prop="cateringName">
|
<el-input v-model="queryParams.cateringName" placeholder="请输入配餐名称" clearable
|
@keyup.enter.native="handleQuery" />
|
</el-form-item>
|
<el-form-item label="最低价格" prop="priceLg">
|
<el-input v-model="queryParams.priceLg" placeholder="请输入最低价格" clearable @keyup.enter.native="handleQuery" />
|
</el-form-item>
|
<el-form-item label="最高价格" prop="priceGt">
|
<el-input v-model="queryParams.priceGt" placeholder="请输入最高价格" clearable @keyup.enter.native="handleQuery" />
|
</el-form-item>
|
|
<el-form-item>
|
<el-button type="primary" 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-col :span="1.5">
|
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd"
|
v-hasPermi="['catering:catering:add']">新增
|
</el-button>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button type="primary" icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
|
v-hasPermi="['catering:catering:edit']">修改
|
</el-button>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button type="primary" icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
|
v-hasPermi="['catering:catering:remove']">删除
|
</el-button>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button type="primary" icon="el-icon-download" size="mini" @click="handleExport"
|
v-hasPermi="['catering:catering:export']">导出
|
</el-button>
|
</el-col>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
</el-row>
|
|
<el-table v-loading="loading" :data="cateringList" @selection-change="handleSelectionChange" border>
|
<el-table-column type="selection" width="55" align="center" />
|
<!-- <el-table-column label="${comment}" align="center" prop="id"/> -->
|
<el-table-column label="序号" align="center" prop="newID" width="55px" />
|
<el-table-column label="配餐名称" align="center" prop="cateringName" />
|
<el-table-column label="营养描述" align="center" prop="nutritionDescription" />
|
<el-table-column label="配餐详细" align="center" prop="nutritionDescription" />
|
<el-table-column label="营养说明" align="center" prop="nutritionDescription" />
|
<el-table-column label="最高价格" align="center" prop="priceGt" width="150px" />
|
<el-table-column label="最低价格" align="center" prop="priceLg" width="150px" />
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="80px">
|
<template slot-scope="scope">
|
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
v-hasPermi="['catering:catering:edit']" title="修改">
|
</el-button>
|
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete1(scope.row)"
|
v-hasPermi="['catering:catering:remove']" title="删除">
|
</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
|
<div class="pag">
|
<div class="pag1">
|
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
|
:limit.sync="queryParams.pageSize" @pagination="getList" />
|
</div>
|
</div>
|
|
|
<!-- 添加或修改体检配餐 对话框 -->
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
<el-form-item label="配餐名称" prop="cateringName">
|
<el-input v-model="form.cateringName" placeholder="请输入配餐名称" />
|
</el-form-item>
|
<el-form-item label="营养描述" prop="nutritionDescription">
|
<el-input v-model="form.nutritionDescription" placeholder="请输入营养描述" />
|
</el-form-item>
|
<el-form-item label="价格最大值" prop="priceGt">
|
<el-input v-model="form.priceGt" placeholder="请输入价格最大值" />
|
</el-form-item>
|
<el-form-item label="价格最小值" prop="priceLg">
|
<el-input v-model="form.priceLg" placeholder="请输入价格最小值" />
|
</el-form-item>
|
</el-form>
|
<el-button style="margin-left: 40px" type="primary" plain size="mini" icon="el-icon-plus">新增行</el-button>
|
|
<table style="
|
width: 96%;
|
margin: 10px 10px;
|
border: 1px solid #dfe6ec;
|
border-collapse: collapse;
|
" cellspacing="4">
|
<tr style="border: 1px solid #dfe6ec; border-collapse: collapse;margin-left:10px">
|
<td style="border: 1px solid #dfe6ec; border-collapse: collapse">
|
序号
|
</td>
|
<td style="border: 1px solid #dfe6ec; border-collapse: collapse">
|
项目名称
|
</td>
|
<td style="border: 1px solid #dfe6ec; border-collapse: collapse">
|
价格(元)
|
</td>
|
<td style="border: 1px solid #dfe6ec; border-collapse: collapse">操作</td>
|
</tr>
|
<tr style="border: 1px solid #dfe6ec; border-collapse: collapse">
|
<td style="border: 1px solid #dfe6ec; border-collapse: collapse">1
|
</td>
|
<td style="border: 1px solid #dfe6ec; border-collapse: collapse">
|
<el-select v-model="ss" placeholder="请选择项目名称">
|
<el-option label="小米粥" value="shanghai"></el-option>
|
<el-option label="八宝粥" value="beijing"></el-option>
|
<el-option label="鸡蛋" value="beijing"></el-option>
|
<el-option label="牛奶" value="beijing"></el-option>
|
<el-option label="面包" value="beijing"></el-option>
|
<el-option label="杂粮" value="beijing"></el-option>
|
<el-option label="馒头" value="beijing"></el-option>
|
<el-option label="营养小菜" value="beijing"></el-option>
|
</el-select>
|
</td>
|
<td style="border: 1px solid #dfe6ec; border-collapse: collapse">10</td>
|
<td style="border: 1px solid #dfe6ec; border-collapse: collapse">
|
<!-- <el-button size="mini" type="text" icon="el-icon-edit" title="修改" @click="handleUpdate(scope.row)"
|
v-hasPermi="['template:template:edit']">
|
</el-button> -->
|
<el-button size="mini" type="text" title="删除" icon="el-icon-delete" @click="handleDelete2(scope.row)"
|
v-hasPermi="['template:template:remove']">
|
</el-button>
|
</td>
|
</tr>
|
<tr style="border: 1px solid #dfe6ec; border-collapse: collapse">
|
<td style="border: 1px solid #dfe6ec; border-collapse: collapse">2
|
</td>
|
<td style="border: 1px solid #dfe6ec; border-collapse: collapse">
|
<el-select v-model="ss1" placeholder="请选择项目名称">
|
<el-option label="小米粥" value="shanghai"></el-option>
|
<el-option label="八宝粥" value="beijing"></el-option>
|
<el-option label="鸡蛋" value="beijing"></el-option>
|
<el-option label="牛奶" value="beijing"></el-option>
|
<el-option label="面包" value="beijing"></el-option>
|
<el-option label="杂粮" value="beijing"></el-option>
|
<el-option label="馒头" value="beijing"></el-option>
|
<el-option label="营养小菜" value="beijing"></el-option>
|
</el-select>
|
</td>
|
<td style="border: 1px solid #dfe6ec; border-collapse: collapse">10</td>
|
<td style="border: 1px solid #dfe6ec; border-collapse: collapse">
|
<!-- <el-button size="mini" type="text" icon="el-icon-edit" title="修改" @click="handleUpdate(scope.row)"
|
v-hasPermi="['template:template:edit']">
|
</el-button> -->
|
<el-button size="mini" type="text" title="删除" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
v-hasPermi="['template:template:remove']">
|
</el-button>
|
</td>
|
</tr>
|
</table>
|
<div slot="footer" class="dialog-footer">
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
<el-button @click="cancel">取 消</el-button>
|
</div>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import {
|
listCatering,
|
getCatering,
|
delCatering,
|
addCatering,
|
updateCatering
|
} from "@/api/catering/catering";
|
|
export default {
|
name: "Catering",
|
data() {
|
return {
|
ss: "小米粥",
|
ss1: "鸡蛋",
|
// 遮罩层
|
loading: true,
|
// 选中数组
|
ids: [],
|
// 非单个禁用
|
single: true,
|
// 非多个禁用
|
multiple: true,
|
// 显示搜索条件
|
showSearch: true,
|
// 总条数
|
total: 0,
|
// 体检配餐
|
//表格数据
|
cateringList: [],
|
// 弹出层标题
|
title: "",
|
// 是否显示弹出层
|
open: false,
|
// 查询参数
|
queryParams: {
|
pageNum: 1,
|
pageSize: 10,
|
cateringName: null,
|
priceGt: null,
|
priceLg: null,
|
},
|
// 表单参数
|
form: {},
|
// 表单校验
|
rules: {
|
cateringName: [
|
{
|
required: true, message: "配餐名称不能为空", trigger: "blur"
|
}
|
],
|
priceGt: [
|
{
|
required: true, message: "价格最大值不能为空", trigger: "blur"
|
}
|
],
|
priceLg: [
|
{
|
required: true, message: "价格最小值不能为空", trigger: "blur"
|
}
|
],
|
}
|
};
|
},
|
created() {
|
this.getList();
|
},
|
methods: {
|
/** 查询体检配餐列表 */
|
getList() {
|
this.loading = true;
|
listCatering(this.queryParams).then(response => {
|
this.cateringList = response.rows;
|
response.rows.forEach((item, index) => {
|
item.newID = (this.queryParams.pageNum - 1) * this.queryParams.pageSize + index + 1
|
});
|
this.total = response.total;
|
this.loading = false;
|
});
|
},
|
// 取消按钮
|
cancel() {
|
this.open = false;
|
this.reset();
|
},
|
// 表单重置
|
reset() {
|
this.form = {
|
id: null,
|
cateringName: null,
|
cateringInfo: null,
|
nutritionDescription: null,
|
priceGt: null,
|
priceLg: null,
|
createBy: null,
|
createTime: null,
|
updateBy: null,
|
updateTime: null,
|
deleted: null
|
};
|
this.resetForm("form");
|
},
|
/** 搜索按钮操作 */
|
handleQuery() {
|
this.queryParams.pageNum = 1;
|
this.getList();
|
},
|
/** 重置按钮操作 */
|
resetQuery() {
|
this.resetForm("queryForm");
|
this.handleQuery();
|
},
|
// 多选框选中数据
|
handleSelectionChange(selection) {
|
this.ids = selection.map(item => item.id)
|
this.single = selection.length !== 1
|
this.multiple = !selection.length
|
},
|
/** 新增按钮操作 */
|
handleAdd() {
|
this.reset();
|
this.open = true;
|
this.title = "添加体检配餐";
|
},
|
/** 修改按钮操作 */
|
handleUpdate(row) {
|
this.reset();
|
const id = row.id || this.ids
|
getCatering(id).then(response => {
|
this.form = response.data;
|
this.open = true;
|
this.title = "修改体检配餐";
|
});
|
},
|
|
/** 提交按钮 */
|
submitForm() {
|
this.$refs["form"].validate(valid => {
|
if (valid) {
|
if (this.form.id != null) {
|
updateCatering(this.form).then(response => {
|
this.$modal.msgSuccess("修改成功");
|
this.open = false;
|
this.getList();
|
});
|
} else {
|
addCatering(this.form).then(response => {
|
this.$modal.msgSuccess("新增成功");
|
this.open = false;
|
this.getList();
|
});
|
}
|
}
|
});
|
},
|
/** 删除按钮操作 */
|
handleDelete1(row) {
|
const reIds = row.id
|
this.$modal.confirm('是否确认删除编号为"' + reIds + '"的数据项?').then(function () {
|
return delCatering(reIds);
|
}).then(() => {
|
this.getList();
|
this.$modal.msgSuccess("删除成功");
|
}).catch(() => { });
|
},
|
/** 删除按钮操作 */
|
handleDelete() {
|
const reIds = this.ids;
|
this.$modal.confirm('是否确认删除编号为"' + reIds + '"的数据项?').then(function () {
|
return delCatering(reIds);
|
}).then(() => {
|
this.getList();
|
this.$modal.msgSuccess("删除成功");
|
}).catch(() => { });
|
},
|
/** 复选框选中数据 */
|
handleDmKsSelectionChange(selection) {
|
this.checkedDmKs = selection.map(item => item.index)
|
},
|
/** 导出按钮操作 */
|
handleExport() {
|
this.download('${moduleName}/${businessName}/export', {
|
...this.queryParams
|
}, `${businessName}_#[[${new Date().getTime()}.xlsx`)
|
}
|
}
|
}
|
;
|
</script>
|
<style scoped>
|
.pag {
|
width: 100%;
|
display: flex;
|
justify-content: center;
|
}
|
|
.pag1 {
|
width: 30%;
|
}
|
</style>
|