<template>
  <div class="main-content credit">
    <div>
      <!-- <el-row style="background: #fff;border-bottom: 1px solid #E5E5E5;">
        <el-col :span="12">
          <div class="table-title">
            <img src="../../../assets/images/icon01.png" alt="" style="width:24px;margin-right:10px">
            {{ isAgreeRepair === '1'? '信用修复审批表':'不予信用修复审批表' }}
          </div>
        </el-col>
        <el-col :span="12">
          <div class="title-btn">
            <el-button type="primary" @click="entInfoDialog = true">企业填报信息</el-button>
          </div>
        </el-col>
      </el-row> -->
      <div class="content-body">
        <el-tabs v-model="activeName" type="border-card" class="tabs" style="font-size:unset">
          <el-tab-pane label="信用修复申请信息" name="first">
            <div class="table-title">
              <img src="../../../assets/images/icon01.png" alt="" style="width:24px;margin-right:10px">
              信用修复申请信息
            </div>
            <el-form ref="form" :model="form" label-width="190px" label-position="right" :rules="formRules">
              <div class="form">
                <div class="form-body">
                  <table
                    width="100%"
                    class="apply-table"
                    style="border-collapse: collapse;"
                    border="1"
                    cellpadding="0"
                    cellspacing="0"
                  >
                    <tr>
                      <th width="20%">注册号/企业统一信用代码</th>
                      <td>{{ companyInfo.regno }}</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.applicant }}
                      </td>
                    </tr>
                    <tr>
                      <th>经营异常列入时间</th>
                      <td>
                        {{ tsabnlist.abntime }}
                      </td>
                    </tr>
                    <tr>
                      <th>经营异常列入机关</th>
                      <td>
                        {{ tsabnlist.intoDecorg }}
                      </td>
                    </tr>
                    <tr>
                      <th>经营异常列入原因</th>
                      <td>
                        {{ tsabnlist.spereasons }}
                      </td>
                    </tr>
                  </table>

                  <!-- <el-form-item label="事实理由" prop="remreasons">
              <el-input v-model="form.remreasons" type="textarea" placeholder="请输入事实理由" style="display:inline-block;width:600px" :autosize="{ minRows: 3, maxRows: 6 }" maxlength="500" show-word-limit />
            </el-form-item> -->
                  <!-- <el-row>
                  <el-form-item label="移出原因" prop="reason" class="bt0">
                    <el-col :span="24" />
                    <el-col :span="24">
                      <el-input v-model="form.reason" type="textarea" disabled style="width:100%" />
                    </el-col>
                  </el-form-item>
                </el-row> -->
                  <!-- <el-row>
                  <el-form-item label="备注" prop="remRemark" class="bt0">
                    <el-input v-model="remRemark" type="textarea" placeholder="备注" style="display:inline-block;width:100%" :autosize="{ minRows: 3, maxRows: 6 }" maxlength="500" show-word-limit />
                  </el-form-item>
                </el-row> -->
                  <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="7" width="20%">证据材料</th>
                      <td>
                        <el-row style="border-left:0;">
                          <el-col :span="14">《信用修复申请书》</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">上传</el-button>
                              <el-button v-if="fujianType === '未年报'" style="margin-left: 10px;" @click="downLoadTemp(3)">下载模版</el-button>
                              <el-button v-if="fujianType === '实地查无'" style="margin-left: 10px;" @click="downLoadTemp(4)">下载模版</el-button>
                              <el-button v-if="fujianType === '虚假公示'" style="margin-left: 10px;" @click="downLoadTemp(5)">下载模版</el-button> -->
                            </el-upload>
                          </el-col>
                        </el-row>
                      </td>
                    </tr>
                    <tr>
                      <td>
                        <el-row style="border-left:0;">
                          <el-col :span="14">《信用修复承诺书》</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">上传</el-button>
                              <el-button style="margin-left: 10px;" @click="downLoadTemp(8)">下载模版</el-button> -->
                            </el-upload>
                          </el-col>
                        </el-row>
                      </td>
                    </tr>
                    <tr>
                      <td v-if="fujianType === '未年报'">
                        <el-row style="border-left:0;">
<!--                          <el-col :span="14">已公示年度报告信息截图</el-col>-->
                          <el-col :span="14">履行法定义务、纠正违法行为的相关材料</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">上传</el-button>
                              <el-button style="margin-left: 10px;" @click="downLoadTemp(7)">下载模版</el-button> -->
                            </el-upload>
                          </el-col>
                        </el-row>
                      </td>
                    </tr>
                    <tr>
                      <td v-if="fujianType === '实地查无'">
                        <el-row style="border-left:0;">
<!--                          <el-col :span="14">《企业公示信息实地核查记录表》或《准予变更等级（备案）通知书》</el-col>-->
                          <el-col :span="14">履行法定义务、纠正违法行为的相关材料</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">上传</el-button>
                              <el-button style="margin-left: 10px;" @click="downLoadTemp(10)">下载模版1</el-button>
                              <el-button style="margin-left: 10px;" @click="downLoadTemp(21)">下载模版2</el-button> -->
                            </el-upload>
                          </el-col>
                        </el-row>
                      </td>
                    </tr>
