2023-07-28 16:09:04 +08:00
|
|
|
<!-- 常住人口 -->
|
|
|
|
<template>
|
|
|
|
<view class="">
|
|
|
|
<u--form labelPosition="left" :model="residents" :rules="rules" ref="uForm">
|
|
|
|
<block value="人口">
|
2023-07-28 17:39:29 +08:00
|
|
|
<block value="人员信息" v-for="(item, index) in residents.family" :key="'user'+index">
|
2023-07-28 18:03:47 +08:00
|
|
|
<u-form-item label="姓名" required prop="residents.name" borderBottom>
|
|
|
|
<u--input v-model="item.name" placeholder="请输入姓名"></u--input>
|
2023-07-28 16:09:04 +08:00
|
|
|
</u-form-item>
|
2023-07-28 18:03:47 +08:00
|
|
|
<picker mode="date" value="1990-01-01" @change="changebirth_time" :data-index="index">
|
|
|
|
<u-form-item labelWidth="auto" label="出生日期" required prop="residents.name" borderBottom>
|
|
|
|
<u--input :value="item.birth_time" placeholder="请选择出生日期" disabled disabledColor="#fff"></u--input>
|
2023-07-28 16:09:04 +08:00
|
|
|
<u-icon slot="right" name="arrow-right"></u-icon>
|
|
|
|
</u-form-item>
|
|
|
|
</picker>
|
2023-07-28 18:03:47 +08:00
|
|
|
<picker mode="selector" :range="situationList" @change="changesituation" :data-index="index">
|
|
|
|
<u-form-item labelWidth="auto" label="就业情况" required prop="residents.name" borderBottom>
|
|
|
|
<u--input :value="item.situation" placeholder="请选择就业情况" disabled disabledColor="#fff"></u--input>
|
2023-07-28 16:09:04 +08:00
|
|
|
<u-icon slot="right" name="arrow-right"></u-icon>
|
|
|
|
</u-form-item>
|
|
|
|
</picker>
|
2023-07-28 18:03:47 +08:00
|
|
|
<u-form-item labelWidth="auto" label="技能特长" required prop="residents.name" borderBottom>
|
|
|
|
<u--input v-model="item.skills" placeholder="请输入技能特长"></u--input>
|
2023-07-28 16:09:04 +08:00
|
|
|
</u-form-item>
|
2023-07-28 17:39:29 +08:00
|
|
|
<button type="primary" v-if="residents.family.length>1" class="delete"
|
|
|
|
@click="removeFamily(index)">删除以上信息</button>
|
2023-07-28 16:09:04 +08:00
|
|
|
</block>
|
2023-07-28 17:39:29 +08:00
|
|
|
<button type="primary" class="plus" @click="pushFamily">+</button>
|
2023-07-28 16:09:04 +08:00
|
|
|
</block>
|
|
|
|
<block value="婴幼儿信息">
|
2023-07-28 17:39:29 +08:00
|
|
|
<u-form-item labelWidth="auto" label="是否存在学生、婴幼儿" required prop="residents.child" borderBottom>
|
|
|
|
<u-radio-group v-model="residents.child" style="margin: 16rpx;">
|
2023-07-28 16:09:04 +08:00
|
|
|
<u-radio :customStyle="{marginRight: '16px'}"
|
|
|
|
v-for="(item, index) in [{value:1,label:'是'},{value:0,label:'否'}]" :key="index" :label="item.label"
|
|
|
|
:name="item.value">
|
|
|
|
</u-radio>
|
|
|
|
</u-radio-group>
|
|
|
|
</u-form-item>
|
2023-07-28 17:39:29 +08:00
|
|
|
<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.child_arr.age" borderBottom>
|
2023-07-28 16:09:04 +08:00
|
|
|
<u--input v-model="item.age" placeholder="请输入年龄" type="number"></u--input>
|
|
|
|
</u-form-item>
|
|
|
|
<block v-if="item.age<4">
|
2023-07-28 17:39:29 +08:00
|
|
|
<u-form-item labelWidth="auto" label="喂养方式" required prop="residents.child" borderBottom>
|
2023-07-28 16:09:04 +08:00
|
|
|
<u-radio-group v-model="item.wyfs" style="margin: 16rpx;">
|
|
|
|
<u-radio :customStyle="{marginRight: '16px'}"
|
|
|
|
v-for="(item, index) in [{value:1,label:'母乳'},{value:0,label:'奶粉'}]" :key="index" :label="item.label"
|
|
|
|
:name="item.value">
|
|
|
|
</u-radio>
|
|
|
|
</u-radio-group>
|
|
|
|
</u-form-item>
|
|
|
|
</block>
|
|
|
|
<block v-else>
|
2023-07-28 17:39:29 +08:00
|
|
|
<u-form-item label="年级" required prop="residents.child_arr.age" borderBottom>
|
2023-07-28 16:09:04 +08:00
|
|
|
<u--input v-model="item.grade" placeholder="请输入年级"></u--input>
|
|
|
|
</u-form-item>
|
2023-07-28 17:39:29 +08:00
|
|
|
<u-form-item labelWidth="auto" label="是否补课" required prop="residents.child" borderBottom>
|
2023-07-28 18:03:47 +08:00
|
|
|
<u-radio-group v-model="item.is_lesson" style="margin: 16rpx;">
|
2023-07-28 16:09:04 +08:00
|
|
|
<u-radio :customStyle="{marginRight: '16px'}"
|
|
|
|
v-for="(item, index) in [{value:1,label:'是'},{value:0,label:'否'}]" :key="index" :label="item.label"
|
|
|
|
:name="item.value">
|
|
|
|
</u-radio>
|
|
|
|
</u-radio-group>
|
|
|
|
</u-form-item>
|
2023-07-28 18:03:47 +08:00
|
|
|
<u-form-item v-if="item.is_lesson>0" label-width="auto" labelPosition="top" label="补课内容" prop="residents.child_arr.age"
|
2023-07-28 16:09:04 +08:00
|
|
|
borderBottom>
|
2023-07-28 18:03:47 +08:00
|
|
|
<u--textarea v-model="item.lesson" autoHeight placeholder="请输入需要的课程" border="surround"
|
2023-07-28 16:09:04 +08:00
|
|
|
count></u--textarea>
|
|
|
|
</u-form-item>
|
2023-07-28 17:39:29 +08:00
|
|
|
<u-form-item label-width="auto" labelPosition="top" label="备注" prop="residents.child_arr.age" borderBottom>
|
2023-07-28 18:03:47 +08:00
|
|
|
<u--textarea v-model="item.notes" autoHeight placeholder="请输入备注" border="surround" count></u--textarea>
|
2023-07-28 16:09:04 +08:00
|
|
|
</u-form-item>
|
|
|
|
</block>
|
2023-07-28 17:39:29 +08:00
|
|
|
<button type="primary" v-if="residents.child_arr.length>1" class="delete"
|
|
|
|
@click="removeChildArr(index)">删除以上信息</button>
|
2023-07-28 16:09:04 +08:00
|
|
|
</block>
|
2023-07-28 18:03:47 +08:00
|
|
|
<button type="primary" v-if="residents.child>0" class="plus" @click="pushChildArr">+</button>
|
2023-07-28 16:09:04 +08:00
|
|
|
</block>
|
2023-07-28 17:13:56 +08:00
|
|
|
|
2023-07-28 16:09:04 +08:00
|
|
|
</u--form>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
2023-07-28 18:03:47 +08:00
|
|
|
situationList: ['公务员','国企事业单位','民营企业','自由职业','其他'],
|
2023-07-28 16:09:04 +08:00
|
|
|
// 常住人口
|
|
|
|
residents: {
|
2023-07-28 17:39:29 +08:00
|
|
|
family: [{
|
2023-07-28 18:03:47 +08:00
|
|
|
name: '',
|
|
|
|
birth_time: '',
|
|
|
|
situation: '', // 工作
|
|
|
|
skills: '', // 技能
|
2023-07-28 16:09:04 +08:00
|
|
|
}],
|
2023-07-28 17:39:29 +08:00
|
|
|
child: '', //是否存在婴幼儿
|
|
|
|
child_arr: [ //婴幼儿列表
|
2023-07-28 16:09:04 +08:00
|
|
|
{
|
|
|
|
age: '',
|
2023-07-28 18:03:47 +08:00
|
|
|
feeding: '', //喂养方式
|
2023-07-28 16:09:04 +08:00
|
|
|
grade: '', //年级
|
2023-07-28 18:03:47 +08:00
|
|
|
is_lesson: '', //是否补课
|
|
|
|
lesson: '', //课程
|
|
|
|
notes: '' //备注
|
2023-07-28 16:09:04 +08:00
|
|
|
}
|
|
|
|
],
|
|
|
|
},
|
|
|
|
rules: {
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
2023-07-28 16:29:01 +08:00
|
|
|
// 选择生日
|
2023-07-28 18:03:47 +08:00
|
|
|
changebirth_time(e){
|
2023-07-28 16:29:01 +08:00
|
|
|
let index = e.currentTarget.dataset.index;
|
2023-07-28 18:03:47 +08:00
|
|
|
this.residents.family[index].birth_time = e.detail.value;
|
2023-07-28 16:29:01 +08:00
|
|
|
},
|
|
|
|
// 选择就业
|
2023-07-28 18:03:47 +08:00
|
|
|
changesituation(e){
|
2023-07-28 16:29:01 +08:00
|
|
|
let index = e.currentTarget.dataset.index;
|
2023-07-28 18:03:47 +08:00
|
|
|
this.residents.family[index].situation = this.situationList[e.detail.value];
|
2023-07-28 16:09:04 +08:00
|
|
|
},
|
|
|
|
// 添加人口
|
2023-07-28 17:39:29 +08:00
|
|
|
pushFamily() {
|
|
|
|
this.residents.family.push({
|
2023-07-28 18:03:47 +08:00
|
|
|
name: '',
|
|
|
|
birth_time: '',
|
|
|
|
situation: '', // 工作
|
|
|
|
skills: '', // 技能
|
|
|
|
})
|
2023-07-28 16:09:04 +08:00
|
|
|
},
|
|
|
|
// 删除人口
|
2023-07-28 17:39:29 +08:00
|
|
|
removeFamily(index) {
|
2023-07-28 16:09:04 +08:00
|
|
|
uni.showModal({
|
|
|
|
confirmColor: '#f56c6c',
|
|
|
|
content: '确定删除吗?',
|
|
|
|
success: (res) => {
|
|
|
|
if (res.confirm) {
|
2023-07-28 17:39:29 +08:00
|
|
|
this.residents.family.splice(index, 1);
|
2023-07-28 16:09:04 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 添加婴幼儿
|
2023-07-28 17:39:29 +08:00
|
|
|
pushChildArr() {
|
|
|
|
this.residents.child_arr.push({
|
2023-07-28 18:03:47 +08:00
|
|
|
age: '',
|
|
|
|
feeding: '', //喂养方式
|
|
|
|
grade: '', //年级
|
|
|
|
is_lesson: '', //是否补课
|
|
|
|
lesson: '', //课程
|
|
|
|
notes: '' //备注
|
|
|
|
})
|
2023-07-28 16:09:04 +08:00
|
|
|
},
|
|
|
|
// 删除婴幼儿
|
2023-07-28 17:39:29 +08:00
|
|
|
removeChildArr(index) {
|
2023-07-28 16:09:04 +08:00
|
|
|
uni.showModal({
|
|
|
|
confirmColor: '#f56c6c',
|
|
|
|
content: '确定删除吗?',
|
|
|
|
success: (res) => {
|
|
|
|
if (res.confirm) {
|
2023-07-28 17:39:29 +08:00
|
|
|
this.residents.child_arr.splice(index, 1);
|
2023-07-28 16:09:04 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
.delete {
|
|
|
|
margin: 22rpx 0;
|
|
|
|
// margin-bottom: 40rpx;
|
|
|
|
width: 100%;
|
|
|
|
height: 54rpx;
|
|
|
|
line-height: 54rpx;
|
|
|
|
background: #f56c6c;
|
|
|
|
border-radius: 14rpx;
|
|
|
|
font-size: 28rpx;
|
|
|
|
color: #fff;
|
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
.plus {
|
|
|
|
margin: 22rpx 0;
|
|
|
|
// margin-bottom: 40rpx;
|
|
|
|
width: 100%;
|
|
|
|
height: 54rpx;
|
|
|
|
line-height: 54rpx;
|
|
|
|
background: $theme-oa-color;
|
|
|
|
border-radius: 14rpx;
|
|
|
|
color: #fff;
|
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
</style>
|