更新
This commit is contained in:
parent
e8a4ef3f33
commit
963838d49f
@ -39,7 +39,7 @@
|
|||||||
</u-form-item>
|
</u-form-item>
|
||||||
<block value="是" v-if="residents.child>0" v-for="(item,index) in residents.child_arr" :key="'child'+index">
|
<block value="是" v-if="residents.child>0" v-for="(item,index) in residents.child_arr" :key="'child'+index">
|
||||||
<u-form-item label="年龄" required prop="child_arr.age" borderBottom>
|
<u-form-item label="年龄" required prop="child_arr.age" borderBottom>
|
||||||
<u--input v-model="item.age" :readonly="readonly" placeholder="请输入年龄" type="number"></u--input>
|
<u--input v-model="item.age" :readonly="readonly" placeholder="请输入年龄" type="number" maxlength="3"></u--input>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<block v-if="item.age<4">
|
<block v-if="item.age<4">
|
||||||
<u-form-item labelWidth="auto" label="喂养方式" borderBottom>
|
<u-form-item labelWidth="auto" label="喂养方式" borderBottom>
|
||||||
@ -82,6 +82,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
import { Toast } from "../../libs/uniApi"
|
||||||
export default {
|
export default {
|
||||||
props:{
|
props:{
|
||||||
readonly: {
|
readonly: {
|
||||||
@ -197,6 +199,15 @@
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async validate() {
|
async validate() {
|
||||||
|
let flag = false;
|
||||||
|
if(this.residents.child) this.residents.child_arr.forEach(item=>{
|
||||||
|
if(item.age==''||item.age<0||item.age>200) flag = true;
|
||||||
|
})
|
||||||
|
if(flag){
|
||||||
|
Toast('请输入年龄');
|
||||||
|
await this.$u.sleep(500);
|
||||||
|
return Promise.reject();
|
||||||
|
}
|
||||||
return this.$refs.residentsForm.validate();
|
return this.$refs.residentsForm.validate();
|
||||||
},
|
},
|
||||||
// 选择生日
|
// 选择生日
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="title">基本信息</view>
|
<view class="title">基本信息</view>
|
||||||
<u-form-item labelWidth="auto" label="姓名" required prop="name" borderBottom>
|
<u-form-item labelWidth="auto" label="姓名" required prop="name" borderBottom>
|
||||||
<u--input v-model="formData.name" placeholder="请输入姓名"></u--input>
|
<u--input v-model="formData.name" placeholder="请输入姓名(6字以内)" maxlength="6"></u--input>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item label="性别" required prop="sex" borderBottom>
|
<u-form-item label="性别" required prop="sex" borderBottom>
|
||||||
<u-radio-group v-model="formData.sex" style="margin: 16rpx;">
|
<u-radio-group v-model="formData.sex" style="margin: 16rpx;">
|
||||||
@ -16,10 +16,10 @@
|
|||||||
</u-radio-group>
|
</u-radio-group>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item label="年龄" required prop="age" borderBottom>
|
<u-form-item label="年龄" required prop="age" borderBottom>
|
||||||
<u--input v-model="formData.age" type="number" placeholder="请输入年龄"></u--input>
|
<u--input v-model="formData.age" type="number" placeholder="请输入年龄" maxlength="3"></u--input>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item labelWidth="auto" label="身份证号" required prop="id_card" borderBottom>
|
<u-form-item labelWidth="auto" label="身份证号" required prop="id_card" borderBottom>
|
||||||
<u--input v-model="formData.id_card" placeholder="请输入身份证号" type="idcard"></u--input>
|
<u--input v-model="formData.id_card" placeholder="请输入身份证号" @input="c_idcard" type="idcard" maxlength="18"></u--input>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item labelWidth="auto" label="联系方式" required prop="phone" borderBottom>
|
<u-form-item labelWidth="auto" label="联系方式" required prop="phone" borderBottom>
|
||||||
<u--input v-model="formData.phone" placeholder="请输入手机号" type="number"></u--input>
|
<u--input v-model="formData.phone" placeholder="请输入手机号" type="number"></u--input>
|
||||||
@ -189,7 +189,7 @@
|
|||||||
},
|
},
|
||||||
id_card: {
|
id_card: {
|
||||||
required: true,
|
required: true,
|
||||||
pattern: /^\d{17}[\dX]$|^\d{15}[\dX]$/,
|
pattern: /^\d{17}[\dX]$/,
|
||||||
message: '请输入正确的身份证号',
|
message: '请输入正确的身份证号',
|
||||||
trigger: ['change', 'blur']
|
trigger: ['change', 'blur']
|
||||||
},
|
},
|
||||||
@ -200,9 +200,11 @@
|
|||||||
trigger: ['change', 'blur']
|
trigger: ['change', 'blur']
|
||||||
},
|
},
|
||||||
age: {
|
age: {
|
||||||
type: 'number',
|
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入年龄',
|
// message: '请输入年龄',
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
value > 0 && value < 200 ? callback() : callback('请输入正确年龄')
|
||||||
|
},
|
||||||
trigger: ['blur', 'change']
|
trigger: ['blur', 'change']
|
||||||
},
|
},
|
||||||
name: {
|
name: {
|
||||||
@ -255,18 +257,20 @@
|
|||||||
address.brigade_name ? str += address.brigade_name : null;
|
address.brigade_name ? str += address.brigade_name : null;
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
},
|
|
||||||
watch:{
|
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
c_idcard(e){
|
||||||
|
this.$nextTick(()=>{
|
||||||
|
this.formData.id_card = e.replace(/[^0-9X]/g, '')
|
||||||
|
})
|
||||||
|
},
|
||||||
// 新增档案
|
// 新增档案
|
||||||
async addArchives() {
|
async addArchives() {
|
||||||
try {
|
try {
|
||||||
// Toast('开发中')
|
// Toast('开发中')
|
||||||
// let refsDatas = this.loadRefsDatas();
|
// let refsDatas = this.loadRefsDatas();
|
||||||
// let flag1 = await this.$refs.districtSelectorRef.validate();
|
// let flag1 = await this.$refs.districtSelectorRef.validate();
|
||||||
let flag2 = await this.$refs.residentsRef.validate();
|
await this.$refs.residentsRef.validate();
|
||||||
// let flag3 = await this.$refs.breedingRef.validate();
|
// let flag3 = await this.$refs.breedingRef.validate();
|
||||||
// let flag4 = await this.$refs.plantRef.validate();
|
// let flag4 = await this.$refs.plantRef.validate();
|
||||||
// return console.log(flag1);
|
// return console.log(flag1);
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
</u-radio-group>
|
</u-radio-group>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item labelWidth="auto" label="身份证号" required prop="id_card" borderBottom>
|
<u-form-item labelWidth="auto" label="身份证号" required prop="id_card" borderBottom>
|
||||||
<u--input v-model="formData.id_card" placeholder="请输入身份证号" type="idcard"></u--input>
|
<u--input v-model="formData.id_card" placeholder="请输入身份证号" @input="c_idcard" type="idcard"></u--input>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item labelWidth="auto" label="是否为小队长" required prop="is_captain" borderBottom>
|
<u-form-item labelWidth="auto" label="是否为小队长" required prop="is_captain" borderBottom>
|
||||||
<u-radio-group v-model="formData.is_captain" style="margin: 16rpx;">
|
<u-radio-group v-model="formData.is_captain" style="margin: 16rpx;">
|
||||||
@ -399,6 +399,11 @@ import { Toast } from "../../libs/uniApi"
|
|||||||
},
|
},
|
||||||
onShow() {},
|
onShow() {},
|
||||||
methods: {
|
methods: {
|
||||||
|
c_idcard(e){
|
||||||
|
this.$nextTick(()=>{
|
||||||
|
this.formData.id_card = e.replace(/[^0-9X]/g, '')
|
||||||
|
})
|
||||||
|
},
|
||||||
// 上传头像
|
// 上传头像
|
||||||
async afterReadAvatar(event) {
|
async afterReadAvatar(event) {
|
||||||
upLoadImage({
|
upLoadImage({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user