<template>
    <div class="app-container">
      <van-nav-bar
        title="用地建房申请"
        left-arrow
        fixed
        placeholder
        @click-left="goBack()"
        z-index="998"
      >
        <template #right>
          <van-icon name="../../../static/images/icon/icon_flow.png" size="20" @click="goFlow"/>
        </template>
      </van-nav-bar>
      <van-steps :active="active" active-color="#38f" @click-step="onStepClicked">
        <van-step>申请</van-step>
        <van-step>开工</van-step>
        <van-step>验收</van-step>
      </van-steps>

      <div class="main" style="padding-bottom: 1rem;">
        <van-form>
          <template v-if="selectedTabName == 0 && formVisible.baseApplyFormVisible"> <!-- 申请 -->
            <div :class="active == 0 ? '' : 'noModify'">
              <p class="topTit">农村宅基地和建房（规划许可）申请表</p>
              <template v-if="formVisible.baseApplyForm.baseFormVisible"> <!-- 申请 基本信息 -->
                <div>
                  <p class="main_title">申请户主信息</p>
                  <div class="main_box">
                    <van-field :readonly="!formEnabled.baseApplyForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyProposer.memberName" label="姓名" placeholder="姓名" input-align="right" required/>
                    <field-select
                      v-model="applicationDetail.tHouseApplyProposer.sex"
                      label="性别"
                      value-key="dictLabel"
                      data-key="dictValue"
                      placeholder="选择性别"
                      :rules="[{ required: true }]"
                      required
                      :readonly="!formEnabled.baseApplyForm.baseFormEnabled"
                      remote-url="/system/dict/data/type/sys_user_sex"
                      :on-remote-response="'data'"
                    />
                    <van-field required :readonly="!formEnabled.baseApplyForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyProposer.age" label="年龄" placeholder="年龄" input-align="right" type="digit"/>
                    <van-field required :readonly="!formEnabled.baseApplyForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyProposer.phone" label="联系电话" placeholder="联系电话" input-align="right" type="digit" :rules="[{pattern: /(^\d{7}(\d{4})?$)/}]"/>
                    <van-field required :readonly="!formEnabled.baseApplyForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyProposer.idcard" label="身份证号" placeholder="身份证号" input-align="right" :rules="[{pattern: /^[1-9]\d{5}(18|19|20|(3\d))\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/}]"/>
                    <van-field required :readonly="!formEnabled.baseApplyForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyProposer.householdRegister" label="户口所在地" placeholder="户口所在地" input-align="right"/>
                    <van-field required :readonly="!formEnabled.baseApplyForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyProposer.familyAddress" label="家庭住址" placeholder="家庭住址" input-align="right"/>
                    <van-field required readonly v-model="applicationDetail.tHouseApplyProposer.members" label="家庭人口数" placeholder="家庭人口数" type="digit" input-align="right"/>
                    <field-radio
                      v-model="applicationDetail.tHouseApplyProposer.existHomestead"
                      label="是否已有宅基地"
                      value-key="dictLabel"
                      data-key="dictValue"
                      :rules="[{ required: true }]"
                      required
                      :readonly="!formEnabled.baseApplyForm.baseFormEnabled"
                      :columns="yesNoOptions"
                      @change="existHomesteadChange"
                    />
                  </div>
                </div>

                <div v-if="applicationDetail.tHouseApplyFamilyMembers">
                  <p class="main_title">家庭成员信息<van-button icon="plus" size="mini" type="info" native-type="button" class="addFamily" @click="addFamily" v-if="formEnabled.baseApplyForm.baseFormEnabled" /></p>
                  <van-collapse v-model="activeNames" v-if="!formEnabled.baseApplyForm.baseFormEnabled">
                    <van-collapse-item  class="collapse" v-for="(item , index) in applicationDetail.tHouseApplyFamilyMembers" :key="index" :name="index+1">
                      <template #title>
                        <van-row>
                          <van-col span="8">{{item.memberName}}</van-col>
                          <van-col span="8">{{item.age}}</van-col>
                          <van-col span="8">{{item.familyStatusName}}</van-col>
                        </van-row>
                      </template>
                      <van-field readonly v-model="item.memberName" label="姓名" placeholder="姓名" input-align="right"/>
                      <van-field readonly v-model="item.age" label="年龄" placeholder="年龄" input-align="right"/>
                      <van-field readonly v-model="item.familyStatusName" label="与户主关系" placeholder="与户主关系" input-align="right"/>
                      <van-field readonly v-model="item.idcard" label="身份证号" placeholder="身份证号" input-align="right"/>
                      <van-field readonly v-model="item.householdRegister" label="户口所在地" placeholder="户口所在地" input-align="right"/>
                    </van-collapse-item>
                  </van-collapse>

                  <div v-else>
                    <van-tabs v-if="applicationDetail.tHouseApplyFamilyMembers && applicationDetail.tHouseApplyFamilyMembers.length > 0" v-model="familyMembersActive">
                      <van-tab :title="(index + 1) + '. ' + item.memberName" v-for="(item , index) in applicationDetail.tHouseApplyFamilyMembers" :key="index" swipeable>
                        <div class="familyList">
                          <div class="main_box" style="margin-bottom: 20px">
                            <van-button icon="minus" size="mini" type="danger" class="deleteFamily" native-type="button" v-if="index!=0" @click="deleteFamily(index)" />
                            <van-field required v-model="item.memberName" label="姓名" placeholder="姓名" input-align="right"/>
                            <van-field required v-model="item.age" label="年龄" placeholder="年龄" input-align="right"/>
                            <van-field required v-model="item.familyStatusName" label="与户主关系" placeholder="与户主关系" input-align="right"/>
                            <van-field required v-model="item.idcard" label="身份证号" placeholder="身份证号" input-align="right" :rules="[{pattern: /^[1-9]\d{5}(18|19|20|(3\d))\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/}]"/>
                            <van-field required v-model="item.householdRegister" label="户口所在地" placeholder="户口所在地" input-align="right"/>
                          </div>
                        </div>
                      </van-tab>
                    </van-tabs>
                  </div>
                </div>

                <div v-if="applicationDetail.tHouseApplyProposer.existHomestead === 'Y'">
                  <p class="main_title">现宅基地及农房状况</p>
                  <div class="main_box">
                    <van-field :rules="[{ required: true }]" required :readonly="!formEnabled.baseApplyForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyCurrentSituation.landArea" label="宅基地面积" placeholder="宅基地面积" input-align="right" type="number"><template #right-icon>㎡</template></van-field>
                    <van-field :rules="[{ required: true }]" required :readonly="!formEnabled.baseApplyForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyCurrentSituation.landPerArea" label="人均宅基地面积" placeholder="人均宅基地面积" input-align="right" label-width="auto" type="number"><template #right-icon>㎡</template></van-field>
                    <van-field :rules="[{ required: true }]" required :readonly="!formEnabled.baseApplyForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyCurrentSituation.landCertificateNo" label="不动产单元号" placeholder="不动产单元号" input-align="right"/>
                    <van-field :rules="[{ required: true }]" required :readonly="!formEnabled.baseApplyForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyCurrentSituation.buildingArea" label="建筑面积" placeholder="建筑面积㎡" input-align="right" type="number"><template #right-icon>㎡</template></van-field>
                    <van-field :rules="[{ required: true }]" required :readonly="!formEnabled.baseApplyForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyCurrentSituation.buildingPerArea" label="人均建筑面积" placeholder="人均建筑面积" input-align="right" label-width="auto" type="number"><template #right-icon>㎡</template></van-field>
                    <van-field :rules="[{ required: true }]" required :readonly="!formEnabled.baseApplyForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyCurrentSituation.houseCertificateNo" label="宅基地证书号" placeholder="宅基地证书号" input-align="right"/>
                    <field-select
                      v-model="applicationDetail.tHouseApplyCurrentSituation.landIsposal"
                      label="处置情况"
                      value-key="dictLabel"
                      data-key="dictValue"
                      placeholder="选择宅基地处置情况"
                      :rules="[{ required: true }]"
                      required
                      :readonly="!formEnabled.baseApplyForm.baseFormEnabled"
                      remote-url="/system/dict/data/type/land_isposal"
                      :on-remote-response="'data'"
                    />
                    <template v-if="applicationDetail.tHouseApplyProposer.existHomestead ==='Y'">
                      <van-field v-if="applicationDetail.tHouseApplyCurrentSituation.landIsposal == '1'" :rules="[{ required: true }]" :required="applicationDetail.tHouseApplyProposer.existHomestead ==='Y' && applicationDetail.tHouseApplyCurrentSituation.landIsposal == '1'" :readonly="!formEnabled.baseApplyForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyCurrentSituation.reservedArea" label="保留面积" placeholder="保留面积" input-align="right" type="number"/>
                      <van-field v-else-if="applicationDetail.tHouseApplyCurrentSituation.landIsposal == '3'" :rules="[{ required: true }]" :required="applicationDetail.tHouseApplyProposer.existHomestead ==='Y' && applicationDetail.tHouseApplyCurrentSituation.landIsposal == '3'" :readonly="!formEnabled.baseApplyForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyCurrentSituation.otherRemark" label="处置情况" placeholder="处置情况" input-align="right"/>
                    </template>
                  </div>
                </div>

                <div v-if="applicationDetail.tHouseApplyProposedSituation">
                  <p class="main_title">拟申请宅基地及建房情况</p>
                  <div class="main_box">
                    <van-field :rules="[{ required: true }]" required :readonly="!formEnabled.baseApplyForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyProposedSituation.location" label="拟建位置" placeholder="拟建位置" input-align="right"/>
                    <van-field :rules="[{ required: true }]" required :readonly="!formEnabled.baseApplyForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyProposedSituation.landArea" label="宅基地面积" placeholder="宅基地面积" input-align="right" type="number"><template #right-icon>㎡</template></van-field>
                    <van-field :rules="[{ required: true }]" required :readonly="!formEnabled.baseApplyForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyProposedSituation.east" label="东至" placeholder="东至" input-align="right"/>
                    <van-field :rules="[{ required: true }]" required :readonly="!formEnabled.baseApplyForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyProposedSituation.west" label="西至" placeholder="西至" input-align="right"/>
                    <van-field :rules="[{ required: true }]" required :readonly="!formEnabled.baseApplyForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyProposedSituation.south" label="南至" placeholder="南至" input-align="right"/>
                    <van-field :rules="[{ required: true }]" required :readonly="!formEnabled.baseApplyForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyProposedSituation.north" label="北至" placeholder="北至" input-align="right"/>
                    <van-field :rules="[{ required: true }]" required :readonly="!formEnabled.baseApplyForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyProposedSituation.buildingArea" label="住房建筑面积" placeholder="住房建筑面积" input-align="right" type="number"><template #right-icon>㎡</template></van-field>
                    <van-field :rules="[{ required: true }]" required :readonly="!formEnabled.baseApplyForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyProposedSituation.buildingLandArea" label="房基占地面积" placeholder="房基占地面积" input-align="right" type="number"><template #right-icon>㎡</template></van-field>
                    <van-field :rules="[{ required: true }]" required :readonly="!formEnabled.baseApplyForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyProposedSituation.buildingFloors" label="建筑层数" placeholder="建筑层数" input-align="right" type="digit"><template #right-icon>层</template></van-field>
                    <van-field :rules="[{ required: true }]" required :readonly="!formEnabled.baseApplyForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyProposedSituation.buildingHight" label="建筑高度" placeholder="建筑高度" input-align="right" type="number"><template #right-icon>m</template></van-field>
                    <field-radio
                      v-model="applicationDetail.tHouseApplyProposedSituation.isAdvice"
                      label="是否征求相邻权利人意见"
                      value-key="dictLabel"
                      data-key="dictValue"
                      :rules="[{ required: true }]"
                      required
                      :readonly="!formEnabled.baseApplyForm.baseFormEnabled"
                      :columns="[{dictLabel: '是', dictValue: '1'}, {dictLabel: '否', dictValue: '2'}]"
                      @change="existHomesteadChange"
                    />

                    <field-select
                      v-model="applicationDetail.tHouseApplyProposedSituation.housingStructure"
                      label="房屋构造"
                      value-key="dictLabel"
                      data-key="dictValue"
                      placeholder="选择房屋构造"
                      :rules="[{ required: true }]"
                      required
                      :readonly="!formEnabled.baseApplyForm.baseFormEnabled"
                      remote-url="/system/dict/data/type/housing_structure"
                      :on-remote-response="'data'"
                    />
                    <field-select
                      v-model="applicationDetail.tHouseApplyProposedSituation.buildingType"
                      label="建房类型"
                      value-key="dictLabel"
                      data-key="dictValue"
                      placeholder="选择建房类型"
                      :rules="[{ required: true }]"
                      required
                      :readonly="!formEnabled.baseApplyForm.baseFormEnabled"
                      remote-url="/system/dict/data/type/building_type"
                      :on-remote-response="'data'"
                    />
                    <field-radio
                      v-model="applicationDetail.tHouseApplyProposedSituation.designPaper"
                      label="设计图纸"
                      value-key="dictLabel"
                      data-key="dictValue"
                      :rules="[{ required: true }]"
                      required
                      :readonly="!formEnabled.baseApplyForm.baseFormEnabled"
                      remote-url="/system/dict/data/type/design_paper"
                      :on-remote-response="'data'"
                    />

                    <field-select
                      v-if="applicationDetail.tHouseApplyProposedSituation.designPaper == '2'"
                      v-model="applicationDetail.tHouseApplyProposedSituation.houseTypeId"
                      label="户型图"
                      value-key="name"
                      data-key="id"
                      placeholder="选择户型图"
                      :rules="[{ required: true }]"
                      required
                      :readonly="!formEnabled.baseApplyForm.baseFormEnabled"
                      :remote-url="getHouseList"
                      :on-remote-response="'rows'"
                    />
                    <field-select
                      v-model="applicationDetail.tHouseApplyProposedSituation.geographicType"
                      label="土地类型"
                      value-key="dictLabel"
                      data-key="dictValue"
                      placeholder="选择土地类型"
                      :rules="[{ required: true }]"
                      required
                      :readonly="!formEnabled.baseApplyForm.baseFormEnabled"
                      remote-url="/system/dict/data/type/geographic_type"
                      :on-remote-response="'data'"
                    />
                    <template>
                      <van-field v-if="applicationDetail.tHouseApplyProposedSituation.geographicType == '10'" :rules="[{ required: true }]" required :readonly="!formEnabled.baseApplyForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyProposedSituation.constructionLandArea" label="建设用地面积" placeholder="建设用地面积" input-align="right" type="number"><template #right-icon>㎡</template></van-field>
                      <van-field v-else-if="applicationDetail.tHouseApplyProposedSituation.geographicType == '20'" :rules="[{ required: true }]" required :readonly="!formEnabled.baseApplyForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyProposedSituation.unusedLandArea" label="未利用地面积" placeholder="未利用地面积" input-align="right" type="number"><template #right-icon>㎡</template></van-field>
                      <van-field v-else-if="applicationDetail.tHouseApplyProposedSituation.geographicType && applicationDetail.tHouseApplyProposedSituation.geographicType != '10' && applicationDetail.tHouseApplyProposedSituation.geographicType != '20'" :rules="[{ required: true }]" required :readonly="!formEnabled.baseApplyForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyProposedSituation.agriculturalLandArea" label="农用地面积" placeholder="农用地面积" input-align="right" type="number"><template #right-icon>㎡</template></van-field>
                    </template>
                  </div>
                  <div class="mapBox">
                    <common-map ref="pointDarwMap" style="height:200px;"
                                :allowDraw="formEnabled.baseApplyForm.baseFormEnabled"
                                @drawReseted="onMapDrawReseted"
                                @drawFinished="onMapDrawFinished"
                    >
                    </common-map>
                  </div>
                </div>

                <div v-if="applicationDetail.tHouseApplyProposer">
                  <p class="main_title">申请理由</p>
                  <div class="main_box">
                    <van-field
                      rows="3"
                      autosize
                      type="textarea"
                      placeholder="申请理由"
                      input-align="left"
                      v-model="applicationDetail.tHouseApplyProposer.applyReasion"
                      :readonly="!formEnabled.baseApplyForm.baseFormEnabled"
                      :rules="[{ required: true }]" required
                    />
                    <van-row>
                      <van-col span="12"><van-field :rules="[{ required: true }]" required :readonly="!formEnabled.baseApplyForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyProposer.memberName" label="申请人" placeholder="申请人" input-align="left" label-width="auto"/></van-col>
                      <van-col span="12">
                        <field-date-picker
                          v-model="applicationDetail.tHouseApplyProposer.applyTime"
                          label=""
                          placeholder="选择日期"
                          :rules="[{ required: true }]"
                          formatter="yyyy-MM-dd"
                          required
                          :readonly="!formEnabled.baseApplyForm.baseFormEnabled"
                        />
                      </van-col>
                    </van-row>
                  </div>
                </div>
              </template>

              <!-- 申请::村级审批 -->
              <template v-if="formVisible.baseApplyForm.villageFormVisible">
                <div class="main_box examine_box">
                  <van-row type="flex" justify="space-between" align="center">
                    <van-col span="5">村级<br/>审核<br/>意见</van-col>
                    <van-col span="19">
                      <van-field required :readonly="!formEnabled.baseApplyForm.villageFormEnabled" v-model="applicationDetail.tHouseApproveVillageOptions.villageOption" rows="2" autosize type="textarea" placeholder="同意申请宅基地"/>
                    </van-col>
                  </van-row>
                </div>
              </template>

              <!-- 申请::农业部门 -->
              <template v-if="formVisible.baseApplyForm.townFormVisible">
                <div class="main_box examine_box">
                  <van-row type="flex" justify="space-between" align="center">
                    <van-col span="5">农业<br/>农村<br/>部门<br/>审查<br/>意见</van-col>
                    <van-col span="19">
                      <field-radio
                        v-model="applicationDetail.tHouseApproveAgricultureOptions.isMembership"
                        label="成员资格审查"
                        value-key="dictLabel"
                        data-key="dictValue"
                        :rules="[{ required: true }]"
                        required
                        :readonly="!formEnabled.baseApplyForm.townFormEnabled"
                        :columns="[{dictLabel: '通过', dictValue: '1'}, {dictLabel: '不通过', dictValue: '2'}]"
                      />
                      <field-radio
                        v-model="applicationDetail.tHouseApproveAgricultureOptions.isOnehouse"
                        label="一户一宅情况"
                        value-key="dictLabel"
                        data-key="dictValue"
                        :rules="[{ required: true }]"
                        required
                        :readonly="!formEnabled.baseApplyForm.townFormEnabled"
                        :columns="[{dictLabel: '符合', dictValue: '1'}, {dictLabel: '不符合', dictValue: '2'}]"
                      />
                      <field-radio
                        v-model="applicationDetail.tHouseApproveAgricultureOptions.isReviewmaterials"
                        label="村委审查资料"
                        value-key="dictLabel"
                        data-key="dictValue"
                        :rules="[{ required: true }]"
                        required
                        :readonly="!formEnabled.baseApplyForm.townFormEnabled"
                        :columns="[{dictLabel: '齐全', dictValue: '1'}, {dictLabel: '不齐全', dictValue: '2'}]"
                      />
                      <van-field required :readonly="!formEnabled.baseApplyForm.townFormEnabled" rows="2" v-model="applicationDetail.tHouseApproveAgricultureOptions.approveOption" autosize type="textarea" placeholder="审查意见"/>
                    </van-col>
                  </van-row>
                </div>
              </template>

              <!-- 申请::自然资源部门 -->
              <template v-if="formVisible.baseApplyForm.townFormVisible">
                <div class="main_box examine_box">
                  <van-row type="flex" justify="space-between" align="center">
                    <van-col span="5">自然<br/>资源<br/>部门<br/>意见</van-col>
                    <van-col span="19">
                      <van-field required :readonly="!formEnabled.baseApplyForm.townFormEnabled" v-model="applicationDetail.tHouseApproveNatureOptions.landArea" label="用地面积" placeholder="请输入" input-align="right"><template #right-icon>㎡</template></van-field>
                      <field-select
                        v-model="applicationDetail.tHouseApproveNatureOptions.rightsType"
                        label="土地权属"
                        value-key="dictLabel"
                        data-key="dictValue"
                        placeholder="请选择土地权属"
                        :rules="[{ required: true }]"
                        required
                        :readonly="!formEnabled.baseApplyForm.townFormEnabled"
                        remote-url="/system/dict/data/type/rights_type"
                        :on-remote-response="'data'"
                      />
                      <van-field required :readonly="!formEnabled.baseApplyForm.townFormEnabled" v-model="applicationDetail.tHouseApproveNatureOptions.east" label="东至" placeholder="请输入" input-align="right"/>
                      <van-field required :readonly="!formEnabled.baseApplyForm.townFormEnabled" v-model="applicationDetail.tHouseApproveNatureOptions.south" label="南至" placeholder="请输入" input-align="right"/>
                      <van-field required :readonly="!formEnabled.baseApplyForm.townFormEnabled" v-model="applicationDetail.tHouseApproveNatureOptions.west" label="西至" placeholder="请输入" input-align="right"/>
                      <van-field required :readonly="!formEnabled.baseApplyForm.townFormEnabled" v-model="applicationDetail.tHouseApproveNatureOptions.north" label="北至" placeholder="请输入" input-align="right"/>
                      <div class="mapBox">
                        <common-map ref="pointDarwNatureMap" style="height:200px;"
                                    :allowDraw="formEnabled.baseApplyForm.townFormEnabled"
                                    @drawReseted="onNatureMapDrawReseted"
                                    @drawFinished="onMapDrawFinished"
                        >
                        </common-map>
                      </div>
                      <van-field required :readonly="!formEnabled.baseApplyForm.townFormEnabled" v-model="applicationDetail.tHouseApproveNatureOptions.approveOption" rows="2" autosize type="textarea" placeholder="审查意见"/>
                    </van-col>
                  </van-row>
                </div>
              </template>

              <!-- 申请::住建部门 -->
              <template v-if="formVisible.baseApplyForm.townFormVisible">
                <div class="main_box examine_box">
                  <van-row type="flex" justify="space-between" align="center">
                    <van-col span="5">其他<br/>部门<br/>意见<br/>(住宅<br/>部门)</van-col>
                    <van-col span="19">
                      <field-select
                        v-model="applicationDetail.tHouseApproveOtherOptions.buildingType"
                        label="建筑类型"
                        value-key="dictLabel"
                        data-key="dictValue"
                        placeholder="请选择建筑类型"
                        :rules="[{ required: true }]"
                        required
                        :readonly="!formEnabled.baseApplyForm.townFormEnabled"
                        remote-url="/system/dict/data/type/building_type"
                        :on-remote-response="'data'"
                      />
                      <field-select
                        v-model="applicationDetail.tHouseApproveOtherOptions.designPaper"
                        label="图纸类型"
                        value-key="dictLabel"
                        data-key="dictValue"
                        placeholder="请选择图纸类型"
                        :rules="[{ required: true }]"
                        required
                        :readonly="!formEnabled.baseApplyForm.townFormEnabled"
                        remote-url="/system/dict/data/type/design_paper"
                        :on-remote-response="'data'"
                      />
                      <van-field required :readonly="!formEnabled.baseApplyForm.townFormEnabled" v-model="applicationDetail.tHouseApproveOtherOptions.buildingLandArea" label="建筑占地面积" placeholder="请输入" input-align="right" type="number"><template #right-icon>㎡</template></van-field>
                      <van-field required :readonly="!formEnabled.baseApplyForm.townFormEnabled" v-model="applicationDetail.tHouseApproveOtherOptions.buildingArea" label="建筑面积" placeholder="请输入" input-align="right" type="number"><template #right-icon>㎡</template></van-field>
                      <van-field required :readonly="!formEnabled.baseApplyForm.townFormEnabled" v-model="applicationDetail.tHouseApproveOtherOptions.buildingFloors" label="建筑层数" placeholder="请输入" input-align="right" type="digit"><template #right-icon>层</template></van-field>
                      <van-field required :readonly="!formEnabled.baseApplyForm.townFormEnabled" v-model="applicationDetail.tHouseApproveOtherOptions.buildingHight" label="建筑高度" placeholder="请输入" input-align="right" type="number"><template #right-icon>m</template></van-field>
                      <van-field required :readonly="!formEnabled.baseApplyForm.townFormEnabled" v-model="applicationDetail.tHouseApproveOtherOptions.east" label="东至" placeholder="请输入" input-align="right"/>
                      <van-field required :readonly="!formEnabled.baseApplyForm.townFormEnabled" v-model="applicationDetail.tHouseApproveOtherOptions.south" label="南至" placeholder="请输入" input-align="right"/>
                      <van-field required :readonly="!formEnabled.baseApplyForm.townFormEnabled" v-model="applicationDetail.tHouseApproveOtherOptions.west" label="西至" placeholder="请输入" input-align="right"/>
                      <van-field required :readonly="!formEnabled.baseApplyForm.townFormEnabled" v-model="applicationDetail.tHouseApproveOtherOptions.north" label="北至" placeholder="请输入" input-align="right"/>
                      <van-field required :readonly="!formEnabled.baseApplyForm.townFormEnabled" v-model="applicationDetail.tHouseApproveOtherOptions.approveOption" rows="2" autosize  type="textarea" placeholder="审批意见"/>
                    </van-col>
                  </van-row>
                </div>
              </template>

              <!-- 申请::镇政府 -->
              <template v-if="formVisible.baseApplyForm.townFormVisible">
                <div class="main_box examine_box" v-if="formVisible.baseApplyForm.townFormVisible">
                  <van-row type="flex" justify="space-between" align="center">
                    <van-col span="5">镇级<br/>审核<br/>意见</van-col>
                    <van-col span="19">
                      <van-field required :readonly="!formEnabled.baseApplyForm.townFormEnabled" v-model="applicationDetail.tHouseApproveTownOptions.approveOption" rows="2" autosize type="textarea" placeholder="同意申请宅基地"/>
                    </van-col>
                  </van-row>
                </div>
              </template>

              <!-- 申请::现场踏勘 -->
              <template v-if="formVisible.baseApplyForm.townFormVisible">
                <div class="main_box examine_box" v-if="formVisible.baseApplyForm.townFormVisible">
                  <van-row type="flex" justify="space-between" align="center">
                    <van-col span="5">现场<br/>踏勘</van-col>
                    <van-col span="19">
                      <house-location-plan-comp ref="pictureUploadApplying" :uploadDisabled="!formEnabled.baseApplyForm.townFormEnabled" :jsonData="uploadImg.fileList" :proposer-id="uploadImg.proposerId" tableName="t_house_approve_locationplan_options"
                                                @uploadFileChanged="(x) => {this.uploadImg.uploadFileList = x;}" @removeFileChanged="(x) => {this.uploadImg.removeFileList = x;}"
                      />
                      <van-row>
                        <van-col span="12"><van-field :rules="[{ required: true }]" required :readonly="!formEnabled.baseApplyForm.townFormEnabled" v-model="applicationDetail.tHouseApproveLocationplanOptions.surveyPersonnel" label="踏勘" placeholder="现场踏勘人员" input-align="left" label-width="auto"/></van-col>
                        <van-col span="12">
                          <field-date-picker
                            v-model="applicationDetail.tHouseApproveLocationplanOptions.suveyTime"
                            label=""
                            placeholder="选择日期"
                            :rules="[{ required: true }]"
                            formatter="yyyy-MM-dd"
                            required
                            :readonly="!formEnabled.baseApplyForm.townFormEnabled"
                          />
                        </van-col>
                      </van-row>
                      <van-row>
                        <van-col span="12"><van-field :rules="[{ required: true }]" required :readonly="!formEnabled.baseApplyForm.townFormEnabled" v-model="applicationDetail.tHouseApproveLocationplanOptions.cartographer" label="制图" placeholder="制图人" input-align="left" label-width="auto"/></van-col>
                        <van-col span="12">
                          <field-date-picker
                            v-model="applicationDetail.tHouseApproveLocationplanOptions.cartographicTime"
                            label=""
                            placeholder="选择日期"
                            :rules="[{ required: true }]"
                            formatter="yyyy-MM-dd"
                            required
                            :readonly="!formEnabled.baseApplyForm.townFormEnabled"
                          />
                        </van-col>
                      </van-row>
                    </van-col>
                  </van-row>
                </div>
              </template>
            </div>
          </template>

          <template v-if="selectedTabName == 1 && formVisible.landscopeVisible"> <!-- 开工申请 -->
            <div :class="active == 1 ? '' : 'noModify'" v-if="formVisible.landscopeVisible">
              <p class="topTit">宅基地开工</p>
              <div class="main_box action-box">
                <van-cell>
                  <template #right-icon>
                    <field-date-picker
                      v-model="applicationDetail.tHouseApplyStart.startDate"
                      label="计划开工时间"
                      placeholder="选择日期"
                      :rules="[{ required: true }]"
                      formatter="yyyy-MM-dd"
                      required
                      :readonly="!formEnabled.landscopeForm.baseFormEnabled"
                    />
                  </template>
                </van-cell>
                <van-cell>
                  <template #right-icon>
                    <field-date-picker
                      v-model="applicationDetail.tHouseApplyStart.endDate"
                      label="计划竣工时间"
                      placeholder="选择日期"
                      :rules="[{ required: true }]"
                      formatter="yyyy-MM-dd"
                      required
                      :readonly="!formEnabled.landscopeForm.baseFormEnabled"
                    />
                  </template>
                </van-cell>
              </div>
            </div>
          </template>

          <template v-if="selectedTabName == 2 && formVisible.acceptingVisible"> <!-- 验收申请 -->
            <template v-if="formVisible.acceptingForm.baseFormVisible">
              <div :class="active == 2 ? '' : 'noModify'">
                <p class="topTit">宅基地验收申请</p>
                <div class="main_box check-box">
                  <van-field required readonly v-model="applicationDetail.tHouseApplyEnd.memberName" label="申请户主姓名" placeholder="申请户主姓名" input-align="right" label-width="auto"/>
                  <van-field required readonly v-model="applicationDetail.tHouseApplyEnd.idcard" label="身份证号" placeholder="身份证号" input-align="right" label-width="auto"/>
                  <van-field required readonly v-model="applicationDetail.tHouseApplyEnd.location" label="用地建房位置" placeholder="用地建房位置" input-align="right" label-width="auto"/>
                  <van-field required readonly v-model="applicationDetail.tHouseApplyEnd.licenseKey" label="乡村建设规划许可证号" placeholder="乡村建设规划许可证号" input-align="right" label-width="auto"/>
                  <van-field required readonly v-model="applicationDetail.tHouseApplyEnd.approvalNumber" label="农村宅基地批准书号" placeholder="农村宅基地批准书号" input-align="right" label-width="auto"/>
                  <field-date-picker
                    v-model="applicationDetail.tHouseApplyEnd.startDate"
                    label="开工日期"
                    placeholder="选择开工日期"
                    :rules="[{ required: true }]"
                    formatter="yyyy-MM-dd"
                    required
                    :readonly="true"
                  />
                  <field-date-picker
                    v-model="applicationDetail.tHouseApplyEnd.endDate"
                    label="竣工日期"
                    placeholder="选择竣工日期"
                    :rules="[{ required: true }]"
                    formatter="yyyy-MM-dd"
                    required
                    :readonly="true"
                  />
                  <van-field required :readonly="!formEnabled.acceptingForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyEnd.houseCertificateNo" label="权属证书号（不动产）" placeholder="权属证书号（不动产）" input-align="right" label-width="auto"/>
                  <van-field required :readonly="!formEnabled.acceptingForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyEnd.landCertificateNo" label="权属证书号（宅基地）" placeholder="权属证书号（宅基地）" input-align="right" label-width="auto"/>
                  <van-field required :readonly="!formEnabled.acceptingForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyEnd.buildingHight" label="批建高度" placeholder="建筑高度" input-align="right" label-width="auto" type="number"><template #right-icon>m</template></van-field>
                  <van-field required :readonly="!formEnabled.acceptingForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyEnd.buildingFloors" label="批建层数" placeholder="批建层数" input-align="right" label-width="auto" type="digit"><template #right-icon>层</template></van-field>
                  <van-field required :readonly="!formEnabled.acceptingForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyEnd.actualBuildingHight" label="竣工高度" placeholder="竣工高度" input-align="right" label-width="auto" type="number"><template #right-icon>m</template></van-field>
                  <van-field required :readonly="!formEnabled.acceptingForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyEnd.actualBuildingFloors" label="竣工层数" placeholder="竣工层数" input-align="right" label-width="auto" type="digit"><template #right-icon>层</template></van-field>
                  <van-field required :readonly="!formEnabled.acceptingForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyEnd.buildingArea" label="建筑面积" placeholder="建筑面积" input-align="right" type="number"><template #right-icon>㎡</template></van-field>
                  <van-field required :readonly="!formEnabled.acceptingForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyEnd.buildingHouseArea" label="其中: 房屋建筑面积" placeholder="房屋建筑面积" input-align="right" label-width="auto" type="number"><template #right-icon>㎡</template></van-field>
                  <van-field required :readonly="!formEnabled.acceptingForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyEnd.buildingOtherArea" label="配套附属设施建筑面积" placeholder="配套附属设施建筑面积" input-align="right" label-width="auto" type="number"><template #right-icon>㎡</template></van-field>
                  <field-select
                    v-model="applicationDetail.tHouseApplyEnd.designPaper"
                    label="建筑风貌"
                    value-key="dictLabel"
                    data-key="dictValue"
                    placeholder="选择建筑风貌"
                    :rules="[{ required: true }]"
                    required
                    :readonly="!formEnabled.acceptingForm.baseFormEnabled"
                    remote-url="/system/dict/data/type/design_paper"
                    :on-remote-response="'data'"
                  />
                  <field-select
                    v-model="applicationDetail.tHouseApplyEnd.oldHouseStatus"
                    label="旧宅基地退还情况"
                    value-key="dictLabel"
                    data-key="dictValue"
                    placeholder="选择旧宅基地退还情况"
                    :rules="[{ required: true }]"
                    required
                    :readonly="!formEnabled.acceptingForm.baseFormEnabled"
                    remote-url="/system/dict/data/type/old_house_status"
                    :on-remote-response="'data'"
                  />
                  <van-field required :readonly="!formEnabled.acceptingForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyEnd.houseCost" label="住房造价" placeholder="住房造价" input-align="right" type="number"><template #right-icon>万元</template></van-field>
                  <van-field required :readonly="!formEnabled.acceptingForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyEnd.facadeColor" label="外立面颜色" placeholder="外立面颜色" input-align="right" label-width="auto"/>
                  <van-field required :readonly="!formEnabled.acceptingForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyEnd.fangjiArea" label="批准房基占地面积" placeholder="批准房基占地面积" input-align="right" label-width="auto" type="number"><template #right-icon>㎡</template></van-field>
                  <van-field required :readonly="!formEnabled.acceptingForm.baseFormEnabled" v-model="applicationDetail.tHouseApplyEnd.actualFangjiArea" label="实际房基占地面积" placeholder="实际房基占地面积" input-align="right" label-width="auto" type="number"><template #right-icon>㎡</template></van-field>
                  <field-radio
                    v-model="applicationDetail.tHouseApplyEnd.isEnjoySubsidy"
                    label="是否享受住房建设补助政策"
                    value-key="dictLabel"
                    data-key="dictValue"
                    :rules="[{ required: true }]"
                    required
                    :readonly="!formEnabled.acceptingForm.baseFormEnabled"
                    :columns="yesNoOptions"
                  />
                  <field-select
                    v-if="applicationDetail.tHouseApplyEnd.isEnjoySubsidy === 'Y'"
                    v-model="applicationDetail.tHouseApplyEnd.enjoySubsidyContent"
                    label="住房建设补助政策"
                    value-key="dictLabel"
                    data-key="dictValue"
                    placeholder="选择住房建设补助政策"
                    :rules="[{ required: true }]"
                    required
                    :readonly="!formEnabled.acceptingForm.baseFormEnabled"
                    remote-url="/system/dict/data/type/house_subsidy_policy"
                    :on-remote-response="'data'"
                  />
                  <van-cell title="农房验收位置"></van-cell>
                  <div class="mapBox">
                    <common-map ref="pointDarwAcceptanceMap" style="height:200px;"
                                :allowDraw="formEnabled.acceptingForm.baseFormEnabled"
                                @drawReseted="onAcceptanceMapDrawReseted"
                                @drawFinished="onMapDrawFinished"
                    >
                    </common-map>
                  </div>
                  <van-field rows="3" :autosize="true" type="textarea" readonly label="备注" label-width="auto" placeholder="" input-align="left" value="1.村民旧宅基地属于应退未退的，不得发放本验收意见表。
