<template>
  <div>
    <el-dialog
      :title="dialogtitle"
      :visible="caseentryExamineVisible"
      @close="cancel"
      width="1000px"
      append-to-body
      :destroy-on-close="true"
      center
    >
      <!-- 案件信息 -->
      <el-form
        ref="form"
        :model="formData"
        :rules="rules"
        label-width="150px"
        disabled
        class="formbox"
      >
        <div style="display: inline-flex">
          <div class="infoIcon"></div>
          <div class="caseInfo">案件信息：</div>
        </div>
        <el-divider></el-divider>
        <el-row>
          <el-col :span="12">
            <el-form-item label="案件编号：" prop="caseNum" v-if="flag !== '2'" :class="changeLableCode.includes('caseNum') ? 'red' : ''" >
              <el-input
                v-model="formData.caseNum"
                placeholder="请输入案件编号"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="案件名称：" prop="caseName" :class="changeLableCode.includes('caseName') ? 'red' : ''" >
              <el-input
                v-model="formData.caseName"
                placeholder="请输入案件名称"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="案件标的：" prop="caseSubjectAmount" :class="changeLableCode.includes('caseSubjectAmount') ? 'red' : ''" >
              <el-input
                v-model="formData.caseSubjectAmount"
                placeholder="请输入案件标的"
                @input="numberFn('caseSubjectAmount')"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="借款开始日期：" prop="loanStartDate" :class="changeLableCode.includes('loanStartDate') ? 'red' : ''" >
              <el-date-picker
                v-model="formData.loanStartDate"
                type="datetime"
                placeholder="借款开始日期"
                @change="setStartTime"
              >
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="借款结束日期：" prop="loanEndDate" :class="changeLableCode.includes('loanEndDate') ? 'red' : ''" >
              <el-date-picker
                v-model="formData.loanEndDate"
                type="datetime"
                placeholder="借款结束日期"
                @change="setEndTime"
              >
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="合同编号：" prop="contractNumber" :class="changeLableCode.includes('contractNumber') ? 'red' : ''" >
              <el-input
                v-model="formData.contractNumber"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="申请人主张欠本金：" prop="claimPrinciOwed" :class="changeLableCode.includes('claimPrinciOwed') ? 'red' : ''" >
              <el-input
                v-model="formData.claimPrinciOwed"
                placeholder="请输入"
                @input="numberFn('claimPrinciOwed')"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="申请人主张欠利息：" prop="claimInterestOwed" :class="changeLableCode.includes('claimInterestOwed') ? 'red' : ''" >
              <el-input
                v-model="formData.claimInterestOwed"
                placeholder="请输入"
                @input="numberFn('claimInterestOwed')"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="申请人主张违约金：" :class="changeLableCode.includes('claimLiquidDamag') ? 'red' : ''" prop="claimLiquidDamag">
              <el-input
                v-model="formData.claimLiquidDamag"
                placeholder="请输入"
                @input="numberFn('claimLiquidDamag')"
              />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="申请人请求仲裁庭裁决：" :class="changeLableCode.includes('requestRule') ? 'red' : ''" prop="requestRule">
              <el-input
                v-model="formData.requestRule"
                placeholder="请输入申请人请求仲裁庭裁决"
                type="textarea"
                :autosize="{ minRows: 4, maxRows: 8 }"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="是否财产保全申请：" prop="properPreser" :class="changeLableCode.includes('properPreser') ? 'red' : ''">
              <el-radio-group v-model="formData.properPreser">
                <el-radio :label="1">是</el-radio>
                <el-radio :label="0">否</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
          <el-col :span="12" v-if="flag == 0">
            <el-form-item label="应缴费用：" prop="feePayable">
              <el-input v-model="formData.feePayable" placeholder="请输入" />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item
              label="申请人仲裁请求及事实和理由"
              prop="arbitratClaims"
              :class="changeLableCode.includes('arbitratClaims') ? 'red' : ''"
            >
              <el-input
                v-model="formData.arbitratClaims"
                placeholder="请输入申请人仲裁诉求"
                type="textarea"
                :autosize="{ minRows: 4, maxRows: 8 }"
              />
            </el-form-item>
          </el-col>
          <!-- <el-col :span="12">
            <el-form-item label="申请人案件证据资料上传：" prop="applicantEvidence" v-if="flag !== '0'">
              <el-upload class="upload-demo" ref="fileupload" accept=".png,.jpg,.doc,.docx,.txt,.pdf"
                :action="UploadUrl()" :on-success="handlSuccess" :on-remove="handleRemove" :on-preview="handlePreview"
                :before-remove="beforeRemove" :data="filedata" :headers="headers" multiple :limit="3"
                :on-exceed="handleExceed" :file-list="fileList">
                <el-button size="small" type="primary">点击上传</el-button>
                <div slot="tip" class="el-upload__tip">
                  文件支持上传.jpg，png，.doc，docx，.txt，.pdf文件
                </div>
              </el-upload>
            </el-form-item>
          </el-col> -->
          <el-col :span="12">
            <el-form-item label="申请人案件证据资料：" :class="changeLableCode.includes('fileColumn') ? 'red' : ''">
              <div v-for="(item, index) in applicateArr" :key="index">
                <a href="#" @click="toFile(item, index)" style="color: blue">
                  {{ item.annexName }}
                </a>
              </div>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item
              label="被申请人案件证据资料："
              prop="respondentEvidence"
            >
              <div v-for="(item, index) in quiltArr" :key="index">
                <a href="#" @click="toFile1(item, index)" style="color: blue">
                  {{ item.annexName }}
                </a>
              </div>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <!-- 申请人主体信息 -->
      <el-form ref="form2" :model="form2" label-width="150px" disabled class="formbox">
        <div v-for="(item, index) in form2.paymentArr" :key="index">
          <div style="display: flex; justify-content: space-between">
            <div style="display: inline-flex">
              <div class="infoIcon"></div>
              <div class="caseInfo">申请人主体信息：</div>
            </div>
            <el-button
              type="danger"
              icon="el-icon-delete"
              @click="deleteData(index)"
              v-if="form2.paymentArr.length > 1 && flag != '0'"
            ></el-button>
          </div>
          <el-divider></el-divider>
          <el-row>
            <el-col :span="12">
              <el-form-item
                label="申请人(机构)："
                :prop="'paymentArr.' + index + '.name'"
                :class="changeLableCode1.includes(`paymentArr.${index}.name`) ? 'red' : ''"
                :rules="[
                  {
                    required: true,
                    message: '申请人不能为空',
                    trigger: 'blur',
                  },
                  { max: 20, message: '长度应小于20个字符', trigger: 'blur' },
                ]"
              >
                <el-input v-model="item.name" placeholder="请输入" />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item
                label="代码："
                :prop="'paymentArr.' + index + '.identityNum'"
                :class="changeLableCode1.includes(`paymentArr.${index}.identityNum`) ? 'red' : ''"
                :rules="[
                  { max: 50, message: '长度应小于50个字符', trigger: 'blur' },
                ]"
              >
                <el-input v-model="item.identityNum" placeholder="请输入" />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item
                label="联系电话："
                :prop="'paymentArr.' + index + '.contactTelphone'"
                :class="changeLableCode1.includes(`paymentArr.${index}.contactTelphone`) ? 'red' : ''"
                :rules="[
                  {
                    required: true,
                    message: '联系电话不能为空',
                    trigger: 'blur',
                  },
                  {
                    pattern: /^[1][3,4,5,6,7,8,9][0-9]{9}$/,
                    message: '请输入正确的手机号码',
                    trigger: 'blur',
                  },
                ]"
              >
                <el-input v-model="item.contactTelphone" placeholder="请输入" />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item
                label="邮箱"
                :prop="'paymentArr.' + index + '.email'"
                :class="changeLableCode1.includes(`paymentArr.${index}.email`) ? 'red' : ''"
                :rules="[
                  {
                    required: true,
                    message: '邮箱地址不能为空',
                    trigger: 'blur',
                  },
                  {
                    pattern:
                      /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/,
                    message: '请输入正确的邮箱地址',
                    trigger: 'blur',
                  },
                ]"
              >
                <el-input v-model="item.email" placeholder="请输入电子邮件" />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item
                label="单位地址："
                :prop="'paymentArr.' + index + '.workAddress'"
                :class="changeLableCode1.includes(`paymentArr.${index}.workAddress`) ? 'red' : ''"
                :rules="[
                  {
                    required: true,
                    message: '单位地址不能为空',
                    trigger: 'blur',
                  },
                  { max: 50, message: '长度应小于50个字符', trigger: 'blur' },
                ]"
              >
                <el-input v-model="item.workAddress" placeholder="请输入" />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item
                label="单位电话："
                :prop="'paymentArr.' + index + '.workTelphone'"
                :class="changeLableCode1.includes(`paymentArr.${index}.workTelphone`) ? 'red' : ''"
                :rules="[
                  {
                    required: true,
                    message: '单位电话不能为空',
                    trigger: 'blur',
                  },
                ]"
              >
                <el-input v-model="item.workTelphone" placeholder="请输入" />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item
                label="联系地址："
                :prop="'paymentArr.' + index + '.contactAddress'"
                :class="changeLableCode1.includes(`paymentArr.${index}.contactAddress`) ? 'red' : ''"
                :rules="[
                  {
                    required: true,
                    message: '联系地址不能为空',
                    trigger: 'blur',
                  },
                  { max: 50, message: '长度应小于50个字符', trigger: 'blur' },
                ]"
              >
                <el-input v-model="item.contactAddress" placeholder="请输入" />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item
                label="申请人住所："
                :prop="'paymentArr.' + index + '.residenAffili'"
                :class="changeLableCode1.includes(`paymentArr.${index}.residenAffili`) ? 'red' : ''"
                :rules="[
                  {
                    required: true,
                    message: '申请人住所不能为空',
                    trigger: 'blur',
                  },
                  { max: 50, message: '长度应小于50个字符', trigger: 'blur' },
                ]"
              >
                <el-input v-model="item.residenAffili" placeholder="请输入" />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item
                label="法定代表人："
                :prop="'paymentArr.' + index + '.compLegalPerson'"
                :class="changeLableCode1.includes(`paymentArr.${index}.compLegalPerson`) ? 'red' : ''"
                :rules="[
                  {
                    required: true,
                    message: '法定代表人不能为空',
                    trigger: 'blur',
                  },
                  { max: 50, message: '长度应小于50个字符', trigger: 'blur' },
                ]"
              >
                <el-input v-model="item.compLegalPerson" placeholder="请输入" />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item
                label="法定代表人职位："
                :prop="'paymentArr.' + index + '.compLegalperPost'"
                :class="changeLableCode1.includes(`paymentArr.${index}.compLegalperPost`) ? 'red' : ''"
                :rules="[
                  {
                    required: true,
                    message: '法定代表人职位不能为空',
                    trigger: 'blur',
                  },
                  { max: 50, message: '长度应小于50个字符', trigger: 'blur' },
                ]"
              >
                <el-input
                  v-model="item.compLegalperPost"
                  placeholder="请输入"
                />
              </el-form-item>
            </el-col>
          </el-row>
          <div style="display: inline-flex">
            <div class="infoIcon"></div>
            <div class="caseInfo2">代理人信息：</div>
          </div>
          <el-row>
            <el-col :span="12">
              <el-form-item
                label="姓名："
                :prop="'paymentArr.' + index + '.nameAgent'"
                :class="changeLableCode1.includes(`paymentArr.${index}.nameAgent`) ? 'red' : ''"
                :rules="[
                  {
                    required: true,
                    message: '姓名不能为空',
                    trigger: 'blur',
                  },
                  { max: 20, message: '长度应小于20个字符', trigger: 'blur' },
                ]"
              >
                <el-input v-model="item.nameAgent" placeholder="请输入" />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item
                label="身份证号："
                :prop="'paymentArr.' + index + '.identityNumAgent'"
                :class="changeLableCode1.includes(`paymentArr.${index}.identityNumAgent`) ? 'red' : ''"
                :rules="[
                  {
                    required: true,
                    message: '身份证号不能为空',
                    trigger: 'blur',
                  },
                  {
                    pattern:
                      /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,
                    message: '请输入正确的身份证号码',
                    trigger: 'blur',
                  },
                ]"
              >
                <el-input
                  v-model="item.identityNumAgent"
                  placeholder="请输入"
                />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item
                label="联系电话："
                :prop="'paymentArr.' + index + '.contactTelphoneAgent'"
                :class="changeLableCode1.includes(`paymentArr.${index}.contactTelphoneAgent`) ? 'red' : ''"
                :rules="[
                  {
                    required: true,
                    message: '联系电话不能为空',
                    trigger: 'blur',
                  },
                  {
                    pattern: /^[1][3,4,5,6,7,8,9][0-9]{9}$/,
                    message: '请输入正确的手机号码',
                    trigger: 'blur',
                  },
                ]"
              >
                <el-input
                  v-model="item.contactTelphoneAgent"
                  placeholder="请输入"
                />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item
                label="联系地址："
                :prop="'paymentArr.' + index + '.contactAddressAgent'"
                :class="changeLableCode1.includes(`paymentArr.${index}.contactAddressAgent`) ? 'red' : ''"
                :rules="[
                  {
                    required: true,
                    message: '联系地址不能为空',
                    trigger: 'blur',
                  },
                  { max: 50, message: '长度应小于50个字符', trigger: 'blur' },
                ]"
              >
                <el-input
                  v-model="item.contactAddressAgent"
                  placeholder="请输入"
                />
              </el-form-item>
            </el-col>
          </el-row>
        </div>
      </el-form>
      <!-- 被申请人主体信息 -->
      <el-form ref="form3" label-width="150px" disabled :model="form3" class="formbox">
        <div
          v-for="(itm, index) in form3.paymentArr1"
          :key="index + form2.paymentArr.length"
        >
          <div style="display: flex; justify-content: space-between">
            <div style="display: inline-flex">
              <div class="infoIcon"></div>
              <div class="caseInfo">被申请人主体信息：</div>
            </div>
            <el-button
              type="danger"
              icon="el-icon-delete"
              @click="deleteData1(index)"
              v-if="form3.paymentArr1.length > 1 && flag != '0'"
            ></el-button>
          </div>
          <el-divider></el-divider>
          <el-row>
            <el-col :span="12">
              <el-form-item
                label="被申请人姓名"
                :prop="'paymentArr1.' + index + '.name'"
                :class="changeLableCode2.includes(`paymentArr1.${index}.name`) ? 'red' : ''"
                :rules="[
                  {
                    required: true,
                    message: '被申请人不能为空',
                    trigger: 'blur',
                  },
                  { max: 20, message: '长度应小于20个字符', trigger: 'blur' },
                ]"
              >
                <el-input v-model="itm.name" placeholder="请输入" />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item
                label="身份证号："
                :prop="'paymentArr1.' + index + '.identityNum'"
                :class="changeLableCode2.includes(`paymentArr1.${index}.identityNum`) ? 'red' : ''"
                :rules="[
                  {
                    required: true,
                    message: '身份证号不能为空',
                    trigger: 'blur',
                  },
                  {
                    pattern:
                      /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,
                    message: '请输入正确的身份证号码',
                    trigger: 'blur',
                  },
                ]"
              >
                <el-input v-model="itm.identityNum" placeholder="请输入" />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item
                label="联系电话："
                :prop="'paymentArr1.' + index + '.contactTelphone'"
                :class="changeLableCode2.includes(`paymentArr1.${index}.contactTelphone`) ? 'red' : ''"
                :rules="[
                  {
                    required: true,
                    message: '联系电话不能为空',
                    trigger: 'blur',
                  },
                  {
                    pattern: /^[1][3,4,5,6,7,8,9][0-9]{9}$/,
                    message: '请输入正确的手机号码',
                    trigger: 'blur',
                  },
                ]"
              >
                <el-input v-model="itm.contactTelphone" placeholder="请输入" />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item
                label="邮箱"
                :prop="'paymentArr1.' + index + '.email'"
                :class="changeLableCode2.includes(`paymentArr1.${index}.email`) ? 'red' : ''"
                :rules="[
                  {
                    required: true,
                    message: '邮箱地址不能为空',
                    trigger: 'blur',
                  },
                  {
                    pattern:
                      /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/,
                    message: '请输入正确的邮箱地址',
                    trigger: 'blur',
                  },
                ]"
              >
                <el-input v-model="itm.email" placeholder="请输入电子邮件" />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item
                label="单位地址："
                :prop="'paymentArr1.' + index + '.workAddress'"
                :class="changeLableCode2.includes(`paymentArr1.${index}.workAddress`) ? 'red' : ''"
                :rules="[
                  {
                    required: true,
                    message: '单位地址不能为空',
                    trigger: 'blur',
                  },
                  { max: 50, message: '长度应小于50个字符', trigger: 'blur' },
                ]"
              >
                <el-input v-model="itm.workAddress" placeholder="请输入" />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item
                label="单位电话："
                :prop="'paymentArr1.' + index + '.workTelphone'"
                :class="changeLableCode2.includes(`paymentArr1.${index}.workTelphone`) ? 'red' : ''"
                :rules="[
                  {
                    required: true,
                    message: '单位电话不能为空',
                    trigger: 'blur',
                  },
                ]"
              >
                <el-input v-model="itm.workTelphone" placeholder="请输入" />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item
                label="联系地址："
                :prop="'paymentArr1.' + index + '.contactAddress'"
                :class="changeLableCode2.includes(`paymentArr1.${index}.contactAddress`) ? 'red' : ''"
                :rules="[
                  {
                    required: true,
                    message: '联系地址不能为空',
                    trigger: 'blur',
                  },
                  { max: 50, message: '长度应小于50个字符', trigger: 'blur' },
                ]"
              >
                <el-input v-model="itm.contactAddress" placeholder="请输入" />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item
                label="被申请人住所："
                :prop="'paymentArr1.' + index + '.residenAffili'"
                :class="changeLableCode2.includes(`paymentArr1.${index}.residenAffili`) ? 'red' : ''"
                :rules="[
                  {
                    required: true,
                    message: '被申请人住所不能为空',
                    trigger: 'blur',
                  },
                  { max: 50, message: '长度应小于50个字符', trigger: 'blur' },
                ]"
              >
                <el-input v-model="itm.residenAffili" placeholder="请输入" />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item
                label="被申请人性别："
                :prop="'paymentArr1.' + index + '.responSex'"
                :class="changeLableCode2.includes(`paymentArr1.${index}.responSex`) ? 'red' : ''"
                :rules="[
                  {
                    required: true,
                  },
                ]"
              >
                <el-radio-group v-model="itm.responSex">
                  <el-radio label="1">男</el-radio>
                  <el-radio label="0">女</el-radio>
                </el-radio-group>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item
                label="被申请人出生年月日："
                :prop="'paymentArr1.' + index + '.responBirth'"
                :class="changeLableCode2.includes(`paymentArr1.${index}.responBirth`) ? 'red' : ''"
                :rules="[
                  {
                    required: true,
                    message: '被申请人出生年月日不能为空',
                    trigger: 'blur',
                  },
                ]"
              >
                <el-date-picker
                  v-model="itm.responBirth"
                  :picker-options="pickerOptions"
                  type="datetime"
                  placeholder="被申请人出生年月日"
                >
                </el-date-picker>
              </el-form-item>
            </el-col>
          </el-row>
          <div style="display: inline-flex">
            <div class="infoIcon"></div>
            <div class="caseInfo2">代理人信息：</div>
          </div>
          <el-row>
            <el-col :span="12">
              <el-form-item
                label="姓名："
                :prop="'paymentArr1.' + index + '.nameAgent'"
                :class="changeLableCode2.includes(`paymentArr1.${index}.nameAgent`) ? 'red' : ''"
                :rules="[
                  {
                    required: true,
                    message: '姓名不能为空',
                    trigger: 'blur',
                  },
                  { max: 20, message: '长度应小于20个字符', trigger: 'blur' },
                ]"
              >
                <el-input v-model="itm.nameAgent" placeholder="请输入" />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item
                label="身份证号："
                :prop="'paymentArr1.' + index + '.identityNumAgent'"
                :class="changeLableCode2.includes(`paymentArr1.${index}.identityNumAgent`) ? 'red' : ''"
                :rules="[
                  {
                    required: true,
                    message: '身份证号不能为空',
                    trigger: 'blur',
                  },
                  {
                    pattern:
                      /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,
                    message: '请输入正确的身份证号码',
                    trigger: 'blur',
                  },
                ]"
              >
                <el-input v-model="itm.identityNumAgent" placeholder="请输入" />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item
                label="联系电话："
                :prop="'paymentArr1.' + index + '.contactTelphoneAgent'"
                :class="changeLableCode2.includes(`paymentArr1.${index}.contactTelphoneAgent`) ? 'red' : ''"
                :rules="[
                  {
                    required: true,
                    message: '联系电话不能为空',
                    trigger: 'blur',
                  },
                  {
                    pattern: /^[1][3,4,5,6,7,8,9][0-9]{9}$/,
                    message: '请输入正确的手机号码',
                    trigger: 'blur',
                  },
                ]"
              >
                <el-input
                  v-model="itm.contactTelphoneAgent"
                  placeholder="请输入"
                />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item
                label="联系地址："
                :prop="'paymentArr1.' + index + '.contactAddressAgent'"
                :class="changeLableCode2.includes(`paymentArr1.${index}.contactAddressAgent`) ? 'red' : ''"
                :rules="[
                  {
                    required: true,
                    message: '联系地址不能为空',
                    trigger: 'blur',
                  },
                  { max: 50, message: '长度应小于50个字符', trigger: 'blur' },
                ]"
              >
                <el-input
                  v-model="itm.contactAddressAgent"
                  placeholder="请输入"
                />
              </el-form-item>
            </el-col>
          </el-row>
        </div>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button
          type="primary"
          @click="submitIsAgree(1)"
          v-if="
            formData.updateSubmitStatus == 1 || formData.updateSubmitStatus == 2
          "
          class="endbutton"
          ><span>同 意</span></el-button
        >
        <el-button
          type="warning"
          @click="submitIsAgree(0)"
          v-if="
            formData.updateSubmitStatus == 1 || formData.updateSubmitStatus == 2
          "
          class="endbutton2"
          ><span>拒 绝</span></el-button
        >
      </div>
    </el-dialog>
  </div>
