<template>
  <view>
    <!--		<cu-custom bgColor="bg-gradual-blueness" :isBack="true">
          <block slot="backText">返回</block>
          <block slot="content">从业人员注册-基础信息</block>
        </cu-custom>-->
    <scroll-view scroll-y="false" >
      <view class="text-align" v-if="this.titleFlag">
        <view class="text-align" style="color: red;text-align: center">人员审核确认中，不可编辑</view>
      </view>
      <view class="form">
        <view class="cu-form-group">
          <view class="title is-required">姓名</view>
          <input v-model="formData.NAME" disabled placeholder="请输入姓名" maxlength="50" name="input" style="color: #cccccc" />
        </view>
        <view class="cu-form-group margin-top-xs">
          <view class="title is-required">身份证号</view>
          <input v-model="formData.USER_ID_CARD" disabled placeholder="请输入身份证号" maxlength="18" name="input" style="color: #cccccc" />
        </view>
        <view class="cu-form-group margin-top-xs">
          <view class="title is-required">手机</view>
          <input v-model="formData.PHONE" disabled placeholder="请输入手机证号" maxlength="11" name="input" style="color: #cccccc" />
        </view>
        <view class="cu-form-group margin-top-xs">
          <view class="title is-required">人员类型</view>
          <zqs-select
              :multiple="true"
              :list="dictData.PERSONNEL_TYPE.list"
              :show-search="false"
              v-model="formData.PERSONNEL_TYPE"
              disabled
              label-key="NAME"
              value-key="DICTIONARIES_ID"
              placeholder="请选择人员类型"
              title="选择人员类型"
              clearable
              @change="changeSelect($event, 'PERSONNEL_TYPE')"
          ></zqs-select>
        </view>

        <!-- 身份证 -->
        <uni-section title="身份证" type="line" class="margin-top" padding>
          <view v-if="forbidEdit" class="cu-form-textarea">
            <view class="title is-required-pic">
              <text>身份证（正面）</text>
            </view>
            <view class="cu-form-p">
              <scroll-view scroll-x class="bg-white nav" scroll-with-animation>
                <view class="imgs">
                  <image :src="baseImgPath+formData.ID_CARD_FRONT" @click="ViewShowImage(event, formData.ID_CARD_FRONT)"
                         mode=""></image>
                </view>
              </scroll-view>
            </view>
          </view>
          <view v-if="!forbidEdit" class="cu-bar bg-white margin-top">
            <view class="action is-required" style="font-size: 28upx; font-weight: bold; color: #000;">
              身份证（正面）
            </view>
            <view class="action">
              {{fileData.idCardFront.length}}/1
            </view>
          </view>
          <view v-if="!forbidEdit" class="cu-form-group">
            <view class="grid col-4 grid-square flex-sub">
              <view class="bg-img" v-for="(item,index) in fileData.idCardFront" :key="index" @tap="ViewImage($event,'idCardFront')"  data-type="0" :data-url="fileData.idCardFront[index].filePath">
                <image :src="fileData.idCardFront[index].filePath" mode="aspectFill"></image>
                <view class="cu-tag bg-red" @tap.stop="DelImg($event,'idCardFront')"  data-type="0" :data-index="index">
                  <text class='cuIcon-close'></text>
                </view>
              </view>
              <view class="solids" @tap.stop="openAuth('CAMERA','idCardFront')" v-if="fileData.idCardFront.length<1">
                <text class='cuIcon-cameraadd'></text>
              </view>
            </view>
          </view>
          <view v-if="forbidEdit" class="cu-form-textarea">
            <view class="title is-required-pic">
              <text>身份证（背面）</text>
            </view>
            <view class="cu-form-p">
              <scroll-view scroll-x class="bg-white nav" scroll-with-animation>
                <view class="imgs">
                  <image :src="baseImgPath+formData.ID_CARD_BACK" @click="ViewShowImage(event, formData.ID_CARD_BACK)"
                         mode=""></image>
                </view>
              </scroll-view>
            </view>
          </view>
          <view v-if="!forbidEdit" class="cu-bar bg-white margin-top-xs">
            <view class="action is-required" style="font-size: 28upx; font-weight: bold; color: #000;">
              身份证（背面）
            </view>
            <view class="action">
              {{fileData.idCardBack.length}}/1
            </view>
          </view>
          <view v-if="!forbidEdit" class="cu-form-group">
            <view class="grid col-4 grid-square flex-sub">
              <view class="bg-img" v-for="(item,index) in fileData.idCardBack" :key="index" @tap="ViewImage($event,'idCardBack')"  data-type="0" :data-url="fileData.idCardBack[index].filePath">
                <image :src="fileData.idCardBack[index].filePath" mode="aspectFill"></image>
                <view class="cu-tag bg-red" @tap.stop="DelImg($event,'idCardBack')"  data-type="0" :data-index="index">
                  <text class='cuIcon-close'></text>
                </view>
              </view>
              <view class="solids" @tap.stop="openAuth('CAMERA','idCardBack')" v-if="fileData.idCardBack.length<1">
                <text class='cuIcon-cameraadd'></text>
              </view>
            </view>
          </view>
          <view class="cu-form-group margin-top-xs">
            <view class="title is-required">生日</view>
            <view v-if="forbidEdit" style="color: #cccccc">{{formData.DATE_OF_BIRTH}}</view>
            <picker v-else mode="date" @change="changeDate($event,'DATE_OF_BIRTH')" :value="formData.DATE_OF_BIRTH" :end="limitData.DATE_OF_BIRTH.end">
              <view class="picker">
                {{formData.DATE_OF_BIRTH?formData.DATE_OF_BIRTH:'请选择'}}
              </view>
            </picker>
          </view>
          <view class="cu-form-group margin-top-xs">
            <view class="title is-required">民族</view>
            <view v-if="forbidEdit" style="color: #cccccc">{{formData.NATION_NAME}}</view>
            <picker v-else @change="pickerChangeData($event,'NATION')" :value="dictData.NATION.index" :range="dictData.NATION.list" range-key="NAME">
              <view class="picker">
                {{formData.NATION_NAME?formData.NATION_NAME:'请选择'}}
              </view>
            </picker>
          </view>
          <view class="cu-form-group margin-top-xs">
            <view class="title is-required">性别</view>
            <view v-if="forbidEdit" style="color: #cccccc">{{formData.SEX_NAME}}</view>
            <picker v-else @change="pickerChangeData($event,'SEX')" :value="dictData.SEX.index" :range="dictData.SEX.list" range-key="NAME">
              <view class="picker">
                {{formData.SEX_NAME?formData.SEX_NAME:'请选择'}}
              </view>
            </picker>
          </view>
          <view class="cu-form-group margin-top-xs">
            <view class="title is-required">有效期（起始）</view>
            <view v-if="forbidEdit" style="color: #cccccc">{{formData.ID_CARD_VALIDITY_START}}</view>
            <picker v-else mode="date" @change="changeDate($event,'ID_CARD_VALIDITY_START')" :value="formData.ID_CARD_VALIDITY_START" >
              <view class="picker">
                {{formData.ID_CARD_VALIDITY_START?formData.ID_CARD_VALIDITY_START:'请选择'}}
              </view>
            </picker>
          </view>
          <view class="cu-form-group margin-top-xs">
            <view class="title is-required">有效期（截止）</view>
            <view v-if="forbidEdit" style="color: #cccccc">{{formData.ID_CARD_VALIDITY_END}}</view>
            <picker v-else mode="date" @change="changeDate($event,'ID_CARD_VALIDITY_END')" :value="formData.ID_CARD_VALIDITY_END" >
              <view class="picker">
                {{formData.ID_CARD_VALIDITY_END?formData.ID_CARD_VALIDITY_END:'请选择'}}
              </view>
            </picker>
          </view>
          <view class="cu-form-textarea margin-top-xs">
            <view class="cu-form-title is-required-cu">住址</view>
            <textarea v-model="formData.ID_CARD_ADDRESS" :disabled="forbidEdit" maxlength="150" placeholder="请输入身份证住址" :style="'color:' + colorValue + ';'"></textarea>
          </view>
          <view class="cu-form-textarea margin-top-xs">
            <view class="cu-form-title is-required-cu">签发机关</view>
            <textarea v-model="formData.ID_CARD_ORGAN" :disabled="forbidEdit" maxlength="150" placeholder="请输入身份证签发机关" :style="'color:' + colorValue + ';'"></textarea>
          </view>
        </uni-section>

        <!-- 驾驶证 -->
        <uni-section title="驾驶证" type="line" class="margin-top" padding>
          <view v-if="forbidEdit" class="cu-form-textarea">
            <view class="title is-required-pic">
              <text>驾驶证</text>
            </view>
            <view class="cu-form-p">
              <scroll-view scroll-x class="bg-white nav" scroll-with-animation>
                <view class="imgs">
                  <image :src="baseImgPath+formData.DRIVER_LICENSE" @click="ViewShowImage(event, formData.DRIVER_LICENSE)"
                         mode=""></image>
                </view>
              </scroll-view>
            </view>
          </view>
          <view v-if="!forbidEdit" class="cu-bar bg-white margin-top">
            <view class="action is-required" style="font-size: 28upx; font-weight: bold; color: #000;">
              驾驶证
            </view>
            <view class="action">
              {{fileData.driverLicense.length}}/1
            </view>
          </view>
          <view v-if="!forbidEdit" class="cu-form-group">
            <view class="grid col-4 grid-square flex-sub">
              <view class="bg-img" v-for="(item,index) in fileData.driverLicense" :key="index" @tap="ViewImage($event,'driverLicense')"  data-type="0" :data-url="fileData.driverLicense[index].filePath">
                <image :src="fileData.driverLicense[index].filePath" mode="aspectFill"></image>
                <view class="cu-tag bg-red" @tap.stop="DelImg($event,'driverLicense')"  data-type="0" :data-index="index">
                  <text class='cuIcon-close'></text>
                </view>
              </view>
              <view class="solids" @tap.stop="openAuth('CAMERA','driverLicense')" v-if="fileData.driverLicense.length<1">
                <text class='cuIcon-cameraadd'></text>
              </view>
            </view>
          </view>
          <view class="cu-form-group margin-top-xs">
            <view class="title is-required">驾驶证号</view>
            <input v-model="formData.DRIVER_LICENSE_NO" :disabled="forbidEdit" placeholder="请输入驾驶证号" maxlength="18" name="input" :style="'color:' + colorValue + ';'" />
          </view>
          <view class="cu-form-group margin-top-xs">
            <view class="title is-required">准驾车型</view>
            <zqs-select
                :multiple="true"
                :list="dictData.DRIVING_MODEL.list"
                :show-search="false"
                :disabled="forbidEdit"
                v-model="formData.DRIVING_MODEL"
                label-key="NAME"
                value-key="DICTIONARIES_ID"
                placeholder="请选择准驾车型"
                title="选择准驾车型"
                clearable
                @change="changeSelect($event, 'DRIVING_MODEL')"
            ></zqs-select>
          </view>
          <view class="cu-form-group margin-top-xs">
            <view class="title is-required">国籍</view>
            <zqs-select
                :multiple="false"
                :list="dictData.NATIONALITY.list"
                :show-search="true"
                :disabled="forbidEdit"
                v-model="formData.DRIVING_NATIONALITY"
                label-key="NAME"
                value-key="NAME"
                placeholder="请选择国籍"
                title="选择国籍"
                clearable
                @change="changeSelect($event, 'DRIVING_NATIONALITY')"
            ></zqs-select>
          </view>
          <view class="cu-form-group margin-top-xs">
            <view class="title is-required">初次领证日期</view>
            <view v-if="forbidEdit" style="color: #cccccc">{{formData.DRIVER_LICENSE_ISSUE_DATE}}</view>
            <picker v-else mode="date" @change="changeDate($event,'DRIVER_LICENSE_ISSUE_DATE')" :value="formData.DRIVER_LICENSE_ISSUE_DATE" >
              <view class="picker">
                {{formData.DRIVER_LICENSE_ISSUE_DATE?formData.DRIVER_LICENSE_ISSUE_DATE:'请选择'}}
              </view>
            </picker>
          </view>
          <view class="cu-form-group margin-top-xs">
            <view class="title is-required">有效期（起始）</view>
            <view v-if="forbidEdit" style="color: #cccccc">{{formData.DRIVER_LICENSE_VALIDITY_START}}</view>
            <picker v-else mode="date" @change="changeDate($event,'DRIVER_LICENSE_VALIDITY_START')" :value="formData.DRIVER_LICENSE_VALIDITY_START" :end="limitData.DRIVER_LICENSE_VALIDITY_START.end">
              <view class="picker">
                {{formData.DRIVER_LICENSE_VALIDITY_START?formData.DRIVER_LICENSE_VALIDITY_START:'请选择'}}
              </view>
            </picker>
          </view>
          <view class="cu-form-group margin-top-xs">
            <view class="title is-required">有效期（截止）</view>
            <view v-if="forbidEdit" style="color: #cccccc">{{formData.DRIVER_LICENSE_VALIDITY_END}}</view>
            <picker v-else mode="date" @change="changeDate($event,'DRIVER_LICENSE_VALIDITY_END')" :value="formData.DRIVER_LICENSE_VALIDITY_END" >
              <view class="picker">
                {{formData.DRIVER_LICENSE_VALIDITY_END?formData.DRIVER_LICENSE_VALIDITY_END:'请选择'}}
              </view>
            </picker>
          </view>
          <view class="cu-form-textarea margin-top-xs">
            <view class="cu-form-title is-required-cu">签发机关</view>
            <textarea v-model="formData.DRIVER_LICENSE_ORGAN" :disabled="forbidEdit" maxlength="150" placeholder="请输入驾驶证签发机关" :style="'color:' + colorValue + ';'"></textarea>
          </view>
        </uni-section>

        <!-- 道路运输从业人员从业资格证 -->
        <uni-section title="道路运输从业人员从业资格证" type="line" class="margin-top" padding>
          <view v-if="forbidEdit" class="cu-form-textarea">
            <view class="title is-required-pic">
              <text>从业资格证</text>
            </view>
            <view class="cu-form-p">
              <scroll-view scroll-x class="bg-white nav" scroll-with-animation>
                <view class="imgs">
                  <image :src="baseImgPath+formData.QUALIFICATION_CERTIFICATE" @click="ViewShowImage(event, formData.QUALIFICATION_CERTIFICATE)"
                         mode=""></image>
                </view>
              </scroll-view>
            </view>
          </view>
          <view v-if="!forbidEdit" class="cu-bar bg-white margin-top">
            <view class="action is-required" style="font-size: 28upx; font-weight: bold; color: #000;">
              从业资格证
            </view>
            <view class="action">
              {{fileData.qualificationCertificate.length}}/1
            </view>
          </view>
          <view v-if="!forbidEdit" class="cu-form-group">
            <view class="grid col-4 grid-square flex-sub">
              <view class="bg-img" v-for="(item,index) in fileData.qualificationCertificate" :key="index" @tap="ViewImage($event,'qualificationCertificate')"  data-type="0" :data-url="fileData.qualificationCertificate[index].filePath">
                <image :src="fileData.qualificationCertificate[index].filePath" mode="aspectFill"></image>
                <view class="cu-tag bg-red" @tap.stop="DelImg($event,'qualificationCertificate')"  data-type="0" :data-index="index">
                  <text class='cuIcon-close'></text>
                </view>
              </view>
              <view class="solids" @tap.stop="openAuth('CAMERA','qualificationCertificate')" v-if="fileData.qualificationCertificate.length<1">
                <text class='cuIcon-cameraadd'></text>
              </view>
            </view>
          </view>
          <view class="cu-form-group margin-top-xs">
            <view class="title is-required">从业资格证号</view>
            <input v-model="formData.QUALIFICATION_CERTIFICATE_NO" :disabled="forbidEdit" placeholder="请输入从业资格证号" maxlength="18" name="input" :style="'color:' + colorValue + ';'" />
          </view>
          <view class="cu-form-group margin-top-xs">
            <view class="title is-required">从业资格类别</view>
            <zqs-select
                :multiple="true"
                :list="dictData.QUALIFICATION_CERTIFICATE_CATEGORY.list"
                :show-search="false"
                :disabled="forbidEdit"
                v-model="formData.QUALIFICATION_CERTIFICATE_CATEGORY"
                label-key="NAME"
                value-key="DICTIONARIES_ID"
                placeholder="请选择从业资格类别"
                title="选择从业资格类别"
                clearable
                @change="changeSelect($event, 'QUALIFICATION_CERTIFICATE_CATEGORY')"
            ></zqs-select>
          </view>
          <view class="cu-form-group margin-top-xs">
            <view class="title is-required">国籍</view>
            <zqs-select
                :multiple="false"
                :list="dictData.QUALIFICATION_CERTIFICATE_NATIONALITY.list"
                :show-search="true"
                :disabled="forbidEdit"
                v-model="formData.QUALIFICATION_CERTIFICATE_NATIONALITY"
                label-key="NAME"
                value-key="NAME"
                placeholder="请选择国籍"
                title="选择国籍"
                clearable
                @change="changeSelect($event, 'QUALIFICATION_CERTIFICATE_NATIONALITY')"
            ></zqs-select>
          </view>
          <view class="cu-form-group margin-top-xs">
            <view class="title is-required">初次领证日期</view>
            <view v-if="forbidEdit" style="color: #cccccc">{{formData.QUALIFICATION_CERTIFICATE_ISSUE_DATE}}</view>
            <picker v-else mode="date" @change="changeDate($event,'QUALIFICATION_CERTIFICATE_ISSUE_DATE')" :value="formData.QUALIFICATION_CERTIFICATE_ISSUE_DATE" :end="limitData.QUALIFICATION_CERTIFICATE_ISSUE_DATE.end">
              <view class="picker">
                {{formData.QUALIFICATION_CERTIFICATE_ISSUE_DATE?formData.QUALIFICATION_CERTIFICATE_ISSUE_DATE:'请选择'}}
              </view>
            </picker>
          </view>
          <view class="cu-form-group margin-top-xs">
            <view class="title is-required">有效期（起始）</view>
            <view v-if="forbidEdit" style="color: #cccccc">{{formData.QUALIFICATION_CERTIFICATE_VALIDITY_START}}</view>
            <picker v-else mode="date" @change="changeDate($event,'QUALIFICATION_CERTIFICATE_VALIDITY_START')" :value="formData.QUALIFICATION_CERTIFICATE_VALIDITY_START" >
              <view class="picker">
                {{formData.QUALIFICATION_CERTIFICATE_VALIDITY_START?formData.QUALIFICATION_CERTIFICATE_VALIDITY_START:'请选择'}}
              </view>
            </picker>
          </view>
          <view class="cu-form-group margin-top-xs">
            <view class="title is-required">有效期（截止）</view>
            <view v-if="forbidEdit" style="color: #cccccc">{{formData.QUALIFICATION_CERTIFICATE_VALIDITY_END}}</view>
            <picker v-else mode="date" @change="changeDate($event,'QUALIFICATION_CERTIFICATE_VALIDITY_END')" :value="formData.QUALIFICATION_CERTIFICATE_VALIDITY_END" >
              <view class="picker">
                {{formData.QUALIFICATION_CERTIFICATE_VALIDITY_END?formData.QUALIFICATION_CERTIFICATE_VALIDITY_END:'请选择'}}
              </view>
            </picker>
          </view>
          <view class="cu-form-textarea margin-top-xs">
            <view class="cu-form-title is-required-cu">签发机关</view>
            <textarea v-model="formData.QUALIFICATION_CERTIFICATE_ORGAN" :disabled="forbidEdit" maxlength="150" placeholder="请输入从业资格证签发机关" :style="'color:' + colorValue + ';'"></textarea>
          </view>
        </uni-section>


      </view>
      <view class="cu-bar btn-group" style="margin-top: 30upx;">
