饭堂参数前端页面

This commit is contained in:
ryoeiken 2020-12-30 17:52:10 +08:00
parent 595adb7ae3
commit d3ac78138a
3 changed files with 264 additions and 1 deletions

View File

@ -0,0 +1,53 @@
import request from '@/utils/request'
// 查询饭堂参数列表
export function listFantangConfig(query) {
return request({
url: '/fantang/fantangConfig/list',
method: 'get',
params: query
})
}
// 查询饭堂参数详细
export function getFantangConfig(id) {
return request({
url: '/fantang/fantangConfig/' + id,
method: 'get'
})
}
// 新增饭堂参数
export function addFantangConfig(data) {
return request({
url: '/fantang/fantangConfig',
method: 'post',
data: data
})
}
// 修改饭堂参数
export function updateFantangConfig(data) {
return request({
url: '/fantang/fantangConfig',
method: 'put',
data: data
})
}
// 删除饭堂参数
export function delFantangConfig(id) {
return request({
url: '/fantang/fantangConfig/' + id,
method: 'delete'
})
}
// 导出饭堂参数
export function exportFantangConfig(query) {
return request({
url: '/fantang/fantangConfig/export',
method: 'get',
params: query
})
}

View File

@ -0,0 +1,210 @@
<template>
<div class="app-container">
<el-form :inline="true" :model="formInline" class="demo-form-inline">
<el-form-item label="最大补贴金额">
<el-input v-model="formInline.price" placeholder="请输入最大补贴金额"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">提交</el-button>
</el-form-item>
</el-form>
<el-form :inline="true" :model="dinnerForm">
<el-row>
<el-col>
<el-form-item label="早餐时间段">
<el-time-picker
is-range
v-model="dinnerForm.breakfast"
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间"
placeholder="选择时间范围">
</el-time-picker>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col>
<el-form-item label="午餐时间段">
<el-time-picker
is-range
v-model="dinnerForm.lunch"
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间"
placeholder="选择时间范围">
</el-time-picker>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col>
<el-form-item label="晚餐时间段">
<el-time-picker
is-range
v-model="dinnerForm.dinner"
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间"
placeholder="选择时间范围">
</el-time-picker>
</el-form-item>
</el-col>
</el-row>
<el-form-item>
<el-button type="primary" @click="submitDinnerForm">提交</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import {
addFantangConfig,
delFantangConfig,
exportFantangConfig,
getFantangConfig,
listFantangConfig,
updateFantangConfig
} from "@/api/fantang/fantangConfig";
export default {
name: "FantangConfig",
components: {},
data() {
return {
formInline: {
price: null,
},
dinnerForm: {
breakfast: null,
lunch: null,
dinner: null,
},
};
},
created() {
this.getList();
},
methods: {
/** 查询饭堂参数列表 */
getList() {
this.loading = true;
listFantangConfig(this.queryParams).then(response => {
this.fantangConfigList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: undefined,
corpId: undefined,
configKey: undefined,
configValue: undefined,
flag: undefined
};
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
getFantangConfig(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改饭堂参数";
});
},
//
submitDinnerForm(){
console.log(this.dinnerForm)
},
//
onSubmit(){
console.log(this.formInline)
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateFantangConfig(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addFantangConfig(this.form).then(response => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm('是否确认删除饭堂参数编号为"' + ids + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function () {
return delFantangConfig(ids);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
})
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有饭堂参数数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function () {
return exportFantangConfig(queryParams);
}).then(response => {
this.download(response.msg);
})
}
}
};
</script>

View File

@ -202,7 +202,7 @@ export default {
this.syncConflictList = response.rows;
this.loading = false;
});
this.timer = setInterval(this.getNewMsg, 5000);
this.timer = setInterval(this.getNewMsg, 1000 * 60 * 5);
},
beforeDestroy() {
clearInterval(this.timer);