Quellcode durchsuchen

界面和功能优化

程志平 vor 4 Jahren
Ursprung
Commit
89debaf4de
2 geänderte Dateien mit 70 neuen und 18 gelöschten Zeilen
  1. 7 6
      src/api/serveAC.js
  2. 63 12
      src/views/serveAC/index.vue

+ 7 - 6
src/api/serveAC.js

@@ -77,11 +77,12 @@ export function addAirs(forData) {
 		floors: forData.floors,
 		floors: forData.floors,
 		dom: forData.room,
 		dom: forData.room,
 		air_ip: forData.deviceIp,
 		air_ip: forData.deviceIp,
-		air_config: forData.checkedDevice[0]
-		// duration_use: 0.01, // 使用时长
-		// is_normal: "1", // 是否正常
-		// is_on: "0", // 是否开启
-		// cao: "张三" // 操作员
+		air_config: forData.checkedDevice[0],
+		duration_use: forData.duration_use, // 使用时长
+		is_normal: forData.is_normal, // 是否正常
+		is_on: forData.is_on, // 是否开启
+		cao: forData.cao, // 操作员
+		contact: forData.contact
 	}
 	}
 
 
 	return request({
 	return request({
@@ -105,4 +106,4 @@ export function deleteAirs(forData) {
 		method: 'post',
 		method: 'post',
 		data
 		data
 	})
 	})
-}
+}

+ 63 - 12
src/views/serveAC/index.vue

@@ -454,6 +454,14 @@
 					<div>{{form_add_device.school + ' / ' + form_add_device.build + ' / ' + form_add_device.floors}}
 					<div>{{form_add_device.school + ' / ' + form_add_device.build + ' / ' + form_add_device.floors}}
 					</div>
 					</div>
 				</el-form-item>
 				</el-form-item>
+				<el-form-item label="操作员:" :label-width="formLabelWidth" prop="cao" :required="true">
+					<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" :required="true">
+					<el-input v-model="form_add_device.contact" autocomplete="off" placeholder="请输入手机号码"
+						ref="ref_contact" maxlength="11"></el-input>
+				</el-form-item>
 				<el-form-item label="设备名称:" :label-width="formLabelWidth" prop="deviceName" :required="true">
 				<el-form-item label="设备名称:" :label-width="formLabelWidth" prop="deviceName" :required="true">
 					<el-input v-model="form_add_device.deviceName" autocomplete="off" placeholder="请输入设备名称"
 					<el-input v-model="form_add_device.deviceName" autocomplete="off" placeholder="请输入设备名称"
 						ref="ref_deviceName" maxlength="10"></el-input>
 						ref="ref_deviceName" maxlength="10"></el-input>
@@ -560,6 +568,34 @@
 					}
 					}
 				}, 100);
 				}, 100);
 			}
 			}
+			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);
+			}
+			var checkcontact = (rule, value, callback) => {
+				if (!value) {
+					return callback(new Error('请输入手机号码'));
+				}
+			
+				setTimeout(() => {
+					var reg = /^((13[0-9])|(14[0|5|6|7|9])|(15[0-3])|(15[5-9])|(16[6|7])|(17[2|3|5|6|7|8])|(18[0-9])|(19[1|8|9]))\d{8}$/
+					if (!reg.test(value)) {
+						callback(new Error('手机号码输入不规范!'));
+					} else {
+						callback();
+					}
+				}, 100);
+			}
 			var checkDeviceName = (rule, value, callback) => {
 			var checkDeviceName = (rule, value, callback) => {
 				if (!value) {
 				if (!value) {
 					return callback(new Error('请输入设备名称'));
 					return callback(new Error('请输入设备名称'));
@@ -647,7 +683,12 @@
 					deviceName: '',
 					deviceName: '',
 					deviceIp: '',
 					deviceIp: '',
 					checkedDevice: [],
 					checkedDevice: [],
-					devices: deviceOptions
+					devices: deviceOptions,
+					duration_use: 0.00, // 使用时长
+					is_normal: '0', // 是否正常
+					is_on: '0', // 是否开启
+					cao: '', // 操作员
+					contact: ''
 				},
 				},
 				form_add_device_rules: {
 				form_add_device_rules: {
 					deviceName: [{
 					deviceName: [{
@@ -658,6 +699,12 @@
 					}],
 					}],
 					checkedDevice: [{
 					checkedDevice: [{
 						validator: checkCheckedDevice
 						validator: checkCheckedDevice
+					}],
+					cao: [{
+						validator: checkCao
+					}],
+					contact: [{
+						validator: checkcontact
 					}]
 					}]
 				},
 				},
 				dialog_operator_details: false, // 操作员详情
 				dialog_operator_details: false, // 操作员详情
@@ -815,7 +862,7 @@
 									alarmStatus: data[i].is_normal == 0 ? '正常' : '异常', // 是否正常
 									alarmStatus: data[i].is_normal == 0 ? '正常' : '异常', // 是否正常
 									onOffStatus: data[i].is_on, // 是否开启
 									onOffStatus: data[i].is_on, // 是否开启
 									userName: data[i].cao, // 操作员
 									userName: data[i].cao, // 操作员
-									contact: '' // 联系方式
+									contact: '待接口返回,待优化' // 联系方式
 								}
 								}
 								// 每个房间的设备循环添加
 								// 每个房间的设备循环添加
 								tmpTableData.push(room)
 								tmpTableData.push(room)