<!--        <button v-if="!forbidEdit" class="cu-btn bg-blue margin-tb-sm lg" @click="$noMultipleClicks(confirmCertificate)">下一步</button>-->
        <button v-if="!forbidEdit" :loading="buttonloading" :disabled="buttonloading" class="cu-btn bg-green margin-tb-sm lg" @click="$noMultipleClicks(confirmCertificate)">提 交</button>
        <button v-if="forbidEdit && applyStatus !== '0'" class="cu-btn bg-blue margin-tb-sm lg" @click="goEdit">编辑</button>
        <!--        <button class="cu-btn bg-green margin-tb-sm lg" @click="$noMultipleClicks(goback)">返回</button>-->
      </view>
    </scroll-view>
    <yk-authpup ref="authpup" type="top" @changeAuth="ChooseImage(0)" :permissionID="permissionID"></yk-authpup>
  </view>
</template>

<script>
import {
  formatDate, baseImgPath, getLevel, getLevelCustom, basePath, loginUser, corpinfoId
} from '../../../../common/tool.js';
import UniSection from "../../../../components/uni-section/components/uni-section/uni-section";
import ZqsSelect from '../../../../components/zqs-select/zqs-select.vue'
export default {
  name: "register_certificate",
  components: {
    UniSection, ZqsSelect
  },
  props: {
    applyStatus: {
      type: String,
      default: ''
    },
    forbidEdit: {
      type: Boolean,
      default: true
    },
    colorValue: {
      type: String,
      default: "#cccccc"
    },
    formData: {
      type: Object,
      default: function() {
        return {}
      }
    },
    fileData: {
      type: Object,
      default: function() {
        return {}
      }
    },
    buttonloading: {
      type: Boolean,
      default: function() {
        return false
      }
    }
  },
  data() {
    return {
      baseImgPath:baseImgPath,
      permissionID:'',
      noClick: true,
      currentFileDataList: '', // 当前是那个附件选择list
      pd: [],
      titleFlag: false,
      // 范围限制
      limitData: {
        // 生日
        DATE_OF_BIRTH:{ start: '', end: '' },
        // 身份证有效期（起始）
        ID_CARD_VALIDITY_START:{ start: '', end: '' },
        // 身份证有效期（截止）
        ID_CARD_VALIDITY_END:{ start: '', end: '' },
        // 驾驶证初次领证日期
        DRIVER_LICENSE_ISSUE_DATE:{ start: '', end: '' },
        // 驾驶证有效期（起始）
        DRIVER_LICENSE_VALIDITY_START:{ start: '', end: '' },
        // 驾驶证有效期（截止）
        DRIVER_LICENSE_VALIDITY_END:{ start: '', end: '' },
        // 从业资格证初次领证日期
        QUALIFICATION_CERTIFICATE_ISSUE_DATE:{ start: '', end: '' },
        // 从业资格证有效期（起始）
        QUALIFICATION_CERTIFICATE_VALIDITY_START:{ start: '', end: '' },
        // 从业资格证有效期（截止）
        QUALIFICATION_CERTIFICATE_VALIDITY_END:{ start: '', end: '' },
      },
      dictData:{
        // 人员类型
        PERSONNEL_TYPE:{
          index: -1,
          list:[],
        },
        // 性别
        SEX:{
          index: -1,
          list:[
            { NAME: '男', DICTIONARIES_ID: '1' },
            { NAME: '女', DICTIONARIES_ID: '0' }
          ],
        },
        // 民族
        NATION:{
          index: -1,
          list:[],
        },
        // 准驾车型
        DRIVING_MODEL: {
          index: -1,
          list:[],
        },
        // 国籍
        NATIONALITY: {
          index: -1,
          list:[],
        },
        // 从业资格类别
        QUALIFICATION_CERTIFICATE_CATEGORY: {
          index: -1,
          list:[],
        },
        // 国籍
        QUALIFICATION_CERTIFICATE_NATIONALITY: {
          index: -1,
          list:[],
        },
      }
    }
  },
  mounted() {
    if(this.applyStatus == '0') this.titleFlag = true;
    this.getData()
    this.getDictList()
    this.getNationality()
    this.getQualificationCertificateNationality()
    var _this = this
    let now = new Date();
    var birthEnd=now.setFullYear(now.getFullYear()-17);
    birthEnd=new Date(birthEnd);
    this.limitData.DATE_OF_BIRTH.end =  formatDate(birthEnd, 'yyyy-MM-dd'); // 生日截止时间
    this.limitData.ID_CARD_VALIDITY_START.end =  formatDate(new Date(), 'yyyy-MM-dd'); // 身份证有效期（起始）
    this.limitData.DRIVER_LICENSE_ISSUE_DATE.end =  formatDate(new Date(), 'yyyy-MM-dd'); // 驾驶证初次领证日期
    this.limitData.DRIVER_LICENSE_VALIDITY_START.end =  formatDate(new Date(), 'yyyy-MM-dd'); // 驾驶证有效期（起始）
    this.limitData.QUALIFICATION_CERTIFICATE_ISSUE_DATE.end =  formatDate(new Date(), 'yyyy-MM-dd'); // 从业资格证初次领证日期
    this.limitData.QUALIFICATION_CERTIFICATE_VALIDITY_START.end =  formatDate(new Date(), 'yyyy-MM-dd'); // 从业资格证有效期（起始）
    this.dictData.SEX.list.forEach((item, index) => {
      if (item.DICTIONARIES_ID === _this.formData.SEX) {
        _this.dictData.SEX.index = index;
        _this.formData.SEX = _this.dictData.SEX.list[_this.dictData.SEX.index].DICTIONARIES_ID
        _this.formData.SEX_NAME = _this.dictData.SEX.list[_this.dictData.SEX.index].NAME
      }
    })
  },
  methods: {
    async getDictList(){
      // 人员类型0
      this.dictData.PERSONNEL_TYPE.list = await getLevel({DICTIONARIES_ID: '0b62f92b0b624aab8e89a77304a64d5e', BIANMA: 'TRAFFIC_EMPLOYMENT_DRIVE'});
      // 民族
      this.dictData.NATION.list = await getLevel({DICTIONARIES_ID: '0a0e406f27f74ee698fe9979d25f62dd'});
      // 准驾车型
      this.dictData.DRIVING_MODEL.list = await getLevel({DICTIONARIES_ID: 'b41e247057334789b60bdf3fe6d8d6ba'});
      // 从业资格类别
      this.dictData.QUALIFICATION_CERTIFICATE_CATEGORY.list = await getLevelCustom({DICTIONARIES_ID: 'ed38fa5f78c64e6d906d2bad0d72bd63', LEVEL: 3});
      this.dictData.QUALIFICATION_CERTIFICATE_CATEGORY.list.forEach((item) => {
        item.NAME = '（'+ item.BIANMA + '） ' + item.NAME
      })

    },
    async getNationality(){
      // 国籍
      this.dictData.NATIONALITY.list = await getLevel({DICTIONARIES_ID: '3b614b43e8814f51a3492f2fdbc9a415'});
      this.dictData.NATIONALITY.tempList = JSON.parse(JSON.stringify(this.dictData.NATIONALITY.list));
    },
    async getQualificationCertificateNationality(){
      this.dictData.QUALIFICATION_CERTIFICATE_NATIONALITY.list = await getLevel({DICTIONARIES_ID: '3b614b43e8814f51a3492f2fdbc9a415'});
      this.dictData.QUALIFICATION_CERTIFICATE_NATIONALITY.tempList = JSON.parse(JSON.stringify(this.dictData.QUALIFICATION_CERTIFICATE_NATIONALITY.list));
    },
    searchSelectNationality(e, name) {
      this.dictData.NATIONALITY.list = JSON.parse(JSON.stringify(this.dictData.NATIONALITY.tempList));
      if (e) {
        this.dictData.NATIONALITY.list = this.dictData[name].list.filter(item => item.NAME.indexOf(e) > -1);
      }
    },
    searchSelectQualificationCertificateNationality(e, name) {
      this.dictData.QUALIFICATION_CERTIFICATE_NATIONALITY.list = JSON.parse(JSON.stringify(this.dictData.QUALIFICATION_CERTIFICATE_NATIONALITY.tempList));
      if (e) {
        this.dictData.QUALIFICATION_CERTIFICATE_NATIONALITY.list = this.dictData[name].list.filter(item => item.NAME.indexOf(e) > -1);
      }
    },
    getData() {
      var _this = this;
      uni.request({
        url: basePath + '/app/user/getUserStatus',
        method: 'POST',
        dataType: 'json',
        header:{
          'Content-type':'application/x-www-form-urlencoded'
        },
        data: {
          USER_ID:loginUser.USER_ID,
          CORPINFO_ID: corpinfoId,
          ISDELETE: '0',
        },
        success: (res) => {
          if(res.data.pd) {
            _this.pd = res.data.pd;
            if(_this.pd.APPLY_TYPE == '3' || _this.pd.APPLY_TYPE == '4') {
              _this.pd.APPLY_TYPE = '3'
            }
          }
        }
      });
    },
    //跳转事件
    confirmCertificate() {
      if (this.validateData()) {
        this.$emit("confirm", '');
      }
    },
    goEdit(){
      this.$emit("goEdit", false);
    },
    changeDate(e,name) {
      this.formData[name] = e.detail.value
      this.$forceUpdate();//强制刷新
    },
    changeSelect(e, name) {
      this.$forceUpdate();//强制刷新
    },
    pickerChangeData(e,name) {
      // 人员类型
      if (name === 'PERSONNEL_TYPE') {
        this.dictData.PERSONNEL_TYPE.index = e.detail.value;
        this.formData.PERSONNEL_TYPE = this.dictData.PERSONNEL_TYPE.list[this.dictData.PERSONNEL_TYPE.index].DICTIONARIES_ID
        this.formData.PERSONNEL_TYPE_NAME = this.dictData.PERSONNEL_TYPE.list[this.dictData.PERSONNEL_TYPE.index].NAME
      }
      // 性别
      if (name === 'SEX') {
        this.dictData.SEX.index = e.detail.value;
        this.formData.SEX = this.dictData.SEX.list[this.dictData.SEX.index].DICTIONARIES_ID
        this.formData.SEX_NAME = this.dictData.SEX.list[this.dictData.SEX.index].NAME
      }
      // 民族
      if (name === 'NATION') {
        this.dictData.NATION.index = e.detail.value;
        this.formData.NATION = this.dictData.NATION.list[this.dictData.NATION.index].DICTIONARIES_ID
        this.formData.NATION_NAME = this.dictData.NATION.list[this.dictData.NATION.index].NAME
      }
      this.$forceUpdate();//强制刷新
    },
    openAuth(permissionID, list){
      this.permissionID = permissionID;
      this.currentFileDataList = list
      setTimeout(()=>{
        this.$refs['authpup'].open();
      },200)
    },

    //图片上传
    ChooseImage(e) {
      var _this = this;
      var ss=1-this.fileData[this.currentFileDataList].length;
      uni.chooseImage({
        count: ss, //默认9
        sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
        sourceType: ['camera','album'], //从相册选择
        success: (res) => {
          if(e==0) {
            for (let i = 0; i < res.tempFilePaths.length; i++) {
              let img={};
              img.id='';
              img.filePath=res.tempFilePaths[i];
              this.fileData[this.currentFileDataList].push(img)
            }
          }
        }
      });
    },
    ViewImage(e,list) {
      console.info(e.currentTarget.dataset.type)
      let files =[];
      if(e.currentTarget.dataset.type==0) {
        for(var i=0;i<this.fileData[list].length;i++){
          files.push(this.fileData[list][i].filePath)
        }
      }else{
        let files =[];
        for(var i=0;i<this.fileData[list].length;i++){
          files.push(this.fileData[list][i].filePath)
        }
      }
      uni.previewImage({
        urls: files,
        current: e.currentTarget.dataset.url
      });
    },
    DelImg(e, list) {
      var _this = this;
      let i=e.currentTarget.dataset.index
      uni.showModal({
        title: '操作提示',
        content: '确定要删除这张图片吗？',
        cancelColor:"#000000",
        cancelText: '取消',
        confirmText: '确定',
        success: res => {
          if (res.confirm) {
            if(e.currentTarget.dataset.type==0) {
              if(_this.formData.USER_ID) {
                uni.showLoading({
                  title: '处理中'
                })
                uni.request({
                  url: basePath+'/app/imgfiles/delete',
                  method: 'POST',
                  dataType: 'json',
                  header: {
                    'Content-type':'application/x-www-form-urlencoded'
                  },
                  data: {
                    list: '',
                    CORPINFO_ID:loginUser.CORPINFO_ID,
                    USER_ID:loginUser.USER_ID,
                  },
                  success: (res) => {
                    uni.hideLoading();
                    uni.showToast({
                      icon: 'none',
                      title: '删除成功',
                      duration: 1500
                    });
                    _this.fileData[list].splice(i, 1)
                  },
                  fail: (err) => {
                    uni.hideLoading();
                    uni.showModal({
                      content: err.errMsg,
                      showCancel: false
                    });
                  }
                })
              }else {
                this.fileData[list].splice(e.currentTarget.dataset.index, 1)
              }
            }
          }
        }
      })
    },
    ViewShowImage(e, path) {
      let files = [];
      files.push(baseImgPath + path)
      uni.previewImage({
        urls: files,
        current: e.currentTarget.dataset.index
      });
    },
    goback(){
      var pages = getCurrentPages();	// 获取当前页面栈
      var prePage = pages[pages.length - 2];	// 上二级页面
      prePage.$vm.initflag = true;    // A 页面 init方法 为true
      uni.navigateBack({delta: 1});
      uni.hideLoading();
    },
    validateData() {
      // 身份证
      if (this.fileData.idCardFront.length < 1) {
        uni.showToast({
          icon: 'none',
          title: '请上传身份证照片（正面）',
          duration: 2000
        });
        return false;
      }
      if (this.fileData.idCardBack.length < 1) {
        uni.showToast({
          icon: 'none',
          title: '请上传身份证照片（背面）',
          duration: 2000
        });
        return false;
      }
      if (!this.formData.DATE_OF_BIRTH) {
        uni.showToast({
          icon: 'none',
          title: '请选择生日',
          duration: 2000
        });
        return false;
      }
      if (!this.formData.NATION) {
        uni.showToast({
          icon: 'none',
          title: '请选择民族',
          duration: 2000
        });
        return false;
      }
      if (!this.formData.SEX) {
        uni.showToast({
          icon: 'none',
          title: '请选择性别',
          duration: 2000
        });
        return false;
      }
      if (!this.formData.ID_CARD_VALIDITY_START || !this.formData.ID_CARD_VALIDITY_END) {
        uni.showToast({
          icon: 'none',
          title: '请选择身份证有效期时间',
          duration: 2000
        });
        return false;
      }
      if (!this.formData.ID_CARD_ADDRESS) {
        uni.showToast({
          icon: 'none',
          title: '请输入住址信息',
          duration: 2000
        });
        return false;
      }
      if (!this.formData.ID_CARD_ORGAN) {
        uni.showToast({
          icon: 'none',
          title: '请输入身份证的签发机关',
          duration: 2000
        });
        return false;
      }

      // 驾驶证
      if (this.formData.PERSONNEL_TYPE_NAME.find((item) => item === '驾驶员')) {
        if (this.fileData.driverLicense.length < 1) {
          uni.showToast({
            icon: 'none',
            title: '请上传驾驶证照片',
            duration: 2000
          });
          return false;
        }
        if (!this.formData.DRIVER_LICENSE_NO) {
          uni.showToast({
            icon: 'none',
            title: '请输入驾驶证号',
            duration: 2000
          });
          return false;
        }
        if (this.formData.DRIVING_MODEL.length < 1) {
          uni.showToast({
            icon: 'none',
            title: '请选择准驾车型',
            duration: 2000
          });
          return false;
        }
        if (!this.formData.DRIVER_LICENSE_ISSUE_DATE) {
          uni.showToast({
            icon: 'none',
            title: '请选择初次领证日期',
            duration: 2000
          });
          return false;
        }
        if (!this.formData.DRIVER_LICENSE_VALIDITY_START || !this.formData.DRIVER_LICENSE_VALIDITY_END) {
          uni.showToast({
            icon: 'none',
            title: '请选择驾驶证有效期时间',
            duration: 2000
          });
          return false;
        }
        if (!this.formData.DRIVER_LICENSE_ORGAN) {
          uni.showToast({
            icon: 'none',
            title: '请输入驾驶证的签发机关',
            duration: 2000
          });
          return false;
        }
      }

      // 从业资格证证
      if (this.fileData.qualificationCertificate.length < 1) {
        uni.showToast({
          icon: 'none',
          title: '请上传从业资格证照片',
          duration: 2000
        });
        return false;
      }
      if (!this.formData.QUALIFICATION_CERTIFICATE_NO) {
        uni.showToast({
          icon: 'none',
          title: '请输入从业资格证号',
          duration: 2000
        });
        return false;
      }
      if (this.formData.QUALIFICATION_CERTIFICATE_CATEGORY.length < 1) {
        uni.showToast({
          icon: 'none',
          title: '请选择从业资格证类别',
          duration: 2000
        });
        return false;
      }
      if (!this.formData.QUALIFICATION_CERTIFICATE_ISSUE_DATE) {
        uni.showToast({
          icon: 'none',
          title: '请选择初次领证日期',
          duration: 2000
        });
        return false;
      }
      if (!this.formData.QUALIFICATION_CERTIFICATE_VALIDITY_START || !this.formData.QUALIFICATION_CERTIFICATE_VALIDITY_END) {
        uni.showToast({
          icon: 'none',
          title: '请选择从业资格证有效期时间',
          duration: 2000
        });
        return false;
      }
      if (!this.formData.QUALIFICATION_CERTIFICATE_ORGAN) {
        uni.showToast({
          icon: 'none',
          title: '请输入从业资格证的签发机关',
          duration: 2000
        });
        return false;
      }
      return true;
    },

  }
}
</script>

<style>
page{
  background-color: #f3f2f2;
}
.prevent {
  width: 100%;
  height: 100%;
  position: fixed;
  top: 0;
  left: 0;
  overflow: hidden;
}
.cu-form-title{
  padding: 20upx 0;
}
.cu-form-textarea{
  background-color: #ffffff;
  padding: 1upx 30upx 20upx;
  min-height: 100upx;
}
.cu-form-textarea textarea {
  height: 4.6em;
  width: 100%;
  line-height: 1.2em;
  flex: 1;
  font-size: 28upx;
  padding: 0;
}
.selected{
  display: flex;
  align-items: center;
  height: 100upx;
}
.selected .radio{
  transform:scale(0.8);
  margin-right: 10upx;
}
.group{
  display: flex;
  align-items: center;
}
.cu-form-group .title{
  font-size: 28upx;
  font-weight: bold;
}
.cu-bar .action:first-child {
  font-size: 28upx;
}
.cu-form-group .picker{
  color: #808080;
}
.picker-tree{
  color: #808080;
}
</style>
