|
|
@@ -53,7 +53,8 @@
|
|
|
</el-table>
|
|
|
<div style="margin-top: 20px" class="table-footer">
|
|
|
<div class="pages">
|
|
|
- <el-pagination layout="prev, pager, next" :total="9000"></el-pagination>
|
|
|
+ <el-pagination :hide-on-single-page="true" layout="prev, pager, next" :total="rows_total">
|
|
|
+ </el-pagination>
|
|
|
</div>
|
|
|
<div class="export-table">
|
|
|
<el-button type="primary" size="small" @click="toggleSelection()">表格导出</el-button>
|
|
|
@@ -120,6 +121,7 @@
|
|
|
xiaofeiDialog: false,
|
|
|
// 表格数据
|
|
|
tableData: [],
|
|
|
+ rows_total: 0,
|
|
|
// 表格参数
|
|
|
table: {
|
|
|
currentPage: 1, // 当前所在页码
|
|
|
@@ -130,35 +132,49 @@
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
- // 获取当天日期
|
|
|
- var myDate = this.getNowFormatDate();
|
|
|
- let params = {
|
|
|
- page: this.table.currentPage,
|
|
|
- rows: this.table.pageRows,
|
|
|
- begin_time: myDate
|
|
|
- // begin_time: '2021-08-10'
|
|
|
+ var statue = sessionStorage.getItem('uname')
|
|
|
+ if (!statue || typeof(statue) == 'undefined' || statue == '' || statue == 'null') {
|
|
|
+ this.$router.replace('/')
|
|
|
+ } else {
|
|
|
+ // 获取当天日期
|
|
|
+ var myDate = this.getNowFormatDate();
|
|
|
+ let params = {
|
|
|
+ page: this.table.currentPage,
|
|
|
+ rows: this.table.pageRows,
|
|
|
+ begin_time: myDate
|
|
|
+ // begin_time: '2021-08-10'
|
|
|
+ }
|
|
|
+ // 获取当日消费列表
|
|
|
+ this.getTodayXiaofei(params)
|
|
|
+ // 1. 获取年月日,并获取消费总金额
|
|
|
+ this.selectGetDate(myDate)
|
|
|
+ // 取得楼栋号,填充下拉列表
|
|
|
+ this.getBuildsFillSelect()
|
|
|
}
|
|
|
- // 获取当日消费列表
|
|
|
- this.getTodayXiaofei(params)
|
|
|
- // 获取年月日消费总金额
|
|
|
- this.get_year_month_amount('/HotWaters/watertotalFeel.action')
|
|
|
- // 取得楼栋号,填充下拉列表
|
|
|
- this.getBuildsFillSelect()
|
|
|
},
|
|
|
methods: {
|
|
|
- // 日期下拉列表选择日期
|
|
|
+ /**
|
|
|
+ * 1. 获取日期下拉列表选择的日期
|
|
|
+ * 2. 拆分到对于的变量中,便于根据
|
|
|
+ * @param {Object} val
|
|
|
+ */
|
|
|
selectGetDate(val) {
|
|
|
console.log(val);
|
|
|
- this.select_riqi.select_day = ''
|
|
|
- this.select_riqi.select_month = ''
|
|
|
this.select_riqi.select_year = ''
|
|
|
+ this.select_riqi.select_month = ''
|
|
|
+ this.select_riqi.select_day = ''
|
|
|
if (val) {
|
|
|
this.select_riqi.select_year = val.split('-')[0]
|
|
|
- this.select_riqi.select_month = val.split('-')[1]
|
|
|
+ this.select_riqi.select_month = val.split('-')[0] + '-' + val.split('-')[1]
|
|
|
+ this.select_riqi.select_day = val
|
|
|
} else {
|
|
|
- this.filters.year = ""
|
|
|
- this.filters.month = ""
|
|
|
+ this.select_riqi.select_year = ""
|
|
|
+ this.select_riqi.select_month = ""
|
|
|
+ this.select_riqi.select_day = ""
|
|
|
}
|
|
|
+
|
|
|
+ // 获取年月日消费总金额
|
|
|
+ this.get_year_month_day_amount()
|
|
|
},
|
|
|
//获取当前时间,格式YYYY-MM-DD
|
|
|
getNowFormatDate() {
|
|
|
@@ -189,7 +205,8 @@
|
|
|
this.$axios.get('/api/HotWaters/watergetdoms.action', params)
|
|
|
.then(res => {
|
|
|
console.log(res.data);
|
|
|
- if (typeof(res.data.doms) != 'undefined' && res.data.doms != '' && JSON.stringify(res.data) !='{}') {
|
|
|
+ if (typeof(res.data.doms) != 'undefined' && res.data.doms != '' && JSON.stringify(res.data) !=
|
|
|
+ '{}') {
|
|
|
this.room_options.rooms = [{
|
|
|
value: 0,
|
|
|
label: '全部'
|
|
|
@@ -202,16 +219,18 @@
|
|
|
this.room_options.rooms.push(tmp)
|
|
|
}
|
|
|
} else {
|
|
|
- _this.$message.success('宿舍号暂无数据!');
|
|
|
+ _this.$message.success('【宿舍号】暂无数据!');
|
|
|
}
|
|
|
})
|
|
|
.catch(err => {
|
|
|
// console.log(err);
|
|
|
- _this.$message.error('请求异常: ' + err);
|
|
|
+ _this.$message.error('【宿舍号】请求异常: ' + err);
|
|
|
})
|
|
|
},
|
|
|
/**
|
|
|
- * 获取楼栋号下拉列表选择的id,并刷新表格
|
|
|
+ * 1. 获取楼栋号下拉列表选择的id
|
|
|
+ * 2. 刷新消费表格
|
|
|
+ * 3. 获取宿舍号填充下拉列表
|
|
|
* @param {Object} vId
|
|
|
*/
|
|
|
selectGetBuild(vId) {
|
|
|
@@ -226,11 +245,12 @@
|
|
|
|
|
|
// 获取宿舍号,填充宿舍号下拉列表
|
|
|
this.getRooms()
|
|
|
- // 组合参数
|
|
|
+ // 组合参数,刷新消费表格
|
|
|
this.selectParams()
|
|
|
},
|
|
|
/**
|
|
|
- * 获取宿舍号下拉列表选择的id,并刷新表格
|
|
|
+ * 1. 获取宿舍号下拉列表选择的id
|
|
|
+ * 2. 刷新消费表格
|
|
|
* @param {Object} vId
|
|
|
*/
|
|
|
selectGetroom(vId) {
|
|
|
@@ -243,11 +263,12 @@
|
|
|
this.room_options.room_value = obj.value
|
|
|
this.room_options.room_label = obj.label
|
|
|
|
|
|
- // 组合参数
|
|
|
+ // 组合参数,刷新消费表格
|
|
|
this.selectParams()
|
|
|
},
|
|
|
/**
|
|
|
- * 组合参数
|
|
|
+ * 1. 组合参数
|
|
|
+ * 2. 刷新消费表格
|
|
|
*/
|
|
|
selectParams() {
|
|
|
var params = {}
|
|
|
@@ -262,11 +283,11 @@
|
|
|
if (this.select_riqi.select_day != '') {
|
|
|
params.begin_time = this.select_riqi.select_day
|
|
|
}
|
|
|
- // 查询该栋的信息
|
|
|
+ // 刷新消费表格
|
|
|
this.getTodayXiaofei(params)
|
|
|
},
|
|
|
/**
|
|
|
- * 获取当日消费列表
|
|
|
+ * 获取消费列表
|
|
|
* @param {Object} params
|
|
|
*/
|
|
|
getTodayXiaofei(params) {
|
|
|
@@ -276,7 +297,8 @@
|
|
|
})
|
|
|
.then(res => {
|
|
|
// console.log(res.data);
|
|
|
- if (typeof(res.data.rows) != 'undefined' && res.data.rows != '' && JSON.stringify(res.data) !='{}') {
|
|
|
+ if (typeof(res.data.rows) != 'undefined' && res.data.rows != '' && JSON.stringify(res.data) !=
|
|
|
+ '{}') {
|
|
|
this.tableData = []
|
|
|
for (var i = 0; i < res.data.rows.length; i++) {
|
|
|
let tmp = {
|
|
|
@@ -290,12 +312,12 @@
|
|
|
this.tableData.push(tmp)
|
|
|
}
|
|
|
} else {
|
|
|
- _this.$message.success('当日消费暂无数据!');
|
|
|
+ _this.$message.success('【当日消费】暂无数据!');
|
|
|
}
|
|
|
})
|
|
|
.catch(err => {
|
|
|
// console.log(err);
|
|
|
- _this.$message.error('请求异常: ' + err);
|
|
|
+ _this.$message.error('【当日消费】请求异常: ' + err);
|
|
|
})
|
|
|
},
|
|
|
/**
|
|
|
@@ -307,7 +329,8 @@
|
|
|
this.$axios.get('/api/HotWaters/watergetBuilds.action')
|
|
|
.then(res => {
|
|
|
// console.log(res.data);
|
|
|
- if (typeof(res.data.builds) != 'undefined' && res.data.builds != '' && JSON.stringify(res.data) !='{}') {
|
|
|
+ if (typeof(res.data.builds) != 'undefined' && res.data.builds != '' && JSON.stringify(res
|
|
|
+ .data) != '{}') {
|
|
|
this.drom_options.builds = [{
|
|
|
value: 0,
|
|
|
label: '全部'
|
|
|
@@ -320,24 +343,30 @@
|
|
|
this.drom_options.builds.push(tmp)
|
|
|
}
|
|
|
} else {
|
|
|
- _this.$message.success('楼栋号暂无数据!');
|
|
|
+ _this.$message.success('【楼栋号】暂无数据!');
|
|
|
}
|
|
|
})
|
|
|
.catch(err => {
|
|
|
// console.log(err);
|
|
|
- _this.$message.error('请求异常: ' + err);
|
|
|
+ _this.$message.error('【楼栋号】请求异常: ' + err);
|
|
|
})
|
|
|
},
|
|
|
/**
|
|
|
* 获取年月日消费总金额
|
|
|
- * @param {Object} url
|
|
|
+ * @param {Object} params
|
|
|
*/
|
|
|
- get_year_month_amount(url) {
|
|
|
+ get_year_month_day_amount() {
|
|
|
var _this = this
|
|
|
- this.$axios.get('/api' + url)
|
|
|
+ this.$axios.get('/api/HotWaters/watertotalFeel.action', {
|
|
|
+ params: {
|
|
|
+ day: this.select_riqi.select_day,
|
|
|
+ month: this.select_riqi.select_month,
|
|
|
+ year: this.select_riqi.select_year
|
|
|
+ }
|
|
|
+ })
|
|
|
.then(res => {
|
|
|
// console.log(res.data);
|
|
|
- if (typeof(res.data) != 'undefined' && res.data != '' && JSON.stringify(res.data) !='{}') {
|
|
|
+ if (typeof(res.data) != 'undefined' && res.data != '' && JSON.stringify(res.data) != '{}') {
|
|
|
// _this.$message.success('数据加载成功!');
|
|
|
this.xiaofei.day_balance = parseFloat(res.data.money_day).toFixed(2)
|
|
|
this.xiaofei.month_balance = parseFloat(res.data.money_month).toFixed(2)
|
|
|
@@ -345,12 +374,12 @@
|
|
|
|
|
|
this.today_xiaofei = parseFloat(res.data.money_day).toFixed(2)
|
|
|
} else {
|
|
|
- _this.$message.success('年月消费暂无数据!');
|
|
|
+ _this.$message.success('【年/月消费】暂无数据!');
|
|
|
}
|
|
|
})
|
|
|
.catch(err => {
|
|
|
// console.log(err);
|
|
|
- _this.$message.error('请求异常: ' + err);
|
|
|
+ _this.$message.error('【年/月消费】请求异常: ' + err);
|
|
|
})
|
|
|
},
|
|
|
onSubmit() {
|