</template>

<script>
import moment from "moment"; //导入文件
import { getToken } from "@/utils/auth";
import { addCaseApply, editCaseApply } from "@/api/caseAccess/caseEntry";
import { updateAudit } from "@/api/caseManagement/caseManagement";
export default {
  props: [
    "dialogtitle",
    "form",
    "getcaseApply",
    "flag",
    "initpaymentArr",
    "initpaymentArr1",
    "queryParams",
    "caseAttachList",
    "caseentryExamineVisible",
    "caseentryExamineData",
    "caseentryExamineDataAll"
  ],
  data() {
    return {
      formData: {},
      changeLableCode: [],
      changeLableCode1: [],
      changeLableCode2: [],
      filedata: {
        annexType: 2,
      },
      headers: {
        Authorization: "Bearer " + getToken(),
      },
      form2: {
        paymentArr: [
          {
            identityType: 1,
            name: "",
            identityNum: "",
            contactTelphone: "",
            email: "",
            workAddress: "",
            workTelphone: "",
            contactAddress: "",
            nameAgent: "",
            contactTelphoneAgent: "",
            contactAddressAgent: "",
            residenAffili: "",
          },
        ],
      }, //申请人主体信息
      form3: {
        paymentArr1: [
          {
            identityType: 2,
            name: "",
            identityNum: "",
            contactTelphone: "",
            email: "",
            workAddress: "",
            workTelphone: "",
            contactAddress: "",
            nameAgent: "",
            contactTelphoneAgent: "",
            contactAddressAgent: "",
            responSex: 1,
            responBirth: "",
            residenAffili: "",
          },
        ],
      }, //被申请人主体信息
      // 表单校验
      rules: {
        caseSubjectAmount: [
          {
            required: true,
            message: "案件标的不能为空",
            trigger: "blur",
          },
        ],
        caseName: [
          {
            required: true,
            message: "案件名称不能为空",
            trigger: "blur",
          },
        ],
        loanStartDate: [
          {
            required: true,
            message: "借款开始日期不能为空",
            trigger: "blur",
          },
        ],
        loanEndDate: [
          {
            required: true,
            message: "借款结束日期不能为空",
            trigger: "blur",
          },
        ],
        name: [
          {
            required: true,
            message: "申请人姓名不能为空",
            trigger: "blur",
          },
        ],
        contractNumber: [
          {
            required: true,
            message: "合同编号不能为空",
            trigger: "blur",
          },
        ],
        claimPrinciOwed: [
          {
            required: true,
            message: "申请人主张欠本金不能为空",
            trigger: "blur",
          },
        ],
        claimInterestOwed: [
          {
            required: true,
            message: "申请人主张欠利息不能为空",
            trigger: "blur",
          },
        ],
        Overduedays: [
          {
            required: true,
            message: "逾期天数不能为空",
            trigger: "blur",
          },
        ],
        claimLiquidDamag: [
          {
            required: true,
            message: "申请人主张违约金不能为空",
            trigger: "blur",
          },
        ],
        arbitratClaims: [
          {
            required: true,
            message: "请输入申请人仲裁诉求",
            trigger: "blur",
          },
        ],
        feePayable: [
          {
            required: true,
          },
        ],
      },
      // annexId: '',
      caseAttachListArr: [],
      fileList: [],
      applicateArr: [],
      quiltArr: [],
      pickerOptions: {
        disabledDate(time) {
          return time.getTime() > Date.now() - 8.64e6;
        },
      },
    };
  },
  watch: {
    caseentryExamineVisible: {
      handler(val) {
        setTimeout(() => {
          if (val) {
            this.applicateArr = [];
            this.quiltArr = [];
            this.formData = this.caseentryExamineData;
            if (this.caseentryExamineDataAll.changeColumn) {
              this.changeLableCode = this.caseentryExamineDataAll.changeColumn.split(',')
            } else {
              this.changeLableCode = []
            }
            if (this.caseentryExamineDataAll.afterCase.caseAffiliates[0].changeColumn) {
              let changelable = this.caseentryExamineDataAll.afterCase.caseAffiliates[0].changeColumn.split(',')
              this.changeLableCode1 = changelable.map(item =>
                'paymentArr.0.'+ item
              )
            } else {
              this.changeLableCode1 = []
            }
            if (this.caseentryExamineDataAll.afterCase.caseAffiliates[1].changeColumn) {
              let changelable1 = this.caseentryExamineDataAll.afterCase.caseAffiliates[1].changeColumn.split(',')
              this.changeLableCode2 = changelable1.map(item =>
                'paymentArr1.0.'+ item
              )
            } else {
              this.changeLableCode2 = []
            }
            this.fileList = [];
            this.form2.paymentArr = [
              this.caseentryExamineData.caseAffiliates[0],
            ];
            this.form3.paymentArr1 = [
              this.caseentryExamineData.caseAffiliates[1],
            ];
            if (this.caseentryExamineData.caseAttachList !== null) {
              this.caseentryExamineData.caseAttachList.forEach((item) => {
                if (item.annexType == 2) {
                  this.applicateArr.push({
                    annexName: item.annexName,
                    annexPath: item.annexPath,
                  });
                }
                if (item.annexType == 6) {
                  this.quiltArr.push({
                    annexName: item.annexName,
                    annexPath: item.annexPath,
                  });
                }
              });
            }
            this.fileList = this.caseentryExamineData.caseAttachList;
            if (this.caseentryExamineData.caseAttachList !== null) {
              this.fileList.forEach((item) => {
                item["name"] = item.annexName;
                item["certificatePath"] = item.annexPath;
              });
            }
          }
        }, 2000);
      },
      deep: true,
    },
  },
  methods: {
    numberFn(p) {
      this.formData[p] =
        this.formData[p]
          .replace(/[^\d^\.]+/g, "")
          .replace(/^0+(\d)/, "$1")
          .replace(/^\./, "0.")
          .match(/^\d*(\.?\d{0,2})/g)[0] || "";
    },
    UploadUrl() {
      return window.location.origin + "/API/evidence/upload";
    },
    handlePreview(file) {
      if (this.flag == "2") {
        window.open(
          window.location.origin + "/API" + file.response.data.annexName,
          "_blank"
        );
      } else if (this.flag == "1") {
        window.open(
          window.location.origin + "/API" + file.certificatePath,
          "_blank"
        );
      }
    },

    // 文件上传成功
    handlSuccess(res, file) {
      this.caseAttachListArr.push({
        annexId: res.data.annexId,
      });
    },
    // 文件超出个数限制时的钩子
    handleExceed(files, fileList) {
      this.$message.warning(
        `当前限制选择 3 个文件，本次选择了 ${files.length} 个文件，共选择了 ${
          files.length + fileList.length
        } 个文件`
      );
    },
    // 删除文件之前的钩子，参数为上传的文件和文件列表，若返回 false 或者返回 Promise 且被 reject，则停止删除。
    beforeRemove(file, fileList) {
      return this.$confirm(`确定移除 ${file.name}？`);
    },
    handleRemove(file, fileList) {
      (this.caseAttachListArr = []),
        fileList.forEach((item) => {
          this.caseAttachListArr.push({ annexId: item.response.data.annexId });
        });
    },
    // 取消
    cancel() {
      this.$emit("caseentryExamineCancel");
    },
    // 校验借款开始日期与结束日期
    setStartTime() {
      if (
        this.setTime(this.formData.loanStartDate) >=
        this.setTime(this.formData.loanEndDate)
      ) {
        this.$message.error("借款开始日期应早于借款结束日期");
        this.formData.loanStartDate = "";
        this.formData.loanEndDate = "";
      }
    },
    setEndTime() {
      if (
        this.setTime(this.formData.loanEndDate) <=
        this.setTime(this.formData.loanStartDate)
      ) {
        this.$message.error("借款结束日期应晚于借款开始日期");
        this.formData.loanStartDate = "";
        this.formData.loanEndDate = "";
      }
    },
    setTime(val) {
      const date = new Date(val);
      const time = date.getTime();
      return time;
    },

    // 新增申请人主体信息
    generateForm() {
      this.form2.paymentArr.push({
        identityType: 1,
        name: "",
        identityNum: "",
        contactTelphone: "",
        email: "",
        workAddress: "",
        workTelphone: "",
        contactAddress: "",
        nameAgent: "",
        contactTelphoneAgent: "",
        contactAddressAgent: "",
      });
    },
    // 新增被申请人主体信息
    generateForm1() {
      this.form3.paymentArr1.push({
        identityType: 2,
        name: "",
        identityNum: "",
        contactTelphone: "",
        email: "",
        workAddress: "",
        workTelphone: "",
        contactAddress: "",
        nameAgent: "",
        contactTelphoneAgent: "",
        contactAddressAgent: "",
      });
    },
    // 删除申请人主体信息
    deleteData(index) {
      this.form2.paymentArr.splice(index, 1);
    },
    // 删除被申请人主体信息
    deleteData1(index) {
      this.form3.paymentArr1.splice(index, 1);
    },
    // 顾问审核修改
    submitIsAgree(row) {
      let parms = {
        caseId: this.formData.id,
        updateSubmitStatus: this.formData.updateSubmitStatus,
        isAgree: row,
        version: this.formData.version,
      };
      updateAudit(parms).then((res) => {
        this.$modal.msgSuccess("审核成功");
        this.$emit("caseentryExamineCancel");
        this.getcaseApply(this.queryParams);
      });
    },
    // 详情显示，展示申请人案件文件
    toFile(item, index) {
      window.open(
        window.location.origin + "/API" + this.applicateArr[index].annexPath,
        "_black"
      );
    },
    // 被申请人文件
    toFile1(item, index) {
      window.open(
        window.location.origin + "/API" + this.quiltArr[index].annexPath,
        "_black"
      );
    },
  },
};
</script>

