调整字段名称
This commit is contained in:
parent
249cbcae1e
commit
1829751e1a
@ -3,7 +3,7 @@
|
|||||||
<view class="">
|
<view class="">
|
||||||
<u--form labelPosition="left" :model="residents" :rules="rules" ref="uForm">
|
<u--form labelPosition="left" :model="residents" :rules="rules" ref="uForm">
|
||||||
<block value="人口">
|
<block value="人口">
|
||||||
<block value="人员信息" v-for="(item, index) in residents.userList" :key="'user'+index">
|
<block value="人员信息" v-for="(item, index) in residents.family" :key="'user'+index">
|
||||||
<u-form-item label="姓名" required prop="residents.nickname" borderBottom>
|
<u-form-item label="姓名" required prop="residents.nickname" borderBottom>
|
||||||
<u--input v-model="item.nickname" placeholder="请输入姓名"></u--input>
|
<u--input v-model="item.nickname" placeholder="请输入姓名"></u--input>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
@ -22,26 +22,26 @@
|
|||||||
<u-form-item labelWidth="auto" label="技能特长" required prop="residents.nickname" borderBottom>
|
<u-form-item labelWidth="auto" label="技能特长" required prop="residents.nickname" borderBottom>
|
||||||
<u--input v-model="item.skill" placeholder="请输入技能特长"></u--input>
|
<u--input v-model="item.skill" placeholder="请输入技能特长"></u--input>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<button type="primary" v-if="residents.userList.length>1" class="delete"
|
<button type="primary" v-if="residents.family.length>1" class="delete"
|
||||||
@click="removeUserList(index)">删除以上信息</button>
|
@click="removeFamily(index)">删除以上信息</button>
|
||||||
</block>
|
</block>
|
||||||
<button type="primary" class="plus" @click="pushUserList">+</button>
|
<button type="primary" class="plus" @click="pushFamily">+</button>
|
||||||
</block>
|
</block>
|
||||||
<block value="婴幼儿信息">
|
<block value="婴幼儿信息">
|
||||||
<u-form-item labelWidth="auto" label="是否存在学生、婴幼儿" required prop="residents.infant" borderBottom>
|
<u-form-item labelWidth="auto" label="是否存在学生、婴幼儿" required prop="residents.child" borderBottom>
|
||||||
<u-radio-group v-model="residents.infant" style="margin: 16rpx;">
|
<u-radio-group v-model="residents.child" style="margin: 16rpx;">
|
||||||
<u-radio :customStyle="{marginRight: '16px'}"
|
<u-radio :customStyle="{marginRight: '16px'}"
|
||||||
v-for="(item, index) in [{value:1,label:'是'},{value:0,label:'否'}]" :key="index" :label="item.label"
|
v-for="(item, index) in [{value:1,label:'是'},{value:0,label:'否'}]" :key="index" :label="item.label"
|
||||||
:name="item.value">
|
:name="item.value">
|
||||||
</u-radio>
|
</u-radio>
|
||||||
</u-radio-group>
|
</u-radio-group>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<block value="是" v-if="residents.infant>0" v-for="(item,index) in residents.infantList" :key="'infant'+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="residents.infantList.age" borderBottom>
|
<u-form-item label="年龄" required prop="residents.child_arr.age" borderBottom>
|
||||||
<u--input v-model="item.age" placeholder="请输入年龄" type="number"></u--input>
|
<u--input v-model="item.age" placeholder="请输入年龄" type="number"></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="喂养方式" required prop="residents.infant" borderBottom>
|
<u-form-item labelWidth="auto" label="喂养方式" required prop="residents.child" borderBottom>
|
||||||
<u-radio-group v-model="item.wyfs" style="margin: 16rpx;">
|
<u-radio-group v-model="item.wyfs" style="margin: 16rpx;">
|
||||||
<u-radio :customStyle="{marginRight: '16px'}"
|
<u-radio :customStyle="{marginRight: '16px'}"
|
||||||
v-for="(item, index) in [{value:1,label:'母乳'},{value:0,label:'奶粉'}]" :key="index" :label="item.label"
|
v-for="(item, index) in [{value:1,label:'母乳'},{value:0,label:'奶粉'}]" :key="index" :label="item.label"
|
||||||
@ -51,10 +51,10 @@
|
|||||||
</u-form-item>
|
</u-form-item>
|
||||||
</block>
|
</block>
|
||||||
<block v-else>
|
<block v-else>
|
||||||
<u-form-item label="年级" required prop="residents.infantList.age" borderBottom>
|
<u-form-item label="年级" required prop="residents.child_arr.age" borderBottom>
|
||||||
<u--input v-model="item.grade" placeholder="请输入年级"></u--input>
|
<u--input v-model="item.grade" placeholder="请输入年级"></u--input>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item labelWidth="auto" label="是否补课" required prop="residents.infant" borderBottom>
|
<u-form-item labelWidth="auto" label="是否补课" required prop="residents.child" borderBottom>
|
||||||
<u-radio-group v-model="item.is_course" style="margin: 16rpx;">
|
<u-radio-group v-model="item.is_course" style="margin: 16rpx;">
|
||||||
<u-radio :customStyle="{marginRight: '16px'}"
|
<u-radio :customStyle="{marginRight: '16px'}"
|
||||||
v-for="(item, index) in [{value:1,label:'是'},{value:0,label:'否'}]" :key="index" :label="item.label"
|
v-for="(item, index) in [{value:1,label:'是'},{value:0,label:'否'}]" :key="index" :label="item.label"
|
||||||
@ -62,19 +62,19 @@
|
|||||||
</u-radio>
|
</u-radio>
|
||||||
</u-radio-group>
|
</u-radio-group>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item v-if="item.is_course>0" label-width="auto" labelPosition="top" label="补课内容" prop="residents.infantList.age"
|
<u-form-item v-if="item.is_course>0" label-width="auto" labelPosition="top" label="补课内容" prop="residents.child_arr.age"
|
||||||
borderBottom>
|
borderBottom>
|
||||||
<u--textarea v-model="item.course" autoHeight placeholder="请输入需要的课程" border="surround"
|
<u--textarea v-model="item.course" autoHeight placeholder="请输入需要的课程" border="surround"
|
||||||
count></u--textarea>
|
count></u--textarea>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item label-width="auto" labelPosition="top" label="备注" prop="residents.infantList.age" borderBottom>
|
<u-form-item label-width="auto" labelPosition="top" label="备注" prop="residents.child_arr.age" borderBottom>
|
||||||
<u--textarea v-model="item.remark" autoHeight placeholder="请输入备注" border="surround" count></u--textarea>
|
<u--textarea v-model="item.remark" autoHeight placeholder="请输入备注" border="surround" count></u--textarea>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
</block>
|
</block>
|
||||||
<button type="primary" v-if="residents.infantList.length>1" class="delete"
|
<button type="primary" v-if="residents.child_arr.length>1" class="delete"
|
||||||
@click="removeInfantList(index)">删除以上信息</button>
|
@click="removeChildArr(index)">删除以上信息</button>
|
||||||
</block>
|
</block>
|
||||||
<button type="primary" class="plus" @click="pushInfantList">+</button>
|
<button type="primary" class="plus" @click="pushChildArr">+</button>
|
||||||
</block>
|
</block>
|
||||||
|
|
||||||
</u--form>
|
</u--form>
|
||||||
@ -88,14 +88,14 @@
|
|||||||
jobTypeList: ['公务员','国企事业单位','民营企业','自由职业','其他'],
|
jobTypeList: ['公务员','国企事业单位','民营企业','自由职业','其他'],
|
||||||
// 常住人口
|
// 常住人口
|
||||||
residents: {
|
residents: {
|
||||||
userList: [{
|
family: [{
|
||||||
nickname: '',
|
nickname: '',
|
||||||
birthday: '',
|
birthday: '',
|
||||||
jobType: '', // 工作
|
jobType: '', // 工作
|
||||||
skill: '', // 技能
|
skill: '', // 技能
|
||||||
}],
|
}],
|
||||||
infant: '', //是否存在婴幼儿
|
child: '', //是否存在婴幼儿
|
||||||
infantList: [ //婴幼儿列表
|
child_arr: [ //婴幼儿列表
|
||||||
{
|
{
|
||||||
age: '',
|
age: '',
|
||||||
wsfy: '', //喂养方式
|
wsfy: '', //喂养方式
|
||||||
@ -115,16 +115,16 @@
|
|||||||
// 选择生日
|
// 选择生日
|
||||||
changeBirthday(e){
|
changeBirthday(e){
|
||||||
let index = e.currentTarget.dataset.index;
|
let index = e.currentTarget.dataset.index;
|
||||||
this.residents.userList[index].birthday = e.detail.value;
|
this.residents.family[index].birthday = e.detail.value;
|
||||||
},
|
},
|
||||||
// 选择就业
|
// 选择就业
|
||||||
changeJobType(e){
|
changeJobType(e){
|
||||||
let index = e.currentTarget.dataset.index;
|
let index = e.currentTarget.dataset.index;
|
||||||
this.residents.userList[index].jobType = this.jobTypeList[e.detail.value];
|
this.residents.family[index].jobType = this.jobTypeList[e.detail.value];
|
||||||
},
|
},
|
||||||
// 添加人口
|
// 添加人口
|
||||||
pushUserList() {
|
pushFamily() {
|
||||||
this.residents.userList.push({
|
this.residents.family.push({
|
||||||
nickname: '',
|
nickname: '',
|
||||||
birthday: '',
|
birthday: '',
|
||||||
jobType: '',
|
jobType: '',
|
||||||
@ -132,20 +132,20 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 删除人口
|
// 删除人口
|
||||||
removeUserList(index) {
|
removeFamily(index) {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
confirmColor: '#f56c6c',
|
confirmColor: '#f56c6c',
|
||||||
content: '确定删除吗?',
|
content: '确定删除吗?',
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
this.residents.userList.splice(index, 1);
|
this.residents.family.splice(index, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 添加婴幼儿
|
// 添加婴幼儿
|
||||||
pushInfantList() {
|
pushChildArr() {
|
||||||
this.residents.infantList.push({
|
this.residents.child_arr.push({
|
||||||
age: '',
|
age: '',
|
||||||
wsfy: '', //喂养方式
|
wsfy: '', //喂养方式
|
||||||
grade: '', //年级
|
grade: '', //年级
|
||||||
@ -154,13 +154,13 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 删除婴幼儿
|
// 删除婴幼儿
|
||||||
removeInfantList(index) {
|
removeChildArr(index) {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
confirmColor: '#f56c6c',
|
confirmColor: '#f56c6c',
|
||||||
content: '确定删除吗?',
|
content: '确定删除吗?',
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
this.residents.infantList.splice(index, 1);
|
this.residents.child_arr.splice(index, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
<u--form labelPosition="left" :model="formData" :rules="rules" ref="uForm">
|
<u--form labelPosition="left" :model="formData" :rules="rules" ref="uForm">
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="title">基本信息</view>
|
<view class="title">基本信息</view>
|
||||||
<u-form-item labelWidth="auto" label="户主姓名" required prop="nickname" borderBottom>
|
<u-form-item labelWidth="auto" label="户主姓名" required prop="name" borderBottom>
|
||||||
<u--input v-model="formData.nickname" placeholder="请输入姓名"></u--input>
|
<u--input v-model="formData.name" placeholder="请输入姓名"></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;">
|
||||||
@ -18,8 +18,8 @@
|
|||||||
<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="请输入身份证号" type="idcard"></u--input>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item labelWidth="auto" label="联系方式" required prop="account" borderBottom>
|
<u-form-item labelWidth="auto" label="联系方式" required prop="phone" borderBottom>
|
||||||
<u--input v-model="formData.account" placeholder="请输入手机号" type="number"></u--input>
|
<u--input v-model="formData.phone" placeholder="请输入手机号" type="number"></u--input>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
@ -28,8 +28,8 @@
|
|||||||
<u-form-item labelWidth="auto" label="详细地址" required prop="address" borderBottom>
|
<u-form-item labelWidth="auto" label="详细地址" required prop="address" borderBottom>
|
||||||
<u--input v-model="formData.address" placeholder="请输入详细地址"></u--input>
|
<u--input v-model="formData.address" placeholder="请输入详细地址"></u--input>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item labelWidth="auto" label="汽车是否能到家" required prop="formData.infant" borderBottom>
|
<u-form-item labelWidth="auto" label="汽车是否能到家" required prop="residents.infant" borderBottom>
|
||||||
<u-radio-group v-model="formData.is_car" style="margin: 16rpx;">
|
<u-radio-group v-model="formData.highway" style="margin: 16rpx;">
|
||||||
<u-radio :customStyle="{marginRight: '16px'}"
|
<u-radio :customStyle="{marginRight: '16px'}"
|
||||||
v-for="(item, index) in [{value:1,label:'是'},{value:0,label:'否'}]" :key="index" :label="item.label"
|
v-for="(item, index) in [{value:1,label:'是'},{value:0,label:'否'}]" :key="index" :label="item.label"
|
||||||
:name="item.value">
|
:name="item.value">
|
||||||
@ -38,14 +38,14 @@
|
|||||||
</u-form-item>
|
</u-form-item>
|
||||||
<block value="智能手机">
|
<block value="智能手机">
|
||||||
<u-form-item labelWidth="auto" label="是否使用智能手机" required prop="formData.infant" borderBottom>
|
<u-form-item labelWidth="auto" label="是否使用智能手机" required prop="formData.infant" borderBottom>
|
||||||
<u-radio-group v-model="formData.is_smartphone" style="margin: 16rpx;">
|
<u-radio-group v-model="formData.smart_phone" style="margin: 16rpx;">
|
||||||
<u-radio :customStyle="{marginRight: '16px'}"
|
<u-radio :customStyle="{marginRight: '16px'}"
|
||||||
v-for="(item, index) in [{value:1,label:'是'},{value:0,label:'否'}]" :key="index" :label="item.label"
|
v-for="(item, index) in [{value:1,label:'是'},{value:0,label:'否'}]" :key="index" :label="item.label"
|
||||||
:name="item.value">
|
:name="item.value">
|
||||||
</u-radio>
|
</u-radio>
|
||||||
</u-radio-group>
|
</u-radio-group>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<block v-if="formData.is_smartphone>0">
|
<block v-if="formData.smart_phone>0">
|
||||||
<u-form-item labelWidth="auto" label="微信号" required prop="formData.infantList.age" borderBottom>
|
<u-form-item labelWidth="auto" label="微信号" required prop="formData.infantList.age" borderBottom>
|
||||||
<u--input v-model="formData.wechat" placeholder="请输入微信号"></u--input>
|
<u--input v-model="formData.wechat" placeholder="请输入微信号"></u--input>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
@ -80,14 +80,15 @@
|
|||||||
formData: {
|
formData: {
|
||||||
id_card: '',
|
id_card: '',
|
||||||
sex: '',
|
sex: '',
|
||||||
nickname: '',
|
name: '',
|
||||||
account: '', //电话
|
phone: '', //电话
|
||||||
is_car: '',//汽车是否能到家
|
highway: '',//汽车是否能到家
|
||||||
is_smartphone: '',//是否使用智能手机
|
smart_phone: '',//是否使用智能手机
|
||||||
wechat: '', //微信号
|
wechat: '', //微信号
|
||||||
|
address: '',//家庭地址
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
account: {
|
phone: {
|
||||||
required: true,
|
required: true,
|
||||||
pattern: /^(1[3456789]\d{9})$/,
|
pattern: /^(1[3456789]\d{9})$/,
|
||||||
message: '请输入正确的手机号码',
|
message: '请输入正确的手机号码',
|
||||||
@ -106,7 +107,7 @@
|
|||||||
message: '请选择男或女',
|
message: '请选择男或女',
|
||||||
trigger: ['blur', 'change']
|
trigger: ['blur', 'change']
|
||||||
},
|
},
|
||||||
nickname: {
|
name: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
required: true,
|
required: true,
|
||||||
message: '姓名不能为空',
|
message: '姓名不能为空',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user