<script lang="ts" setup>
// @ts-ignore

import { ElCard } from 'element-plus';

// @ts-ignore
import { useVbenVxeGrid } from '#/adapter/vxe-table';

// 定义组件的Props接口
interface WeeklyEvaluationProps {
  taskDetail: any;
}

// 接收父组件传递的任务详情数据
const props = defineProps<WeeklyEvaluationProps>();

// 表格列配置
const tableColumns: any = [
  {
    field: 'userName',
    title: '姓名',
    width: 100,
    fixed: 'left',
  },
  {
    field: 'totalScore',
    title: '总分',
    width: 80,
  },
  {
    field: 'postName',
    title: '岗位',
    width: 100,
  },
  {
    field: 'customerService',
    title: '顾客服务(30分)',
    width: 150,
  },
  {
    field: 'safetyAssessment',
    title: '安全考核(15分)',
    width: 150,
  },
  {
    field: 'dailyPerformance',
    title: '日常综合表现(25分)',
    width: 180,
  },
  {
    field: 'performance',
    title: '业绩表现(20分)',
    width: 150,
  },
  {
    field: 'selfEvaluation',
    title: '自主评分(10分)',
    width: 150,
  },

  {
    field: 'comments',
    title: '评语',
    minWidth: 400,
    // width: 200,
  },
];

// 初始化表格配置
const gridOptions: any = {
  size: 'medium',
  toolbarConfig: {
    custom: false,
    refresh: false,
    zoom: false,
  },
  pagerConfig: {
    enabled: false,
  },
  proxyConfig: {
    ajax: {
      query: async () => {
        return {
          items: props.taskDetail || [],
        };
      },
    },
  },
  columns: tableColumns,
};

// 使用BasicTable组件
const [BasicTable] = useVbenVxeGrid({
  gridOptions,
});
</script>

<template>
  <ElCard>
    <template #header>
      <div class="flex items-center gap-4">
        <div style="width: 4px; height: 12px; background-color: #215acd"></div>
        <span
          class="text-lg font-bold text-gray-800"
          style="font-size: 14px; font-weight: 600"
        >
          员工周评价详情
        </span>
      </div>
    </template>

    <div class="task-info">
      <!-- 员工周评价表格 -->
      <!-- <div class="section-title">
        <div class="section-bar"></div>
        <span class="section-text">员工周评价数据</span>
      </div> -->
      <div class="mb-6">
        <BasicTable table-title="" class="w-full" />
      </div>
    </div>
  </ElCard>
</template>

<style scoped lang="scss">
.task-info {
  .section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 20px 0 12px 0;

    .section-bar {
      width: 4px;
      height: 12px;
      background-color: #215acd;
    }

    .section-text {
      font-size: 14px;
      font-weight: 600;
      color: var(--text-color-primary);
    }
  }

  :deep(.el-descriptions) {
    margin-bottom: 0 !important;
  }

  :deep(.el-descriptions__label) {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-color-secondary);
  }

  :deep(.el-descriptions__content) {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color-primary);
  }

  :deep(.el-descriptions__table) {
    background: transparent !important;
  }
}
</style>
