commonRiskModal.vue 9.03 KB
<template>
  <a-modal
    title="授信审批风控报告"
    :width="1200"
    :centered="false"
    :visible="visible"
    @cancel="handleCancel"
    :confirmLoading="confirmLoading"
    :footer="null"
    cancelText="关闭"
    :maskClosable="false"
    style="top: 40px"
    class="scope-link-man"
  >
    <a-spin :spinning="confirmLoading">
      <div class="labelBox" v-if="data.applyCreditType == 1">
        <div>
          <p>申请时间</p>
          <p>{{ data.applyTime }}</p>
        </div>
        <div>
          <p>申请产品</p>
          <p>{{ data.applyProductCode }}</p>
        </div>
        <div>
          <p>风控类型</p>
          <p v-if="data.applyCreditType == 1">准入</p>
          <p v-else-if="data.applyCreditType == 2">授信</p>
        </div>
        <div>
          <p>风控结果</p>
          <p v-if="data.applyStatus == 'PASS'">通过</p>
          <p v-else-if="data.applyStatus == 'REFUSE'">拒绝</p>
          <p v-else-if="data.applyStatus == 'MANUAL'">转人工</p>
        </div>
      </div>
      <div class="labelBox" v-if="data.applyCreditType == 2">
        <div>
          <p>信用评分</p>
          <p>{{ data.creditScore }}</p>
        </div>
        <div>
          <p>个人评级</p>
          <p>{{ data.createLevel }}</p>
        </div>
        <div>
          <p>申请时间</p>
          <p>{{ data.applyTime }}</p>
        </div>
        <div>
          <p>申请产品</p>
          <p>{{ data.applyProductCode }}</p>
        </div>
        <div>
          <p>风控类型</p>
          <p v-if="data.applyCreditType == 1">准入</p>
          <p v-else-if="data.applyCreditType == 2">授信</p>
        </div>
        <div>
          <p>申请额度(元)</p>
          <p>{{ data.applyAmount }}</p>
        </div>
        <div>
          <p>建议额度(元)</p>
          <p>{{ data.resultAmount }}</p>
        </div>
      </div>
      <a-card title="客户基本信息" :bordered="false">
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item label="姓名" :labelCol="{ span: 8 }" :wrapperCol="{ span: 16 }">
              <div>{{ data.name }}</div>
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="身份证号" :labelCol="{ span: 8 }" :wrapperCol="{ span: 16 }">
              <div>{{ data.idCard }}</div>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item label="联系电话" :labelCol="{ span: 8 }" :wrapperCol="{ span: 16 }">
              <div>{{ data.phone }}</div>
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="联系地址" :labelCol="{ span: 8 }" :wrapperCol="{ span: 16 }">
              <div>{{ data.contactAddress }}</div>
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="学历" :labelCol="{ span: 8 }" :wrapperCol="{ span: 16 }">
              <div v-if="data.education == 0">研究生</div>
              <div v-if="data.education == 1">大学本科</div>
              <div v-if="data.education == 2">大学专科</div>
              <div v-if="data.education == 3">高中</div>
              <div v-if="data.education == 4">技术学校/中等专业学校/中等技术学校</div>
              <div v-if="data.education == 5">初中</div>
              <div v-if="data.education == 6">小学</div>
              <div v-if="data.education == 7">文盲/半文盲</div>
              <div v-if="data.education == 8">其他</div>
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="婚姻状况" :labelCol="{ span: 8 }" :wrapperCol="{ span: 16 }">
              <div v-if="data.maritalStatus == 0">未婚</div>
              <div v-if="data.maritalStatus == 1">已婚</div>
              <div v-if="data.maritalStatus == 2">丧偶</div>
              <div v-if="data.maritalStatus == 3">离异</div>
              <div v-if="data.maritalStatus == 4">其他</div>
              <div v-if="data.maritalStatus == 5">未说明</div>
            </a-form-item>
          </a-col>
        </a-row>
        <div class="imgBox">
          <div>
            <p>身份证正面照片</p>
            <img :src="data.idCardFront" width="400px" />
          </div>
          <div>
            <p>身份证反面照片</p>
            <img :src="data.idCardReverse" width="400px" />
          </div>
        </div>
      </a-card>
      <a-card title="规则状态" :bordered="false">
        <a-table
          ref="table"
          size="middle"
          :bordered="false"
          :columns="riskData"
          :dataSource="dataSource"
          :pagination="false"
          :loading="loading"
          :rowKey="(record) => record.id"
          @change="handleTableChange"
          style="margin-bottom: 20px"
        >
          <span slot="rule" slot-scope="text, record">
            {{ record.targetBaseName }} {{ record.judge }} {{ record.threshold }}
          </span>
          <template slot="hit" slot-scope="text, record">
            <div v-if="record.execType == 1">{{ record.score }}分</div>
            <div v-if="record.execType == 0">
              <span v-if="record.hit == 0">未命中</span>
              <span v-else style="color: rgb(255, 77, 79)">命中</span>
            </div>
          </template>
        </a-table>
      </a-card>
    </a-spin>
  </a-modal>
