commonApprovalRecord.vue 6.22 KB
<template>
  <a-spin :spinning="confirmLoading">
    <a-card title="审批流程" :bordered="false">
      <div style="width: 100%; text-align: center">
        <img :src="qrUrl" :onerror="errorImg01" />
      </div>
    </a-card>
    <a-card title="审批历史" :bordered="false">
      <a-table
        ref="table"
        size="middle"
        bordered
        :rowKey="(record, index) => index"
        :columns="historicalApprovalData"
        :dataSource="dataSource"
        :pagination="false"
        :loading="loading"
        style="padding-top: 20px"
      >
        <span slot="xiangqing" slot-scope="text, record">
          <a-button
            type="link"
            size="small"
            @click="chakan(record)"
            v-if="record.approvalRecordType == 'approval'"
            icon="search"
            style="font-size: 12px"
            >查看</a-button
          >
          <span v-else-if="record.approvalRecordType == 'credit'">{{ record.approvalDesc }}</span>
          <span v-else>--</span>
        </span>
        <span slot="action" slot-scope="text, record">
          <a-button
            type="link"
            size="small"
            @click="handleAttachmentModal(record)"
            v-if="record.approvalRecordType == 'risk'"
            icon="search"
            style="font-size: 12px"
            >查看</a-button
          >
          <span v-else>--</span>
        </span>
      </a-table>
    </a-card>
    <!-- <common-risk-modal ref="commonRiskModal" @ok="commonRiskModalOk"></common-risk-modal> -->
    <common-risk-modal v-if="userType == 1" ref="commonRiskModal" @ok="commonRiskModalOk"></common-risk-modal>
    <common-risk-modal2 v-else-if="userType == 2" ref="commonRiskModal" @ok="commonRiskModalOk"></common-risk-modal2>
    <shenpiModal ref="shenpi"></shenpiModal>
  </a-spin>
</template>
<script>
import { queryApprovalRecords, getApprovalStatusImg, queryCollResult, getCreditRiskResult } from '@/api/configApi'
import { axios } from '@/utils/requestLocal'
// import commonRiskModal from '@/views/modules/common/commonRiskModal'
import commonRiskModal from './commonRiskModal'
import commonRiskModal2 from './commonRiskModal2'
import shenpiModal from '../../../taskList-manage/modules/shenpiModal.vue'
export default {
  name: 'personApprovalRecord',
  props: {
    userType: {
      type: Number,
      default: null,
    },
    applyNo: {
      type: String,
      default: null,
    },
  },
  rowKey: {
    type: String,
    default: 'id',
  },
  components: {
    commonRiskModal,
    commonRiskModal2,
    shenpiModal,
  },
  data() {
    return {
      dataSource: [],
      confirmLoading: false,
      current: 3,
      loading: false,
      qrUrl: '',
      thatImg: 0,
      errorImg01: 'this.src="' + require('@/assets/zanwu.jpg') + '"',
      historicalApprovalData: [
        {
          title: '序号',
          dataIndex: '',
          key: 'rowIndex',
          align: 'center',
          width: 60,
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          },
        },
        {
          title: '审批岗位',
          align: 'center',
          // width: 120,
          dataIndex: 'approvalDepart',
        },
        {
          title: '审批人员',
          align: 'center',
          // width: 120,
          dataIndex: 'approvalUser',
        },
        {
          title: '审批结果',
          align: 'center',
          // width: 120,
          dataIndex: 'approvalResult',
        },
        {
          title: '审批详情',
          align: 'center',
          // width: 120,
          dataIndex: '',
          scopedSlots: { customRender: 'xiangqing' },
        },
        // {
        //   title: '审批意见',
        //   align: 'center',
        //   // width: 120,
        //   dataIndex: 'approvalDesc'
        // },
        {
          title: '审批时间',
          align: 'center',
          // width: 120,
          dataIndex: 'approvalTime',
        },
        {
          title: '审批报告',
          dataIndex: 'action',
          scopedSlots: { customRender: 'action' },
          align: 'center',
          width: 100,
          fixed: 'right',
        },
      ],
    }
  },
  methods: {
    loadData() {
      let _p = { applyNo: this.applyNo }
      // 审批历史
      queryApprovalRecords(_p).then((res) => {
        console.log(res)
        if (res.status.statusCode == 0) {
          this.dataSource = res.result
        } else {
          this.$message.warning(res.status.statusReason)
        }
      })
      // 审批状态
      getApprovalStatusImg(_p).then((res) => {
        try {
          const myBlob = new window.Blob([res], { type: 'image/jpeg' })
          this.qrUrl = window.URL.createObjectURL(myBlob)
          this.thatImg = 1
          console.log(this.qrUrl)
        } catch (error) {
          this.qrUrl = ''
          this.thatImg = 0
          this.$message.warning('获取审批流程失败')
        }
      })
    },
    chakan(record) {
      this.$refs.shenpi.look(record)
    },
    // 自定义附件信息查看   图片 文件
    handleAttachmentLook(record) {
      window.open(record.approvalUploadFileUrl)
    },
    // 自定义附件信息查看 modal
    handleAttachmentModal(record) {
      // let _p = { applyNo: 'HYD_CMM_ONLINE_20200331_16504111171' }
      console.log(record)
      let _p = { applyTransNo: record.approvalTransNo }
      getCreditRiskResult(_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)
        }
      })
    },
    handleError(e) {
      e.currentTarget.src = '@/assets/zanwu.jpg'
    },
    commonRiskModalOk() {
      var arr = [
        {
          key: 'key1',
          val: {
            nodeName: '',
            ruleValue: '',
          },
        },
        {
          key: 'key2',
          val: {
            nodeName: '',
            ruleValue: '',
          },
        },
        {
          key: 'key3',
          val: {
            nodeName: '',
            ruleValue: '',
          },
        },
      ]
    },
  },
}
</script>
<style>
</style>