<template>
  <div class="main-content credit">
    <!-- <div class="content-header">
      <span class="title">严重违法名录移出：经办</span>
      <el-button type="warning" icon="el-icon-caret-left" size="mini" class="back-btn" @click="$router.back()">返回上一层</el-button>
    </div> -->

    <div class="content-body">
      <el-tabs v-model="activeName" type="border-card" class="tabs" style="font-size:unset" @tab-click="handleClick">
        <el-tab-pane label="信用修复申请信息" name="first">
          <div class="table-title">
            <img src="../../../assets/images/icon01.png" alt="" style="width:24px;margin-right:10px">
            信用修复申请信息
          </div>
          <div>
            <table
              width="100%"
              class="apply-table"
              style="border-collapse: collapse;"
              border="1"
              cellpadding="0"
              cellspacing="0"
            >
              <tr>
                <th width="20%">注册号/企业统一信用代码</th>
                <td>
                  <el-link type="primary" style="font-size:16px" @click="seeDetail(companyInfo.priPID)">{{ companyInfo.uscc }}</el-link>
                </td>
              </tr>
              <tr>
                <th>企业名称</th>
                <td>
                  {{ companyInfo.entName }}
                </td>
              </tr>
              <tr>
                <th>申请时间</th>
                <td colspan="2">{{ companyInfo.applyTime }}</td>
              </tr>
              <tr>
                <th>法定代表人/经营者</th>
                <td colspan="2">{{ companyInfo.lerep }}</td>
              </tr>
              <template v-if="appOrPc === '0'">
                <tr>
                  <th>申请人</th>
                  <td colspan="2">
                    {{ companyInfo.applicant }}
                  </td>
                </tr>
              </template>
              <template v-if="appOrPc === '1'">
                <tr>
                  <th>申请人</th>
                  <td colspan="2">
                    <el-input v-model="applicant" style="width:100%" />
                  </td>
                </tr>
              </template>
              <tr>
                <th>列入时间</th>
                <td>
                  {{ tsSerIllegalList.abntime }}
                </td>
              </tr>
              <tr>
                <th>列入原因</th>
                <td>
                  {{ tsSerIllegalList.lostcreditexplain }}
                </td>
              </tr>
              <tr>
                <th>列入单位</th>
                <td>
                  {{ tsSerIllegalList.decorgCn }}
                </td>
              </tr>
            </table>
            <table
              width="100%"
              class="apply-table"
              style="border-collapse: collapse;"
              border="1"
              cellpadding="0"
              cellspacing="0"
            >
              <tr>
                <!--<th rowspan="5" width="20%">移出严重违法失信企业名单证据材料</th>-->
                <th rowspan="6" width="20%">证据材料</th>
                <td>
                  <el-row>
                    <el-col :span="14">1、信用修复申请书</el-col>
                    <el-col :span="10">
                      <el-upload
                        :action="uploadUrl + '/attachment/saveTCLawFile.do'"
                        :on-preview="handlePreview"
                        :file-list="fileUri.file1"
                        accept=".pdf,.jpg,.png"
                        :data="uploadData(1)"
                        :before-upload="beforeUpload"
                        :on-success="handleSuccess(1)"
                        :on-remove="handleRemove(1)"
                      >
                        <el-button slot="trigger" type="primary" size="mini">上传</el-button>
                        <el-button style="margin-left: 10px;" size="mini" @click="downLoadTemp(1)">下载模版</el-button>
                      </el-upload>
                    </el-col>
                  </el-row>
                </td>
              </tr>
              <tr>
                <td>
                  <el-row>
                    <el-col :span="14">2、守信承诺书</el-col>
                    <el-col :span="10">
                      <el-upload
                        :action="uploadUrl + '/attachment/saveTCLawFile.do'"
                        :on-preview="handlePreview"
                        :file-list="fileUri.file2"
                        accept=".pdf,.jpg,.png"
                        :data="uploadData(2)"
                        :before-upload="beforeUpload"
                        :on-success="handleSuccess(2)"
                        :on-remove="handleRemove(2)"
                      >
                        <el-button slot="trigger" type="primary" size="mini">上传</el-button>
                        <el-button style="margin-left: 10px;" size="mini" @click="downLoadTemp(2)">下载模版</el-button>
                      </el-upload>
                    </el-col>
                  </el-row>
                </td>
              </tr>
              <tr>
                <td>
                  <el-row>
                    <el-col :span="14">3、履行法定义务、纠正违法行为的相关材料</el-col>
                    <el-col :span="10">
                      <el-upload
                        :action="uploadUrl + '/attachment/saveTCLawFile.do'"
                        :on-preview="handlePreview"
                        :file-list="fileUri.file3"
                        accept=".pdf,.jpg,.png"
                        :data="uploadData(3)"
                        :before-upload="beforeUpload"
                        :on-success="handleSuccess(3)"
                        :on-remove="handleRemove(3)"
                      >
                        <el-button slot="trigger" type="primary" size="mini">上传</el-button>
                      </el-upload>
                    </el-col>
                  </el-row>
                </td>
              </tr>
              <tr>
                <td v-if="fileUri.file6 && fileUri.file6.length > 0">
                  <el-row>
                    <el-col :span="14">4、信用修复委托书</el-col>
                    <el-col :span="10">
                      <el-upload
                        :action="uploadUrl + '/attachment/saveTCLawFile.do'"
                        :on-preview="handlePreview"
                        :file-list="fileUri.file6"
                        accept=".pdf,.jpg,.png"
                        :data="uploadData(6)"
                        :before-upload="beforeUpload"
                        :on-success="handleSuccess(6)"
                        :on-remove="handleRemove(6)"
                      >
                        <el-button slot="trigger" type="primary" size="mini">上传</el-button>
                      </el-upload>
                    </el-col>
                  </el-row>
                </td>
                <td v-if="fileUri.file8 && fileUri.file8.length > 0">
                  <el-row>
                    <el-col :span="14">4、法人身份证信息</el-col>
                    <el-col :span="10">
                      <el-upload
                        :action="uploadUrl + '/attachment/saveTCLawFile.do'"
                        :on-preview="handlePreview"
                        :file-list="fileUri.file8"
                        accept=".pdf,.jpg,.png"
                        :data="uploadData(8)"
                        :before-upload="beforeUpload"
                        :on-success="handleSuccess(8)"
                        :on-remove="handleRemove(8)"
                      >
                        <el-button slot="trigger" type="primary" size="mini">上传</el-button>
                      </el-upload>
                    </el-col>
                  </el-row>
                </td>
              </tr>
              <tr>
                <td>
                  <el-row>
                    <el-col :span="14">5、营业执照照片</el-col>
                    <el-col :span="10">
                      <el-upload
                        :action="uploadUrl + '/attachment/saveTCLawFile.do'"
                        :on-preview="handlePreview"
                        :file-list="fileUri.file7"
                        accept=".pdf,.jpg,.png"
                        :data="uploadData(7)"
                        :before-upload="beforeUpload"
                        :on-success="handleSuccess(7)"
                        :on-remove="handleRemove(7)"
                      >
                        <el-button slot="trigger" type="primary" size="mini">上传</el-button>
                      </el-upload>
                    </el-col>
                  </el-row>
                </td>
              </tr>
              <!--              <tr>-->
              <!--                <td>-->
              <!--                  <el-row>-->
              <!--                    <el-col :span="14">4、委托人身份证</el-col>-->
              <!--                    <el-col :span="10">-->
              <!--                      <el-upload-->
              <!--                        :action="uploadUrl + '/attachment/saveTCLawFile.do'"-->
              <!--                        :on-preview="handlePreview"-->
              <!--                        :file-list="fileUri.file5"-->
              <!--                        accept=".pdf,.jpg,.png"-->
              <!--                        :data="uploadData(5)"-->
              <!--                        :before-upload="beforeUpload"-->
              <!--                        :on-success="handleSuccess(5)"-->
              <!--                        :on-remove="handleRemove(5)"-->
              <!--                      >-->
              <!--                        <el-button slot="trigger" type="primary" size="mini">上传</el-button>-->
              <!--                      </el-upload>-->
              <!--                    </el-col>-->
              <!--                  </el-row>-->
              <!--                </td>-->
              <!--              </tr>-->
              <tr>
                <td>
                  <el-row>
                    <el-col :span="14">6、其他材料</el-col>
                    <el-col :span="10">
                      <el-upload
                        :action="uploadUrl + '/attachment/saveTCLawFile.do'"
                        :on-preview="handlePreview"
                        :file-list="fileUri.file4"
                        accept=".pdf,.jpg,.png"
                        :data="uploadData(4)"
                        :before-upload="beforeUpload"
                        :on-success="handleSuccess(4)"
                        :on-remove="handleRemove(4)"
                      >
                        <el-button slot="trigger" type="primary" size="mini">上传</el-button>
                      </el-upload>
                    </el-col>
                  </el-row>
                </td>
              </tr>
              <tr>
                <th>补充材料</th>
                <td>
                  <el-upload
                    :data="{
                      pripids:companyInfo.priPID,
                      bizseq:bizseq,
                      filetype:'99',
                      attachtype: '99'
                    }"
                    :action="uploadUrl + '/attachment/saveTCLawFile.do'"
                    :on-preview="handlePreview"
                    :on-remove="handleRemove(99)"
                    :on-success="handleSuccess(99)"
                    :file-list="fileUri.file99"
                    style="width:40%"
                  >
                    <el-button size="small" type="primary">点击上传</el-button>
                  </el-upload>
                </td>
              </tr>
              <!-- <tr v-if="historyLog && historyLog.length > 0">
                  <th>历史意见</th>
                  <td colspan="2">
                    <el-steps direction="vertical">
                      <el-step v-for="(each,index) in historyLog" :key="'historyLog'+index" :title="'处办人：' + each.handler + ' 处办日期：' + each.handledate" :description="each.opinioncontent" status="finish" />
                    </el-steps>
                  </td>
                </tr> -->
            </table>

            <table
              v-if="htopinions && htopinions.length > 0"
              width="100%"
              class="apply-table"
              style="border-collapse: collapse;"
              border="1"
              cellpadding="0"
              cellspacing="0"
            >
              <tr v-for="(each,index) in htopinions" :key="'historyLog'+index">
                <th style="width: 20%;">历史退回原因</th>
                <td colspan="3">
                  <span style="display: block;text-indent: 1em;min-height:80px">{{ each.opinioncontent }}</span>
                  <el-col :span="8" :offset="16">
                    <label style="font-size: 0.37333rem">{{ each.step }}人:</label>
                    <span>{{ each.handler }}</span>
                    <label
                      style="font-size: 0.37333rem; margin-left: 10px"
                    >{{ each.step }}日期:</label>
                    <span style="display: inline-block">{{ each.handledate }}</span>
                  </el-col>
                </td>
              </tr>
            </table>

            <table
              style="border-collapse: collapse;"
              border="1"
              cellpadding="0"
              cellspacing="0"
              width="100%"
              class="apply-table"
            >
              <template v-if="appOrPc === '0'">
                <tr>
                  <th width="20%"><span style="color:red">*</span>是否受理</th>
                  <td class="radio">
                    <el-radio v-model="isAccept" label="1">受理</el-radio>
                    <el-radio v-model="isAccept" label="0">不予受理</el-radio>
                  </td>
                </tr>
                <tr v-if="isAccept === '1'">
                  <th><span style="color:red">*</span>是否予以信用修复</th>
                  <td colspan="3" class="radio">
                    <el-radio v-model="isAgreeRepair" label="1" style="font-size: unset">准予信用修复</el-radio>
                    <el-radio v-model="isAgreeRepair" label="0" style="font-size: unset">不予信用修复</el-radio>