2.本验收意见表是向不动产登记部门申请办理不动产登记的要件之一，请妥善保管。"></van-field>
                </div>
              </div>
            </template>

            <template v-if="formVisible.acceptingForm.townFormVisible">
              <div class="main_box examine_box">
                <van-row type="flex" justify="space-between" align="center">
                  <van-col span="5">竣工<br/>平面<br/>简图<br/>
                    (标注<br/>长宽<br/>及四至)</van-col>
                  <van-col span="19">
                    <house-location-plan-comp ref="pictureUploadAccepting" :uploadDisabled="!formEnabled.acceptingForm.townFormEnabled" :jsonData="uploadImgAccepting.fileList" :proposer-id="uploadImgAccepting.proposerId" tableName="t_house_apply_end"
                                              @uploadFileChanged="(x) => {this.uploadImgAccepting.uploadFileList = x;}" @removeFileChanged="(x) => {this.uploadImgAccepting.removeFileList = x;}"
                    />
                    <van-field required :readonly="!formEnabled.acceptingForm.townFormEnabled" v-model="applicationDetail.tHouseApplyEnd.cartographer"  placeholder="经办人" label="经办人" input-align="left"/>
                  </van-col>
                </van-row>
              </div>

              <div class="main_box examine_box">
                <van-row type="flex" justify="space-between" align="center">
                  <van-col span="5">住房<br/>竣工<br/>验收<br/>内容</van-col>
                  <van-col span="19">
                    <field-checkbox
                      v-model="applicationDetail.tHouseApplyEnd.isProjectFinished"
                      label="1.是否已完成工程设计和合同约定的各项内容"
                      true-label="Y"
                      false-label="N"
                      :rules="[{ required: true }]"
                      :readonly="!formEnabled.acceptingForm.townFormEnabled"
                      label-width="5.6rem"
                    />
                    <field-checkbox
                      v-model="applicationDetail.tHouseApplyEnd.isQualifiedQuality"
                      label="2.承揽人对完工住房质量自查是否合格"
                      true-label="Y"
                      false-label="N"
                      :rules="[{ required: true }]"
                      :readonly="!formEnabled.acceptingForm.townFormEnabled"
                      label-width="5.6rem"
                    />
                    <field-checkbox
                      v-model="applicationDetail.tHouseApplyEnd.hasBuildingRecord"
                      label="3.是否有施工记录资料"
                      true-label="Y"
                      false-label="N"
                      :rules="[{ required: true }]"
                      :readonly="!formEnabled.acceptingForm.townFormEnabled"
                      label-width="5.6rem"
                    />
                    <field-checkbox
                      v-model="applicationDetail.tHouseApplyEnd.isSignWarranty"
                      label="4.建房村民和承揽人是否已经共同签署农村住房质量保修书"
                      true-label="Y"
                      false-label="N"
                      :rules="[{ required: true }]"
                      :readonly="!formEnabled.acceptingForm.townFormEnabled"
                      label-width="5.6rem"
                    />
                    <field-checkbox
                      v-model="applicationDetail.tHouseApplyEnd.isHandleProblem"
                      label="5.住房城乡建设行政主管部门或乡（镇）人民政府责令整改的问题是否全部整改完毕"
                      true-label="Y"
                      false-label="N"
                      :rules="[{ required: true }]"
                      :readonly="!formEnabled.acceptingForm.townFormEnabled"
                      label-width="5.6rem"
                    />
                    <field-checkbox
                      v-model="applicationDetail.tHouseApplyEnd.isDesignPaperSame"
                      label="6.建筑风貌是否与设计图基本一致"
                      true-label="Y"
                      false-label="N"
                      :rules="[{ required: true }]"
                      :readonly="!formEnabled.acceptingForm.townFormEnabled"
                      label-width="5.6rem"
                    />
                    <field-checkbox
                      v-model="applicationDetail.tHouseApplyEnd.isOtherAcceptanceFinished"
                      label="7.法律、法规规定的其他验收条件完成情况"
                      true-label="Y"
                      false-label="N"
                      :rules="[{ required: true }]"
                      :readonly="!formEnabled.acceptingForm.townFormEnabled"
                      label-width="5.6rem"
                    />
                  </van-col>
                </van-row>
              </div>

              <div class="main_box examine_box">
                <van-row type="flex" justify="space-between" align="center">
                  <van-col span="5">乡镇<br/>农业<br/>农村<br/>部门<br/>意见</van-col>
                  <van-col span="19">
                    <van-field required :readonly="!formEnabled.acceptingForm.townFormEnabled" rows="2" v-model="applicationDetail.tHouseApplyEnd.nongyeOption" :autosize="true" type="textarea" placeholder="乡镇农业农村部门意见"/>
                  </van-col>
                </van-row>
              </div>

              <div class="main_box examine_box">
                <van-row type="flex" justify="space-between" align="center">
                  <van-col span="5">乡镇<br/>自然<br/>资源<br/>部门<br/>意见</van-col>
                  <van-col span="19">
                    <van-field required :readonly="!formEnabled.acceptingForm.townFormEnabled" rows="2" v-model="applicationDetail.tHouseApplyEnd.natureOption" :autosize="true" type="textarea" placeholder="乡镇自然资源部门意见"/>
                  </van-col>
                </van-row>
              </div>

              <div class="main_box examine_box">
                <van-row type="flex" justify="space-between" align="center">
                  <van-col span="5">乡镇<br/>住建<br/>部门<br/>意见</van-col>
                  <van-col span="19">
                    <van-field required :readonly="!formEnabled.acceptingForm.townFormEnabled" rows="2" v-model="applicationDetail.tHouseApplyEnd.buildingOption" :autosize="true" type="textarea" placeholder="乡镇住建部门意见"/>
                  </van-col>
                </van-row>
              </div>

              <div class="main_box examine_box">
                <van-row type="flex" justify="space-between" align="center">
                  <van-col span="5">乡镇<br/>政府<br/>验收<br/>意见</van-col>
                  <van-col span="19">
                    <van-field required :readonly="!formEnabled.acceptingForm.townFormEnabled" rows="2" v-model="applicationDetail.tHouseApplyEnd.zhenOption" :autosize="true" type="textarea" placeholder="乡镇政府验收意见"/>
                  </van-col>
                </van-row>
              </div>

              <van-field rows="3" :autosize="true" type="textarea" readonly label="备注" label-width="auto"  placeholder="备注" :readonly="!formEnabled.acceptingForm.townFormEnabled" v-model="applicationDetail.tHouseApplyEnd.remark" input-align="left"></van-field>
            </template>
          </template>

        </van-form>
      </div>

      <!-- 底部按钮 -->
      <van-goods-action style="z-index: 999;">
        <van-goods-action-icon icon="label-o" text="附件" @click="openAttachment" color="#1D6FE9" />
        <template v-if="formVisible.editVisible">
          <van-goods-action-button type="primary" text="保存"  @click="onSubmit('add')" :disabled="!formEnabled.baseApplyEnabled" v-if="formEnabled.baseApplyEnabled"/>
          <van-goods-action-button type="primary" :text="formEnabled.baseApplyEnabled ? '保存并提交' : '提交'"  @click="onSubmit(formEnabled.baseApplyEnabled ? 'save_and_submit' : 'submit')" :disabled="!formEnabled.submitEnabled"/>
        </template>
        <template v-else-if="formEnabled.landscopeEnabled">
          <van-goods-action-button type="primary" text="提交开工"  @click="onSubmit('start_and_submit')"/>
        </template>
        <template v-else-if="formEnabled.acceptingEnabled">
          <van-goods-action-button type="primary" text="提交验收"  @click="onSubmit('end')"/>
        </template>
        <template v-else-if="formVisible.auditVisible">
          <van-goods-action-button type="primary" text="同意"  @click="onSubmit('agree')"/>
          <van-goods-action-button type="danger" text="驳回"  @click="onSubmit('reject')"/>
        </template>
      </van-goods-action>

      <!-- 3组附件 -->
      <van-popup
          v-model="attachmentVisible"
          closeable
          position="top"
          :style="{ height: '61.8%' }"
          :close-on-click-overlay="proposerStatus == 1"
          :lazy-render="false"
        >
          <van-tabs type="card" style="padding-top: 1.35rem;" color="#1D6FE9" :lazy-render="false" v-model="attachmentActive" ref="attachmentDialog">
            <van-tab title="申请" key="0">
              <house-apply-upload-comp
                :business-type="houseApplyUploadComp.businessType"
                :house-apply-status="houseApplyUploadComp.houseApplyStatus"
                :process-key="houseApplyUploadComp.processKey"
                :proposer-id="houseApplyUploadComp.proposerId"
                :table-name="houseApplyUploadComp.tableName"
                :readonly="houseApplyUploadComp.readonly"
                :full="houseApplyUploadComp.full"
                @uploadFinished="onUploadFinished"
              >
              </house-apply-upload-comp>
            </van-tab>
            <van-tab title="开工" key="1" :disabled="active < 1">
              <house-apply-upload-comp
                :business-type="houseApplyUploadCompStart.businessType"
                :house-apply-status="houseApplyUploadCompStart.houseApplyStatus"
                :process-key="houseApplyUploadCompStart.processKey"
                :proposer-id="houseApplyUploadCompStart.proposerId"
                :table-name="houseApplyUploadCompStart.tableName"
                :readonly="houseApplyUploadCompStart.readonly"
                :full="houseApplyUploadCompStart.full"
              >
              </house-apply-upload-comp>
            </van-tab>
            <van-tab title="验收" key="2" :disabled="active < 2">
              <house-apply-upload-comp
                :business-type="houseApplyUploadCompEnd.businessType"
                :house-apply-status="houseApplyUploadCompEnd.houseApplyStatus"
                :process-key="houseApplyUploadCompEnd.processKey"
                :proposer-id="houseApplyUploadCompEnd.proposerId"
                :table-name="houseApplyUploadCompEnd.tableName"
                :readonly="houseApplyUploadCompEnd.readonly"
                :full="houseApplyUploadCompEnd.full"
              >
              </house-apply-upload-comp>
            </van-tab>
          </van-tabs>
      </van-popup>

      <!-- 当前流程 -->
      <van-popup
        v-model="flowVisible"
        position="top"
      >
        <div class="flow_main_box">
          <van-row>
            <van-col span="8"><p class="tit" :style="{'background-color': applicationDetail.proposerActiveIndex >= 0 ? '' : '#ABABAB'}">01 申请</p></van-col>
            <van-col span="8"><p class="tit" :style="{'background-color': applicationDetail.startActiveIndex >= 0 ? '' : '#ABABAB'}">02 开工</p></van-col>
            <van-col span="8"><p class="tit" :style="{'background-color': applicationDetail.endActiveIndex >= 0 ? '' : '#ABABAB'}">03 验收</p></van-col>
          </van-row>
          <van-row>
            <van-col span="8">
              <van-steps direction="vertical" active-color="#1D6FE9" :active="applicationDetail.proposerActiveIndex" style="padding-left: 0.853333rem;">
                <van-step v-for="(item,index) in applicationDetail.applyStepList" :key="index">{{item}}</van-step>
              </van-steps>
            </van-col>
            <van-col span="8">
              <van-steps direction="vertical" active-color="#1D6FE9" :active="applicationDetail.startActiveIndex" style="padding-left: 0.853333rem;">
                <van-step v-for="(item,index) in applicationDetail.startStepList" :key="index">{{item}}</van-step>
              </van-steps>
            </van-col>
            <van-col span="8">
              <van-steps direction="vertical" active-color="#1D6FE9" :active="applicationDetail.endActiveIndex" style="padding-left: 0.853333rem;">
                <van-step v-for="(item,index) in applicationDetail.endStepList" :key="index">{{item}}</van-step>
              </van-steps>
            </van-col>
          </van-row>
        </div>
      </van-popup>
    </div>
