<template>
  <div class="main-content abnormal m20">
    <DetailHead result="案件处理界面" />
    <div class="content-body">
      <el-form ref="form" :model="fraudEntInfo" label-width="220px" label-position="right" :rules="formRules">
        <div class="form">
          <div class="tab">
            <div class="tab-title">
              <label>被投诉人信息</label>
            </div>
          </div>
          <div class="form-body">
            <el-row class="flex-row">
              <el-col :span="12">
                <el-form-item label="主体名称">
                  <span style="color: #8cc3fb;cursor: pointer;" class="span-content" @click="toEntDetail(entInfo.uniscid)">{{ entInfo.entname }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="统一社会信用代码/注册号">
                  <span class="span-content">{{ entInfo.uniscid || entInfo.regno }}</span>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row class="bt0 flex-row">
              <el-col :span="12">
                <el-form-item label="法定代表人">
                  <span class="span-content">{{ entInfo.lerep }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="联系方式">
                  <span class="span-content">{{ entInfo.phone }}</span>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row class="bt0">
              <el-form-item label="登记机关">
                <span class="span-content">{{ entInfo.regorgCn }}</span>
              </el-form-item>
            </el-row>
            <!-- <el-row class="bt0">
              <el-form-item label="是否转现场核查" prop="isCase">
                <span style="display: inline-block">
                  <el-radio-group v-model="fraudEntInfo.isCase" @change="isCaseChangeEvent">
                    <el-radio label="1">是</el-radio>
                    <el-radio label="0">否</el-radio>
                  </el-radio-group>
                </span>
              </el-form-item>
            </el-row> -->
            <div v-if="fraudEntInfo.isCase === '1'">
              <el-row class="bt0">
                <el-form-item label="重点核查内容">
                  <el-input
                    v-model="fraudEntInfo.content"
                    :autosize="{ minRows: 2 }"
                    type="textarea"
                    placeholder="请输入重点核查内容"
                  />
                </el-form-item>
              </el-row>
              <el-row class="bt0">
                <el-form-item label="现场核查通知">
                  <el-button style="margin-right:20px" type="primary" size="mini" @click="openDialog">现场核查通知书模板</el-button>
                  <el-row style="border: unset">
                    <el-upload
                      :action="uploadPath"
                      :data="uploadBodyData(4)"
                      :on-remove="removeFile"
                      :on-success="uploadCallback"
                      :on-preview="previewFile"
                      :before-upload="beforeFileUpload"
                      :before-remove="beforeRemove"
                      accept=".doc,.docx,.xlsx,.xls,.pdf,.jpg,.zip,.rar,.7z,.png"
                      multiple
                      :disabled="readOnly"
                      name="files"
                      :file-list="fileList0"
                      style="max-width:800px;display: inline-block"
                      class="uploadFileList"
                      :class="{disabled: readOnly}"
                    >
                      <div v-if="!readOnly" style="display: inline-block;">
                        <el-button style="display: inline-block;" size="mini" type="primary">点击上传</el-button>
                        <div slot="tip" style="display: inline-block;" class="el-upload__tip">只能上传jpg/png/pdf/doc/docx/xls/xlsx/rar/zip/7z文件，且单个文件不能超过20M</div>
                      </div>
                    </el-upload>
                  </el-row>

                  <!-- <el-input
                    v-model="fraudEntInfo.notice"
                    :autosize="{ minRows: 2 }"
                    type="textarea"
                    placeholder="请输入现场核查通知"
                  /> -->
                </el-form-item>
              </el-row>
              <el-row class="bt0">
                <el-form-item label="备注">
                  <el-input
                    v-model="fraudEntInfo.remarks"
                    :autosize="{ minRows: 2 }"
                    type="textarea"
                    placeholder="请输入备注"
                  />
                </el-form-item>
              </el-row>
            </div>
            <el-row class="bt0 flex-row">
              <el-col :span="24">
                <el-form-item style="min-height: 100px" label="被投诉企业委托代理人信息" prop="fraudPersonInfo">
                  <div style="display: flex;">
                    <span style="flex-shrink: 0;width: 100px;text-align: right;">姓名：</span>
                    <span v-if="readOnly" class="span-content">{{ fraudEntInfo.fraudPersonInfoName }}</span>
                    <el-input
                      v-else
                      v-model="fraudEntInfo.fraudPersonInfoName"
                      style="width: 222px;"
                      placeholder="请输入被投诉企业委托代理人姓名"
                    />
                  </div>
                  <div style="display: flex;">
                    <span style="flex-shrink: 0;width: 100px;text-align: right;">证件类型：</span>
                    <span v-if="readOnly" class="span-content">{{ certype(fraudEntInfo.fraudPersonInfoCertType) }}</span>
                    <el-select v-else v-model="fraudEntInfo.fraudPersonInfoCertType" type="text">
                      <el-option v-for="item in certypeList" :key="item.value" :value="item.value" :label="item.label" />
                    </el-select>
                  </div>
                  <div style="display: flex;">
                    <span style="flex-shrink: 0;width: 100px;text-align: right;">证件号码：</span>
                    <span v-if="readOnly" class="span-content">{{ fraudEntInfo.fraudPersonInfoCertNo }}</span>
                    <el-input
                      v-else
                      v-model="fraudEntInfo.fraudPersonInfoCertNo"
                      placeholder="请输入委托代理人证件号码"
                    />
                  </div>
                  <div style="display:flex">
                    <span style="color:red;">因虚假市场主体登记被撤销的市场主体,其直接责任人自市场主体登记被撤销之日起3 年内不得再次申请市场主体登记。登记机关应当通过国家企业信用信息公示系统予以公示</span>
                  </div>
                </el-form-item>
              </el-col>
            </el-row>
          </div>
        </div>

        <div class="form">
          <div class="tab">
            <div class="tab-title">
              <label>撤销登记案件信息登记</label>
            </div>
          </div>
          <div class="form-body">
            <el-row class="flex-row">
              <el-col :span="12">
                <el-form-item label="投诉原因" prop="complaintReason">
                  <span v-if="readOnly" class="span-content">{{ fraudEntInfo.complaintReason }}</span>
                  <el-select v-else v-model="fraudEntInfo.complaintReason" type="text">
                    <el-option value="冒用他人身份信息登记">冒用他人身份信息登记</el-option>
                    <el-option value="冒用地址信息登记">冒用地址信息登记</el-option>
                    <el-option value="冒用其他信息登记">冒用其他信息登记</el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="冒名登记时间">
                  <span v-if="readOnly" class="span-content">{{ fraudEntInfo.regTime }}</span>
                  <el-date-picker
                    v-else
                    v-model="fraudEntInfo.regTime"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="选择日期"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row class="bt0 flex-row">
              <el-col :span="24">
                <el-form-item label="冒名登记事项" prop="regItem">
                  <span v-if="readOnly" class="span-content">{{ fraudEntInfo.regItem }}</span>
                  <el-input
                    v-else
                    v-model="fraudEntInfo.regItem"
                    :autosize="{ minRows: 2 }"
                    type="textarea"
                    placeholder="请输入冒名登记事项"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row class="bt0 flex-row">
              <el-col :span="12">
                <el-form-item label="登记机关">
                  <span class="span-content">{{ fraudEntInfo.regOrgCn }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="登记机关联系方式" prop="tel">
                  <span v-if="readOnly" class="span-content">{{ fraudEntInfo.tel }}</span>
                  <el-input
                    v-else
                    v-model="fraudEntInfo.tel"
                    placeholder="请输入登记机关联系方式"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <!--            <el-row class="bt0 flex-row">-->
            <!--              <el-col :span="24">-->
            <!--                <el-form-item style="min-height: 100px" label="被投诉企业委托代理人信息" prop="fraudPersonInfo">-->
            <!--                  <div style="display: flex;">-->
            <!--                    <span style="flex-shrink: 0;width: 100px;text-align: right;">姓名：</span>-->
            <!--                    <span class="span-content">{{ fraudEntInfo.fraudPersonInfoName }}</span>-->
            <!--                  </div>-->
            <!--                  <div style="display: flex;">-->
            <!--                    <span style="flex-shrink: 0;width: 100px;text-align: right;">证件类型：</span>-->
            <!--                    <span class="span-content">{{ certype(fraudEntInfo.fraudPersonInfoCertType) }}</span>-->
            <!--                  </div>-->
            <!--                  <div style="display: flex;">-->
            <!--                    <span style="flex-shrink: 0;width: 100px;text-align: right;">证件号码：</span>-->
            <!--                    <span class="span-content">{{ fraudEntInfo.fraudPersonInfoCertNo }}</span>-->
            <!--                  </div>-->
            <!--                </el-form-item>-->
            <!--              </el-col>-->
            <!--            </el-row>-->
            <el-row class="bt0">
              <el-form-item label="投诉证据材料" class="upload">
                <el-upload
                  :action="uploadPath"
                  :data="uploadBodyData(1)"
                  :on-remove="removeFile"
                  :on-success="uploadCallback"
                  :on-preview="previewFile"
                  :before-upload="beforeFileUpload"
                  :before-remove="beforeRemove"
                  accept=".doc,.docx,.xlsx,.xls,.pdf,.jpg,.zip,.rar,.7z,.png"
                  multiple
                  :disabled="readOnly"
                  name="files"
                  :file-list="fileList"
                  style="max-width:800px;display: inline-block"
                  class="uploadFileList"
                  :class="{disabled: readOnly}"
                >
                  <div v-if="!readOnly" style="display: inline-block;">
                    <el-button style="display: inline-block;" size="mini" type="primary">点击上传</el-button>
                    <div slot="tip" style="display: inline-block;" class="el-upload__tip">只能上传jpg/png/pdf/doc/docx/xls/xlsx/rar/zip/7z文件，且单个文件不能超过20M</div>
                  </div>
                </el-upload>
              </el-form-item>
            </el-row>
            <el-row class="bt0">
              <el-col :span="12">
                <el-form-item label="公告期自">
                  <span v-if="readOnly" class="span-content">{{ fraudEntInfo.noticeFrom }}</span>
                  <el-date-picker
                    v-else
                    v-model="fraudEntInfo.noticeFrom"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="选择日期"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="公告期至">
                  <span v-if="readOnly" class="span-content">{{ fraudEntInfo.noticeTo }}</span>
                  <el-date-picker
                    v-else
                    v-model="fraudEntInfo.noticeTo"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="选择日期"
                  />
                </el-form-item>
              </el-col>
            </el-row>
          </div>
        </div>

        <div class="form">
          <div class="tab">
            <div class="tab-title">
              <label>投诉人信息</label>
            </div>
          </div>
          <el-row style="border: 0;">
            <el-col :span="12" style="border: 1px solid #8CC3FB;">
              <el-form-item prop="complainerType" label-width="250px" label="投诉人类型：">
                <el-select v-model="fraudEntInfo.complainerType" style="width: 100%;" @change="fraudEntInfo.complainerCertType=''">
                  <el-option value="0" label="自然人" />
                  <el-option value="1" label="市场主体" />
                  <el-option value="2" label="政府单位(国有企业)/其他" />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row style="border: 0;">
            <el-col :span="12" style="border: 1px solid #8CC3FB;">
              <el-form-item prop="businessType" label-width="250px" label="业务类型：">
                <span v-if="readOnly" class="span-content">{{ fraudEntInfo.businessType }}</span>
                <el-select v-model="fraudEntInfo.businessType" style="width: 100%;" >
                  <el-option value="1" label="撤销设立" />
                  <el-option value="2" label="撤销变更" />
                  <el-option value="3" label="撤销注销" />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <div v-if="fraudEntInfo.complainerType === '0'">
            <!-- <el-col style="height:100%;background: #E9E9E9;border-right: 1px solid white " :span="1">
              <div style="padding:5px;height:100%">虚假登记投诉人信息</div>
            </el-col> -->
            <el-row>
              <el-col :span="12">
                <el-form-item prop="complainerName" label-width="250px" label="投诉人姓名：">
                  <span v-if="dialogTitle =='详情'">{{ fraudEntInfo.complainerName }}</span>
                  <el-input v-else v-model="fraudEntInfo.complainerName" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item prop="complainerCertType" label-width="249px" label="投诉人证件类型：">
                  <span v-if="dialogTitle =='详情'">{{ fraudEntInfo.complainerCertType }}</span>
                  <el-select v-else v-model="fraudEntInfo.complainerCertType" clearable class="custom">
                    <el-option
                      v-for="item in certypeList"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item prop="contactsPhone" label-width="250px" label="投诉人联系电话：">
                  <span v-if="dialogTitle =='详情'">{{ fraudEntInfo.contactsPhone }}</span>
                  <el-input v-else v-model="fraudEntInfo.contactsPhone" type="text" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item prop="complainerCertNo" label-width="249px" label="投诉人证件号码：">
                  <span v-if="dialogTitle =='详情'">{{ fraudEntInfo.complainerCertNo }}</span>
                  <el-input v-else v-model="fraudEntInfo.complainerCertNo" type="text" />
                </el-form-item>
              </el-col>
            </el-row>
          </div>
          <div v-if="fraudEntInfo.complainerType === '1'">
            <el-row>
              <el-col :span="12">
                <el-form-item class="flex-content" prop="complainerCertNo" label-width="250px" label="统一社会信用代码：">
                  <span v-if="dialogTitle =='详情'">{{ fraudEntInfo.complainerCertNo }}</span>
                  <el-input v-else v-model="fraudEntInfo.complainerCertNo" />
                  <el-button v-if="dialogTitle !== '详情'" :disabled="!fraudEntInfo.complainerCertNo" type="primary" @click="queryComplainerCertNo">查询</el-button>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item prop="complainerEntName" label-width="249px" label="主体名称：">
                  <span v-if="dialogTitle =='详情'">{{ fraudEntInfo.complainerEntName }}</span>
                  <el-input v-else v-model="fraudEntInfo.complainerEntName" type="text" />
                </el-form-item>
              </el-col>

            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item prop="complainerCertType" label-width="250px" label="主体类型：">
                  <span v-if="dialogTitle =='详情'">{{ fraudEntInfo.complainerCertType }}</span>
                  <el-select v-else v-model="fraudEntInfo.complainerCertType" clearable class="custom">
                    <el-option
                      v-for="item in certypeList2"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    >{{ item.label }}</el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item prop="complainerName" label-width="249px" label="法定代表人：">
                  <span v-if="dialogTitle =='详情'">{{ fraudEntInfo.complainerName }}</span>
                  <el-input v-else v-model="fraudEntInfo.complainerName" type="text" />
                </el-form-item>
              </el-col>

            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item prop="complainerLegalPhone" label-width="250px" label="法定代表人联系电话：">
                  <span v-if="dialogTitle =='详情'">{{ fraudEntInfo.complainerLegalPhone }}</span>
                  <el-input v-else v-model="fraudEntInfo.complainerLegalPhone" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item prop="contacts" label-width="250px" label="联系人：">
                  <span v-if="dialogTitle =='详情'">{{ fraudEntInfo.contacts }}</span>
                  <el-input v-else v-model="fraudEntInfo.contacts" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item prop="contactsPhone" label-width="250px" label="联系人电话：">
                  <span v-if="dialogTitle =='详情'">{{ fraudEntInfo.contactsPhone }}</span>
                  <el-input v-else v-model="fraudEntInfo.contactsPhone" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item prop="complainerRegOrg_cn" label-width="250px" label="登记机关：">
                  <span v-if="dialogTitle =='详情'">{{ fraudEntInfo.complainerRegOrg_cn }}</span>
                  <el-input v-else v-model="fraudEntInfo.complainerRegOrg_cn" disabled />
                </el-form-item>
              </el-col>
            </el-row>
          </div>
          <div v-if="fraudEntInfo.complainerType === '2'">
            <el-row>
              <el-col :span="12">
                <el-form-item prop="complainerName" label-width="250px" label="来函单位名称：">
                  <span v-if="dialogTitle =='详情'">{{ fraudEntInfo.complainerName }}</span>
                  <el-input v-else v-model="fraudEntInfo.complainerName" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item prop="contactsPhone" label-width="250px" label="单位联系电话：">
                  <span v-if="dialogTitle =='详情'">{{ fraudEntInfo.contactsPhone }}</span>
                  <el-input v-else v-model="fraudEntInfo.contactsPhone" type="text" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item prop="companyContact" label-width="249px" label="单位联系人：">
                  <span v-if="dialogTitle =='详情'">{{ fraudEntInfo.contacts }}</span>
                  <el-input v-else v-model="fraudEntInfo.contacts" type="text" />
                </el-form-item>
              </el-col>
            </el-row>
          </div>
          <el-row>
            <el-form-item label-width="250px" :label="fraudEntInfo.complainerType === '2'?'来函文件':'投诉人身份信息'" class="upload">
              <el-upload
                :action="uploadPath"
                :data="uploadBodyData(0)"
                :on-remove="removeFile"
                :on-success="uploadCallback"
                :on-preview="previewFile"
                :before-upload="beforeFileUpload"
                :before-remove="beforeRemove"
                accept=".doc,.docx,.xlsx,.xls,.pdf,.jpg,.zip,.rar,.7z,.png"
                multiple
                :disabled="readOnly"
                name="files"
                :file-list="fileList0"
                style="max-width:800px;display: inline-block"
                class="uploadFileList"
                :class="{disabled: readOnly}"
              >
                <div v-if="!readOnly" style="display: inline-block;">
                  <el-button style="display: inline-block;" size="mini" type="primary">点击上传</el-button>
                  <div slot="tip" style="display: inline-block;" class="el-upload__tip">只能上传jpg/png/pdf/doc/docx/xls/xlsx/rar/zip/7z文件，且单个文件不能超过20M</div>
                </div>
              </el-upload>
            </el-form-item>
          </el-row>
        </div>
        <div v-if="fraudEntInfo.businessType === '2'" class="form">
          <div class="tab">
            <div class="tab-title"><label>变更信息</label></div>
          </div>
          <div class="form-body history">
            <el-table
              ref="multipleTable"
              v-loading="loading"
              :data="eAlterRecoder"
              tooltip-effect="dark"
              class="table-style"
              :fit="true"
              :row-class-name="tableRowClassName"
              :header-cell-style="{background:'#8cc3fb',color:'#fff'}"
            >
              <el-table-column prop="index" label="序号" min-width="50" align="center" />
              <el-table-column prop="altitemCn" label="变更事项" min-width="150" align="left" />
              <el-table-column prop="altbe" :show-overflow-tooltip="true" label="变更前" min-width="120" align="left" />
              <el-table-column prop="altaf" :show-overflow-tooltip="true" label="变更后" min-width="80" align="left" />
              <el-table-column prop="altdate" :show-overflow-tooltip="true" label="变更日期" min-width="150" align="left" />
              <el-table-column label="操作" min-width="100" align="center">
                <template slot-scope="scope">
                  <el-button type="primary"  :loading="scope.row.loading" @click="handleProcess(scope.row,'1')" size="mini" >变更撤销</el-button>
                  <el-button type="primary"  :loading="scope.row.loading" @click="handleProcess(scope.row,'2')" size="mini" >行政撤销</el-button>
                </template>
              </el-table-column>
            </el-table>
          </div>
        </div>
        <div  class="form">
          <div class="tab">
            <div class="tab-title"><label>撤销决定</label></div>
          </div>
          <div class="form-body history">
            <el-table
              ref="multipleTable"
              v-loading="loading"
              :data="selectedRecords"
              tooltip-effect="dark"
              class="table-style"
              :fit="true"
              :row-class-name="tableRowClassName"
              :header-cell-style="{background:'#8cc3fb',color:'#fff'}"
            >
              <el-table-column prop="index" label="序号" min-width="50" align="center" />
              <el-table-column prop="altitemCn" label="变更事项" min-width="150" align="left" />
              <el-table-column prop="altbe" :show-overflow-tooltip="true" label="撤销前" min-width="120" align="left" />
              <el-table-column prop="altaf" :show-overflow-tooltip="true" label="撤销后" min-width="80" align="left" />
              <el-table-column prop="altdate" :show-overflow-tooltip="true" label="变更日期" min-width="150" align="left" />
              <el-table-column label="操作" min-width="100" align="center">
                <template slot-scope="scope">
                  <el-button type="primary"  :loading="scope.row.loading" @click="removeSelectedRecord(scope.$index)" size="mini" >删除</el-button>
                </template>
              </el-table-column>
            </el-table>
          </div>
        </div>
        <div class="form">
          <div class="tab">
            <div class="tab-title"><label>处理意见</label></div>
          </div>
          <div class="form-body history">
            <div v-if="opinions.length == 0" class="none">暂无处理意见</div>
            <el-steps direction="vertical">
              <el-step v-for="(each,index) in opinions" :key="'historyLog'+index" :title="opiniontypeCN(each.opiniontype) + '人：' + each.handler + ' ' + opiniontypeCN(each.opiniontype) +'日期：' + each.handledate " :description=" each.opinioncontent " status="finish" />
            </el-steps>
          </div>
        </div>
        <div class="form">
          <div class="tab">
            <div class="tab-title">
              <label>撤销登记案件处理情况</label>
            </div>
          </div>
          <div class="form-body">
            <el-row class="bt0">
              <el-form-item prop="_handlrea" label-width="220px" label="处理原因：">
                <span v-if="readOnly" class="span-content">{{ fraudEntInfo.handleReaCn }}</span>
                <el-select
                  v-else
                  ref="reaSelect"
                  v-model="fraudEntInfo._handlrea"
                  placeholder="请选择"
                  clearable
                  style="width: 80%"
                  class="custom"
                  value-key="value"
                  @change="(item)=>{
                    fraudEntInfo.handleRea = item.value
                    fraudEntInfo.handleReaCn = item.label;
                  }"
                >
                  <el-option
                    v-for="item in handlreaList"
                    :key="item.value"
                    :label="item.label"
                    :value="item"
                  />
                </el-select>
              </el-form-item>
            </el-row>
            <el-row class="bt0">
              <el-form-item prop="handleResult" label-width="220px" label="处理结果：">
                <span v-if="readOnly" class="span-content">{{ fraudEntInfo.bizHandleResult }} </span>
                <el-radio-group v-else v-model="fraudEntInfo.bizHandleResult" class="custom" style="margin-bottom: 10px;width: 80%">
                  <el-radio :label="'撤销设立'">撤销设立</el-radio>
                  <el-radio :label="'撤销变更'">撤销变更</el-radio>
                  <el-radio :label="'撤销注销'">撤销注销</el-radio>
                  <el-radio :label="'终止撤销'">终止撤销</el-radio>
                  <el-radio :label="'不予撤销'">不予撤销</el-radio>
                </el-radio-group>
                <br>
                <span v-if="readOnly" class="span-content">{{ fraudEntInfo.handleResult }} </span>
                <el-input
                  v-else
                  v-model="fraudEntInfo.handleResult"
                  :autosize="{ minRows: 2 }"
                  type="textarea"
                  placeholder="请输入处理结果"
                />
              </el-form-item>
            </el-row>
            <el-row class="bt0">
              <el-form-item prop="_judAuth" label-width="220px" label="作出决定机关">
                <span v-if="readOnly" class="span-content">{{ fraudEntInfo.judAuthCn }}</span>
                <el-select
                  v-else
                  v-model="fraudEntInfo._judAuth"
                  placeholder="请选择"
                  clearable
                  style="width: 80%"
                  class="custom"
                  value-key="value"
                  @change="(item)=>{
                    fraudEntInfo.judAuth = item.value
                    fraudEntInfo.judAuthCn = item.label;
                  }"
                >
                  <el-option
                    v-for="item in judauthList"
                    :key="item.value"
                    :label="item.label"
                    :value="item"
                  />
                </el-select>
              </el-form-item>
            </el-row>
            <el-row class="bt0">
              <el-col :span="24">
                <el-form-item prop="judDate" label="作出决定日期：">
                  <span v-if="readOnly" class="span-content">{{ fraudEntInfo.judDate }}</span>
                  <el-date-picker
                    v-else
                    v-model="fraudEntInfo.judDate"
                    style="display: inline-block"
                    :clearable="false"
                    value-format="yyyy-MM-dd"
                    format="yyyy-MM-dd"
                    size="small"
                    type="date"
                    placeholder="选择日期"
                    :picker-options="{
                      firstDayOfWeek: 1,
                      disabledDate: (date)=>{
                        return date.setHours(0,0,0,0) > (new Date()).setHours(0,0,0,0)
                      }
                    }"
                    @change="
                      (value)=>{
                        if(new Date().valueOf() - new Date(value).valueOf() > 1000*60*60*24*365 ){
                          $confirm(`您选择的日期为${$utils.parseTime(new Date(value), '{yyyy}年{mm}月{dd}日')}，请确认！`,{
                            showClose: false,
                            closeOnClickModal: false,
                            showCancelButton: false
                          })
                        }
                      }
                    "
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row class="bt0">
              <el-form-item label-width="220px" label="公告内容：">
                <span v-if="readOnly" class="span-content">{{ fraudEntInfo.noticeContent }}</span>
                <el-input
                  v-else
                  v-model="fraudEntInfo.noticeContent"
                  :autosize="{ minRows: 2 }"
                  type="textarea"
                  placeholder="请输入公告内容"
                />
              </el-form-item>
            </el-row>
            <!--            <el-row class="bt0">-->
            <!--              <el-col :span="24">-->
            <!--                <el-form-item label="公告日期：">-->
            <!--                  <span v-if="readOnly" class="span-content">{{ fraudEntInfo.noticeDate }}</span>-->
            <!--                  <el-date-picker-->
            <!--                    v-else-->
            <!--                    v-model="fraudEntInfo.noticeDate"-->
            <!--                    style="display: inline-block"-->
            <!--                    :clearable="false"-->
            <!--                    value-format="yyyy-MM-dd"-->
            <!--                    format="yyyy-MM-dd"-->
            <!--                    size="small"-->
            <!--                    type="date"-->
            <!--                    placeholder="选择日期"-->
            <!--                    :picker-options="{-->
            <!--                      firstDayOfWeek: 1,-->
            <!--                      disabledDate: (date)=>{-->
            <!--                        return date.setHours(0,0,0,0) > (new Date()).setHours(0,0,0,0)-->
            <!--                      }-->
            <!--                    }"-->
            <!--                    @change="-->
            <!--                      (value)=>{-->
            <!--                        if(new Date().valueOf() - new Date(value).valueOf() > 1000*60*60*24*365 ){-->
            <!--                          $confirm(`您选择的日期为${$utils.parseTime(new Date(value), '{yyyy}年{mm}月{dd}日')}，请确认！`,{-->
            <!--                            showClose: false,-->
            <!--                            closeOnClickModal: false,-->
            <!--                            showCancelButton: false-->
            <!--                          })-->
            <!--                        }-->
            <!--                      }-->
            <!--                    "-->
            <!--                  />-->
            <!--                </el-form-item>-->
            <!--              </el-col>-->
            <!--            </el-row>-->
            <el-row v-if="fraudEntInfo.bizHandleResult" class="bt0">
              <el-form-item
                prop="fileList3"
                :label="{
                  '撤销设立': '撤销设立决定书',
                  '撤销变更': '撤销变更通知书',
                  '撤销注销': '撤销注销通知书',
                  '终止撤销': '终止撤销通知书',
                  '不予撤销': '不予受理通知书',
                }[fraudEntInfo.bizHandleResult]"
              >
                <el-upload
                  ref="fileList3"
                  :action="uploadPath"
                  :data="uploadBodyData(3)"
                  :on-remove="removeFile"
                  :on-success="uploadCallback"
                  :on-preview="previewFile"
                  :before-upload="beforeFileUpload"
                  :before-remove="beforeRemove"
                  accept=".doc,.docx,.xlsx,.xls,.pdf,.jpg,.zip,.rar,.7z,.png"
                  multiple
                  name="files"
                  :file-list="fileList3"
                  style="max-width:800px;display: inline-block"
                  class="uploadFileList"
                  :disabled="readOnly"
                  :class="{disabled: readOnly}"
                >
                  <div v-if="!readOnly" style="display: inline-block;">
                    <el-button style="display: inline-block;" size="mini" type="primary">点击上传</el-button>
                    <div slot="tip" style="display: inline-block;" class="el-upload__tip">只能上传jpg/png/pdf/doc/docx/xls/xlsx/rar/zip/7z文件，且单个文件不能超过20M</div>
                  </div>
                </el-upload>
              </el-form-item>
            </el-row>
            <el-row v-if="fraudEntInfo.bizHandleResult === '撤销设立' || fraudEntInfo.bizHandleResult === '撤销变更' || fraudEntInfo.bizHandleResult === '撤销注销' " class="bt0">
              <el-col :span="24">
                <el-form-item label="撤销文书号：" prop="canceldocno">
                  <span v-if="readOnly" class="span-content">{{ fraudEntInfo.canceldocno }}</span>
                  <div v-else class="canceldocno-input">
                    <el-input
                      v-model="canceldocno.left"
                      type="text"
                    />
                    〔
                    <el-input
                      v-model="canceldocno.middle"
                      type="text"
                    />
                    〕
                    <el-input
                      v-model="canceldocno.right"
                      type="text"
                    />
                    号
                  </div>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row v-if="fraudEntInfo.bizHandleResult === '撤销设立' || fraudEntInfo.bizHandleResult === '撤销变更' || fraudEntInfo.bizHandleResult === '撤销注销' " class="bt0 autoaddresslock">
              <el-form-item prop="autoaddresslock" label-width="220px" label="该次撤销的企业住所（地址）均是否属于虚假（住宅）地址：">
                <span v-if="readOnly" class="span-content">{{ fraudEntInfo.autoaddresslock === '1'? '是':'否' }}</span>
                <el-select
                  v-else
                  v-model="autoaddresslock"
                  style="width: 80%"
                  class="custom"
                >
                  <el-option
                    v-for="item in autoaddresslockList"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  />
                </el-select>
              </el-form-item>
            </el-row>
            <el-row class="bt0">
              <el-form-item label="案件卷宗上传扫描件">
                <el-upload
                  :action="uploadPath"
                  :data="uploadBodyData(2)"
                  :on-remove="removeFile"
                  :on-success="uploadCallback"
                  :on-preview="previewFile"
                  :before-upload="beforeFileUpload"
                  :before-remove="beforeRemove"
                  accept=".doc,.docx,.xlsx,.xls,.pdf,.jpg,.zip,.rar,.7z,.png"
                  multiple
                  name="files"
                  :file-list="fileList2"
                  style="max-width:800px;display: inline-block"
                  class="uploadFileList"
                  :disabled="readOnly"
                  :class="{disabled: readOnly}"
                >
                  <div v-if="!readOnly" style="display: inline-block;">
                    <el-button style="display: inline-block;" size="mini" type="primary">点击上传</el-button>
                    <div slot="tip" style="display: inline-block;" class="el-upload__tip">只能上传jpg/png/pdf/doc/docx/xls/xlsx/rar/zip/7z文件，且单个文件不能超过20M</div>
                  </div>
                </el-upload>
              </el-form-item>
            </el-row>
            <!-- <el-row v-for="item in opinions" :key="item.opinionid" class="bt0">
              <el-form-item :label="opiniontypeCN(item.opiniontype)">
                <span style="display: block;text-indent: 1em;">{{ item.opinioncontent }}</span>
                <el-col :span="8" :offset="16">
                  <label>{{ opiniontypeCN2(item.opiniontype) }}:</label>
                  <span>{{ item.handler }}</span>
                  <label
                    style="margin-left: 10px"
                  >日期:</label>
                  <span style="display: inline-block">{{ item.handledate | datetime }}</span>
                </el-col>
              </el-form-item>
            </el-row> -->
            <el-row class="bt0">
              <el-form-item v-if="!readOnly" label="处理意见" prop="opinion">
                <el-col :span="24" style="margin-bottom:10px">
                  <el-input
                    v-model="fraudEntInfo.opinion"
                    :autosize="{ minRows: 2 }"
                    type="textarea"
                    placeholder="请输入意见"
                  />
                </el-col>
                <el-col :span="12">
                  <label>常用语</label>
                  <el-select
                    v-model="opinion"
                    placeholder="请选择"
                    clearable
                    style="margin-left: 10px;width: 80%"
                    class="custom"
                  >
                    <el-option
                      v-for="item in opinionOptions"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-col>
              </el-form-item>
            </el-row>
            <el-row class="bt0 p0">
              <el-form-item v-if="!readOnly" label="操作" class="label-lineheight-inherit" prop="nextNodeID">
                <span style="display: inline-block">
                  <el-radio
                    v-for="item in nextSequenceFlowList"
                    :key="item.id"
                    v-model="fraudEntInfo.nextNodeID"
                    :label="item.nextNode.id"
                  >{{ item.name }}</el-radio>
                </span>
              </el-form-item>
            </el-row>
            <el-row class="bt0 p0">
              <el-form-item class="label-lineheight-inherit" label="审批人" prop="reviewer">
                <el-select
                  v-model="fraudEntInfo.reviewer"
                  placeholder="请选择审批人"
                  class="custom"
                  value-key="primaryKey"
                >
                  <el-option
                    v-for="item in reviewer"
                    :key="'reviewer'+item.primaryKey"
                    :label="item.name"
                    :value="item"
                  />
                </el-select>
              </el-form-item>
            </el-row>
          </div>
        </div>
      </el-form>
      <div class="submit-box">
        <el-button v-if="!readOnly" type="primary" :loading="submitLoading" @click="submitForm">提交</el-button>
        <el-button v-if="!readOnly" type="primary" :loading="submitLoading" @click="temporarySave">暂存</el-button>
        <el-button @click="$router.back()">返回</el-button>
      </div>
      <el-dialog
        title="现场核查通知书"
        :visible.sync="editDialog"
        :close-on-click-modal="false"
        width="60%"
        center
      >
        <Editor ref="editorDialog" v-model="editContent" :is-clear="isClear" :is-disable="editorDisable" @getTextVal="getTextVal" />
        <span slot="footer" class="dialog-footer">
          <el-button type="primary" size="mini" :loading="loading" @click="saveTemplate(true,'notice')">保存</el-button>
          <el-button type="primary" size="mini" :loading="loading" @click="print">打印</el-button>
        </span>
      </el-dialog>
    </div>
  </div>