<!--                    <el-radio v-model="isAgreeRepair" label="2" style="font-size: unset">结束流程</el-radio>-->
                    <el-radio v-model="isAgreeRepair" label="3" style="font-size: unset">转办</el-radio>
                  </td>
                </tr>
              </template>
              <template v-if="appOrPc === '1'">
                <tr>
                  <th width="20%"><span style="color:red">*</span>是否予以信用修复</th>
                  <td colspan="3" class="radio">
                    <el-radio v-model="isAgreeRepair" label="1" style="font-size: unset">准予信用修复</el-radio>
                    <el-radio v-model="isAgreeRepair" label="0" style="font-size: unset">不予信用修复</el-radio>
                    <el-radio v-model="isAgreeRepair" label="2" style="font-size: unset">流程作废</el-radio>
                    <el-radio v-model="isAgreeRepair" label="3" style="font-size: unset">转办</el-radio>
                  </td>
                </tr>
              </template>
              <tr v-if="isAgreeRepair === '3'">
                <th><span style="color:red">*</span>转办机关</th>
                <td>
                  <el-select v-model="transferOrg" clearable size="mini" placeholder="请选择" style="width:100%">
                    <el-option
                      v-for="item in orgList"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </td>
              </tr>
              <tr v-if="isAgreeRepair === '3'">
                <th><span style="color:red">*</span>转办原因</th>
                <td>
                  <el-input v-model="tranferReason" type="textarea" style="width:100%" />
                </td>
              </tr>
              <tr v-if="isAgreeRepair === '2'">
                <th><span style="color:red">*</span>结束原因</th>
                <td>
                  <el-input v-model="endReason" type="textarea" style="width:100%" />
                </td>
              </tr>
              <tr v-if="isAccept === '0'">
                <th><span style="color:red">*</span>退回原因</th>
                <td>
                  <el-input v-model="backProposal" type="textarea" style="width:100%" />
                </td>
              </tr>

              <!-- <tr>
                  <th>经办人意见</th>
                  <td colspan="2">
                    <div>
                      <el-row>
                        <el-col :span="24">
                          <el-input v-model="formData.opinion" type="textarea" placeholder="请输入经办意见" style="width:100%" />
                        </el-col>
                        <el-col :span="12">
                          <br>
                          <span>常用语:</span>
                          <el-select v-model="opinion" placeholder="请选择" class="custom" style="width:100%">
                            <el-option
                              v-for="item in opinionOptions"
                              :key="item.value"
                              :label="item.label"
                              :value="item.value"
                            />
                          </el-select>
                        </el-col>
                      </el-row>
                      <el-row>
                        <el-col :span="12">
                          <br>
                          <span>后续处理人:</span>
                          <el-select v-model="formData.nextPerformerids" placeholder="请选择审核人" class="custom" style="width:100%">
                            <el-option
                              v-for="item in reviewer"
                              :key="'reviewer'+item.primaryKey"
                              :label="item.name"
                              :value="item.primaryKey"
                            />
                          </el-select>
                        </el-col>
                      </el-row>
                    </div>
                  </td>
                </tr> -->
            </table>
            <div v-if="isAgreeRepair === '2'" class="submit-btn-box">
              <el-button type="primary" :loading="endProcessLoading" @click="endProcess">结束流程</el-button>
            </div>
            <div v-else-if="isAgreeRepair === '3'" class="submit-btn-box">
              <el-button type="primary" :loading="submitLoading" @click="tranferProcess">转办</el-button>
            </div>
            <div v-else class="submit-btn-box">
              <el-button v-if="isAccept === '1'" type="primary" @click="$router.go(-1)">返回</el-button>
              <el-button v-if="isAccept === '1'" type="primary" @click="toSecond">确定</el-button>
              <el-button v-if="isAccept === '0'" :loading="submitLoading" type="primary" @click="backToApplyer">退回至申请人</el-button>
            </div>
          </div>
        </el-tab-pane>
        <el-tab-pane :label="isAgreeRepair === '0'? '不予信用修复审批表':'信用修复审批表'" name="second" :disabled="apprDisable">
          <div class="table-title">
            <img src="../../../assets/images/icon01.png" alt="" style="width:24px;margin-right:10px">
            {{ isAgreeRepair === '1'? '信用修复审批表' : '不予信用修复审批表' }}
          </div>
          <div>
            <table
              width="100%"
              class="apply-table"
              style="border-collapse: collapse;"
              border="1"
              cellpadding="0"
              cellspacing="0"
            >
              <tr>
                <th width="20%">名称/姓名</th>
                <td>{{ companyInfo.entName }}</td>
                <th width="20%">注册号/企业统一信用代码</th>
                <td>{{ companyInfo.regNO }}</td>
              </tr>
              <tr>
                <th>审批事项</th>
                <td colspan="3" class="radio">
                  <el-radio v-model="repairType" disabled label="1" style="display:block;font-size: unset;margin-bottom:10px">经营异常名录</el-radio>
                  <el-radio v-model="repairType" disabled label="2" style="display:block;font-size: unset;margin-bottom:10px">个体工商户经营异常状态</el-radio>
                  <el-radio v-model="repairType" disabled label="3" style="display:block;font-size: unset;margin-bottom:10px">行政处罚信息</el-radio>
                  <el-radio v-model="repairType" disabled label="4" style="display:block;font-size: unset;margin-bottom:10px">严重违法失信名单</el-radio>
                </td>
              </tr>
              <tr>
                <th><span style="color:red">*</span>作出决定的事实、理由、依据及主要内容</th>
                <td colspan="3">
                  <el-input v-model="formData.lostCreditExplainrem" type="textarea" :autosize="{ minRows: 4}" placeholder="请输入作出决定的事实、理由、依据及主要内容" style="width:100%" />
                </td>
              </tr>
              <template v-if="historyLog && historyLog.length > 0">
                <tr v-for="(each,index) in historyLog" :key="'historyLog'+index">
                  <th>{{ each.label }}</th>
                  <td colspan="3">
                    <span style="display: block;text-indent: 1em;min-height:80px">{{ each.opinioncontent }}</span>
                    <el-col :span="8" :offset="16">
                      <label style="font-size: 0.37333rem">{{ each.step }}人:</label>
                      <span>{{ each.handler }}</span>
                      <label
                        style="font-size: 0.37333rem; margin-left: 10px"
                      >{{ each.step }}日期:</label>
                      <span style="display: inline-block">{{ each.handledate }}</span>
                    </el-col>
                  </td>
                </tr>
              </template>
              <tr v-if="tranferRecord.length > 0">
                <th>转办记录</th>
                <td colspan="3" v-for="item,index in tranferRecord" :key="item.handler">
                  {{item.operOpinion}}
                  <el-row style="text-align: right;border: unset">
                    转办人：<span style="display:inline-block;text-align: left;">{{item.handler}}  </span>
                    转办机关：<span style="display:inline-block;text-align: left;">{{orgName[index]}}  </span>
                    转办日期：<span style="display:inline-block;text-align: left;">{{item.handledate}}  </span>
                  </el-row>
                </td>
              </tr>
              <tr>
                <th><span style="color:red">*</span>经办人意见</th>
                <td colspan="3">
                  <el-input v-model="formData.opinion" type="textarea" :autosize="{ minRows: 2}" placeholder="1000字内" style="width:100%" />
                </td>
              </tr>
              <!-- <tr>
                <th><span style="color:red">*</span>经办人意见</th>
                <td colspan="3">
                  <el-input v-model="formData.opinion" type="textarea" :autosize="{ minRows: 2}" placeholder="1000字内" style="width:100%" />
                </td>
              </tr>
              <tr v-if="reviewOpinion.opinionContent">
                <th>经办机构负责人意见</th>
                <td colspan="3">
                  <span style="display: block;text-indent: 1em;min-height:80px">{{ reviewOpinion.opinionContent }}</span>
                  <el-col :span="8" :offset="16">
                    <label style="font-size: 0.37333rem">审核人:</label>
                    <span>{{ reviewOpinion.handler }}</span>
                    <label
                      style="margin-left: 10px"
                    >审核日期:</label>
                    <span style="display: inline-block">{{ reviewOpinion.handleDate }}</span>
                  </el-col>
                </td>
              </tr>
              <tr v-if="approvalOpinion.opinionContent">
                <th>部门负责人意见</th>
                <td colspan="3">
                  <span style="display: block;text-indent: 1em;min-height:80px">{{ approvalOpinion.opinionContent }}</span>
                  <el-col :span="8" :offset="16">
                    <label>审批人:</label>
                    <span>{{ approvalOpinion.handler }}</span>
                    <label
                      style="font-size: 0.37333rem; margin-left: 10px"
                    >审批日期:</label>
                    <span style="display: inline-block">{{ approvalOpinion.handleDate }}</span>
                  </el-col>
                </td>
              </tr> -->
              <tr>
                <th>备注</th>
                <td colspan="3">
                  <el-input v-model="formData.remark" type="textarea" style="width:100%" />
                </td>
              </tr>
              <tr>
                <th><span style="color:red">*</span>审核人</th>
                <td colspan="3">
                  <el-select v-model="formData.nextPerformerids" placeholder="请选择审核人" class="custom" filterable style="width:30%">
                    <el-option
                      v-for="item in reviewer"
                      :key="'reviewer'+item.primaryKey"
                      :label="item.name"
                      :value="item.primaryKey"
                    />
                  </el-select>
                </td>
              </tr>

              <tr v-if="isAccept === '1'">
                <th>
                  <span style="color:red">*</span>文书
                </th>
                <td colspan="3">
                  <!-- <el-link v-if="isAccept === '0'" style="font-size: unset"  @click="openDialog('disagreeDec')">不予受理决定书</el-link> -->
                  <el-link v-if="isAgreeRepair === '0'" type="primary" :underline="false" style="font-size: unset;border-bottom:1px solid #409EFF" @click="openDialog('noCreidtRepair')">不予信用修复决定书</el-link>
                  <el-link v-if="isAgreeRepair === '1'" type="primary" :underline="false" style="font-size: unset;border-bottom:1px solid #409EFF" @click="openDialog('creidtRepair')">准予信用修复决定书</el-link>
                </td>
              </tr>
            </table>
            <div class="submit-btn-box">
              <el-button type="primary" :loading="submitLoading" @click="submitExamine">提交</el-button>
              <el-button @click="toFirst">返回</el-button>
            </div>
          </div>
        </el-tab-pane>
      </el-tabs>
    </div>
    <el-dialog
      :loading="dialogLoading"
      :title="dialogTitle"
      :visible.sync="eidtDialog"
      :close-on-click-modal="false"
      width="60%"
      center
    >

      <div class="firstEnt">
        <el-form label-position="left" label-width="200px" :model="firstEnt" class="decForm">
          <el-row>
            <el-form-item label="主标题">
              <span>{{ user.orgName }}</span>
            </el-form-item>
          </el-row>
          <el-row>
            <el-form-item label="副标题">
              <span>{{ dialogTitle }}</span>
            </el-form-item>
          </el-row>
          <el-row>
            <el-form-item label="当事人">
              <span>{{ companyInfo.entName }}</span>
            </el-form-item>
          </el-row>
        </el-form>
      </div>
      <Editor ref="editorDialog" v-model="eidtContent" :is-clear="isClear" :is-disable="editorDisable" @getTextVal="getTextVal" @change="changeEditor" />
      <span slot="footer" class="dialog-footer">
        <el-button v-if="!editorDisable" type="primary" size="mini" @click="saveTempalte(true)">保存</el-button>
        <!-- <el-button size="mini" @click="getEditorText">输出纯文本</el-button> -->

      </span>
    </el-dialog>
  </div>
