import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';

export const queryFormSchema: FormSchemaGetter = () => [
  {
    component: 'Input',
    fieldName: 'licenseName',
    label: '证照名称',
    componentProps: {
      placeholder: '请输入证照名称',
    },
  },
  {
    component: 'Select',
    fieldName: 'annualReview',
    label: '年审',
    componentProps: {
      placeholder: '请选择年审状态',
      options: [
        { label: '是', value: '1' },
        { label: '否', value: '0' },
      ],
    },
  },
  {
    component: 'Select',
    fieldName: 'annualReviewTask',
    label: '年审（转任务计算）',
    componentProps: {
      placeholder: '请选择年审（转任务计算）',
      options: [
        { label: '是', value: '1' },
        { label: '否', value: '0' },
      ],
    },
  },
  {
    component: 'Select',
    fieldName: 'renewal',
    label: '换证',
    componentProps: {
      placeholder: '请选择换证状态',
      options: [
        { label: '是', value: '1' },
        { label: '否', value: '0' },
      ],
    },
  },
];

export const tableColumns: VxeGridProps['columns'] = [
  {
    type: 'checkbox',
    width: 80,
  },
  {
    field: 'name',
    title: '姓名',
    fixed: 'left',
    minWidth: 100,
  },
  {
    field: 'position',
    title: '岗位',
    minWidth: 120,
  },
  {
    field: 'month',
    title: '月份',
    minWidth: 100,
  },
  {
    field: 'customerService',
    title: '顾客服务（30分）',
    minWidth: 120,
  },
  {
    field: 'safetyAssessment',
    title: '安全考核（15分）',
    minWidth: 120,
  },
  {
    field: 'dailyPerformance',
    title: '日常综合表现（24分）',
    minWidth: 120,
  },
  {
    field: 'performance',
    title: '业绩表现（20分）',
    minWidth: 120,
  },
  {
    field: 'selfAssessment',
    title: '自主评分（10分）',
    minWidth: 120,
  },
  {
    field: 'totalScore',
    title: '总分',
    minWidth: 100,
  },
  {
    field: 'evaluationLevelRef',
    title: '考评等级（参考）',
    minWidth: 120,
  },
  {
    field: 'performanceLevel',
    title: '绩效等级',
    minWidth: 100,
  },
  {
    field: 'comment',
    title: '评语',
    minWidth: 150,
  },
  {
    field: 'bonusRatio',
    title: '奖金比例%',
    minWidth: 100,
  },
  {
    field: 'bonusPackageDesc',
    title: '奖金包说明',
    minWidth: 150,
  },
  {
    field: 'evaluationLevel',
    title: '考评等级',
    minWidth: 100,
  },
  {
    field: 'deductionAmount',
    title: '扣款金额',
    minWidth: 100,
  },
  {
    field: 'deductionDesc',
    title: '扣款说明',
    minWidth: 150,
  },
  {
    field: 'gasStation',
    title: '油站',
    minWidth: 120,
  },
  {
    field: 'action',
    fixed: 'right',
    slots: { default: 'action' },
    title: '操作',
    width: 150,
  },
];

export const drawerFormSchema: FormSchemaGetter = () => [
  {
    component: 'Input',
    dependencies: {
      show: () => false,
      triggerFields: [''],
    },
    fieldName: 'id',
  },
  {
    component: 'Input',
    fieldName: 'performanceLevel',
    label: '绩效等级',
    componentProps: {
      placeholder: '请输入绩效等级',
      maxlength: 50,
    },
  },
  {
    component: 'Input',
    fieldName: 'comment',
    label: '评语',
    componentProps: {
      placeholder: '请输入评语',
      maxlength: 500,
      type: 'textarea',
      rows: 3,
    },
  },
  {
    component: 'InputNumber',
    fieldName: 'bonusRatio',
    label: '奖金比例%',
    componentProps: {
      placeholder: '请输入奖金比例',
      min: 0,
      max: 200,
      step: 0.1,
    },
  },
  {
    component: 'Input',
    fieldName: 'bonusPackageDesc',
    label: '奖金包说明',
    componentProps: {
      placeholder: '请输入奖金包说明',
      maxlength: 200,
      type: 'textarea',
      rows: 2,
    },
  },
  {
    component: 'Select',
    fieldName: 'evaluationLevel',
    label: '考评等级',
    componentProps: {
      placeholder: '请选择考评等级',
      options: [
        { label: '优秀', value: '优秀' },
        { label: '良好', value: '良好' },
        { label: '合格', value: '合格' },
        { label: '需改进', value: '需改进' },
      ],
    },
  },
  {
    component: 'Input',
    fieldName: 'ratingDesc',
    label: '评级说明',
    componentProps: {
      placeholder: '请输入评级说明',
      maxlength: 200,
      type: 'textarea',
      rows: 2,
    },
  },
  {
    component: 'InputNumber',
    fieldName: 'deductionAmount',
    label: '扣款金额',
    componentProps: {
      placeholder: '请输入扣款金额',
      min: 0,
      step: 1,
    },
  },
  {
    component: 'Input',
    fieldName: 'deductionDesc',
    label: '扣款说明',
    componentProps: {
      placeholder: '请输入扣款说明',
      maxlength: 200,
      type: 'textarea',
      rows: 2,
    },
  },
];

