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

// 油轮检查类型定义
export interface TankerInspectData {
  id: number;
  taskName: string; // 任务名称
  area: string; // 片区
  station: string; // 油站
  participateTime: string; // 参与时间
  executor: string; // 执行人
  comment: string; // 评论
  deadline: string; // 截止时间
  processingTime: string; // 处理时间
  completionStatus: string; // 完成状态
  creation: string; // 创建
}

// 油轮检查表格配置
export const tableColumns: VxeGridProps['columns'] = [
  { title: '任务名称', field: 'taskName', minWidth: 180, align: 'center' },
  { title: '片区', field: 'area', minWidth: 120, align: 'center' },
  { title: '油站', field: 'station', minWidth: 150, align: 'center' },
  { title: '参与时间', field: 'participateTime', minWidth: 200, align: 'center' },
  { title: '执行人', field: 'executor', minWidth: 120, align: 'center' },
  { title: '评论', field: 'comment', minWidth: 120, align: 'center' },
  { title: '截止时间', field: 'deadline', minWidth: 200, align: 'center' },
  { title: '处理时间', field: 'processingTime', minWidth: 200, align: 'center' },
  { title: '完成状态', field: 'completionStatus', minWidth: 120, align: 'center' },
  { title: '创建', field: 'creation', minWidth: 200, align: 'center' },
  { title: '操作', minWidth: 100, align: 'center', slots: { default: 'action' } },
];

// 油轮检查模拟数据
export const TANKER_INSPECT_MOCK_DATA: TankerInspectData[] = [
  {
    id: 1,
    taskName: '油轮安全检查',
    area: '华北片区',
    station: '北京东加油站',
    participateTime: '2025-01-15 09:00:00',
    executor: '张三',
    comment: '正常',
    deadline: '2025-01-20 18:00:00',
    processingTime: '2025-01-15 10:30:00',
    completionStatus: '已完成',
    creation: '2025-01-10 14:20:00'
  },
  {
    id: 2,
    taskName: '油轮设备检修',
    area: '华北片区',
    station: '北京西加油站',
    participateTime: '2025-01-16 10:00:00',
    executor: '李四',
    comment: '需要更换零件',
    deadline: '2025-01-22 18:00:00',
    processingTime: '2025-01-16 11:45:00',
    completionStatus: '处理中',
    creation: '2025-01-11 09:15:00'
  },
  {
    id: 3,
    taskName: '油轮防漏检查',
    area: '华东片区',
    station: '上海南加油站',
    participateTime: '2025-01-17 13:30:00',
    executor: '王五',
    comment: '发现轻微泄漏',
    deadline: '2025-01-23 18:00:00',
    processingTime: '2025-01-17 14:50:00',
    completionStatus: '待处理',
    creation: '2025-01-12 16:30:00'
  },
  {
    id: 4,
    taskName: '油轮安全检查',
    area: '华东片区',
    station: '上海北加油站',
    participateTime: '2025-01-18 08:45:00',
    executor: '赵六',
    comment: '正常',
    deadline: '2025-01-24 18:00:00',
    processingTime: '2025-01-18 10:15:00',
    completionStatus: '已完成',
    creation: '2025-01-13 11:25:00'
  },
  {
    id: 5,
    taskName: '油轮设备检修',
    area: '华南片区',
    station: '广州东加油站',
    participateTime: '2025-01-19 09:30:00',
    executor: '钱七',
    comment: '设备运行正常',
    deadline: '2025-01-25 18:00:00',
    processingTime: '2025-01-19 11:00:00',
    completionStatus: '已完成',
    creation: '2025-01-14 10:40:00'
  },
  {
    id: 6,
    taskName: '油轮防漏检查',
    area: '华南片区',
    station: '广州西加油站',
    participateTime: '2025-01-20 14:15:00',
    executor: '孙八',
    comment: '正常',
    deadline: '2025-01-26 18:00:00',
    processingTime: '2025-01-20 15:30:00',
    completionStatus: '已完成',
    creation: '2025-01-15 13:50:00'
  },
  {
    id: 7,
    taskName: '油轮安全检查',
    area: '华北片区',
    station: '天津加油站',
    participateTime: '2025-01-21 10:00:00',
    executor: '周九',
    comment: '需要加强管理',
    deadline: '2025-01-27 18:00:00',
    processingTime: '2025-01-21 11:20:00',
    completionStatus: '处理中',
    creation: '2025-01-16 09:10:00'
  },
  {
    id: 8,
    taskName: '油轮设备检修',
    area: '华东片区',
    station: '南京加油站',
    participateTime: '2025-01-22 13:30:00',
    executor: '吴十',
    comment: '设备老化',
    deadline: '2025-01-28 18:00:00',
    processingTime: '2025-01-22 14:45:00',
    completionStatus: '待处理',
    creation: '2025-01-17 14:20:00'
  },
];

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

// 查询表单模式配置
const QUERY_FORM_SCHEMA = [
  {
    component: 'Select',
    fieldName: 'area',
    label: '片区',
    componentProps: {
      placeholder: '请选择片区',
      options: [
        { label: '华北片区', value: '华北片区' },
        { label: '华东片区', value: '华东片区' },
        { label: '华南片区', value: '华南片区' },
      ],
    },
  },
  {
    component: 'Select',
    fieldName: 'station',
    label: '油站',
    componentProps: {
      placeholder: '请选择油站',
      options: [
        { label: '北京东加油站', value: '北京东加油站' },
        { label: '北京西加油站', value: '北京西加油站' },
        { label: '上海南加油站', value: '上海南加油站' },
        { label: '上海北加油站', value: '上海北加油站' },
        { label: '广州东加油站', value: '广州东加油站' },
        { label: '广州西加油站', value: '广州西加油站' },
        { label: '天津加油站', value: '天津加油站' },
        { label: '南京加油站', value: '南京加油站' },
      ],
    },
  },
  {
    component: 'Input',
    fieldName: 'taskName',
    label: '任务名称',
    componentProps: {
      placeholder: '请输入任务名称',
    },
  },
  {
    component: 'DatePicker',
    fieldName: 'participateTimeRange',
    label: '参与时间',
    componentProps: {
      placeholder: '请选择参与时间范围',
      type: 'daterange',
      rangeSeparator: '至',
      startPlaceholder: '开始时间',
      endPlaceholder: '结束时间',
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
  },
  {
    component: 'DatePicker',
    fieldName: 'processingTimeRange',
    label: '处理时间',
    componentProps: {
      placeholder: '请选择处理时间范围',
      type: 'daterange',
      rangeSeparator: '至',
      startPlaceholder: '开始时间',
      endPlaceholder: '结束时间',
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
  },
  {
    component: 'Select',
    fieldName: 'comment',
    label: '评论',
    componentProps: {
      placeholder: '请选择评论',
      options: [
        { label: '正常', value: '正常' },
        { label: '需要更换零件', value: '需要更换零件' },
        { label: '发现轻微泄漏', value: '发现轻微泄漏' },
        { label: '需要加强管理', value: '需要加强管理' },
        { label: '设备老化', value: '设备老化' },
        { label: '设备运行正常', value: '设备运行正常' },
      ],
    },
  },
  {
    component: 'Select',
    fieldName: 'completionStatus',
    label: '状态',
    componentProps: {
      placeholder: '请选择状态',
      options: [
        { label: '已完成', value: '已完成' },
        { label: '处理中', value: '处理中' },
        { label: '待处理', value: '待处理' },
      ],
    },
  },
];
