<style lang='scss' scoped>
	.addMaintenancePeople{
		width: 100%;
		padding: $paddingTB $paddingLR;
		&-bottom{
			position: absolute;
			left: 0;
			bottom: 30rpx;
			width: 100%;
			padding: 0 $paddingLR;
			
		}
	}
</style>
<template>
	<view class="addMaintenancePeople">
		<u-form :model="form" ref="uForm" label-width="160">
			<u-form-item required label="人员姓名" prop="name"><u-input v-model="form.name" /></u-form-item>
			<u-form-item required label="联系方式" prop="phonenumber"><u-input v-model="form.phonenumber" /></u-form-item>
		</u-form>
		<view class="addMaintenancePeople-bottom">
			<u-button class="addMaintenancePeople-bottom-btn" type="primary" @click="onSubmitFn">提交</u-button>
		</view>
		
	</view>
</template>
<script>
	export default {
		data() {
			return {
				form: {
					name: '',
					phonenumber: '',
				},
				rules: {
					name: [
						{
							required: true,
							message: '请填写姓名',
							trigger: ['change','blur']
						},
					],
					phonenumber:[{
							required: true,
							message: '请填写联系方式',
							trigger: ['change']
						}]
				}
			}
		},
		onLoad() {},
		onReady() {
			this.$refs.uForm.setRules(this.rules);
		},
		methods: {
			onSubmitFn() {
				this.$refs.uForm.validate((valid) => {
					console.log(valid,"valid");
					if (valid) {
						console.log('验证通过');
					} else {
						console.log('验证失败');
					}
				});
			}
		}
	}
</script>
