<template>
  <w-grid
    ref="opinionGridRef"
    :dense="rating.dense"
    :pageable="false"
    :hide-bottom="true"
    :auto-fetch-data="true"
    :fetch-data-url="histOpinionUrl"
    :checkbox-selection="false"
    :config-button="false"
    :columns="[
      { name: 'roleName', label: '岗位名称', width: 150 },
      { name: 'userCode', label: '操作人工号', width: 100 },
      { name: 'userName', label: '操作人名称', width: 100 },
      { name: 'operationOpinion', label: '操作意见', width: 100, format: Formater.dictionary({ items: RatingProcessOperationStatus }) },
      { name: 'adjReason', label: '意见说明', width: 200 },
      { name: 'lastModifyDate', label: '操作时间', width: 150 },
      { name: 'isOverturn', label: '是否推翻', width: 80, format: Formater.yesNo() },
      { name: 'overturnType', label: '推翻类型', width: 100, format: Formater.dictionary(rating.dictionary.overturnType) },
      { name: 'suggestLevel', label: '建议等级', width: 100 },
      { name: 'fileCount', label: '附件列表', width: 100 },
    ]"
    :query-criteria="{
      fieldName: 'ratingId',
      operator: 'equals',
      value: rating.ratingData.value['id'],
    }"
    :sort-by="['-lastModifyDate']"
  ></w-grid>
</template>
<script setup lang="ts">
import { inject, ref } from 'vue';
import { Environment, Formater } from 'platform-core';
import { Rating } from '@/views/custRating/company/ts/Rating';
import { RatingProcessOperationStatus } from '@/views/custRating/company/ts/Utils';

const rating = <Rating>inject('rating');
const overturnFormRef = ref();
const getOverturnFormRef = () => {
  return overturnFormRef.value;
};
rating.refs.setOverturnFormRefFunction(getOverturnFormRef);
const histOpinionUrl = Environment.apiContextPath('api/irbs/ratingOverturn');
</script>
