Просмотр исходного кода

楼层、房间输入解除约束

程志平 3 лет назад
Родитель
Сommit
1746a07443
1 измененных файлов с 71 добавлено и 59 удалено
  1. 71 59
      src/views/serveAC/index.vue

+ 71 - 59
src/views/serveAC/index.vue

@@ -13,7 +13,7 @@
 							:style="{display: item0.isShow ? '' : 'none'}">
 							<div class="loudong"
 								@click="loudong_toggle(item1.id + '|' + item0.id, item1.label + '|'+ item0.label)">
-								<div>{{item1.label}}</div>
+								<div class="louidong_text" :title="item1.label">{{item1.label}}</div>
 								<i v-if="item1.isShow" class="el-icon-arrow-down"></i>
 								<i v-else class="el-icon-arrow-right"></i>
 							</div>
@@ -407,7 +407,7 @@
 				</el-form-item>
 				<el-form-item label="楼栋:" :label-width="formLabelWidth" prop="building" :required="true">
 					<el-input v-model="form_add_loudong.building" autocomplete="off" placeholder="请输入楼栋名称"
-						ref="ref_loudong" maxlength="10"></el-input>
+						ref="ref_loudong" maxlength="15"></el-input>
 				</el-form-item>
 			</el-form>
 			<div slot="footer" class="dialog-footer">
@@ -426,8 +426,8 @@
 					<div>{{form_add_louceng.building}}</div>
 				</el-form-item>
 				<el-form-item label="楼层:" :label-width="formLabelWidth" prop="floor" :required="true">
-					<el-input v-model="form_add_louceng.floor" autocomplete="off" placeholder="请输入楼层号"
-						ref="ref_louceng" maxlength="1" @keydown.enter.native="dialog_add_louceng_click"></el-input>
+					<el-input v-model="form_add_louceng.floor" autocomplete="off" placeholder="请输入楼层号" ref="ref_louceng"
+						maxlength="1" @keydown.enter.native="dialog_add_louceng_click"></el-input>
 				</el-form-item>
 			</el-form>
 			<div slot="footer" class="dialog-footer">
@@ -523,8 +523,9 @@
 					<div>{{form_modify_room.floor}}</div>
 				</el-form-item>
 				<el-form-item label="房间:" :label-width="formLabelWidth" :required="true" prop="room">
-					<el-input v-model="form_modify_room.room" autocomplete="off" placeholder="请输入房间号" ref="ref_modi_room"
-						maxlength="4" @keydown.enter.native="dialog_modify_room_click(show_modify_room)"></el-input>
+					<el-input v-model="form_modify_room.room" autocomplete="off" placeholder="请输入房间号"
+						ref="ref_modi_room" maxlength="4"
+						@keydown.enter.native="dialog_modify_room_click(show_modify_room)"></el-input>
 				</el-form-item>
 			</el-form>
 			<div slot="footer" class="dialog-footer">
@@ -579,19 +580,19 @@
 	const deviceOptions = ['1匹', '1.5匹', '2匹', '3匹', '天花机器(3匹)'];
 	export default {
 		data() {
-			var checkloudong = (rule, value, callback) => {
-				if (!value) {
-					return callback(new Error('请输入楼栋名称'));
-				}
-				setTimeout(() => {
-					var reg = /^[a-zA-Z0-9_\u4e00-\u9fa5]{2,10}$/
-					if (!reg.test(value)) {
-						callback(new Error('必须为2-10个汉字、数字、字母或下划线!'));
-					} else {
-						callback();
-					}
-				}, 100);
-			}
+			// var checkloudong = (rule, value, callback) => {
+			// 	if (!value) {
+			// 		return callback(new Error('请输入楼栋名称'));
+			// 	}
+			// 	setTimeout(() => {
+			// 		var reg = /^[a-zA-Z0-9_\u4e00-\u9fa5]{2,10}$/
+			// 		if (!reg.test(value)) {
+			// 			callback(new Error('必须为2-10个汉字、数字、字母或下划线!'));
+			// 		} else {
+			// 			callback();
+			// 		}
+			// 	}, 100);
+			// }
 			var checklouceng = (rule, value, callback) => {
 				if (!value) {
 					return callback(new Error('请输入数字楼层号'));
@@ -605,24 +606,24 @@
 					}
 				}, 100);
 			}