</template>

<script>
import HouseApplyUploadComp from "@/components/house/HouseApplyUploadComp";
import HouseLocationPlanComp from "@/components/house/HouseLocationPlanComp";

import FieldSelect from "@/components/form/FieldSelect";
  import { getQueryLand, saveHouseBaseInfo , houseList , getHouseMembers , allInformationWLHT, checkDuplicateBuilding, checkDuplicateBuildingQuery, customSubmitWLHT, submitStartWLHT, updateStart, updateEnd, submitEndWLHT, getWorkflow } from "@/api/onlineHome/homestead/application";
  import $ from "jquery";
import CommonMap from "@/components/house/CommonMap";
import FieldDatePicker from "@/components/form/FieldDatePicker";
import FieldRadio from "@/components/form/FieldRadio";
import FieldCheckbox from "@/components/form/FieldCheckbox";
import {formatDate} from "element-ui/src/utils/date-util.js";
import request from '@/utils/request'
import {Notify} from "vant";
// 意图
const PROPOSER_VIEW = 1;
const PROPOSER_EDIT = 2;
const PROPOSER_ADD = 3;
// 阶段
const PROPOSER_STAGE_BASE_APPLY = 0;
const PROPOSER_STAGE_START = 1;
const PROPOSER_STAGE_END = 2;
// 工作流名称
const PROPOSER_STAGE_BASE_APPLY_ACTIVITY = 'baseApplyWLHT';
const PROPOSER_STAGE_START_ACTIVITY = 'landscopeWLHT';
const PROPOSER_STAGE_END_ACTIVITY = 'acceptingWLHT';
// 附件表名
const PROPOSER_STAGE_BASE_APPLY_TABLE = 't_house_apply_proposer';
const PROPOSER_STAGE_START_TABLE = 't_house_apply_start';
const PROPOSER_STAGE_END_TABLE = 't_house_apply_end';
// 其他
const PROPOSER_MODULE = 'house';

