<template>
    <div>
        <el-form
                :label-position="labelPosition"
                :rules="rules"
                ref="formLabelAlign"
                label-width="220px"
                :model="formLabelAlign"
        >
<!--            <el-form-item class="oldPhoto" v-if="!isGo">-->
<!--                <div style="position:relative;">-->
<!--                    <el-button type="primary" size="mini" plain><i class="el-icon-camera-solid"-->
<!--                                                                   style="margin-right: 2px"></i>可拍身份证照片上传基本信息-->
<!--                    </el-button>-->
<!--                    <input-->
<!--                            class="camera"-->
<!--                            type="file"-->
<!--                            accept="image/*"-->
<!--                            capture="camera"-->
<!--                            style="width: 100%;"-->
<!--                            ref="fileItemCard"-->
<!--                            @change="test"-->
<!--                    />-->
<!--                </div>-->
<!--            </el-form-item>-->
            <el-form-item label="姓名" ref="name" prop="name">
                <el-input
                        :disabled="isGo"
                        v-model="formLabelAlign.name"
                        @blur="sumbitOlds"
                        @blur.prevent="inputLoseFocus"
                ></el-input>
            </el-form-item>
            <el-form-item label="性别" ref="sex" prop="sex">
                <el-radio-group
                        :disabled="isGo"
                        v-model="formLabelAlign.sex"
                        @change="(val)=>{selectInfo2(val,'sex')}"
                >
                    <el-radio label="男"></el-radio>
                    <el-radio label="女"></el-radio>
                </el-radio-group>
            </el-form-item>
            <el-form-item label="民族" ref="nation" prop="nation">
                <el-select
                        :disabled="isGo"
                        v-model="formLabelAlign.nation"
                        placeholder="请选择"
                        @change="(val)=>{selectInfo2(val,'nation')}"
                >
                    <el-option
                            v-for="item in options"
                            :key="item.value"
                            :label="item.label"
                            :value="item.value"
                    ></el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="身份证号" ref="idNumber" prop="idNumber">
                <el-input
                        :disabled="isGo"
                        v-model="formLabelAlign.idNumber "
                        @blur="(val)=>{selectInfo2(val,'idNumber')}"
                ></el-input>
            </el-form-item>
          <el-form-item label="是否为八类老年人" ref="eightType" prop="eightType">
            <el-radio-group
                v-model="formLabelAlign.eightType"
                @change="(val)=>{selectInfo2(val,'eightType')}"
            >
              <el-radio :label="0">否</el-radio>
              <el-radio :label="1">是</el-radio>
            </el-radio-group>
          </el-form-item>
          <!--&lt;!&ndash;老人能力情况是必填的&ndash;&gt;-->
          <el-form-item label="老年人能力情况" prop="ability" ref="ability">
            <el-select
                v-model="formLabelAlign.ability"
                placeholder="请选择"
                @change="changeAbility"
            >
              <el-option
                  v-for="item in abilitys"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                  :disabled=" formLabelAlign.eightType == 0 && item.label =='失能' "></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="老年人类别" v-if="formLabelAlign.eightType == 1" prop="oldType" ref="oldType">
            <el-checkbox-group v-model="formLabelAlign.oldType " @change="changesto">
              <el-checkbox label="农村留守老年人" :disabled="ldisold" @change="isLdisold"></el-checkbox>
              <el-checkbox label="分散供养特困老年人" :disabled="fdisold"></el-checkbox>
              <el-checkbox label="计划生育特殊家庭老人" :disabled="jdisold"></el-checkbox>
              <el-checkbox label="空巢老年人" :disabled="kdisold"></el-checkbox>
              <el-checkbox label="独居老年人" :disabled="djisold"></el-checkbox>
              <el-checkbox label="重残老人"   :disabled="zcisold"></el-checkbox>
              <el-checkbox label="高龄老人"   :disabled="glisold"></el-checkbox>
<!--              <el-checkbox label="居家老年人" :disabled="jjisold"></el-checkbox>-->
<!--              <el-checkbox v-if="formLabelAlign.ability=='失能'" :disabled=true label="失能老人"></el-checkbox>-->
              <el-checkbox  :disabled=true label="失能老人"></el-checkbox>
