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

// 场站新增任务数据类型定义
export interface WorkReportData {
  id: number;
  taskName: string; // 任务名称
  station: string; // 油站
  executor: string; // 执行人
  position: string; // 岗位
  comment: string; // 评论
  deadline: string; // 截止时间
  processTime: string; // 处理时间
  completionStatus: string; // 完成状态
  creator: string; // 创建人
  area: string; // 片区
}

// 场站新增任务表格配置
export const tableColumns: VxeGridProps['columns'] = [
  { title: '任务名称', field: 'taskName', minWidth: 180, align: 'center' },
  { title: '油站', field: 'station', minWidth: 150, align: 'center' },
  { title: '执行人', field: 'executor', minWidth: 120, align: 'center' },
  { title: '岗位', field: 'position', minWidth: 120, align: 'center' },
  { title: '评论', field: 'comment', minWidth: 150, align: 'center' },
  { title: '截止时间', field: 'deadline', minWidth: 150, align: 'center' },
  { title: '处理时间', field: 'processTime', minWidth: 150, align: 'center' },
  {
    title: '完成状态',
    field: 'completionStatus',
    minWidth: 120,
    align: 'center',
  },
  { title: '创建', field: 'creator', minWidth: 120, align: 'center' },
  {
    title: '操作',
    minWidth: 100,
    align: 'center',
    slots: {
      default: 'action',
    },
  },
];

// 场站新增任务虚拟数据
export const WORK_REPORT_MOCK_DATA: WorkReportData[] = [
  {
    id: 1,
    taskName: '设备维护保养',
    station: '北京东加油站',
    executor: '张三',
    position: '站长',
    comment: '设备运行正常',
    deadline: '2024-12-10',
    processTime: '2024-12-08',
    completionStatus: '已完成',
    creator: '李四',
    area: '默认片区',
  },
  {
    id: 2,
    taskName: '安全检查',
    station: '北京西加油站',
    executor: '王五',
    position: '安全主管',
    comment: '发现1处安全隐患已整改',
    deadline: '2024-12-15',
    processTime: '2024-12-12',
    completionStatus: '已完成',
    creator: '赵六',
    area: '默认片区',
  },
  {
    id: 3,
    taskName: '油品配送',
    station: '机场油站',
    executor: '孙七',
    position: '配送员',
    comment: '按时完成配送',
    deadline: '2024-12-20',
    processTime: '2024-12-18',
    completionStatus: '已完成',
    creator: '周八',
    area: '片区1',
  },
  {
    id: 4,
    taskName: '员工培训',
    station: '北京南加油站',
    executor: '吴九',
    position: '培训师',
    comment: '培训效果良好',
    deadline: '2024-12-25',
    processTime: '',
    completionStatus: '未完成',
    creator: '郑十',
    area: '片区2',
  },
  {
    id: 5,
    taskName: '消防演练',
    station: '北京北加油站',
    executor: '钱一',
    position: '安全经理',
    comment: '演练顺利完成',
    deadline: '2024-12-30',
    processTime: '',
    completionStatus: '未完成',
    creator: '孙二',
    area: '片区3',
  },
];

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

// 查询表单模式配置
const QUERY_FORM_SCHEMA = [
  {
    component: 'Select',
    fieldName: 'area',
    label: '片区',
    componentProps: {
      placeholder: '请选择片区',
      options: [
        { label: '默认片区', value: '默认片区' },
        { label: '片区1', value: '片区1' },
        { label: '片区2', value: '片区2' },
        { label: '片区3', value: '片区3' },
      ],
    },
  },
  {
    component: 'Select',
    fieldName: 'station',
    label: '油站',
    componentProps: {
      placeholder: '请选择油站',
      options: [
        { label: '机场油站', value: '机场油站' },
        { 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: '进行中' },
      ],
    },
  },
  {
    component: 'DatePicker',
    fieldName: 'processTimeRange',
    label: '处理时间',
    componentProps: {
      placeholder: '请选择时间范围',
      type: 'daterange',
      rangeSeparator: '至',
      startPlaceholder: '开始时间',
      endPlaceholder: '结束时间',
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
    },
  },
  {
    component: 'Select',
    fieldName: 'position',
    label: '岗位',
    componentProps: {
      placeholder: '请选择岗位',
      options: [
        { label: '站长', value: '站长' },
        { label: '安全主管', value: '安全主管' },
        { label: '配送员', value: '配送员' },
        { label: '培训师', value: '培训师' },
        { label: '安全经理', value: '安全经理' },
      ],
    },
  },
  {
    component: 'Select',
    fieldName: 'comment',
    label: '评论',
    componentProps: {
      placeholder: '请选择评论状态',
      options: [
        { label: '有评论', value: '有评论' },
        { label: '无评论', value: '无评论' },
      ],
    },
  },
  {
    component: 'Select',
    fieldName: 'creator',
    label: '创建人',
    componentProps: {
      placeholder: '请选择创建人',
      options: [
        { label: '李四', value: '李四' },
        { label: '赵六', value: '赵六' },
        { label: '周八', value: '周八' },
        { label: '郑十', value: '郑十' },
        { label: '孙二', value: '孙二' },
      ],
    },
  },
  {
    component: 'Input',
    fieldName: 'executor',
    label: '执行人',
    componentProps: {
      placeholder: '请输入执行人',
    },
  },
  {
    component: 'Input',
    fieldName: 'taskName',
    label: '任务名称',
    componentProps: {
      placeholder: '请输入任务名称',
    },
  },
];