</template>

<script>
import { removeAttachementById, listAttachmentByBizseq, uploadFile } from '@/api/attachment'
import { illRemTransfer, nextRemTask, listIllegalRem, returnToApplyer } from '@/api/illegal'
import { getUsersWithPermission, getStationByOrg } from '@/api/user'
import { taskOpinion } from '@/api/task'
import { getContentsWithBizseq, saveOrUpdateContent, getNewestOpinion } from '@/api/credit'
import editor from '@/components/editor.vue'
import { getConstant } from '@/api/system'
import { isMenHu } from '@/utils/utils'

export default {
  components: {
    Editor: editor
  },
  data() {
    return {
      orgName: [],
      tranferRecord: [],
      tranferData: {},
      tranferReason: '', //转办原因
      orgList: [],      //转办机关下拉框选项
      transferOrg: '', //转办机关码值
      htopinions: [], // 回退到移动端意见
      appOrPc: '',
      backProposal: '',
      dialogLoading: false,
      repairType: '4',
      activeName: 'first',
      firstEnt: {},
      editorDisable: false,
      eidtDialog: false,
      isClear: false,
      eidtContent: '',
      dialogTitle: '',
      isAccept: '1',
      isAgreeRepair: '',
      uploadUrl: process.env.VUE_APP_BASE_API,
      showEntbase: false,
      bizseq: '',
      workflowId: '',
      tasklistid: '',
      opinion: '',
      companyInfo: {},
      lostCreditExplainrem: '根据《市场监督管理信用修复管理办法》，当事人被列入严重违法失信名单，且符合下列情形的，可以依照本办法规定申请信用修复：（一）已经自觉履行行政处罚决定中规定的义务；（二）已经主动消除危害后果和不良影响；（三）未再受到市场监督管理部门较重行政处罚。',
      formData: {
        lostCreditExplainrem: '根据《市场监督管理信用修复管理办法》，当事人被列入严重违法失信名单，且符合下列情形的，可以依照本办法规定申请信用修复：（一）已经自觉履行行政处罚决定中规定的义务；（二）已经主动消除危害后果和不良影响；（三）未再受到市场监督管理部门较重行政处罚。',
        remark: '',
        operOpinion: '',
        opinion: ''

      },
      reasonOptions: [],
      opinionOptions: [{
        value: 0,
        label: '拟同意'
      }, {
        value: 1,
        label: '同意'
      }, {
        value: 2,
        label: '不同意'
      }],
      historyLog: [],
      exmainerOptions: [],
      fileUri: {
        file1: []
      },
      user: JSON.parse(sessionStorage.getItem('user')),
      reviewer: [],
      submitLoading: false,
      tswrittemplate: {
        bizseq: '',
        writsType: '',
        isTemplate: ''
      },
      // 意见-经办人
      handleOpinion: {
        handler: '',
        handleDate: '',
        opinionContent: ''
      },
      // 意见-审核人
      reviewOpinion: {
        handler: '',
        handleDate: '',
        opinionContent: ''
      },
      // 意见-审批人
      approvalOpinion: {
        handler: '',
        handleDate: '',
        opinionContent: ''
      },
      applicant: '',
      contentText: '',
      endReason: '',
      endProcessLoading: false,
      tsSerIllegalList: ''
    }
  },
  computed: {
    uploadData() {
      return (index) => {
        return {
          filetype: index,
          attachtype: index,
          bizseq: this.bizseq,
          pripids: this.companyInfo.priPID
        }
      }
    },
    apprDisable() {
      if (this.isAccept === '1') {
        if (this.$util.isNotEmpty(this.isAgreeRepair) && this.isAgreeRepair !== '2') {
          return false
        }
      }
      return true
    }
  },
  watch: {
    // 意见渲染
    opinion() {
      let name = ''
      this.opinionOptions.forEach(each => {
        if (this.opinion === each.value) {
          name = each.label
        }
      })
      this.formData.opinion = name
    },
    isAccept: {
      handler(newMsg, oldMsg) {
        if (newMsg === '1') {
          this.isAgreeRepair = '1'
        } else if (newMsg === '0') {
          this.isAgreeRepair = ''
          // this.getDisagreeDecContent()
        }
      },
      immediate: true
    },
    isAgreeRepair: {
      handler(newMsg, oldMsg) {
        if (newMsg === '1') {
          this.getRepairDecContent()
        } else if (newMsg === '0') {
          this.getNoRepairDecContent()
        }
      }
    }
  },
  mounted() {
    this.bizseq = this.$route.query.bizseq // 获取跳转携带的参数bizseq
    this.workflowId = this.$route.query.workflowid
    this.tasklistid = this.$route.query.tasklistid
    this.getRepairDecContent()

    console.log(this.user.orgCode)
    //加载转办机关下拉框选项
    getStationByOrg({'regorg' : this.user.orgCode}).then(res => {
      if (res.code === 0) {
          res.data.forEach(each => {
            console.log(each)
            this.orgList.push(each)
          })
        }
    })

    // 加载严重违法主体
    listIllegalRem(this.bizseq).then(res => {
      if (res.code === 0) {
        if(res.data.tranferRecord){
          this.tranferRecord = res.data.tranferRecord
          this.orgName = res.data.orgName
        }
        const tsbizserillegalrem = res.data.tsbizserillegalrem[0]
        this.companyInfo = tsbizserillegalrem
        this.companyInfo.lerep = res.data.lerep
        this.companyInfo.uscc = tsbizserillegalrem.uniscid || tsbizserillegalrem.regNO
        let date = this.companyInfo.abnTime
        this.formData.lostCreditExplainrem = this.$util.isEmpty(this.companyInfo.lostCreditExplainrem) ? this.lostCreditExplainrem : this.companyInfo.lostCreditExplainrem
        this.formData.remark = (this.$util.isEmpty(tsbizserillegalrem.remark) || tsbizserillegalrem.remark === 'null') ? '' : tsbizserillegalrem.remark
        // this.isAccept = tsbizserillegalrem.isAccept
        this.isAgreeRepair = tsbizserillegalrem.isAgreeRepair
        this.appOrPc = tsbizserillegalrem.appOrPc
        this.applicant = tsbizserillegalrem.applicant
        this.tsSerIllegalList = res.data.tsSerIllegalList
        // this.formData.opinion = tsbizserillegalrem.operOpinion
        if (date) {
          date = date.split('-')
          this.companyInfo.abnTime = date[0] + '年' + date[1] + '月' + date[2] + '日'
        }
      } else {
        this.$message.error('加载严重违法主体信息失败')
      }
    })

    // 加载企业移出原因
    getConstant('CD74').then(res => {
      if (res.code === 0) {
        const list = []
        res.data.forEach(each => {
          list.push({
            value: each.code,
            label: each.name
          })
        })
        this.reasonOptions = list
      }
    })

    // 加载处办记录
    taskOpinion(this.workflowId).then(res => {
      if (res.code === 0) {
        res.data.forEach(each => {
          switch (each.opiniontype) {
            case '0':
              each.step = '经办'
              each.label = '经办人意见'
              if (each.isagree === '2') this.htopinions.push(each)
              break
            case '1':
              each.step = '审核'
              each.label = '部门负责人意见'
              break
            case '2':
              each.step = '审批'
              each.label = '经办机构负责人意见'
              break
          }
          if (each.opiniontype !== '9') {
            this.historyLog.push(each)
          }
        })
      } else {
        this.$message.error('加载意见记录失败')
      }
    })

    // 加载审核人
    this.loadReviewer()

    // 加载附件清单
    this.loadAttachmentList()

    // this.getHandleOpinion(this.workflowId, '0')
    // this.getReviewOpinion(this.workflowId, '1')
    // this.getApprovalOpinion(this.workflowId, '2')
    console.log(this.fileUri)
  },
  methods: {
    // 跳转企业详情页面新窗口
    seeDetail(pripid) {
      if (window.parent) {
        window.open(window.parent.location.origin + '/aiccs/#/comprehensive/details?pripid=' + pripid + '&shrink=true', '_blank')
      }
      // const url = this.$router.resolve({
      //   path: '/comprehensive/details',
      //   query: { pripid: pripid, shrink: true }
      // })
      // window.open(url.href, '_blank')
    },
    // 获取最新经办意见
    getHandleOpinion(workflowid, opinionType) {
      getNewestOpinion(workflowid, opinionType).then(res => {
        if (res.code === 0 && res.data !== null) {
          this.handleOpinion.opinionContent = res.data.opinioncontent
          this.handleOpinion.handler = res.data.handler
          this.handleOpinion.handleDate = this.$util.formatDate.format(new Date(Date.parse(res.data.handledate)), 'yyyy-MM-dd hh:mm:ss')
          this.$nextTick(() => {
            this.$set(this.formData, 'opinion', res.data.opinioncontent)
            this.$set(this.formData, 'handledate', res.data.handledate)
          })
        }
      })
    },
    // 获取最新审核意见
    getReviewOpinion(workflowid, opinionType) {
      getNewestOpinion(workflowid, opinionType).then(res => {
        if (res.code === 0 && res.data !== null) {
          this.reviewOpinion.opinionContent = res.data.opinioncontent
          this.reviewOpinion.handler = res.data.handler
          this.reviewOpinion.handleDate = this.$util.formatDate.format(new Date(Date.parse(res.data.handledate)), 'yyyy-MM-dd hh:mm:ss')
          // if (this.currentNode === 'handleRevCancel') {
          //   this.$nextTick(() => {
          //     this.$set(this.form, 'opinion', res.data.opinioncontent)
          //     this.$set(this.form, 'handledate', res.data.handledate)
          //   })
          // }
        }
      })
    },
    // 获取最新审批意见
    getApprovalOpinion(workflowid, opinionType) {
      getNewestOpinion(workflowid, opinionType).then(res => {
        if (res.code === 0 && res.data !== null) {
          this.approvalOpinion.handler = res.data.handler
          this.approvalOpinion.handleDate = this.$util.formatDate.format(new Date(Date.parse(res.data.handledate)), 'yyyy-MM-dd hh:mm:ss')
          this.approvalOpinion.opinionContent = res.data.opinioncontent
          // if (this.currentNode === 'approveRevCancel') {
          //   this.$nextTick(() => {
          //     this.$set(this.form, 'opinion', res.data.opinioncontent)
          //     this.$set(this.form, 'handledate', res.data.handledate)
          //   })
          // }
        }
      })
    },
    handleClick() {

    },
    toFirst() {
      this.activeName = 'first'
    },
    toSecond() {
      if (this.$util.isEmpty(this.isAgreeRepair)) {
        return this.$message.warning('请选择是否予以信用修复')
      }
      this.activeName = 'second'
    },
    // 图片类型验证
    verificationPicFile(file) {
      const fileTypes = ['.jpg', '.png', '.pdf']
      if (file.name) {
        const fileEnd = file.name.substring(file.name.lastIndexOf('.'))
        return fileTypes.includes(fileEnd)
      } else {
        return false
      }
    },
    // 保存模板编辑内容
    async saveTempalte(alertMsg) {
      // console.log(this.hearingNoticeInfo)
      this.tswrittemplate.content = this.eidtContent
      var resData = false
      await saveOrUpdateContent(this.tswrittemplate).then(res => {
        resData = res.data
      })
      if (resData === true) {
        this.eidtDialog = false
        if (alertMsg) {
          return this.$message.success('保存成功')
        } else {
          return true
        }
        // this.getHearingNotice()
      } else {
        if (alertMsg) {
          return this.$message.error('保存决定书失败')
        } else {
          return false
        }
      }
    },
    // 获取不予受理决定书内容
    getDisagreeDecContent() {
      this.tswrittemplate.bizseq = this.bizseq
      this.tswrittemplate.writsType = '51'
      getContentsWithBizseq(this.tswrittemplate).then(res => {
        if (res.code === 0) {
          this.tswrittemplate.content = res.data.content
          this.eidtContent = res.data.content
        }
      })
    },
    // 获取不予信用修复决定书内容
    getNoRepairDecContent() {
      this.tswrittemplate.bizseq = this.bizseq
      this.tswrittemplate.writsType = '52'
      this.dialogLoading = true
      getContentsWithBizseq(this.tswrittemplate).then(res => {
        if (res.code === 0) {
          this.$nextTick(() => {
            this.$set(this.tswrittemplate, 'content', res.data.content)
            this.$set(this, 'eidtContent', res.data.content)
            // this.$set(this, 'dialogLoading', false)
            // this.tswrittemplate.content = res.data.content
            // this.eidtContent = res.data.content
          })
        }
      })
    },
    // 获取准予信用修复决定书内容
    getRepairDecContent() {
      this.tswrittemplate.bizseq = this.bizseq
      this.tswrittemplate.writsType = '53'
      this.dialogLoading = true
      getContentsWithBizseq(this.tswrittemplate).then(res => {
        if (res.code === 0) {
          this.$nextTick(() => {
            this.$set(this.tswrittemplate, 'content', res.data.content)
            this.$set(this, 'eidtContent', res.data.content)
            // this.$set(this, 'dialogLoading', false)
            // this.tswrittemplate.content = res.data.content
            // this.eidtContent = res.data.content
          })
        }
      })
    },
    openDialog(type) {
      var title = ''
      if (type === 'disagreeDec') {
        title = '不予受理决定书'
        this.eidtDialog = true
        // this.clearEditorContent(type)
        this.$nextTick(() => {
          this.eidtContent = this.tswrittemplate.content
          this.editorDialogType = type
          if (this.editorDisable) {
            this.$refs.editorDialog.$emit('disable')
          }
        })
      } else if (type === 'noCreidtRepair') {
        title = '不予信用修复决定书'
        this.eidtDialog = true
        // this.clearEditorContent(type)
        this.$nextTick(() => {
          this.eidtContent = this.tswrittemplate.content
          this.editorDialogType = type
          if (this.editorDisable) {
            this.$refs.editorDialog.$emit('disable')
          }
        })
      } else if (type === 'creidtRepair') {
        title = '准予信用修复决定书'
        this.eidtDialog = true
        // this.clearEditorContent(type)

        this.$nextTick(() => {
          this.eidtContent = this.tswrittemplate.content
          this.editorDialogType = type
          if (this.editorDisable) {
            this.$refs.editorDialog.$emit('disable')
          }
        })
      }
      this.dialogTitle = title
    },
    async clearEditorContent(type) {
      if (this.$refs.editorDialog && type !== this.editorDialogType) {
        await this.$refs.editorDialog.$emit('clear')
      }
    },
    // 接收子组件的传参
    changeEditor(val) {
    //   console.log(val)
      this.eidtContent = val
    },
    getTextVal(res) {
      const list = []
      res.forEach(each => {
        console.log(each)
      })
    },
    // 加载附件清单
    loadAttachmentList() {
      listAttachmentByBizseq(this.bizseq).then(data => {
        this.fileUri.file1 = data.filter((item) => {
          return item.filetype === '1'
        }).map((item) => {
          return {
            ...item,
            id: item.attachmentid,
            name: item.filename,
            url: `${process.env.VUE_APP_DOWNLOAD_URL}/${item.temppath}`
          }
        })
        this.fileUri.file2 = data.filter((item) => {
          return item.filetype === '2'
        }).map((item) => {
          return {
            ...item,
            id: item.attachmentid,
            name: item.filename,
            url: `${process.env.VUE_APP_DOWNLOAD_URL}/${item.temppath}`
          }
        })
        this.fileUri.file3 = data.filter((item) => {
          return item.filetype === '3'
        }).map((item) => {
          return {
            ...item,
            id: item.attachmentid,
            name: item.filename,
            url: `${process.env.VUE_APP_DOWNLOAD_URL}/${item.temppath}`
          }
        })
        this.fileUri.file4 = data.filter((item) => {
          return item.filetype === '4'
        }).map((item) => {
          return {
            ...item,
            id: item.attachmentid,
            name: item.filename,
            url: `${process.env.VUE_APP_DOWNLOAD_URL}/${item.temppath}`
          }
        })
        this.fileUri.file5 = data.filter((item) => {
          return item.filetype === '5'
        }).map((item) => {
          return {
            ...item,
            id: item.attachmentid,
            name: item.filename,
            url: `${process.env.VUE_APP_DOWNLOAD_URL}/${item.temppath}`
          }
        })
        this.fileUri.file5.forEach(res => {
          this.fileUri.file4.push(res)
        })
        this.fileUri.file6 = data.filter((item) => {
          return item.filetype === '6'
        }).map((item) => {
          return {
            ...item,
            id: item.attachmentid,
            name: item.filename,
            url: `${process.env.VUE_APP_DOWNLOAD_URL}/${item.temppath}`
          }
        })
        this.fileUri.file7 = data.filter((item) => {
          return item.filetype === '7'
        }).map((item) => {
          return {
            ...item,
            id: item.attachmentid,
            name: item.filename,
            url: `${process.env.VUE_APP_DOWNLOAD_URL}/${item.temppath}`
          }
        })
        this.fileUri.file8 = data.filter((item) => {
          return item.filetype === '8'
        }).map((item) => {
          return {
            ...item,
            id: item.attachmentid,
            name: item.filename,
            url: `${process.env.VUE_APP_DOWNLOAD_URL}/${item.temppath}`
          }
        })
        this.fileUri.file99 = data.filter((item) => {
          return !['1', '2', '3', '4', '5', '6', '7', '8'].includes(item.filetype)
        }).map((item) => {
          return {
            ...item,
            id: item.attachmentid,
            name: item.filename,
            url: `${process.env.VUE_APP_DOWNLOAD_URL}/${item.temppath}`
          }
        })
      })
    },
    // 其他附件预览查看
    handlePreview(file) {
      if (['.jpg', '.png', '.jpeg', '.bmp'].includes(file.fileext)) {
        // this.$hevueImgPreview(file.url)
        let fileList = []
        switch (file.filetype) {
          case '1': fileList = this.fileUri.file1; break
          case '2': fileList = this.fileUri.file2; break
          case '3': fileList = this.fileUri.file3; break
          case '4': fileList = this.fileUri.file4; break
          case '5': fileList = this.fileUri.file5; break
          case '6': fileList = this.fileUri.file6; break
          case '7': fileList = this.fileUri.file7; break
          case '8': fileList = this.fileUri.file8; break
          default: fileList = this.fileUri.file99; break
        }
        const imges = []
        let index = 0
        let indextemporary = 0
        for (let i = 0; i < fileList.length; i++) {
          if (['.jpg', '.png', '.jpeg', '.bmp'].includes(fileList[i].fileext)) {
            imges.push(fileList[i].url)
            if (file.id === fileList[i].id) {
              index = indextemporary
            }
            // 下一张图片的下标
            indextemporary++
          }
        }
        this.$hevueImgPreview({
          multiple: true, // 开启多图预览模式
          nowImgIndex: index, // 多图预览，默认展示第几张图片
          imgList: imges
        })
      } else {
        window.open(file.url)
      }
    },
    // 其他附件删除
    handleRemove(index) {
      return (file, fileList) => {
        removeAttachementById(file.id).then(res => {
          if (res.code === 0) {
            this.$message.success('删除成功')
            this.fileUri[`file${index}`].splice(this.fileUri[`file${index}`].indexOf(file), 1)
          }
        })
      }
    },
    // 上传成功处理
    handleSuccess(index) {
      return (res, file) => {
        if (res.code === 0) {
          const data = res.data[0]
          file.id = data.attachmentid
          file.url = process.env.VUE_APP_DOWNLOAD_URL + '/' + data.temppath
          this.fileUri[`file${index}`].push(file)
        }
      // this.loadAttachmentList()
      }
    },
    // 点击上传文件
    clickUpload(index) {
      this.$refs[`file${index}`].click()
    },
    beforeUpload(file) {
      if (!this.verificationPicFile(file)) {
        this.$message.error('上传格式不支持，请重新上传')
        return false
      } else {
        return true
      }
    },
    // 文件上传
    fileUpload(index) {
      return (uploadData) => {
        const file = uploadData.file
        uploadFile({
          filetype: index,
          attachtype: index,
          bizseq: this.bizseq,
          pripids: this.companyInfo.priPID
        }, file).then(res => {
          if (res.code === 0) {
            this.$message.success('上传成功')
            this.loadAttachmentList()
          } else {
            this.$message.error('上传失败')
          }
        })
      }
    },
    // 查看附件
    openFile(index) {
      window.open(this.fileUri['file' + index])
    },

    tranferProcess(){
      this.submitLoading = true
      if (this.isAgreeRepair === '3') {
        if (this.$util.isEmpty(this.transferOrg)) {
          this.submitLoading = false
          return this.$message.error('请选择转办机关')
        }
        if (this.$util.isEmpty(this.tranferReason)) {
          this.submitLoading = false
          return this.$message.error('请输入结束原因')
        }
      }
      this.formData.bizSerRemID = this.companyInfo.bizSerRemID
      //this.formData.enttype = this.tsabnlist.enttype
      // this.formData.bizseq = this.companyInfo.bizseq
      // this.formData.abnlistid = this.companyInfo.abnlistid
      // this.formData.pripid = this.companyInfo.pripid
      // this.formData.regno = this.companyInfo.regno
      // this.formData.entname = this.companyInfo.entname
      // this.formData.specause = this.companyInfo.specause
      // this.formData.abntime = this.companyInfo.abntime
      // this.formData.spereasons = this.companyInfo.spereasons
      // this.formData.applicant = this.companyInfo.applicant
      // this.formData.applicantNo = this.companyInfo.applicantNo
      // this.formData.applicantId = this.companyInfo.applicantId
      // this.formData.cerno = this.companyInfo.cerno
      // this.formData.type = this.companyInfo.type
      // this.formData.applyTime = this.companyInfo.applyTime

      this.formData.tasklistid = this.tasklistid
      this.formData.transferOrg = this.transferOrg
      this.formData.opinion = this.tranferReason
      illRemTransfer(this.formData).then(res => {
        if (res.code === 0) {
          this.submitLoading = false
          if(res.data.flag == 'success'){
            this.$message.success('提交成功')
            if (isMenHu()) {
              // 信创门户环境跳转回待办
              console.log(res,'hhh')
              window.location.href = '/aiccs/#/todo/list'
            } else {
              this.$router.back()
            }
          }else if(res.data.flag == 'error'){
            this.$message.error('提交失败，' + res.data.msg)
          }
        } else {
          this.$message.error('提交失败，' + res.data.msg)
        }
      })
    },

    // 提交审核
    submitExamine() {
      this.submitLoading = true
      // if (this.fileUri.file1.length === 0) {
      //   this.submitLoading = false
      //   return this.$message.error('请上传信用修复申请书')
      // }
      // if (this.fileUri.file2.length === 0) {
      //   this.submitLoading = false
      //   return this.$message.error('请上传守信承诺书')
      // }
      // if (this.fileUri.file3.length === 0) {
      //   this.submitLoading = false
      //   return this.$message.error('请上传履行法定义务、纠正违法行为的相关材料')
      // }
      // if (this.$util.isEmpty(this.fileUri.file4)) {
      //   return this.$message.error('请上传要求提交的其他材料')
      // }
      // if (this.fileUri.file5.length === 0) {
      //   this.submitLoading = false
      //   return this.$message.error('请上传委托人身份证')
      // }
      if (this.isAccept === '0' && this.$util.isEmpty(this.backProposal)) {
        this.submitLoading = false
        return this.$message.error('请输入退回原因')
      }
      if (this.isAccept === '1' && this.$util.isEmpty(this.formData.lostCreditExplainrem)) {
        this.submitLoading = false
        return this.$message.error('请输入作出决定的事实、理由、依据及主要内容')
      }
      if (this.isAccept === '1' && this.$util.isEmpty(this.formData.opinion)) {
        this.submitLoading = false
        return this.$message.error('请输入经办人意见')
      }
      if (this.isAccept === '1' && this.$util.isEmpty(this.formData.nextPerformerids)) {
        this.submitLoading = false
        return this.$message.error('请选择审核人')
      }
      if (this.isAccept === '0') {
        this.formData.nextPerformerids = this.user.primaryKey
        this.formData.nextPerformerNames = this.user.username
      }
      for (const i in this.reviewer) {
        if (this.reviewer[i].primaryKey === this.formData.nextPerformerids) {
          this.formData.nextPerformerNames = this.reviewer[i].name
        }
      }
      if (this.appOrPc === '1' && this.$util.isNotEmpty(this.applicant)) {
        this.formData.applicant = this.applicant
      }
      this.saveTempalte(false).then(res => {
        if (res === true) {
          this.formData.bizSeq = this.bizseq
          this.formData.workflowid = this.workflowId
          this.formData.tasklistid = this.tasklistid
          this.formData.isAccept = this.isAccept
          this.formData.isAgreeRepair = this.isAgreeRepair
          this.formData.handler = this.user.username
          this.formData.handlerid = this.user.primaryKey
          this.formData.opiniontype = '0'
          this.formData.nextNodeID = 'handleSerIllegal'
          this.formData.opinioncontent = this.formData.opinion
          this.formData.remExcpRes = '5'
          nextRemTask(this.formData).then(res => {
            this.submitLoading = false
            if (res.code === 0) {
              this.$message.success('提交成功')
              if (isMenHu()) {
                // 信创门户环境跳转回待办
                window.location.href = '/aiccs/#/todo/list'
              } else {
                this.$router.back()
              }
            } else {
              this.$message.error('提交失败，' + res.data.msg)
            }
          })
        }
        this.submitLoading = false
      })
    },
    // 结束流程
    endProcess() {
      if (this.isAgreeRepair === '2') {
        this.endProcessLoading = true
        if (this.$util.isEmpty(this.endReason)) {
          this.endProcessLoading = false
          return this.$message.error('请输入结束原因')
        }
        this.formData.bizSeq = this.bizseq
        this.formData.workflowid = this.workflowId
        this.formData.tasklistid = this.tasklistid
        this.formData.isAccept = this.isAccept
        this.formData.isAgreeRepair = this.isAgreeRepair
        this.formData.handler = this.user.username
        this.formData.handlerid = this.user.primaryKey
        this.formData.opiniontype = '0'
        this.formData.nextNodeID = 'overFinish'
        this.formData.opinioncontent = this.formData.opinion
        // this.formData.remExcpRes = '5'
        this.formData.nextPerformerids = this.user.primaryKey
        this.formData.nextPerformerNames = this.user.username
        this.formData.opinioncontent = this.endReason
        nextRemTask(this.formData).then(res => {
          this.endProcessLoading = false
          if (res.code === 0) {
            this.$message.success('提交成功')
            if (isMenHu()) {
              // 信创门户环境跳转回待办
              window.location.href = '/aiccs/#/todo/list'
            } else {
              this.$router.back()
            }
          } else {
            this.$message.error('提交失败，' + res.data.msg)
          }
        })
      } else {
        return
      }
    },
    backToApplyer() {
      this.submitLoading = true
      const data = {
        tasklistid: this.tasklistid,
        bizSeq: this.bizseq,
        backProposal: this.backProposal,
        handler: this.user.nickname,
        handlerid: this.user.primaryKey
      }
      returnToApplyer(data).then(res => {
        this.submitLoading = false
        if (res.data === true) {
          this.$message.success('提交成功')
          if (isMenHu()) {
            // 信创门户环境跳转回待办
            window.location.href = '/aiccs/#/todo/list'
          } else {
            this.$router.back()
          }
        } else {
          this.$message.error('提交失败，' + res.data.msg)
        }
      })
    },
    // 移除文件回调
    removeFile(file) {
      removeAttachementById(file.response.data.attachmentid).then(res => {
        if (res.code === 0) {
          this.$message.success('删除成功')
        } else {
          this.$message.error(res.data.msg)
        }
      })
    },
    // 加载审核人
    loadReviewer() {
      getUsersWithPermission('illegalRemoveReview', this.user.orgId).then(res => {
        if (res.code === 0) {
          this.reviewer = res.data
        }
      })
    },
    // 下载模版
    downLoadTemp(type) {
      let name = ''
      switch (parseInt(type)) {
        // case 1: path = '/credit/repair/PrintPromiseNew'; break // 严重违法失信承诺书
        // case 2: path = '/credit/repair/printRemoveApplyNew'; break // 严重违法失信信用修复申请书
        //   //        case 2: path = '/credit/repair/printRemoveApply'; break // 严重违法失信企业信用修复申请表
        // case 3: path = '/credit/repair/printPromise'; break // 企业信用承诺书
        // case 4: path = '/credit/repair/printRemoveExamine'; break // 严重违法失信企业信用修复审批表
        case 1: name = 'yzwfsqs.pdf'; break
        case 2: name = 'sxcrspdf.pdf'; break
      }
      // const { href } = this.$router.resolve({ path: path, query: {
      //   bizseq: this.bizseq,
      //   workflowId: this.workflowId,
      //   tasklistid: this.tasklistid
      // }})
      // window.open(href)
      window.open(process.env.NODE_ENV === '"development"' ? `/${name}` : `/crss/${name}`)
    }
  }
}
</script>

