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

// 事件报告类型定义
export interface EventReportData {
  id: number;
  eventName: string; // 事件名称
  station: string; // 油站
  eventType: string; // 事件类型
  eventLevel: string; // 事件等级
  link: string; // 环节
  deduction: number; // 扣分
  submitter: string; // 提交人
  occurrenceTime: string; // 发生时间
  submitTime: string; // 提交时间
  status: string; // 状态
}

// 事件报告表格配置
export const tableColumns: VxeGridProps['columns'] = [
  { title: '事件名称', field: 'eventName', minWidth: 180, align: 'center' },
  { title: '油站', field: 'station', minWidth: 150, align: 'center' },
  { title: '事件类型', field: 'eventType', minWidth: 120, align: 'center' },
  { title: '事件等级', field: 'eventLevel', minWidth: 120, align: 'center' },
  { title: '环节', field: 'link', minWidth: 120, align: 'center' },
  { title: '扣分', field: 'deduction', minWidth: 100, align: 'center' },
  { title: '提交人', field: 'submitter', minWidth: 120, align: 'center' },
  { title: '发生时间', field: 'occurrenceTime', minWidth: 160, align: 'center' },
  { title: '提交时间', field: 'submitTime', minWidth: 160, align: 'center' },
  { title: '状态', field: 'status', minWidth: 120, align: 'center' },
  { 
    title: '操作', 
    minWidth: 100, 
    align: 'center', 
    fixed: 'right',
    slots: { default: 'action' },
  },
];

// 事件报告虚拟数据
export const WORK_REPORT_MOCK_DATA: EventReportData[] = [
  { 
    id: 1, 
    eventName: '设备故障未及时维修', 
    station: '北京东加油站', 
    eventType: '设备故障', 
    eventLevel: '一般', 
    link: '设备管理', 
    deduction: 5, 
    submitter: '张三', 
    occurrenceTime: '2024-01-01 10:30:00', 
    submitTime: '2024-01-01 11:00:00', 
    status: '已处理'
  },
  { 
    id: 2, 
    eventName: '安全检查不合格', 
    station: '北京西加油站', 
    eventType: '安全隐患', 
    eventLevel: '严重', 
    link: '安全管理', 
    deduction: 10, 
    submitter: '李四', 
    occurrenceTime: '2024-01-02 14:20:00', 
    submitTime: '2024-01-02 15:00:00', 
    status: '处理中'
  },
  { 
    id: 3, 
    eventName: '员工违规操作', 
    station: '机场油站', 
    eventType: '违规操作', 
    eventLevel: '中等', 
    link: '员工管理', 
    deduction: 8, 
    submitter: '王五', 
    occurrenceTime: '2024-01-03 09:15:00', 
    submitTime: '2024-01-03 10:00:00', 
    status: '已处理'
  },
  { 
    id: 4, 
    eventName: '消防设备过期', 
    station: '北京南加油站', 
    eventType: '消防隐患', 
    eventLevel: '严重', 
    link: '消防管理', 
    deduction: 15, 
    submitter: '赵六', 
    occurrenceTime: '2024-01-04 16:45:00', 
    submitTime: '2024-01-04 17:00:00', 
    status: '待处理'
  },
  { 
    id: 5, 
    eventName: '油品泄漏', 
    station: '北京北加油站', 
    eventType: '油品泄漏', 
    eventLevel: '严重', 
    link: '油品管理', 
    deduction: 20, 
    submitter: '孙七', 
    occurrenceTime: '2024-01-05 13:20:00', 
    submitTime: '2024-01-05 14:00:00', 
    status: '已处理'
  },
  { 
    id: 6, 
    eventName: '客户投诉', 
    station: '未来路加油站', 
    eventType: '客户投诉', 
    eventLevel: '一般', 
    link: '客户服务', 
    deduction: 3, 
    submitter: '周八', 
    occurrenceTime: '2024-01-06 11:50:00', 
    submitTime: '2024-01-06 12:00:00', 
    status: '处理中'
  },
];

export const queryFormSchema: FormSchemaGetter = () => QUERY_FORM_SCHEMA;

// 查询表单模式配置
const QUERY_FORM_SCHEMA = [
  { 
    component: 'Select', 
    fieldName: 'station', 
    label: '油站', 
    componentProps: { 
      placeholder: '请选择油站', 
      options: [
        { label: '机场油站', value: '机场油站' },
        { label: '北京东加油站', value: '北京东加油站' },
        { label: '北京西加油站', value: '北京西加油站' },
        { label: '北京南加油站', value: '北京南加油站' },
        { label: '北京北加油站', value: '北京北加油站' },
        { label: '未来路加油站', value: '未来路加油站' },
      ], 
    }, 
  },
  { 
    component: 'Select', 
    fieldName: 'eventType', 
    label: '事件类型', 
    componentProps: { 
      placeholder: '请选择事件类型', 
      options: [
        { label: '设备故障', value: '设备故障' },
        { label: '安全隐患', value: '安全隐患' },
        { label: '违规操作', value: '违规操作' },
        { label: '消防隐患', value: '消防隐患' },
        { label: '油品泄漏', value: '油品泄漏' },
        { label: '客户投诉', value: '客户投诉' },
      ], 
    }, 
  },
  { 
    component: 'Select', 
    fieldName: 'eventLevel', 
    label: '事件等级', 
    componentProps: { 
      placeholder: '请选择事件等级', 
      options: [
        { label: '一般', value: '一般' },
        { label: '中等', value: '中等' },
        { label: '严重', value: '严重' },
      ], 
    }, 
  },
  { 
    component: 'Select', 
    fieldName: 'status', 
    label: '状态', 
    componentProps: { 
      placeholder: '请选择状态', 
      options: [
        { label: '待处理', value: '待处理' },
        { label: '处理中', value: '处理中' },
        { label: '已处理', value: '已处理' },
      ], 
    }, 
  },
  { 
    component: 'Select', 
    fieldName: 'link', 
    label: '环节', 
    componentProps: { 
      placeholder: '请选择环节', 
      options: [
        { label: '设备管理', value: '设备管理' },
        { label: '安全管理', value: '安全管理' },
        { label: '员工管理', value: '员工管理' },
        { label: '消防管理', value: '消防管理' },
        { label: '油品管理', value: '油品管理' },
        { label: '客户服务', value: '客户服务' },
      ], 
    }, 
  },
  { 
    component: 'RangePicker', 
    fieldName: 'occurrenceTime', 
    label: '发生时间', 
    componentProps: { 
      placeholder: ['开始时间', '结束时间'], 
      type: 'datetime',
    }, 
  },
  { 
    component: 'Input', 
    fieldName: 'eventName', 
    label: '事件名称', 
    componentProps: { 
      placeholder: '请输入事件名称', 
    }, 
  },
];
