Browse Source

解决若干问题

soft5566 3 years ago
parent
commit
dc8895e2d0

+ 3 - 0
src/api/accountMgr.js

@@ -18,6 +18,7 @@ export function addAccount(param) {
 		admin_name: param.username,
 		phone: param.phone,
 		password: param.password,
+		user_name: param.fullname,
 		level: param.checkedRole[0] == '超级管理员' ? 2 : 1,
 		remark: param.comment
 	}
@@ -35,9 +36,11 @@ export function modifyAccount(param) {
 		admin_name: param.username,
 		phone: param.phone,
 		password: param.password,
+		user_name: param.fullname,
 		level: param.checkedRole[0] == '超级管理员' ? 2 : 1,
 		remark: param.comment
 	}
+	console.log(data);
 	return request({
 		url: '/airManage/adminupdate.action',
 		method: 'post',

+ 19 - 18
src/router/index.js

@@ -131,7 +131,22 @@ export const constantRoutes = [{
 			}
 		}]
 	},
-	
+
+	{
+		path: '/operationRecord',
+		component: Layout,
+		redirect: '/operationRecord',
+		children: [{
+			path: 'operationRecord',
+			name: 'SystemSet',
+			component: () => import('@/views/operationRecord/index'),
+			meta: {
+				title: '操作日志',
+				icon: 'operationRecord'
+			}
+		}]
+	},
+
 	{
 		path: '/feilvSet',
 		component: Layout,
@@ -146,7 +161,7 @@ export const constantRoutes = [{
 			}
 		}]
 	},
-	
+
 	{
 		path: '/systemSet',
 		component: Layout,
@@ -161,21 +176,7 @@ export const constantRoutes = [{
 			}
 		}]
 	},