<style lang="scss" scoped>
.el-upload{
  /deep/ .el-icon-close-tip{
    display: none!important;
  }
}
.main-content{
  padding: 10pt;
  .back-btn{
    position:absolute;
    right:40pt;
  }
  .content-header,.content-body{
    background: white;
    border:1PX solid #eee;
  }
  .content-header{
    height:60PX;
    .title{
      font-weight: 700;
      font-size: $font-size-sub-title;
    }
  }
  .content-body{
      .tab{
        .tab-title{
          label{
            background: $color-primary;
            display:inline-block;
            color:white;
            padding:5px;
          }
        }
      }
    .form{
      margin-bottom: 20pt;
    }
  }
  .apply-table{
    padding:15px;
    margin-bottom: 30px;
    border-color: $color-border;
    tr{
      width:100%
    }
    th,td{
      font-size:$table-title-font-size;
      padding:15px
    }
    th{
      color: $font-size-label;
      font-weight: normal;
      background: $color-form-label;
      text-align: $text-algin-right;
      font-size:$table-title-font-size;
    }
    td{
      text-align: $text-algin-left;
      color: $table-content-color!important;
      /deep/.el-radio{
        color: $table-content-color!important;
      }
      /deep/.el-textarea__inner{
        color: $table-content-color!important;
      }
      /deep/.el-input__inner{
        color: $table-content-color!important;
      }

    }
    .radio{
      .el-radio__label {
        font-size: unset;
      }
    }
  }

}
.table-title{
  width: 100%;
  margin-top: 10px;
  padding: 15px;
  display: flex;
  align-items: center;
  font-weight: 600;
  background: #fff;
  font-size: $table-title-font-size;
  color:#333;
  border-bottom: 1px solid #E5E5E5;
}
</style>
<style lang="scss">
.tabs {
  .el-tabs__item {
    font-size: initial;
  }
}
.credit{
  .radio{
    .el-radio__label {
      font-size: unset;
    }
    .el-radio__input.is-disabled+span.el-radio__label {
      color: unset;
    }
    .el-radio__input.is-disabled.is-checked .el-radio__inner {
      background-color: #409EFF;
      border-color: #409EFF;
    }
  }
  .el-dialog__header{
    background:#e4e4e4;
    .el-dialog__title {
      font-size: large;
    }
  }
  .decForm{
    .el-form-item {
      margin-bottom: 0;
      background: $color-form-label;
      .el-form-item__label {
        font-size: initial;
        padding-left: 20px;
        border-top: 1px solid $color-border;
        border-left: 1px solid $color-border;
      }
      .el-form-item__content {
        padding-left: 10px;
        font-size: initial;
        // line-height: normal;
        background: white;
        border-top: 1px solid $color-border;
        border-right: 1px solid $color-border;
        border-left: 1px solid $color-border;
      }
    }
  }
}

</style>
