<template>
  <div class="main-content deregist m20">
    <div class="content-header">
      <img src="../../../assets/images/icon-text.png" alt="" style="width:24px;margin-right:10px">
      <span class="title">业务办理</span>
    </div>
    <div class="content-body">
      <el-form ref="form" :model="form" label-width="200px" label-position="right" :rules="formRules">
        <div class="form">
          <div class="form">
            <div class="tab">
              <div class="tab-title"><label>惩戒信息</label></div>
            </div>
            <div class="form-body">
              <el-row class="lh0">
                <el-form-item label="主体名单">
                  <el-button size="mini" type="primary" @click="showEntbaseList">查看主体名单<i class="el-icon el-icon-s-order" style="margin-left:5px" /></el-button>
                </el-form-item>
              </el-row>
              <el-row class="bt0">
                <el-form-item label="锁定原因" prop="lockreason">
                  <el-col :span="24">
                    <el-input v-model="lockReason" type="textarea" style="width:99%;margin:5px 0 5px 0" :autosize="{ minRows: 4 }" />
                  </el-col>
                </el-form-item>
              </el-row>
              <el-row class="bt0">
                <!--                  <el-form-item label="惩戒来源" prop="lockreason">-->
                <!--                    <el-col :span="24">-->
                <!--                      <el-input v-model="punishFrom" type="textarea" style="width:99%;margin:5px 0 5px 0" :autosize="{ minRows: 4 }" />-->
                <!--                    </el-col>-->
                <!--                  </el-form-item>-->
                <el-form-item label="惩戒来源" prop="punishFrom">
                  <el-col :span="24">
                    <el-select v-model="form.punishFrom" filterable clearable placeholder="请选择惩戒来源" @change="getMeasure()">
                      <el-option
                        v-for="item in punishFromList"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                        type="text"
                      />
                    </el-select>
                  </el-col>
                </el-form-item>
              </el-row>
              <el-row class="bt0">
                <el-form-item label="惩戒措施" prop="measure">
                  <el-col :span="24">
                    <el-select v-model="measure" style="width:99%;margin:5px 0 5px 0" placeholder="请选择惩戒措施" class="custom" filterable>
                      <el-option
                        v-for="item in measureOptions"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                      >
                        <span style="display:block;float: left;width:850px;overflow: hidden;">{{ item.value }}</span>
                        <span style="float: right; color: #8492a6; font-size: 13px">{{ item.department }}</span>
                      </el-option>
                    </el-select>
                  </el-col>
                  <el-col :span="24">
                    <el-input v-model="form.measure" style="width:99%;margin:5px 0 5px 0" type="textarea" disabled />
                  </el-col>
                </el-form-item>
              </el-row>
              <el-row class="bt0">
                <el-form-item label="锁定类型" prop="locktype">
                  <el-col :span="12">
                    <el-select v-model="form.locktype" disabled style="width:100%;margin-top:5px" clearable filterable placeholder="请选择锁定类型" class="custom">
                      <el-option
                        v-for="item in lockTypeOptions"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                      />
                    </el-select>
                  </el-col>
                </el-form-item>
              </el-row>
              <el-row class="bt0 p0">
                <el-form-item label="材料上传" class="upload">
                  <el-upload
                    :action="uploadPath"
                    :data="{bizseq:bizseq}"
                    :on-remove="removeFile"
                    :on-success="uploadCallback"
                    :on-preview="previewFile"
                    :before-upload="beforeFileUpload"
                    :before-remove="beforeRemove"
                    accept=".doc,.docx,.xlsx,.xls,.pdf,.jpg,.zip,.rar,.7z"
                    multiple
                    :file-list="fileList"
                    style="max-width:800px;display: inline-block"
                    class="uploadFileList"
                  >
                    <!-- <el-button size="small" type="primary">点击上传</el-button> -->
                    <div style="display: inline-block;">
                      <el-button style="display: inline-block;" type="primary">点击上传</el-button>
                      <div slot="tip" style="display: inline-block;" class="el-upload__tip">只能上传jpg/png/pdf/doc/docx/xls/xlsx/rar/zip/7z文件，且单个文件不能超过20M</div>
                    </div>
                  </el-upload>
                </el-form-item>
              </el-row>
              <!-- <el-form-item label="锁定人">
                <span>{{ complaintTypeStr }}</span>
              </el-form-item> -->
            </div>
          </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" style="width:99%;margin:5px 0 5px 0" type="textarea" placeholder="请输入经办意见" :autosize="{ minRows: 2}" />
                </el-col>
                <el-col :span="12">
                  <label>常用语</label>
                  <el-select v-model="opinion" style="width:100%" placeholder="请选择" clearable class="custom">
                    <el-option
                      v-for="item in opinionOptions"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-col>

              </el-form-item>
            </el-row>
            <el-row class="bt0">
              <el-form-item label="审核人" prop="reviewerId">
                <el-col :span="12">
                  <el-select v-model="form.reviewerId" style="width:100%;margin-top:5px" clearable filterable 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>
      </el-form>
      <div class="submit-box">
        <el-button type="primary" :loading="submitLoading" @click="submitForm">提交</el-button>
        <el-button @click="$router.back()">返回</el-button>
      </div>
    </div>
    <HandleDialog :show.sync="showEntbase" title="主体名单">
      <el-table :data="dataShow" tooltip-effect="dark" size="mini" style="width: 100%; min-height: 400px;" :fit="true" @selection-change="handleSelectionChange">
        <el-table-column class="no" type="selection" min-width="20" align="center" />
        <el-table-column prop="index" label="序号" min-width="50" align="center" />
        <el-table-column prop="uniscid" label="统一社会信用代码" min-width="160" align="left" />
        <el-table-column prop="entname" :show-overflow-tooltip="true" label="主体名称" min-width="150" align="left">
          <template slot-scope="scope">
            <a style="color:blue;cursor:pointer" @click="Entdetail(scope.row)">{{ scope.row.entname }}</a>
          </template>
        </el-table-column>
        <el-table-column prop="dom" :show-overflow-tooltip="true" label="经营地址" min-width="150" align="left" />
        <!--<el-table-column prop="estdate" :show-overflow-tooltip="true" label="成立日期" min-width="90" align="left" />-->
        <!--6月7日<el-table-column prop="name" label="法定代表人" align="left" />-->
        <!--<el-table-column prop="lerep" label="法定代表人" align="left" />-->
        <!-- <el-table-column prop="sendtime" label="发送时间" align="left" /> -->
        <!--6月7日<el-table-column prop="entTypeName" :show-overflow-tooltip="true" label="企业类型" min-width="100" align="left" />-->
        <!--<el-table-column prop="typeName" :show-overflow-tooltip="true" label="企业类型" min-width="100" align="left" />-->
        <!--6月7日<el-table-column prop="regstateCn" :show-overflow-tooltip="true" label="企业状态" min-width="120" align="left" />-->
        <el-table-column prop="regorg" :show-overflow-tooltip="true" label="登记机关" min-width="120" align="left" :formatter="regOrgFormat" />
        <el-table-column prop="regstate" :show-overflow-tooltip="true" label="企业状态" min-width="120" align="left" :formatter="regStateformat" />
      </el-table>
      <!--      <el-table v-if="punishFrom === '1'" :data="infoList" tooltip-effect="dark" size="mini" style="width: 100%; min-height: 400px;" :fit="true" @selection-change="handleSelectionChange">-->
      <!--        <el-table-column class="no" type="selection" min-width="20" align="center" />-->
      <!--        <el-table-column prop="index" label="序号" min-width="50" align="center" />-->
      <!--        <el-table-column prop="uniscid" label="统一社会信用代码" min-width="160" align="left" />-->
      <!--        <el-table-column prop="entName" :show-overflow-tooltip="true" label="主体名称" min-width="150" align="left" />-->
      <!--        <el-table-column prop="name" :show-overflow-tooltip="true" label="主要负责人" min-width="90" align="left" />-->
      <!--        <el-table-column prop="dishonestyAct" :show-overflow-tooltip="true" label="失信行为简况" min-width="170" align="left" />-->
      <!--        <el-table-column prop="infoReportAuthority" :show-overflow-tooltip="true" label="信息报送机关" min-width="100" align="left" />-->
      <!--        <el-table-column prop="includeReason" :show-overflow-tooltip="true" label="纳入理由" min-width="150" align="left" />-->
      <!--        <el-table-column prop="registeAddress" :show-overflow-tooltip="true" label="注册地址" align="left" />-->
      <!--      </el-table>-->
      <!--      <el-table v-if="punishFrom === '3'" :data="infoList" tooltip-effect="dark" size="mini" style="width: 100%; min-height: 400px;" :fit="true" @selection-change="handleSelectionChange">-->
      <!--        <el-table-column class="no" type="selection" min-width="20" align="center" />-->
      <!--        <el-table-column prop="index" label="序号" min-width="50" align="center" />-->
      <!--        &lt;!&ndash; <el-table-column prop="uniscid" label="组织机构代码" min-width="160" align="left" /> &ndash;&gt;-->
      <!--        <el-table-column prop="qyzwmc" :show-overflow-tooltip="true" label="企业中文名称" min-width="150" align="left" />-->
      <!--        <el-table-column prop="sczcrq" :show-overflow-tooltip="true" label="首次注册日期" min-width="90" align="left" />-->
      <!--        <el-table-column prop="xydj" :show-overflow-tooltip="true" label="信用等级" min-width="100" align="left" />-->
      <!--        <el-table-column prop="djrdsj" label="登记认定时间" min-width="100" align="left" />-->
      <!--        <el-table-column prop="frdb" :show-overflow-tooltip="true" label="法人代表" min-width="150" align="left" />-->
      <!--        <el-table-column prop="zcdz" label="注册地址" align="left" />-->
      <!--        <el-table-column prop="zxbz" label="注销标志" align="left" />-->
      <!--      </el-table>-->
      <el-row>
        <el-col :span="18">
          <el-pagination
            :current-page="currentPage"
            small
            layout="prev, pager, next"
            :total="total"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
          />
        </el-col>
        <el-col :span="6">
          <div class="dialog-box">
            <!-- <el-button type="danger" size="mini" @click="removeEntbaseItem">剔除</el-button> -->
            <el-button type="primary" size="mini" @click="showEntbaseList">确定</el-button>
          </div>
        </el-col>
      </el-row>
    </HandleDialog>
  </div>