<style lang="scss" scoped>
::v-deep .el-dialog__body {
  height: 700px !important;
  overflow: auto !important;
}

::v-deep .el-dialog {
  width: 800px;
  background: #ffffff;
  border-radius: 20px;
}

.caseInfo {
  font-size: 17px;
  font-weight: 600;
}

.caseInfo2 {
  font-size: 15px;
  font-weight: 550;
}

.infoIcon {
  width: 4px;
  // height: 17px;
  background-color: #0072ff;
  margin-right: 5px;
}

.el-date-editor {
  width: 100%;
}

.endbutton {
  width: 154px;
  height: 37px;
  background: #0072ff;
  border-radius: 19px;

  span {
    width: 96px;
    height: 15px;
    font-size: 16px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: #ffffff;
  }
}

.endbutton1 {
  width: 154px;
  height: 37px;
  background: #ffffff;
  border: 1px solid #d0d0d0;
  border-radius: 19px;

  span {
    width: 31px;
    height: 13px;
    font-size: 16px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: #959595;
  }
}
.endbutton2 {
  width: 154px;
  height: 37px;
  background: #f40505;
  border: 1px solid #f50a0a;
  border-radius: 19px;
  span {
    width: 31px;
    height: 13px;
    font-size: 16px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: #ffffff;
  }
}
::v-deep .formbox {
  .el-form-item {
    &.red {  
      .el-form-item__label {
        color: red;
      }
    }
  }
}
</style>