<!--                    <tr>-->
<!--                      <td v-if="fujianType === '虚假公示'">-->
<!--                        <el-row style="border-left:0;">-->
<!--                          <el-col :span="14">《企业公示信息核查记录表》</el-col>-->
<!--                          <el-col :span="10">-->
<!--                            <el-upload-->
<!--                              :action="uploadUrl + '/attachment/saveTCLawFile.do'"-->
<!--                              :on-preview="handlePreview"-->
<!--                              :file-list="fileUri.file10"-->
<!--                              accept=".pdf,.jpg,.png"-->
<!--                              :data="uploadData(10)"-->
<!--                              :before-upload="beforeUpload"-->
<!--                              :on-success="handleSuccess(10)"-->
<!--                              :on-remove="handleRemove(10)"-->
<!--                            >-->
<!--                              &lt;!&ndash; <el-button slot="trigger" type="primary">上传</el-button>-->
<!--                              <el-button style="margin-left: 10px;" @click="downLoadTemp(20)">下载模版</el-button> &ndash;&gt;-->
<!--                            </el-upload>-->
<!--                          </el-col>-->
<!--                        </el-row>-->
<!--                      </td>-->
<!--                    </tr>-->
                    <tr>
                      <td v-if="fujianType === '虚假公示'">
                        <el-row style="border-left:0;">
<!--                          <el-col :span="14"> 申请移出经营异常名录的报告</el-col>-->
                          <el-col :span="14">履行法定义务、纠正违法行为的相关材料</el-col>
                          <el-col :span="10">
                            <el-upload
                              :action="uploadUrl + '/attachment/saveTCLawFile.do'"
                              :on-preview="handlePreview"
                              :file-list="fileUri.file9"
                              accept=".pdf,.jpg,.png"
                              :data="uploadData(9)"
                              :before-upload="beforeUpload"
                              :on-success="handleSuccess(9)"
                              :on-remove="handleRemove(9)"
                            >
                              <!-- <el-button slot="trigger" type="primary">上传</el-button>
                              <el-button style="margin-left: 10px;" @click="downLoadTemp(9)">下载模版</el-button> -->
                            </el-upload>
                          </el-col>
                        </el-row>
                      </td>
                    </tr>
                    <tr>
                      <td>
                        <el-row style="border-left:0;">
                          <el-col :span="14">《移出企业经营异常名录授权委托书》</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">上传</el-button>
                              <el-button style="margin-left: 10px;" @click="downLoadTemp(11)">下载模版</el-button> -->
                            </el-upload>
                          </el-col>
                        </el-row>
                      </td>
                    </tr>
                    <tr>
                      <td>
                        <el-row style="border-left:0;">
                          <el-col :span="14">营业执照照片</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">上传</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 type="primary">点击上传</el-button> -->
                        </el-upload>
                      </td>
                    </tr>
                  </table>

                </div>
              </div>
              <div class="form">
                <div class="table-title">
                  <img src="../../../assets/images/icon01.png" alt="" style="width:24px;margin-right:10px">
                  移出记录
                </div>
                <div class="form-body history">
                  <div v-if="removeRecordList.length == 0" class="none">暂无移出记录</div>
                  <el-table v-else :data="removeRecordList" border style="width: 100%">
                    <el-table-column type="index" label="序号" width="80" align="center" />
                    <el-table-column prop="abntime" label="列入日期" min-width="100" />
                    <el-table-column prop="spereasons" :show-overflow-tooltip="true" label="列入原因" min-width="200" />
                    <el-table-column prop="intoDecorg" label="列入决定机关" min-width="100" />
                    <el-table-column prop="remdate" label="移出日期" min-width="100" />
                    <el-table-column prop="remexcpresCn" :show-overflow-tooltip="true" label="移出原因" min-width="200" />
                    <!-- <el-table-column prop="remDecorg" label="移出决定机关" min-width="100" /> -->
                    <el-table-column label="移出决定机关" min-width="100" />
                  </el-table>
                </div>
              </div>

              <div class="form" v-if="htopinions.length > 0">
              <div class="form-body">
                <template v-if="htopinions && htopinions.length > 0">
                  <table
                    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>{{ each.label }}</th>-->
                      <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>
                </template>
              </div>
            </div>
              <!-- <div class="form">
              <div class="tab">
                <div class="tab-title"><label>处理意见</label></div>
              </div>
              <div class="form-body history">
                <div v-if="historyLog.length == 0" class="none">暂无历史意见</div>
                <el-steps direction="vertical">
                  <el-step v-for="(each,index) in historyLog" :key="'historyLog'+index" :title="each.step + '人：' + each.handler + ' ' + each.step +'日期：' + 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>
                  <el-form-item label="经办意见" prop="opinion">
                    <el-col :span="24">
                      <el-input v-model="form.opinion" type="textarea" placeholder="请输入经办意见" :autosize="{ minRows: 2, maxRows: 6 }" />
                    </el-col>
                    <el-col :span="12">
                      <label>常用语</label>
                      <el-select v-model="opinion" clearable 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-form-item>
                </el-row>

                <el-row>
                  <el-form-item label="审核人" prop="reviewerId" class="bt0">
                    <el-col :span="12">
                      <el-select v-model="form.reviewerId" style="width:100%" filterable clearable placeholder="请选择审核人" class="custom">
                        <el-option
                          v-for="item in reviewer"
                          :key="'reviewer'+item.primaryKey"
                          :label="item.name"
                          :value="item.primaryKey"
                        />
                      </el-select>
                    </el-col>
                  </el-form-item>
                </el-row>

              </div>
            </div> -->

              <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" disabled>材料齐全</el-radio>
                      <el-radio v-model="isAccept" label="0" disabled>补正材料</el-radio>
                    </td>
                  </tr>
                </template>
                <tr v-if="isAccept === '1'">
                  <th width="20%">是否予以信用修复</th>
                  <td colspan="3" class="radio">
                    <el-radio v-model="isAgreeRepair" disabled label="1" style="font-size: unset">准予信用修复</el-radio>
                    <el-radio v-model="isAgreeRepair" disabled label="0" style="font-size: unset">不予信用修复</el-radio>
                  </td>
                </tr>
                <tr v-if="isAccept === '1' && isAgreeRepair === '1'">
                  <th><span style="color:red">*</span>移出原因</th>
                  <td colspan="3" class="radio">
                    <el-input type="textarea" v-model="reason" :readonly=true style="width:100%" placeholder="请选择移出原因" class="custom">
