<template>
	<view class="appWrapper">

		<form action="">
			<view style="height:30rpx"></view>
			<view class="form-item">
				<view class="title">
					<text class="necessary">*</text>
					联系方式:
				</view>
				<input name="input" v-model="formMess.deviceNo"></input>
			</view>
			<view class="form-item">
				<view class="title">姓名:</view>
				<input name="input" v-model="formMess.deviceName"></input>
			</view>

			<view class="form-item">
				<view class="title">所在单位:</view>
				<select name="" id="">
					<option value="">虹泾总部园</option>
					<option value="">单位二</option>
					<option value="">单位三</option>
				</select>
			</view>

			<view class="form-item">
				<view class="title">角色权限:</view>
				<radio-group name="gender">
					<label class="margin-right">
						<radio value="管理员" checked /><text>管理员</text>
					</label>
					<label>
						<radio value="普通员工" /><text>普通员工</text>
					</label>
				</radio-group>
			</view>


			<view class="btn-area submitBottomBtn padding-lr-sm">
				<button class="bg-blue round  margin-top" @click="submit()">提 交 </button>
			</view>
		</form>


	</view>
</template>

<script>
	var graceChecker = require("../../../common/graceChecker.js");
	// import add from '../../common/select.js';
	export default {

		data() {
			return {
				index: -1,
				picker: ['楼层一', '楼层二', '楼层三'],
				type: '0',

				isShow: false,
				formMess: {
					"userName": "sss",
					"siteName": "",
					"place": "",
					"longitude": "",
					"dimension": "",
					"contactor": "",
					"mobile": "",
				},

				// 站点多选下拉
				siteItemData: ["站点一", "站点二", "站点三", "站点四", "站点五", "站点六"],
				newDataList: ["站点一", "站点二", "站点三", "站点四", "站点五", "站点六"],

				selectedData: [],
				// 站点多选下拉 end


			}
		},
		onLoad: function(option) {

		},
		methods: {
			submit() {
				uni.navigateTo({
					url: '/pages/accountManage/success/success',
					
				});
			},
			add: function(item, index) {
				this.selectedData.push(item);
				this.newDataList.splice(index, 1);
				this.isShow = false;
				this.formMess.siteName = ''
			},
			deleteItem: function(item, index) {
				// this.selectedData.remove(item);
				this.selectedDaxta.splice(index, 1);
				this.newDataList.push(item);


			},

			// 站点多选下拉
			test: function() {
				this.isShow = !this.isShow;
			},
			test2: function() {
				this.isShow = false;
			},
			handleInput() {
				// var newlist = this.siteItemData.filter(item => item.indexOf(this.formMess.siteName) > -1)
				// this.newDataList = newlist;
				// console.log(this.newDataList)
			},
			// 站点多选下拉 end



			formSubmit: function(e) {
				console.log('form发生了submit事件，携带数据为：' + JSON.stringify(e.detail.value))
				//定义表单规则
				var rule = [{
						name: "userName",
						checkType: "string",
						checkRule: "1,3",
						errorMsg: "姓名应为1-3个字符..."
					},
					// {name:"gender", checkType : "in", checkRule:"男,女",  errorMsg:"请选择性别"},
					// {name:"loves", checkType : "notnull", checkRule:"",  errorMsg:"请选择爱好"}
				];
				//进行表单检查
				var formData = e.detail.value;
				var checkRes = graceChecker.check(formData, rule);
				if (checkRes) {
					uni.showToast({
						title: "验证通过!",
						icon: "none"
					});
				} else {
					uni.showToast({
						title: graceChecker.error,
						icon: "none"
					});
				}
			},
			formReset: function(e) {
				console.log('清空数据')
			}





		}
	}
</script>




<style lang="scss">
	.cu-form-group {
		border-top: 0;

	}

	input,
	select,
	option {
		line-height: 70rpx;
		padding: 0 20rpx;
		height: 70rpx;
		border: 1px solid #EDEDED;
		// width:500rpx!important;
		background-color: #fff;
		box-sizing: border-box;
		appearance: none;
		-moz-appearance: none;
		-webkit-appearance: none;
		color: #999;


	}

	select:focus,
	select:active,
	select:hover {
		outline: none;
	}

	select {
		background: url(../../../static/arrow.png) no-repeat scroll 98% center;
		background-size: 6%;
	}

	.form-item label text {
		position: relative;
		top: 2rpx
	}

	.form-item {
		padding: 0 40rpx;
		display: flex;
		align-items: top;
		margin-bottom: 20rpx;


		.title {
			width: 170rpx;
			position: relative;

			.necessary {
				color: red;
				display: inline-block;
				position: absolute;
				top: -2rpx;
				left: -20rpx;
				font-size: 40rpx;

			}
		}

		input,
		select {
			width: 500rpx;
			font-size: 28rpx;
		}


	}





	/* 站点多选下拉样式 start */

	.layui-btn {
		background-color: #5fb878;
	}

	a {
		text-decoration: none;
	}

	.label {
		padding: 2px 0px;
		background: #aaa;
		border-radius: 2px;
		color: #fff;
		display: block;
		line-height: 20px;
		height: 20px;
		margin: 2px 5px 2px 0;
		float: left;
	}

	.label span {
		padding: 0 5px;
		color: #fff;
	}

	.close {
		padding: 1px 5px !important;
	}

	.close:hover {
		/* background-color: #009E94;
	    border-radius: 2px;
	    color: tomato; */
	}

	.selectId input {
		width: 100% !important;
	}

	.selectId input {
		height: 25px;
		padding: 1px 5px;
		border-radius: 3px;
		width: calc(100% - 12px);
		outline-color: #5fb878;
		border: 1px solid #5fb878;
	}

	.selectId {
		position: relative;
	}

	.selectId dl {
		border: 1px solid #eee;
		border-radius: 3px;
		margin: 2px 0px;
		max-height: 300px;
		overflow-x: hidden;
		white-space: nowrap;
		position: absolute;
		width: 100%;
		top: 40px;
		background: #fff;
		z-index: 1000
	}

	.selectId dl dd {
		margin: 0;
		padding: 5px 10px;
	}

	.selectId dl dd:hover {
		background-color: #5FB878;
		color: white;
	}

	.AD {
		/* width: 210px;
	        margin-left: 40px; */
		overflow-y: auto;
		max-height: 200px;
		/* border: 2px solid #5fb878;
	        border-radius: 6px;
	        padding: 1px 2px; */
	}

	form .AD span {
		width: auto;
	}

	.siteSelect {
		width: 71%;
		display: inline-block;
	}


	/* 站点多选下拉样式end */
</style>