</template>

<script>
import DetailHead from '@/components/DetailHead'
import HandleDialog from '@/components/HandleDialog'
import { delFile, listAttachmentByBizseq } from '@/api/attachment'
import { getUsersWithPermission } from '@/api/user'
import { taskOpinion } from '@/api/task'
import { getPunishFromList, getEntInfoPageandPunishFrom, next, getLockTypeList, getMeasureList, getRegStateNameList, getRegorgList } from '@/api/punishment'
import { validBeforeUpload } from '@/api/fileUpload'
import { isMenHu } from '@/utils/utils'

export default {
  components: {
    HandleDialog: HandleDialog,
    DetailHead
  },
  data() {
    return {
      measure: '',
      measureId: '',
      measureOptions: [],
      infoList: [],
      lockReason: '按照《中华人民共和国国民经济和社会发展第十四个五年规划和2035年远景目标纲要》《国务院办公厅关于进一步完善失信约束制度构建诚信建设长效机制的指导意见》（国办发〔2020〕49号）要求，进一步规范失信惩戒措施，保护信用主体合法权益，国家发展改革委、人民银行会同社会信用体系建设部际联席会议成员单位和其他有关部门（单位），严格以法律、行政法规和党中央、国务院政策文件为依据，根据《广州市人民政府关于印发广州市建立完善守信联合激励和失信联合惩戒机制实施方案的通知》（穗府〔2019〕1号）的要求进行联合惩戒。（可办理：一、企业因地址原因列入经营异常名录办理的地址变更，二、企业办理清算小组备案)',
      commonLockReason: '联合惩戒要求进行限制；2、根据《失信企业协同监管和联合惩戒合作备忘录》（发改财金〔2015〕2045号）《广州市人民政府关于印发广州市建立完善守信联合激励和失信联合惩戒机制实施方案的通知》（穗府〔2019〕1号）。 （可办理：一、企业因地址原因列入经营异常名录办理的地址变更，二、企业办理清算小组备案，办理注销）',
      punishFromList: [],
      punishFrom: 0,
      punishFromStr: '',
      departmentCode: '',
      user: JSON.parse(sessionStorage.getItem('user')),
      uploadPath: `${process.env.VUE_APP_BASE_API}/attachment/uploadFileByBizseq`,
      showEntbase: false,
      bizseq: '',
      workflowId: '',
      tasklistid: '',
      submitLoading: false,
      entbase: [], // 主体名单列表
      // 分页数据,这里用来保存每页切割后的数据
      // 看起来格式是这样的[[{},{},{}],[{},{},{}]]
      // 数组内套数组，每个数组就是一页数据
      totalPageData: [],
      // 共几页
      pageNum: '',
      // 每页显示数量
      pageSize: 10,
      // 当前显示页码
      currentPage: 1,
      // 总共多少条数据
      total: 1,
      // 当前要显示的数据
      dataShow: [],
      // 选中数组
      multipleSelection: [],
      form: {
        opinion: '',
        locktype: '001',
        measure: '',
        punishFrom: ''
      },
      formRules: {
        // 6月7日 lockreason: [
        //   { required: true, message: '请输入锁定原因', trigger: 'blur' }
        // ],
        locktype: [
          { required: true, message: '请选择锁定类型', trigger: 'blur' }
        ],
        opinion: [
          { required: true, message: '请输入经办意见', trigger: ['blur', 'change'] }
        ],
        reviewerId: [
          { required: true, message: '请选择审核人' }
        ],
        punishFrom: [
          { required: true, message: '请选择惩戒来源' }
        ]
        // measure: [
        //   { required: true, message: '请选择惩戒措施', trigger: ['blur', 'change'] }
        // ]
      },
      complaintTypeStr: '',
      researchResult: '',
      remarks: '',
      isSet: '1',
      reason: '',
      opinion: '',
      lockTypeOptions: [],
      opinionOptions: [],
      historyLog: [],
      exmainerOptions: [],
      fileList: [],
      reviewer: [],
      pageParam: {
        customParamMap: { bizseq: '' },
        curPage: 1,
        total: 0,
        pageSize: 10
      },
      regStateList: []
    }
  },

  watch: {
    // 措施渲染
    measure() {
      this.form.measure = this.measure
    },
    // 意见渲染
    opinion() {
      let name = ''
      this.opinionOptions.forEach(each => {
        if (this.opinion === each.value) {
          name = each.label
        }
      })
      this.form.opinion = name
    },
    punishFrom() {
      this.punishFromList.forEach(each => {
        if (each.value === this.punishFrom) {
          // this.punishFromStr = each.label
          this.$set(this, 'punishFromStr', each.label)
          if (this.$util.isEmpty(this.lockReason)) {
            this.$set(this, 'lockReason', '1、' + this.punishFromStr + this.commonLockReason)
          }
        }
      })
    },
    lockReason() {
      this.$set(this.form, 'lockreason', this.lockReason)
    }
  },
  mounted() {
    this.bizseq = this.$route.query.bizseq // 获取跳转携带的参数bizseq
    this.workflowId = this.$route.query.workflowId
    this.tasklistid = this.$route.query.tasklistid
    // 加载常用语
    this.opinionOptions = this.$util.getCommonWordsWithModule(this.user.primaryKey, '联合惩戒')

    this.pageParam.customParamMap.bizseq = this.bizseq
    this.regStateList = getRegStateNameList()
    this.regOrgList = getRegorgList()
    getEntInfoPageandPunishFrom(this.pageParam).then(res => {
      if (res.code === 0) {
        // this.lockReason = res.data.lockReason
        this.punishFrom = res.data.punishFrom
        this.departmentCode = res.data.department
        if (res.data.measure != null) {
          this.measure = res.data.measure
        }
        console.log(this.departmentCode + '==================')
        // this.$set(this, 'punishFrom', res.data.punishFrom)
        if (this.$util.isNotEmpty(res.data.locktype)) {
          this.$set(this.form, 'locktype', res.data.locktype)
        }

        const list = []
        let i = 1
        const pageStart = (this.pageParam.curPage - 1) * this.pageParam.pageSize
        res.data.page.forEach(each => {
          each.index = pageStart + i++
          each.typeName = each.entTypeName
          if (each.estdate !== null) {
            each.estdate = each.estdate.substr(0, 10)
          }
          this.entbase.push(each)
        })
        this.total = this.entbase.length
        this.calcPageData()
        // this.getMeasure()
      } else {
        this.$message.error(res.msg)
      }
    })

    // 加载惩戒来源
    this.punishFromList = getPunishFromList()
    // 加载锁定类型
    this.lockTypeOptions = getLockTypeList()

    // 加载处办记录
    taskOpinion(this.workflowId).then(res => {
      if (res.code === 0) {
        res.data.forEach(each => {
          switch (each.opiniontype) {
            case '0': each.step = '经办'
              break
            case '1': each.step = '审核'
              break
            case '2': each.step = '审批'
              break
          }
          this.historyLog.push(each)
        })
      } else {
        this.$message.error('加载处办记录失败')
      }
    })
    // // 加载惩戒措施清单
    // getMeasureList(this.departmentCode).then(res => {
    //   if (res.code === 0) {
    //     const list = []
    //     res.data.forEach(each => {
    //       list.push({
    //         value: each.measure,
    //         label: each.measure,
    //         department: each.department
    //       })
    //     })
    //     this.measureOptions = list
    //   }
    // })
    // 加载审核人
    this.loadReviewer()

    // 加载附件清单
    listAttachmentByBizseq(this.bizseq).then(data => {
      data.forEach(each => {
        each.id = each.attachmentid
        each.name = each.filename
        each.url = `${process.env.VUE_APP_DOWNLOAD_URL}/` + each.temppath
      })
      this.fileList = data
    })
  },
  methods: {
    // 加载惩戒措施清单
    getMeasure() {
      this.measureOptions = []
      this.measure = ''
      if (this.form.punishFrom !== '6') {
        if (!this.lockReason.endsWith('办理注销)')) {
          this.lockReason = this.lockReason.substring(0, this.lockReason.length - 1)
          this.lockReason = this.lockReason.concat('，办理注销)')
        }
      } else {
        this.lockReason = '按照《中华人民共和国国民经济和社会发展第十四个五年规划和2035年远景目标纲要》《国务院办公厅关于进一步完善失信约束制度构建诚信建设长效机制的指导意见》（国办发〔2020〕49号）要求，进一步规范失信惩戒措施，保护信用主体合法权益，国家发展改革委、人民银行会同社会信用体系建设部际联席会议成员单位和其他有关部门（单位），严格以法律、行政法规和党中央、国务院政策文件为依据，根据《广州市人民政府关于印发广州市建立完善守信联合激励和失信联合惩戒机制实施方案的通知》（穗府〔2019〕1号）的要求进行联合惩戒。（可办理：一、企业因地址原因列入经营异常名录办理的地址变更，二、企业办理清算小组备案)'
      }
      // getMeasureList(this.departmentCode).then(res => {
      getMeasureList(this.form.punishFrom).then(res => {
        if (res.code === 0) {
          const list = []
          res.data.forEach(each => {
            list.push({
              value: each.measure,
              label: each.measure,
              department: each.department
            })
          })
          this.measureOptions = list
        }
      })
    },
    // 惩戒来源格式化
    punishFromFormat(list, value) {
      list.forEach(each => {
        console.log(each)
        if (each.value === value) {
          // this.punishFromStr = each.label
          this.$set(this, 'punishFromStr', each.label)
          console.log(this.punishFromStr)
        }
      })
    },
    regStateformat(row) {
      let name = ''
      this.regStateList.forEach(each => {
        if (each.value === row.regstate) {
          name = each.label
        }
      })
      return name
    },
    regOrgFormat(row) {
      let name = ''
      this.regOrgList.forEach(each => {
        if (each.value === row.regorg) {
          name = each.label
        }
      })
      return name
    },
    // 计算页数
    calcPageData() {
      // 计算页数
      if (this.entbase.length >= 1) {
        this.pageNum = Math.ceil(this.entbase.length / this.pageSize) || 1
        console.log('总页数:', this.pageNum)
      }
      // 数据分组
      for (let i = 0; i < this.pageNum; i++) {
        this.totalPageData[i] = this.entbase.slice(this.pageSize * i, this.pageSize * (i + 1))
      }
      this.dataShow = this.totalPageData[this.currentPage - 1]
      console.log(this.dataShow)
    },
    // 每页条数发生变化
    handleSizeChange(newPageSize) {
      this.pageSize = newPageSize
      // 重新计算页数并分组
      this.calcPageData()
    },
    // 当前页码发生变化
    handleCurrentChange(newPageNum) {
      console.log('当前页码:', newPageNum)
      this.currentPage = newPageNum
      this.dataShow = this.totalPageData[newPageNum - 1]
    },
    // 剔除主体名单
    removeEntbaseItem() {
      if (this.multipleSelection.length === 0) return this.$message.error('请至少选择一个企业从此列表中剔除')
      this.$confirm('是否确认剔除', '提示').then(() => {
        console.log(this.multipleSelection)
        // 遍历获取spelistid 拼接成字符串形式
        let ids = ''
        this.multipleSelection.forEach(each => {
          ids += (each.spelistid + ';')
        })
        // 调接口
        removeBySpelistid(ids.substring(0, ids.length - 1)).then(res => {
          if (res.code === 0) {
            this.multipleSelection.forEach(each => {
            // 表示先获取这个元素的下标，然后从这个下标开始计算，删除长度为1的元素
              this.entbase.splice(this.entbase.indexOf(each), 1)
            })
            let i = 1
            const pageStart = (this.currentPage - 1) * this.pageSize
            this.entbase.forEach(each => {
              each.index = pageStart + i++
            })
            // 重新计算页数
            this.calcPageData()
            this.$message.success('剔除成功')
          } else {
            this.$message.error(res.msg)
          }
        })
      })
    },

    handleSelectionChange(val) {
      this.multipleSelection = val
    },
    // 提交
    submitForm() {
      // 6月7日 if (this.$util.isEmpty(this.form.measure)) {
      //   return this.$message.warning('请选择惩戒措施')
      // }
      this.$refs.form.validate(valid => {
        if (!valid) return
        this.$confirm('是否确认发送？', '提示').then(() => {
          this.form.bizseq = this.bizseq
          this.form.workflowid = this.workflowId
          this.form.opiniontype = '0'
          this.form.handler = this.user.username
          this.form.handlerid = this.user.primaryKey
          this.form.opinioncontent = this.form.opinion
          this.form.tasklistid = this.tasklistid
          // this.form.nextPerformerids = this.user.primaryKey
          // this.form.nextPerformerNames = this.user.username
          this.form.nextPerformerids = this.form.reviewerId
          this.form.lockreason = this.lockReason
          this.form.nextNodeID = 'handlePunish'
          for (const i in this.reviewer) {
            if (this.reviewer[i].primaryKey === this.form.reviewerId) {
              this.form.nextPerformerNames = this.reviewer[i].name
            }
          }
          debugger
          this.submitLoading = true
          next(this.form).then(res => {
            this.submitLoading = false
            if (res.code === 0) {
              // if (this.user.primaryKey === this.form.reviewerId) {
              //   this.$router.push({ path: '/punish/inclusion/review', query: { tasklistid: res.data.taskListId, bizseq: res.data.bizseq, workflowId: res.data.workFlowId }})
              // } else {
              //   this.$message.success('提交成功')
              //   this.$router.back()
              // }
              this.$message.success('提交成功')
              if (isMenHu()) {
                // 信创门户环境跳转回待办
                window.location.href = '/aiccs/#/todo/list'
              } else {
                this.$router.back()
              }
            } else {
              this.$message.error(res.msg)
            }
          })
        })
      })
    },

    previewFile(file) {
      // downLoadFile(file.id).then(res => {
      //   const url = window.URL.createObjectURL(file)
      //   window.open(url)
      //   // const link = document.createElement('a')
      //   // link.href = window.URL.createObjectURL(res)
      //   // link.download = file.name
      //   // link.click()
      //   // window.open(link.href)
      //   // window.URL.revokeObjectURL(link.href)
      // })
      window.open(file.url, '_blank')
      // window.open(`${process.env.VUE_APP_BASE_API}/attachment/download?id=${file.id}`, '_blank')
    },
    uploadCallback(res, file) {
      if (res.code === 0) {
        file.filename = res.data.filename
        file.id = res.data.attachmentid
        file.url = `${process.env.VUE_APP_DOWNLOAD_URL}` + res.data.temppath
        this.$message.success('上传成功')
      }
    },
    // 上传文件之前校验大小
    beforeFileUpload(file) {
      var that = this
      return validBeforeUpload(file, that)
    },
    // 移除文件前
    beforeRemove(file, fileList) {
      if (file && file.status === 'success') {
        return this.$confirm(`确定移除 ${file.name} ？`)
      }
    },
    // 查看主体名单
    showEntbaseList() {
      this.showEntbase = !this.showEntbase
    },
    // 移除文件回调
    removeFile(file) {
      if (file && file.status === 'success') {
        delFile(file.id).then(res => {
          if (res.code === 0) {
            this.$message.success('删除成功')
          } else {
            this.$message.error(res.msg)
          }
        })
      }
    },
    // 加载审核人
    loadReviewer() {
      // getUsersWithPermission('punishUnlockHandle', this.user.orgId).then(res => {
      getUsersWithPermission('punishLockEnter', this.user.orgId).then(res => {
        if (res.code === 0) {
          this.reviewer = res.data
        }
      })
    },
    Entdetail(row) {
      this.$router.push({ path: '/comprehensive/details', query: { pripid: row.pripid }})
    }
  }
}
</script>

