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

export const queryFormSchema: FormSchemaGetter = () => [
  {
    component: 'Select',
    fieldName: 'department',
    label: '部门',
    componentProps: {
      placeholder: '请选择部门',
      options: [
        { label: '运营部', value: '运营部' },
        { label: '市场部', value: '市场部' },
        { label: '财务部', value: '财务部' },
        { label: '人力资源部', value: '人力资源部' },
        { label: '技术部', value: '技术部' },
      ],
    },
  },
  {
    component: 'Input',
    fieldName: 'taskName',
    label: '任务名称',
    componentProps: {
      placeholder: '请输入任务名称',
    },
  },
  {
    component: 'DatePicker',
    fieldName: 'validTime',
    label: '失效时间',
    componentProps: {
      type: 'daterange',
      format: 'YYYY-MM-DD HH:mm:ss',
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
      startPlaceholder: '开始时间',
      endPlaceholder: '结束时间',
    },
  },
  {
    component: 'Select',
    fieldName: 'taskSource',
    label: '任务来源',
    componentProps: {
      placeholder: '请选择任务来源',
      options: [
        { label: '系统自动', value: '系统自动' },
        { label: '人工分配', value: '人工分配' },
        { label: '用户提交', value: '用户提交' },
      ],
    },
  },
  {
    component: 'Input',
    fieldName: 'departmentTaskName',
    label: '任务名称',
    componentProps: {
      placeholder: '请输入任务名称',
    },
  },
  {
    component: 'Select',
    fieldName: 'taskSourcePerson',
    label: '任务来源人',
    componentProps: {
      placeholder: '请选择任务来源人',
      options: [
        { label: '管理员', value: '管理员' },
        { label: '系统', value: '系统' },
        { label: '张三', value: '张三' },
        { label: '李四', value: '李四' },
        { label: '王五', value: '王五' },
      ],
    },
  },
];

export const tableColumns: VxeGridProps['columns'] = [
  {
    type: 'checkbox',
    width: 80,
  },
  {
    field: 'taskType',
    title: '任务类型',
    minWidth: 120,
  },
  {
    field: 'taskName',
    title: '任务名称',
    minWidth: 150,
  },
  {
    field: 'validTime',
    title: '时效时间',
    minWidth: 200,
  },
  {
    field: 'taskSource',
    title: '任务来源',
    minWidth: 120,
  },
  {
    field: 'taskPersonCount',
    title: '任务人数',
    minWidth: 100,
    align: 'center',
  },
  {
    field: 'onTimeComplete',
    title: '按时完成',
    minWidth: 100,
    align: 'center',
  },
  {
    field: 'overdueComplete',
    title: '逾期完成',
    minWidth: 100,
    align: 'center',
  },
  {
    field: 'expiredNotComplete',
    title: '过期未完成',
    minWidth: 120,
    align: 'center',
  },
  {
    field: 'cancelled',
    title: '已取消',
    minWidth: 100,
    align: 'center',
  },
  {
    field: 'completionRate',
    title: '完成率',
    minWidth: 100,
    align: 'center',
  },
  {
    field: 'overdueRate',
    title: '逾期率',
    minWidth: 100,
    align: 'center',
  },
];
