commonApprovalRecord.vue 4.32 KB
<template>
  <a-spin :spinning="confirmLoading">
    <a-card title="审批流程" :bordered="false">
      <img style="width:100%;" :src="qrUrl" />
    </a-card>
    <a-card title="审批历史" :bordered="false">
      <a-table 
        ref="table" 
        size="middle" 
        bordered 
        rowKey="id" 
        :columns="columns" 
        :dataSource="dataSource" 
        :pagination="false" 
        :loading="loading" 
        style="padding-top:20px;">
        <span slot="action" slot-scope="text, record">
          <a v-if="record.approvalUploadFileUrl " @click="handleAttachmentLook(record)">查看</a>
          <a v-if="record.riskFlag && !showTask" @click="handleAttachmentModal(record)">查看</a>
        </span>
      </a-table>
    </a-card>
    <common-risk-modal ref="commonRiskModal" @ok="commonRiskModalOk"></common-risk-modal>
  </a-spin>
</template>
<script>
// import { queryApprovalRecords,getApprovalStatusImg  } from '@/api/configApi'
import { 
  // queryApprovalRecordsUseCredit,getApprovalStatusImgUseCredit,
   queryTransRiskResult, queryApprovalTransDetail, getInputStreamByApplyNo } from '@/api/insys'
import { axios } from '@/utils/requestLocal'
import commonRiskModal from '@/views/modules/common/commonRiskModal'
export default {
  name: 'personApprovalRecord',
  props: {
    strategyType: {//用户类型 1 进件 2 用信
      type: Number,
      default: null,
    },
    showTask:{
      type: Boolean,
      default: null,
    }
  },
  components: {
    commonRiskModal
  },
  data () {
    return {
      dataSource:[],
      confirmLoading: false,
      current: 3,
      loading:false,
      qrUrl:'',
      columns: [
        {
          title: '序号',
          dataIndex: '',
          key: 'rowIndex',
          align: 'center',
          width: 60,
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          }
        },
        {
          title: '审批岗位',
          align: 'center',
          width: '100px',
          dataIndex: 'approvalRoleCode'
        },
        {
          title: '审批人员',
          align: 'center',
          width: '100px',
          dataIndex: 'approvalUserName'
        },
        {
          title: '审批结果',
          align: 'center',
          width: '100px',
          dataIndex: 'approvalResultStr'
        },
        {
          title: '审批意见',
          align: 'center',
          width: '100px',
          dataIndex: 'approvalNote'
        },
        {
          title: '审批时间',
          align: 'center',
          dataIndex: 'updateTime'
        },
        {
          title: '审批报告',
          dataIndex: 'action',
          scopedSlots: { customRender: 'action' },
          align: 'center',
          width: 100,
          fixed: 'right'
        }
      ],
    }
  },
  methods: {
    loadData(data){
      if(this.strategyType == 2){
        this.queryApprovalTransDetail({
          applyNo: data.applyNo,
          transNo: data.transNo
        })
        this.getInputStreamByApplyNo(data.applyNo)
      }
    },
    // 审批历史
    queryApprovalTransDetail(p) {
      queryApprovalTransDetail(p).then(res => {
        if(res.status.statusCode==0){
          this.dataSource = res.result
        }else{
          this.$message.warning(res.status.statusReason)
        }
      })
    },
    // 审批流程
    getInputStreamByApplyNo(p) {
      getInputStreamByApplyNo(p).then(res => {
        try {
          const myBlob = new window.Blob([res], {type: 'image/jpeg'})
          this.qrUrl = window.URL.createObjectURL(myBlob)
        } catch (error) {
          this.qrUrl = ''
          this.$message.warning('获取审批流程失败')
        }
      })
    },
    // 自定义附件信息查看   图片 文件
    handleAttachmentLook (record) {
      window.open(record.approvalUploadFileUrl)
    },
    // 自定义附件信息查看 modal
    handleAttachmentModal (record) {
      let _p = { 'orderNo': this.uniqueNo }
      queryTransRiskResult(_p).then(res => {
        if (res.status.statusCode == 0) {
          this.$refs.commonRiskModal.edit(res.result)
          this.$refs.commonRiskModal.disableSubmit = false
          this.$refs.commonRiskModal.onlyread = true
        } else {
          this.$message.warning(res.status.statusReason)
        }
      })

    },
    commonRiskModalOk(){

    }
  }
}
</script>