<!--                      <el-option-->
<!--                        v-for="item in reasonOptions"-->
<!--                        :key="item.value"-->
<!--                        :label="item.label"-->
<!--                        :value="item.value"-->
<!--                      />-->
                    </el-input>
                  </td>
                </tr>
                <!-- <tr v-if="isAccept === '1' && isAgreeRepair === '1'">
                <th><span style="color:red">*</span>备注</th>
                <td colspan="3" class="radio">
                  <el-input v-model="remRemark" type="textarea" placeholder="备注" style="display:inline-block;width:100%" :autosize="{ minRows: 3, maxRows: 6 }" maxlength="500" show-word-limit />
                </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%" readonly="true"/>
                  </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 class="submit-btn-box">
                <el-button v-if="isAccept === '1'" type="primary" @click="activeName = 'second'">确定</el-button>
                <el-button v-if="isAccept === '0'" :loading="submitLoading" type="primary" @click="backToApplyer">退回至申请人</el-button>
              </div> -->
            </el-form>
          </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 === '0'? '不予信用修复审批表':'信用修复审批表' }}
            </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.remreasons" type="textarea" :autosize="{ minRows: 4}" placeholder="请输入作出决定的事实、理由、依据及主要内容" 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>
                  <th>作出决定的事实、理由、依据及主要内容</th>
                  <td colspan="3">
                    <span style="display: block;text-indent: 1em;min-height:80px">{{ companyInfo.remreasons }}</span>

                  </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>
                  <th>经办人意见</th>
                  <td colspan="3">
                    <span style="display: block;text-indent: 1em;min-height:80px">{{ handleOpinion.opinionContent }}</span>
                    <el-col :span="8" :offset="16">
                      <label>经办人:</label>
                      <span>{{ handleOpinion.handler }}</span>
                      <label
                        style="margin-left: 10px"
                      >经办日期:</label>
                      <span style="display: inline-block">{{ handleOpinion.handleDate }}</span>
                    </el-col>
                  </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="font-size: 0.37333rem; 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 style="font-size: 0.37333rem">审批人:</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">
                    <span>{{ companyInfo.remRemark }}</span>
                  </td>
                </tr>
                <tr>
                  <th>
                    文书
                  </th>
                  <td colspan="3">
                    <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>
          </el-tab-pane>
        </el-tabs>
        <!-- <table
          width="100%"
          class="apply-table"
          style="border-collapse: collapse;"
          border="1"
          cellpadding="0"
          cellspacing="0"
        >
          <tr v-if="isAccept === '1'">
            <th>是否予以信用修复</th>
            <td colspan="2">
              <span>{{ this.isAgreeRepair ==='1'? '准予信用修复':'不予信用修复' }}</span>
            </td>
          </tr>
          <tr>
            <th>审批人意见</th>
            <td colspan="2">
              <el-input v-model="formData.opinion" type="textarea" placeholder="请输入审批人意见" :autosize="{minRows:4, maxRows: 8}" />
              <el-row style="margin:10px 0">
                <label>是否通过：</label>
                <el-radio-group v-model="formData.nextNodeID">
                  <el-radio label="endSerIllegal">通过</el-radio>
                  <el-radio label="overSerIllegal">不通过</el-radio>
                </el-radio-group>
              </el-row>
              <el-row style="margin:10px 0">
                <el-col :span="12">
                  <label>常用语：</label>
                  <el-select v-model="opinion" placeholder="请选择" class="custom">
                    <el-option
                      v-for="item in opinionOptions"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-col>
              </el-row>
            </td>
          </tr>
        </table> -->
        <!-- <div class="submit-btn-box">
          <el-button type="primary" :loading="submitLoading" @click="submitExamine">提交</el-button>
        </div> -->
        <div class="submit-btn-box" v-if="isAppBackEnter">
          <el-button @click="$router.back()">返回</el-button>
          <el-button type="primary" @click="cancelBusiness">撤销业务</el-button>
        </div>
      </div>
    </div>
    <el-dialog
      :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">保存</el-button>
        <!-- <el-button size="mini" @click="getEditorText">输出纯文本</el-button> -->

      </span>
    </el-dialog>
    <el-dialog
      title="企业填报信息"
      :visible.sync="entInfoDialog"
      :close-on-click-modal="false"
      width="60%"
      class="infoDialog"
    >
      <table
        width="100%"
        class="apply-table"
        style="border-collapse: collapse;"
        border="1"
        cellpadding="0"
        cellspacing="0"
      >
        <tr>
          <th width="20%">注册号/企业统一信用代码</th>
          <td>{{ companyInfo.regno }}</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.applicant }}
          </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="7" width="20%">证据材料</th>
          <td>
            <el-row style="border-left:0;">
