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

// 片区检查数据类型定义
export interface DistrictInspectData {
  id: number;
  area: string; // 片区
  meetingPlace: string; // 会议地点
  meetingTime: string; // 会议时间
  executor: string; // 执行人
  comment: string; // 评论
  deadline: string; // 截止时间
  processingTime: string; // 处理时间
  completionStatus: string; // 完成状态
  creation: string; // 创建时间
}

// 片区检查表格配置
export const tableColumns: VxeGridProps['columns'] = [
  { title: '片区', field: 'area', minWidth: 120, align: 'center' },
  { title: '会议地点', field: 'meetingPlace', minWidth: 150, align: 'center' },
  { title: '会议时间', field: 'meetingTime', minWidth: 160, align: 'center' },
  { title: '执行人', field: 'executor', 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 DISTRICT_INSPECT_MOCK_DATA: DistrictInspectData[] = [
  { 
    id: 1, 
    area: '北京片区', 
    meetingPlace: '北京东加油站会议室', 
    meetingTime: '2025-12-18 10:00:00', 
    executor: '张三', 
    comment: '已审核通过', 
    deadline: '2025-12-20 18:00:00', 
    processingTime: '2025-12-18 14:30:00', 
    completionStatus: '已完成', 
    creation: '2025-12-15 09:00:00'
  },
  { 
    id: 2, 
    area: '上海片区', 
    meetingPlace: '上海加油站会议室', 
    meetingTime: '2025-12-19 13:00:00', 
    executor: '李四', 
    comment: '待审核', 
    deadline: '2025-12-22 18:00:00', 
    processingTime: '2025-12-19 10:15:00', 
    completionStatus: '进行中', 
    creation: '2025-12-16 10:30:00'
  },
  { 
    id: 3, 
    area: '广州片区', 
    meetingPlace: '广州加油站会议室', 
    meetingTime: '2025-12-20 09:30:00', 
    executor: '王五', 
    comment: '已评论', 
    deadline: '2025-12-23 18:00:00', 
    processingTime: '2025-12-20 11:45:00', 
    completionStatus: '进行中', 
    creation: '2025-12-17 14:00:00'
  },
  { 
    id: 4, 
    area: '深圳片区', 
    meetingPlace: '深圳加油站会议室', 
    meetingTime: '2025-12-17 14:00:00', 
    executor: '赵六', 
    comment: '已审核通过', 
    deadline: '2025-12-19 18:00:00', 
    processingTime: '2025-12-18 09:20:00', 
    completionStatus: '已完成', 
    creation: '2025-12-14 11:00:00'
  },
  { 
    id: 5, 
    area: '北京片区', 
    meetingPlace: '北京西加油站会议室', 
    meetingTime: '2025-12-21 14:30:00', 
    executor: '孙七', 
    comment: '未评论', 
    deadline: '2025-12-24 18:00:00', 
    processingTime: '2025-12-21 08:45:00', 
    completionStatus: '进行中', 
    creation: '2025-12-18 09:15:00'
  },
  { 
    id: 6, 
    area: '上海片区', 
    meetingPlace: '上海南加油站会议室', 
    meetingTime: '2025-12-16 11:00:00', 
    executor: '周八', 
    comment: '已审核通过', 
    deadline: '2025-12-18 18:00:00', 
    processingTime: '2025-12-17 15:30:00', 
    completionStatus: '已完成', 
    creation: '2025-12-13 10:45: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: '广州片区' },
        { label: '深圳片区', value: '深圳片区' },
      ],
    },
  },
  {
    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: '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: '已取消' },
      ],
    },
  },
];