<style lang="scss" scoped>
.deregist{
  .back-btn{
    position:absolute;
    right:40pt;
  }
  .content-header,.content-body{
    background: white;
    padding:20PX 10PX;
    border:1PX solid #eee;
  }
  .content-header{
    height:60PX;
    .title{
      font-weight: 700;
      font-size: $font-size-sub-title;
    }
  }
  .content-body{
    padding:20pt;
      .tab{
        .tab-title{
          label{
            display:inline-block;
          }
        }
      }
    .form{
      margin-bottom: 20pt;
    }
  }
}
</style>
<style lang="scss">
.main-content.deregist{
    font-size: $table-content-font-size;
  .el-form-item{
    margin-bottom:0;
    background: $color-form-label;
    .el-form-item__label{
      padding-left: 10px;
      border-top: 1px solid $color-border;
      border-left: 1px solid $color-border;
      font-size: $table-content-font-size;
    }
    .el-form-item__content{
      background: white;
      padding: 10px;
      border-top: 1px solid $color-border;
      border-right: 1px solid $color-border;
      border-left: 1px solid $color-border;
      font-size: $table-content-font-size;

    }
  }
  .el-form-item:last-child{
    border-bottom: 1px solid $color-border;
  }
  .form-body.history{
    padding:15px;
    border:1px solid $color-border;
  }
  .form-body .history .none{
    font-size: $table-content-font-size!important;
  }
  .el-form-item.is-error .custom .el-input__inner{
    border-color:$color-border;
  }
  .el-table-column--selection .cell {
    padding-right: 0px;
  }
  .no {
    padding-left: 0px;
  }
  .el-table_9_column_61.is-left.is-leaf{
    .cell{
      padding-left: 0px;
      padding-right: 0px;
    }
  }
  .handle-dialog.mid>.main-dialog{
    min-height: 300px;
    width: 75vw;
  }
  .el-pagination{
    text-align: left;
  }
  .dialog-box{
    text-align: right;
  }
  .upload .el-form-item__label::after{
    display: inline-block;
    content: '(单个文件不能超过20M)';
    color: #F56C6C;
  }
  .el-textarea.is-disabled .el-textarea__inner{
    color: #1c1e23;
  }
  .el-input__inner{
    margin-bottom: 5px;
  }
}
</style>