<!--              <el-col :span="14">《商事主体移出经营异常名录(消除经营异常状态)申请表》</el-col>-->
              <el-col :span="14">《信用修复申请书》</el-col>
              <el-col :span="10">
                <el-upload
                  class="disabled-upload-remove"
                  :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 style="border-left:0;">
              <el-col :span="14">《信用修复承诺书》</el-col>
              <el-col :span="10">
                <el-upload
                  class="disabled-upload-remove"
                  :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 v-if="fujianType === '未年报'">
            <el-row style="border-left:0;">
<!--              <el-col :span="14">已公示年度报告信息截图</el-col>-->
              <el-col :span="14">履行法定义务、纠正违法行为的相关材料</el-col>
              <el-col :span="10">
                <el-upload
                  class="disabled-upload-remove"
                  :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-button style="margin-left: 10px;" size="mini" @click="downLoadTemp(7)">下载模版</el-button> -->
                </el-upload>
              </el-col>
            </el-row>
          </td>
        </tr>
        <tr>
          <td v-if="fujianType === '实地查无'">
            <el-row style="border-left:0;">
<!--              <el-col :span="14">《企业公示信息实地核查记录表》或《准予变更等级（备案）通知书》</el-col>-->
              <el-col :span="14">履行法定义务、纠正违法行为的相关材料</el-col>
              <el-col :span="10">
                <el-upload
                  class="disabled-upload-remove"
                  :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 v-if="fujianType === '虚假公示'">-->
<!--            <el-row style="border-left:0;">-->
<!--              <el-col :span="14">《企业公示信息核查记录表》</el-col>-->
<!--              <el-col :span="10">-->
<!--                <el-upload-->
<!--                  class="disabled-upload-remove"-->
<!--                  :action="uploadUrl + '/attachment/saveTCLawFile.do'"-->
<!--                  :on-preview="handlePreview"-->
<!--                  :file-list="fileUri.file10"-->
<!--                  accept=".pdf,.jpg,.png"-->
<!--                  :data="uploadData(10)"-->
<!--                  :before-upload="beforeUpload"-->
<!--                  :on-success="handleSuccess(10)"-->
<!--                  :on-remove="handleRemove(10)"-->
<!--                >-->
<!--                  &lt;!&ndash; <el-button slot="trigger" type="primary" size="mini">上传</el-button>-->
<!--                            <el-button style="margin-left: 10px;" size="mini" @click="downLoadTemp(10)">下载模版</el-button> &ndash;&gt;-->
<!--                </el-upload>-->
<!--              </el-col>-->
<!--            </el-row>-->
<!--          </td>-->
<!--        </tr>-->
        <tr>
          <td v-if="fujianType === '虚假公示'">
            <el-row style="border-left:0;">
<!--              <el-col :span="14"> 申请移出经营异常名录的报告</el-col>-->
              <el-col :span="14">履行法定义务、纠正违法行为的相关材料</el-col>
              <el-col :span="10">
                <el-upload
                  class="disabled-upload-remove"
                  :action="uploadUrl + '/attachment/saveTCLawFile.do'"
                  :on-preview="handlePreview"
                  :file-list="fileUri.file9"
                  accept=".pdf,.jpg,.png"
                  :data="uploadData(9)"
                  :before-upload="beforeUpload"
                  :on-success="handleSuccess(9)"
                  :on-remove="handleRemove(9)"
                >
                  <!-- <el-button slot="trigger" type="primary" size="mini">上传</el-button>
                            <el-button style="margin-left: 10px;" size="mini" @click="downLoadTemp(9)">下载模版</el-button> -->
                </el-upload>
              </el-col>
            </el-row>
          </td>
        </tr>
        <tr>
          <td>
            <el-row style="border-left:0;">
              <el-col :span="14">《移出企业经营异常名录授权委托书》</el-col>
              <el-col :span="10">
                <el-upload
                  class="disabled-upload-remove"
                  :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>
            <el-row style="border-left:0;">
              <el-col :span="14">营业执照照片</el-col>
              <el-col :span="10">
                <el-upload
                  class="disabled-upload-remove"
                  :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
              class="disabled-upload-remove"
              :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>
      </table>
    </el-dialog>
  </div>