@@ -1001,7 +1048,7 @@
 			 * @param {Object} row
 			 * @param {Object} row
 			 */
 			 */
 			alarm_status_click(index, row) {
 			alarm_status_click(index, row) {
-				// console.log(index, row);
+				console.log(index, row);
 				this.form_operator_details.name = row.userName
 				this.form_operator_details.name = row.userName
 				this.form_operator_details.contact = row.contact
 				this.form_operator_details.contact = row.contact
 				// 显示操作详情
 				// 显示操作详情
@@ -1135,7 +1182,7 @@
 									_this.currentData.clickElement.click()
 									_this.currentData.clickElement.click()
 								}, 1000)
 								}, 1000)
 								setTimeout(() => {
 								setTimeout(() => {
-									
+
 								}, 300)
 								}, 300)
 							} else {
 							} else {
 								this.$message.error(res.message)
 								this.$message.error(res.message)
@@ -1217,7 +1264,7 @@
 
 
 				setTimeout(() => {
 				setTimeout(() => {
 					this.$nextTick(() => {
 					this.$nextTick(() => {
-						this.$refs.ref_deviceName.focus()
+						this.$refs.ref_cao.focus()
 					})
 					})
 				}, 100)
 				}, 100)
 			},
 			},
@@ -1276,7 +1323,11 @@
 						deviceName: '',
 						deviceName: '',
 						deviceIp: '',
 						deviceIp: '',
 						checkedDevice: [],
 						checkedDevice: [],
-						devices: deviceOptions
+						devices: deviceOptions,
+						duration_use: 0.00, // 使用时长
+						is_normal: '0', // 是否正常
+						is_on: '0', // 是否开启
+						cao: '' // 操作员
 					}
 					}
 				}
 				}
 
 
@@ -1370,7 +1421,7 @@
 
 
 			.nav-class {
 			.nav-class {
 				.nav-box {
 				.nav-box {
-					height: 795px;
+					height: 788px;
 					overflow-x: hidden;
 					overflow-x: hidden;
 					overflow-y: scroll;
 					overflow-y: scroll;
 				}
 				}
@@ -1494,7 +1545,7 @@
 						justify-content: space-between;
 						justify-content: space-between;
 						align-items: center;
 						align-items: center;
 						margin-bottom: 20px;
 						margin-bottom: 20px;
-						padding-bottom: 30px;
+						padding-bottom: 18px;
 						border-bottom: 1px solid #CCCCCC;
 						border-bottom: 1px solid #CCCCCC;
 
 
 						.title-left {
 						.title-left {
@@ -1586,8 +1637,7 @@
 
 
 								.panel-left,
 								.panel-left,
 								.panel-right {
 								.panel-right {
-									margin-right: 0px;
-
+									
 									.panel-header {
 									.panel-header {
 										display: flex;
 										display: flex;
 										justify-content: space-between;
 										justify-content: space-between;
@@ -1674,6 +1724,7 @@
 								}
 								}
 
 
 								.panel-right {
 								.panel-right {
+									margin-right: 0px;
 									margin-left: 10px;
 									margin-left: 10px;
 								}
 								}
 							}
 							}
@@ -1684,7 +1735,7 @@
 							justify-content: flex-end;
 							justify-content: flex-end;
 							align-items: center;
 							align-items: center;
 							height: 30px;
 							height: 30px;
-							margin-top: 0;
+							margin-top: 5px;
 							padding-right: 100px;
 							padding-right: 100px;
 
 
 							::v-deep .el-pagination {
 							::v-deep .el-pagination {
@@ -1851,7 +1902,7 @@
 	}
 	}
 
 
 	.el-dialog-add-device {
 	.el-dialog-add-device {
-		height: 470px !important;
+		height: 590px !important;
 		width: 500px !important;
 		width: 500px !important;
 	}
 	}