<template>
  <w-grid
    ref="custHistRatingGridRef"
    :dense="rating.dense"
    :pageable="false"
    :hide-bottom="true"
    :auto-fetch-data="true"
    :toolbar-actions="[]"
    :fetch-data-url="Environment.apiContextPath('api/irbs/companyRating')"
    :checkbox-selection="false"
    :config-button="false"
    :columns="[
      { name: 'id', label: '申请编号' },
      { name: 'custNo', label: '客户号' },
      { name: 'custName', label: '客户名称' },
      // { name: 'modelScore', label: '得分' },
      { name: 'modelLevel', label: '系统评级等级' },
      { name: 'adjLevel', label: '调整等级' },
      { name: 'initLevel', label: '初评等级' },
      { name: 'finalLevel', label: '最终等级' },
      { name: 'effectiveTime', label: '生效日期', format: Formater.dateOnly() },
      { name: 'matureTime', label: '到期日期', format: Formater.dateOnly() },
      { name: 'ratingStatus', label: '评级状态', format: Formater.enum(rating.enum.ratingStatus) },
      { name: 'launchUser', label: '发起人' },
      { name: 'processStatus', label: '状态', format: Formater.enum(rating.enum.ratingProcessStatus) },
    ]"
    :query-criteria="{
      operator: 'and',
      criteria: [
        {
          fieldName: 'custNo',
          operator: 'equals',
          value: rating.ratingData.value['custNo'],
        },
        {
          fieldName: 'processStatus',
          operator: 'equals',
          value: Constant.DEFAULT_PROCESS_STATUS.PASS,
        },
      ],
    }"
  ></w-grid>
</template>
<script setup lang="ts">
import { Environment, Formater } from 'platform-core';
import { inject } from 'vue';
import { Constant } from '../ts/Constant';
import { Rating } from '../ts/Rating';

const rating = <Rating>inject('rating');
</script>