-	
-	{
-		path: '/operationRecord',
-		component: Layout,
-		redirect: '/operationRecord',
-		children: [{
-			path: 'operationRecord',
-			name: 'SystemSet',
-			component: () => import('@/views/operationRecord/index'),
-			meta: {
-				title: '操作日志',
-				icon: 'operationRecord'
-			}
-		}]
-	},
+
 	// 404页面 必须放在最后!!
 	{
 		path: '*',
@@ -200,4 +201,4 @@ export function resetRouter() {
 	router.matcher = newRouter.matcher // reset router
 }
 
-export default router
+export default router

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

@@ -381,7 +381,7 @@
 				tableData: [],
 				// 分页参数
 				pagination: {
-					pageSize: 10,
+					pageSize: 9,
 					currentPage: 1,
 					total: 0
 				},

+ 3 - 3
src/views/consumptionRecord/index.vue

@@ -6,7 +6,7 @@
 					<div class="cell-title">
 						<div class="title-left">
 							<div class="title">消费记录</div>
-							<div class="title-detail">总余额:{{total_balance}}元</div>
+							<!-- <div class="title-detail">总余额:{{total_balance}}元</div> -->
 							<div class="title-detail">总消费:{{total_consumption}}元</div>
 							<div class="title-detail">总交易笔数:{{total_number}}笔</div>
 						</div>
@@ -123,7 +123,7 @@
 	export default {
 		data() {
 			return {
-				total_balance: 0.0.toFixed(2), // 总余额
+				// total_balance: 0.0.toFixed(2), // 总余额
 				total_consumption: 0.0.toFixed(2), // 总消费
 				total_number: 0, // 总交易笔数
 				formLabelWidth: '120px',
@@ -275,7 +275,7 @@
 				getThreeData(this.cond_data).then((res) => {
 					// console.log(res);
 					if (res.code == 200) {
-						this.total_balance = res.TotalYe.toFixed(2) // 总余额
+						// this.total_balance = res.TotalYe.toFixed(2) // 总余额
 						this.total_consumption = res.zongConsume.toFixed(2) // 总消费
 						this.total_number = res.zongRecord // 总交易笔数
 					} else {

+ 36 - 27
src/views/feilvSet/index.vue

@@ -11,8 +11,8 @@
 						</div>
 					</div>
 					<div class="cell-body">
-						<el-table :data="tableData" height="610" style="width: 100%" :cell-style="cell_style"
-							v-loading="loading" :header-cell-style="header_cell_style">
+						<el-table :data="tableData" height="610" style="width: 100%" :cell-style="cell_style" v-loading="loading"
+							:header-cell-style="header_cell_style">
 							<!-- <el-table-column label="id" align="center" width="100">
 								<template slot-scope="scope">
 									<span>{{scope.row.id}}</span>
@@ -63,16 +63,17 @@
 			</div>
 		</el-dialog> -->
 		<!-- 修改费率对话框 -->
-		<el-dialog title="修改费率" custom-class="modify-feilv-dialog" :visible.sync="dialogModifyFeilvVisible"
-			:close-on-click-modal="false" :close-on-press-escape="false" @close="dialog_close('modifyForm')">
+		<el-dialog title="修改费率" custom-class="modify-feilv-dialog" :visible.sync="dialogModifyFeilvVisible" :close-on-click-modal="false"
+			:close-on-press-escape="false" @close="dialog_close('modifyForm')">
 			<el-form :model="form" ref="modifyForm" :rules="modifyRules">
 				<el-form-item label="型号:" :label-width="formLabelWidth" :required="true" prop="air_config_modify">
-					<el-input v-model="form.air_config_modify" autocomplete="off" readonly="" maxlength="3" ref="modifyFeilv_focus">
+					<el-input v-model="form.air_config_modify" autocomplete="off" disabled maxlength="3">
 						<template slot="append">匹</template>
 					</el-input>
+					<!-- <span>{{ form.air_config_modify }} 匹</span> -->
 				</el-form-item>
 				<el-form-item label="费率:" :label-width="formLabelWidth" :required="true" prop="rate_modify">
-					<el-input v-model="form.rate_modify" autocomplete="off" maxlength="4">
+					<el-input v-model="form.rate_modify" autocomplete="off" maxlength="4" ref="modifyFeilv_focus">
 						<template slot="append">元</template>
 					</el-input>
 				</el-form-item>
@@ -83,8 +84,8 @@
 			</div>
 		</el-dialog>
 		<!-- 删除费率对话框 -->
-		<el-dialog custom-class="el-dialog-delete-feilv" :visible.sync="dialog_delete_feilv"
-			:close-on-click-modal="false" :close-on-press-escape="false" :show-close="false">
+		<el-dialog custom-class="el-dialog-delete-feilv" :visible.sync="dialog_delete_feilv" :close-on-click-modal="false" :close-on-press-escape="false"
+			:show-close="false">
 			<div slot="" class="del-account-body">
 				<img src="../../icons/serveAC/del_warning.png" alt="">
 				<div class="del-account-body-txt">是否确定将该【{{delForm.air_config}}】从列表中移除?</div>
@@ -124,12 +125,12 @@
 			}
 			var checkFeilv = (rule, value, callback) => {
 				if (!value) {
-					return callback(new Error('请输入费率,最多4位整数或小数!'));
+					return callback(new Error('请输入费率,最多4位整数或小数!'));
 				}
 				setTimeout(() => {
-					var reg = /^[1-9]{1,2}$|^[1-9][\.][0-9]{1,2}$/
+					var reg = /^(0\.[1-9]\d{0,1}|0\.0[1-9]{1}|[1-9]\d{0,3}(\.\d{1,2})?)$/
 					if (!reg.test(value)) {
-						callback(new Error('必须正整数或小数'));
+						callback(new Error('必须大于0的整数或小数,长度为1-4位'));
 					} else {
 						callback();
 					}
@@ -195,6 +196,13 @@
 			// 获取费率列表数据
 			this.get_list()
 		},
+		watch: {
+			'form.rate_modify': function(newValue, oldValue) {
+				// console.log('变量 form.rate_modify 的值从 ' + oldValue + ' 改变为 ' + newValue)
+				if (this.form.rate_modify == '.')
+					this.form.rate_modify = '0.';
+			}
+		},
 		methods: {
 			delete_feilv(index, row) {
 				// console.log(index, row);
@@ -215,7 +223,7 @@
 						this.$message.error('返回数据格式问题,code未获取到!')
 						return
 					}
-				
+
 					if (res.code == 200) {
 						this.dialog_delete_feilv = false
 						this.$message.success('删除费率成功!')
@@ -346,16 +354,17 @@
 			 */
 			modifyFeilv_dialog(index, row) {
 				// console.log(index, row);
-				this.dialogModifyFeilvVisible = true
-				this.form.id = row.id
-				this.form.air_config_modify = row.air_config.substr(0, row.air_config.length - 1)
-				this.form.rate_modify = row.rate
+				this.dialogModifyFeilvVisible = true;
+				this.form.id = row.id;
+				this.form.air_config_modify = row.air_config.substr(0, row.air_config.length - 1);
+				this.form.rate_modify = row.rate;
+				var _this = this;
 				// 使金额输入框input_amount获得焦点
 				setTimeout(() => {
-					this.$nextTick(() => {
-						this.$refs.modifyFeilv_focus.focus()
-					})
-				}, 100)
+					_this.$nextTick(() => {
+						const input = _this.$refs.modifyFeilv_focus.focus();
+					});
+				}, 100);
 			},
 			/**
 			 * 对话框关闭时清理数据
@@ -478,10 +487,10 @@
 				}
 
 				// .el-input__inner {
-					
+
 				// }
 			}
-			
+
 			// 删除对话框的样式
 			.del-account-body {
 				display: flex;
@@ -489,11 +498,11 @@
 				justify-content: center;
 				align-items: center;
 				height: 180px;
-			
+
 				img {
 					width: 72px;
 				}
-			
+
 				.del-account-body-txt {
 					height: 58px;
 					line-height: 58px;
@@ -540,13 +549,13 @@
 	.modify-feilv-dialog {
 		height: 300px !important;
 	}
-	
+
 	.el-dialog-delete-feilv {
 		height: 300px !important;
 		width: 460px !important;
 	}
-	
+
 	.el-dialog-delete-feilv .el-dialog__header {
 		display: none !important;
 	}
-</style>
+</style>

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

@@ -549,7 +549,7 @@
 						// this.$message.error('本月充值:' + res.message)
 					} else {
 						this.showThisMonthRecharge.time = getFormatDateTime('datetime');
-						this.$message.error('本月充值:' + res.message)
+						// this.$message.error('本月充值:' + res.message)
 					}
 				}).catch((err) => {
 					// console.log(err);

+ 3 - 44
src/views/operationRecord/index.vue

@@ -17,7 +17,7 @@
 					<div class="cell-body">
 						<el-form :inline="true" :model="formInline" class="demo-form-inline">
 							<el-form-item label="关键字:">
-								<el-input v-model="formInline.user" clearable placeholder="请输入姓名或身份证"></el-input>
+								<el-input v-model="formInline.user" clearable placeholder="请输入操作人姓名"></el-input>
 							</el-form-item>
 							<el-form-item>
 								<el-button type="warning" @click="btn_search">查询</el-button>
@@ -29,8 +29,9 @@
 									format="yyyy-MM-dd HH:mm:ss" clearable>
 								</el-date-picker>
 							</el-form-item>
-							<el-form-item label="">
+							<el-form-item label="操作:">
 								<el-select v-model="formInline.re_state" clearable placeholder="请选择" @change="search_state_change">
+									<el-option label="全部" value=""></el-option>
 									<el-option label="补充" value="补充"></el-option>
 									<el-option label="赠送" value="赠送"></el-option>
 								</el-select>
@@ -43,48 +44,6 @@
 									<span>{{(pagination.currentPage - 1) * pagination.pageSize + scope.$index + 1}}</span>
 								</template>
 							</el-table-column>
-							<!-- <el-table-column label="姓名" align="center" width="100">
-								<template slot-scope="scope">
-									<span>{{ scope.row.user_name }}</span>
-								</template>
-							</el-table-column>
-							<el-table-column label="手机" align="center" width="180">
-								<template slot-scope="scope">
-									<span>{{ scope.row.phone }}</span>
-								</template>
-							</el-table-column>
-							<el-table-column label="充值金额(元)" align="center" width="200">
-								<template slot-scope="scope">
-									<span>{{ scope.row.account }}</span>
-								</template>
-							</el-table-column>
-							<el-table-column label="账户余额(元)" align="center" width="200">
-								<template slot-scope="scope">
-									<span>{{ scope.row.balance }}</span>
-								</template>
-							</el-table-column>
-							<el-table-column label="充值类型" align="center" width="150">
-								<template slot-scope="scope">
-									<span v-if="scope.row.re_state == '补充'" class="txt-cell-green">{{ scope.row.re_state }}</span>
-									<span v-else class="txt-cell-red">{{ scope.row.re_state }}</span>
-								</template>
-							</el-table-column>
-							<el-table-column label="操作账号" align="center">
-								<template slot-scope="scope">
-									<span>{{ scope.row.cao }}</span>
-								</template>
-							</el-table-column>
-							<el-table-column label="交易流水号" align="center">
-								<template slot-scope="scope">
-									<span>{{ scope.row.order_num }}</span>
-								</template>
-							</el-table-column>
-							<el-table-column label="支付时间" align="center">
-								<template slot-scope="scope">
-									<span>{{ scope.row.time }}</span>
-								</template>
-							</el-table-column> -->
-							
 							<el-table-column label="操作账号" align="center">
 								<template slot-scope="scope">
 									<span>{{ scope.row.user_name }}</span>

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

@@ -456,10 +456,11 @@
 					</div>
 				</el-form-item>
 				<el-form-item label="操作员:" :label-width="formLabelWidth" prop="cao">
-					<el-input v-model="cao" autocomplete="off" placeholder="请输入操作员" ref="ref_cao" readonly="" maxlength="10"></el-input>
+					<el-input v-model="form_add_device.cao" autocomplete="off" placeholder="请输入操作员" ref="ref_cao" maxlength="10"></el-input>
 				</el-form-item>
 				<el-form-item label="手机号码:" :label-width="formLabelWidth" prop="contact">
-					<el-input v-model="contact" autocomplete="off" placeholder="请输入手机号码" ref="ref_contact" maxlength="11" readonly=""></el-input>
+					<el-input v-model="form_add_device.contact" autocomplete="off" placeholder="请输入手机号码" ref="ref_contact" maxlength="11"
+						readonly=""></el-input>
 				</el-form-item>
 				<el-form-item label="设备名称:" :label-width="formLabelWidth" prop="deviceName" :required="true">
 					<el-input v-model="form_add_device.deviceName" autocomplete="off" placeholder="请输入设备名称" ref="ref_deviceName" maxlength="10"></el-input>
@@ -599,20 +600,23 @@
 				// }, 100);
 			};
 
-			// var checkCao = (rule, value, callback) => {
-			// 	if (!value) {
-			// 		return callback(new Error('请输入操作员'));
-			// 	};
+			var checkCao = (rule, value, callback) => {
+				if (!value) {
+					return callback(new Error('请输入操作员'));
+				};
 
-			// 	setTimeout(() => {
-			// 		var reg = /^[\u4e00-\u9fa5]{2,10}$/
-			// 		if (!reg.test(value)) {
-			// 			callback(new Error('必须为2-10个汉字!'));
-			// 		} else {
-			// 			callback();
-			// 		}
-			// 	}, 100);
-			// };
+				setTimeout(() => {
+					callback();
+				}, 100);
+				// setTimeout(() => {
+				// 	var reg = /^[\u4e00-\u9fa5]{2,10}$/
+				// 	if (!reg.test(value)) {
+				// 		callback(new Error('必须为2-10个汉字!'));
+				// 	} else {
+				// 		callback();
+				// 	}
+				// }, 100);
+			};
 
 			// var checkcontact = (rule, value, callback) => {
 			// 	if (!value) {
@@ -665,9 +669,7 @@
 				}
 			};
 			return {
-				hideOnSinglePage: true, // 只有一页时是否隐藏
-				cao: this.$store.state.user.user_name, // 操作员
-				contact: this.$store.state.user.phone,
+				hideOnSinglePage: true, // 只有一页时是否隐藏				
 				room_number: 0, // 房间数量
 				device_number: 0, // 设备数量
 				offline_device_number: 0, // 离线数量
@@ -727,6 +729,8 @@
 				// 添加设备
 				dialog_add_device: false,
 				form_add_device: { // 添加设备数据
+					cao: this.$store.state.user.name, // 操作员
+					contact: this.$store.state.user.phone, // 操作员手机号
 					school: '',
 					build: '',
 					floors: '',
@@ -749,9 +753,9 @@
 					checkedDevice: [{
 						validator: checkCheckedDevice
 					}],
-					// cao: [{
-					// 	validator: checkCao
-					// }],
+					cao: [{
+						validator: checkCao
+					}],
 					// contact: [{
 					// 	validator: checkcontact
 					// }]
@@ -1841,7 +1845,6 @@
 			dialog_add_air_click() {
 				this.$refs["add_device_form"].validate(validate => {
 					if (validate) {
-						// console.log(this.form_add_device);
 						addAirs(this.form_add_device).then((res) => {
 							// console.log(res);
 							if (typeof res.code == 'undefined' || res.code == '') {
@@ -2023,7 +2026,10 @@
 				}
 
 				if (param == 'form_add_device') {
+					var tmpdevices = this.form_add_device.devices;
 					this.form_add_device = {
+						cao: this.$store.state.user.name, // 操作员
+						contact: this.$store.state.user.phone, // 操作员手机号
 						school: '',
 						build: '',
 						floors: '',
@@ -2031,7 +2037,7 @@
 						deviceName: '',
 						deviceIp: '',
 						checkedDevice: [],
-						devices: [],
+						devices: tmpdevices,
 						duration_use: 0.00, // 使用时长
 						is_normal: '0', // 是否正常
 						is_on: '0', // 是否开启

+ 1 - 0
src/views/systemSet/index.vue

@@ -247,6 +247,7 @@
 							end_jian: this.formData.end_jian,
 							overtime: this.formData.overtime
 						}
+						// console.log(params);
 						// 开始发送更新配置请求
 						updateSet(params).then((res) => {
 							// console.log(res);