-			var checkroom = (rule, value, callback) => {
-				if (!value) {
-					return callback(new Error('请输入房间号'));
-				}
-
-				setTimeout(() => {
-					var regH = /[\d]$/g;
-					var floor = this.currentData.floor.replace(regH, '');
-					var reg = /[1-9]{1}[0-9]{2,3}$/
-					if (value.indexOf(floor)) {
-						callback(new Error('房间号数字部分,必须以楼层号开头!'));
-					} else if (!reg.test(value)) {
-						callback(new Error('房间号数字部分,为3-4个数字,非0开头!栋号不需要添加!'));
-					} else {
-						callback();
-					}
-				}, 100);
-			}
+			// var checkroom = (rule, value, callback) => {
+			// 	if (!value) {
+			// 		return callback(new Error('请输入房间号'));
+			// 	}
+
+			// 	setTimeout(() => {
+			// 		var regH = /[\d]$/g;
+			// 		var floor = this.currentData.floor.replace(regH, '');
+			// 		var reg = /[1-9]{1}[0-9]{2,3}$/
+			// 		if (value.indexOf(floor)) {
+			// 			callback(new Error('房间号数字部分,必须以楼层号开头!'));
+			// 		} else if (!reg.test(value)) {
+			// 			callback(new Error('房间号数字部分,为3-4个数字,非0开头!栋号不需要添加!'));
+			// 		} else {
+			// 			callback();
+			// 		}
+			// 	}, 100);
+			// }
 			var checkCao = (rule, value, callback) => {
 				if (!value) {
 					return callback(new Error('请输入操作员'));
@@ -699,11 +700,11 @@
 					school: '',
 					building: ''
 				},
-				form_add_loudong_rules: { // 添加楼栋表单验证
-					building: [{
-						validator: checkloudong
-					}]
-				},
+				// form_add_loudong_rules: { // 添加楼栋表单验证
+				// 	building: [{
+				// 		validator: checkloudong
+				// 	}]
+				// },
 				// 添加楼层
 				dialog_add_louceng: false,
 				form_add_louceng: { // 添加楼层数据
@@ -724,11 +725,11 @@
 					floor: '',
 					room: ''
 				},
-				form_add_room_rules: { // 添加房间表单验证
-					room: [{
-						validator: checkroom
-					}]
-				},
+				// form_add_room_rules: { // 添加房间表单验证
+				// 	room: [{
+				// 		validator: checkroom
+				// 	}]
+				// },
 				// 修改房间
 				dialog_modify_room: false,
 				form_modify_room: { // 修改房间数据
@@ -737,11 +738,11 @@
 					floor: '',
 					room: ''
 				},
-				form_modify_room_rules: { // 修改房间表单验证
-					room: [{
-						validator: checkroom
-					}]
-				},
+				// form_modify_room_rules: { // 修改房间表单验证
+				// 	room: [{
+				// 		validator: checkroom
+				// 	}]
+				// },
 				// 添加设备
 				dialog_add_device: false,
 				form_add_device: { // 添加设备数据
@@ -1117,7 +1118,11 @@
 						this.$message.error('返回数据格式问题,code未获取到!');
 						return;
 					}
-					// console.log(res.data);
+					console.log(res.data);
+					if (typeof res.data == 'undefined' || res.data == '') {
+						this.$message.error('返回数据格式问题,data未获取到!');
+						return;
+					}
 					// 校区
 					let school = JSON.parse(res.data);
 					// console.log('school', school);
@@ -1896,9 +1901,9 @@
 				this.form_modify_room.room = room.split('-')[1]
 				this.show_modify_room = room
 				this.dialog_modify_room = true
-				
-				setTimeout(()=>{
-					this.$nextTick(()=>{
+
+				setTimeout(() => {
+					this.$nextTick(() => {
 						this.$refs.ref_modi_room.focus()
 					})
 				}, 500)
@@ -2090,10 +2095,9 @@
 					box-shadow: 0px 3px 21px 0px rgba(60, 108, 254, 0.16);
 
 					.item-school {
-						margin-top: 20px;
+						margin-top: 0px;
 
-						.school,
-						.loudong {
+						.school {
 							display: flex;
 							justify-content: space-between;
 							align-items: center;
@@ -2103,6 +2107,7 @@
 							font-weight: bold;
 							color: #EDF0F5;
 							cursor: pointer;
+							white-space: nowrap;
 						}
 
 						.item-loudong {
@@ -2120,6 +2125,13 @@
 								font-weight: bold;
 								color: #2B4CFE;
 								cursor: pointer;
+
+								.louidong_text {
+									white-space: nowrap;
+									width: 260px;
+									overflow: hidden;
+									text-overflow: ellipsis;
+								}
 							}
 
 							.item-louceng {