</template>
<script>
import { JeecgListMixin } from '@/mixins/CoreListMixin'
import { ossDownloadFile } from '@/api/configApi'

export default {
  name: 'commonBankAccountTable',
  mixins: [JeecgListMixin],
  data() {
    return {
      title: '',
      confirmLoading: false,
      visible: false,
      riskNode: '',
      model: [],
      data: {},
      riskData: [
        {
          title: '策略节点',
          align: 'center',
          width: '100px',
          dataIndex: 'groupName',
          customRender: this.changeRowSpan,
        },
        {
          title: '规则',
          dataIndex: 'rule',
          scopedSlots: { customRender: 'rule' },
          align: 'center',
          width: 400,
        },
        {
          title: '取值',
          align: 'center',
          dataIndex: 'targetValue',
        },
        {
          title: '结果',
          align: 'center',
          dataIndex: 'hit',
          scopedSlots: { customRender: 'hit' },
        },
      ],
      dataSource: [],
    }
  },
  created() {},
  methods: {
    edit(res) {
      this.data = res
      this.dataSource = res.strategyRuleItemResult
      var totalArr = []
      var arr = []
      this.dataSource.forEach((item, index) => {
        arr.push(item)
        if (
          (this.dataSource[index + 1] && item.groupName !== this.dataSource[index + 1].groupName) ||
          !this.dataSource[index + 1]
        ) {
          arr.forEach((it, ind) => {
            if (ind === 0) {
              it.rowSpan = arr.length
            } else {
              it.rowSpan = 0
            }
          })
          totalArr.push(...arr)
          arr = []
        }
      })
      this.dataSource = totalArr
      let p = {
        fileIdentifyingCode: res.idCardFront,
        expire: 10000,
      }
      let t = {
        fileIdentifyingCode: res.idCardReverse,
        expire: 10000,
      }
      ossDownloadFile(p).then((res) => {
        if (res.status.statusCode == 0) {
          this.data.idCardFront = res.result.url
        } else {
          this.$message.warning(res.status.statusReason)
        }
      })
      ossDownloadFile(t).then((res) => {
        if (res.status.statusCode == 0) {
          this.data.idCardReverse = res.result.url
        } else {
          this.$message.warning(res.status.statusReason)
        }
      })
      this.visible = true
    },
    changeRowSpan(value, row, index) {
      return {
        children: value,
        attrs: {
          rowSpan: row.rowSpan,
        },
      }
    },
    close() {
      this.$emit('close')
      this.visible = false
    },
    handleCancel() {
      this.close()
    },
    selectUserHierarchy(key) {
      this.riskNode = key
      this.dataSource = []
      this.keyFindVal()
    },
    // 返回数据处理
    objForEach(obj) {
      this.model = []
      Object.keys(obj).forEach((key) => {
        this.model.push(obj[key])
        this.selectData.push(key)
      })
      this.selectData.map((v) => {
        this.riskNode = this.selectData[0] // 默认选择第一个
      })
    },
    keyFindVal() {
      this.dataSource = []
      // 根据key找val
      this.model.map((v) => {
        v.map((v1) => {
          if (this.riskNode == v1.nodeName) {
            this.dataSource.push(v1)
          }
        })
      })
    },
  },
}
</script>
<style>
.labelBox {
  display: flex;
  justify-content: space-around;
  text-align: center;
  width: 100%;
}

.labelBox div p:nth-child(1) {
  font-size: 15px;
  font-weight: 600;
}

.imgBox {
  display: flex;
  justify-content: space-around;
  text-align: center;
  width: 100%;
}

.gBox {
  display: flex;
  justify-content: space-between;
}
</style>