<!--              <el-checkbox label="失能老人"></el-checkbox>-->
            </el-checkbox-group>
          </el-form-item>

            <el-form-item label="是否是党员" ref="partyMember" prop="partyMember">
                <el-radio-group
                        v-model="formLabelAlign.partyMember"
                        @change="(val)=>{selectInfo2(val,'partyMember')}"
                >
                    <el-radio :label="0">否</el-radio>
                    <el-radio :label="1">是</el-radio>
                </el-radio-group>
            </el-form-item>
            <el-form-item label="联系电话" ref="phone" prop="phone">
                <el-input v-model="formLabelAlign.phone" @blur="(val)=>{selectInfo2(val,'phone')}"></el-input>
            </el-form-item>
            <!--npm install picker-extend -D-->
            <div id="trigger4" v-show="false" style="width: 0;height: 0"></div>
            <el-form-item label="户籍地址" prop="nativePlace" ref="nativePlace">
                <el-col :span="24" @click.native="changdeptnext" style="color:#409EFF ">
                    <!--{{formLabelAlign.nativePlace ||'点击选择户籍地址'}}-->
                    点击选择户籍地址
                </el-col>
                <el-input
                        :disabled="true"
                        type="textarea"
                        autosize
                        v-model="formLabelAlign.nativePlace"
                        @blur="selectInfoNative"
                        placeholder="请填写户籍地址"
                ></el-input>
            </el-form-item>

            <el-input
                    v-model="formLabelAlign.nativePlaceExt"
                    @blur="selectInfo5"
                    placeholder="请填写户籍地址补充信息"
            ></el-input>
            <el-form-item label>
                <el-checkbox v-model="checked" @change="isdept">现居住地址与户籍地址一致</el-checkbox>
            </el-form-item>
            <div id="trigger5" v-show="false" style="width: 0;height: 0"></div>
            <el-form-item label="现居地址" prop="address" ref="address">
                <el-col :span="24" @click.native="changdept" style="color:#409EFF " v-show="!ifAddress">
                    <!--{{formLabelAlign.address || '点击选择现居地址'}}-->
                    点击选择现居地址
                </el-col>
                <el-input
                        :disabled="true"
                        type="textarea"
                        autosize
                        v-model="formLabelAlign.address"
                        @blur="infoAlignAddress"
                        placeholder="请填写现居地址"
                ></el-input>
            </el-form-item>
            <el-input
                    :disabled="ifAddress"
                    v-model="formLabelAlign.addressExt"
                    @blur="infoAddress"
                    :placeholder="addressExtPH"
            ></el-input>

            <el-form-item label="婚姻及配偶情况" prop="partnerState" ref="partnerState">
                <el-radio-group v-model="formLabelAlign.partnerState" @change="changestate">
                    <el-radio label="未婚">未婚</el-radio>
                    <el-radio label="已婚">已婚</el-radio>
                    <el-radio label="离异">离异</el-radio>
                    <el-radio label="丧偶">丧偶</el-radio>
                </el-radio-group>
            </el-form-item>
            <div class="partner" v-if="viPartnerName">
                <el-form-item label="配偶姓名" ref="partnerName" prop="partnerName">
                    <el-input
                            v-model="formLabelAlign.partnerName "
                            @blur="(val)=>{selectInfo2(val,'partnerName')}"
                    ></el-input>
                </el-form-item>
                <el-form-item label="配偶身份证号" ref="partnerIdNumber" prop="partnerIdNumber">
                    <el-input
                            v-model="formLabelAlign.partnerIdNumber"
                            @blur="(val)=>{selectInfo2(val,'partnerIdNumber')}"
                    ></el-input>
                </el-form-item>
            </div>

            <el-form-item label="健康状况" prop="health" ref="health">
                <el-checkbox-group v-model="formLabelAlign.health" @change="changes">
                    <el-checkbox label="健康"></el-checkbox>
                    <el-checkbox label="残疾" :disabled="disHealth" @change="changesy"></el-checkbox>
                    <el-checkbox label="患重特大疾病" :disabled="disHealth" @change="changesy1"></el-checkbox>
                    <el-checkbox label="老年人慢性病" :disabled="disHealth"></el-checkbox>
                </el-checkbox-group>
            </el-form-item>
            <el-form-item label="残疾类别" v-if="canType" prop="disabilityCategory" ref="disabilityCategory">
                <el-checkbox-group
                        v-model="formLabelAlign.disabilityCategory"
                        @change="(val)=>{selectInfo2(val,'disabilityCategory')}"
                >
                    <el-checkbox label="视力残疾"></el-checkbox>
                    <el-checkbox label="听力残疾"></el-checkbox>
                    <el-checkbox label="言语残疾"></el-checkbox>
                    <el-checkbox label="肢体残疾"></el-checkbox>
                    <el-checkbox label="智力残疾"></el-checkbox>
                    <el-checkbox label="精神残疾"></el-checkbox>
                    <el-checkbox label="多重残疾"></el-checkbox>
                </el-checkbox-group>
            </el-form-item>
            <el-form-item label="残疾人等级" v-if="canType" prop="disabilityLevel" ref="disabilityLevel">
                <el-select
                        v-model="formLabelAlign.disabilityLevel"
                        placeholder="请选择"
                        @change="(val)=>{selectInfo2(val,'disabilityLevel')}"
                >
                    <el-option
                            v-for="item in optionCod"
                            :key="item.value"
                            :label="item.label"
                            :value="item.value"
                    ></el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="重特大疾病类别" v-if="canType1" prop="majorDiseases" ref="majorDiseases">
                <el-checkbox-group
                        v-model="formLabelAlign.majorDiseases"
                        @change="(val)=>{selectInfo2(val,'majorDiseases')}"
                >
                    <el-checkbox label="重大器官类疾病"></el-checkbox>
                    <el-checkbox label="心脑血管类疾病"></el-checkbox>
                    <el-checkbox label="神经与代谢类疾病"></el-checkbox>
                    <el-checkbox label="肢体与病毒类疾病"></el-checkbox>
                    <el-checkbox label="恶性肿瘤"></el-checkbox>
                </el-checkbox-group>
            </el-form-item>
            <el-form-item label="生活经济状况" prop="livingCondition" ref="livingCondition">
                <el-select
                        v-model="formLabelAlign.livingCondition"
                        placeholder="请选择"
                        @change="(val)=>{selectInfo2(val,'livingCondition')}"
                >
                    <el-option
                            v-for="item in livingConditions"
                            :key="item.value"
                            :label="item.label"
                            :value="item.value"
                    ></el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="收入来源" prop="sourceOfIncome" ref="sourceOfIncome">
                <el-checkbox-group v-model="formLabelAlign.sourceOfIncome" @change="changeincome">
                    <el-checkbox label="家庭经营性收入"></el-checkbox>
                    <el-checkbox label="工资性收入"></el-checkbox>
                    <el-checkbox label="转移性收入"></el-checkbox>
                    <el-checkbox label="财产性收入"></el-checkbox>
                    <el-checkbox label="其它" @change="changSourceOfIncome"></el-checkbox>
                    <el-form-item v-if="ifIncone" prop="sourceOfIncomeExt" ref="sourceOfIncomeExt">
                        <el-input
                                v-model="formLabelAlign.sourceOfIncomeExt"
                                placeholder="请填写其它收入来源"
                                @blur="(val)=>{selectInfo2(val,'sourceOfIncomeExt')}"
                        ></el-input>
                    </el-form-item>
                </el-checkbox-group>
            </el-form-item>
            <el-form-item label="本人上年度可支配收入" prop="income" ref="income">
                <el-select
                        v-model="formLabelAlign.income "
                        placeholder="请选择"
                        @change="(val)=>{selectInfo2(val,'income')}"
                >
                    <el-option
                            v-for="item in incomes"
                            :key="item.value"
                            :label="item.label"
                            :value="item.value"
                    ></el-option>
                </el-select>
            </el-form-item>
            <!--家庭救助帮扶情况不是必填的-->
            <el-form-item label="家庭救助帮扶情况" prop="rescueState" ref="rescueState">
                <el-checkbox-group v-model="formLabelAlign.rescueState " @change="changest">
                    <el-checkbox label="低保"></el-checkbox>
                    <el-checkbox label="建档立卡贫困户"></el-checkbox>
                    <el-checkbox label="医疗救助"></el-checkbox>
                    <el-checkbox label="临时救助"></el-checkbox>
                    <el-checkbox label="老年人福利津贴"></el-checkbox>
                    <el-checkbox label="残疾人两项补贴(或一项补贴)"></el-checkbox>
                    <el-checkbox label="其他救助" @change="changRescueState"></el-checkbox>
                    <el-form-item v-if="ifRescueState">
                        <el-input
                                v-model="formLabelAlign.rescueStateExt"
                                placeholder="请填写其他帮扶情况"
                                @blur="selectInfo6"
                        ></el-input>
                    </el-form-item>
                </el-checkbox-group>
            </el-form-item>
            <el-form-item label="是否为失独家庭" prop="isLoss" ref="isLoss">
                <el-radio-group
                        v-model="formLabelAlign.isLoss"
                        @change="(val)=>{selectInfo2(val,'isLoss')}"
                >
                    <el-radio label="是">是</el-radio>
                    <el-radio label="否">否</el-radio>
                </el-radio-group>
            </el-form-item>
            <el-form-item label="陪伴居住情况" prop="accompany" ref="accompany">
                <el-checkbox-group v-model="formLabelAlign.accompany" @change="changestd">
                    <el-checkbox label="无人陪伴居住"></el-checkbox>
                    <el-checkbox label="配偶" :disabled="disCategory"></el-checkbox>
                    <el-checkbox label="近亲属" :disabled="disCategory"></el-checkbox>
                    <el-checkbox label="未成年孙子女" :disabled="disCategory"></el-checkbox>
                    <el-checkbox label="其他情形" :disabled="disCategory" @change="changQestd"></el-checkbox>
                    <el-form-item v-if="ifDisabilityCategory" prop="accompanyExt" ref="accompanyExt">
                        <el-input
                                v-model="formLabelAlign.accompanyExt"
                                placeholder="请填写其他情形"
                                @blur="(val)=>{selectInfo2(val,'accompanyExt')}"
                        ></el-input>
                    </el-form-item>
                </el-checkbox-group>
            </el-form-item>
            <el-form-item label="日常生活照料人" prop="lookAfter" ref="lookAfter">
                <el-checkbox-group v-model="formLabelAlign.lookAfter" @change="changestl">
                    <el-checkbox label="无人照料"></el-checkbox>
                    <el-checkbox label="近亲属" :disabled="disLookAfter"></el-checkbox>
                    <el-checkbox label="配偶" :disabled="disLookAfter"></el-checkbox>
                    <el-checkbox label="邻里互助" :disabled="disLookAfter"></el-checkbox>
                    <el-checkbox label="购买养老服务" :disabled="disLookAfter"></el-checkbox>
                    <el-checkbox label="其他人员" :disabled="disLookAfter" @change="changesQtl"></el-checkbox>
                    <el-form-item v-if="ifLookAfter" prop="lookAfterExt" ref="lookAfterExt">
                        <el-input
                                v-model="formLabelAlign.lookAfterExt"
                                placeholder="请填写人员关系"
                                @blur="(val)=>{selectInfo2(val,'lookAfterExt')}"
                        ></el-input>
                    </el-form-item>
                </el-checkbox-group>
            </el-form-item>
            <div class="partner" v-if="mainLookAfter">
                <el-form-item label="主要照料人姓名" prop="mainLookName" ref="mainLookName">
                    <el-input
                            v-model="formLabelAlign.mainLookName "
                            @blur="(val)=>{selectInfo2(val,'mainLookName')}"
                    ></el-input>
                </el-form-item>
                <el-form-item label="主要照料人性别" prop="mainLookSex" ref="mainLookSex">
                    <el-radio-group
                            v-model="formLabelAlign.mainLookSex"
                            @change="(val)=>{selectInfo2(val,'mainLookSex')}"
                    >
                        <el-radio label="男">男</el-radio>
                        <el-radio label="女">女</el-radio>
                    </el-radio-group>
                </el-form-item>
                <el-form-item label="主要照料人电话" prop="mainLookPhone" ref="mainLookPhone">
                    <el-input
                            v-model="formLabelAlign.mainLookPhone"
                            @blur="(val)=>{selectInfo2(val,'mainLookPhone')}"
                    ></el-input>
                </el-form-item>
            </div>
            <el-form-item label="关爱服务需求" prop="demand" ref="demand">
                <el-checkbox-group v-model="formLabelAlign.demand" @change="changestld">
                    <el-checkbox label="生活照料"></el-checkbox>
                    <el-checkbox label="生产帮助"></el-checkbox>
                    <el-checkbox label="精神慰籍"></el-checkbox>
                    <el-checkbox label="医疗保健"></el-checkbox>
                    <el-checkbox label="权益维护"></el-checkbox>
                    <el-checkbox label="安全监护"></el-checkbox>
                    <el-checkbox label="文化娱乐"></el-checkbox>
                    <el-checkbox label="紧急救助"></el-checkbox>
                    <el-checkbox label="其它" @change="changDemand"></el-checkbox>
                    <el-form-item v-if="ifDemand" prop="demandExt" ref="demandExt">
                        <el-input
                                v-model="formLabelAlign.demandExt"
                                placeholder="请填写其它服务"
                                @blur="(val)=>{selectInfo2(val,'demandExt')}"
                        ></el-input>
                    </el-form-item>
                </el-checkbox-group>
            </el-form-item>
            <el-form-item class="oldPhoto" label="老人照片" prop="photo" ref="photo">
                <br/>
                <div>
          <span
                  v-for="(u,index) in urls"
                  :key="index"
                  style="position: relative;display: inline-block; margin-right: 1% "
          >
            <el-image
                    :src="servelUrl+u"
                    @click="look(u)"
                    style="width: 100px;height: 100px;margin-bottom: 5%;"
            >
              <div slot="placeholder" class="image-slot">照片加载中...</div>
            </el-image>
            <span
                    style="position: absolute;top: 5%;right: 5%;color: #ffffff;"
                    @click="deleteImg(index)"
            >
              <i class="el-icon-circle-close"></i>
            </span>
          </span>
                </div>
                <div style="position:relative;">
                    <el-button v-if="isShowUpload" type="primary" size="mini" plain>请上传含面部照片</el-button>
                    <input
                            class="camera"
                            v-if="isShowUpload"
                            type="file"
                            accept="image/*"
                            capture="camera"
                            style="width: 100%;"
                            ref="fileItem"
                            @change="changeFile"
                    />
                </div>
                <el-amap
                        class="amap-box"
                        vid="amapDemo"
                        :zoom="14"
                        v-if="isUploading"
                        :center="[125.290178, 43.8406]"
                        :plugin="plugin"
                ></el-amap>
            </el-form-item>
        </el-form>
        <el-image
                :src="require('../../assets/ic_tip.png')"
                style="position: fixed;top:10vh;right: 10px;width: 20px;"
                @click="Scroll"
        />
    </div>
</template>

