<template>
  <div class="main-content abnormal" v-loading.fullscreen.lock="fullscreenLoading">
    <DetailHead result="审批界面" />
    <div class="content-body">
      <el-form ref="form" :model="fraudEntInfo" label-width="220px" label-position="right" :rules="formRules">
        <div class="form">
          <div class="tab">
            <div class="tab-title">
              <label>被投诉人信息</label>
            </div>
          </div>
          <div class="form-body">
            <el-row class="flex-row">
              <el-col :span="12">
                <el-form-item label="主体名称">
                  <span style="color: #8cc3fb;cursor: pointer;" class="span-content" @click="toEntDetail(entInfo.uniscid)">{{ entInfo.entname }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="统一社会信用代码/注册号">
                  <span class="span-content">{{ entInfo.uniscid || entInfo.regno }}</span>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row class="bt0 flex-row">
              <el-col :span="12">
                <el-form-item label="法定代表人">
                  <span class="span-content">{{ entInfo.lerep }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="联系方式">
                  <span class="span-content">{{ entInfo.phone }}</span>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row class="bt0">
              <el-form-item label="登记机关">
                <span class="span-content">{{ entInfo.regorgCn }}</span>
              </el-form-item>
            </el-row>

          </div>
        </div>
        <div class="form">
          <div class="tab">
            <div class="tab-title">
              <label>投诉人信息</label>
            </div>
          </div>
          <div v-if="bizFraudInfo.complainerType === '0'" class="form-body">
            <el-row class="flex-row">
              <el-col :span="12">
                <el-form-item label="姓名">
                  <span class="span-content">{{ bizFraudInfo.complainerName }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="联系电话">
                  <span class="span-content">{{ bizFraudInfo.contactsPhone }}</span>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row class="bt0 flex-row">
              <el-col :span="12">
                <el-form-item label="证件类型">
                  <span class="span-content">{{ certype(bizFraudInfo.complainerCertType) }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="证件号码">
                  <span class="span-content">{{ bizFraudInfo.complainerCertNo }}</span>
                </el-form-item>
              </el-col>
            </el-row>
            <!-- <el-form-item label="投诉材料">
              <el-input v-model="form.uscc" :disabled="true" />
              <el-button type="primary" size="mini" @click="showEntbaseList">查看全部材料</el-button>
            </el-form-item> -->
          </div>
          <div v-else-if="bizFraudInfo.complainerType === '2'" class="form-body">
            <el-row class="flex-row">
              <el-col :span="12">
                <el-form-item label="来函单位名称">
                  <span class="span-content">{{ bizFraudInfo.complainerName }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="单位联系电话">
                  <span class="span-content">{{ bizFraudInfo.contactsPhone }}</span>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row class="bt0 flex-row">
              <el-col :span="24">
                <el-form-item label="单位联系人">
                  <span class="span-content">{{ bizFraudInfo.contacts }}</span>
                </el-form-item>
              </el-col>
            </el-row>
          </div>
          <div v-else class="form-body">
            <el-row class="flex-row">
              <el-col :span="12">
                <el-form-item label="统一社会信用代码">
                  <span class="span-content">{{ bizFraudInfo.complainerCertNo }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="主体名称">
                  <span class="span-content">{{ bizFraudInfo.complainerEntName }}</span>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row class="bt0">
              <el-col :span="24">
                <el-form-item label="主体类型">
                  <span class="span-content">{{ bizFraudInfo.complainerCertType }}</span>
                </el-form-item>
              </el-col>

            </el-row>
            <el-row class="bt0 flex-row">
              <el-col :span="12">
                <el-form-item label="法定代表人">
                  <span class="span-content">{{ bizFraudInfo.complainerName }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="法定代表人联系电话">
                  <span class="span-content">{{ bizFraudInfo.complainerLegalPhone }}</span>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row class="bt0 flex-row">
              <el-col :span="12">
                <el-form-item label="联系人">
                  <span class="span-content">{{ bizFraudInfo.contacts }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="联系人电话">
                  <span class="span-content">{{ bizFraudInfo.contactsPhone }}</span>
                </el-form-item>
              </el-col>
            </el-row>
            <!-- <el-form-item label="投诉材料">
              <el-input v-model="form.uscc" :disabled="true" />
              <el-button type="primary" size="mini" @click="showEntbaseList">查看全部材料</el-button>
            </el-form-item> -->
          </div>
          <el-row class="bt0">
            <el-form-item :label="bizFraudInfo.complainerType === '2'?'来函文件':'投诉人身份信息'" class="upload">
              <el-upload
                :action="uploadPath"
                :data="uploadBodyData(0)"
                :on-remove="removeFile"
                :on-success="uploadCallback"
                :on-preview="previewFile"
                :before-upload="beforeFileUpload"
                :before-remove="beforeRemove"
                accept=".doc,.docx,.xlsx,.xls,.pdf,.jpg,.zip,.rar,.7z,.png"
                multiple
                :disabled="onlyShow"
                name="files"
                :file-list="fileList0"
                style="max-width:800px;display: inline-block"
                class="uploadFileList"
                :class="{disabled: onlyShow}"
              >
                <div v-if="!onlyShow" style="display: inline-block;">
                  <el-button style="display: inline-block;" size="mini" type="primary">点击上传</el-button>
                  <div slot="tip" style="display: inline-block;" class="el-upload__tip">只能上传jpg/png/pdf/doc/docx/xls/xlsx/rar/zip/7z文件，且单个文件不能超过20M</div>
                </div>
              </el-upload>
            </el-form-item>
          </el-row>
        </div>
        <div v-if="this.bizFraudInfo.businessType == '2'" class="form">
          <div class="tab">
            <div class="tab-title"><label>变更信息</label></div>
          </div>
          <div class="form-body history">
            <div v-if="eAlterRecoder.length == 0" class="none">暂无变更信息</div>
            <el-table v-if="eAlterRecoder.length !== 0" :data="eAlterRecoder">
              <el-table-column label="序号" prop="index" min-width="30" />
              <el-table-column label="变更事项" prop="altitemCn" min-width="100" show-overflow-tooltip />
              <el-table-column label="变更前" prop="altbe" min-width="150" show-overflow-tooltip />
              <el-table-column label="变更后" prop="altaf" show-overflow-tooltip />
              <el-table-column label="变更日期" prop="altdate" show-overflow-tooltip />
            </el-table>
          </div>
        </div>
        <div class="form">
          <div class="tab">
            <div class="tab-title"><label>处理意见</label></div>
          </div>
          <div class="form-body history">
            <div v-if="opinions.length == 0" class="none">暂无处理意见</div>
            <el-steps direction="vertical">
              <el-step v-for="(each,index) in opinions" :key="'historyLog'+index" :title="opiniontypeCN(each.opiniontype) + '人：' + each.handler + ' ' + opiniontypeCN(each.opiniontype) +'日期：' + each.handledate " :description=" each.opinioncontent " status="finish" />
            </el-steps>
          </div>
        </div>
        <div class="form">
          <div class="tab">
            <div class="tab-title">
              <label>撤销登记案件审批</label>
            </div>
          </div>
          <div class="form-body">
            <el-row class="flex-row">
              <el-col :span="12">
                <el-form-item label="投诉原因" prop="complaintReason">
                  <span v-if="onlyShow" class="span-content">{{ fraudEntInfo.complaintReason }}</span>
                  <el-select v-else v-model="fraudEntInfo.complaintReason" type="text">
                    <el-option value="冒用他人身份信息登记">冒用他人身份信息登记</el-option>
                    <el-option value="冒用地址信息登记">冒用地址信息登记</el-option>
                    <el-option value="冒用其他信息登记">冒用其他信息登记</el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="虚假登记时间">
                  <span class="span-content">{{ fraudEntInfo.regTime }}</span>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row class="bt0">
              <el-col :span="24">
                <el-form-item label="虚假登记事项" prop="regItem">
                  <span v-if="onlyShow" class="span-content">{{ fraudEntInfo.regItem }}</span>
                  <el-input
                    v-else
                    v-model="fraudEntInfo.regItem"
                    :autosize="{ minRows: 2 }"
                    type="textarea"
                    placeholder="请输入虚假登记事项"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row class="bt0 flex-row">
              <el-col :span="12">
                <el-form-item label="登记机关">
                  <span class="span-content">{{ fraudEntInfo.regOrgCn }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="登记机关联系方式">
                  <span class="span-content">{{ fraudEntInfo.tel }}</span>
                </el-form-item>
              </el-col>
            </el-row>
<!--            <el-row class="bt0 flex-row">-->
<!--              <el-col :span="24">-->
<!--                <el-form-item style="min-height: 100px" label="被投诉企业委托代理人信息" prop="fraudPersonInfo">-->
<!--                  <div style="display: flex;">-->
<!--                    <span style="flex-shrink: 0;width: 100px;text-align: right;">姓名：</span>-->
<!--                    <span v-if="onlyShow" class="span-content">{{ fraudEntInfo.fraudPersonInfoName }}</span>-->
<!--                    <el-input-->
<!--                      v-else-->
<!--                      v-model="fraudEntInfo.fraudPersonInfoName"-->
<!--                      style="width: 222px;"-->
<!--                      placeholder="请输入被投诉企业委托代理人姓名"-->
<!--                    />-->
<!--                  </div>-->
<!--                  <div style="display: flex;">-->
<!--                    <span style="flex-shrink: 0;width: 100px;text-align: right;">证件类型：</span>-->
<!--                    <span v-if="onlyShow" class="span-content">{{ fraudEntInfo.fraudPersonInfoCertType }}</span>-->
<!--                    <el-select v-else v-model="fraudEntInfo.fraudPersonInfoCertType" type="text">-->
<!--                      <el-option v-for="item in certypeList" :key="item.value" :value="item.value" :label="item.label"></el-option>-->
<!--                    </el-select>-->
<!--                  </div>-->
<!--                  <div style="display: flex;">-->
<!--                    <span style="flex-shrink: 0;width: 100px;text-align: right;">证件号码：</span>-->
<!--                    <span v-if="onlyShow" class="span-content">{{ fraudEntInfo.fraudPersonInfoCertNo }}</span>-->
<!--                    <el-input-->
<!--                      v-else-->
<!--                      v-model="fraudEntInfo.fraudPersonInfoCertNo"-->
<!--                      placeholder="请输入委托代理人证件号码"-->
<!--                    />-->
<!--                  </div>-->
<!--                </el-form-item>-->
<!--              </el-col>-->
<!--            </el-row>-->
            <el-row class="bt0">
              <el-form-item label="投诉证据材料">
                <el-upload
                  :action="uploadPath"
                  :data="uploadBodyData(1)"
                  :on-remove="removeFile"
                  :on-success="uploadCallback"
                  :on-preview="previewFile"
                  :before-upload="beforeFileUpload"
                  :before-remove="beforeRemove"
                  accept=".doc,.docx,.xlsx,.xls,.pdf,.jpg,.zip,.rar,.7z,.png"
                  multiple
                  :disabled="onlyShow"
                  name="files"
                  :file-list="fileList"
                  style="max-width:800px;display: inline-block"
                  class="uploadFileList"
                  :class="{disabled: onlyShow}"
                >
                  <div v-if="!onlyShow" style="display: inline-block;">
                    <el-button style="display: inline-block;" size="mini" type="primary">点击上传</el-button>
                    <div slot="tip" style="display: inline-block;" class="el-upload__tip">只能上传jpg/png/pdf/doc/docx/xls/xlsx/rar/zip/7z文件，且单个文件不能超过20M</div>
                  </div>
                </el-upload>
              </el-form-item>
            </el-row>
            <!-- <el-row v-for="item in opinions" :key="item.opinionid" class="bt0">
              <el-form-item :label="opiniontypeCN(item.opiniontype)">
                <span style="display: block;text-indent: 1em;">{{ item.opinioncontent }}</span>
                <el-col :span="8" :offset="16">
                  <label>{{ opiniontypeCN2(item.opiniontype) }}:</label>
                  <span>{{ item.handler }}</span>
                  <label
                    style="margin-left: 10px"
                  >日期:</label>
                  <span style="display: inline-block">{{ item.handledate | datetime }}</span>
                </el-col>
              </el-form-item>
            </el-row> -->
            <el-row class="bt0">
              <el-form-item v-if="!onlyShow" label="审批意见" prop="opinioncontent">
                <el-col :span="24" style="margin-bottom:10px">
                  <el-input
                    v-model="fraudEntInfo.opinioncontent"
                    :autosize="{ minRows: 2 }"
                    type="textarea"
                    placeholder="请输入意见"
                  />
                </el-col>
                <el-col :span="12">
                  <label>常用语</label>
                  <el-select
                    v-model="opinion"
                    placeholder="请选择"
                    clearable
                    style="margin-left: 10px;width: 80%"
                    class="custom"
                  >
                    <el-option
                      v-for="item in opinionOptions"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-col>
              </el-form-item>
            </el-row>
            <el-row class="bt0 p0">
              <el-form-item v-if="!onlyShow" label="操作" prop="nextNodeID">
                <div style="line-height: 60px;">
                  <el-radio
                    v-for="item in nextSequenceFlowList"
                    :key="item.id"
                    v-model="fraudEntInfo.nextNodeID"
                    :label="item.nextNode.id"
                  >{{ item.name }}</el-radio>
                </div>
              </el-form-item>
            </el-row>
          </div>
        </div>
      </el-form>
      <div class="submit-box">
        <el-button v-if="!onlyShow" type="primary" :loading="submitLoading" @click="submitForm">提交</el-button>
        <el-button v-if="!onlyShow" type="primary" :loading="submitLoading" @click="temporarySave">暂存</el-button>
        <el-button @click="$router.back()">返回</el-button>
      </div>
    </div>
  </div>
</template>

<script>
import DetailHead from '@/components/DetailHead'
import { listFile, removeAttachementById } from '@/api/attachment'
import { getBusFraudInfo, getConstant, getEntBaseInfoByCode, processControl, temporarySave, getTempInfo, getFraudEntBybizSeq } from '@/api/personate'
import { validBeforeUpload } from '@/api/fileUpload'
import { queryEAlterByEntNo } from '@/api/comprehensive'
import { checkIdNum } from '@/utils/rules'
export default {
  components: {
    DetailHead
    // HandleDialog: HandleDialog
  },
  data() {
    return {
      tempSaveId: '',
      fullscreenLoading: false,
      onlyShow: false,
      uploadPath: `${process.env.VUE_APP_BASE_API}/fraudReg/process/upload`,
      showEntbase: false,
      bizseq: '',
      workflowId: '',
      tasklistid: '',
      personateid: '',
      form: {
        uniscid: '',
        regno: '',
        searchCode: '',
        entname: '',
        certype: '',
        handlrea: '',
        judauth: '',
        regorgCn: '',
        noticefrom: '',
        noticeto: '',
        juddate: '',
        cerno: '',
        opiniontype: '',
        complaintType: '', // 投诉事由
        reason: '', // 投诉是由
        opinion: '', // 意见
        nextNodeID: ''
      },
      opinion: '',
      // 意见-经办人
      handleOpinion: {
        handler: '',
        handleDate: '',
        opinionContent: ''
      },
      // 意见-审核人
      reviewOpinion: {
        handler: '',
        handleDate: '',
        opinionContent: ''
      },
      // 意见-审批人
      approvalOpinion: {
        handler: '',
        handleDate: '',
        opinionContent: ''
      },
      formRules: {
        complaintType: [
          { required: true, message: '请选择投诉类型', trigger: 'blur' }
        ],
        complaintReason: [
          { required: true, message: '请选择投诉原因', trigger: 'change' }
        ],
        regItem: [
          { required: true, message: '请输入虚假登记事项', trigger: 'blur' }
        ],
        tel: [
          { required: true, message: '请输入登记机关联系方式', trigger: 'blur' }
        ],
        opinioncontent: [
          { required: true, message: '请输入审批意见', trigger: 'blur' }
        ],
        nextNodeID: [
          { required: true, message: '请选择下一步操作', trigger: 'blur' }
        ],
        fraudPersonInfo: [
          { required: true, validator: (rule, value, callback) => {
            if (!this.fraudEntInfo.fraudPersonInfoName) {
              callback('请输入被投诉企业委托代理人姓名')
            } else if (!this.fraudEntInfo.fraudPersonInfoCertType) {
              callback('请选择委托代理人证件类型')
            } else if (!this.fraudEntInfo.fraudPersonInfoCertNo) {
              callback('请输入委托代理人证件号码')
            } else if (this.fraudEntInfo.fraudPersonInfoCertType === '中华人民共和国居民身份证') {
              checkIdNum(rule, this.fraudEntInfo.fraudPersonInfoCertNo, callback)
            } else {
              callback()
            }
          } }
        ]
      },
      opinionOptions: [],
      eAlterRecoder: [],
      pripid: '',
      historyLog: [],
      certypeList: [],
      exmainerOptions: [],
      fileList: [],
      fileList0: [],
      user: JSON.parse(sessionStorage.getItem('user')),
      reviewer: [],
      submitLoading: false,
      complaintTypeStr: '',
      nextNodeID: '',
      nextSequenceFlowList: [],
      entInfo: {},
      bizFraudInfo: {},
      fraudEntInfo: {},
      fraudPersonInfo: {},
      opinions: []
    }
  },
  computed: {
    certype() {
      return (value) => {
        const target = this.certypeList.find((item) => {
          return item.value === value
        })
        return target ? target.label : ''
      }
    },
    uploadBodyData() {
      return (attachType) => {
        return {
          attachType,
          id: this.bizseq
        }
      }
    },
    // opiniontypeCN() {
    //   return (value) => {
    //     return {
    //       '1': '经办意见',
    //       '2': '审核人意见',
    //       '3': '审批人意见'
    //     }[value]
    //   }
    // },
    opiniontypeCN() {
      return (value) => {
        return {
          '1': '经办',
          '2': '审核',
          '3': '审批'
        }[value]
      }
    }
  },
  watch: {
    nextNodeID() {
      this.$set(this.fraudEntInfo, 'nextNodeID', this.nextNodeID)
      this.$refs.form.validateField('nextNodeID')
    },
    // 意见渲染
    opinion() {
      let name = ''
      this.opinionOptions.forEach(each => {
        if (this.opinion === each.value) {
          name = each.label
        }
      })
      this.fraudEntInfo.opinioncontent = name
    }
  },
  mounted() {
    this.bizseq = this.$route.query.bizseq // 获取跳转携带的参数bizseq
    this.workflowId = this.$route.query.workflowId
    this.tasklistid = this.$route.query.tasklistid
    this.onlyShow = this.$route.query.onlyShow === 'true'
    // 加载常用语
    this.opinionOptions = this.$util.getCommonWordsWithModule(this.user.primaryKey, '撤销登记案件')
    // 加载证件类型
    const p1 = getConstant('CB16').then(res => {
      if (res.code === 0) {
        const list = []
        res.data.forEach(each => {
          list.push({
            value: each.code,
            label: each.name
          })
        })
        this.certypeList = list
      }
    })
    const p2 = getBusFraudInfo({
      bizSeq: this.bizseq,
      workflowId: this.$route.query.workflowId,
      readOnly: this.onlyShow ? '1' : '0'
    }).then(res => {
      if (res.code === 0) {
        this.bizFraudInfo = res.data.bizFraudInfo || {}
        this.fraudPersonInfo = res.data.fraudPersonInfo || {}
        this.fraudEntInfo = {
          ...res.data.fraudEntInfo,
          complaintReason: this.bizFraudInfo.complaintReason,
          fraudPersonInfoName: this.fraudPersonInfo.name,
          fraudPersonInfoCertType: this.fraudPersonInfo.certType,
          fraudPersonInfoCertNo: this.fraudPersonInfo.certNo
        }
        this.$nextTick(() => {
          this.$refs.form.clearValidate()
        })
        this.opinions = res.data.opinions || {}
        this.nextSequenceFlowList = (res.data.nextSequenceFlowList || []).map((item) => {
          return {
            ...item,
            loading: false
          }
        }) || []
        return getEntBaseInfoByCode({
          code: this.fraudEntInfo.uniScId
        })
      }
    }).then((res) => {
      this.entInfo = res.data
      this.fraudEntInfo.complainantCertype = this.$util.enumFormatter(this.certypeList, res.data.complainantCertype)

      getTempInfo(this.bizseq,'撤销登记案件','登记-待审批').then(res => {
        if(res.data){
          let tempInfo = JSON.parse(res.data.dataJson)
          console.log(tempInfo)
          this.fraudEntInfo.complaintReason = tempInfo.complaintReason
          this.fraudEntInfo.regItem = tempInfo.regItem
          this.tempSaveId = res.data.id
          this.$set(this.fraudEntInfo, 'opinioncontent', tempInfo.opinioncontent)
          console.log(this.fraudEntInfo)
        }
      })
    })
    const p3 = listFile({
      attachType: '0',
      id: this.bizseq
    }).then(({ data }) => {
      this.fileList0 = data.map((item) => {
        return {
          ...item,
          id: item.attachmentid,
          name: item.filename,
          url: `${process.env.VUE_APP_BASE_API}/attachment/download?id=${item.id}`
        }
      })
    })
    const p4 = listFile({
      attachType: '1',
      id: this.bizseq
    }).then(({ data }) => {
      this.fileList = data.map((item) => {
        return {
          ...item,
          id: item.attachmentid,
          name: item.filename,
          url: `${process.env.VUE_APP_BASE_API}/attachment/download?id=${item.id}`
        }
      })
    })
    const p5 = getFraudEntBybizSeq({
      bizSeq: this.bizseq
    }).then(res => {
      queryEAlterByEntNo(
        res.data.pripid
      ).then(resa => {
        const data = resa.data
        const list = []
        let index = 0
        data.forEach(each => {
          each.index = ++index
          list.push(each)
        })
        this.eAlterRecoder = list
        return true
      })
    })
    this.fullscreenLoading = true
    Promise.all([p1, p2, p3, p4, p5 ]).finally(() => {
      this.fullscreenLoading = false
    })
  },
  methods: {
    temporarySave(){
      let tempData = {
        complaintReason : this.fraudEntInfo.complaintReason,
        regItem : this.fraudEntInfo.regItem,
        opinioncontent : this.fraudEntInfo.opinioncontent
      }
      let param = {
        id : this.tempSaveId,
        bizseq : this.bizseq,
        module : '撤销登记案件',
        flow : '登记-待审批',
        data : tempData,
        creator : this.user.nickname,
        creator_id : this.user.primaryKey
      }
      temporarySave(param).then((res) => {
        if (res.code === 0) {
          this.tempSaveId = res.data
          this.$message.success('提交成功')
        } else {
          throw res
        }
      })
    },
    toEntDetail(uniscid) {
      this.$router.push({
        path: '/comprehensive/details',
        query: {
          pripid: this.entInfo.pripid
        }
      })
    },
    uploadCallback(res, file) {
      if (res.code === 0) {
        file.id = res.data[0].attachmentid
        file.name = res.data[0].filename
        file.url = `${process.env.VUE_APP_BASE_API}/attachment/download?id=${res.data[0].id}`
        this.$message.success('上传成功')
      }
    },
    removeFile(file) {
      if (file && file.status === 'success') {
        removeAttachementById(file.id).then(res => {
          if (res.code === 0) {
            this.$message.success('删除成功')
          } else {
            this.$message.error(res.msg)
          }
        })
      }
    },
    beforeFileUpload(file) {
      return validBeforeUpload(file, this)
    },
    beforeRemove(file, fileList) {
      if (file && file.status === 'success') {
        return this.$confirm(`确定移除 ${file.name} ？`)
      }
    },
    previewFile(file) {
      window.open(`${process.env.VUE_APP_BASE_API}/attachment/download?id=${file.id}`, '_blank')
    },
    // 点击文件列表中已上传文件进行下载
    handlePreview(file) {
      var a = document.createElement('a')
      var event = new MouseEvent('click')
      a.download = file.name
      a.href = file.url
      a.dispatchEvent(event)
    },
    submitForm() {
      this.$refs.form.validate((valid, rules) => {
        if (!valid) {
          this.$message.warning(rules[Object.keys(rules)[0]][0].message)
          return
        }
        this.$confirm(this.fraudEntInfo.nextNodeID === 'handleCase' && this.fraudEntInfo.complaintReason === '冒用他人身份信息登记' ? `审批通过后，将会推送涉嫌冒用他人信息至公示系统对外公示，请确认！` : `是否确认提交？`, '提示', {
          beforeClose: (action, instance, done) => {
            if (action === 'confirm') {
              instance.confirmButtonLoading = true
              processControl({
                fraudEntInfo: this.fraudEntInfo,
                fraudPersonInfo: {
                  ...this.fraudPersonInfo,
                  name: this.fraudEntInfo.fraudPersonInfoName,
                  certType: this.fraudEntInfo.fraudPersonInfoCertType,
                  certNo: this.fraudEntInfo.fraudPersonInfoCertNo
                },
                nextNodeID: this.fraudEntInfo.nextNodeID,
                complaintReason: this.fraudEntInfo.complaintReason,
                bizSeq: this.bizseq,
                opinion: {
                  opiniontype: '3',
                  opinioncontent: this.fraudEntInfo.opinioncontent
                },
                nextPerformerIds: [],
                nextPerformerNames: []
              }).then((res) => {
                if (res.code === 0) {
                  this.$message.success('提交成功')
                  this.$router.push('/todo/list')
                } else {
                  throw res
                }
              }).finally(() => {
                instance.confirmButtonLoading = false
                done()
              })
            } else if (!instance.confirmButtonLoading) {
              done()
            }
          }
        })
      })
    }
  }
}
</script>

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

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

  .el-input__inner{
    margin-bottom: 5px;
    width: 50%;
  }
}

</style>