</template>

<script>
import { removeAttachementById, listAttachmentByBizseq, uploadFile } from '@/api/attachment'
import { bizRemoveNext, getBizRemInfo, selectHistorybizRemlist, downLoadHistoryFile, bizRemCancelBusiness } from '@/api/abnormal'
import { getUsersWithPermission } from '@/api/user'
import { getContentsWithBizseq, getNewestOpinion } from '@/api/credit'
import editor from '@/components/editor.vue'
import { getConstant, getCD72 } from '@/api/system'
import { taskOpinion,  getProcessNodeList, getTaskList } from '@/api/task'
export default {
  components: {
    Editor: editor
  },
  data() {
    return {
      htopinions: [], // 回退到移动端意见
      appOrPc: '',
      row: '',
      fujianType: '',
      backProposal: '',
      remRemark: '',
      submitLoading: false,
      entname: '',
      removeRecordList: [],
      uploadPath: `${process.env.VUE_APP_BASE_API}/attachment/uploadAdvance`,
      uploadUrl: process.env.VUE_APP_BASE_API,
      showEntbase: false,
      bizseq: '',
      workflowId: '',
      tasklistid: '',
      entbase: [], // 主体名单列表
      // 分页数据,这里用来保存每页切割后的数据
      // 看起来格式是这样的[[{},{},{}],[{},{},{}]]
      // 数组内套数组，每个数组就是一页数据
      totalPageData: [],
      // 共几页
      pageNum: '',
      // 每页显示数量
      pageSize: 10,
      // 当前显示页码
      currentPage: 1,
      // 总共多少条数据
      total: 1,
      // 当前要显示的数据
      dataShow: [],
      // 选中数组
      multipleSelection: [],
      form: {
        enterType: 'company',
        remreasons: '',
        reason: '',
        remRemark: '',
        opinion: ''
      },
      formRules: {
        reason: [
          { required: true, message: '请选择移出原因', trigger: 'blur' }
        ],
        opinion: [
          { required: true, message: '请输入经办意见', trigger: ['blur', 'change'] }
        ],
        reviewerId: [
          { required: true, message: '请选择审核人' }
        ]
      },
      reason: '',
      opinion: '',
      reasonOptions: [],
      inclueReasonOptions: [],
      opinionOptions: [],
      historyLog: [],
      exmainerOptions: [],
      fileList: [],
      user: JSON.parse(sessionStorage.getItem('user')),
      reviewer: [],
      activeName: 'first',
      isAgreeRepair: '',
      companyInfo: {},
      repairType: '',
      dialogTitle: '',
      type: '',
      firstEnt: {},
      isClear: false,
      eidtContent: '',
      tswrittemplate: {
        bizseq: '',
        writsType: '',
        isTemplate: '',
        type: ''
      },
      formData: {
        // lostCreditExplainrem: '根据《市场监督管理信用修复管理办法》第七条要求，当事人被列入严重违法失信名单满一年，且符合下列情形的，可以依照本办法规定申请信用修复：（一）已经自觉履行行政处罚决定中规定的义务；（二）已经主动消除危害后果和不良影响；（三）未再受到市场监督管理部门较重行政处罚。依照法律、行政法规规定，实施相应管理措施期限尚未届满的，不得申请提前移出。',
        lostCreditExplainrem: '',
        remRemark: '',
        operOpinion: '',
        opinion: '',
        nextPerformerids: '',
        remreasons: ''
      },
      // 意见-经办人
      handleOpinion: {
        handler: '',
        handleDate: '',
        opinionContent: ''
      },
      // 意见-审核人
      reviewOpinion: {
        handler: '',
        handleDate: '',
        opinionContent: ''
      },
      // 意见-审批人
      approvalOpinion: {
        handler: '',
        handleDate: '',
        opinionContent: ''
      },
      fileUri: {
        file1: []
      },
      specause: '',
      specauseType: '',
      applicant: '',
      entInfoDialog: false,
      isAccept: '',
      editorDisable: true,
      eidtDialog: false,
      tsabnlist: '',
      busstatus:'',
      nodeflow:[],
      currentnode:''
    }
  },
  computed: {
    uploadData() {
      return (index) => {
        return {
          filetype: index,
          attachtype: index,
          bizseq: this.bizseq,
          pripids: this.companyInfo.priPID
        }
      }
    },
    apprDisable() {
      if (this.isAccept === '0') {
        return true
      } else if (this.isAccept === '1') {
        if (this.$util.isNotEmpty(this.isAgreeRepair)) {
          if (this.isAgreeRepair === '0') {
            return false
          } else if (this.isAgreeRepair === '1') {
            if (this.$util.isNotEmpty(this.reason)) {
              return false
            } else {
              return true
            }
          }
        } else {
          return true
        }
      }
    },
    //是否为回退到第一步（移动端)
    isAppBackEnter() {
       if(this.appOrPc === '0' && this.busstatus ==='5' && this.currentnode === 'exptlistEnter' && this.nodeflow.length > 0 && this.nodeflow[0] === 'exptlistEnter'){
          return true
        }
      return false
    }
  },
  watch: {
    // 意见渲染
    opinion() {
      let name = ''
      this.opinionOptions.forEach(each => {
        if (this.opinion === each.value) {
          name = each.label
        }
      })
      this.formData.opinion = name
    },
    isAgreeRepair: {
      handler(newMsg, oldMsg) {
        if (!this.workflowId) return
        if (newMsg === '1') {
          this.getRepairDecContent()
        } else if (newMsg === '0') {
          this.getNoRepairDecContent()
        }
      }
    },
    specauseType() {
      if (this.specauseType === 'nb') {
        this.$set(this, 'fujianType', '未年报')
      } else if (this.specauseType === 'sd') {
        this.$set(this, 'fujianType', '实地查无')
      } else if (this.specauseType === 'xj') {
        this.$set(this, 'fujianType', '虚假公示')
      }
    }
  },
  mounted() {
    this.bizseq = this.$route.query.bizseq // 获取跳转携带的参数bizseq
    this.workflowId = this.$route.query.workflowId
    this.tasklistid = this.$route.query.tasklistid
    this.type = this.$route.query.type

    if (this.workflowId) {
      // 加载待移出主体名单及 事实理由
      getBizRemInfo(this.bizseq).then(res => {
        if (res.code === 0) {
          // 添加分页index
          const list = []
          let i = 1
          const pageStart = (this.currentPage - 1) * this.pageSize
          res.data.bizList.forEach(each => {
            each.index = pageStart + i++
            each.uscc = each.uniscid ? each.uniscid : each.regno // 有统一码显示统一码 没有用注册号
            list.push(each)
          })
          this.entbase = list
          this.tsabnlist = res.data.tsAbnList
          const bizInfo = res.data.bizRemListMOdel
          this.companyInfo = res.data.bizRemListMOdel
          this.isAccept = bizInfo.isAccept
          this.backProposal = bizInfo.backProposal
          this.isAgreeRepair = bizInfo.isAgreeRepair
          this.entname = bizInfo.entname
          this.$set(this, 'reason', bizInfo.remreasons)
          this.specause = bizInfo.specause
          this.remRemark = bizInfo.remRemark
          this.specauseType = bizInfo.specauseType
          this.appOrPc = bizInfo.appOrPc
          this.isAgreeRepair = bizInfo.isAgreeRepair
          this.applicant = bizInfo.applicant
        } else {
          this.$message.error('加载异常名录主体信息失败')
        }
      })
      taskOpinion(this.workflowId).then(res => {
        if (res.code === 0) {
          res.data.forEach(each => {
            switch (each.opiniontype) {
              case '9':
                each.step = '经办'
                each.label = '经办人意见'
                break
              case '0':
                each.step = '经办'
                each.label = '经办人意见'
                break
              case '1':
                each.step = '审核'
                each.label = '经办机构负责人意见'
                break
              case '2':
                each.step = '审批'
                each.label = '部门负责人意见'
                break
            }
            if (each.opiniontype == '9') {
              this.htopinions.push(each)
            }
            this.historyLog.push(each)
            // if (each.opiniontype !== '9') {
            //   this.historyLog.push(each)
            // }
          })
        } else {
          this.$message.error('加载意见记录失败')
        }
      })
      this.loadAttachmentList()
      // 按类型加载企业移出原因
      if (this.type === 'farmer') {
        this.repairType = '1'
        this.getRemReaList('CD78')
      } else if (this.type === 'individual') {
        this.repairType = '2'
        this.getRemReaList('CD76')
      } else if (this.type === 'company') {
        this.repairType = '1'
        this.getCD72List()
      }
      // this.getHandleOpinion(this.workflowId, '0')
      // this.getReviewOpinion(this.workflowId, '1')
      // this.getApprovalOpinion(this.workflowId, '2')

      //获取获取待办信息
      getTaskList(this.tasklistid).then(res => {
        if (res.code === 0) {
          this.busstatus=res.data.busstatus
        }
      })

      //获取流程节点信息
      getProcessNodeList(this.workflowId).then(res => {
          if (res.code === 0 && res.data.length>0) {
            this.nodeflow = res.data[0].nodeflow.split("_")
            this.currentnode = res.data[0].currentnode
          }
      })
    } else {
      console.log('history===================')
      selectHistorybizRemlist(this.bizseq).then(res => {
        if (res.code === 0) {
          this.tsabnlist = res.data.tsAbnList ? res.data.tsAbnList : { abntime: '', intoDecorg: '', pereasons: '' }
          const bizInfo = res.data.bizRemListMOdel
          this.companyInfo = res.data.bizRemListMOdel
          this.isAccept = '1'
          this.backProposal = bizInfo.backProposal
          this.isAgreeRepair = '1'
          this.entname = bizInfo.entname
          this.$set(this, 'reason', bizInfo.remreasons)
          this.specause = bizInfo.specause
          this.remRemark = bizInfo.remRemark
          this.specauseType = bizInfo.specauseType
          this.appOrPc = bizInfo.appOrPc
          this.applicant = bizInfo.applicant
        }
        res.data.tsOpinions.forEach(each => {
          switch (each.opiniontype) {
            case '9':
              each.step = '经办'
              each.label = '经办人意见'
              break
            case '0':
              each.step = '经办'
              each.label = '经办人意见'
              break
            case '1':
              each.step = '审核'
              each.label = '经办机构负责人意见'
              break
            case '2':
              each.step = '审批'
              each.label = '部门负责人意见'
              break
          }
          if (each.opiniontype === '9') {
            this.htopinions.push(each)
          }
          this.historyLog.push(each)
        })
        const list = []
        res.data.tsAttachments.forEach(each => {
          if (each.attachtype !== '0') {
            each.id = each.attachmentid
            each.name = each.filename
            each.url = `${process.env.VUE_APP_DOWNLOAD_URL}/` + each.temppath
            each.filetype = '99'
            list.push(each)
          }
        })
        this.fileUri.file99 = list
        this.tswrittemplate.content = res.data.content
      })
    }
  },
  methods: {
    // 加载移出原因
    getRemReaList(code) {
      getConstant(code).then(res => {
        if (res.code === 0) {
          const list = []
          res.data.forEach(each => {
            list.push({
              value: each.code,
              label: each.name
            })
          })
          this.reasonOptions = list
        }
      })
    },
    getCD72List() {
      getCD72().then(res => {
        if (res.code === 0) {
          const list = []
          res.data.forEach(each => {
            list.push({
              value: each.code,
              label: each.name
            })
          })
          this.reasonOptions = list
        }
      })
    },
    // 加载附件清单
    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.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.file9 = data.filter((item) => {
          return item.filetype === '9'
        }).map((item) => {
          return {
            ...item,
            id: item.attachmentid,
            name: item.filename,
            url: `${process.env.VUE_APP_DOWNLOAD_URL}/${item.temppath}`
          }
        })
        this.fileUri.file10 = data.filter((item) => {
          return item.filetype === '10'
        }).map((item) => {
          return {
            ...item,
            id: item.attachmentid,
            name: item.filename,
            url: `${process.env.VUE_APP_DOWNLOAD_URL}/${item.temppath}`
          }
        })
        this.fileUri.file10.forEach(each => {
          this.fileUri.file9.push(each)
        })
        this.fileUri.file99 = data.filter((item) => {
          return !['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'].includes(item.filetype)
        }).map((item) => {
          return {
            ...item,
            id: item.attachmentid,
            name: item.filename,
            url: `${process.env.VUE_APP_DOWNLOAD_URL}/${item.temppath}`
          }
        })
      })
    },
    // 获取最新经办意见
    getHandleOpinion(workflowid, opinionType) {
      getNewestOpinion(workflowid, opinionType).then(res => {
        if (res.code === 0 && res.data !== null) {
          this.handleOpinion.opinionContent = res.data.opinioncontent
          this.handleOpinion.operOpinion = res.data.operOpinion
          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')
        }
      })
    },
    // 获取最新审核意见
    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')
        }
      })
    },
    // 获取最新审批意见
    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
          this.$nextTick(() => {
            this.$set(this.formData, 'opinion', res.data.opinioncontent)
            this.$set(this.formData, 'handledate', res.data.handledate)
          })
        }
      })
    },
    openDialog(type) {
      var title = ''
      if (type === 'disagreeDec') {
        title = '不予受理决定书'
        this.eidtDialog = true
        this.$nextTick(() => {
          this.clearEditorContent(type)
          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.$nextTick(() => {
          this.clearEditorContent(type)
          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.$nextTick(() => {
          this.clearEditorContent(type)
          this.eidtContent = this.tswrittemplate.content
          this.editorDialogType = type
          if (this.editorDisable) {
            this.$refs.editorDialog.$emit('disable')
          }
        })
      }
      this.dialogTitle = title
    },
    async clearEditorContent(type) {
      if (type !== this.editorDialogType) {
        await this.$refs.editorDialog.$emit('clear')
      }
    },
    // 获取不予受理决定书内容
    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
        } else {
          this.$message.error(res.msg)
        }
      })
    },
    // 获取不予信用修复决定书内容
    getNoRepairDecContent() {
      this.tswrittemplate.bizseq = this.bizseq
      if (this.type === 'farmer' || this.type === 'company') {
        this.$set(this.tswrittemplate, 'writsType', '55')
      } else {
        this.$set(this.tswrittemplate, 'writsType', '58')
      }
      this.tswrittemplate.type = this.type
      getContentsWithBizseq(this.tswrittemplate).then(res => {
        if (res.code === 0) {
          this.tswrittemplate.content = res.data.content
        } else {
          this.$message.error(res.msg)
        }
      })
    },
    // 获取准予信用修复决定书内容
    getRepairDecContent() {
      this.tswrittemplate.bizseq = this.bizseq
      if (this.type === 'farmer' || this.type === 'company') {
        this.$set(this.tswrittemplate, 'writsType', '56')
      } else {
        this.$set(this.tswrittemplate, 'writsType', '59')
      }
      this.tswrittemplate.type = this.type
      getContentsWithBizseq(this.tswrittemplate).then(res => {
        if (res.code === 0) {
          this.tswrittemplate.content = res.data.content
        } else {
          this.$message.error(res.msg)
        }
      })
    },
    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()
      }
    },
    beforeUpload(file) {
      if (!this.verificationPicFile(file)) {
        this.$message.error('上传格式不支持，请重新上传')
        return false
      } else {
        return true
      }
    },
    handlePreview(file) {
      if (this.workflowId) {
        window.open(file.url)
      } else {
        console.log('jiufujian===========')
        downLoadHistoryFile(file.id).then(res => {
          this.download2(res, file.name)
        }).catch(req => {
          console.log('下载失败', req)
        })
      }
    },
    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)
          }
        })
      }
    },
    // 接收子组件的传参
    changeEditor(val) {
    //   console.log(val)
    //   this.eidtContent = val
    },
    getTextVal(res) {
      // const list = []
      res.forEach(each => {
        console.log(each)
      })
    },
    // 点击上传文件
    clickUpload(index) {
      this.$refs[`file${index}`].click()
    },
    // 文件上传
    fileUpload(index) {
      const el = this.$refs[`file${index}`]
      if (el.values === '') return
      const cur = this
      uploadFile({
        filetype: index,
        attachtype: index,
        bizseq: this.bizseq,
        pripids: this.companyInfo.priPID
      }, el.files[0]).then(res => {
        el.values = ''
        if (res.code === 0) {
          this.$message.success('上传成功')
          cur.$set(cur.fileUri, `file${index}`, res.data[0].temppath)
        } else {
          this.$message.error('上传失败')
        }
      })
    },
    // 查看附件
    openFile(index) {
      window.open(this.fileUri['file' + index])
    },
    // 提交审核
    submitExamine() {
      this.submitLoading = true
      if (this.$util.isEmpty(this.formData.opinion)) {
        this.submitLoading = false
        return this.$message.error('请输入部门负责人意见')
      }
      this.formData.isagree = '1'
      if (this.formData.nextNodeID === 'exptlistEnter') {
        this.formData.isagree = '2'
      }
      this.formData.nextPerformerids = ''
      this.formData.bizseq = this.bizseq
      this.formData.workflowid = this.workflowId
      this.formData.tasklistid = this.tasklistid
      this.formData.handler = this.user.nickname
      this.formData.handlerid = this.user.primaryKey
      this.formData.opiniontype = '2'
      this.formData.opinioncontent = this.formData.opinion
      bizRemoveNext(this.formData).then(res => {
        this.submitLoading = false
        if (res.code === 0) {
          this.$message.success('提交成功')
          this.$router.back()
        } else {
          this.$message.error('提交失败，' + res.msg)
        }
      })
    },
    // 移除文件回调
    removeFile(file) {
      removeAttachementById(file.response.data.attachmentid).then(res => {
        if (res.code === 0) {
          this.$message.success('删除成功')
        } else {
          this.$message.error(res.msg)
        }
      })
    },
    // 加载审核人
    loadReviewer() {
      getUsersWithPermission('illegalRemoveReview', this.user.orgId).then(res => {
        if (res.code === 0) {
          this.reviewer = res.data
        }
      })
    },
    download2(data, fileName) {
      if (!data) {
        return
      }
      console.log(data)
      const url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel;charset=utf-8' }))
      // window.open(url)
      const link = document.createElement('a')
      link.style.display = 'none'
      link.href = url
      link.setAttribute('download', fileName)
      // document.body.appendChild(link)
      link.click()
    },
    cancelBusiness(){
      this.$confirm('是否确认撤销业务?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        bizRemCancelBusiness(this.bizseq).then(res => {
          if (res.code === 0) {
            this.$message({
              type: 'success',
              message: '撤销成功'
            });
            this.$router.back()
          }else{
            this.$message.error('撤销失败');
          }
        })
      }).catch(() => {
      });
    }
  }
}
</script>