</template>

<script>
import DetailHead from '@/components/DetailHead'
import Editor from '@/components/editor.vue'
import { listFile, removeAttachementById } from '@/api/attachment'
import { saveOrUpdateRevContent, getRevContentsWithBizseq } from '@/api/revoke'
import {
  getAllDepts,
  getBusFraudInfo,
  getConstant,
  getEntBaseInfoByCode,
  getSteps,
  processControlEasyTFraud,
  temporarySave,
  getTempInfo
} from '@/api/personate'
import { validBeforeUpload } from '@/api/fileUpload'
import { queryEAlterByEntNo } from '@/api/comprehensive'
import { checkPhoneNumber, checkIdNum, uniSCID } from '@/utils/rules'
import { getUsersWithPermission } from '@/api/user'

export default {
  components: {
    Editor: Editor,
    DetailHead
  },
  data() {
    return {
      fullscreenLoading: false,
      onlyShow: '',
      judauthList: [],
      handlreaList: [],
      uploadPath: `${process.env.VUE_APP_BASE_API}/fraudReg/process/upload`,
      showEntbase: false,
      bizseq: '',
      workflowId: '',
      tasklistid: '',
      personateid: '',
      editDialog: false,
      certypeList2: [
        {
          value: '企业',
          label: '企业'
        },
        {
          value: '个体户',
          label: '个体户'
        },
        {
          value: '农合',
          label: '农合'
        }
      ],
      editContent: '',
      dialogTitle: '新增',
      form: {
        uniscid: '',
        regno: '',
        searchCode: '',
        entname: '',
        certype: '',
        handlrea: '',
        judauth: '',
        regorgCn: '',
        noticefrom: '',
        noticeto: '',
        judDate: '',
        cerno: '',
        opiniontype: '',
        complaintType: '', // 投诉事由
        complaintReason: '', // 投诉原因
        reason: '', // 投诉是由
        opinion: '', // 意见
        nextNodeID: '',
        complainerType: '',
        complainerCertType: '',
        personateid: '',
        uniScId: ''
      },
      opinion: '',
      // 意见-经办人
      handleOpinion: {
        handler: '',
        handleDate: '',
        opinionContent: ''
      },
      // 意见-审核人
      reviewOpinion: {
        handler: '',
        handleDate: '',
        opinionContent: ''
      },
      // 意见-审批人
      approvalOpinion: {
        handler: '',
        handleDate: '',
        opinionContent: ''
      },
      formRules: {
        _handlrea: [
          { required: true, message: '请选择处理原因', trigger: 'blur' }
        ],
        businessType: [
          { required: true, message: '请选择业务类型' }
        ],
        handleResult: [
          { required: true, message: '请输入处理结果', trigger: 'blur' }
        ],
        _judAuth: [
          { required: true, message: '请选择作出决定机关', trigger: 'blur' }
        ],
        judDate: [
          { required: true, message: '请选择作出决定日期', trigger: 'blur' }
        ],
        nextNodeID: [
          { required: true, message: '请选择下一步操作', trigger: 'blur' }
        ],
        fileList3: [
          { required: true, validator: this.validateFile }
        ],
        casePerformerId: [
          { required: true, message: '请选择检查接收人', trigger: 'blur' }
        ],
        fraudPersonInfo: [
          { required: true, validator: (rule, value, callback) => {
            if (!this.fraudEntInfo.fraudPersonInfoName) {
              callback('请输入被投诉企业委托代理人姓名')
            } else if (!this.fraudEntInfo.fraudPersonInfoCertType) {
              callback('请选择委托代理人证件类型')
            } else if (!this.fraudEntInfo.fraudPersonInfoCertNo) {
              callback('请输入委托代理人证件号码')
            } else if (this.fraudEntInfo.fraudPersonInfoCertType === '中华人民共和国居民身份证') {
              checkIdNum(rule, this.fraudEntInfo.fraudPersonInfoCertNo, callback)
            } else {
              callback()
            }
          } }
        ],
        isCase: [
          { required: true, message: '请选择是否发起现场核查', trigger: 'blur' }
        ],
        complaintReason: [
          { required: true, message: '请选择投诉原因', trigger: 'change' }
        ],
        regItem: [
          { required: true, message: '请输入冒名登记事项', trigger: 'blur' }
        ],
        tel: [
          { required: true, message: '请输入登记机关联系方式', trigger: 'blur' }
        ],
        complainerType: [
          { required: true, message: '请选择投诉人类型' }
        ],
        complainerName: [
          { required: true, message: '请输入投诉人姓名/法定代表人/来函单位名称', trigger: 'blur' }
        ],
        complainerCertType: [
          { required: true, message: '请选择证件类型/主体类型', trigger: 'blur' }
        ],
        // contactsPhone: [
        //   { required: true, message: '请输入联系电话', trigger: 'blur' },
        //   // { validator: (rule, value, callback) => {
        //   //   checkPhoneNumber(rule, value, callback)
        //   // }, trigger: 'blur' }
        // ],
        complainerCertNo: [
          { required: true, message: '请输入证件号码/统一社会信用代码', trigger: 'blur' },
          { validator: (rule, value, callback) => {
            if (this.fraudEntInfo.complainerCertType === '1' && this.fraudEntInfo.complainerType === '0') {
              checkIdNum(rule, value, callback)
            } else if (this.fraudEntInfo.complainerType === '1') {
              uniSCID.validator(rule, value, callback)
            } else {
              callback()
            }
          }, trigger: 'blur' }
        ],
        complainerEntName: [
          { required: true, message: '请输入主体名称', trigger: 'blur' }
        ],
        complainerLegalPhone: [
          { required: true, message: '请输入法定代表人联系电话', trigger: 'blur' },
          { validator: (rule, value, callback) => {
            checkPhoneNumber(rule, value, callback)
          }, trigger: 'blur' }
        ],
        contacts: [
          { required: true, message: '请输入联系人', trigger: 'blur' }
        ],
        phoneNum: [
          { required: true, message: '请输入联系电话', trigger: 'blur' },
          { validator: (rule, value, callback) => {
            checkPhoneNumber(rule, value, callback)
          }, trigger: 'blur' }
        ],
        certype: [
          { required: true, message: '请选择证件类型', trigger: 'blur' }
        ],
        name: [
          { required: true, message: '请输入姓名', trigger: 'blur' }
        ],
        uniScId: [
          { required: true, message: '请输入统一码', trigger: 'blur' }
        ],
        reviewer: [
          { required: true, message: '请选择后续处理人' }
        ],
        canceldocno: [
          { required: true, validator: (rule, value, callback) => {
            if (!this.canceldocno.left || !this.canceldocno.middle || !this.canceldocno.right) {
              callback('请输入撤销文书号')
            } else {
              callback()
            }
          } }
        ],
        noticeFrom: [
          { required: true, message: '请选择公告期自', trigger: 'blur' }
        ],
        noticeTo: [
          { required: true, message: '请选择公告期至', trigger: 'blur' }
        ]
      },
      opinionOptions: [],
      eAlterRecoder: [],
      selectedRecords: [], // 新增的选中数据列表
      pripid: '',
      historyLog: [],
      certypeList: [],
      exmainerOptions: [],
      fileList: [],
      fileList0: [],
      fileList2: [],
      fileList3: [],
      user: JSON.parse(sessionStorage.getItem('user')),
      reviewer: [],
      submitLoading: false,
      complaintTypeStr: '',
      nextNodeID: '',
      nextSequenceFlowList: [],
      entInfo: {},
      fraudCheckInfo: {},
      bizFraudInfo: {},
      fraudEntInfo: {},
      opinions: [],
      readOnly: false,
      tswrittemplate: {
        content: '',
        bizseq: '',
        writsType: '',
        isTemplate: '',
        needTemplate: ''
      },
      isClear: false, // 清除富文本编辑器内容
      editorDisable: false,
      loading: false,
      printContent: '',
      canceldocno: { // 撤销文书号拼接
        left: '',
        middle: '',
        right: ''
      },
      autoaddresslock: '0', // 该次撤销的企业住所（地址）均是否属于虚假（住宅）地址
      autoaddresslockList: [{
        value: '0',
        label: '否'
      }, {
        value: '1',
        label: '是'
      }
      ],
      tempSaveId: ''
    }
  },
  computed: {
    certype() {
      return (value) => {
        const target = this.certypeList.find((item) => {
          return item.value === value
        })
        return target ? target.label : ''
      }
    },
    uploadBodyData() {
      return (attachType) => {
        return {
          attachType,
          id: this.bizseq
        }
      }
    },
    opiniontypeCN() {
      return (value) => {
        return {
          '1': '经办',
          '2': '审核',
          '3': '审批'
        }[value]
      }
    }
  },
  watch: {
    // 监听通过单选框给表单nextNodeID赋值
    'nextNodeID': {
      handler(newVal, oldVal) {
        this.$set(this.form, 'nextNodeID', newVal)
        this.$refs.form.validateField('nextNodeID')
      },
      deep: true
    },
    // 意见渲染
    opinion() {
      let name = ''
      this.opinionOptions.forEach(each => {
        if (this.opinion === each.value) {
          name = each.label
        }
      })
      if (this.$util.isNotEmpty(name)) {
        this.$set(this.fraudEntInfo, 'opinion', name)
        this.$refs.form.validateField('opinion')
      }
    }
  },
  mounted() {
    this.bizseq = this.$route.query.bizseq // 获取跳转携带的参数bizseq
    this.workflowId = this.$route.query.workflowId
    this.readOnly = this.$route.query.onlyShow === 'true'
    // 加载常用语
    this.opinionOptions = this.$util.getCommonWordsWithModule(this.user.primaryKey, '撤销登记案件')
    // 加载处理原因
    const p1 = getConstant('CD96').then(res => {
      if (res.code === 0) {
        const list = []
        res.data.forEach(each => {
          list.push({
            value: each.code,
            label: each.name
          })
        })
        this.handlreaList = list
      }
    })
    // 加载证件类型
    const p2 = getConstant('CB16').then(res => {
      if (res.code === 0) {
        const list = []
        res.data.forEach(each => {
          list.push({
            value: each.code,
            label: each.name
          })
        })
        this.certypeList = list
      }
    })
    // 加载决定机关
    const p3 = getAllDepts().then(res => {
      if (res.code === 0) {
        this.judauthList = res.data.map((item) => {
          return {
            value: item.code,
            label: item.name
          }
        })
        return getBusFraudInfo({
          bizSeq: this.bizseq,
          workflowId: this.$route.query.workflowId,
          readOnly: this.readOnly ? '1' : '0'
        })
      }
    }).then(res => {
      if (res.code === 0) {
        this.bizFraudInfo = res.data.bizFraudInfo || {}
        this.fraudPersonInfo = res.data.fraudPersonInfo || {}
        this.fraudCheckInfo = res.data.fraudCheckInfo || {}
        this.autoaddresslock = res.data.fraudEntInfo.autoaddresslock || '0'
        const canceldocno = res.data.fraudEntInfo.canceldocno || ''
        const matchResult = canceldocno.match(/(.*?)〔(.*)〕(.*)/)
        if (matchResult) {
          this.canceldocno.left = matchResult[1] || ''
          this.canceldocno.middle = matchResult[2] || ''
          this.canceldocno.right = matchResult[3] ? matchResult[3].slice(0, -1) : ''
        }
        this.fraudEntInfo = {
          ...res.data.fraudEntInfo,
          _judAuth: res.data.fraudEntInfo.judAuthCn,
          bizHandleResult: this.bizFraudInfo.bizHandleResult,
          complaintReason: this.bizFraudInfo.complaintReason,
          fraudPersonInfoName: this.fraudPersonInfo.certNo ? this.fraudPersonInfo.name : '',
          fraudPersonInfoCertType: this.fraudPersonInfo.certType,
          fraudPersonInfoCertNo: this.fraudPersonInfo.certNo,
          isCase: this.bizFraudInfo.isCase,
          remarks: this.fraudCheckInfo.remarks,
          content: this.fraudCheckInfo.content,
          complainerType: this.bizFraudInfo.complainerType,
          complainerCertNo: this.bizFraudInfo.complainerCertNo,
          complainerCertType: this.bizFraudInfo.complainerCertType,
          complainerEntName: this.bizFraudInfo.complainerEntName,
          complainerLegalPhone: this.bizFraudInfo.complainerLegalPhone,
          complainerName: this.bizFraudInfo.complainerName,
          contacts: this.bizFraudInfo.contacts,
          contactsPhone: this.bizFraudInfo.contactsPhone,
          _handlrea: res.data.fraudEntInfo.handleReaCn,
          businessType: res.data.bizFraudInfo.businessType,
          complainerRegOrg_cn: this.fraudEntInfo.regOrgCn
        }
        if (!this.fraudEntInfo.judAuth) {
          const user = JSON.parse((sessionStorage.getItem('user')))
          const judAuth = this.judauthList.find((item) => {
            return item.label === user.orgName
          })
          if (judAuth) {
            this.$set(this.fraudEntInfo, '_judAuth', judAuth)
            this.fraudEntInfo.judAuth = judAuth.value
            this.fraudEntInfo.judAuthCn = judAuth.label
          }
        }
        this.opinions = res.data.opinions || {}
        this.nextSequenceFlowList = (res.data.nextSequenceFlowList || []).map((item) => {
          return {
            ...item,
            loading: false
          }
        })
        return getEntBaseInfoByCode({
          code: this.fraudEntInfo.uniScId
        })
      }
    }).then((res) => {
      if (res.code === 0) {
        this.entInfo = res.data
        queryEAlterByEntNo(
          res.data.pripid
        ).then(resa => {
          const data = resa.data
          const list = []
          let index = 0
          data.forEach(each => {
            each.index = ++index
            list.push(each)
          })
          this.eAlterRecoder = list
          return true
        })
      }
      this.fraudEntInfo.complainantCertype = this.$util.enumFormatter(this.certypeList, res.data.complainantCertype)
      getTempInfo(this.bizseq, '撤销登记案件', '录入-待受理').then(res => {
        if (res.data) {
          const tempInfo = JSON.parse(res.data.dataJson)
          console.log(tempInfo)
          this.fraudEntInfo._judAuth = tempInfo._judAuth,
          this.fraudEntInfo.bizHandleResult = tempInfo.bizHandleResult,
          this.fraudEntInfo.complaintReason = tempInfo.complaintReason,
          this.fraudEntInfo.regTime = tempInfo.regTime,
          this.fraudEntInfo.regItem = tempInfo.regItem,
          this.fraudEntInfo.tel = tempInfo.tel,
          this.fraudEntInfo.noticeFrom = tempInfo.noticeFrom,
          this.fraudEntInfo.noticeTo = tempInfo.noticeTo,
          this.fraudEntInfo.fraudPersonInfoName = tempInfo.fraudPersonInfoName,
          this.fraudEntInfo.fraudPersonInfoCertType = tempInfo.fraudPersonInfoCertType,
          this.fraudEntInfo.fraudPersonInfoCertNo = tempInfo.fraudPersonInfoCertNo,
          this.fraudEntInfo.isCase = tempInfo.isCase,
          this.fraudEntInfo.remarks = tempInfo.remarks,
          this.fraudEntInfo.content = tempInfo.content,
          this.fraudEntInfo.complainerType = tempInfo.complainerType,
          this.fraudEntInfo.complainerCertNo = tempInfo.complainerCertNo,
          this.fraudEntInfo.complainerCertType = tempInfo.complainerCertType,
          this.fraudEntInfo.complainerEntName = tempInfo.complainerEntName,
          this.fraudEntInfo.complainerLegalPhone = tempInfo.complainerLegalPhone,
          this.fraudEntInfo.complainerName = tempInfo.complainerName,
          this.fraudEntInfo.contacts = tempInfo.contacts,
          this.fraudEntInfo.contactsPhone = tempInfo.contactsPhone,
          this.fraudEntInfo.complainerRegOrg_cn = tempInfo.complainerRegOrg_cn,
          this.fraudEntInfo.handleResult = tempInfo.handleResult,
          this.fraudEntInfo.judDate = tempInfo.judDate,
          this.fraudEntInfo.noticeContent = tempInfo.noticeContent,
          this.fraudEntInfo.noticeDate = tempInfo.noticeDate,
          this.canceldocno.left = tempInfo.canceldocnoLeft,
          this.canceldocno.middle = tempInfo.canceldocnoMiddle,
          this.canceldocno.right = tempInfo.canceldocnoRight,
          this.autoaddresslock = tempInfo.autoaddresslock,
          this.$set(this.fraudEntInfo, 'opinion', tempInfo.opinion),
          this.fraudEntInfo._handlrea = tempInfo._handlrea,
          this.fraudEntInfo.businessType = tempInfo.businessType
          this.$nextTick(() => {
            // 使用 $nextTick 确保组件更新后再触发 change 事件
            this.$refs.reaSelect.$emit('change', this.fraudEntInfo._handlrea)
          })
          this.tempSaveId = res.data.id
          console.log(this.fraudEntInfo)
        }
      })
    })
    const p4 = listFile({
      attachType: '0',
      id: this.bizseq
    }).then(({ data }) => {
      this.fileList0 = data.map((item) => {
        return {
          ...item,
          id: item.attachmentid,
          name: item.filename,
          url: `${process.env.VUE_APP_BASE_API}/attachment/download?id=${item.id}`
        }
      })
    })
    const p5 = listFile({
      attachType: '1',
      id: this.bizseq
    }).then(({ data }) => {
      this.fileList = data.map((item) => {
        return {
          ...item,
          id: item.attachmentid,
          name: item.filename,
          url: `${process.env.VUE_APP_BASE_API}/attachment/download?id=${item.id}`
        }
      })
    })
    const p6 = listFile({
      attachType: '2',
      id: this.bizseq
    }).then(({ data }) => {
      this.fileList2 = data.map((item) => {
        return {
          ...item,
          id: item.attachmentid,
          name: item.filename,
          url: `${process.env.VUE_APP_BASE_API}/attachment/download?id=${item.id}`
        }
      })
    })
    const p7 = listFile({
      attachType: '3',
      id: this.bizseq
    }).then(({ data }) => {
      this.fileList3 = data.map((item) => {
        return {
          ...item,
          id: item.attachmentid,
          name: item.filename,
          url: `${process.env.VUE_APP_BASE_API}/attachment/download?id=${item.id}`
        }
      })
    })
    const p8 = getSteps({ bizSeq: this.bizseq }).then(res => {
      const { data } = res
      if (data != null && data.status === '4') {
        this.$notify.info({
          title: '业务提示',
          message: '现场核查业务已办结',
          offset: 100,
          duration: 0
        })
      }
    })
    const p9 = this.loadReviewer()
    this.fullscreenLoading = true
    Promise.all([p1, p2, p3, p4, p5, p6, p7, p8, p9]).finally(() => {
      this.fullscreenLoading = false
    })
  },
  methods: {
    temporarySave() {
      const tempData = {
        _judAuth: this.fraudEntInfo._judAuth,
        bizHandleResult: this.fraudEntInfo.bizHandleResult,
        complaintReason: this.fraudEntInfo.complaintReason,
        regTime: this.fraudEntInfo.regTime,
        regItem: this.fraudEntInfo.regItem,
        tel: this.fraudEntInfo.tel,
        noticeFrom: this.fraudEntInfo.noticeFrom,
        noticeTo: this.fraudEntInfo.noticeTo,
        fraudPersonInfoName: this.fraudEntInfo.fraudPersonInfoName,
        fraudPersonInfoCertType: this.fraudEntInfo.fraudPersonInfoCertType,
        fraudPersonInfoCertNo: this.fraudEntInfo.fraudPersonInfoCertNo,
        isCase: this.fraudEntInfo.isCase,
        remarks: this.fraudEntInfo.remarks,
        content: this.fraudEntInfo.content,
        complainerType: this.fraudEntInfo.complainerType,
        complainerCertNo: this.fraudEntInfo.complainerCertNo,
        complainerCertType: this.fraudEntInfo.complainerCertType,
        complainerEntName: this.fraudEntInfo.complainerEntName,
        complainerLegalPhone: this.fraudEntInfo.complainerLegalPhone,
        complainerName: this.fraudEntInfo.complainerName,
        contacts: this.fraudEntInfo.contacts,
        contactsPhone: this.fraudEntInfo.contactsPhone,
        _handlrea: this.fraudEntInfo._handlrea,
        businessType: this.fraudEntInfo.businessType,
        complainerRegOrg_cn: this.fraudEntInfo.complainerRegOrg_cn,
        handleResult: this.fraudEntInfo.handleResult,
        judDate: this.fraudEntInfo.judDate,
        noticeContent: this.fraudEntInfo.noticeContent,
        noticeDate: this.fraudEntInfo.noticeDate,
        canceldocnoLeft: this.canceldocno.left,
        canceldocnoMiddle: this.canceldocno.middle,
        canceldocnoRight: this.canceldocno.right,
        autoaddresslock: this.autoaddresslock,
        opinion: this.fraudEntInfo.opinion
      }

      const param = {
        id: this.tempSaveId,
        bizseq: this.bizseq,
        module: '撤销登记案件',
        flow: '录入-待受理',
        data: tempData,
        creator: this.user.nickname,
        creator_id: this.user.primaryKey
      }
      temporarySave(param).then((res) => {
        if (res.code === 0) {
          this.tempSaveId = res.data
          this.$message.success('提交成功')
        } else {
          throw res
        }
      })
    },
    validateFile(rule, value, callback) {
      const files = this.$refs.fileList3.uploadFiles
      if (!files.length) {
        callback(new Error('请选择要上传的通知书!'))
      }
      callback()
    },
    toEntDetail(uniscid) {
      this.$router.push({
        path: '/comprehensive/details',
        query: {
          pripid: this.entInfo.pripid
        }
      })
    },
    uploadCallback(res, file) {
      if (res.code === 0) {
        file.id = res.data[0].attachmentid
        file.name = res.data[0].filename
        file.url = `${process.env.VUE_APP_BASE_API}/attachment/download?id=${res.data[0].id}`
        this.$message.success('上传成功')
      }
    },
    removeFile(file) {
      if (file && file.status === 'success') {
        removeAttachementById(file.id).then(res => {
          if (res.code === 0) {
            this.$message.success('删除成功')
          } else {
            this.$message.error(res.msg)
          }
        })
      }
    },
    beforeFileUpload(file) {
      return validBeforeUpload(file, this)
    },
    beforeRemove(file, fileList) {
      if (file && file.status === 'success') {
        return this.$confirm(`确定移除 ${file.name} ？`)
      }
    },
    previewFile(file) {
      window.open(`${process.env.VUE_APP_BASE_API}/attachment/download?id=${file.id}`, '_blank')
    },
    // 点击文件列表中已上传文件进行下载
    handlePreview(file) {
      var a = document.createElement('a')
      var event = new MouseEvent('click')
      a.download = file.name
      a.href = file.url
      a.dispatchEvent(event)
    },
    isCaseChangeEvent() {
      if (this.fraudEntInfo.isCase === '1') {
        this.getCaseReport()
      }
    },
    // 获取现场核查通知书
    getCaseReport() {
      this.tswrittemplate.bizseq = this.bizseq
      this.tswrittemplate.writsType = '42'
      this.tswrittemplate.needTemplate = '1'
      return getRevContentsWithBizseq(this.tswrittemplate).then(res => {
        if (res.code === 0) {
          this.$nextTick(() => {
            this.$set(this.tswrittemplate, 'content', res.data.content.replace(new RegExp('{{complainerName}}', 'g'), this.fraudEntInfo.complainerName)
              .replace(new RegExp('{{entName}}', 'g'), this.fraudEntInfo.entName)
              .replace(new RegExp('{{dom}}', 'g'), this.entInfo.dom)
              .replace(new RegExp('{{orgName}}', 'g'), this.user.orgName))
            this.$set(this.tswrittemplate, 'isTemplate', res.data.isTemplate)
          })
        }
      })
    },
    openDialog() {
      this.editDialog = true
      // this.clearEditorContent()
      this.$nextTick(() => {
        this.editContent = this.tswrittemplate.content
      })
    },
    // 打印
    print() {
      const html = '<div id="printPaper" class="printPaper">' + this.tswrittemplate.content + '</div>'
      const printHtml = html// 获取到要打印的节点内容
      window.document.body.innerHTML = printHtml// 把打印内容赋值给页面内容

      window.print()// 调用打印方法
      window.location.reload()// 打印之后页面重新加载
    },
    // 保存模板编辑内容
    async saveTemplate(alertMsg, type) {
      // console.log(this.hearingNoticeInfo)
      this.loading = true
      let resData = false
      if (type === 'notice') {
        this.tswrittemplate.content = this.editContent
        await saveOrUpdateRevContent(this.tswrittemplate).then(res => {
          resData = res.data
          this.tswrittemplate.isTemplate = resData ? '0' : '1'
        })
      }
      this.loading = false
      if (resData === true) {
        this.editDialog = false
        if (alertMsg) {
          this.$message.success('保存成功')
        }
      } else {
        if (alertMsg) {
          return this.$message.error('保存失败')
        } else {
          return false
        }
      }
    },
    getEditorText() {
      this.$refs.editorDialog.$emit('getText')
    },
    getTextVal(res) {
      this.printContent = res
      console.log(this.printContent)
    },
    tableRowClassName({ row, rowIndex }) {
      if (rowIndex % 2 === 1) {
        return 'warning-row'
      }
    },
    handleProcess(row, flag) {
      // 将选中的行数据添加到selectedRecords数组中
      if (flag === '1') { // 假设'1'代表变更撤销
        // 将scope.row添加到selectedRecords数组中
        this.selectedRecords.push({ ...row }) // 使用{...row}进行浅拷贝，以避免直接修改原始数据
        // 在selectedRecords数组中找到刚刚添加的那一行（通常是最后一行）
        const selectedRow = this.selectedRecords[this.selectedRecords.length - 1]
        // 交换变更前和变更后的值
        const tempBe = selectedRow.altbe
        selectedRow.altbe = selectedRow.altaf
        selectedRow.altaf = tempBe
      } else if (flag === '2') {
        // 将scope.row添加到selectedRecords数组中
        this.selectedRecords.push({ ...row }) // 使用{...row}进行浅拷贝，以避免直接修改原始数据
        // 在selectedRecords数组中找到刚刚添加的那一行（通常是最后一行）
        const selectedRow = this.selectedRecords[this.selectedRecords.length - 1]
        // 交换变更前和变更后的值
        selectedRow.altbe = '行政撤销'
        selectedRow.altaf = ''
      }
    },
    removeSelectedRecord(index) {
      // 使用 splice 方法删除该行
      this.selectedRecords.splice(index, 1)
    },
    async clearEditorContent(type) {
      if (this.$refs.editorDialog && type !== this.editorDialogType) {
        await this.$refs.editorDialog.$emit('clear')
      }
    },
    queryComplainerCertNo() {
      getEntBaseInfoByCode({
        code: this.fraudEntInfo.complainerCertNo
      }).then(res => {
        if (res.code === 0) {
          this.$set(this.fraudEntInfo, 'complainerEntName', res.data.entname)
          if (res.data.enttype === '9910') {
            this.$set(this.fraudEntInfo, 'complainerCertType', '个体户')
          } else if (['9100', '9200'].includes(res.data.enttype)) {
            this.$set(this.fraudEntInfo, 'complainerCertType', '农合')
          } else {
            this.$set(this.fraudEntInfo, 'complainerCertType', '企业')
          }
          this.$set(this.fraudEntInfo, 'complainerName', res.data.lerep)
          this.$set(this.fraudEntInfo, 'complainerLegalPhone', res.data.phone)
          this.$set(this.fraudEntInfo, 'complainerRegOrg_cn', res.data.regorgCn)
          return true
        } else {
          this.$message.error('加载主体信息失败')
          return false
        }
      })
    },
    // 加载审核人
    loadReviewer() {
      getUsersWithPermission('approvalLrCancel', this.user.orgId).then(res => {
        if (res.code === 0) {
          this.reviewer = res.data
        }
      })
    },
    submitForm() {
      if (this.fraudEntInfo.nextNodeID === 'cancelCase') {
        this.$confirm('是否确认提交？', '提示', {
          beforeClose: (action, instance, done) => {
            if (action === 'confirm') {
              instance.confirmButtonLoading = true
              processControlEasyTFraud({
                selectedRecords: this.selectedRecords, // 这里是你要发送的selectedRecords数组
                nextNodeID: this.fraudEntInfo.nextNodeID,
                complaintReason: '无效参数',
                bizSeq: this.bizseq
              }).then((res) => {
                if (res.code === 0) {
                  this.$message.success('提交成功')
                  this.$router.push('/todo/list')
                } else {
                  throw res
                }
              }).finally(() => {
                instance.confirmButtonLoading = false
                done()
              })
            } else if (!instance.confirmButtonLoading) {
              done()
            }
          }
        })
      } else if (this.fraudEntInfo.nextNodeID == 'approvalLrCancel') {
        this.$refs.form.validate((valid, rules) => {
          if (!valid) {
            this.$message.warning(rules[Object.keys(rules)[0]][0].message)
            return
          }
          this.$confirm(`是否确认提交？`, '提示', {
            beforeClose: (action, instance, done) => {
              if (action === 'confirm') {
                instance.confirmButtonLoading = true
                if (this.fraudEntInfo.bizHandleResult === '撤销设立') { // 撤销设立增加参数（撤销文书号 和 该次撤销的企业住所（地址）均是否属于虚假（住宅）地址）
                  this.fraudEntInfo.canceldocno = this.canceldocno.left + '〔' + this.canceldocno.middle + '〕' + this.canceldocno.right + '号'
                  this.fraudEntInfo.autoaddresslock = this.autoaddresslock
                }
                processControlEasyTFraud({
                  fraudEntInfo: this.fraudEntInfo,
                  fraudCheckInfo: {
                    content: this.fraudEntInfo.content,
                    notice: this.fraudEntInfo.notice,
                    remarks: this.fraudEntInfo.remarks
                  },
                  fraudPersonInfo: {
                    ...this.fraudPersonInfo,
                    name: this.fraudEntInfo.fraudPersonInfoName,
                    certType: this.fraudEntInfo.fraudPersonInfoCertType,
                    certNo: this.fraudEntInfo.fraudPersonInfoCertNo
                  },
                  bizFraudInfo: {
                    ...this.fraudEntInfo,
                    complainerType: this.fraudEntInfo.complainerType,
                    complainerName: this.fraudEntInfo.complainerName,
                    contactsPhone: this.fraudEntInfo.contactsPhone,
                    complainerCertType: this.fraudEntInfo.complainerCertType,
                    complainerCertNo: this.fraudEntInfo.complainerCertNo,
                    complainerEntName: this.fraudEntInfo.complainerEntName,
                    complainerLegalPhone: this.fraudEntInfo.complainerLegalPhone,
                    contacts: this.fraudEntInfo.contacts
                  },
                  nextNodeID: this.fraudEntInfo.nextNodeID,
                  complaintReason: this.fraudEntInfo.complaintReason,
                  bizHandleResult: this.fraudEntInfo.bizHandleResult,
                  bizSeq: this.bizseq,
                  opinion: {
                    opiniontype: '2',
                    opinioncontent: this.fraudEntInfo.opinion
                  },
                  nextPerformerIds: this.fraudEntInfo.nextNodeID === 'startLrAccept' ? [] : [this.fraudEntInfo.reviewer.primaryKey],
                  nextPerformerNames: this.fraudEntInfo.nextNodeID === 'startLrAccept' ? [] : [this.fraudEntInfo.reviewer.name],
                  isCase: this.fraudEntInfo.isCase,
                  selectedRecords: this.selectedRecords // 这里是你要发送的selectedRecords数组
                }).then((res) => {
                  if (res.code === 0) {
                    this.$message.success('提交成功')
                    this.$router.push('/todo/list')
                  } else {
                    throw res
                  }
                }).finally(() => {
                  instance.confirmButtonLoading = false
                  done()
                })
              } else if (!instance.confirmButtonLoading) {
                done()
              }
            }
          })
        })
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.el-row.flex-row{
  display: flex;
  .el-col{
    display: flex;
    .el-form-item{
      width: 100%;
      display: flex;
      /deep/ .el-form-item__label{
        flex-shrink: 0;
      }
      /deep/ .el-form-item__content{
        width: 100%;
        min-height: 60px;
      }
    }
  }
}
.uploadFileList.disabled{
  /deep/ .el-upload{
    display: none;
  }
}
.el-form-item{
  position: relative;
  /deep/ .el-form-item__label{
    line-height: 40px;
    height: 100%;
    position: absolute;
  }
}
.main-content{
  font-size: $table-content-font-size;
  .back-btn{
    position:absolute;
    right:40pt;
  }
  .content-header,.content-body{
    background: white;
    padding:20PX 10PX;
    border:1PX solid #eee;
  }
  .content-header{
    height:60PX;
    .title{
      font-weight: 700;
      font-size: $font-size-sub-title;
    }
  }
  .content-body{
    padding:20pt;
      .tab{
        .tab-title{
          text-align: left;
          padding-left: 20px;
          label{
            color: #000;
            font-weight: bold;
            display:inline-block;
          }
        }
      }
    .form{
      margin-bottom: 20pt;
    }
  }
  .span-content{
    display: inline-block;
    text-indent: 1em;
  }
}
.canceldocno-input{
  /deep/ .el-input{
    width: 150px;
  }
  /deep/ .el-input__inner{
    border-radius: 0px;
    border-top-width: 0px;
    border-left-width: 0px;
    border-right-width: 0px;
    border-bottom-width: 1px;
  }
}
.autoaddresslock{
  /deep/ .el-form-item .el-form-item__label {
    position: inherit;
}
}
</style>
<style lang="scss">
.main-content.abnormal{
  .el-form-item{
    margin-bottom:0;
    background: $color-form-label;
    .el-form-item__label{
      padding-left: 20px;
      border-top: 1px solid $color-border;
      border-left: 1px solid $color-border;
      font-size: $table-content-font-size;
    }
    .el-form-item__content{
      font-size: 16px;
      background: white;
      padding: 10px;
      border-top: 1px solid $color-border;
      border-right: 1px solid $color-border;
      border-left: 1px solid $color-border;
      font-size: $table-content-font-size;
      // min-height: 60px;
    }
  }
  .el-form-item:last-child{
    border-bottom: 1px solid $color-border;
  }
  .form-body.history{
    padding:15px;
    border:1px solid $color-border;
  }

  .el-form-item.is-error .custom .el-input__inner{
    border-color:$color-border;
  }
  .el-table-column--selection .cell {
    padding-right: 0px;
  }
  .no {
    padding-left: 0px;
  }
  .el-table_9_column_61.is-left.is-leaf{
    .cell{
      padding-left: 0px;
      padding-right: 0px;
    }
  }
  .el-pagination{
    text-align: right;
  }
  .dialog-box{
    text-align: right;
  }
  .el-textarea.is-disabled .el-textarea__inner{
    color: #1c1e23;
  }
.el-input.is-disabled .el-input__inner

  .el-input__inner{
    margin-bottom: 5px;
    width: 50%;
  }
}
</style>
