bonus-ui/src/views/base/stall/index.vue

323 lines
12 KiB
Vue
Raw Normal View History

2025-03-05 14:52:18 +08:00
<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="areaNameStr">
<el-cascader
v-model="queryParams.areaNameStr" :show-all-levels="false" :filterable="true"
:options="treeOptions" :props="treeProps" collapse-tags
@change="handleTreeChange"></el-cascader>
</el-form-item>
<el-form-item label="食堂名称" prop="canteenName">
<el-input
v-model="queryParams.canteenName"
placeholder="请输入食堂名称"
clearable
style="width: 240px"
@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"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
>新增</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="tableListData" height="800">
<el-table-column label="食堂编号" align="center" prop="canteenNum" :show-overflow-tooltip="true" width="100" fixed="left"/>
<el-table-column label="食堂名称" align="center" prop="canteenName" :show-overflow-tooltip="true" width="150" fixed="left"/>
<el-table-column label="所属区域" align="center" prop="areaNameStr" :show-overflow-tooltip="true" width="180"/>
<el-table-column label="负责人" align="center" prop="custName" :show-overflow-tooltip="true" width="80"/>
<el-table-column label="联系电话" align="center" prop="contactTel" :show-overflow-tooltip="true" width="100"/>
<el-table-column label="食堂标签" align="center" prop="labelNameStr" :show-overflow-tooltip="true" width="80"/>
<el-table-column label="食堂状态" align="center" prop="businessState" :show-overflow-tooltip="true" width="80">
<template slot-scope="scope">
<span v-if="scope.row.businessState==1">休息</span>
<span v-if="scope.row.businessState==2">营业</span>
</template>
</el-table-column>
<el-table-column label="主营项目" align="center" prop="mainProject" :show-overflow-tooltip="true" width="80"/>
<el-table-column label="营业时间" align="center" prop="startBusinessTime" :show-overflow-tooltip="true" width="180">
<template slot-scope="scope">
{{ scope.row.startBusinessTime }}-{{ scope.row.endBusinessTime }}
</template>
</el-table-column>
<el-table-column label="预订餐" align="center" prop="ifReserve" :show-overflow-tooltip="true" width="140">
<template slot-scope="scope">
<el-switch
v-model="scope.row.ifReserve"
active-text="开启"
inactive-text="关闭"
:active-value="1"
:inactive-value="2"
>
</el-switch>
</template>
</el-table-column>
<el-table-column label="报餐" align="center" prop="ifBook" :show-overflow-tooltip="true" width="140">
<template slot-scope="scope">
<el-switch
v-model="scope.row.ifBook"
active-text="开启"
inactive-text="关闭"
:active-value="1"
:inactive-value="2"
>
</el-switch>
</template>
</el-table-column>
<el-table-column label="最大容纳人数" align="center" prop="capacity" :show-overflow-tooltip="true" width="100"/>
<el-table-column label="客流统计" align="center" prop="" :show-overflow-tooltip="true" width="80">
<template slot-scope="scope">
<span style="color: #4b80fd;">详情</span>
</template>
</el-table-column>
<el-table-column label="区域人数统计" align="center" prop="" :show-overflow-tooltip="true" width="80">
<template slot-scope="scope">
<span style="color: #4b80fd;">详情</span>
</template>
</el-table-column>
<el-table-column label="食堂图片" align="center" prop="imgUrl" :show-overflow-tooltip="true" width="100">
<template slot-scope="scope">
<img :src="scope.row.imgUrl" alt="" style="width: 80px;height: 40px;">
</template>
</el-table-column>
<el-table-column label="支付设置" align="center" prop="canteenName" :show-overflow-tooltip="true" width="80">
<template slot-scope="scope">
<span style="color: #4b80fd;">详情</span>
</template>
</el-table-column>
<el-table-column label="配送设置" align="center" prop="canteenName" :show-overflow-tooltip="true" width="80">
<template slot-scope="scope">
<span style="color: #4b80fd;">详情</span>
</template>
</el-table-column>
<el-table-column label="预订/点餐/报餐设置" align="center" prop="" :show-overflow-tooltip="true" width="140">
<template slot-scope="scope">
<span style="color: #4b80fd;">详情</span>
</template>
</el-table-column>
<el-table-column label="收款码" align="center" prop="payCodeUrl" :show-overflow-tooltip="true" width="80">
<template slot-scope="scope">
<span>未开启</span>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="crtime" :show-overflow-tooltip="true" width="160"/>
<el-table-column label="更新时间" align="center" prop="uptime" :show-overflow-tooltip="true" width="160"/>
<el-table-column label="操作" align="center" width="180" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>休息</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>编辑</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</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="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
</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>
<script>
import { systemAreaTreeApi } from "@/api/base/area";
import { getPageCanteenApi } from "@/api/base/canteen";
export default {
name: "",
dicts: [],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 字典表格数据
tableListData: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
treeOptions:[],//区域树
treeProps:{
multiple: true,
value:"id",
label:"treeName",
children:"children",
},
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
canteenName: undefined,
areaNameStr: undefined,
},
// 表单参数
form: {},
// 表单校验
rules: {
// canteenName: [
// { required: true, message: "字典名称不能为空", trigger: "blur" }
// ],
// dictType: [
// { required: true, message: "字典类型不能为空", trigger: "blur" }
// ]
}
};
},
created() {
this.getTreeData();
this.getList();
},
methods: {
//区域树
getTreeData() {
systemAreaTreeApi({}).then((response) => {
this.treeOptions = response;
console.log(this.treeOptions)
});
},
handleTreeChange(e){
console.log(e)
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 查询列表 */
getList() {
this.loading = true;
let param = {
"current": this.queryParams.pageNum,
"size": this.queryParams.pageSize,
}
getPageCanteenApi(param).then(response => {
this.tableListData = response.records;
this.total = Number(response.total);
this.loading = false;
});
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "新增";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
// const dictId = row.dictId || this.ids
// getType(dictId).then(response => {
// this.form = response.data;
this.open = true;
this.title = "修改";
// });
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {};
this.resetForm("form");
},
/** 提交按钮 */
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.dictId != undefined) {
// updateType(this.form).then(response => {
// this.$modal.msgSuccess("修改成功");
// this.open = false;
// this.getList();
// });
} else {
// addType(this.form).then(response => {
// this.$modal.msgSuccess("新增成功");
// this.open = false;
// this.getList();
// });
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const dictIds = row.dictId || this.ids;
this.$modal.confirm('是否确认删除数据项?').then(function() {
// return delType(dictIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
}
};
</script>