“hanlingqiang пре 2 година
родитељ
комит
3c0288b919

+ 16 - 0
src/views/weibao/router/router.js

@@ -21,8 +21,24 @@ const routes = [{
     {
         path: '/collect/index',
         name: 'collect',
+        meta: {
+            keepAlive: true
+        },
         component: () => import('../views/collect/index.vue')
     },
+    {
+        path: '/collect/family',
+        name: 'family',
+        meta: {
+            keepAlive: true
+        },
+        component: () => import('../views/collect/family.vue')
+    },
+    {
+        path:'/collect/inforMation',
+        name: 'inforMation',
+        component: () => import('../views/collect/inforMation.vue')
+    },
     {
         path: '/text',
         name: 'Home',

+ 321 - 0
src/views/weibao/views/collect/family.vue

@@ -0,0 +1,321 @@
+<template>
+    <div class="main_bg">
+        <van-nav-bar title="信息采集" @click-left="$router.back()" left-arrow fixed placeholder safe-area-inset-top />
+        <h3>家庭及监护状况</h3>
+        <div class="page">
+            <van-row class="cell">
+                <van-col span="6">家庭类型<span>*</span>:</van-col>
+                <van-col span="18">
+                        <van-field-checkbox
+                        placeholder="请选择"
+                        v-model="familyTypeStr"
+                        :isSearch="false"
+                        :columns="familyList"
+                        label-width="100"
+                        :option="{label:'text', value:'value'}"
+                        @confirm="onFamilyShow"
+                        />
+                    </van-col>
+            </van-row>
+            <div class="cell_2">
+                <van-cell title="家庭状况">
+                    <template #right-icon>
+                        <van-button icon="plus" type="primary" size="small" @click="onAddClick(1)">添加</van-button>
+                    </template>
+                </van-cell>
+                <van-swipe-cell v-for="(item,index) in familyMembers" :key="index">
+                    <van-cell center is-link @click="onCellClick(1,index,item)">
+                        <template #title>
+                            <span class="custom-title">{{item.name}}</span>
+                            <span class="custom-title">{{ item.relation }}</span>
+                            <span class="custom-title">{{ item.mobile }}</span>
+                        </template>
+                        <template #label>
+                            <span class="custom-title">{{ item.address }}</span>
+                        </template>
+                    </van-cell>
+                    <template #right>
+                        <van-button square type="danger" text="删除" />
+                    </template>
+                </van-swipe-cell>
+            </div>
+            
+            <div class="cell_2">
+                <van-cell title="监护状况">
+                    <template #right-icon>
+                        <van-button icon="plus" type="primary" size="small" @click="onAddClick(2)">添加</van-button>
+                    </template>
+                </van-cell>
+                <van-swipe-cell v-for="(item,index) in guardians" :key="index">
+                    <van-cell center is-link @click="onCellClick(2,index,item)">
+                        <template #title>
+                            <span class="custom-title">{{item.name}}</span>
+                            <span class="custom-title">{{ item.relation }}</span>
+                            <span class="custom-title">{{ item.mobile }}</span>
+                        </template>
+                        <template #label>
+                            <span class="custom-title">{{ item.address }}</span>
+                        </template>
+                    </van-cell>
+                    <template #right>
+                        <van-button square type="danger" text="删除" />
+                    </template>
+                </van-swipe-cell>
+            </div>
+
+            <div class="but">
+                <van-button native-type="submit" @click="onSubmitClick">提 交</van-button>
+            </div>
+        </div>
+        <van-overlay :show="showoOverlay">
+            <van-loading size="24px" vertical>正在提交...</van-loading>
+        </van-overlay>
+    </div>
+</template>
+<script>
+import vanFieldCheckbox from '../../components/vanFieldCheckbox.vue'
+import {createChildBaseInfo} from '../../api/index.js'
+export default {
+    components: {vanFieldCheckbox},
+    data() {
+        return {
+            isEdit:false,
+            type:-1, //家庭状况 监护状况
+            cellIndex:-1, //点击的哪一行
+            form:'',
+            familyType:'',
+            familyShow:false,
+            familyTypeStr:[],
+            showoOverlay:false,
+            familyList:[
+                {
+                    text:'核心家庭',
+                    value:'1'
+                },
+                {
+                    text:'主干家庭',
+                    value:'2'
+                },
+                {
+                    text:'联合家庭',
+                    value:'3'
+                },
+                {
+                    text:'再婚家庭',
+                    value:'4'
+                },
+                {
+                    text:'单亲家庭',
+                    value:'5'
+                }
+            ],
+            familyMembers:[
+                // {
+                //     name:'张达日',
+                //     relation:'父子',
+                //     mobile:'18810511323',
+                //     address:'山东省滨州市邹平市九户镇西河沟村15号邹平市九户镇西河沟村15号',
+                //     postalCode:'222888'
+                // }
+            ],
+            guardians:[
+                // {
+                //     name:'张达日',
+                //     relation:'父子',
+                //     mobile:'18810511323',
+                //     address:'山东省滨州市邹平市九户镇西河沟村15号邹平市九户镇西河沟村15号',
+                //     postalCode:'222888'
+                // }
+            ]
+        }
+    },
+    watch: {
+        '$route.path': {
+            handler(toPath, fromPath){
+                if(fromPath == '/collect/inforMation') {
+                    if(!this.isEdit) {
+                        if(this.type == '1') {
+                            // 家庭状况
+                            localStorage.getItem('infoForm') && this.familyMembers.push(JSON.parse(localStorage.getItem('infoForm')))
+                            
+                        }else if(this.type == '2') {
+                            localStorage.getItem('infoForm') && this.guardians.push(JSON.parse(localStorage.getItem('infoForm')))
+                        }
+                        localStorage.setItem('infoForm', '')
+                    }else {
+                        // 编辑
+                        if(this.type == '1') {
+                            this.familyMembers.splice(this.cellIndex,1,localStorage.getItem('infoForm') && JSON.parse(localStorage.getItem('infoForm')))
+                            console.log(this.familyMembers)
+                        }else if(this.type == '2') {
+                            this.guardians.splice(this.cellIndex,1,localStorage.getItem('infoForm') && JSON.parse(localStorage.getItem('infoForm')))
+                        }
+                        localStorage.setItem('infoForm', '')
+                    }
+                   
+                }
+            },
+            deep: true, // 深度监听
+            immediate: true, // 第一次初始化渲染就可以监听到
+        },
+        '$route': {
+			immediate: false,
+			handler: function(to, from) {
+				//拿到目标参数 to.query.id 去再次请求数据接口
+                if(to && to.path == '/collect/family' && from && from.path == '/collect/index') {
+                    this.form =  to.query.form
+                    console.log('$route form::' + JSON.stringify(to.query.form));
+                }
+			}
+		}
+    },
+    created() {
+       
+    },
+    mounted() {
+        this.form = this.$route.query.form
+        console.log('mounted form:')
+        console.log(this.$route.query.form)
+    },
+   
+    methods: {
+        // 家庭类型选择
+        onFamilyShow(label,value) {
+            this.familyType = value
+        },
+        // 添加
+        onAddClick(index) {
+            this.isEdit = false
+            this.type = index
+            this.$router.push({
+                path:'/collect/inforMation',
+                query:{
+                    'type':index,
+                    'value':'',
+                    "isEdit":false
+                }
+            })
+        },
+        // 每一行点击
+        onCellClick(type,index,item) {
+            this.isEdit = true
+            this.type = type
+            this.cellIndex = index
+            this.$router.push({
+                path:'/collect/inforMation',
+                query:{
+                    'type':index,
+                    'value':JSON.parse(JSON.stringify(item)),
+                    "isEdit":true
+                }
+            })
+
+        },
+        // 提交
+        async onSubmitClick() {
+            console.log('111111')
+            console.log(this.form)
+            console.log(this.familyType)
+            console.log(this.familyMembers)
+            console.log(this.guardians)
+            console.log('22222222')
+            
+            let data =this.form
+            data.familyType = this.familyType
+            data.familyMembers =this.familyMembers
+            data.guardians =this.guardians
+            this.showoOverlay = true
+            const res = await createChildBaseInfo(data)
+            this.showoOverlay = false
+            if (res.code == '0000') {
+                this.$toast.success('成功')
+                this.$router.go(-2)
+            }
+        }
+    }
+}
+</script>
+<style lang="scss" scoped>
+.main_bg {
+    padding: 0 20px;
+    box-sizing: border-box;
+   
+    .page {
+        .van-row {
+            font-size: 30px;
+            text-align: left;
+        }
+        .van-cell {
+            height: 80px;
+            padding: 0;
+            font-size: 30px;
+            display: flex;
+            align-items: center;
+        }
+        .van-cell::after {
+            border-bottom: none;
+        }
+        .cell {
+            border-bottom: 1px solid #eee;
+            padding: 5px 0;
+            box-sizing: border-box;
+            display: flex;
+            align-items: center;
+            .van-col {
+                min-height: 80px;
+                display: flex;
+                align-items: center;
+                span {
+                    color: #f62a59;
+                }
+                .van-button {
+                    font-size: 25px;
+                    background-color: #1677ff;
+                    .van-button__text {
+                        color: #ffffff;
+                    }
+                }
+            }
+        }
+        .cell_2 {
+            min-height: 130px;
+            padding: 3px 8px 3px 3px;
+            box-sizing: border-box;
+            .van-swipe-cell {
+                height:auto;
+                padding: 10px 0;
+                box-sizing: border-box;
+                margin-bottom:40px;
+                border-bottom: 1px solid #eee;
+                .van-button {
+                    border: none;
+                }
+                .van-cell {
+                    height: auto;
+                    span {
+                        margin-right: 15px;
+                    }
+                }
+            }
+            .van-swipe-cell:nth-child(2) {
+                margin-top: 20px;
+            }
+            .van-swipe-cell:last-child {
+                margin-bottom:20px;
+            }
+           
+        }
+        .but {
+            text-align: center;
+            .van-button {
+                width: 620px;
+                margin: 24px auto;
+                color: #fff;
+                background-color: #1677ff;
+                border-radius: 12px;
+                font-size: 30px;
+            }
+        }
+    }
+}
+</style>

+ 29 - 16
src/views/weibao/views/collect/index.vue

@@ -150,7 +150,7 @@
                 </van-row>
                 
                 <van-row class="cell">
-                    <van-col span="6">身高:</van-col>
+                    <van-col span="6">身高(cm):</van-col>
                     <van-col span="18">
                         <van-field name="height" type="number" v-model="form.height"  :rules="[{ required: false }]"
                             placeholder="请输入" />
@@ -158,7 +158,7 @@
                 </van-row>
                 
                 <van-row class="cell">
-                    <van-col span="6">体重:</van-col>
+                    <van-col span="6">体重(kg):</van-col>
                     <van-col span="18">
                         <van-field name="weight" type="number" v-model="form.weight"  :rules="[{required: false}]"
                             placeholder="请输入" />
@@ -207,6 +207,21 @@
                             placeholder="请输入" />
                     </van-col>
                 </van-row>
+
+                <van-row class="cell">
+                    <van-col span="6">是否上大专、大学、研究生:</van-col>
+                    <van-col span="18">
+                        <van-field name="basic">
+                            <template #input>
+                                <van-radio-group v-model="form.higherEducationStatus" direction="horizontal">
+                                    <van-radio name='1' shape="square" icon-size="16px">是</van-radio>
+                                    <van-radio name='0'  shape="square" icon-size="16px">否</van-radio>
+                                </van-radio-group>
+                            </template>
+                           
+                        </van-field>
+                    </van-col>
+                </van-row>
                 
                 <van-row class="cell">
                     <van-col span="6">是否享受低保:</van-col>
@@ -259,18 +274,16 @@
                 </van-row> -->
             </div>
             <div class="but">
-                <van-button native-type="submit" :disabled="disabled">确 定</van-button>
+                <van-button native-type="submit" :disabled="disabled">下 一 步</van-button>
             </div>
         </van-form>
-        <van-overlay :show="showoOverlay">
-            <van-loading size="24px" vertical>正在提交...</van-loading>
-        </van-overlay>
+       
     </div>
 </template>
 <script>
 import {mzlist} from './mzlist.js'
 import {validateIDcard} from '@/utils/validate.js'
-import { listArea, childType, organization, listEmployeeByName, createChildBaseInfo} from '../../api/index.js'
+import { listArea, childType, organization, listEmployeeByName} from '../../api/index.js'
 import vanUploader from '../../components/vanUploader.vue'
 import vanFieldCheckbox from '../../components/vanFieldCheckbox.vue'
 export default {
@@ -314,6 +327,7 @@ export default {
                 familyDesc:'',//家庭情况
                 disabilityLevel:'',//残疾等级
                 disabilityCertificate:'',//残疾证书号
+                higherEducationStatus:'0',//是否受过高等教育 0 否 1是
                 subsistence:'0',//低保状态 0 否 1 是
                 disabledSerious:'0',//重度残疾状态 0 否 1 是
                 disabled:'0',//残疾状态 0 否 1 是
@@ -384,7 +398,6 @@ export default {
                 { value: 9, label: '九级' },
                 { value: 10, label: '十级' },
             ],
-            showoOverlay:false,
             show: false,
             disabled: false,
             minDate: new Date(2020, 0, 1),
@@ -405,6 +418,11 @@ export default {
         this.childTypeF()
         this.organizationF()
     },
+    beforeRouteUpdate(to,from,next){
+        this.form = to.query.form
+        console.log(to.query.form)
+        next();
+    },
     methods: {
         async listAreaF() {
             let res = await listArea({ parentId: '' })
@@ -558,20 +576,15 @@ export default {
             }
             return year + '-' + month + '-' + day
         },
-        async saveFollowUp(e) {
+        saveFollowUp(e) {
             // if (!this.form.photoImgUrl) {
             //     this.$toast.fail('请选择一张图片')
             //     return
             // }
+            // 
             var data = JSON.parse(JSON.stringify(this.form))
             data.birthday = data.birthday+' 00:00:00'
-            this.showoOverlay = true
-            const res = await createChildBaseInfo(data)
-            this.showoOverlay = false
-            if (res.code == '0000') {
-                this.$toast.success('成功')
-                this.$router.go(-1)
-            }
+            this.$router.push({ path: '/collect/family', query: {form:data} })
         },
         getfileList(v, index) {
             console.log(v)

+ 120 - 0
src/views/weibao/views/collect/inforMation.vue

@@ -0,0 +1,120 @@
+<template>
+    <div class="main_bg">
+        <van-nav-bar :title="title" @click-left="onNavBarLeft" left-arrow fixed placeholder safe-area-inset-top />
+        <van-form @submit="onSureHandle">
+            <div class="page">
+                <van-row class="cell">
+                    <van-col span="6">姓名<span>*</span>:</van-col>
+                    <van-col span="18">
+                        <van-field name="name" v-model="infoForm.name"  :rules="[{ required: true }]" placeholder="请输入" />
+                    </van-col>
+                </van-row>
+                <van-row class="cell">
+                    <van-col span="6">关系<span>*</span>:</van-col>
+                    <van-col span="18">
+                        <van-field name="relation" v-model="infoForm.relation"  :rules="[{ required: true }]" placeholder="请输入" />
+                    </van-col>
+                </van-row>
+                <van-row class="cell">
+                    <van-col span="6">联系电话<span>*</span>:</van-col>
+                    <van-col span="18">
+                        <van-field name="mobile" v-model="infoForm.mobile"  :rules="[{ required: true }]" placeholder="请输入" />
+                    </van-col>
+                </van-row>
+                <van-row class="cell">
+                    <van-col span="6">住址:</van-col>
+                    <van-col span="18">
+                        <van-field name="address" v-model="infoForm.address"  :rules="[{ required: false }]" placeholder="请输入" />
+                    </van-col>
+                </van-row>
+                <van-row class="cell">
+                    <van-col span="6">邮编:</van-col>
+                    <van-col span="18">
+                        <van-field name="postalCode"  type="tel" v-model="infoForm.postalCode"  :rules="[{ required: false }]" placeholder="请输入" />
+                    </van-col>
+                </van-row>
+            </div>
+            <div class="but">
+                <van-button native-type="submit">确 定</van-button>
+            </div>
+        </van-form>
+    </div>
+</template>
+<script>
+export default {
+    components: {},
+    data() {
+        return {
+           isEdit:'',
+           type:'',
+           title:'',
+           infoForm:{
+            name:'',
+            relation:'',
+            mobile:'',
+            address:'',
+            postalCode:''
+           }
+        }
+    },
+    created() {
+        this.type = this.$route.query.type
+        if(this.$route.query.value) {
+            this.infoForm = this.$route.query.value
+        }
+        this.title = this.type == 1 ? '家庭状况' :'监护状况'
+    },
+    methods: {
+        // 确定
+        onSureHandle(e) {
+            localStorage.setItem('infoForm', JSON.stringify(this.infoForm))
+            this.$router.back()
+        },
+        onNavBarLeft() {
+            if(this.isEdit) {
+                localStorage.setItem('infoForm', JSON.stringify(this.infoForm))
+            }else {
+                localStorage.setItem('infoForm', '')
+            }
+            this.$router.back()
+        }
+      
+    }
+}
+</script>
+<style lang="scss" scoped>
+.main_bg {
+    padding: 0 25px;
+    box-sizing: border-box;
+    .page {
+        font-size: 28px;
+        .cell {
+            border-bottom: 1px solid #eee;
+            padding: 5px 0;
+            box-sizing: border-box;
+            display: flex;
+            align-items: center;
+            .van-col {
+                min-height: 80px;
+                display: flex;
+                align-items: center;
+                span {
+                    color: #f62a59;
+                }
+            }
+        }
+    }
+    .but 
+    {
+        text-align: center;
+        .van-button {
+            width: 620px;
+            margin: 24px auto;
+            color: #fff;
+            background-color: #1677ff;
+            border-radius: 12px;
+            font-size: 30px;
+        }
+    }
+}
+</style>