Browse Source

需求修改,设备管理界面和功能的优化

soft5566 3 years ago
parent
commit
5e3777f08b

+ 6 - 0
src/api/consumptionRecord.js

@@ -31,6 +31,12 @@ export function getTableData(forData) {
 	if (typeof forData.name_card != 'undefined') {
 	if (typeof forData.name_card != 'undefined') {
 		data.append('name_card', forData.name_card)
 		data.append('name_card', forData.name_card)
 	}
 	}
+	if (typeof forData.dom_name != 'undefined') {
+		data.append('dom_name', forData.dom_name)
+	}
+	if (typeof forData.air_name != 'undefined') {
+		data.append('air_name', forData.air_name)
+	}
 	if (typeof forData.start_time != 'undefined') {
 	if (typeof forData.start_time != 'undefined') {
 		data.append('start_time', forData.start_time)
 		data.append('start_time', forData.start_time)
 	}
 	}

+ 53 - 40
src/views/consumptionRecord/index.vue

@@ -16,30 +16,28 @@
 					</div>
 					</div>
 					<div class="cell-body">
 					<div class="cell-body">
 						<el-form :inline="true" :model="formInline" class="demo-form-inline">
 						<el-form :inline="true" :model="formInline" class="demo-form-inline">
-							<el-form-item label="关键字:">
-								<el-input v-model="formInline.user" placeholder="请输入姓名" clearable></el-input>
+							<el-form-item label="姓名:">
+								<el-input v-model="formInline.user" placeholder="请输入姓名" :style="keyword_style" clearable></el-input>
+							</el-form-item>
+							<el-form-item label="房间号:">
+								<el-input v-model="formInline.dom_name" placeholder="请输入房间号" :style="keyword_style" clearable></el-input>
+							</el-form-item>
+							<el-form-item label="空调设备:">
+								<el-input v-model="formInline.air_name" placeholder="请输入空调设备" :style="keyword_style" clearable></el-input>
 							</el-form-item>
 							</el-form-item>
 							<el-form-item>
 							<el-form-item>
 								<el-button type="warning" @click="btn_search">查询</el-button>
 								<el-button type="warning" @click="btn_search">查询</el-button>
 							</el-form-item>
 							</el-form-item>
 							<el-form-item label="时间筛选:">
 							<el-form-item label="时间筛选:">
-								<el-date-picker v-model="search_datatime" type="datetimerange" align="right"
-									start-placeholder="开始日期" end-placeholder="结束日期" @change="search_datetime_change"
-									:default-time="['00:00:00', '23:59:59']" clearable
-									value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd HH:mm:ss">
+								<el-date-picker v-model="search_datatime" type="datetimerange" align="right" start-placeholder="开始日期" end-placeholder="结束日期"
+									@change="search_datetime_change" :default-time="['00:00:00', '23:59:59']" clearable value-format="yyyy-MM-dd HH:mm:ss"
+									format="yyyy-MM-dd HH:mm:ss" :style="keyword_style">
 								</el-date-picker>
 								</el-date-picker>
 							</el-form-item>
 							</el-form-item>
-							<!-- <el-form-item label="">
-								<el-select v-model="formInline.state" placeholder="支付状态" @change="search_state_change"
-									clearable>
-									<el-option label="支付成功" value="1"></el-option>
-									<el-option label="支付失败" value="0"></el-option>
-								</el-select>
-							</el-form-item> -->
 						</el-form>
 						</el-form>
-						<el-table :data="tableData" height="510" style="width: 100%" :cell-style="cell_style"
-							v-loading="loading" :header-cell-style="header_cell_style">
-							<el-table-column label="序号" align="center" width="80">
+						<el-table :data="tableData" height="510" style="width: 100%" :cell-style="cell_style" v-loading="loading"
+							:header-cell-style="header_cell_style" border>
+							<el-table-column label="序号" align="center" width="60">
 								<template slot-scope="scope">
 								<template slot-scope="scope">
 									<span>{{(pagination.currentPage - 1) * pagination.pageSize + scope.$index + 1}}</span>
 									<span>{{(pagination.currentPage - 1) * pagination.pageSize + scope.$index + 1}}</span>
 								</template>
 								</template>
@@ -49,7 +47,7 @@
 									<span>{{ scope.row.user_name }}</span>
 									<span>{{ scope.row.user_name }}</span>
 								</template>
 								</template>
 							</el-table-column>
 							</el-table-column>
-							<el-table-column label="手机" align="center" width="140">
+							<el-table-column label="手机" align="center" width="110">
 								<template slot-scope="scope">
 								<template slot-scope="scope">
 									<span>{{ scope.row.phone }}</span>
 									<span>{{ scope.row.phone }}</span>
 								</template>
 								</template>
@@ -66,20 +64,30 @@
 							</el-table-column>
 							</el-table-column>
 							<el-table-column label="房间号" align="center">
 							<el-table-column label="房间号" align="center">
 								<template slot-scope="scope">
 								<template slot-scope="scope">
-									<span>{{ scope.row.dom }}</span>
+									<span>{{ scope.row.dom_name }}</span>
+								</template>
+							</el-table-column>
+							<el-table-column label="空调设备" align="center">
+								<template slot-scope="scope">
+									<span>{{ scope.row.air_name }}</span>
+								</template>
+							</el-table-column>
+							<el-table-column label="开始时间" align="center" width="100">
+								<template slot-scope="scope">
+									<span>{{ scope.row.time }}</span>
 								</template>
 								</template>
 							</el-table-column>
 							</el-table-column>
-							<el-table-column label="操作状态" align="center" width="90">
+							<el-table-column label="结束时间" align="center" width="100">
 								<template slot-scope="scope">
 								<template slot-scope="scope">
-									<span>{{ scope.row.handler_state }}</span>
+									<span>{{ scope.row.end_time }}</span>
 								</template>
 								</template>
 							</el-table-column>
 							</el-table-column>
-							<el-table-column label="消费金额(元)" align="center" width="140">
+							<el-table-column label="消费(元)" align="right" width="110">
 								<template slot-scope="scope">
 								<template slot-scope="scope">
 									<span>{{ scope.row.account }}</span>
 									<span>{{ scope.row.account }}</span>
 								</template>
 								</template>
 							</el-table-column>
 							</el-table-column>
-							<el-table-column label="账户余额(元)" align="center" width="140">
+							<el-table-column label="余额(元)" align="right" width="110">
 								<template slot-scope="scope">
 								<template slot-scope="scope">
 									<span>{{ scope.row.balance }}</span>
 									<span>{{ scope.row.balance }}</span>
 								</template>
 								</template>
@@ -95,15 +103,14 @@
 									<span>{{ scope.row.order_num }}</span>
 									<span>{{ scope.row.order_num }}</span>
 								</template>
 								</template>
 							</el-table-column>
 							</el-table-column>
-							<el-table-column label="支付时间" align="center" width="160">
+							<el-table-column label="支付时间" align="center" width="100">
 								<template slot-scope="scope">
 								<template slot-scope="scope">
 									<span>{{ scope.row.time }}</span>
 									<span>{{ scope.row.time }}</span>
 								</template>
 								</template>
 							</el-table-column>
 							</el-table-column>
 						</el-table>
 						</el-table>
 						<div class="pagination-table">
 						<div class="pagination-table">
-							<el-pagination @current-change="currentPageChange"
-								:current-page.sync="pagination.currentPage" :page-size="pagination.pageSize"
+							<el-pagination @current-change="currentPageChange" :current-page.sync="pagination.currentPage" :page-size="pagination.pageSize"
 								layout="prev, pager, next, jumper" :total="pagination.total">
 								layout="prev, pager, next, jumper" :total="pagination.total">
 							</el-pagination>
 							</el-pagination>
 						</div>
 						</div>
@@ -127,6 +134,8 @@
 				total_consumption: 0.0.toFixed(2), // 总消费
 				total_consumption: 0.0.toFixed(2), // 总消费
 				total_number: 0, // 总交易笔数
 				total_number: 0, // 总交易笔数
 				formLabelWidth: '120px',
 				formLabelWidth: '120px',
+				keyword_width: '150px',
+				keyword_style: 'margin-left: -12px',
 				// 表格单元格样式
 				// 表格单元格样式
 				cell_style: {
 				cell_style: {
 					color: '#1A202B',
 					color: '#1A202B',
@@ -144,9 +153,10 @@
 				// 表单数据
 				// 表单数据
 				formInline: {
 				formInline: {
 					user: '',
 					user: '',
+					dom_name: '',
+					air_name: '',
 					startTime: '',
 					startTime: '',
-					endTime: '',
-					state: ''
+					endTime: ''
 				},
 				},
 				tableData: [],
 				tableData: [],
 				cond_data: {},
 				cond_data: {},
@@ -222,9 +232,9 @@
 			get_table_data(param) {
 			get_table_data(param) {
 				this.loading = true
 				this.loading = true
 				this.get_condition();
 				this.get_condition();
-				
+
 				let data = this.cond_data;
 				let data = this.cond_data;
-				
+
 				if (param == 'search') {
 				if (param == 'search') {
 					data.page = 1;
 					data.page = 1;
 					this.pagination.currentPage = 1;
 					this.pagination.currentPage = 1;
@@ -239,17 +249,17 @@
 						for (var i = 0; i < res.rows.length; i++) {
 						for (var i = 0; i < res.rows.length; i++) {
 							item = {
 							item = {
 								user_name: res.rows[i].user_name,
 								user_name: res.rows[i].user_name,
-								phone: res.rows[i].phone,
+								phone: res.rows[i].phone.substr(res.rows[i].phone.length - 11),
 								build: res.rows[i].build,
 								build: res.rows[i].build,
 								floors: res.rows[i].floors,
 								floors: res.rows[i].floors,
-								dom: res.rows[i].air_name + ' ' + res.rows[i].air_ip,
-								// dom: res.rows[i].dom.split('-')[1] + ' ' + res.rows[i].air_name + ' ' + res.rows[i].air_ip,
-								handler_state: res.rows[i].handler_state,
-								account: res.rows[i].account,
-								balance: res.rows[i].balance,
+								dom_name: res.rows[i].dom_name,
+								air_name: res.rows[i].air_name,
 								state: res.rows[i].state,
 								state: res.rows[i].state,
+								account: res.rows[i].account.toFixed(2),
+								balance: res.rows[i].balance.toFixed(2),
 								order_num: res.rows[i].order_num,
 								order_num: res.rows[i].order_num,
-								time: res.rows[i].time
+								time: res.rows[i].time,
+								end_time: res.rows[i].end_time
 							}
 							}
 							this.tableData.push(item)
 							this.tableData.push(item)
 						}
 						}
@@ -297,15 +307,18 @@
 				if (this.formInline.user !== '') {
 				if (this.formInline.user !== '') {
 					data.name_card = this.formInline.user;
 					data.name_card = this.formInline.user;
 				}
 				}
+				if (this.formInline.dom_name !== '') {
+					data.dom_name = this.formInline.dom_name;
+				}
+				if (this.formInline.air_name !== '') {
+					data.air_name = this.formInline.air_name;
+				}
 				if (this.formInline.startTime !== '') {
 				if (this.formInline.startTime !== '') {
 					data.start_time = this.formInline.startTime;
 					data.start_time = this.formInline.startTime;
 				}
 				}
 				if (this.formInline.endTime !== '') {
 				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;
-				}
 				this.cond_data = data;
 				this.cond_data = data;
 			},
 			},
 			/**
 			/**
@@ -523,4 +536,4 @@
 			}
 			}
 		}
 		}
 	}
 	}
-</style>
+</style>

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

@@ -167,10 +167,10 @@
 				},
 				},
 				// 本月充值
 				// 本月充值
 				showThisMonthRecharge: {
 				showThisMonthRecharge: {
-					time: '0000/00/00 00:00:00',
-					amount: 0.00,
-					online_amount: 0.00,
-					offline_amount: 0.00,
+					time: '0000/00/00 00:00:00', // 时间
+					amount: 0.00, // 总
+					online_amount: 0.00, // 线上
+					offline_amount: 0.00, // 线下
 					loading: false
 					loading: false
 				},
 				},
 				// 本月消费
 				// 本月消费
@@ -541,15 +541,15 @@
 
 
 					if (res.code == 200) {
 					if (res.code == 200) {
 						this.showThisMonthRecharge.time = res.time
 						this.showThisMonthRecharge.time = res.time
-						this.showThisMonthRecharge.online_amount = res.zongRe // 线上充值
-						this.showThisMonthRecharge.offline_amount = res.zongRo // 线下充值
-						this.showThisMonthRecharge.amount = res.zongRe + res.zongRo // 总充值
+						this.showThisMonthRecharge.online_amount = res.zongRe.tong // 线上充值
+						this.showThisMonthRecharge.offline_amount = res.zongRo.tong // 线下充值
+						this.showThisMonthRecharge.amount = res.zongRe.tong + res.zongRo.tong // 总充值
 					} else if (res.code == 205) {
 					} else if (res.code == 205) {
 						this.showThisMonthRecharge.time = getFormatDateTime('datetime');
 						this.showThisMonthRecharge.time = getFormatDateTime('datetime');
-						// this.$message.error('本月充值:' + res.message)
+						this.$message.error('本月充值:' + res.message)
 					} else {
 					} else {
 						this.showThisMonthRecharge.time = getFormatDateTime('datetime');
 						this.showThisMonthRecharge.time = getFormatDateTime('datetime');
-						// this.$message.error('本月充值:' + res.message)
+						this.$message.error('本月充值:' + res.message)
 					}
 					}
 				}).catch((err) => {
 				}).catch((err) => {
 					// console.log(err);
 					// console.log(err);

+ 1 - 1
src/views/rechargeRecord/index.vue

@@ -6,7 +6,7 @@
 					<div class="cell-title">
 					<div class="cell-title">
 						<div class="title-left">
 						<div class="title-left">
 							<div class="title">充值记录</div>
 							<div class="title">充值记录</div>
-							<div class="title-detail">总余额:{{total_balance}}元</div>
+							<!-- <div class="title-detail">总余额:{{total_balance}}元</div> -->
 							<div class="title-detail">总充值:{{recharge.total}}元【线上:{{recharge.online}}元,线下:{{recharge.offline}}元】</div>
 							<div class="title-detail">总充值:{{recharge.total}}元【线上:{{recharge.online}}元,线下:{{recharge.offline}}元】</div>
 							<div class="title-detail">总交易笔数:{{number.total}}笔【线上:{{number.online}}笔,线下:{{number.offline}}笔】</div>
 							<div class="title-detail">总交易笔数:{{number.total}}笔【线上:{{number.online}}笔,线下:{{number.offline}}笔】</div>
 						</div>
 						</div>

+ 43 - 23
src/views/serveAC/index.vue

@@ -92,9 +92,12 @@
 										<div class="panel-title-btns">
 										<div class="panel-title-btns">
 											<el-button class="panel-title-btn" type="text" icon="el-icon-edit-outline"
 											<el-button class="panel-title-btn" type="text" icon="el-icon-edit-outline"
 												@click="operate_modify_room(currentData.rooms[0].room)">编辑</el-button>
 												@click="operate_modify_room(currentData.rooms[0].room)">编辑</el-button>
-											<el-button class="panel-title-btn" type="text" icon="el-icon-delete"
-												@click="operate_delete_room(currentData.rooms[0].room)">删除
-											</el-button>
+											<el-tooltip class="item" effect="dark" content="有设备,不能删除!" placement="top"
+												v-if="currentData.rooms[0].tableData.length > 0">
+												<el-button class="panel-title-btn deletenone" type="text" icon="el-icon-delete">删除</el-button>
+											</el-tooltip>
+											<el-button class="panel-title-btn" v-else type="text" icon="el-icon-delete"
+												@click="operate_delete_room(0, currentData.rooms[0].room)">删除</el-button>
 										</div>
 										</div>
 									</div>
 									</div>
 									<div class="panel-body">
 									<div class="panel-body">
@@ -169,9 +172,12 @@
 										<div class="panel-title-btns">
 										<div class="panel-title-btns">
 											<el-button class="panel-title-btn" type="text" icon="el-icon-edit-outline"
 											<el-button class="panel-title-btn" type="text" icon="el-icon-edit-outline"
 												@click="operate_modify_room(currentData.rooms[1].room)">编辑</el-button>
 												@click="operate_modify_room(currentData.rooms[1].room)">编辑</el-button>
-											<el-button class="panel-title-btn" type="text" icon="el-icon-delete"
-												@click="operate_delete_room(currentData.rooms[1].room)">删除
-											</el-button>
+											<el-tooltip class="item" effect="dark" content="有设备,不能删除!" placement="top"
+												v-if="currentData.rooms[1].tableData.length > 0">
+												<el-button class="panel-title-btn deletenone" type="text" icon="el-icon-delete">删除</el-button>
+											</el-tooltip>
+											<el-button class="panel-title-btn" v-else type="text" icon="el-icon-delete"
+												@click="operate_delete_room(1, currentData.rooms[1].room)">删除</el-button>
 										</div>
 										</div>
 									</div>
 									</div>
 									<div class="panel-body">
 									<div class="panel-body">
@@ -248,9 +254,12 @@
 										<div class="panel-title-btns">
 										<div class="panel-title-btns">
 											<el-button class="panel-title-btn" type="text" icon="el-icon-edit-outline"
 											<el-button class="panel-title-btn" type="text" icon="el-icon-edit-outline"
 												@click="operate_modify_room(currentData.rooms[2].room)">编辑</el-button>
 												@click="operate_modify_room(currentData.rooms[2].room)">编辑</el-button>
-											<el-button class="panel-title-btn" type="text" icon="el-icon-delete"
-												@click="operate_delete_room(currentData.rooms[2].room)">删除
-											</el-button>
+											<el-tooltip class="item" effect="dark" content="有设备,不能删除!" placement="top"
+												v-if="currentData.rooms[2].tableData.length > 0">
+												<el-button class="panel-title-btn deletenone" type="text" icon="el-icon-delete">删除</el-button>
+											</el-tooltip>
+											<el-button class="panel-title-btn" v-else type="text" icon="el-icon-delete"
+												@click="operate_delete_room(2, currentData.rooms[2].room)">删除</el-button>
 										</div>
 										</div>
 									</div>
 									</div>
 									<div class="panel-body">
 									<div class="panel-body">
@@ -325,9 +334,12 @@
 										<div class="panel-title-btns">
 										<div class="panel-title-btns">
 											<el-button class="panel-title-btn" type="text" icon="el-icon-edit-outline"
 											<el-button class="panel-title-btn" type="text" icon="el-icon-edit-outline"
 												@click="operate_modify_room(currentData.rooms[3].room)">编辑</el-button>
 												@click="operate_modify_room(currentData.rooms[3].room)">编辑</el-button>
-											<el-button class="panel-title-btn" type="text" icon="el-icon-delete"
-												@click="operate_delete_room(currentData.rooms[3].room)">删除
-											</el-button>
+											<el-tooltip class="item" effect="dark" content="有设备,不能删除!" placement="top"
+												v-if="currentData.rooms[3].tableData.length > 0">
+												<el-button class="panel-title-btn deletenone" type="text" icon="el-icon-delete">删除</el-button>
+											</el-tooltip>
+											<el-button class="panel-title-btn" v-else type="text" icon="el-icon-delete"
+												@click="operate_delete_room(3, currentData.rooms[3].room)">删除</el-button>
 										</div>
 										</div>
 									</div>
 									</div>
 									<div class="panel-body">
 									<div class="panel-body">
@@ -757,8 +769,7 @@
 						validator: checkroom
 						validator: checkroom
 					}]
 					}]
 				},
 				},
-				// 添加设备
-				dialog_add_device: false,
+				dialog_add_device: false, // 添加设备
 				form_add_device: { // 添加设备数据
 				form_add_device: { // 添加设备数据
 					cao: this.$store.state.user.name, // 操作员
 					cao: this.$store.state.user.name, // 操作员
 					contact: this.$store.state.user.phone, // 操作员手机号
 					contact: this.$store.state.user.phone, // 操作员手机号
@@ -797,6 +808,7 @@
 					contact: ''
 					contact: ''
 				},
 				},
 				dialog_delete_room: false, // 删除房间
 				dialog_delete_room: false, // 删除房间
+				delete_room_index: '', // 记录需要删除的房间index
 				show_delete_room: '', // 记录需要删除的房间
 				show_delete_room: '', // 记录需要删除的房间
 				dialog_delete_air: false, // 删除空调
 				dialog_delete_air: false, // 删除空调
 				show_modify_room: '', // 记录需要修改的房间
 				show_modify_room: '', // 记录需要修改的房间
@@ -1128,6 +1140,10 @@
 			 * @param {Object} room
 			 * @param {Object} room
 			 */
 			 */
 			dialog_delete_rooms_click(room) {
 			dialog_delete_rooms_click(room) {
+				if (this.currentData.rooms[this.delete_room_index].tableData.length > 0) {
+					this.$message.error('房间中有设备,不能删除!');
+					return;
+				}
 				let data = this.currentData.title_any_where.split('-')
 				let data = this.currentData.title_any_where.split('-')
 				delRooms({
 				delRooms({
 					school: data[0],
 					school: data[0],
@@ -1230,7 +1246,7 @@
 								})
 								})
 								tmpBuilds.id = builds[j].id
 								tmpBuilds.id = builds[j].id
 								tmpBuilds.label = builds[j].building
 								tmpBuilds.label = builds[j].building
-								tmpBuilds.isShow = false
+								tmpBuilds.isShow = true
 								tmpBuilds.children = []
 								tmpBuilds.children = []
 								tmpBuilds.children = tmpFloors
 								tmpBuilds.children = tmpFloors
 								// 放入楼栋
 								// 放入楼栋
@@ -1993,10 +2009,9 @@
 								let indexs = _this.navData_positioning(labels, 'label', 1);
 								let indexs = _this.navData_positioning(labels, 'label', 1);
 								let i = indexs[0];
 								let i = indexs[0];
 								_this.navData[i].children.push({
 								_this.navData[i].children.push({
-									// id: res.data.id, 
-									id: 100000,
+									id: res.data.id, 
 									label: _this.form_add_loudong.building,
 									label: _this.form_add_loudong.building,
-									isShow: false,
+									isShow: true,
 									children: []
 									children: []
 								});
 								});
 								_this.navData[i].children.sort((a, b) => a.label.localeCompare(b.label));
 								_this.navData[i].children.sort((a, b) => a.label.localeCompare(b.label));
@@ -2037,8 +2052,7 @@
 								let i = indexs[0];
 								let i = indexs[0];
 								let j = indexs[1];
 								let j = indexs[1];
 								_this.navData[i].children[j].children.push({
 								_this.navData[i].children[j].children.push({
-									// id: res.data.id, 
-									id: 1,
+									id: res.data.id, 
 									label: _this.form_add_louceng.floor,
 									label: _this.form_add_louceng.floor,
 									rooms: []
 									rooms: []
 								});
 								});
@@ -2230,9 +2244,10 @@
 			/**
 			/**
 			 * 操作删除房间
 			 * 操作删除房间
 			 */
 			 */
-			operate_delete_room(room) {
-				this.show_delete_room = room
-				this.dialog_delete_room = true
+			operate_delete_room(index, room) {
+				this.delete_room_index = index;
+				this.show_delete_room = room;
+				this.dialog_delete_room = true;
 			},
 			},
 			/**
 			/**
 			 * 操作删除空调
 			 * 操作删除空调
@@ -2707,6 +2722,11 @@
 												font-family: Microsoft YaHei-3970(82674968);
 												font-family: Microsoft YaHei-3970(82674968);
 												color: #2B4CFE;
 												color: #2B4CFE;
 											}
 											}
+
+											.deletenone {
+												color: #CCCCCC;
+												cursor: not-allowed;
+											}
 										}
 										}
 									}
 									}