提交 b29fb79c authored 作者: huang's avatar huang

规则模块页面开发

上级 31ee22bb
import request from '@/utils/request'
//获取扣费方案
export function getDeductionList() {
return request({
url: '/deductionPlan/getDeductionList',
method: 'get',
})
}
//根据id获取扣费方案
export function getDeductionById(id) {
return request({
url: '/deductionPlan/getDeductionById/'+id,
method: 'get',
})
}
//更新获取扣费方案
export function updateDeduction(data) {
return request({
url: '/deductionPlan/updateDeduction',
method: 'put',
data:data
})
}
import request from '@/utils/request'
//获取食用时间
export function getEatTime() {
return request({
url: '/globalSetting/getEatTime',
method: 'get',
})
}
//保存食用时间
export function saveEatTime(data) {
return request({
url: '/globalSetting/saveEatTime',
method: 'put',
data:data
})
}
import request from '@/utils/request'
//获取食用时间
export function getPrepTime() {
return request({
url: '/globalSetting/getPrepTime',
method: 'get',
})
}
//保存食用时间
export function savePrepTime(data) {
return request({
url: '/globalSetting/savePrepTime',
method: 'put',
data:data
})
}
import request from '@/utils/request' import request from '@/utils/request'
//获取用允许餐时段和允许自动报餐时段
export function getRecipeRule() {
return request({
url: '/recipeRule/getRecipeRule',
method: 'get',
})
}
//更新用允许餐时段和允许自动报餐时段
export function updateRecipeRule(data) {
return request({
url: '/recipeRule/updateRecipeRule',
method: 'put',
data: data
})
}
<template> <template>
<div>666</div> <div class="app-container">
<!--操作按钮组-->
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="success" icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate" v-hasPermi="['system:user:edit']" >修改</el-button>
</el-col>
</el-row>
<!--列表-->
<el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="40" align="center" :show-overflow-tooltip="true"/>
<el-table-column label="部门" align="center" prop="planName" :show-overflow-tooltip="true" />
<el-table-column label="早餐基本餐" align="center" prop="breakfastBasePrice" :show-overflow-tooltip="true" />
<el-table-column label="早餐客餐" align="center" prop="breakfastFormalPrice" :show-overflow-tooltip="true" />
<el-table-column label="午餐基本餐" align="center" prop="lunchBasePrice" :show-overflow-tooltip="true" />
<el-table-column label="午餐客餐" align="center" prop="lunchFormalPrice" :show-overflow-tooltip="true" />
<el-table-column label="晚餐基本餐" align="center" prop="supperBasePrice" :show-overflow-tooltip="true" />
<el-table-column label="晚餐客餐" align="center" prop="supperFormalPrice" :show-overflow-tooltip="true" />
</el-table>
<!--分页按钮组-->
<pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList"/>
<!-- 添加或修改公告通知对话框 -->
<el-dialog :title="title" :visible.sync="open" width="400px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row>
<el-col :span="24" >
<el-form-item label="早餐基本餐">
<el-input v-model="form.breakfastBasePrice" type="number" :step="0.1" :min="0" prefix-icon="el-icon-money"></el-input>
</el-form-item>
<el-form-item label="早餐客餐">
<el-input v-model="form.breakfastFormalPrice" type="number" :step="0.1" :min="0" prefix-icon="el-icon-money"></el-input>
</el-form-item>
<el-form-item label="午餐基本餐">
<el-input v-model="form.lunchBasePrice" type="number" :step="0.1" :min="0" prefix-icon="el-icon-money"></el-input>
</el-form-item>
<el-form-item label="午餐客餐">
<el-input v-model="form.lunchFormalPrice" type="number" :step="0.1" :min="0" prefix-icon="el-icon-money"></el-input>
</el-form-item>
<el-form-item label="晚餐基本餐">
<el-input v-model="form.supperBasePrice" type="number" :step="0.1" :min="0" prefix-icon="el-icon-money"></el-input>
</el-form-item>
<el-form-item label="晚餐客餐">
<el-input v-model="form.supperFormalPrice" type="number" :step="0.1" :min="0" prefix-icon="el-icon-money"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<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> </template>
<script> <script>
import {getDeductionList,getDeductionById,updateDeduction} from "@/api/rule/deduction";
export default {
//页签缓存页面的name要和路由中的那么要相同,才能缓存,
//如果是自定义菜单,则页面的name和菜单管理中路由地址要相同,才能页签缓存
name: "deduction",
data() {
return {
// 遮罩层
loading: true,
ids: [],// 选中数组
single: true, // 非单个禁用
multiple: true, // 非多个禁用
total: 0, // 总条数
list: [],// 部门扣费方案列表
title: "", // 弹出层标题
open: false,// 是否显示弹出层
queryParams: { // 查询参数
pageNum: 1,
pageSize: 10
},
form: {}, // 表单参数
rules: {// 表单校验
breakfastBasePrice: [
{ required: true, message: "早餐基本餐不能为空", trigger: "blur" ,type:"number"}
],
breakfastFormalPrice: [
{ required: true, message: "早餐客餐不能为空", trigger: "blur" ,type:"number"}
],
lunchBasePrice: [
{ required: true, message: "午餐基本餐不能为空", trigger: "blur" ,type:"number"}
],
lunchFormalPrice: [
{ required: true, message: "午餐客餐不能为空", trigger: "blur" ,type:"number"}
],
supperBasePrice: [
{ required: true, message: "晚餐基本餐不能为空", trigger: "blur" ,type:"number" }
],
supperFormalPrice: [
{ required: true, message: "晚餐客餐不能为空", trigger: "blur" ,type:"number"}
],
}
};
},
created() {
this.getList();
},
methods: {
/** 获取部门扣费方案 */
getList() {
this.loading = true;
getDeductionList(this.queryParams).then(response=>{
this.list = response.rows
this.total=response.total
this.loading = false
})
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: undefined
};
this.resetForm("form");
},
//多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!=1
this.multiple = !selection.length
},
/** 修改按钮操作 */
handleUpdate(row) {
//清空表单
this.reset();
const deptId = row.deptId || this.ids[0]
getDeductionById(deptId).then(response => {
this.form = response.data;
this.open = true;
this.title = this.form.planName;
});
},
/** 提交按钮 */
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != undefined) {
updateDeduction(this.form).then(response => {
if (response.code === 200) {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
} else {
this.msgError("修改失败:"+response.msg);
}
});
}
}
});
},
}
};
</script> </script>
<style scoped> <style scoped>
......
<template> <template>
<div>666</div> <div class="app-container">
<!--操作按钮组-->
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="success" icon="el-icon-edit" size="mini" @click="handleSave" v-hasPermi="['system:user:edit']" >保存</el-button>
</el-col>
</el-row>
<!--早餐用餐时间-->
<div class="margin-bottom">
<span>早餐用餐时间:</span>
<el-time-select placeholder="起始时间" v-model="bfStartTime" :picker-options="{ start: '06:00', step: '00:10', end: '22:00' }">
</el-time-select>
<el-time-select placeholder="结束时间" v-model="bfEndTime"
:picker-options="{ start: '06:00', step: '00:10', end: '22:00', minTime: bfStartTime }">
</el-time-select>
</div>
<!--午餐用餐时间-->
<div class="margin-bottom">
<span>午餐用餐时间:</span>
<el-time-select placeholder="起始时间" v-model="lunchStartTime" :picker-options="{ start: '06:00', step: '00:10', end: '22:00', minTime: bfEndTime }">
</el-time-select>
<el-time-select placeholder="结束时间" v-model="lunchEndTime" :picker-options="{ start: '06:00', step: '00:10', end: '22:00', minTime: lunchStartTime }">
</el-time-select>
</div>
<!--晚餐用餐时间-->
<div>
<span>晚餐用餐时间:</span>
<el-time-select placeholder="起始时间" v-model="supperStartTime" :picker-options="{ start: '06:00', step: '00:10', end: '22:00', minTime: lunchEndTime }">
</el-time-select>
<el-time-select placeholder="结束时间" v-model="supperEndTime" :picker-options="{ start: '06:00', step: '00:10', end: '22:00', minTime: supperStartTime }">
</el-time-select>
</div>
</div>
</template> </template>
<script> <script>
import {getEatTime,saveEatTime} from "@/api/rule/eattingTime";
export default {
created(){
getEatTime().then(response=>{
if (response.data.id) this.id = response.data.id
//如果设置过食用时间
if (response.code === 200&&response.data.eatBfStartTime) {
this.id = response.data.id
this.bfStartTime=response.data.eatBfStartTime
this.bfEndTime=response.data.eatBfEndTime
this.lunchStartTime=response.data.eatLunchStartTime
this.lunchEndTime=response.data.eatLunchEndTime
this.supperStartTime=response.data.eatSupperStartTime
this.supperEndTime=response.data.eatSupperEndTime
}else if(response.code === 200){
this.msgInfo("尚未设置食用时间,确保功能正常,请先设置!")
}else{
this.msgError("获取使用时间失败"+response.msg)
}
})
},
data() {
return {
id:null,
bfStartTime: '',
bfEndTime: '',
lunchStartTime:'',
lunchEndTime:'',
supperStartTime:'',
supperEndTime:''
};
},
methods:{
handleSave(){
let data = {
id:this.id,
eatBfStartTime:this.bfStartTime,
eatBfEndTime:this.bfEndTime,
eatLunchStartTime:this.lunchStartTime,
eatLunchEndTime:this.lunchEndTime,
eatSupperStartTime:this.supperStartTime,
eatSupperEndTime:this.supperEndTime
}
saveEatTime(data).then(response=>{
this.msgSuccess("保存成功")
})
}
}
}
</script> </script>
<style scoped> <style scoped>
.margin-bottom{
margin-bottom: 50px;
}
</style> </style>
<template> <template>
<div>666</div> <div class="app-container">
<!--操作按钮组-->
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="success" icon="el-icon-edit" size="mini" @click="handleSave" v-hasPermi="['system:user:edit']" >保存</el-button>
</el-col>
</el-row>
<!--早餐备餐时间-->
<div class="margin-bottom">
<span>早餐备餐时间:</span>
<el-select v-model="prepBfPrefix" placeholder="请选择" style="width: 120px">
<el-option label="前一天" value="前一天"> </el-option>
<el-option label="当天" value="当天"> </el-option>
</el-select>
<el-time-select placeholder="起始时间" v-model="prepBfStartTime" :picker-options="{ start: '06:00', step: '00:10', end: '22:00' }"></el-time-select>
<span>~当天</span>
<el-time-select placeholder="结束时间" v-model="prepBfEndTime" :picker-options="{ start: '06:00', step: '00:10', end: '22:00', minTime: prepBfStartTime }"></el-time-select>
</div>
<!--午餐备餐时间-->
<div class="margin-bottom">
<span>午餐备餐时间:</span>
<el-select v-model="prepLunchPrefix" placeholder="请选择" style="width: 120px">
<el-option label="前一天" value="前一天"> </el-option>
<el-option label="当天" value="当天"> </el-option>
</el-select>
<el-time-select placeholder="起始时间" v-model="prepLunchStartTime" :picker-options="{ start: '06:00', step: '00:10', end: '22:00', minTime: prepBfEndTime }"></el-time-select>
<span>~当天</span>
<el-time-select placeholder="结束时间" v-model="prepLunchEndTime" :picker-options="{ start: '06:00', step: '00:10', end: '22:00', minTime: prepLunchStartTime }"></el-time-select>
</div>
<!--晚餐备餐时间-->
<div>
<span>晚餐备餐时间:</span>
<el-select v-model="prepSupperPrefix" placeholder="请选择" style="width: 120px">
<el-option label="前一天" value="前一天"> </el-option>
<el-option label="当天" value="当天"> </el-option>
</el-select>
<el-time-select placeholder="起始时间" v-model="prepSupperStartTime" :picker-options="{ start: '06:00', step: '00:10', end: '22:00', minTime: prepLunchEndTime }"></el-time-select>
<span>~当天</span>
<el-time-select placeholder="结束时间" v-model="prepSupperEndTime" :picker-options="{ start: '06:00', step: '00:10', end: '22:00', minTime: prepSupperStartTime }"></el-time-select>
</div>
</div>
</template> </template>
<script> <script>
import {getPrepTime,savePrepTime} from "@/api/rule/prepTime";
export default {
created(){
getPrepTime().then(response=>{
if (response.data.id) this.id = response.data.id
//如果设置过备餐时间
if (response.code === 200&&response.data.prepBfPrefix) {
this.options
this.prepBfPrefix=response.data.prepBfPrefix
this.prepBfStartTime=response.data.prepBfStartTime
this.prepBfEndTime=response.data.prepBfEndTime
this.prepLunchPrefix=response.data.prepLunchPrefix
this.prepLunchStartTime=response.data.prepLunchStartTime
this.prepLunchEndTime=response.data.prepLunchEndTime
this.prepSupperPrefix=response.data.prepSupperPrefix
this.prepSupperStartTime=response.data.prepSupperStartTime
this.prepSupperEndTime=response.data.prepSupperEndTime
}else if(response.code === 200){
this.msgInfo("尚未设置备餐时间,确保功能正常,请先设置!")
}else{
this.msgError("获取使用时间失败"+response.msg)
}
})
},
data() {
return {
id:null,
prepBfPrefix: '',
prepBfStartTime: '',
prepBfEndTime:'',
prepLunchPrefix:'',
prepLunchStartTime:'',
prepLunchEndTime:'',
prepSupperPrefix:'',
prepSupperStartTime:'',
prepSupperEndTime:'',
options: [{
value: '前一天',
label: '前一天'
}, {
value: '当天',
label: '当天'
}]
};
},
methods:{
handleSave(){
let data = {
id:this.id,
prepBfPrefix:this.prepBfPrefix,
prepBfStartTime:this.prepBfStartTime,
prepBfEndTime:this.prepBfEndTime,
prepLunchPrefix:this.prepLunchPrefix,
prepLunchStartTime:this.prepLunchStartTime,
prepLunchEndTime:this.prepLunchEndTime,
prepSupperPrefix:this.prepSupperPrefix,
prepSupperStartTime:this.prepSupperStartTime,
prepSupperEndTime:this.prepSupperEndTime
}
savePrepTime(data).then(response=>{
this.msgSuccess("保存成功")
})
}
}
}
</script> </script>
<style scoped> <style scoped>
.margin-bottom{
margin-bottom: 50px;
}
</style> </style>
<template> <template>
<div class="app-container"> <div class="app-container">
<div style="margin-left: 35%;margin-top: 5%"> <div style="margin-left: 35%;margin-top: 5%">
<el-checkbox :indeterminate="isIndeterminate" v-model="selectAllEatPeriod" @change="handleSelectAllEatPeriod">允许用餐时段</el-checkbox> <el-checkbox :indeterminate="isIndeterminate" v-model="selectAllEatPeriod" @change="handleSelectAllEatPeriod">全选:允许用餐时段</el-checkbox>
<div style="margin: 15px 0;"></div> <div style="margin: 15px 0;"></div>
<el-checkbox-group v-model="currentEatPeriod" @change="handleEatPeriodChange"> <el-checkbox-group v-model="currentEatPeriod" @change="handleEatPeriodChange">
<el-checkbox v-for="item in eatPeriodList" :label="item" :key="item">{{item}}</el-checkbox> <el-checkbox v-for="item in eatPeriodList" :label="item" :key="item">{{item}}</el-checkbox>
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
</div> </div>
<div style="margin-left: 35%;margin-top: 10%"> <div style="margin-left: 35%;margin-top: 10%">
<el-checkbox :indeterminate="isIndeterminate2" v-model="selectAllAutoPeriod" @change="handleSelectAllAutoPeriod">允许用餐时段</el-checkbox> <el-checkbox :indeterminate="isIndeterminate2" v-model="selectAllAutoPeriod" @change="handleSelectAllAutoPeriod">全选:允许自动报餐时段</el-checkbox>
<div style="margin: 15px 0;"></div> <div style="margin: 15px 0;"></div>
<el-checkbox-group v-model="currentAutoPeriod" @change="handleAutoPeriodChange"> <el-checkbox-group v-model="currentAutoPeriod" @change="handleAutoPeriodChange">
<el-checkbox v-for="item in autoPeriodList" :label="item" :key="item">{{item}}</el-checkbox> <el-checkbox v-for="item in autoPeriodList" :label="item" :key="item">{{item}}</el-checkbox>
...@@ -18,17 +18,42 @@ ...@@ -18,17 +18,42 @@
</div> </div>
</template> </template>
<script> <script>
import {getRecipeRule,updateRecipeRule} from "@/api/rule/recipeRule";
export default { export default {
created(){
getRecipeRule().then(response=>{
if(response.code===200){
this.currentEatPeriod= response.data.eatRule;
this.currentAutoPeriod= response.data.autoRule;
this.id=response.data.id;
//如果是全选则给全选按钮打勾
if(response.data.autoRule.length===this.currentEatPeriod.length){
this.selectAllEatPeriod=true;
this.isIndeterminate=false
}
//如果是全选则给全选按钮打勾
if(response.data.eatRule.length===this.currentAutoPeriod.length){
this.selectAllAutoPeriod=true;
this.isIndeterminate2=false
}
}else{
this.msgError("getRecipeRule failure:"+response.msg)
}
})
},
data() { data() {
return { return {
id:null,
selectAllEatPeriod: false, //全选允许用餐时段 selectAllEatPeriod: false, //全选允许用餐时段
currentEatPeriod: ['早餐', '晚餐'], currentEatPeriod: [],
eatPeriodList: ['早餐', '午餐', '晚餐'], eatPeriodList: ['早餐', '午餐', '晚餐'],
//只负责样式控制 //只负责样式控制
isIndeterminate: true, isIndeterminate: true,
selectAllAutoPeriod:false, //全选允许自动报餐时段勾号 selectAllAutoPeriod:false, //全选允许自动报餐时段勾号
currentAutoPeriod:['晚餐'], currentAutoPeriod:[],
autoPeriodList: ['早餐', '午餐', '晚餐'], autoPeriodList: ['早餐', '午餐', '晚餐'],
//只负责样式控制 //只负责样式控制
isIndeterminate2: true, isIndeterminate2: true,
...@@ -37,13 +62,18 @@ ...@@ -37,13 +62,18 @@
}, },
methods: { methods: {
/** /**
* 点击全选 * 允许用餐时段点击全选
* @param flag 全选时为true * @param flag 全选时为true
*/ */
handleSelectAllEatPeriod(flag) { handleSelectAllEatPeriod(flag) {
this.currentEatPeriod = flag ? this.eatPeriodList : []; this.currentEatPeriod = flag ? this.eatPeriodList : [];
this.isIndeterminate = false; this.isIndeterminate = false;
this.handleUpdateRecipeRule()
}, },
/**
* 选择用餐时段时段
* @param value
*/
handleEatPeriodChange(value) { handleEatPeriodChange(value) {
//当前选中的个数 //当前选中的个数
let checkedCount = value.length; let checkedCount = value.length;
...@@ -51,10 +81,36 @@ ...@@ -51,10 +81,36 @@
this.selectAllEatPeriod = checkedCount === this.eatPeriodList.length; this.selectAllEatPeriod = checkedCount === this.eatPeriodList.length;
//只选择了一部分 //只选择了一部分
this.isIndeterminate = checkedCount > 0 && checkedCount < this.eatPeriodList.length; this.isIndeterminate = checkedCount > 0 && checkedCount < this.eatPeriodList.length;
this.handleUpdateRecipeRule()
}, },
/**
* 全选允许自动报餐时段
* @param flag
*/
handleSelectAllAutoPeriod(flag){ handleSelectAllAutoPeriod(flag){
this.selectAllAutoPeriod = flag ? this.autoPeriodList : []; this.currentAutoPeriod = flag ? this.autoPeriodList : [];
this.isIndeterminate2 = false; this.isIndeterminate2 = false;
this.handleUpdateRecipeRule()
},
/**
* 选择自动报餐时段
*/
handleAutoPeriodChange(value){
//当前选中的个数
let checkedCount = value.length;
//如果选中的个数等于总数,则设为true
this.selectAllAutoPeriod = checkedCount === this.autoPeriodList.length;
//只选择了一部分
this.isIndeterminate2 = checkedCount > 0 && checkedCount < this.autoPeriodList.length;
this.handleUpdateRecipeRule()
},
handleUpdateRecipeRule(){
let data={
id:this.id,
eatArr:this.currentEatPeriod,
autoArr:this.currentAutoPeriod
}
updateRecipeRule(data)
} }
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论