commonApprovalRecord.vue 4.11 KB
<template>
  <a-spin :spinning="confirmLoading">
    <a-card title="审批流程" :bordered="false" class="scoped-approval">
      <img style="width:100%;" :src="qrUrl" />
    </a-card>
    <a-card title="审批历史" :bordered="false">
      <a-table ref="table" size="middle" bordered rowKey="id" :columns="historicalApprovalData" :dataSource="dataSource" :pagination="false" :loading="loading" style="padding-top:20px;">
        <span slot="action" slot-scope="text, record">
          <a v-show="record.approvalUploadFileUrl" @click="handleAttachmentLook(record)">查看</a>
          <a v-show="record.riskFlag" @click="handleAttachmentModal(record)">查看</a>
        </span>
      </a-table>
    </a-card>
    <common-risk-modal ref="commonRiskModal" @ok="commonRiskModalOk"></common-risk-modal>
  </a-spin>
</template>
<script>
import { getActionImg, queryCollResult } from '@/api/configApi'
import { queryApprovalTransDetail } from '@/api/insys'
import commonRiskModal from '@/views/modules/common/commonRiskModal'

export default {
  name: 'personApprovalRecord',
  props: {
    userType: {
      type: Number,
      default: null,
    },
    creditApplyNo: {
      type: String,
      default: null,
    }
  },
  components: {
    commonRiskModal
  },
  data () {
    return {
      dataSource: [],
      confirmLoading: false,
      current: 3,
      loading: false,
      qrUrl: '',
      historicalApprovalData: [
        {
          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'
        }
      ],
    }
  },
  created () { },
  methods: {
    loadData () {
      // let _p = {'applyNo':'P_2020011018928JOH'} // 测试用 写死的
      let _p = { 'transNo': this.creditApplyNo }
      // 审批历史
      queryApprovalTransDetail(_p).then(res => {
        console.log(res)
        if (res.status.statusCode == 0) {
          this.dataSource = res.result
        } else {
          this.$message.warning(res.status.statusReason)
        }
      })
      // 审批状态
      let _p1 = `/approval/admin/model/getInputStreamByApplyNo/${this.creditApplyNo}`
      getActionImg(_p1).then(res => {
        if (res.status.statusCode == -1) {
          this.$message.warning(res.status.statusReason)
        } else {
          const myBlob = new window.Blob([res], { type: 'image/jpeg' })
          this.qrUrl = window.URL.createObjectURL(myBlob)
        }
      })
    },
    // 自定义附件信息查看 图片 文件
    handleAttachmentLook (record) {
      window.open(record.approvalUploadFileUrl)
    },
    // 自定义附件信息查看 modal
    handleAttachmentModal (record) {
      // let _p = { applyNo: 'HYD_CMM_ONLINE_20200331_16504111171' }
      let _p = { applyNo: this.applyNo }
      queryCollResult(_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>
<style>
</style>