export default {
  name: "applicationForm",
    components: {
      FieldCheckbox,
      FieldRadio, HouseApplyUploadComp, FieldDatePicker, CommonMap, FieldSelect, HouseLocationPlanComp},
    data() {
    return {
      // 当前流程步骤
      active: 0,
      // 申请ID
      id: '',
      // 表单数据
      applicationDetail: {},
      // 当前家庭成员展开
      activeNames:['1'],
      // 当前显示流程
      selectedTabName: 0,
      processKeyField: null,
      // 表单意图
      proposerStatus: PROPOSER_VIEW,
      // 显示控制
      formVisible: {
        baseApplyFormVisible: true,
        editVisible: false,
        baseApplyForm: {
          baseFormVisible: true,
          homesteadFormVisible: false,
          groupFormVisible: false,
          villageFormVisible: false,
          townFormVisible: false,
          homesteadForm: {
            keepVisible: false, // 是否显示宅基地保留输入
            otherVisible: false, // 是否显示宅基地其他输入
          }
        },
        landscopeVisible: false,
        landscopeForm: {
          baseFormVisible: false,
        },
        acceptingVisible: false,
        acceptingForm: {
          baseFormVisible: false,
          townFormVisible: false,
        },
        auditVisible: false,
      },
      // 表单启用控制
      formEnabled: {
        baseApplyEnabled: false,
        submitEnabled: false,
        baseApplyForm: {
          baseFormEnabled: false,
          homesteadFormEnabled: false,
          groupFormEnabled: false,
          villageFormEnabled: false,
          townFormEnabled: false,
        },
        landscopeEnabled: false,
        landscopeForm: {
          baseFormEnabled: false,
        },
        acceptingEnabled: false,
        acceptingForm: {
          baseFormEnabled: false,
          townFormEnabled: false,
        },
      },
      // 申请附件树
      houseApplyUploadComp: {
        businessType: PROPOSER_MODULE,
        proposerId: null,
        houseApplyStatus: null,
        processKey: PROPOSER_STAGE_BASE_APPLY_ACTIVITY,
        tableName: PROPOSER_STAGE_BASE_APPLY_TABLE,
        attachmentList: [],
        readonly: false,
        full: false,
      },
      // 开工附件树
      houseApplyUploadCompStart: {
        businessType: PROPOSER_MODULE,
        proposerId: null,
        houseApplyStatus: null,
        processKey: PROPOSER_STAGE_START_ACTIVITY,
        tableName: PROPOSER_STAGE_START_TABLE,
        attachmentList: [],
        readonly: false,
        full: false,
      },
      // 验收附件树
      houseApplyUploadCompEnd: {
        businessType: PROPOSER_MODULE,
        proposerId: null,
        houseApplyStatus: null,
        processKey: PROPOSER_STAGE_END_ACTIVITY,
        tableName: PROPOSER_STAGE_END_TABLE,
        attachmentList: [],
        readonly: false,
        full: false,
      },
      currentUserRole: null,
      // 当前位置信息
      tGeoOrganizationLat: null,
      tGeoOrganizationLng: null,
      // 表单默认值
      form: {
        villagerOpinion: "经审查，材料真实有效，符合建房安全、无纠纷，同意申报。",
        villageOption: "经审查，{memberName}宅基地和建房申请材料真实有效，拟用地{location}符合村庄规划，相邻人{isAdvice}无异议，同意其宅基地和建房申请。",
        // applicationDetail.tHouseApplyProposer.memberName, applicationDetail.tHouseApplyProposedSituation.location, null
        groupOption: "经讨论和公示无异议，{memberName}符合农村宅基地申请资格，同意{memberName}的农村宅基地和建房申请。",
        // applicationDetail.tHouseApplyProposer.memberName, applicationDetail.tHouseApplyProposer.memberName
      },
      // 工作流
      taskId: null,
      instanceId: null,
      // 申请镇政府审批平面图
      uploadImg: {
        proposerId: null,
        fileList: '',
        uploadFileList: [],
        removeFileList: [],
      },
      // 验收镇政府审批平面图
      uploadImgAccepting: {
        proposerId: null,
        fileList: '',
        uploadFileList: [],
        removeFileList: [],
      },
      // 地图绘制
      drawInsert: null,
      // 附件弹出框显示
      attachmentVisible: false,
      // 工作流弹出框显示
      flowVisible: false,
      // 是/否字典
      yesNoOptions: [
        {dictLabel: '是', dictValue: 'Y'},
        {dictLabel: '否', dictValue: 'N'},
      ],
      // 当前附件tab
      attachmentActive: 0,
      // 家庭成员tab
      familyMembersActive: '0',
    };
  },
  created() {
    this.id = this.$route.query.id;
    this.type = this.$route.query.type;
    this.taskId = this.$route.query.taskId;
    this.instanceId = this.$route.query.instanceId;
    this.getFormIntent();
    this.getLandCoord();
    this.getDetail();
  },
  methods: {
    // 打开工作流程
    goFlow(){
      this.flowVisible = true;
      //window.location='flowChart?id='+this.id + '&processKey=WLHT';
    },
    // 初始化当前数据, 有ID则查询, 否则新增
    getDetail(){
      this.reset();
      if(this.id)
      {
        allInformationWLHT(this.id).then(response => {
          this.init(response.data);
        });
      }
      else
      {
        this.init();
        this.getApplyerDetail();
      }
    },
    // 绘制申请地图
    pointDarw(data) {
      this.$nextTick(() => {
        let map = this.$refs.pointDarwMap;
        if(data === null)
          data = this.applicationDetail.tHouseApplyProposedSituation.theGeom;
        this.setMapData(map, data);
      });
    },
    // 绘制验收地图
    pointWrapAcceptance(data) {
      this.$nextTick(() => {
        let map = this.$refs.pointDarwAcceptanceMap;
        if(data === null)
          if(data === null)
          {
            if(this.applicationDetail.tHouseApplyEnd && this.applicationDetail.tHouseApplyEnd.theGeom)
              data = this.applicationDetail.tHouseApplyEnd.theGeom;
            else {
              if(this.applicationDetail.tHouseApproveNatureOptions && this.applicationDetail.tHouseApproveNatureOptions.theGeom)
                data = this.applicationDetail.tHouseApproveNatureOptions.theGeom;
            }
          }
        this.setMapData(map, data);
      });
    },
    // 绘制开工地图
    paintStartNatureMap(data) {
      this.$nextTick(() => {
        let map = this.$refs.startNatureMap;
        if(data === null)
        {
          if(this.applicationDetail.tHouseApproveNatureOptions && this.applicationDetail.tHouseApproveNatureOptions.theGeom)
            data = this.applicationDetail.tHouseApproveNatureOptions.theGeom;
          else {
            if(this.applicationDetail.tHouseApplyProposedSituation.theGeom)
              data = this.applicationDetail.tHouseApplyProposedSituation.theGeom;
          }
        }
        this.setMapData(map, data);
      });
    },
    // 绘制自然资源部门地图
    pointDarwNature(data) {
      this.$nextTick(() => {
        let map = this.$refs.pointDarwNatureMap;
        if(data === null)
        {
          if(this.applicationDetail.tHouseApproveNatureOptions && this.applicationDetail.tHouseApproveNatureOptions.theGeom)
            data = this.applicationDetail.tHouseApproveNatureOptions.theGeom;
          else {
            if(this.applicationDetail.tHouseApplyProposedSituation.theGeom)
              data = this.applicationDetail.tHouseApplyProposedSituation.theGeom;
          }
        }
        this.setMapData(map, data);
      });
    },
    // 通用设置地图数据函数
    setMapData(map, data) {
      //console.log(map, data ? true : false);
      if(!map) return;
      if(data)
      {
        map.setLayer('pointDarwLayer', data);
      }
      else {
        this.getLandCoord((lng, lat) => {
          map.setCoord(this.tGeoOrganizationLng, this.tGeoOrganizationLat);
        });
      }
    },
    // 点击流程步骤条, 切换流程表单页
    onStepClicked(index) {
      this.selectTab(index);
    },
    // 全局初始化
    init(value) {
      const role = this.$store.getters.roles;
      this.currentUserRole = role[0];

      // 局部变量
      let houseApplyStatus = value ? value.tHouseApplyProposer.houseApplyStatus : -1;
      let proposerId = value ? value.tHouseApplyProposer.id : null;
      let hasGroupLevel = false; //value.tHouseApplyProposer.hasOwnProperty('hasGroupLevel') ? value.tHouseApplyProposer.hasGroupLevel : this.isGroupLevel;

      // 默认状态
      this.formVisible.baseApplyForm.homesteadFormVisible = value ? value.tHouseApplyProposer.existHomestead ==='Y' : false;

      this.formVisible.editVisible = false;

      this.formVisible.baseApplyForm.groupFormVisible = false;
      this.formVisible.baseApplyForm.villageFormVisible = false;
      this.formVisible.baseApplyForm.townFormVisible = false;

      this.formVisible.landscopeVisible = false;
      this.formVisible.landscopeForm.baseFormVisible = false;

      this.formVisible.acceptingVisible = false;
      this.formVisible.acceptingForm.baseFormVisible = false;
      this.formVisible.acceptingForm.townFormVisible = false

      this.formVisible.auditVisible = false;

      this.formEnabled.baseApplyEnabled = false;
      this.formEnabled.submitEnabled = false;
      this.formEnabled.baseApplyForm.baseFormEnabled = false;
      this.formEnabled.baseApplyForm.homesteadFormEnabled = false;
      this.formEnabled.baseApplyForm.groupFormEnabled = false;
      this.formEnabled.baseApplyForm.villageFormEnabled = false;
      this.formEnabled.baseApplyForm.townFormEnabled = false;

      this.formEnabled.landscopeEnabled = false;
      this.formEnabled.landscopeForm.baseFormEnabled = false;

      this.formEnabled.acceptingEnabled = false;
      this.formEnabled.acceptingForm.baseFormEnabled = false;
      this.formEnabled.acceptingForm.townFormEnabled = false;

      switch (this.proposerStatus) {
        // 查看
        case PROPOSER_VIEW:
          this.formVisible.baseApplyForm.groupFormVisible = hasGroupLevel && this.isNotProposeStatus(houseApplyStatus, ["1", '32']);
          this.formVisible.baseApplyForm.villageFormVisible = this.isNotProposeStatus(houseApplyStatus, ["1", "32", "2", "3", "31"]);
          this.formVisible.baseApplyForm.townFormVisible = this.isNotProposeStatus(houseApplyStatus, ["1", "32", "2", "3", "31", '4', '5', '8']);

          this.formVisible.landscopeVisible = this.isNotProposeStatus(houseApplyStatus, ["1", "32", "2", "3", "31", '4', '5', '6', '7', '8', '9', '10']);
          this.formVisible.landscopeForm.baseFormVisible = this.isNotProposeStatus(houseApplyStatus, ["1", "32", "2", "3", "31", '4', '5', '6', '7', '8', '9', '10']);

          this.formVisible.acceptingVisible = this.isProposeStatus(houseApplyStatus, ["18", "20", "21", "22", "23", "24", "25", "30", "29", "26"]);
          this.formVisible.acceptingForm.baseFormVisible = this.isProposeStatus(houseApplyStatus, ["18", "20", "21", "22", "23", "24", "25", "30", "29", "26"]);
          this.formVisible.acceptingForm.townFormVisible = this.isProposeStatus(houseApplyStatus, [/*"29", */"26"]);

          this.formEnabled.submitEnabled = this.isProposeStatus(houseApplyStatus, ["1"]);
          this.formVisible.editVisible = this.formEnabled.submitEnabled;

          this.houseApplyUploadComp.full = true;
          this.houseApplyUploadComp.readonly = true;
          this.houseApplyUploadComp.proposerId = proposerId;
          this.houseApplyUploadComp.houseApplyStatus = houseApplyStatus;
          this.houseApplyUploadCompStart.full = true;
          this.houseApplyUploadCompStart.readonly = true;
          this.houseApplyUploadCompStart.proposerId = proposerId;
          this.houseApplyUploadCompStart.houseApplyStatus = houseApplyStatus; // == '10' ? '12' : houseApplyStatus;
          this.houseApplyUploadCompEnd.full = true;
          this.houseApplyUploadCompEnd.readonly = true;
          this.houseApplyUploadCompEnd.proposerId = proposerId;
          this.houseApplyUploadCompEnd.houseApplyStatus = houseApplyStatus;

          // 初始化申请平面图
          this.uploadImg.fileList = value.tHouseApproveLocationplanOptions ? value.tHouseApproveLocationplanOptions.locationPlan : '';
          this.uploadImg.proposerId = value.tHouseApplyProposer.id;
          // 初始化验收平面图
          this.uploadImgAccepting.fileList = value.tHouseApplyEnd ? value.tHouseApplyEnd.locationPlan : '';
          this.uploadImgAccepting.proposerId = value.tHouseApplyProposer.id;

          //地图查看
          this.applicationDetail = value;
          this.pointDarw(null);
          this.pointDarwNature(null);
          this.pointWrapAcceptance(null);
          this.paintStartNatureMap(null);
          break;

        // 编辑/审批
        case PROPOSER_EDIT:
          let handlerName = this.$store.getters.nickName;
          let handlerTime = this.getDate();
          this.applicationDetail = value;
          this.formVisible.auditVisible = this.type === 'done' || this.type === 'todo';

          // 申请-组级审批 初始化表单
          if(hasGroupLevel)
          {
            if(this.isProposeStatus(houseApplyStatus, ["32"]))
            {
              let defaultGroupOption = this.form.groupOption
                .replaceAll('{memberName}', this.applicationDetail.tHouseApplyProposer.memberName)
              ;
              if(!value.tHouseApproveVillageOptions)
              {
                this.$set(this.applicationDetail, 'tHouseApproveVillageOptions', {
                  groupLeader: handlerName,
                  groupTime: handlerTime,
                  groupOption: defaultGroupOption
                });
              }
              else {
                if(!this.applicationDetail.tHouseApproveVillageOptions.groupLeader)
                  this.$set(this.applicationDetail.tHouseApproveVillageOptions, 'groupLeader', handlerName);
                if(!this.applicationDetail.tHouseApproveVillageOptions.groupTime)
                  this.$set(this.applicationDetail.tHouseApproveVillageOptions, 'groupTime', handlerTime);
                if(!this.applicationDetail.tHouseApproveVillageOptions.groupOption)
                  this.$set(this.applicationDetail.tHouseApproveVillageOptions, 'groupOption', defaultGroupOption);
              }
            }
          }

          // 申请-草稿
          if(this.isProposeStatus(houseApplyStatus, ["1"]))
          {
            this.formEnabled.baseApplyForm.baseFormEnabled = true;
            this.formEnabled.baseApplyEnabled = true;
            this.formEnabled.submitEnabled = true;
            this.formVisible.editVisible = true;
          }
          // 申请-村级审批
          else if(this.isProposeStatus(houseApplyStatus, ["31"]))
          {
            let neighbor = [];
            if(this.applicationDetail.tHouseApplyProposedSituation.east) neighbor.push(this.applicationDetail.tHouseApplyProposedSituation.east);
            if(this.applicationDetail.tHouseApplyProposedSituation.west) neighbor.push(this.applicationDetail.tHouseApplyProposedSituation.west);
            if(this.applicationDetail.tHouseApplyProposedSituation.south) neighbor.push(this.applicationDetail.tHouseApplyProposedSituation.south);
            if(this.applicationDetail.tHouseApplyProposedSituation.north) neighbor.push(this.applicationDetail.tHouseApplyProposedSituation.north);
            neighbor = neighbor.join('、');
            let defaultVillageOption = this.form.villageOption
              .replaceAll('{memberName}', this.applicationDetail.tHouseApplyProposer.memberName)
              .replaceAll('{location}', this.applicationDetail.tHouseApplyProposedSituation.location)
              .replaceAll('{isAdvice}', neighbor)
            ; // this.form.villagerOpinion
            if(!value.tHouseApproveVillageOptions) {
              this.$set(this.applicationDetail, 'tHouseApproveVillageOptions', {
                villageLeader: handlerName,
                villageOption: defaultVillageOption,
                villageTime: handlerTime,
              });
            }
            else {
              if(!this.applicationDetail.tHouseApproveVillageOptions.villageLeader)
                this.$set(this.applicationDetail.tHouseApproveVillageOptions, 'villageLeader', handlerName);
              if(!this.applicationDetail.tHouseApproveVillageOptions.villageTime)
                this.$set(this.applicationDetail.tHouseApproveVillageOptions, 'villageTime', handlerTime);
              if(!this.applicationDetail.tHouseApproveVillageOptions.villageOption)
                this.$set(this.applicationDetail.tHouseApproveVillageOptions, 'villageOption', defaultVillageOption);
            }
          }
          // 申请-镇级审批
          else if(this.isProposeStatus(houseApplyStatus, ["8"]))
          {
            // 自然资源部门
            if(!value.tHouseApproveNatureOptions)
            {
              this.$set(this.applicationDetail, "tHouseApproveNatureOptions", {
                landArea: "",
                rightsType: "",
                east: "", // 东至
                west: "", // 西至
                south: "", // 南至
                north: "", // 北至
                approveLeader: handlerName,
                approveOption: "",
                approveTime: handlerTime,
                //theGeom: value.tHouseApplyProposedSituation.theGeom,
              });
            }
            else {
              if(!this.applicationDetail.tHouseApproveNatureOptions.approveLeader)
                this.$set(this.applicationDetail.tHouseApproveNatureOptions, 'approveLeader', handlerName);
              if(!this.applicationDetail.tHouseApproveNatureOptions.approveTime)
                this.$set(this.applicationDetail.tHouseApproveNatureOptions, 'approveTime', handlerTime);
            }
            // 农村农业部门
            if(!value.tHouseApproveAgricultureOptions)
            {
              this.$set(this.applicationDetail, "tHouseApproveAgricultureOptions", {
                isMembership: "",
                isOnehouse: "",
                isReviewmaterials: "",
                approveLeader: handlerName,
                approveOption: "",
                approveTime: handlerTime,
              });
            }
            else {
              if(!this.applicationDetail.tHouseApproveAgricultureOptions.approveLeader)
                this.$set(this.applicationDetail.tHouseApproveAgricultureOptions, 'approveLeader', handlerName);
              if(!this.applicationDetail.tHouseApproveAgricultureOptions.approveTime)
                this.$set(this.applicationDetail.tHouseApproveAgricultureOptions, 'approveTime', handlerTime);
            }
            // 住建部
            if(!value.tHouseApproveOtherOptions)
            {
              this.$set(this.applicationDetail, "tHouseApproveOtherOptions", {
                buildingType: "",
                buildingArea: "",
                buildingFloors: "",
                buildingHight: "",
                buildingLandArea: "",
                designPaper: "1",
                east: "", // 东至
                west: "", // 西至
                south: "", // 南至
                north: "", // 北至
                approveLeader: handlerName,
                approveOption: "",
                approveTime: handlerTime,
              });
            }
            else {
              if(!this.applicationDetail.tHouseApproveOtherOptions.approveLeader)
                this.$set(this.applicationDetail.tHouseApproveOtherOptions, 'approveLeader', handlerName);
              if(!this.applicationDetail.tHouseApproveOtherOptions.approveTime)
                this.$set(this.applicationDetail.tHouseApproveOtherOptions, 'approveTime', handlerTime);
            }
            // 镇政府
            if(!value.tHouseApproveTownOptions)
            {
              this.$set(this.applicationDetail, 'tHouseApproveTownOptions', {
                approveLeader: handlerName,
                approveTime: handlerTime,
              });
            }
            else {
              if(!this.applicationDetail.tHouseApproveTownOptions.approveLeader)
                this.$set(this.applicationDetail.tHouseApproveTownOptions, 'approveLeader', handlerName);
              if(!this.applicationDetail.tHouseApproveTownOptions.approveTime)
                this.$set(this.applicationDetail.tHouseApproveTownOptions, 'approveTime', handlerTime);
            }
            // 勘察
            if(!value.tHouseApproveLocationplanOptions)
            {
              this.$set(this.applicationDetail, 'tHouseApproveLocationplanOptions', {
                locationPlan: null,
                cartographicUnit: '',
                surveyPersonnel: handlerName,
                suveyTime: handlerTime,
                cartographer: handlerName,
                cartographicTime: handlerTime,
              });
            }
            else {
              if(!this.applicationDetail.tHouseApproveLocationplanOptions.surveyPersonnel)
                this.$set(this.applicationDetail.tHouseApproveLocationplanOptions, 'surveyPersonnel', handlerName);
              if(!this.applicationDetail.tHouseApproveLocationplanOptions.suveyTime)
                this.$set(this.applicationDetail.tHouseApproveLocationplanOptions, 'suveyTime', handlerTime);
              if(!this.applicationDetail.tHouseApproveLocationplanOptions.cartographer)
                this.$set(this.applicationDetail.tHouseApproveLocationplanOptions, 'cartographer', handlerName);
              if(!this.applicationDetail.tHouseApproveLocationplanOptions.cartographicTime)
                this.$set(this.applicationDetail.tHouseApproveLocationplanOptions, 'cartographicTime', handlerTime);
            }
          }

          // 开工申请
          else if(this.isProposeStatus(houseApplyStatus, ["10"]))
          {
            if(!this.applicationDetail.tHouseApplyStart)
            {
              this.$set(this.applicationDetail, 'tHouseApplyStart', {
                startDate: '',
                endDate: '',
              });
            }
          }
          // 验收
          else if(this.isProposeStatus(houseApplyStatus, ["20"]))
          {
            if(!this.applicationDetail.tHouseApplyEnd)
            {
              this.$set(this.applicationDetail, 'tHouseApplyEnd', {
                //TODO: 开工结束时后台必定生成
              });
            }
          }
          // 验收镇级审批
          else if(this.isProposeStatus(houseApplyStatus, ["29"]))
          {
            if(!this.applicationDetail.tHouseApplyEnd.cartographer) this.applicationDetail.tHouseApplyEnd.cartographer = handlerName;
            if(!this.applicationDetail.tHouseApplyEnd.zhenName) this.applicationDetail.tHouseApplyEnd.zhenName = handlerName;
            if(!this.applicationDetail.tHouseApplyEnd.zhenTime) this.applicationDetail.tHouseApplyEnd.zhenTime = handlerTime;
            if(!this.applicationDetail.tHouseApplyEnd.nongyeName) this.applicationDetail.tHouseApplyEnd.nongyeName = handlerName;
            if(!this.applicationDetail.tHouseApplyEnd.nongyeTime) this.applicationDetail.tHouseApplyEnd.nongyeTime = handlerTime;
            if(!this.applicationDetail.tHouseApplyEnd.natureName) this.applicationDetail.tHouseApplyEnd.natureName = handlerName;
            if(!this.applicationDetail.tHouseApplyEnd.natureTime) this.applicationDetail.tHouseApplyEnd.natureTime = handlerTime;
            if(!this.applicationDetail.tHouseApplyEnd.buildingName) this.applicationDetail.tHouseApplyEnd.buildingName = handlerName;
            if(!this.applicationDetail.tHouseApplyEnd.buildingTime) this.applicationDetail.tHouseApplyEnd.buildingTime = handlerTime;
            if(!this.applicationDetail.tHouseApplyEnd.isProjectFinished) this.applicationDetail.tHouseApplyEnd.isProjectFinished = 'Y';
            if(!this.applicationDetail.tHouseApplyEnd.isQualifiedQuality) this.applicationDetail.tHouseApplyEnd.isQualifiedQuality = 'Y';
            if(!this.applicationDetail.tHouseApplyEnd.hasBuildingRecord) this.applicationDetail.tHouseApplyEnd.hasBuildingRecord = 'Y';
            if(!this.applicationDetail.tHouseApplyEnd.isSignWarranty) this.applicationDetail.tHouseApplyEnd.isSignWarranty = 'Y';
            if(!this.applicationDetail.tHouseApplyEnd.isHandleProblem) this.applicationDetail.tHouseApplyEnd.isHandleProblem = 'Y';
            if(!this.applicationDetail.tHouseApplyEnd.isDesignPaperSame) this.applicationDetail.tHouseApplyEnd.isDesignPaperSame = 'Y';
            if(!this.applicationDetail.tHouseApplyEnd.isOtherAcceptanceFinished) this.applicationDetail.tHouseApplyEnd.isOtherAcceptanceFinished = 'Y';
          }

          this.formVisible.baseApplyForm.groupFormVisible = hasGroupLevel && this.isNotProposeStatus(houseApplyStatus, ["1"]);
          this.formVisible.baseApplyForm.villageFormVisible = this.isNotProposeStatus(houseApplyStatus, ["1", "32", "2", "3"]);
          this.formVisible.baseApplyForm.townFormVisible = this.isNotProposeStatus(houseApplyStatus, ["1", "32", "2", "3", "31", '4', '5']);

          this.formVisible.landscopeVisible = this.isNotProposeStatus(houseApplyStatus, ["1", "32", "2", "3", "31", '4', '5', '6', '7', '8', '9']);
          this.formVisible.landscopeForm.baseFormVisible = this.isNotProposeStatus(houseApplyStatus, ["1", "32", "2", "3", "31", '4', '5', '6', '7', '8', '9']);

          this.formVisible.acceptingVisible = this.isProposeStatus(houseApplyStatus, ["18", "20", "21", "22", "23", "24", "25", "30", "29", "26"]);
          this.formVisible.acceptingForm.baseFormVisible = this.isProposeStatus(houseApplyStatus, ["18", "20", "21", "22", "23", "24", "25", "30", "29", "26"]);
          this.formVisible.acceptingForm.townFormVisible = this.isProposeStatus(houseApplyStatus, ["29", "26"]);

          this.formEnabled.baseApplyForm.groupFormEnabled = hasGroupLevel && this.isProposeStatus(houseApplyStatus, ['32']) && this.isInRoles(role, 'village_group_leader');
          this.formEnabled.baseApplyForm.villageFormEnabled = this.isProposeStatus(houseApplyStatus, ["31"]) && this.isInRoles(role, 'village_leader');
          this.formEnabled.baseApplyForm.townFormEnabled = this.isProposeStatus(houseApplyStatus, ['8']) && this.isInRoles(role, 'town_leader');
          //console.log(this.isProposeStatus(houseApplyStatus, ['8']) && this.isInRoles(role, 'town_leader')+'11111111');
          this.formEnabled.landscopeEnabled = this.isProposeStatus(houseApplyStatus, ['10', '12']);
          this.formEnabled.landscopeForm.baseFormEnabled = this.isProposeStatus(houseApplyStatus, ['10', '12']);

          this.formEnabled.acceptingEnabled = this.isProposeStatus(houseApplyStatus, ['20']);
          this.formEnabled.acceptingForm.baseFormEnabled = this.isProposeStatus(houseApplyStatus, ['20']);
          this.formEnabled.acceptingForm.townFormEnabled = this.isProposeStatus(houseApplyStatus, ["29"]) && this.isInRoles(role, 'town_leader');

          this.applicationDetail.tHouseApplyProposer = value.tHouseApplyProposer;
          this.applicationDetail.tHouseApplyCurrentSituation = value.tHouseApplyCurrentSituation;
          this.applicationDetail.tHouseApplyProposedSituation = value.tHouseApplyProposedSituation;
          //this.formEnabled.landscopeEnabled = value.startDraft;

          if (this.isLandscope()) {
            this.houseApplyUploadComp.full = true;
            this.houseApplyUploadCompStart.full = false;
            this.houseApplyUploadCompEnd.full = false;
            this.houseApplyUploadComp.readonly = true;
            this.houseApplyUploadCompStart.readonly = false;
            this.houseApplyUploadCompEnd.readonly = true;
          } else if (this.isAccepting()) {
            this.houseApplyUploadComp.full = true;
            this.houseApplyUploadCompStart.full = true;
            this.houseApplyUploadCompEnd.full = false;
            this.houseApplyUploadComp.readonly = true;
            this.houseApplyUploadCompStart.readonly = true;
            this.houseApplyUploadCompEnd.readonly = false;
          }
          else { // this.isBaseApply()
            this.houseApplyUploadComp.full = false;
            this.houseApplyUploadCompStart.full = false;
            this.houseApplyUploadCompEnd.full = false;
            this.houseApplyUploadComp.readonly = false;
            this.houseApplyUploadCompStart.readonly = houseApplyStatus == '10' ? false : true;
            this.houseApplyUploadCompEnd.readonly = true;
          }

          this.houseApplyUploadComp.proposerId = proposerId;
          this.houseApplyUploadComp.houseApplyStatus = houseApplyStatus;
          this.houseApplyUploadCompStart.proposerId = proposerId;
          this.houseApplyUploadCompStart.houseApplyStatus = houseApplyStatus == '10' ? '12' : houseApplyStatus; // 申请通过是10 被驳回是12
          this.houseApplyUploadCompEnd.proposerId = proposerId;
          this.houseApplyUploadCompEnd.houseApplyStatus = houseApplyStatus;

          // 初始化申请平面图
          this.applicationDetail.tHouseApproveLocationplanOptions = value.tHouseApproveLocationplanOptions;
          this.uploadImg.fileList = value.tHouseApproveLocationplanOptions ? value.tHouseApproveLocationplanOptions.locationPlan : '';
          this.uploadImg.proposerId = this.applicationDetail.tHouseApplyProposer.id;

          this.uploadImgAccepting.fileList = value.tHouseApplyEnd ? value.tHouseApplyEnd.locationPlan : '';
          this.uploadImgAccepting.proposerId = this.applicationDetail.tHouseApplyProposer.id;

          //地图编辑
          this.pointDarw(null);
          this.pointDarwNature(null);
          this.pointWrapAcceptance(null);
          this.paintStartNatureMap(null);
          break;

        // 新建
        case PROPOSER_ADD:
          this.formEnabled.baseApplyEnabled = true;
          this.formEnabled.baseApplyForm.baseFormEnabled = true;
          this.formEnabled.submitEnabled = true;
          this.formVisible.editVisible = true;

          this.houseApplyUploadComp.full = false;
          this.houseApplyUploadComp.readonly = false;
          this.houseApplyUploadComp.houseApplyStatus = '1';
          this.houseApplyUploadComp.proposerId = -1;

          this.pointDarw();
          getWorkflow().then((resp) => {
            this.$set(this.applicationDetail, 'proposerActiveIndex', -1);
            this.$set(this.applicationDetail, 'startActiveIndex', -1);
            this.$set(this.applicationDetail, 'endActiveIndex', -1);
            this.$set(this.applicationDetail, 'applyStepList', resp.data.applyStepList.name);
            this.$set(this.applicationDetail, 'startStepList', resp.data.startStepList.name);
            this.$set(this.applicationDetail, 'endStepList', resp.data.endStepList.name);
          });
          //this.initData();
          break;
      }

      // 通用设置
      if (this.isLandscope()) {
        this.active = PROPOSER_STAGE_START;
        this.selectedTabName = PROPOSER_STAGE_START;
        this.processKeyField = PROPOSER_STAGE_START_ACTIVITY;
        this.attachmentActive = PROPOSER_STAGE_START;
      } else if (this.isAccepting()) {
        this.active = PROPOSER_STAGE_END;
        this.selectedTabName = PROPOSER_STAGE_END;
        this.processKeyField = PROPOSER_STAGE_END_ACTIVITY;
        this.attachmentActive = PROPOSER_STAGE_END;
      }
      else { // this.isBaseApply()
        this.active = PROPOSER_STAGE_BASE_APPLY;
        this.selectedTabName = PROPOSER_STAGE_BASE_APPLY;
        this.attachmentActive = PROPOSER_STAGE_BASE_APPLY;
        // 编辑时且为申请通过状态 -> 填写开工
        if(this.proposerStatus == PROPOSER_EDIT && houseApplyStatus == '10')
        {
          this.active = PROPOSER_STAGE_START;
          this.selectedTabName = PROPOSER_STAGE_START;
          this.attachmentActive = PROPOSER_STAGE_START;
        }

        this.processKeyField = PROPOSER_STAGE_BASE_APPLY_ACTIVITY;
      }
    },
    // 获取query的意图
    getFormIntent() {
      console.log(this.type);
      switch (this.type) {
        case 'done':
        case 'view':
          this.proposerStatus = PROPOSER_VIEW;
          break;
        case 'add':
          this.proposerStatus = PROPOSER_ADD;
          break;
        case 'modify':
        case 'audit':
        case 'todo':
          this.proposerStatus = PROPOSER_EDIT;
          break;
        default:
          this.proposerStatus = PROPOSER_VIEW;
          break;
      }
      return this.proposerStatus;
    },
    // 获取日期, yyyy-MM-dd
    getDate(d) {
      return formatDate(d ? d : new Date(), 'yyyy-MM-dd');
    },
    // 初始化基础表单
    reset() {
      this.$set(this.applicationDetail, 'tHouseApplyProposer', {
        memberName: "",
        sex: "",
        age: "" /* 年龄*/,
        phone: "",
        idcard: "",
        householdRegister: "",
        familyAddress: "",
        members: 0, // 家庭人口数
        applyTime: this.getDate(),
        applyReasion: "",
        houseSource: "建房申请来源{农户自制,协管代办}", // 字典
        houseApplyStatus: "", // 字典
        auditStatus: "", // 字典
        taskId: "",
        taskName: "",
        instanceId: "",
        processKey: "",
        existHomestead: "N",
      });
      this.$set(this.applicationDetail, "tHouseApplyCurrentSituation", {
        landArea: "", //宅基地面积
        landPerArea: "", //人均宅基地面积
        landCertificateNo: "", //权属证书号
        buildingPerArea: "", //人均建筑面积
        houseCertificateNo: "", //权属证书号
        landIsposal: "", // 现宅基地处置情况
        reservedArea: "", // 保留m²
        otherRemark: "", // 其他
      });
      this.$set(this.applicationDetail, "tHouseApplyFamilyMembers", []);
      this.$set(this.applicationDetail, "tHouseApplyProposedSituation", {
        location: "", // 拟建位置
        landArea: "", // 宅基地面积
        east: "", // 东至
        west: "", // 西至
        south: "", // 南至
        north: "", // 北至
        geographicType: "", // 地类
        constructionLandArea: "", // 建设用地面积
        unusedLandArea: "", // 未利用地面积
        agriculturalLandArea: "", // 农用地面积
        farmLandArea: "", //耕地面积
        forestLandArea: "", // 林地面积
        buildingArea: "", // 建筑面积
        buildingFloors: "", // 建筑层数
        buildingHight: "", // 建筑高度
        designPaper: "1", // 设计图纸
        housingStructure: "", // 房屋构造
        isAdvice: "1", // 是否征求相邻权利人意见
        buildingType: "4",
        buildingLandArea:"", //房基占地面积
        buildingDesign: "1",//是否有住房建设设计图
        buildingAtlas: "1", //是否采用住建部门提供的图集
        houseTypeId: null,
      });
      this.$set(this.applicationDetail, 'fileList', []);
    },
    //是否有宅基地选项改变
    existHomesteadChange(name){
      if (name == 'Y'){
        if (!this.applicationDetail.tHouseApplyCurrentSituation){
          //现宅基地情况
          this.$set(this.applicationDetail, 'tHouseApplyCurrentSituation', {
            //宅基地面积
            landArea: '',
            //人均宅基地面积
            landPerArea: '',
            //不动产单元号
            landCertificateNo: '',
            //农民房屋幢号
            houseCertificateNo: '',
            //建筑面积
            buildingArea: '',
            //人均建筑面积
            buildingPerArea: '',
            //现宅基地处置情况 字典 land_isposal
            landIsposal: ""
          });
        }
      }
      else
        this.$set(this.applicationDetail, 'tHouseApplyCurrentSituation', null);
    },
    //添加家庭成员
    addFamily(){
      this.applicationDetail.tHouseApplyProposer.members++;
      this.applicationDetail.tHouseApplyFamilyMembers.push({
        //applyProposerId: this.applicationDetail.tHouseApplyFamilyMembers[0].applyProposerId,
        memberName:'',
        age:'',
        familyStatusName:'',
        idcard :'',
        householdRegister:'',
      });
    },
    //删除家庭成员
    deleteFamily(index){
      this.applicationDetail.tHouseApplyProposer.members--;
      this.applicationDetail.tHouseApplyFamilyMembers.splice(index,1)
    },
    // 获取户型配置
    getHouseList() {
      return houseList();
    },
    //返回上一步操作
    goBack(){
      this.$router.push({name: this.$router.back(-1)});
    },
    // 当地图绘制完成时
    onMapDrawFinished(data) {
      this.drawInsert = data;
    },
    // 当申请地图被重置时
    onMapDrawReseted() {
      this.drawInsert = null;
      if(this.applicationDetail.tHouseApplyProposedSituation.theGeom)
      {
        let lastData = JSON.parse(this.applicationDetail.tHouseApplyProposedSituation.theGeom);
        if(lastData.hasOwnProperty('coordinates')) // 从后台获取的
          this.drawInsert = lastData.coordinates;
      }
    },
    // 全局提交
    onSubmit(intent){
      console.log(this.applicationDetail, intent);
      switch (intent) {
        case 'add':
        case 'modify':
          this.saveProposerApply();
          break;
        case 'submit':
          this.submitApplyProposer();
          break;
        case 'save_and_submit':
          this.saveProposerApply(true);
          break;
        case 'agree':
          this.auditProposer(true);
          break;
        case 'reject':
          this.auditProposer(false);
          break;
        case 'start':
          this.startProposerApply();
          break;
        case 'start_and_submit':
          this.startProposerApply(true);
          break;
        case 'end':
          this.endProposerApply(true);
          break;
        default:
          console.error('Unknown intent! ', intent);
          break;
      }
    },
    // 初次申请草稿的附件上传
    onUploadFinished(fileIdList) {
      this.$set(this.applicationDetail, "fileList", fileIdList);
    },
    // 获取申请人信息
    getApplyerDetail(){
      getHouseMembers().then(res => {
        if(res.data)
        {
          this.applicationDetail.tHouseApplyProposer = res.data.tHouseApplyProposer;
          this.applicationDetail.tHouseApplyFamilyMembers = res.data.tHouseApplyFamilyMembers;
          if(!this.applicationDetail.tHouseApplyProposer.existHomestead)
            this.applicationDetail.tHouseApplyProposer.existHomestead = 'N';
          this.applicationDetail.tHouseApplyProposer.applyTime = this.getDate();
          this.getMemberCurrentSituation();
        }
      });
    },
    // 检查字符串, 不符合返回true
    checkString(value, regexp) {
      let res = value === undefined || value === null || value === '' || value.toString().trim().length === 0;
      if(res)
        return true;
      if(regexp)
        res = !regexp.test(value);
      return res;
    },
    // 保存申请(是否提交)
    saveProposerApply(submit) {
      let msg = this.validateBaseApplyFormBase();
      if(msg)
      {
        this.notify(msg, 'danger');
        return;
      }
      //地图判断
      if (this.drawInsert != null) {
        this.applicationDetail.tHouseApplyProposedSituation.theGeom = JSON.stringify(this.drawInsert);
      }
      else
      {
        if(this.applicationDetail.tHouseApplyProposer.existHomestead === 'Y' && this.applicationDetail.tHouseApplyProposedSituation.theGeom) // 新增时 && 已有宅基地时 && 重新画过图且被清理掉
        {
          this.applicationDetail.tHouseApplyProposedSituation.theGeom = this.convertGeom(this.applicationDetail.tHouseApplyProposedSituation.theGeom);
        }
      }
      if(this.checkString(this.applicationDetail.tHouseApplyProposedSituation.theGeom))
      {
        this.notify("请标注宅基地位置!", 'danger');
        return;
      }
      console.log("进行保存", this.applicationDetail);
      saveHouseBaseInfo(this.applicationDetail).then((response) => {
        if(submit)
        {
          this.id = response.data;
          this.submitApplyProposer();
        }
        else
        {
          this.notify("保存成功", 'success');
          this.$router.back(-1);
        }
      }).catch((e) => {
        this.notify("保存失败!", 'danger');
      }).finally(() => {
      });
    },
    // 判断状态是否符合
    isProposeStatus(target, arr) {
      if(!Array.isArray(arr))
        arr = arr.split(',');
      return arr.indexOf(target) !== -1;
    },
    // 判断状态是否不符合
    isNotProposeStatus(target, arr) {
      return !this.isProposeStatus(target, arr);
    },
    // 是否当前是申请流程
    isBaseApply() {
      return ["1", "32", "2", "3", "31", "4", "5", "6", "7", "8", "9", "10"].indexOf(this.applicationDetail.tHouseApplyProposer.houseApplyStatus) !== -1;
    },
    // 是否当前是开工流程
    isLandscope() {
      return ["12", "13", "14", "15", "16", "17", "28", "19", "18"].indexOf(this.applicationDetail.tHouseApplyProposer.houseApplyStatus) !== -1;
    },
    // 是否当前是验收流程
    isAccepting() {
      return ["18", "20", "21", "22", "23", "24", "25", "30", "29", "26"].indexOf(this.applicationDetail.tHouseApplyProposer.houseApplyStatus) !== -1;
    },
    // 获取当前申请人的宅基地信息
    getMemberCurrentSituation(item) {
      let farmerCode = this.applicationDetail.tHouseApplyProposer.farmerCode;
      checkDuplicateBuilding({farmerCode: farmerCode}).then(resp => {
        if (resp.data) {
          this.notify(resp.msg, 'danger');
        } else {
          checkDuplicateBuildingQuery({farmerCode: farmerCode}).then(resp => {
            if(resp.data !=null && resp.data !=""){
              this.applicationDetail.tHouseApplyProposer.existHomestead ="Y";
              // 现宅基地及农房情况对象
              this.applicationDetail.tHouseApplyCurrentSituation.landArea = resp.data.zdmj; //宅基地面积
              this.applicationDetail.tHouseApplyCurrentSituation.landPerArea= (resp.data.zdmj/(this.applicationDetail.tHouseApplyProposer.members +1)); //人均宅基地面积
              this.applicationDetail.tHouseApplyCurrentSituation.landCertificateNo= resp.data.bdcdyh; //不动产单元号
              this.applicationDetail.tHouseApplyCurrentSituation.buildingArea= resp.data.scjzmj; //建筑面积
              this.applicationDetail.tHouseApplyCurrentSituation.buildingPerArea= (resp.data.scjzmj/(this.applicationDetail.tHouseApplyProposer.members +1)); //人均建筑面积
              this.applicationDetail.tHouseApplyCurrentSituation.houseCertificateNo= resp.data.zrzh; //自然幢号
              this.applicationDetail.tHouseApplyCurrentSituation.landIsposal= ""; // 现宅基地处置情况
              this.applicationDetail.tHouseApplyCurrentSituation.reservedArea= ""; // 保留m²
              this.applicationDetail.tHouseApplyCurrentSituation.otherRemark= ""; // 其他
              this.renderMapRegion(resp.data.theGeom);
            } else {
              this.applicationDetail.tHouseApplyProposer.existHomestead ="N";
              // 现宅基地及农房情况对象
              this.applicationDetail.tHouseApplyCurrentSituation.landArea = ""; //宅基地面积
              this.applicationDetail.tHouseApplyCurrentSituation.landPerArea= ""; //人均宅基地面积
              this.applicationDetail.tHouseApplyCurrentSituation.landCertificateNo= ""; //权属证书号
              this.applicationDetail.tHouseApplyCurrentSituation.buildingPerArea= ""; //人均建筑面积
              this.applicationDetail.tHouseApplyCurrentSituation.houseCertificateNo= ""; //权属证书号
              this.applicationDetail.tHouseApplyCurrentSituation.landIsposal= ""; // 现宅基地处置情况
              this.applicationDetail.tHouseApplyCurrentSituation.reservedArea= ""; // 保留m²
              this.applicationDetail.tHouseApplyCurrentSituation.otherRemark= ""; // 其他
              this.renderMapRegion(null);
            }
          });
        }
      });
    },
    // 绘制现有宅基地地图
    renderMapRegion(json = null) { // json = theGeom
      this.applicationDetail.tHouseApplyProposedSituation.theGeom = json;
      if(json)
      {
        let obj = JSON.parse(json);
        this.drawInsert = obj.coordinates;
      }
      else
        this.drawInsert = null;
      this.pointDarw(null);
    },
    // 提交申请
    submitApplyProposer() {
      customSubmitWLHT(this.id).then((resp) => {
          this.notify("提交成功", 'success');
          this.$router.back(-1);
        }).catch((e) => {
        this.notify("提交失败!", 'danger');
      }).finally(() => {
      });
    },
    // 判断角色是否符合
    isInRoles(myRoles, requireRole) {
      if(!Array.isArray(myRoles))
        myRoles = myRoles.split(',');
      return myRoles.indexOf(requireRole) !== -1;
    },
    // 转换地图数据用于提交后台
    convertGeom(json) {
      let data = JSON.parse(json);
      if(data.hasOwnProperty('coordinates'))
        return JSON.stringify(data.coordinates);
      return null;
    },
    // 审批(同意/驳回)
    auditProposer(pass) {
      switch (this.processKeyField) {
        case PROPOSER_STAGE_BASE_APPLY_ACTIVITY: {
          let comment;
          const role = this.$store.getters.roles[0];
          console.log(role);
          let msg = "";
          switch (role) {
            case "town_leader":
              msg = this.validateAgricultureForm(pass);
              if (msg) {
                break;
              }

              msg = this.validateNatureForm();
              if (msg) {
                break;
              }

              msg = this.validateBuildingForm();
              if (msg) {
                break;
              }

              msg = this.validateTownForm();
              if (msg) {
                break;
              }
              comment = this.applicationDetail.tHouseApproveTownOptions.approveOption;
              //地图判断
              if (this.drawInsert != null) {
                this.applicationDetail.tHouseApproveNatureOptions.theGeom = JSON.stringify(this.drawInsert);
              }
              else {
                if(this.applicationDetail.tHouseApproveNatureOptions && this.applicationDetail.tHouseApproveNatureOptions.theGeom == null){
                  this.applicationDetail.tHouseApproveNatureOptions.theGeom = this.convertGeom(this.applicationDetail.tHouseApplyProposedSituation.theGeom);
                }
              }
              console.log(this.$refs.pictureUploadApplying, this.$refs.pictureUploadApplying.isValid());
              if(this.$refs.pictureUploadApplying && this.$refs.pictureUploadApplying.isValid()) {
                this.submitHouseApproveLocationplanOptions(pass, comment);
                return;
              }
              break;
            default:
              comment = this.applicationDetail.tHouseApproveVillageOptions.villageOption;
              break;
          }
          if (msg) {
            this.notify(msg, 'danger');
            break;
          }

          saveHouseBaseInfo(this.applicationDetail).then((response) => {
            this.complete(pass, comment);
          }).catch(resp => {
            this.notify(msg, 'danger');
            this.notify("保存失败!", 'danger');
          });
        }
          break;
        case PROPOSER_STAGE_START_ACTIVITY:
          this.complete(pass);
          break;
        case PROPOSER_STAGE_END_ACTIVITY : {
          let comment;
          let msg = "";
          const role = this.$store.getters.roles[0];
          switch (role) {
            case "town_leader":
              msg = this.validateAcceptingFormTown();
              comment = this.applicationDetail.tHouseApplyEnd.zhenOption;
              break;
            default:
              comment = '同意';
              break;
          }
          if (msg) {
            this.notify(msg, 'danger');
            break;
          }

          if (this.$refs.pictureUploadAccepting && this.$refs.pictureUploadAccepting.isValid()) {
            this.submitHouseApplyEndLocationplanOptions(pass);
            return;
          }

          updateEnd(this.applicationDetail.tHouseApplyEnd).then((response) => {
            this.complete(pass, comment);
          }).catch(err => {
            this.notify('保存失败', 'danger');
          });
        }
          break;
        default:
          break;
      }
    },
    // 带平面图附件上传的镇级申请审批
    submitHouseApproveLocationplanOptions(pass, commentText) {
      this.$refs.pictureUploadApplying.updatePlanFiles().then((x) => {
          let list = [];
          x.data.forEach((f) => {
            let item = {
              id: f.id,
              fileName: f.fileName,
              fileUrl: f.fileUrl,
              fileType: f.fileType,
              tableId: f.tableId,
              tableName: f.tableName,
            };
            list.push(item);
          });
          this.applicationDetail.tHouseApproveLocationplanOptions.locationPlan = JSON.stringify(list);
          saveHouseBaseInfo(this.applicationDetail).then((response) => {
            this.complete(pass, commentText);
          }).catch(resp => {
            this.notify("保存失败!", 'danger');
          });
        }).catch((x) => {
        this.notify("上传宅基地坐落平面位置图失败!", 'danger');
      });
    },
    // 带平面图附件上传的镇级验收审批
    submitHouseApplyEndLocationplanOptions(pass, commentText) {
      this.$refs.pictureUploadAccepting.updatePlanFiles()
        .then((x) => {
          let list = [];
          x.data.forEach((f) => {
            let item = {
              id: f.id,
              fileName: f.fileName,
              fileUrl: f.fileUrl,
              fileType: f.fileType,
              tableId: f.tableId,
              tableName: f.tableName,
            };
            list.push(item);
          });

          this.applicationDetail.tHouseApplyEnd.locationPlan = JSON.stringify(list);

          updateEnd(this.applicationDetail.tHouseApplyEnd).then((response) => {
            this.complete(pass, commentText);
          }).catch(err => {
            this.notify("保存失败!", 'danger');
          });
        }).catch((x) => {
        this.notify("上传宅基地坐落平面位置图失败!", 'danger');
      });
    },
    // 审批工具函数(同意/驳回, 意见)
    complete(pass, comment) {
      if(!this.taskId || !this.instanceId)
      {
        console.error(this.taskId, this.instanceId);
        return false;
      }
      let data = {
        taskId: this.taskId,
        instanceId: this.instanceId,
        variables: JSON.stringify({
          pass: pass ? "true" : "false",
          comment: comment ? comment : (pass ? '同意' : '驳回'),
        }),
      };
      request({
        url: "/activiti/process/complete",
        method: "post",
        params: data,
      }).then((response) => {
        this.notify("操作成功", 'success');
        this.$router.back(-1);
      }).catch(e => {
        this.notify("操作失败!", 'danger');
      });
      return true;
    },
    // 请求结果提示工具函数
    notify(message, type) {
      Notify.clear();
      Notify({ type: type || 'primary', message: message });
    },
    // 当自然资源部门地图绘制被重置时
    onNatureMapDrawReseted() {
      this.drawInsert = null;
      if(this.applicationDetail.tHouseApproveNatureOptions.theGeom)
      {
        let lastData = JSON.parse(this.applicationDetail.tHouseApproveNatureOptions.theGeom);
        if(lastData.hasOwnProperty('coordinates')) // 从后台获取的
          this.drawInsert = lastData.coordinates;
      }
    },
    // 当验收地图绘制被重置时
    onAcceptanceMapDrawReseted() {
      this.drawInsert = null;
      if(this.applicationDetail.tHouseApplyEnd.theGeom)
      {
        let lastData = JSON.parse(this.applicationDetail.tHouseApplyEnd.theGeom);
        if(lastData.hasOwnProperty('coordinates')) // 从后台获取的
          this.drawInsert = lastData.coordinates;
      }
    },
    // 打开附件树
    openAttachment() {
      this.attachmentVisible = true;
      if(this.attachmentActive == this.active)
        this.$nextTick(() => {
          this.$refs.attachmentDialog.scrollTo(this.active);
        });
    },
    // 选择步骤页面
    selectTab(index) {
      if(index <= this.active)
      {
        this.selectedTabName = index;
      }
      //console.log(index, this.active,this.selectedTabName);
    },
    // 保存开工(是否提交)
    startProposerApply(submit) {
      let msg = this.validateStartFormBase();
      if (msg) {
        this.notify(msg, 'danger');
        return;
      }
      updateStart({
        id: this.applicationDetail.tHouseApplyStart.id,
        startDate: this.applicationDetail.tHouseApplyStart.startDate,
        endDate: this.applicationDetail.tHouseApplyStart.endDate,
      }).then(resp => {
        if(submit)
        {
          submitStartWLHT(this.applicationDetail.tHouseApplyStart.id).then(resp => {
            this.notify("操作成功", 'success');
            this.$router.back(-1);
          }).catch((e) => {
            this.notify("操作失败!", 'danger');
          });
        }
        else
        {
          this.notify("保存成功", 'success');
          this.$router.back(-1);
        }
      }).catch((e) => {
        this.notify('保存失败', 'danger');
      });
    },
    // 保存验收(是否提交)
    endProposerApply(submit) {
      let msg = this.validateAcceptingFormBase();
      if (msg) {
        this.notify(msg, 'danger');
        return;
      }
      if (this.drawInsert != null) {
        this.applicationDetail.tHouseApplyEnd.theGeom = JSON.stringify(this.drawInsert);
      }
      else {
        if(this.applicationDetail.tHouseApplyEnd.theGeom == null){
          this.applicationDetail.tHouseApplyEnd.theGeom = this.convertGeom(this.applicationDetail.tHouseApproveNatureOptions.theGeom);
        }
      }
      updateEnd(this.applicationDetail.tHouseApplyEnd).then(resp => {
        if(submit)
        {
          submitEndWLHT(this.applicationDetail.tHouseApplyEnd.id).then(resp => {
            this.notify("操作成功", 'success');
            this.$router.back(-1);
          }).catch(err => {
            this.notify("操作失败!", 'danger');
          });
        }
        else
        {
          this.notify("保存成功", 'success');
          this.$router.back(-1);
        }
      }).catch(err => {
        this.notify('保存失败', 'danger');
      });
    },
    // 获取登录人位置坐标
    getLandCoord(func) {
      if (func
        && this.tGeoOrganizationLng !== null && this.tGeoOrganizationLng !== ''
        && this.tGeoOrganizationLat !== null && this.tGeoOrganizationLat !== '') {
        this.$nextTick(() => {
          func(this.tGeoOrganizationLng, this.tGeoOrganizationLat);
        })
      }
      else {
        let deptName = this.$store.state.user.deptName + "";
        getQueryLand(deptName).then((response) => {
          if (response.code == 200) {
            let InsertCode = response.data;
            this.form.orgCode = InsertCode.orgCode;
            this.tGeoOrganizationLat = InsertCode.lat;
            this.tGeoOrganizationLng = InsertCode.lng;
            if(func)
            {
              func(this.tGeoOrganizationLng, this.tGeoOrganizationLat);
            }
          }
        });
      }
    },
    validateBaseApplyFormBase() {
      if(!this.applicationDetail.tHouseApplyProposer) return '请填写申请数据';
      if (this.checkString(this.applicationDetail.tHouseApplyProposer.memberName)) {
        return "申请户主姓名不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyProposer.sex)) {
        return "户主性别不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyProposer.age)) {
        return "户主年龄不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyProposer.phone)) {
        return "联系电话不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyProposer.idcard)) {
        return "身份证号不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyProposer.householdRegister)) {
        return "户口所在地不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyProposer.familyAddress)) {
        return "家庭住址不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyProposer.members)) {
        return "家庭人口数不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyProposer.existHomestead)) {
        return "是否已有宅基地不能为空";
      }

      for(let i in this.applicationDetail.tHouseApplyFamilyMembers)
      {
        let v = this.applicationDetail.tHouseApplyFamilyMembers[i];
        if (this.checkString(v.memberName)) {
          return "成员姓名不能为空";
        }
        if (this.checkString(v.age)) {
          return "年龄不能为空";
        }
        if (this.checkString(v.familyStatusName)) {
          return "与户主关系不能为空";
        }
        if (this.checkString(v.idcard)) {
          return "家庭成员身份证不能为空";
        }
        if (this.checkString(v.householdRegister)) {
          return "户口所在地不能为空";
        }
      }

      if(this.applicationDetail.tHouseApplyProposer.existHomestead === 'Y')
      {
        if (this.checkString(this.applicationDetail.tHouseApplyCurrentSituation.landArea)) {
          return "宅基地面积不能为空";
        }
        if (this.checkString(this.applicationDetail.tHouseApplyCurrentSituation.landPerArea)) {
          return "人均宅基地面积不能为空";
        }
        if (this.checkString(this.applicationDetail.tHouseApplyCurrentSituation.buildingArea)) {
          return "建筑面积不能为空";
        }
        if (this.checkString(this.applicationDetail.tHouseApplyCurrentSituation.buildingPerArea)) {
          return "人均建筑面积不能为空";
        }
        if (this.checkString(this.applicationDetail.tHouseApplyCurrentSituation.landCertificateNo)) {
          return "不动产单元号不能为空";
        }
        if (this.checkString(this.applicationDetail.tHouseApplyCurrentSituation.landIsposal)) {
          return "处置情况不能为空";
        }
        if(this.applicationDetail.tHouseApplyCurrentSituation.landIsposal == '1')
        {
          if (this.checkString(this.applicationDetail.tHouseApplyCurrentSituation.reservedArea)) {
            return "保留面积不能为空";
          }
        }
        else if(this.applicationDetail.tHouseApplyCurrentSituation.landIsposal == '3')
        {
          if (this.checkString(this.applicationDetail.tHouseApplyCurrentSituation.otherRemark)) {
            return "处置情况不能为空";
          }
        }
        if (this.checkString(this.applicationDetail.tHouseApplyCurrentSituation.houseCertificateNo)) {
          return "宅基地证书号不能为空";
        }
      }

      if (this.checkString(this.applicationDetail.tHouseApplyProposedSituation.location)) {
        return "拟建位置不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyProposedSituation.landArea)) {
        return "拟建宅基地面积不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyProposedSituation.east)) {
        return "东至不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyProposedSituation.west)) {
        return "西至不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyProposedSituation.south)) {
        return "南至不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyProposedSituation.north)) {
        return "北至不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyProposedSituation.buildingArea)) {
        return "住房建筑面积不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyProposedSituation.buildingLandArea)) {
        return "房基占地面积不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyProposedSituation.buildingFloors)) {
        return "建筑层数不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyProposedSituation.buildingHight)) {
        return "建筑高度不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyProposedSituation.isAdvice)) {
        return "征求相邻权利人意见不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyProposedSituation.housingStructure)) {
        return "房屋构造不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyProposedSituation.buildingType)) {
        return "建房类型不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyProposedSituation.geographicType)) {
        return "土地类型不能为空";
      }
      if(this.applicationDetail.tHouseApplyProposedSituation.geographicType == '10')
      {
        if (this.checkString(this.applicationDetail.tHouseApplyProposedSituation.constructionLandArea)) {
          return "建设用地面积不能为空";
        }
      }
      else if(this.applicationDetail.tHouseApplyProposedSituation.geographicType == '20')
      {
        if (this.checkString(this.applicationDetail.tHouseApplyProposedSituation.unusedLandArea)) {
          return "未利用地不能为空";
        }
      }
      else
      {
        if (this.checkString(this.applicationDetail.tHouseApplyProposedSituation.agriculturalLandArea)) {
          return "农用地不能为空";
        }
      }
      if (this.checkString(this.applicationDetail.tHouseApplyProposedSituation.designPaper)) {
        return "设计图纸不能为空";
      }
      if(this.applicationDetail.tHouseApplyProposedSituation.designPaper == '2')
      {
        if (this.checkString(this.applicationDetail.tHouseApplyProposedSituation.houseTypeId)) {
          return "房屋户型不能为空";
        }
      }
      if (this.checkString(this.applicationDetail.tHouseApplyProposer.applyReasion)) {
        return "申请理由不能为空";
      }

      return false;
    },
    validateNatureForm() {
      if (this.checkString(this.applicationDetail.tHouseApproveNatureOptions.landArea)) {
        return "用地面积不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApproveNatureOptions.rightsType)) {
        return "土地权属不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApproveNatureOptions.east)) {
        return "北至不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApproveNatureOptions.west)) {
        return "西至不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApproveNatureOptions.south)) {
        return "南至不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApproveNatureOptions.north)) {
        return "北至不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApproveNatureOptions.approveOption)) {
        return "说明不能为空";
      }
      return false;
    },
    validateAgricultureForm(pass) {
      if (this.checkString(this.applicationDetail.tHouseApproveAgricultureOptions.isMembership)) {
        return "成员资格审查不能为空";
      }

      if (this.checkString(this.applicationDetail.tHouseApproveAgricultureOptions.isOnehouse)) {
        return "一户一宅情况不能为空";
      }

      if (this.checkString(this.applicationDetail.tHouseApproveAgricultureOptions.isReviewmaterials)) {
        return "村委会审查材料不能为空";
      }

      if (this.checkString(this.applicationDetail.tHouseApproveAgricultureOptions.approveOption)) {
        return "说明不能为空";
      }
      // 通过时检查打勾, 农业部门
      if(pass)
      {
        if(this.applicationDetail.tHouseApproveAgricultureOptions.isMembership != '1')
        {
          return "同意申请时需通过成员资格审查";
        }
        if(this.applicationDetail.tHouseApproveAgricultureOptions.isOnehouse != '1')
        {
          return "同意申请时需符合一户一宅情况";
        }
        if(this.applicationDetail.tHouseApproveAgricultureOptions.isReviewmaterials != '1')
        {
          return "同意申请时需齐全村委会审查材料";
        }
      }
      return false;
    },
    validateBuildingForm() {
      if (this.checkString(this.applicationDetail.tHouseApproveOtherOptions.buildingType)) {
        return "建筑类型不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApproveOtherOptions.buildingArea)) {
        return "建筑面积不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApproveOtherOptions.buildingFloors)) {
        return "建筑层数不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApproveOtherOptions.buildingHight)) {
        return "建筑高度不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApproveOtherOptions.buildingLandArea)) {
        return "建筑占地面积不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApproveOtherOptions)) {
        return "图纸类型不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApproveOtherOptions.east)) {
        return "东至不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApproveOtherOptions.west)) {
        return "西至不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApproveOtherOptions.south)) {
        return "南至不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApproveOtherOptions.north)) {
        return "北至不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApproveOtherOptions.approveOption)) {
        return "说明不能为空";
      }
      return false;
    },
    validateTownForm() {
      if (this.checkString(this.applicationDetail.tHouseApproveTownOptions.approveOption)) {
        return "镇政府审批意见不能为空";
      }
      return false;
    },
    validateAcceptingFormBase() {
      if(!this.applicationDetail.tHouseApplyEnd) return '请填写验收数据';
      if (this.checkString(this.applicationDetail.tHouseApplyEnd.location)) {
        return "用地建房位置不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyEnd.startDate)) {
        return "开工日期不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyEnd.endDate)) {
        return "竣工日期不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyEnd.actualBuildingHight)) {
        return "竣工高度不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyEnd.actualBuildingFloors)) {
        return "竣工层数不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyEnd.buildingArea)) {
        return "建筑面积不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyEnd.designPaper)) {
        return "建筑风貌不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyEnd.oldHouseStatus)) {
        return "旧宅基地退还情况不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyEnd.buildingArea)) {
        return "建筑面积不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyEnd.houseCertificateNo)) {
        return "权属证书号（不动产）不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyEnd.landCertificateNo)) {
        return "权属证书号（宅基地）不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyEnd.isEnjoySubsidy)) {
        return "是否享受住房建设补助政策不能为空";
      }
      if (this.applicationDetail.tHouseApplyEnd.isEnjoySubsidy === 'Y' && this.checkString(this.applicationDetail.tHouseApplyEnd.enjoySubsidyContent)) {
        return "享受住房建设补助政策不能为空";
      }

      if (this.checkString(this.applicationDetail.tHouseApplyEnd.houseCost)) {
        return "住房造价不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyEnd.buildingHouseArea)) {
        return "房屋建筑面积不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyEnd.buildingOtherArea)) {
        return "配套附属设施建筑面积不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyEnd.facadeColor)) {
        return "外立面颜色不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyEnd.fangjiArea)) {
        return "批准房基占地面积不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyEnd.actualFangjiArea)) {
        return "实际房基占地面积不能为空";
      }
      return false;
    },
    validateAcceptingFormTown(pass) {
      if(!this.applicationDetail.tHouseApplyEnd) return '请填写验收数据';
      if (this.checkString(this.applicationDetail.tHouseApplyEnd.cartographer)) {
        return "竣工平面简图经办人不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyEnd.nongyeOption)) {
        return "乡镇农业农村部门意见不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyEnd.nongyeName)) {
        return "乡镇农业农村部门经办人不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyEnd.nongyeTime)) {
        return "乡镇农业农村部门经办时间不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyEnd.natureOption)) {
        return "乡镇自然资源部门意见不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyEnd.natureName)) {
        return "乡镇自然资源部门经办人不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyEnd.natureTime)) {
        return "乡镇自然资源部门经办时间不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyEnd.buildingOption)) {
        return "乡镇住建部门意见不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyEnd.buildingName)) {
        return "乡镇住建部门验收负责人不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyEnd.buildingTime)) {
        return "乡镇住建部门验收时间不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyEnd.zhenOption)) {
        return "乡镇政府验收意见不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyEnd.zhenName)) {
        return "乡镇政府验收负责人不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyEnd.zhenTime)) {
        return "乡镇政府验收时间不能为空";
      }

      if (this.checkString(this.applicationDetail.tHouseApplyEnd.isProjectFinished)) {
        return "是否已完成工程设计和合同约定的各项内容不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyEnd.isQualifiedQuality)) {
        return "承揽人对完工住房质量自查是否合格不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyEnd.hasBuildingRecord)) {
        return "是否有施工记录资料不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyEnd.isSignWarranty)) {
        return "建房村民和承揽人是否已经共同签署农村住房质量保修书不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyEnd.isHandleProblem)) {
        return "住房城乡建设行政主管部门或乡（镇）人民政府责令整改的问题是否全部整改完毕不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyEnd.isDesignPaperSame)) {
        return "建筑风貌是否与设计图基本一致不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyEnd.isOtherAcceptanceFinished)) {
        return "法律、法规规定的其他验收条件完成情况不能为空";
      }

      // 通过时检查打勾, 农业部门
      if(pass)
      {
        if(this.applicationDetail.tHouseApplyEnd.isProjectFinished != 'Y')
        {
          return "同意验收时需已完成工程设计和合同约定的各项内容";
        }
        if(this.applicationDetail.tHouseApplyEnd.isQualifiedQuality != 'Y')
        {
          return "同意验收时需承揽人对完工住房质量自查合格";
        }
        if(this.applicationDetail.tHouseApplyEnd.hasBuildingRecord != 'Y')
        {
          return "同意验收时需有施工记录资料";
        }
        if(this.applicationDetail.tHouseApplyEnd.isSignWarranty != 'Y')
        {
          return "同意验收时需建房村民和承揽人已经共同签署农村住房质量保修书";
        }
        if(this.applicationDetail.tHouseApplyEnd.isHandleProblem != 'Y')
        {
          return "同意验收时需住房城乡建设行政主管部门或乡（镇）人民政府责令整改的问题全部整改完毕";
        }
        if(this.applicationDetail.tHouseApplyEnd.isDesignPaperSame != 'Y')
        {
          return "同意验收时需建筑风貌是否与设计图基本一致";
        }
        if(this.applicationDetail.tHouseApplyEnd.isOtherAcceptanceFinished != 'Y')
        {
          return "同意验收时需法律、法规规定的其他验收条件完成情况";
        }
      }

      return false;
    },
    validateStartFormBase() {
      if (!this.applicationDetail.tHouseApplyStart) return '请填写开工数据';
      if (this.checkString(this.applicationDetail.tHouseApplyStart.startDate)) {
        return "计划开工时间不能为空";
      }
      if (this.checkString(this.applicationDetail.tHouseApplyStart.endDate)) {
        return "计划竣工时间不能为空";
      }
      return false;
    },
  },
  watch: {
    selectedTabName: function (newVal, oldVal) {
      this.$nextTick(() => {
        if(newVal == PROPOSER_STAGE_BASE_APPLY)
        {
          this.pointDarw(null);
          this.pointDarwNature(null);
          this.$refs.pointDarwMap && this.$refs.pointDarwMap.update();
          this.$refs.pointDarwNatureMap && this.$refs.pointDarwNatureMap.update();
        }
        else if(newVal == PROPOSER_STAGE_START) {
          this.paintStartNatureMap(null);
          this.$refs.startNatureMap && this.$refs.startNatureMap.update();
        }
        else if(newVal == PROPOSER_STAGE_END) {
          this.pointWrapAcceptance(null);
          this.$refs.pointDarwAcceptanceMap && this.$refs.pointDarwAcceptanceMap.update();
        }
      })
    },
  }
}
</script>

