bonus-ui/src/views/canteen/pointsSearch/personalRechargeList.vue

219 lines
6.0 KiB
Vue

<template>
<div>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
label-width="68px">
<el-form-item label="姓名:" prop="userId" label-width="68px">
<Treeselect style="width: 220px" v-model="queryParams.userId" :options="deptOptions" :normalizer="normalizer"
:show-count="true"
:multiple="false" :flat="true"
@input="inputHandle" :disable-branch-nodes="true"
placeholder="请选择"/>
</el-form-item>
<el-form-item label="选择时间:" prop="incomeTimeQuery" label-width="120px">
<el-date-picker
v-model="queryParams.incomeTimeQuery"
type="month"
value-format="yyyy-MM"
placeholder="选择日期">
</el-date-picker>
</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-button type="primary" icon="el-icon-export" size="mini" @click="handleExport">导出</el-button>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="personalSubsidyList" class="tableContent" max-height="600px">
<el-table-column label="序号" align="center" type="index"/>
<el-table-column label="姓名" align="center" prop="userName"/>
<el-table-column label="食堂卡" align="center" prop="canteenName"/>
<el-table-column label="充值积分时间" align="center" prop="incomeTime"/>
<el-table-column label="充值积分地点" align="center" prop="carteenName"/>
<el-table-column label="充值积分" align="center" prop="incomeNum"/>
<el-table-column label="提报人" align="center" prop="createByName"/>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
import {listPersonalRecharge} from "@/api/canteen/pointsSearch";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import {deptUserTree} from "@/api/canteen/pointsDistribution";
export default {
name: 'PersonalRechargeList',
components: {
Treeselect
},
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
activeTab: 'list',
activeLabel: '食堂卡列表',
// 菜谱CM_CARTE表格数据
personalSubsidyList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
carteenId: null,
carteenName: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
tags: [
{required: true, message: "请选择菜点", trigger: "change"}
],
name: [
{required: true, message: "菜名不能为空", trigger: "blur"}
],
carteType: [
{required: true, message: "请选择菜谱类别", trigger: "change"}
],
cartePrice: [
{required: true, message: "积分不能为空", trigger: "blur"}
],
},
deptOptions: [],
};
},
created() {
this.initData();
},
methods: {
// 树形选择器
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.nodeId,
label: node.label,
children: node.children,
};
},
// 树形选择器
inputHandle(value) {
console.log(value);
},
// 初始化数据
initData() {
this.getList();
this.initDeptUserTree();
},
initDeptUserTree() {
deptUserTree().then(res => {
if (res.code === 200) {
this.deptOptions = res.data;
} else {
this.$modal.msgError(res.msg);
}
})
},
/** 查询菜谱CM_CARTE列表 */
getList() {
this.loading = true;
listPersonalRecharge(this.queryParams).then(response => {
this.personalSubsidyList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
carteenId: null,
carteenName: null,
name: null,
carteType: null,
cartePrice: null,
pic: null,
tags: null,
carteSort: null,
description: null,
status: null,
delFlag: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams = {
pageNum: 1,
pageSize: 10,
userName: null,
incomeTime: null,
};
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 导出按钮操作 */
handleExport() {
this.yjDownload('/canteen/cmPersonIncome/rechargeListExport', {
...this.queryParams
}, `个人充值积分_${new Date().getTime()}.xlsx`)
}
},
watch: {
activeTab: {
handler(newVal, oldVal) {
if (newVal === 'list') {
this.activeLabel = '食堂卡列表'
}
}
}
}
}
</script>
<style scoped>
</style>