<style lang="scss" scoped>
div.submit-btn-box{
  text-align: center;
  padding:15px;
}
.disabled-upload-remove{
  /deep/ .el-upload-list__item-status-label{
    display: none;
  }
  /deep/ .el-icon-close{
    display: none;
  }
  /deep/ .el-icon-close-tip{
    display: none!important;
  }
}
.main-content{
  .back-btn{
    position:absolute;
    right:40pt;
  }
  .content-header,.content-body{
    /* 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;
    border-color: $color-border;
    margin-bottom: 30px;
    tr{
      width:100%
    }
    th,td{
      font-size: $table-title-font-size;
      padding:15px
    }
    th{
      text-align: $text-algin-right;
      color: #5e5e5e;
      font-weight: normal;
      background: $color-form-label
    }
    td{
      text-align:$text-algin-left;
    }
  }

}
.table-title{
  width: 100%;
  margin-top: 10px;
  padding: 15px;
  display: flex;
  align-items: center;
  font-weight: 600;
  background: #fff;
  font-size: $page-title-font-size;
  color:#333;

}
.title-btn{
  margin-top: 15px;
  margin-right: 40px;
  text-align: right;
  background: #fff;
}
</style>
<style lang="scss">
.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;
      }
    }
  }
  .el-input.is-disabled .el-input__inner{
    color: unset;
  }
}

</style>