<style scoped lang="scss">
  .app-container {
    padding-bottom: 5%;
  }
  .examine_box{
    background-color: #1D6FE9!important;
    padding: 0.18rem!important;
    padding-left: 0!important;
    border-radius: 0.15rem!important;
    margin-top: 0.3rem!important;
  }
  .examine_box .van-col:first-child{
    color: #FFF!important;
    font-size: 0.45rem!important;
    text-align: center!important;
  }
  .examine_box .van-col:last-child{
    background-color: #FFF!important;
    border-radius: 0.15rem!important;
    overflow: hidden!important;
    .van-radio-group--horizontal{
      padding: 0.2rem 0;
      border-bottom: 1px solid #eee;
    }
  }
  #mapWrap{
    width: 96%;
    margin: 0 auto;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    overflow: hidden;
  }
  .mapBox{
    position: relative;
    .mapBox_button{
      position: absolute;
      top: 0.2rem;
      right: 2%;
    }
  }
  .van-steps{
    padding: 2% 6% 0;
  }
  .topTit{
    margin-top: 0.4rem;
    font-size: 0.45rem;
    background-color: #1D6FE9;
    color: #FFFFFF;
    line-height: 58px;
    text-align: center;
    padding: 15px 0;
    box-shadow: 0px 3px 6px 0px rgba(15,67,145,0.40);
  }
  .main_title{
    font-size: 0.4rem;
    color: #1D6FE9;
    margin: 0.2rem 6%;
    position: relative;
  }
  .main_box{
    width: 96%;
    margin: 0 auto;
    border-radius: 6px;
    box-shadow: 0px 3px 6px 0px rgba(0,0,0,0.16);
    overflow: hidden;
    background-color: #FFF;
  }
  .collapse{
    width: 96%;
    margin: 0 auto;
    border-radius: 6px;
    box-shadow: 0px 3px 6px 0px rgba(0,0,0,0.16);
    overflow: hidden;
    margin-bottom: 15px;
  }
  /deep/.van-radio--horizontal{
    margin-left: 20px;
    margin-right: 0;
  }
  .file-box{
    padding: 2% 5% 0;
  }
  .submitButton{
    width: 80%;
    margin: 0 auto;
    border-radius: 14px;
  }
  .timeTit{
    text-align: center;
    font-size: 16px;
    line-height: 27px;
  }
  .action-box{
    padding: 15px 0!important;
    margin-top: 0.4rem;
  }
  .check-box{
    margin-top: 0.4rem;
  }
  .addFamily{
    position: absolute;
    top: -2px;
    right: 0;
    border-radius: 50%;
    display: inline-block;
    width: 0.7rem;
    height: 0.7rem;
  }
  .deleteFamily{
    position: absolute;
    top: -0.35rem;
    right: 6%;
    z-index: 9;
    border-radius: 50%;
    display: inline-block;
    width: 0.7rem;
    height: 0.7rem;
  }
  .familyList{
    margin-top: 0.4rem;
    position: relative;
  }
  .noModify{
    .topTit{
      background-color:#ABABAB ;
      box-shadow: 0px 3px 6px 0px rgba(171,171,171,0.40);
    }
    .van-cell__title{
      color: #B4B0B0;
    }
  }
  .flow_main_box{
    width: 96%;
    margin: 0 auto;
    border-radius: 6px;
    box-shadow: 0px 3px 6px 0px rgba(0,0,0,0.16);
    overflow: hidden;
    background-color: #FFF;
    margin-top: 2%;
    padding: 5% 1%;
    .van-col{
      text-align: center;
    }
    .tit{
      background: #1d6fe9;
      border-radius: 12px;
      font-size: 0.4rem;
      font-family: Source Han Sans CN, Source Han Sans CN-Regular;
      font-weight: 400;
      color: #ffffff;
      line-height: 0.65rem;
      letter-spacing: 0px;
      width: 70%;
      margin: 0 auto;
    }
    .van-step--vertical{
      padding-right: 0;
      text-align: left;
    }
    .van-step--vertical:not(:last-child)::after{
      border: none;
    }
    .van-step--finish{
      color: #1d6fe9;
    }
  }
  .van-goods-action {
    justify-content: center;
  }
</style>
