<template>
  <div class="h-full">
    <w-grid
      ref="rptModelMonitorStableGridRef"
      title="模型稳定性监控报表"
      :data-url="Environment.apiContextPath('api/irbs/rptModelMonitorStable/list')"
      :sort-no="true"
      :checkbox-selection="false"
      :query-form-cols-num="4"
      :query-form-fields="rptModelMonitorStableGrid.queryFormFields"
      :columns="rptModelMonitorStableGrid.columns"
      :toolbar-actions="rptModelMonitorStableGrid.buttons"
      :pageable="false"
    ></w-grid>
  </div>
</template>

<script setup lang="ts">
import { ref, reactive } from 'vue';
import { useQuasar } from 'quasar';
import { Environment, EnumTools, DictionaryTools, Options, Formater, axios, NotifyManager } from 'platform-core';

const $q = useQuasar();
const rptModelMonitorStableGridRef = ref();

const rptModelMonitorStableGrid = {
  buttons: [
    {
      extend: 'query',
      click: () => {
        const QueryParams = rptModelMonitorStableGridRef.value.getQueryForm().getData();
        axios.get(Environment.apiContextPath('api/irbs/rptModelMonitorStable/list'), { params: QueryParams }).then((resp) => {
          rptModelMonitorStableGridRef.value.setLocalData(resp.data);
        });
      },
    },
    'reset',
    'separator',
  ],
  queryFormFields: [
    { label: '报表日期', name: 'ratingMonth', type: 'date', defaultValue: '2023-07-01' },
    {
      label: '模型敞口',
      name: 'modelCode',
      type: 'select',
      options: [
        { value: 'WHM1', label: '政府投融资平台' },
        { value: 'WHM2', label: '事业单位' },
        { value: 'WHM3', label: '银行类金融机构' },
        { value: 'WHM41', label: '金融租赁与消费金融公司' },
        { value: 'WHM42', label: '证券公司' },
        { value: 'WHM43', label: '其他非银行金融机构' },
        { value: 'WHM44', label: '基金公司' },
        { value: 'WHM5', label: '新建企业' },
        { value: 'WHM6', label: '综合性集团' },
        { value: 'WHM7', label: '大型其他行业' },
        { value: 'WHM8', label: '中小微其他行业' },
        { value: 'WHM9', label: '大中型租赁和商务服务行业' },
        { value: 'WHM10', label: '小微租赁和商务服务业' },
        { value: 'WHM12', label: '房地产业' },
        { value: 'WHM13', label: '大中型农林牧渔业' },
        { value: 'WHM14', label: '小微农林牧渔业' },
        { value: 'WHM15', label: '大型建筑业' },
        { value: 'WHM16', label: '中小微建筑业' },
        { value: 'WHM17', label: '大中型制造业' },
        { value: 'WHM18', label: '小微制造业' },
        { value: 'WHM19', label: '大中型批发和零售业' },
        { value: 'WHM20', label: '小微批发和零售业' },
        { value: 'WHM22', label: '科技行业' },
      ],
      defaultValue: 'WHM18',
    },
  ],
  columns: [
    { label: '时间区间', name: 'ratingQuarter', align: 'center' },
    {
      label: '稳定性',
      name: 'stableHeader',
      columns: [
        { label: 'PSI', name: 'psi', align: 'center' },
        { label: '风险等级', name: 'riskLevel', align: 'center' },
      ],
    },
  ],
};
</script>