<script>
    import PickerExtend from "picker-extend";
    import {getToken, updateOlds, CountryDeptList, getLivPicByBase64} from "../../api";
    import config from '@/util/config';
    import nation from "../../util/nation";
    import lrz from "lrz";
    import {mapMutations} from "vuex";
    import axios from 'axios'
    import getClient from "../../util/oss";
    import uploadType from "../../util/uploadType";
    import {idCard} from "@/util/checkIdCard";

    export default {
        name: "Olds",
        props: ["oId", "OldName", "clickTabIndex", "oldData"],
        data() {
            let checkName = (rule, value, callback) => {
                if (!value) {
                    callback(new Error("老人姓名不能为空"));
                } else {
                    let reg = /^(?:[\u4e00-\u9fa5·]{2,16})$/;
                    if (!reg.test(value)) {
                        callback(new Error("请输入中文格式"));
                    } else {
                        callback();
                    }
                }
            };
            let checkIdNumber = (rule, value, callback) => {
                if (!value) {
                    callback(new Error("身份证号不能为空"));
                } else {
                    if (value.length !== 18) {
                        callback(new Error("请输入十八位身份证号"));
                    } else {
                        let cIdNum1 = this.newTime - 60 * 10000;
                        let cIdNum2 = this.newTime - 210 * 10000;
                        let cIdNum3 = this.newTime - 150 * 10000;
                        let reg = /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
                        if (!reg.test(value)) {
                            callback(new Error("请输入正确身份证号"));
                        } else if (cIdNum1 < window.parseInt(value.substr(6, 8))) {
                            callback(new Error("老人年龄不能小于60周岁"));
                        } else if (cIdNum3 > window.parseInt(value.substr(6, 8))) {
                            callback(new Error("老人年龄不能超过150周岁"));
                        }else if (cIdNum2 > window.parseInt(value.substr(6, 8))) {
                            callback(new Error("请输入正确身份证号"));
                        } else {
                            callback();
                        }
                    }
                }
            };
            let self = this;
            return {
                waitDept: true,
                deptOption: [0, 0, 0, 0, 0],
                deptOption1: [0, 0, 0, 0, 0],
                addressExtPH: "请填写现居地址补充信息",
                newTime: "",
                isGo: false,
                index: "",
                oldId: "",
                labelPosition: "top",
                deptsId: "",
                formLabelAlign: {
                    name: "",
                    region: "",
                    type: "",
                    sex: "",
                    nation: "",
                    idNumber: "",
                    partyMember:0,
                    eightType:0,
                    phone: "",
                    address: "",
                    addressExt: "",
                    isSameWithAddress: false,
                    nativePlace: "",
                    nativePlaceExt: "",
                    partnerState: "",
                    partnerName: "",
                    partnerIdNumber: "",
                    isLoss: "",
                    health: [],
                    disabilityCategory: [],
                    disabilityLevel: "",
                    majorDiseases: [],
                    ability: "",
                    eightTypeOfNotAbility: "",
                    livingCondition: "",
                    sourceOfIncome: [],
                    income: "",
                    rescueState: [],
                    rescueState11: "",
                    accompany: [],
                    lookAfter: [],
                    mainLookName: "",
                    mainLookSex: "",
                    mainLookPhone: "",
                    demand: [],
                    oldType: [],
                    oldTypeOfNotOldType: [],
                    photo: "",
                    photoAndLocation: "",
                    //其他
                    sourceOfIncomeExt: "",
                    rescueStateExt: "",
                    accompanyExt: "",
                    lookAfterExt: "",
                    demandExt: ""
                },
                oldList: {},
                rules: {
                    name: [{required: true, validator: checkName, trigger: "blur"}],
                    idNumber: [
                        // {required: true, validator: checkIdNumber, trigger: "blur"}
                        {required: true, validator: idCard, trigger: "blur"}
                    ],
                    eightType: [
                      // {required: true, validator: checkIdNumber, trigger: "blur"}
                      {required: true, message: "选项不能为空", trigger: "change"}
                    ],
                    phone: [{required: true, message: "请输入联系电话", trigger: "blur"}],
                    partnerName: [
                        {required: true, message: "请输入配偶姓名", trigger: "blur"},
                        {
                            pattern: /^[\u2E80-\u9FFF]+$/,
                            message: "请输入中文格式",
                            trigger: "blur"
                        }
                    ],
                    partnerIdNumber: [
                        {required: true, message: "请输入身份证号", trigger: "blur"},
                        {
                            pattern: /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,
                            message: "身份证号格式不对",
                            trigger: "blur"
                        }
                    ],
                    mainLookName: [
                        {required: true, message: "请输入姓名", trigger: "blur"},
                        {
                            pattern: /^[\u2E80-\u9FFF]+$/,
                            message: "请输入中文格式",
                            trigger: "blur"
                        }
                    ],
                    mainLookPhone: [
                        {required: true, message: "请输入联系电话", trigger: "blur"}
                    ],
                    sex: [{required: true, message: "性别不能为空", trigger: "change"}],
                    nation: [
                        {required: true, message: "民族不能为空", trigger: "change"}
                    ],
                    address: [
                        {required: true, message: "居住地址不能为空", trigger: "blur"}
                    ],
                    partnerState: [
                        {
                            required: true,
                            message: "婚姻及配偶情况不能为空",
                            trigger: "change"
                        }
                    ],
                    health: [
                        {required: true, message: "健康状况不能为空", trigger: "change"}
                    ],
                    disabilityCategory: [
                        {required: true, message: "残疾类别不能为空", trigger: "change"}
                    ],
                    disabilityLevel: [
                        {required: true, message: "残疾等级不能为空", trigger: "change"}
                    ],
                    majorDiseases: [
                        {required: true, message: "重特大疾病类别不能为空", trigger: "change"}
                    ],
                    ability: [
                        {required: true, message: "老人能力情况不能为空", trigger: "change"}
                    ],
                    livingCondition: [
                        {required: true, message: "生活经济状况不能为空", trigger: "change"}
                    ],
                    sourceOfIncome: [
                        {required: true, message: "收入来源不能为空", trigger: "change"}
                    ],
                    income: [
                        {
                            required: true,
                            message: "本人上年度可支配收入不能为空",
                            trigger: "change"
                        }
                    ],
                    rescueState: [
                        {
                            required: true,
                            message: "家庭救助帮扶情况不能为空",
                            trigger: "change"
                        }
                    ],
                    rescueStateExt: [
                        {required: true, message: "其他救助不能为空", trigger: "change"}
                    ],
                    isLoss: [
                        {
                            required: true,
                            message: "是否为失独家庭不能为空",
                            trigger: "change"
                        }
                    ],
                    accompany: [
                        {required: true, message: "陪伴居住情况不能为空", trigger: "change"}
                    ],
                    lookAfter: [
                        {
                            required: true,
                            message: "日常生活照料人不能为空",
                            trigger: "change"
                        }
                    ],
                    mainLookSex: [
                        {required: true, message: "性别不能为空", trigger: "change"}
                    ],
                    demand: [
                        {required: true, message: "关爱服务需求不能为空", trigger: "change"}
                    ],
                    oldType: [
                        {required: true, message: "老年人类别不能为空", trigger: "change"}
                    ],
                    photo: [
                        {required: true, message: "老人照片不能为空", trigger: "change"}
                    ],
                    nativePlace: [
                        {required: true, message: "户籍地址不能为空", trigger: "change"}
                    ],
                    sourceOfIncomeExt: [
                        {required: true, message: "其它收入来源不能为空", trigger: "blur"}
                    ],
                    accompanyExt: [
                        {required: true, message: "其他情形不能为空", trigger: "blur"}
                    ],
                    lookAfterExt: [
                        {required: true, message: "人员关系不能为空", trigger: "blur"}
                    ],
                    demandExt: [
                        {required: true, message: "其它服务不能为空", trigger: "blur"}
                    ],
                },
                livingConditions: [
                    {
                        value: "建档立卡贫困户",
                        label: "建档立卡贫困户"
                    },
                    {
                        value: "一般家庭",
                        label: "一般家庭"
                    },
                    {
                        value: "低保",
                        label: "低保"
                    },
                    {
                        value: "特困供养人员",
                        label: "特困供养人员"
                    }
                ],
                optionCod: [
                    {
                        value: "一级",
                        label: "一级"
                    },
                    {
                        value: "二级",
                        label: "二级"
                    },
                    {
                        value: "三级",
                        label: "三级"
                    },
                    {
                        value: "四级",
                        label: "四级"
                    }
                ],
                abilitys: [
                    {
                        value: "完全自理",
                        label: "完全自理",
                    },
                    {
                        value: "半失能（部分自理）",
                        label: "半失能（部分自理）",
                    },
                    {
                        value: "失能",
                        label: "失能",
                    }
                ],
                incomes: [
                    {
                        value: "5000元以下",
                        label: "5000元以下"
                    },
                    {
                        value: "5000元~10000元",
                        label: "5000元~10000元"
                    },
                    {
                        value: "10000元以上",
                        label: "10000元以上"
                    }
                ],
                options: nation.nation,
                sourceOfIncome: [],
                disabilityCategory: [],
                majorDiseases: [],
                lookAfter: [],
                demand: [],
                viPartnerName: false,
                disHealth: false,
                canType: false,
                canType1: false,
                ifIncone: false,
                ifRescueState: false,
                disLookAfter: false,
                disCategory: false,
                ifDisabilityCategory: false,
                ifLookAfter: false,
                mainLookAfter: false,
                ifDemand: false,
                ldisold: false,
                oldTypesold: false,
                fdisold: false,
                jdisold: false,
                kdisold: false,
                djisold: false, // 独居-CH-新增-2023-7-3
                zcisold: false, // 重残-CH-新增-2023-7-3
                glisold: false, // 高龄-CH-新增-2023-7-3
                // jjisold: false, // 居家-CH-新增-2023-7-3
                snisold: false, // 失能-CH-新增-2023-7-3
                checked: false,
                mobileSelect4: "",
                mobileSelect5: "",
                ifAddress: false,
                //上传图片
                loading: {}, //全局加载框
                isShowUpload: true, //是否显示 选择文件
                isUploading: false, //是否正在上传
                urls: [],
                dialogVisible: false,
                plugin: [
                    {
                        pName: "Geolocation",
                        showMarker: false,
                        events: {
                            init(o) {
                                self.locationPlugin = o;
                            }
                        }
                    }
                ],
                //五级联动数据
                deptDatas: "",
                //状态
                isColor: false
            };
        },
        methods: {
            ...mapMutations(["changeDeptLoading"]),
            async test() {
                this.loading = this.$loading();
                const result = await getToken();
                let that = this;
                if (result.data.status == 200) {
                    let fileItem = this.$refs.fileItemCard;
                    //得到图片的路径
                    let file = fileItem.files[0];
                    lrz(file)
                    //成功时执行
                        .then(function (rst) {
                            let fd = rst.base64;
                            let form = new FormData();
                            // 文件对象
                            form.append("image", fd);
                            form.append("access_token", result.data.token);
                            form.append("id_card_side", 'front');
                            axios.post("https://aip.baidubce.com/rest/2.0/ocr/v1/idcard?access_token=" + result.data.token,
                                form,
                                {
                                    headers: {
                                        'content-type': 'application/x-www-form-urlencoded'
                                    },
                                    dataType: 'json',
                                }).then(res => {
                                console.log(res, 'res');
                                if (res.data.idcard_number_type == 1) {
                                    if (that.formLabelAlign.name == res.data.words_result['姓名'].words) {
                                        // console.log("1111111111",res.data.words_result['公民身份号码'].words.substr(6, 8));
                                        if ((that.newTime - 60 * 10000) >= window.parseInt(res.data.words_result['公民身份号码'].words.substr(6, 8)))
                                        // if(window.parseInt(res.data.words_result['公民身份号码'].words.substr(6, 8)))
                                        {
                                            that.formLabelAlign.sex = res.data.words_result['性别'].words;
                                            that.formLabelAlign.idNumber = res.data.words_result['公民身份号码'].words;
                                            that.formLabelAlign.nation = res.data.words_result['民族'].words + '族';
                                            console.log(res.data.words_result['公民身份号码'].words, '我是公民身份证号');
                                            that.selectInfo2(res.data.words_result['性别'].words, 'sex');
                                            that.selectInfo2(res.data.words_result['民族'].words, 'nation');
                                            that.selectInfo2(res.data.words_result['公民身份号码'].words, 'idNumber');
                                        } else {
                                            that.$message.error('当前老人不满60周岁');
                                        }

                                    } else {
                                        that.$message.error('添加当前老人名字和扫描身份证名字不一致,请重新扫描');
                                    }
                                }else
                                {
                                    that.$message.error('身份证OCR识别失败');
                                }
                                that.loading.close();
                            })
                                .catch(e => {
                                    that.$message.error(e.message);
                                    that.loading.close();
                                })
                        })
                        .catch(function (error) {
                            that.$message.error(error.message);
                            that.loading.close();
                        });

                }
            },
            changeAbility(val) {
                this.selectInfo2(val, 'ability');
                // if (val == '失能') {
                //     this.formLabelAlign.oldType.push('失能老人');
                //     this.selectInfo2("", "oldType");
                // } else {
                //     // if (this.formLabelAlign.oldType.indexOf('失能老人') == -1) {
                //     this.formLabelAlign.oldType = this.formLabelAlign.oldType.filter((item) => {
                //         return item != '失能老人';
                //     });
                //     this.selectInfo2("", "oldType");
                //   // }
                // }
            },
            isLdisold(data) {
                if (data == false) {
                    let index = this.formLabelAlign.oldType.indexOf("空巢老年人");
                    if (index != -1) {
                        this.formLabelAlign.oldType.splice(index, 1);
                    }
                }
            },
            isAbility(data) {
                if (data == false) {
                    this.formLabelAlign.ability = '';
                    this.selectInfo2('', 'ability');
                }
            },
            toScroll() {
                setTimeout(() => {
                    this.$refs["formLabelAlign"].validate(valid => {
                        if (valid) {
                            this.isColor = true;
                            this.$emit("isColor", this.isColor, this.index);
                        } else {
                            this.isColor = false;
                            this.$emit("isColor", this.isColor, this.index);
                        }
                    });
                    this.$refs["formLabelAlign"].clearValidate();
                }, 0);
            },
            Scroll() {
                setTimeout(() => {
                    this.$refs["formLabelAlign"].validate((valid, obj) => {
                        if (valid) {
                            this.isColor = true;
                            this.$emit("isColor", this.isColor, this.index);
                        } else {
                            this.isColor = false;
                            this.$emit("isColor", this.isColor, this.index);
                            let vKey = "";
                            Object.keys(obj).forEach(item => {
                                if (!vKey) {
                                    vKey = item;
                                }
                            });
                            this.$refs[vKey].$el.scrollIntoView({
                                behavior: "auto",
                                block: "center",
                                inline: "nearest"
                            });
                        }
                    });
                    // this.$refs['formLabelAlign'].clearValidate();
                }, 200);
            },
            async findDept(level, fid, abbreviation) {
                this.waitDept = false;
                if (level < 5) {
                    let result = await CountryDeptList({fid: fid});
                    if (result.code == 0 && result.data.length > 0) {
                        if (abbreviation) {
                            result.data.map(item => {
                                let name = item.CIVILREGIONALISMNAME;
                                abbreviation.forEach(items => {
                                    item.CIVILREGIONALISMNAME = item.CIVILREGIONALISMNAME.replace(
                                        items,
                                        ""
                                    );
                                });
                                if (!item.CIVILREGIONALISMNAME) {
                                    item.CIVILREGIONALISMNAME = name;
                                }
                                return item.CIVILREGIONALISMNAME;
                            });
                            abbreviation.push(result.data[0].CIVILREGIONALISMNAME);
                        }
                        this.mobileSelect4.updateWheel(level, result.data);
                        this.mobileSelect4.locatePosition(level, 0);
                        await this.findDept(
                            level + 1,
                            result.data[0].CIVILREGIONALISMID,
                            abbreviation
                        );
                    } else {
                        this.mobileSelect4.updateWheel(level, [
                            {CIVILREGIONALISMID: 0, CIVILREGIONALISMNAME: ""}
                        ]);
                        await this.findDept(level + 1, 789465);
                    }
                } else {
                    this.waitDept = true;
                }
            },
            clearDept(level) {
                if (level < 5) {
                    this.mobileSelect4.updateWheel(level, [
                        {CIVILREGIONALISMID: 0, CIVILREGIONALISMNAME: ""}
                    ]);
                    this.clearDept(level + 1);
                }
            },
            clearDepts(level) {
                if (level < 5) {
                    this.mobileSelect5.updateWheel(level, [
                        {CIVILREGIONALISMID: 0, CIVILREGIONALISMNAME: ""}
                    ]);
                    this.clearDepts(level + 1);
                }
            },
            addZero(data) {
                if (data.length < 5) {
                    data.push(0);
                    this.addZero(data);
                }
                return data;
            },
            async findDepts(level, fid, abbreviation) {
                this.waitDept = false;
                if (level < 5) {
                    let result = await CountryDeptList({fid: fid});
                    if (result.code == 0 && result.data.length > 0) {
                        if (abbreviation) {
                            result.data.map(item => {
                                let name = item.CIVILREGIONALISMNAME;
                                abbreviation.forEach(items => {
                                    item.CIVILREGIONALISMNAME = item.CIVILREGIONALISMNAME.replace(
                                        items,
                                        ""
                                    );
                                });
                                if (!item.CIVILREGIONALISMNAME) {
                                    item.CIVILREGIONALISMNAME = name;
                                }
                                return item.CIVILREGIONALISMNAME;
                            });
                            abbreviation.push(result.data[0].CIVILREGIONALISMNAME);
                        }
                        this.mobileSelect5.updateWheel(level, result.data);
                        this.mobileSelect5.locatePosition(level, 0);
                        await this.findDepts(
                            level + 1,
                            result.data[0].CIVILREGIONALISMID,
                            abbreviation
                        );
                    } else {
                        // this.waitDept=true;
                        this.mobileSelect5.updateWheel(level, [
                            {CIVILREGIONALISMID: 0, CIVILREGIONALISMNAME: ""}
                        ]);
                        await this.findDepts(level + 1, 789465);
                    }
                } else {
                    this.waitDept = true;
                }
            },
            async cascading() {
                this.$loading();
                let deptList = [];
                let result = await CountryDeptList();
                if (result.code == 0) {
                    result.data.sort(function (a, b) {
                        if (a.CIVILREGIONALISMNAME == "吉林省") {
                            return -1;
                        }
                        if (b.CIVILREGIONALISMNAME == "吉林省") {
                            return 1;
                        }
                        return 0;
                    });

                    result.data.length > 0
                        ? (result = result)
                        : (result = {
                            data: [{CIVILREGIONALISMID: 0, CIVILREGIONALISMNAME: ""}]
                        });
                    deptList.push(result);
                    let result2 = await CountryDeptList({
                        fid: result.data[0].CIVILREGIONALISMID
                    });
                    if (result2.code == 0) {
                        result2.data.length > 0
                            ? (result2 = result2)
                            : (result2 = {
                                data: [{CIVILREGIONALISMID: 0, CIVILREGIONALISMNAME: ""}]
                            });
                        deptList.push(result2);
                        let result3 = await CountryDeptList({
                            fid: result2.data[0].CIVILREGIONALISMID
                        });
                        if (result3.code == 0) {
                            result3.data.length > 0
                                ? (result3 = result3)
                                : (result3 = {
                                    data: [{CIVILREGIONALISMID: 0, CIVILREGIONALISMNAME: ""}]
                                });
                            deptList.push(result3);
                            let result4 = await CountryDeptList({
                                fid: result3.data[0].CIVILREGIONALISMID
                            });
                            if (result4.code == 0) {
                                result4.data.length > 0
                                    ? (result4 = result4)
                                    : (result4 = {
                                        data: [{CIVILREGIONALISMID: 0, CIVILREGIONALISMNAME: ""}]
                                    });
                                deptList.push(result4);
                                let result5 = await CountryDeptList({
                                    fid: result4.data[0].CIVILREGIONALISMID
                                });
                                if (result5.code == 0) {
                                    result5.data.length > 0
                                        ? (result5 = result5)
                                        : (result5 = {
                                            data: [
                                                {CIVILREGIONALISMID: 0, CIVILREGIONALISMNAME: ""}
                                            ]
                                        });
                                    deptList.push(result5);
                                    this.$loading().close();
                                }
                            }
                        }
                    }
                }
                if (deptList.length > 0) {
                    let that = this;
                    this.mobileSelect4 = new PickerExtend({
                        trigger: "#trigger4",
                        title: "选择地区",
                        wheels: deptList,
                        keyMap: {
                            id: "CIVILREGIONALISMID",
                            value: "CIVILREGIONALISMNAME"
                            // childs :'childs'
                        },
                        position: [0, 0, 0, 0, 0], //初始化定位
                        callback: function (indexArr, data) {
                            if (that.waitDept) {
                                let arr = [];
                                let arrId = [];
                                data.forEach(item => {
                                    arr.push(item.CIVILREGIONALISMNAME);
                                    arrId.push(item.CIVILREGIONALISMCODE);
                                });
                                that.formLabelAlign.address = arr.join("/");
                                that.toScroll();
                                that.updateOlds({
                                    id: that.oldId,
                                    address: that.formLabelAlign.address,
                                    addressId: arrId.join(",")
                                });
                            } else {
                                that.$message.error("请等数据加载完,再选择");
                            }
                        },
                        transitionEnd: async function (indexArr, data) {
                            let indexd = [];
                            that.deptOption.forEach((item, index) => {
                                if (indexArr[index] != item) {
                                    indexd.push(index);
                                }
                            });
                            that.deptOption = indexArr;
                            that.deptOption.splice(indexd[0] + 1, data.length);
                            that.deptOption = that.addZero(that.deptOption);
                            let deptData = [];
                            data.forEach(item => {
                                if (item) {
                                    deptData.push(item.CIVILREGIONALISMNAME);
                                }
                            });
                            if (
                                !data[4] ||
                                !data[4].CIVILREGIONALISMLEVELID ||
                                (data[4].CIVILREGIONALISMLEVELID !== 5 && indexd[0] != 4)
                            ) {
                                deptData.splice(indexd[0] + 1, data.length);
                                if (indexd.length > 0) {
                                    that.waitDept = false;
                                    that.clearDept(parseInt(data[indexd[0]]));
                                    that.changeDeptLoading(true);
                                    await that.findDept(
                                        parseInt(data[indexd[0]].CIVILREGIONALISMLEVELID) - 1,
                                        data[indexd[0]].CIVILREGIONALISMID,
                                        deptData
                                    );
                                    that.changeDeptLoading(false);
                                }
                            }
                        }
                    });
                    this.mobileSelect5 = new PickerExtend({
                        trigger: "#trigger5",
                        title: "选择地区",
                        wheels: deptList,
                        keyMap: {
                            id: "CIVILREGIONALISMID",
                            value: "CIVILREGIONALISMNAME"
                            // childs :'childs'
                        },
                        position: [0, 0, 0, 0, 0], //初始化定位
                        callback: function (indexArr, data) {
                            if (that.waitDept) {
                                let arr = [];
                                let arrId = [];
                                data.forEach(item => {
                                    arr.push(item.CIVILREGIONALISMNAME);
                                    arrId.push(item.CIVILREGIONALISMCODE);
                                });
                                that.formLabelAlign.nativePlace = arr.join("/");
                                that.deptsId = arrId.join(",");
                                if (that.ifAddress) {
                                    that.addressExtPH = "";
                                    that.formLabelAlign.address = that.formLabelAlign.nativePlace;
                                    that.updateOlds({
                                        id: that.oldId,
                                        addressId: arrId.join(","),
                                        address: that.formLabelAlign.address
                                    });
                                } else {
                                    that.addressExtPH = "请填写现居地址补充信息";
                                }
                                that.toScroll();
                                that.updateOlds({
                                    id: that.oldId,
                                    nativePlace: that.formLabelAlign.nativePlace,
                                    nativePlaceId: arrId.join(",")
                                });
                            } else {
                                that.$message.error("请等数据加载完,再选择");
                            }
                        },
                        transitionEnd: async function (indexArr, data) {
                            let indexd = [];
                            that.deptOption1.forEach((item, index) => {
                                if (indexArr[index] != item) {
                                    indexd.push(index);
                                }
                            });
                            that.deptOption1 = indexArr;
                            that.deptOption1.splice(indexd[0] + 1, data.length);
                            that.deptOption1 = that.addZero(that.deptOption1);
                            let deptData = [];
                            data.forEach(item => {
                                if (item) {
                                    deptData.push(item.CIVILREGIONALISMNAME);
                                }
                            });
                            if (
                                !data[4] ||
                                !data[4].CIVILREGIONALISMLEVELID ||
                                (data[4].CIVILREGIONALISMLEVELID !== 5 && indexd[0] != 4)
                            ) {
                                if (indexd.length > 0) {
                                    that.waitDept = false;
                                    deptData.splice(indexd[0] + 1, data.length);
                                    that.clearDepts(parseInt(data[indexd[0]]));
                                    that.changeDeptLoading(true);
                                    await that.findDepts(
                                        parseInt(data[indexd[0]].CIVILREGIONALISMLEVELID) - 1,
                                        data[indexd[0]].CIVILREGIONALISMID,
                                        deptData
                                    );
                                    that.changeDeptLoading(false);
                                }
                            }
                        }
                    });
                }
            },
            deleteImg(index) {
                this.urls.splice(index, 1);
                this.isShowUpload = this.urls.length < 1;
                this.formLabelAlign.photo = "";
                this.toScroll();
                this.updateOlds({id: this.oldId, photo: ""});
            },
            async changeFile() {
            this.isShowUpload = false;
                this.loading = this.$loading();
                this.isUploading = true;
                let fileItem = this.$refs.fileItem;
                //得到图片的路径
                let file = fileItem.files[0];
                //.then 和 vue this 同名了
                let that = this;
                lrz(file)
                //成功时执行
                    .then(function (rst) {
                        let fd = rst.formData;
                        // that.findLoaction(fd,rst);
                        that.photoUp(fd,rst);
                        fileItem.value = "";
                    })
                    .catch(function (error) {
                        that.$message.error(error.message);
                        that.isShowUpload = true;
                        that.isUploading = false;
                        that.loading.close();
                    });
            },

            async photoUp(fd,rst) {
              const resultCode = await getLivPicByBase64({photoBase64:rst.base64});
              if(resultCode.code  ===  1){
                this.isUploading = false;
                this.loading.close();
                return false;
              }
                let file=getClient.base64toFile(rst.base64,rst.origin.name);
                const forData=new FormData();
                const receiveType = config.fileTypeConfig[uploadType.INFO];
                const picName = file.name;
                const filetype = picName.substring(picName.lastIndexOf("."));
                const filename =  receiveType + Date.now() + '_' + Math.floor(Math.random() * 10000) + filetype; // 存数据库里的路径需要/
                const objkey = filename.substring(1); // 上传至obs的 需要去掉起始的/
                forData.append("objkey",'sckjpicup$' + objkey);
                forData.append('objdata', file);

                const requestResult = await axios({
                  method: 'post',
                  // url: '/obs-demo/objUpload', // 146.3上测试
                  // url: 'http://abc.ccsckj.com/obs-demo/objUpload', // 测试域名
                  // url: 'http://info.windd.cn/obs-demo/objUpload', // 祥云147.2正式
                  url: 'https://info.windd.cn/obs-demo/objUpload', // 祥云147.2正式
                  data: forData,
                  // headers: forData.getHeaders(),
                });
                if (requestResult.status === 200) {
                  if(filename){
                    this.urls.push(filename);
                    this.formLabelAlign.photo = filename;
                    this.toScroll();
                    this.updateOlds({id: this.oldId, photo: filename});
                  }
                }else{
                  this.$message.error('公众号端上传老人照片失败!')
                }

                if (this.urls.length < 1) {
                    this.isShowUpload = true;
                }
                this.isUploading = false;
                this.loading.close();
            },
            findLoaction(fd,rst) {
                let self = this;
                //测试专用
                self.updateOldsLocation(
                    {
                        id: self.oldId,
                    },
                    fd,rst
                );
/** TODO 因业务需求变动，采集和探访时，不需要填写位置信息(只需要活体识别和人脸比对即可)-2023-4-26 16:28:22*/
                // this.locationPlugin.getCurrentPosition((status, result) => {
                //     if (result && result.position) {
                //         self.center = [result.position.lng, result.position.lat];
                //         let geocoder = new AMap.Geocoder({
                //             radius: 1000,
                //             extensions: "all"
                //         });
                //         self.lng = result.position.lng;
                //         self.lat = result.position.lat;
                //         geocoder.getAddress([self.lng, self.lat], function (status, result2) {
                //             if (status === "complete" && result2.info === "OK") {
                //                 if (result2 && result2.regeocode) {
                //                     self.visitLocation = result2.regeocode.formattedAddress;
                //                     self.$nextTick();
                //                 } else {
                //                     self.visitLocation = "无地址信息";
                //                 }
                //             } else {
                //                 self.visitLocation = "无地址信息";
                //             }
                //             //完成了经度纬度的查找就可以
                //             let addres = self.lng + "/" + self.lat + "/" + self.visitLocation;
                //             self.updateOldsLocation(
                //                 {
                //                     id: self.oldId,
                //                     photoAndLocation: addres.replace('"', "").replace("'", "")
                //                 },
                //                 fd,rst
                //             );
                //         });
                //     } else {
                //         self.$message.error("定位失败");
                //         self.isShowUpload = true;
                //         self.isUploading = false;
                //         self.loading.close();
                //     }
                // });
            },
            changdept() {
                this.mobileSelect4.show();
            },
            changdeptnext() {
                this.mobileSelect5.show();
            },
            changDemand(data) {
                if (data == false) {
                    this.formLabelAlign.demandExt = "";
                    this.updateOlds({
                        id: this.oldId,
                        demandExt: this.formLabelAlign.demandExt
                    });
                }
                this.selectInfo2("", "rescueStateExt");
            },
            changRescueState(data) {
                if (data == false) {
                    this.formLabelAlign.rescueStateExt = "";
                    this.updateOlds({
                        id: this.oldId,
                        rescueStateExt: this.formLabelAlign.rescueStateExt
                    });
                }
                this.selectInfo2("", "rescueStateExt");
            },
            changSourceOfIncome(data) {
                if (data == false) {
                    this.formLabelAlign.sourceOfIncomeExt = "";
                    this.updateOlds({
                        id: this.oldId,
                        sourceOfIncomeExt: this.formLabelAlign.sourceOfIncomeExt
                    });
                }
                this.selectInfo2("", "sourceOfIncomeExt");
            },
            changQestd(data) {
                if (data == false) {
                    this.formLabelAlign.accompanyExt = "";
                    this.updateOlds({
                        id: this.oldId,
                        accompanyExt: this.formLabelAlign.accompanyExt
                    });
                }
                this.selectInfo2("", "accompanyExt");
            },
            changesy(data) {
                if (data == false) {
                    this.formLabelAlign.disabilityCategory = [];
                    this.formLabelAlign.disabilityLevel = "";
                    this.updateOlds({
                        id: this.oldId,
                        health: JSON.stringify(this.formLabelAlign.health),
                        disabilityCategory: "",
                        disabilityLevel: ""
                    });
                }
                //this.toScroll();
            },
            changesy1(data) {
                if (data == false) {
                    this.formLabelAlign.majorDiseases = [];
                    this.updateOlds({
                        id: this.oldId,
                        health: JSON.stringify(this.formLabelAlign.health),
                        majorDiseases: "",
                    });
                }

            },
            isdept(data) {
                if (data == false) {
                    this.ifAddress = false;
                    this.addressExtPH = "请填写现居地址补充信息";
                } else {
                    this.addressExtPH = "";
                    this.formLabelAlign.address = this.formLabelAlign.nativePlace;
                    this.formLabelAlign.addressExt = this.formLabelAlign.nativePlaceExt;
                    this.ifAddress = true;
                }
                let a = "";
                if (this.checked) {
                    a = "是";
                    this.updateOlds({
                        id: this.oldId,
                        address: this.formLabelAlign.nativePlace,
                        addressExt: this.formLabelAlign.addressExt,
                        nativePlaceId: this.deptsId,
                        addressId: this.deptsId
                    });
                } else {
                    a = "否";
                    this.formLabelAlign.address = "";
                    this.formLabelAlign.addressExt = "";
                    this.updateOlds({id: this.oldId, address: "", addressExt: ""});
                }
                this.updateOlds({id: this.oldId, isSameWithAddress: a});
                this.toScroll();
            },
            changesto(data) {
                if (data.indexOf("农村留守老年人") !== -1) {
                    this.jdisold = true;
                    this.fdisold = true;
                    this.kdisold = true;
                  this.ldisold = false; // 这个是如果勾选了'农村'
                  this.djisold = false;
                  this.zcisold = false;
                  this.glisold = false;
                  // this.jjisold = false;
                  this.snisold = false;
                    if (this.formLabelAlign.oldType.indexOf("空巢老年人") == -1) {
                        this.formLabelAlign.oldType.push("空巢老年人");
                    }
                } else if (data.indexOf("分散供养特困老年人") !== -1) {
                    this.ldisold = true;
                    this.jdisold = true;
                    this.kdisold = true;
                  this.fdisold = false; // 勾选了 '分散供养特困老年人'
                  this.djisold = false;
                  this.zcisold = false;
                  this.glisold = false;
                  // this.jjisold = false;
                  this.snisold = false;
                } else if (data.indexOf("计划生育特殊家庭老人") !== -1) {
                    this.ldisold = true;
                    this.fdisold = true;
                    this.kdisold = true;
                  this.jdisold = false; // 勾选了 '计划生育特殊家庭老人'
                  this.djisold = false;
                  this.zcisold = false;
                  this.glisold = false;
                  // this.jjisold = false;
                  this.snisold = false;
                } else if (data.indexOf("空巢老年人") !== -1) {
                    this.jdisold = true;
                    this.ldisold = true;
                    this.fdisold = true;
                  this.kdisold = false; // 勾选了 '空巢老年人'
                  this.djisold = false;
                  this.zcisold = false;
                  this.glisold = false;
                  // this.jjisold = false;
                  this.snisold = false;
                } else {
                    this.ldisold = false;
                    this.fdisold = false;
                    this.jdisold = false;
                    this.kdisold = false;
                  this.djisold = false;
                  this.zcisold = false;
                  this.glisold = false;
                  // this.jjisold = false;
                  this.snisold = false;
                }
                this.selectInfo2("", "oldType");
            },
            changestld(data) {
                if (data.indexOf("其它") !== -1) {
                    this.ifDemand = true;
                } else {
                    this.ifDemand = false;
                    this.formLabelAlign.demandExt = "";
                }
                this.selectInfo2("", "demand");
            },
            changestl(data) {
                if (data.length > 0) {
                    if (data.indexOf("无人照料") !== -1) {
                        this.formLabelAlign.mainLookName = "";
                        this.formLabelAlign.mainLookSex = "";
                        this.formLabelAlign.mainLookPhone = "";
                        this.formLabelAlign.lookAfterExt = "";
                        this.formLabelAlign.lookAfter = [];
                        this.formLabelAlign.lookAfter.push("无人照料");
                        this.disLookAfter = true;
                        this.ifLookAfter = false;
                        this.mainLookAfter = false;
                        //this.updateOlds({id:this.oldId,lookAfterExt:this.formLabelAlign.lookAfterExt});
                    } else {
                        // if (data.indexOf("配偶") !== -1 || data.indexOf("邻里互助") !== -1 || data.indexOf("购买养老服务") !== -1 || data.indexOf("其他人员") !== -1 || data.indexOf("近亲属") !== -1) {
                        this.mainLookAfter = true;
                        // } else {
                        //     this.formLabelAlign.lookAfterExt="";
                        //     this.formLabelAlign.mainLookName="";
                        //     this.formLabelAlign.mainLookSex="";
                        //     this.formLabelAlign.mainLookPhone="";
                        //     this.disLookAfter = false;
                        //     this.mainLookAfter = false;
                        // }
                        // this.ifLookAfter=data.indexOf("其他人员") !== -1 && data.indexOf("无人照料") === -1;
                        // }
                        if (
                            data.indexOf("其他人员") !== -1 &&
                            data.indexOf("无人照料") === -1
                        ) {
                            this.ifLookAfter = true;
                        } else {
                            this.ifLookAfter = false;
                            this.formLabelAlign.lookAfterExt = "";
                            //this.selectInfo2('','lookAfterExt')
                            //this.updateOlds({id:this.oldId,lookAfterExt:this.formLabelAlign.lookAfterExt});
                        }
                    }
                } else {
                    this.formLabelAlign.mainLookName = "";
                    this.formLabelAlign.mainLookSex = "";
                    this.formLabelAlign.mainLookPhone = "";
                    // this.formLabelAlign.lookAfterExt = "";
                    this.disLookAfter = false;
                    this.mainLookAfter = false;
                    this.ifLookAfter = false;
                }
                this.selectInfo2("", "lookAfter");
                this.selectInfo2("", "mainLookName");
                this.selectInfo2("", "mainLookSex");
                this.selectInfo2("", "mainLookPhone");
                //this.selectInfo2('','lookAfterExt');
                //this.toScroll();
                //this.updateOlds({id:this.oldId,lookAfter :JSON.stringify(this.formLabelAlign.lookAfter),mainLookName:this.formLabelAlign.mainLookName,mainLookSex:this.formLabelAlign.mainLookSex,mainLookPhone: this.formLabelAlign.mainLookPhone,lookAfterExt:this.formLabelAlign.lookAfterExt});
            },
            changesQtl(data) {
                if (data == false) {
                    this.formLabelAlign.lookAfterExt = "";
                    //this.updateOlds({id:this.oldId,lookAfterExt:this.formLabelAlign.lookAfterExt});
                }
                /*  this.toScroll();*/
                this.selectInfo2("", "lookAfterExt");
            },

            changestd(data) {
                if (data.length > 0) {
                    if (data.indexOf("无人陪伴居住") !== -1) {
                        this.formLabelAlign.accompany = [];
                        this.formLabelAlign.accompany.push("无人陪伴居住");
                        this.disCategory = true;
                        this.ifDisabilityCategory = false;
                    } else {
                        if (data.indexOf("其他情形") !== -1) {
                            console.log("出现");
                            this.ifDisabilityCategory = true;
                        } else {
                            this.ifDisabilityCategory = false;
                        }
                        this.formLabelAlign.accompanyExt = "";
                    }
                } else {
                    this.disCategory = false;
                    this.ifDisabilityCategory = false;
                }
                this.selectInfo2("", "accompany");
                /*  if(data.indexOf("无人陪伴居住")!==-1){
                              this.disCategory=true;
                              this.ifDisabilityCategory=false;
                          } else {
                              this.disCategory=false;
                          }
                          this.ifDisabilityCategory = data.indexOf("其他情形") !== -1 && data.indexOf("无人陪伴居住") === -1;
                          this.selectInfo2('','accompany')*/
            },
            changest(data) {
                if (data.indexOf("其他救助") !== -1) {
                    this.ifRescueState = true;
                } else {
                    this.formLabelAlign.rescueStateExt = "";
                    this.ifRescueState = false;
                }
                this.selectInfo2("", "rescueState");
            },
            changestate(data) {
                let datas = {
                    id: this.oldId,
                    partnerState: this.formLabelAlign.partnerState
                };
                if (data == "已婚") {
                    this.viPartnerName = true;
                } else {
                    this.viPartnerName = false;
                    datas.partnerName = "";
                    datas.partnerIdNumber = "";
                    this.formLabelAlign.partnerName = "";
                    this.formLabelAlign.partnerIdNumber = "";
                }
                this.selectInfo2("", "partnerState");
            },
            changeincome(data) {
                if (data.indexOf("其它") !== -1) {
                    this.ifIncone = true;
                } else {
                    this.formLabelAlign.sourceOfIncomeExt = "";
                    this.ifIncone = false;
                }
                this.selectInfo2("", "sourceOfIncome");
            },
            changes(data) {
                let datas = {};
                if (data.indexOf("健康") !== -1) {
                    this.formLabelAlign.health = [];
                    this.formLabelAlign.health.push("健康");
                    this.formLabelAlign.disabilityCategory = [];
                    this.formLabelAlign.disabilityLevel = "";
                    datas.disabilityCategory = "";
                    datas.disabilityLevel = "";
                    this.canType = false;
                    this.canType1 = false;
                    this.disHealth = true;
                } else {
                    this.disHealth = false;
                }
                if (data.indexOf("残疾") !== -1 && data.indexOf("健康") === -1) {
                    this.canType = true;
                } else {
                    this.formLabelAlign.disabilityCategory = [];
                    this.formLabelAlign.disabilityLevel = "";
                    datas.disabilityCategory = "";
                    datas.disabilityLevel = "";
                    this.canType = false;
                }
                // 患重特大疾病
                if (data.indexOf("患重特大疾病") !== -1 && data.indexOf("健康") === -1) {
                    this.canType1 = true;
                } else {
                    this.formLabelAlign.majorDiseases = [];
                    this.canType1 = false;
                }
                // majorDiseases
                console.log(this.formLabelAlign.majorDiseases, 'this.formLabelAlign.majorDiseases');
                this.selectInfo2("", "health");
            },
            sumbitOlds() {
                this.$refs["formLabelAlign"].validateField("name", emailError => {
                    if (!emailError) {
                        this.toScroll();
                        this.$emit("oName", this.formLabelAlign.name, this.oldId);
                        this.updateOlds({id: this.oldId, name: this.formLabelAlign.name});
                    } else {
                        this.isColor = false;
                        this.$emit("isColor", this.isColor, this.index);
                        return false;
                    }
                });
            },
            selectInfo2(v1, value) {
              if( value == 'eightType' || value == 'ability' || value == 'oldType' ){
                if(value == 'eightType'){
                  if(v1 === 0){ // 是否为八类老年人：否
                    this.ldisold = true;
                    this.fdisold = true;
                    this.jdisold = true;
                    this.kdisold = true;
                    this.djisold = true;
                    this.zcisold = true;
                    this.glisold = true;
                    // this.jjisold = true;
                    this.snisold = true;
                    this.formLabelAlign.oldTypeOfNotOldType = this.formLabelAlign.oldType; // 将原先的值存一下
                    this.formLabelAlign.oldType = ['居家老年人'];
                    if(this.formLabelAlign.ability =='失能'){
                      this.formLabelAlign.ability = '';
                    }
                  }else{ // 是否为八类老年人：是
                    if( this.formLabelAlign.oldTypeOfNotOldType.length !== 0 ){
                        this.formLabelAlign.oldType = this.formLabelAlign.oldTypeOfNotOldType;
                        this.formLabelAlign.oldType = this.formLabelAlign.oldType.filter((item) => {
                          return item != '居家老年人';
                        });
                        this.formLabelAlign.oldType = this.formLabelAlign.oldType.filter((item) => {
                          return item != '失能老人';
                        });
                    }
                    this.changesto(this.formLabelAlign.oldType);
                  }
                }
                if(value == 'ability'){
                  if(v1 == '失能'){
                    this.formLabelAlign.oldType.push('失能老人');
                  }else{
                    this.formLabelAlign.oldType = this.formLabelAlign.oldType.filter((item) => {
                      return item != '失能老人';
                    });
                  }
                }
                if( this.formLabelAlign.eightType ==0 ){ // 不是八类
                  // if( this.formLabelAlign.oldType.length ==1 && this.formLabelAlign.oldType[0] == '居家老年人' ){
                    this.formLabelAlign.oldType = ['居家老年人'];
                    let bb = {};
                    bb.id = this.oldId;
                    bb.eightType = this.formLabelAlign.eightType;
                    bb.ability = this.formLabelAlign.ability;
                    bb.oldType = JSON.stringify(this.formLabelAlign.oldType);
                    this.updateOlds(bb);
                  // }
                } else { //是八类老年人
                  if( this.formLabelAlign.oldType.length ==0 || !(this.formLabelAlign.oldType.length == 1 && this.formLabelAlign.oldType[0] == '居家老年人') ){
                    let bb = {};
                    bb.id = this.oldId;
                    bb.eightType = this.formLabelAlign.eightType;
                    bb.ability = this.formLabelAlign.ability;
                    this.formLabelAlign.oldType = this.formLabelAlign.oldType.filter((item) => {
                      return item != '居家老年人';
                    });
                    bb.oldType = JSON.stringify(this.formLabelAlign.oldType);
                    if(this.formLabelAlign.oldType.length !== 0){
                      this.updateOlds(bb);
                    }
                  }
                }
              } else {
                this.$refs["formLabelAlign"].validateField(value, emailError => {
                  if (!emailError) {
                    let myDate = new Date();
                    let yy = myDate.getFullYear();
                    if(this.formLabelAlign.idNumber) {
                      let day = parseInt(this.formLabelAlign.idNumber.substr(6, 4));
                      let now = yy - day;
                      if (value == 'idNumber' && (now > 100 && now < 150)) {
                        this.$message({
                          message: '当前老人超过100岁',
                          type: 'warning'
                        });
                      }
                    }
                    this.toScroll();
                    let bb = {};
                    bb.id = this.oldId;
                    if (this.formLabelAlign[value] instanceof Array) {
                      bb[value] = JSON.stringify(this.formLabelAlign[value]);
                    } else {
                      bb[value] = this.formLabelAlign[value];
                    }
                    if (this.formLabelAlign[value]||this.formLabelAlign[value]=='0') {
                      this.updateOlds(bb);
                    }
                  } else {
                    let bb = {};
                    bb.id = this.oldId;
                    if (this.formLabelAlign[value] instanceof Array) {
                      bb[value] = JSON.stringify(this.formLabelAlign[value]);
                    } else {
                      bb[value] = "";
                    }
                    this.updateOlds(bb);
                    this.isColor = false;
                    this.$emit("isColor", this.isColor, this.index);
                    return false;
                  }
                });
              }
            },
            selectInfoNative() {
                if (this.ifAddress) {
                    this.formLabelAlign.address = this.formLabelAlign.nativePlace;
                    this.addressExtPH = "";
                    this.updateOlds({
                        id: this.oldId,
                        address: this.formLabelAlign.address
                    });
                } else {
                    this.addressExtPH = "请填写现居地址补充信息";
                }

                this.$refs["formLabelAlign"].validateField("nativePlace", emailError => {
                    if (!emailError) {
                        this.toScroll();
                        this.updateOlds({
                            id: this.oldId,
                            nativePlace: this.formLabelAlign.nativePlace
                        });
                    } else {
                        this.updateOlds({id: this.oldId, nativePlace: ""});
                        this.isColor = false;
                        this.$emit("isColor", this.isColor, this.index);
                        return false;
                    }
                });
            },
            infoAlignAddress() {
                this.$refs["formLabelAlign"].validateField("address", emailError => {
                    if (!emailError) {
                        if (this.formLabelAlign.nativePlace == this.formLabelAlign.address) {
                            this.checked = true;
                            this.ifAddress = true;
                        } else {
                            this.checked = false;
                            this.ifAddress = false;
                        }
                        this.toScroll();
                        this.updateOlds({
                            id: this.oldId,
                            address: this.formLabelAlign.address
                        });
                    } else {
                        this.updateOlds({id: this.oldId, address: ""});
                        this.isColor = false;
                        this.$emit("isColor", this.isColor, this.index);
                        return false;
                    }
                });
            },
            selectInfo5() {
                if (this.ifAddress) {
                    this.formLabelAlign.addressExt = this.formLabelAlign.nativePlaceExt;
                }
                this.updateOlds({
                    id: this.oldId,
                    nativePlaceExt: this.formLabelAlign.nativePlaceExt
                });
            },
            selectInfo6() {
                this.updateOlds({
                    id: this.oldId,
                    rescueStateExt: this.formLabelAlign.rescueStateExt
                });
            },
            infoAddress() {
                //this.toScroll();
                this.updateOlds({
                    id: this.oldId,
                    addressExt: this.formLabelAlign.addressExt
                });
            },

            async updateOlds(data) {
                const result = await updateOlds(data);
                if (result.code === 0) {
                    console.log(result);
                }
            },
            async updateOldsLocation(data, fd,rst) {
                const result = await updateOlds(data);
                if (result.code === 0) {
                    this.isShowUpload = false;
                    this.photoUp(fd,rst);
                }
            },
            removeExcess(data) {
                if (data) {
                    if (data.length > 0) {
                        data = JSON.parse(data);
                    }
                }
                return data;
            },
            getList() {
                if (this.oldData) {
                    this.oldList = this.oldData;
                    console.log(this.oldList, "查看锕");
                    if (this.oldList.nativePlaceId) {
                        this.deptsId = this.oldList.nativePlaceId;
                    }
                    this.oldId = this.oldList._id;
                    if (this.oldList.status == "3") {
                        this.isGo = true;
                    }
                    if (this.oldList.sourceOfIncome) {
                        if (
                            this.oldList.sourceOfIncomeExt ||
                            this.oldList.sourceOfIncome.indexOf("其它") !== -1
                        ) {
                            this.ifIncone = true;
                        } else {
                            this.ifIncone = false;
                        }
                    }
                    if (this.oldList.rescueState) {
                        if (
                            this.oldList.rescueStateExt ||
                            this.oldList.rescueState.indexOf("其他救助") !== -1
                        ) {
                            this.ifRescueState = true;
                        } else {
                            this.ifRescueState = false;
                        }
                    }
                    if (this.oldList.accompany) {
                        if (
                            this.oldList.accompanyExt ||
                            this.oldList.accompany.indexOf("其他情形") !== -1
                        ) {
                            this.ifDisabilityCategory = true;
                        } else {
                            this.ifDisabilityCategory = false;
                        }
                    }
                    if (this.oldList.lookAfter) {
                        if (
                            this.oldList.lookAfterExt ||
                            this.oldList.lookAfter.indexOf("其他人员") !== -1
                        ) {
                            this.ifLookAfter = true;
                        } else {
                            this.ifLookAfter = false;
                        }
                    }
                    if (this.oldList.demand) {
                        if (
                            this.oldList.demandExt ||
                            this.oldList.demand.indexOf("其它") !== -1
                        ) {
                            this.ifDemand = true;
                        } else {
                            this.ifDemand = false;
                        }
                    }
                    if (this.oldList.health) {
                        if (this.oldList.health.indexOf("残疾") !== -1) {
                            this.canType = true;
                        }
                        if (this.oldList.health.indexOf("患重特大疾病") !== -1) {
                            this.canType1 = true;
                        }
                        if (this.oldList.health.indexOf("健康") !== -1) {
                            this.disHealth = true;
                        }
                    }
                    if (this.oldList.partnerState) {
                        if (this.oldList.partnerState.indexOf("已婚") !== -1) {
                            this.viPartnerName = true;
                        }
                    }
                    if (this.oldList.accompany) {
                        if (this.oldList.accompany.indexOf("无人照料") !== -1) {
                            this.disCategory = true;
                        }
                    }
                    if (this.oldList.oldType) {
                        if (this.oldList.oldType.indexOf("分散供养特困老年人") !== -1) {
                            this.ldisold = true;
                            this.jdisold = true;
                            this.kdisold = true;
                        } else if (
                            this.oldList.oldType.indexOf("计划生育特殊家庭老人") !== -1
                        ) {
                            this.ldisold = true;
                            this.fdisold = true;
                            this.kdisold = true;
                        } else if (this.oldList.oldType.indexOf("农村留守老年人") !== -1) {
                            this.jdisold = true;
                            this.fdisold = true;
                            this.kdisold = true;
                        } else if (this.oldList.oldType.indexOf("空巢老年人") !== -1) {
                            this.ldisold = true;
                            this.jdisold = true;
                            this.fdisold = true;
                        } else {
                            this.ldisold = false;
                            this.fdisold = false;
                            this.jdisold = false;
                            this.kdisold = false;
                        }
                    }
                    if (this.oldList.accompany) {
                        if (this.oldList.accompany.indexOf("无人陪伴居住") !== -1) {
                            this.disCategory = true;
                            this.ifDisabilityCategory = false;
                        }
                    }
                    if (this.oldList.lookAfter) {
                        if (this.oldList.lookAfter.indexOf("无人照料") !== -1) {
                            this.disLookAfter = true;
                            this.ifLookAfter = false;
                            this.mainLookAfter = false;
                        }
                        if (
                            this.oldList.lookAfter.indexOf("配偶") !== -1 ||
                            this.oldList.lookAfter.indexOf("邻里互助") !== -1 ||
                            this.oldList.lookAfter.indexOf("购买养老服务") !== -1 ||
                            this.oldList.lookAfter.indexOf("其他人员") !== -1 ||
                            this.oldList.lookAfter.indexOf("近亲属") !== -1
                        ) {
                            this.mainLookAfter = true;
                        }
                    }
                    if (this.oldList.photo) {
                        this.isShowUpload = false;
                        this.urls.push(this.oldList.photo);
                    } else {
                        this.isShowUpload = true;
                    }
                    if (!this.oldList.health) {
                        this.oldList.health = [];
                    }
                    if (!this.oldList.disabilityCategory) {
                        this.oldList.disabilityCategory = [];
                    }
                    if (!this.oldList.majorDiseases) {
                        this.oldList.majorDiseases = [];
                    }
                    if (!this.oldList.sourceOfIncome) {
                        this.oldList.sourceOfIncome = [];
                    }
                    if (!this.oldList.rescueState) {
                        this.oldList.rescueState = [];
                    }
                    if (!this.oldList.accompany) {
                        this.oldList.accompany = [];
                    }
                    if (!this.oldList.lookAfter) {
                        this.oldList.lookAfter = [];
                    }
                    if (!this.oldList.demand) {
                        this.oldList.demand = [];
                    } else {
                        if (this.oldList.demand.indexOf("其它") !== -1) {
                            this.ifDemand = true;
                        } else {
                            this.ifDemand = false;
                        }
                    }
                    if (!this.oldList.oldType) {
                        this.oldList.oldType = [];
                    }
                    if (this.oldList.isSameWithAddress == "是") {
                        this.checked = true;
                        this.ifAddress = true;
                        this.addressExtPH = "";
                    } else {
                        this.checked = false;
                        this.ifAddress = false;
                        this.addressExtPH = "请填写现居地址补充信息";
                    }
                    this.formLabelAlign.name = this.oldList.name;
                    this.formLabelAlign.sex = this.oldList.sex;
                    this.formLabelAlign.nation = this.oldList.nation;
                    this.formLabelAlign.idNumber = this.oldList.idNumber;
                    this.formLabelAlign.partyMember = this.oldList.partyMember?this.oldList.partyMember:0;
                    this.formLabelAlign.eightType = this.oldList.eightType?this.oldList.eightType:0;
                    if(this.formLabelAlign.eightType === 0 ){
                      this.ldisold = true;
                      this.fdisold = true;
                      this.jdisold = true;
                      this.kdisold = true;
                      this.djisold = true;
                      this.zcisold = true;
                      this.glisold = true;
                      this.snisold = true;
                    }
                    this.formLabelAlign.phone = this.oldList.phone;
                    this.formLabelAlign.address = this.oldList.address;
                    this.formLabelAlign.addressExt = this.oldList.addressExt;
                    this.formLabelAlign.nativePlace = this.oldList.nativePlace;
                    this.formLabelAlign.nativePlaceExt = this.oldList.nativePlaceExt;
                    this.formLabelAlign.partnerState = this.oldList.partnerState;
                    this.formLabelAlign.partnerName = this.oldList.partnerName;
                    this.formLabelAlign.partnerIdNumber = this.oldList.partnerIdNumber;
                    this.formLabelAlign.isLoss = this.oldList.isLoss;
                    this.formLabelAlign.health = this.oldList.health;
                    this.formLabelAlign.disabilityCategory = this.oldList.disabilityCategory;
                    this.formLabelAlign.disabilityLevel = this.oldList.disabilityLevel;
                    this.formLabelAlign.majorDiseases = this.oldList.majorDiseases;
                    this.formLabelAlign.ability = this.oldList.ability;
                    this.formLabelAlign.livingCondition = this.oldList.livingCondition;
                    this.formLabelAlign.sourceOfIncome = this.oldList.sourceOfIncome;
                    this.formLabelAlign.income = this.oldList.income;
                    this.formLabelAlign.rescueState = this.oldList.rescueState;
                    this.formLabelAlign.accompany = this.oldList.accompany;
                    this.formLabelAlign.lookAfter = this.oldList.lookAfter;
                    this.formLabelAlign.mainLookName = this.oldList.mainLookName;
                    this.formLabelAlign.mainLookSex = this.oldList.mainLookSex;
                    this.formLabelAlign.mainLookPhone = this.oldList.mainLookPhone;
                    this.formLabelAlign.demand = this.oldList.demand;
                    this.formLabelAlign.oldType = this.oldList.oldType;
                    this.formLabelAlign.photo = this.oldList.photo;
                    this.formLabelAlign.sourceOfIncomeExt = this.oldList.sourceOfIncomeExt;
                    this.formLabelAlign.rescueStateExt = this.oldList.rescueStateExt;
                    this.formLabelAlign.accompanyExt = this.oldList.accompanyExt;
                    this.formLabelAlign.lookAfterExt = this.oldList.lookAfterExt;
                    this.formLabelAlign.demandExt = this.oldList.demandExt;
                    /*   this.formLabelAlign = {
                                       //name: this.oldList.name,
                                       sex: this.oldList.sex,
                                       nation: this.oldList.nation,
                                       idNumber: this.oldList.idNumber,
                                       phone: this.oldList.phone,
                                       address:this.oldList.address,
                                       addressExt:this.oldList.addressExt,
                                       // isSameWithAddress:this.oldList.isSameWithAddress,
                                       nativePlace:this.oldList.nativePlace,
                                       nativePlaceExt:this.oldList.nativePlaceExt,
                                       partnerState: this.oldList.partnerState,
                                       partnerName: this.oldList.partnerName,
                                       partnerIdNumber: this.oldList.partnerIdNumber,
                                       isLoss: this.oldList.isLoss,
                                       health: this.removeExcess(this.oldList.health),
                                       disabilityCategory: this.removeExcess(this.oldList.disabilityCategory),
                                       disabilityLevel: this.oldList.disabilityLevel,
                                       ability: this.oldList.ability,
                                       livingCondition: this.oldList.livingCondition,
                                       sourceOfIncome: this.removeExcess(this.oldList.sourceOfIncome),
                                       income: this.oldList.income,
                                       rescueState: this.removeExcess(this.oldList.rescueState),
                                       // rescueState11:'',
                                       accompany: this.removeExcess(this.oldList.accompany),
                                       lookAfter: this.removeExcess(this.oldList.lookAfter),
                                       mainLookName: this.oldList.mainLookName,
                                       mainLookSex: this.oldList.mainLookSex,
                                       mainLookPhone: this.oldList.mainLookPhone,
                                       demand: this.removeExcess(this.oldList.demand),
                                       //oldType: this.removeExcess(this.oldList.oldType),
                                       oldType: this.oldList.oldType,
                                       photo:this.oldList.photo,
                                       // photoAndLocation:'',
                                       sourceOfIncomeExt: this.oldList.sourceOfIncomeExt,
                                       rescueStateExt: this.oldList.rescueStateExt,
                                       accompanyExt: this.oldList.accompanyExt,
                                       lookAfterExt: this.oldList.lookAfterExt,
                                       demandExt: this.oldList.demandExt,
                                   };*/
                    //
                    setTimeout(() => {
                        this.$refs["formLabelAlign"].clearValidate();
                    }, 100);
                    this.toScroll();
                    //  TODO  回显判断
                    /*   if (this.oldList.sex && this.oldList.nation && this.oldList.idNumber  && this.oldList.phone && this.oldList.address){

                                   }*/
                }
            }
        },
        watch: {
            clickTabIndex(newValue) {
                this.index = newValue;
            },
            oId(newValue) {
                this.oldId = newValue;
            },
            oldData(newValue) {
                this.oldList = newValue;
            }
        },
        created() {
            const dateMat = new Date();
            const year = dateMat.getFullYear();
            const month =
                dateMat.getMonth() + 1 > 9
                    ? dateMat.getMonth() + 1
                    : "0" + (dateMat.getMonth() + 1);
            const day =
                dateMat.getDate() > 9 ? dateMat.getDate() : "0" + dateMat.getDate();
            this.newTime = window.parseInt("" + year + month + day);
        },
        mounted() {
            this.formLabelAlign.name = this.OldName;
            this.oldId = this.oId;
            this.index = this.clickTabIndex;
            this.cascading();
            this.getList();
        }
    };
</script>
<style scoped>
    .camera {
        position: absolute;
        left: 0;
        top: 0;
        opacity: 0;
    }

    .image-slot {
        width: 100px;
        height: 100px;
        text-align: center;
        line-height: 100px;
        background: #f5f7fa;
        font-size: 5px;
    }

    .partner {
        padding: 10px;
        border: 1px solid #eee;
        background-color: #f1f1f1;
    }

    .oldPhoto >>> .el-form-item__content {
        line-height: 0px !important;
    }
</style>
