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

// 总部检查数据类型定义
export interface HeadquartersInspectData {
  id: number;
  taskName: string; // 任务名称
  anomalyTotal: number; // 异常总数
  noPhotoCount: number; // 无拍照数
  executor: string; // 执行人
  position: string; // 岗位
  comment: string; // 评论
  deadline: string; // 截止时间
  processingTime: string; // 处理时间
  completionStatus: string; // 完成状态
  creation: string; // 创建时间
}

// 总部检查表格配置
export const tableColumns: VxeGridProps['columns'] = [
  { title: '任务名称', field: 'taskName', minWidth: 150, align: 'center' },
  { title: '异常总数', field: 'anomalyTotal', minWidth: 100, align: 'center' },
  { title: '无拍照数', field: 'noPhotoCount', minWidth: 100, 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: 160, align: 'center' },
  { title: '处理时间', field: 'processingTime', minWidth: 160, align: 'center' },
  { title: '完成状态', field: 'completionStatus', minWidth: 120, align: 'center' },
  { title: '创建', field: 'creation', minWidth: 160, align: 'center' },
  { 
    title: '操作', 
    minWidth: 100, 
    align: 'center', 
    slots: { default: 'action' }
  },
];

// 总部检查虚拟数据
export const HEADQUARTERS_INSPECT_MOCK_DATA: HeadquartersInspectData[] = [
  { 
    id: 1, 
    taskName: '安全检查', 
    anomalyTotal: 5, 
    noPhotoCount: 1, 
    executor: '张三', 
    position: '站长', 
    comment: '已审核通过', 
    deadline: '2025-12-20 18:00:00', 
    processingTime: '2025-12-18 10:30:00', 
    completionStatus: '已完成', 
    creation: '2025-12-15 09:00:00'
  },
  { 
    id: 2, 
    taskName: '设备巡检', 
    anomalyTotal: 3, 
    noPhotoCount: 0, 
    executor: '李四', 
    position: '设备管理员', 
    comment: '待审核', 
    deadline: '2025-12-21 18:00:00', 
    processingTime: '2025-12-18 14:20:00', 
    completionStatus: '进行中', 
    creation: '2025-12-16 08:30:00'
  },
  { 
    id: 3, 
    taskName: '环境检查', 
    anomalyTotal: 2, 
    noPhotoCount: 0, 
    executor: '王五', 
    position: '安全员', 
    comment: '已评论', 
    deadline: '2025-12-19 18:00:00', 
    processingTime: '2025-12-18 09:15:00', 
    completionStatus: '已完成', 
    creation: '2025-12-17 10:00:00'
  },
  { 
    id: 4, 
    taskName: '服务检查', 
    anomalyTotal: 4, 
    noPhotoCount: 2, 
    executor: '赵六', 
    position: '服务专员', 
    comment: '未评论', 
    deadline: '2025-12-22 18:00:00', 
    processingTime: '2025-12-18 11:45:00', 
    completionStatus: '进行中', 
    creation: '2025-12-18 09:30:00'
  },
  { 
    id: 5, 
    taskName: '安全检查', 
    anomalyTotal: 1, 
    noPhotoCount: 0, 
    executor: '孙七', 
    position: '安全员', 
    comment: '已审核通过', 
    deadline: '2025-12-18 18:00:00', 
    processingTime: '2025-12-17 16:30:00', 
    completionStatus: '已完成', 
    creation: '2025-12-14 14:00:00'
  },
  { 
    id: 6, 
    taskName: '设备巡检', 
    anomalyTotal: 6, 
    noPhotoCount: 1, 
    executor: '周八', 
    position: '设备管理员', 
    comment: '待审核', 
    deadline: '2025-12-23 18:00:00', 
    processingTime: '2025-12-18 15:20:00', 
    completionStatus: '进行中', 
    creation: '2025-12-18 10:15:00'
  },
];

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

// 查询表单模式配置
const QUERY_FORM_SCHEMA = [
  {
    component: 'Select',
    fieldName: 'taskName',
    label: '任务名称',
    componentProps: {
      placeholder: '请选择任务名称',
      options: [
        { label: '安全检查', value: '安全检查' },
        { label: '设备巡检', value: '设备巡检' },
        { label: '环境检查', value: '环境检查' },
        { label: '服务检查', value: '服务检查' },
      ],
    },
  },
  {
    component: 'Input',
    fieldName: 'executor',
    label: '执行人',
    componentProps: {
      placeholder: '请输入执行人',
    },
  },
  {
    component: 'Select',
    fieldName: 'position',
    label: '岗位',
    componentProps: {
      placeholder: '请选择岗位',
      options: [
        { label: '站长', value: '站长' },
        { label: '安全员', value: '安全员' },
        { label: '设备管理员', value: '设备管理员' },
        { label: '服务专员', value: '服务专员' },
      ],
    },
  },
  {
    component: 'Select',
    fieldName: 'comment',
    label: '评论',
    componentProps: {
      placeholder: '请选择评论',
      options: [
        { label: '已评论', value: '已评论' },
        { label: '未评论', value: '未评论' },
        { label: '待审核', value: '待审核' },
      ],
    },
  },
  {
    component: 'DatePicker',
    fieldName: 'processingTimeRange',
    label: '处理时间',
    componentProps: {
      placeholder: '请选择处理时间范围',
      type: 'daterange',
      rangeSeparator: '至',
      startPlaceholder: '开始时间',
      endPlaceholder: '结束时间',
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
  },
  {
    component: 'Select',
    fieldName: 'completionStatus',
    label: '完成状态',
    componentProps: {
      placeholder: '请选择完成状态',
      options: [
        { label: '已完成', value: '已完成' },
        { label: '进行中', value: '进行中' },
        { label: '已逾期', value: '已逾期' },
        { label: '已取消', value: '已取消' },
      ],
    },
  },
];
