程志平 il y a 3 ans
Parent
commit
964f5653f8

+ 33 - 4
src/api/consumptionRecord.js

@@ -1,10 +1,25 @@
 import request from '@/utils/request'
 
 // 获取3个数据
-export function getThreeData() {
+export function getThreeData(forData) {
+	let data = new FormData()
+	if (typeof forData.name_card != 'undefined') {
+		data.append('name_card', forData.name_card)
+	}
+	if (typeof forData.start_time != 'undefined') {
+		data.append('start_time', forData.start_time)
+	}
+	if (typeof forData.end_time != 'undefined') {
+		data.append('end_time', forData.end_time)
+	}
+	if (typeof forData.state != 'undefined') {
+		data.append('state', forData.state)
+	}
+	// console.log(forData);
 	return request({
 		url: '/airManage/consumequeryTongji.action',
-		method: 'post'
+		method: 'post',
+		data
 	})
 }
 
@@ -34,9 +49,23 @@ export function getTableData(forData) {
 
 
 // 下载
-export function downloadExcel() {
+export function downloadExcel(forData) {
+	let data = new FormData()
+	if (typeof forData.name_card != 'undefined') {
+		data.append('name_card', forData.name_card)
+	}
+	if (typeof forData.start_time != 'undefined') {
+		data.append('start_time', forData.start_time)
+	}
+	if (typeof forData.end_time != 'undefined') {
+		data.append('end_time', forData.end_time)
+	}
+	if (typeof forData.state != 'undefined') {
+		data.append('state', forData.state)
+	}
 	return request({
 		url: '/airManage/consumetoExcel.action',
-		method: 'post'
+		method: 'post',
+		data
 	})
 }

+ 34 - 4
src/api/rechargeRecord.js

@@ -1,10 +1,25 @@
 import request from '@/utils/request'
 
 // 获取3个数据
-export function getThreeData() {
+export function getThreeData(forData) {
+	let data = new FormData()
+	if (typeof forData.name_card != 'undefined') {
+		data.append('name_card', forData.name_card)
+	}
+	if (typeof forData.start_time != 'undefined') {
+		data.append('start_time', forData.start_time)
+	}
+	if (typeof forData.end_time != 'undefined') {
+		data.append('end_time', forData.end_time)
+	}
+	if (typeof forData.state != 'undefined') {
+		data.append('state', forData.state)
+	}
+	// console.log(forData);
 	return request({
 		url: '/airManage/rechargequeryTongji.action',
-		method: 'post'
+		method: 'post',
+		data
 	})
 }
 
@@ -34,9 +49,24 @@ export function getTableData(forData) {
 
 
 // 下载
-export function downloadExcel() {
+export function downloadExcel(forData) {
+	let data = new FormData()
+	if (typeof forData.name_card != 'undefined') {
+		data.append('name_card', forData.name_card)
+	}
+	if (typeof forData.start_time != 'undefined') {
+		data.append('start_time', forData.start_time)
+	}
+	if (typeof forData.end_time != 'undefined') {
+		data.append('end_time', forData.end_time)
+	}
+	if (typeof forData.state != 'undefined') {
+		data.append('state', forData.state)
+	}
+	// console.log(forData);
 	return request({
 		url: '/airManage/rechargetoExcel.action',
-		method: 'post'
+		method: 'post',
+		data
 	})
 }

+ 13 - 2
src/api/userMgr.js

@@ -38,10 +38,21 @@ export function chongzhi(data) {
 }
 
 // 下载
-export function downloadExcel() {
+export function downloadExcel(forData) {
+	let data = new FormData()
+	data.append('page', forData.page)
+	data.append('rows', forData.rows)
+	if (typeof forData.name_card != 'undefined') {
+		data.append('name_card', forData.name_card)
+	}
+	if (typeof forData.classfy != 'undefined') {
+		data.append('classfy', forData.classfy)
+	}
+	// console.log(forData);
 	return request({
 		url: '/airManage/userstoExcel.action',
-		method: 'post'
+		method: 'post',
+		data
 	})
 }
 

+ 23 - 12
src/views/consumptionRecord/index.vue

@@ -149,6 +149,7 @@
 					state: ''
 				},
 				tableData: [],
+				cond_data: {},
 				// 分页参数
 				pagination: {
 					currentPage: 1,
@@ -172,8 +173,9 @@
 			 * 下载Excel表格
 			 */
 			handler_download_excel() {
+				let data = this.cond_data;
 				// 开始发送请求,获取配置数据
-				downloadExcel().then((res) => {
+				downloadExcel(data).then((res) => {
 					// console.log(res);
 					if (typeof res.code == 'undefined' || res.code == '') {
 						this.$message.error('返回数据格式问题,code未获取到!')
@@ -224,20 +226,22 @@
 					rows: this.pagination.pageSize
 				}
 				if (param == 'search') {
-					data.page = 1
+					data.page = 1;
+					this.pagination.currentPage = 1;
 				}
 				if (this.formInline.user !== '') {
-					data.name_card = this.formInline.user
+					data.name_card = this.formInline.user;
 				}
 				if (this.formInline.startTime !== '') {
-					data.start_time = this.formInline.startTime
+					data.start_time = this.formInline.startTime;
 				}
 				if (this.formInline.endTime !== '') {
-					data.end_time = this.formInline.endTime
+					data.end_time = this.formInline.endTime;
 				}
 				if (this.formInline.state !== '') {
-					data.state = this.formInline.state
+					data.state = this.formInline.state;
 				}
+				this.cond_data = data;
 				// console.log(data);
 				getTableData(data).then((res) => {
 					// console.log(res);
@@ -263,20 +267,25 @@
 							this.tableData.push(item)
 						}
 					} else {
-						this.tableData = []
-						this.$message.warning('没有符合条件的数据!')
+						this.tableData = [];
+						this.$message.warning('没有符合条件的数据!');
 					}
 				}).catch((err) => {
 					// console.log(err);
-					this.$message.error(err.message)
+					this.$message.error(err.message);
 				});
-				this.loading = false
+				this.loading = false;
+
+				if (param == 'search') {
+					this.get_three_data();
+				}
 			},
 			/**
 			 * 获取3个数据
 			 */
 			get_three_data() {
-				getThreeData().then((res) => {
+				let data = this.cond_data;
+				getThreeData(data).then((res) => {
 					// console.log(res);
 					if (res.code == 200) {
 						this.total_balance = res.TotalYe.toFixed(2) // 总余额
@@ -288,7 +297,9 @@
 				}).catch((err) => {
 					// console.log(err);
 					this.$message.error(err.message)
-				})
+				});
+				
+				this.cond_data = {};
 			},
 			/**
 			 * 搜索

+ 12 - 3
src/views/rechargeRecord/index.vue

@@ -135,6 +135,7 @@
 					state: '2'
 				},
 				tableData: [],
+				cond_data: {},
 				// 分页参数
 				pagination: {
 					currentPage: 1,
@@ -158,8 +159,9 @@
 			 * 下载Excel表格
 			 */
 			handler_download_excel() {
+				let data = this.cond_data;
 				// 开始发送请求,获取配置数据
-				downloadExcel().then((res) => {
+				downloadExcel(data).then((res) => {
 					// console.log(res);
 					if (typeof res.code == 'undefined' || res.code == '') {
 						this.$message.error('返回数据格式问题,code未获取到!')
@@ -204,7 +206,8 @@
 			 * 获取3个数据
 			 */
 			get_three_data() {
-				getThreeData().then((res) => {
+				let data = this.cond_data;
+				getThreeData(data).then((res) => {
 					// console.log(res);
 					if (res.code == 200) {
 						this.total_balance = res.TotalYe.toFixed(2) // 总余额
@@ -229,6 +232,7 @@
 				}
 				if (param == 'search') {
 					data.page = 1
+					this.pagination.currentPage = 1
 				}
 				if (this.formInline.user !== '') {
 					data.name_card = this.formInline.user
@@ -242,6 +246,7 @@
 				if (this.formInline.state !== '') {
 					data.state = this.formInline.state
 				}
+				this.cond_data = data;
 				// console.log(data);
 				getTableData(data).then((res) => {
 					// console.log(res);
@@ -259,7 +264,11 @@
 					// console.log(err);
 					this.$message.error(err.message)
 				});
-				this.loading = false
+				this.loading = false;
+
+				if (param == 'search') {
+					this.get_three_data();
+				}
 			},
 			/**
 			 * 搜索

+ 9 - 5
src/views/userMgr/index.vue

@@ -300,6 +300,7 @@
 					options: []
 				},
 				tableData: [],
+				cond_data: {},
 				// 分页参数
 				pagination: {
 					currentPage: 1,
@@ -388,8 +389,9 @@
 			 * 下载Excel表格
 			 */
 			handler_download_excel() {
+				let data = this.cond_data;
 				// 开始发送请求,获取配置数据
-				downloadExcel().then((res) => {
+				downloadExcel(data).then((res) => {
 					// console.log(res);
 					if (typeof res.code == 'undefined' || res.code == '') {
 						this.$message.error('返回数据格式问题,code未获取到!')
@@ -509,14 +511,16 @@
 					rows: this.pagination.pageSize
 				}
 				if (param == 'search') {
-					data.page = 1
+					data.page = 1;
+					this.pagination.currentPage = 1;
 				}
 				if (this.formInline.user !== '') {
-					data.name_card = this.formInline.user
+					data.name_card = this.formInline.user;
 				}
 				if (this.formInline.category !== '') {
-					data.classfy = this.formInline.category
+					data.classfy = this.formInline.category;
 				}
+				this.cond_data = data;
 				// 开始发送请求,获取配置数据
 				getUserList(data).then((res) => {
 					// console.log(res.rows);
@@ -535,7 +539,7 @@
 					this.$message.error(err.message)
 				});
 				// loading结束
-				this.loading = false
+				this.loading = false;
 			},
 			/**
 			 * 查询