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

import { getPopupContainer } from '@vben/utils';

import { ElMessage } from 'element-plus';

// import type { SelectProps } from '#/adapter/form';
import { getPostList } from '#/api/system/post/post';
import { querybaseApilist as queryCheckFormList } from '#/api/system/tasksettings/checktheform';
import { querybaseApilist } from '#/api/system/tasksettings/tasktemplate';
import { getUserList } from '#/api/system/user/user';
import { getDictOptions } from '#/utils/dict';
// 字典标识常量
const DICT_KEYS = {
  // 任务类型字典标识
  TASK_TYPE: 'task_type',
  // 表单类型
  FORM_TYPE: 'wf_form_type',
  // 任务频率
  TASK_FREQUENCY: 'task_frequency',
};

// @ts-ignore:获取执行岗位列表
export let positionsOptions = [] as any[];
// @ts-ignore:任务负责人
export let PersoninchargeOptions = [] as any[];
// @ts-ignore:任务排斥
export let TaskExclusionOptions = [] as any[];

const getPositionsList = async () => {
  const { rows } = await getPostList({});
  positionsOptions = rows.map((item: any) => ({
    label: item.postName,
    value: item.postId,
    type: item.type,
  }));
};
// postId 1  管理部
// postId 2  片区经理
// postId 3  站长
// postId 4  当班经理
// postId 5  测试
// postId 6  安全管理部
// 初始化岗位数据
getPositionsList().catch(console.error);

const deptTreefn = async () => {
  // @ts-ignore
  const res = await getUserList({});
  PersoninchargeOptions = res.rows.map((item: any) => ({
    label: item.userName,
    value: item.userId,
  }));
};
deptTreefn();
const TaskExclusionOptionsfn = async () => {
  const res = await querybaseApilist({});
  // console.log('排斥任务',res);
  TaskExclusionOptions = res.rows.map((item: any) => ({
    label: item.taskName,
    value: item.id,
  }));
};
TaskExclusionOptionsfn();
// 获取任务类型字典选项
const getTaskTypeOptions = () => getDictOptions(DICT_KEYS.TASK_TYPE);
// 获取表单类型字典选项
const getFormTypeOptions = () => getDictOptions(DICT_KEYS.FORM_TYPE);
// 获取任务频率字典选项
export const getTaskFrequencyOptions = () =>
  getDictOptions(DICT_KEYS.TASK_FREQUENCY);
console.log('任务频率', getTaskFrequencyOptions());

// 通用Select组件配置函数
const createSearchSelectConfig = (options: any[], placeholder: string) => ({
  allowClear: true,
  placeholder,
  showSearch: true,
  filterOption: (input: string, option: any) =>
    (option?.label || '').toLowerCase().includes(input.toLowerCase()),
  options,
});

// 通用RadioGroup组件配置函数
const createRadioConfig = (
  options: { label: string; value: string }[],
  defaultValue?: string,
) => ({
  options,
  defaultValue,
});

export const queryFormSchema: FormSchemaGetter = () => [
  {
    component: 'Input',
    fieldName: 'taskName',
    label: '任务名称',
    componentProps: {
      placeholder: '请输入任务名称',
      clearable: true,
    },
  },
  {
    component: 'Select',
    fieldName: 'taskType',
    label: '任务类型',
    componentProps: {
      allowClear: true,
      placeholder: '请选择任务类型',
      options: getTaskTypeOptions(),
      clearable: true,
    },
  },
  {
    component: 'ApiSelect',
    fieldName: 'taskLeader',
    label: '任务负责人',
    componentProps: {
      placeholder: '请选择任务来源',
      api: async () => {
        const resp: any = await getUserList({
          pageNum: 1,
          pageSize: 100,
        });
        return resp.rows.map((item: any) => ({
          label: item.nickName || item.userName,
          value: item.userId.toString(),
        }));
      },
      filterable: true,
      labelField: 'label',
      valueField: 'value',
    },
  },
  {
    component: 'Select',
    fieldName: 'executePosition',
    label: '执行岗位',
    componentProps: {
      allowClear: true,
      placeholder: '请选择执行岗位',
      options: positionsOptions,
      clearable: true,
    },
  },
  {
    component: 'Select',
    fieldName: 'taskFrequency',
    label: '任务频率',
    componentProps: {
      allowClear: true,
      placeholder: '请选择任务频率',
      options: getTaskFrequencyOptions(),
      defaultValue: 'daily',
      clearable: true,
    },
  },
  {
    component: 'Select',
    fieldName: 'status',
    label: '状态',
    componentProps: {
      allowClear: true,
      placeholder: '请选择状态',
      options: [
        { label: '关闭', value: '1' },
        { label: '启用', value: '0' },
      ],
      clearable: true,
    },
  },
  {
    component: 'Select',
    fieldName: 'level',
    label: '任务级别',
    componentProps: {
      allowClear: true,
      placeholder: '请选择任务级别',
      options: [
        { label: '低', value: '0' },
        { label: '中', value: '1' },
        { label: '高', value: '2' },
      ],
      clearable: true,
    },
  },
  {
    component: 'Select',
    fieldName: 'formType',
    label: '表单类型',
    componentProps: {
      allowClear: true,
      placeholder: '请选择表单类型',
      options: getFormTypeOptions(),
      clearable: true,
    },
  },

  {
    component: 'Select',
    fieldName: 'isTiming',
    label: '定时分发',
    componentProps: {
      allowClear: true,
      placeholder: '请选择定时分发',
      options: [
        { label: '否', value: '0' },
        { label: '是', value: '1' },
      ],
      clearable: true,
    },
  },
  // {
  //   component: 'Select',
  //   fieldName: 'taskSource',
  //   label: '任务来源',
  //   componentProps: {
  //     allowClear: true,
  //     placeholder: '请选择任务来源',
  //     optiolns: [
  //       { label: '默认', value: '默认' },
  //       { label: '新增', value: '新增' },
  //     ],
  //     clearable: true,
  //   },
  // },
];
export const tableColumns: VxeGridProps['columns'] = [
  {
    type: 'checkbox',
    width: 80,
  },
  {
    field: 'taskName',
    title: '任务名称',
    minWidth: 150,
  },
  {
    field: 'taskTypeName',
    title: '任务类型',
    minWidth: 120,
  },
  {
    field: 'formTypeName',
    title: '表单类型',
    minWidth: 120,
  },
  {
    field: 'taskLeader',
    title: '任务负责人',
    minWidth: 120,
    slots: { default: 'taskLeader' },
  },
  {
    field: 'executePosition',
    title: '执行岗位',
    minWidth: 120,
    slots: { default: 'executePosition' },
  },
  {
    field: 'taskFrequency',
    title: '任务频率',
    minWidth: 120,
    slots: { default: 'taskFrequency' },
  },
  {
    field: 'status',
    title: '状态',
    minWidth: 100,
    slots: { default: 'status' },
  },
  {
    field: 'isTiming',
    title: '定时分发',
    minWidth: 100,
    slots: { default: 'isTiming' },
  },
  // {
  //   field: 'taskSource',
  //   title: '任务来源',
  //   minWidth: 100,
  // },
  // {
  //   field: 'operator',
  //   title: '操作人',
  //   minWidth: 120,
  // },
  // {
  //   field: 'operationTime',
  //   title: '操作时间',
  //   minWidth: 180,
  // },
  {
    field: 'action',
    fixed: 'right',
    slots: { default: 'action' },
    title: '操作',
    width: 300,
  },
];

// 定义通用的是/否选项
const yesNoOptions = [
  { label: '是', value: '1' },
  { label: '否', value: '0' },
];

export const drawerFormSchema: FormSchemaGetter = (props?: any) => [
  {
    component: 'Input',
    dependencies: {
      show: () => false,
      triggerFields: [''],
    },
    fieldName: 'id',
    formItemClass: 'col-span-2 items-baseline',
  },
  {
    component: 'Input',
    fieldName: 'executePosition',
    dependencies: {
      show: () => false,
      triggerFields: [''],
    },
  },
  {
    component: 'Select',
    fieldName: 'executePositions',
    label: '执行岗位',
    componentProps: (data: any, form: any) => {
      return {
        allowClear: true,
        multiple: true,
        placeholder: '请选择执行岗位',
        options: positionsOptions,
        clearable: true,
        onChange: () => {
          // 判断选择的数据是否有不同类型的
          const posts = data.executePositions;
          const type: any = [];
          for (const item of posts) {
            const info = positionsOptions.find((i: any) => i.value === item);
            if (type.includes(info.type)) {
              continue;
            }
            type.push(info.type);
          }
          if (type.length > 1) {
            ElMessage.error('选择的岗位类型不能不同');
            form.setFieldValue('executePositions', '');
            form.setFieldValue('executePosition', '');
          } else {
            form.setFieldValue(
              'executePosition',
              data.executePositions.join(','),
            );
          }
        },
      };
    },
    rules: 'required',
    formItemClass: 'col-span-2 items-baseline',
  },
  {
    component: 'Input',
    fieldName: 'taskName',
    label: '任务名称',
    componentProps: {
      placeholder: '请输入任务名称',
      maxlength: 100,
      clearable: true,
    },
    rules: 'required',
    formItemClass: 'col-span-2 items-baseline',
  },
  {
    component: 'Select',
    fieldName: 'taskType',
    label: '任务类型',
    componentProps: {
      placeholder: '请选择任务类型',
      options: getTaskTypeOptions(),
      clearable: true,
    },
    rules: 'required',
    formItemClass: 'col-span-2 items-baseline',
  },
  {
    component: 'ApiSelect',
    fieldName: 'taskLeader',
    label: '任务负责人',
    componentProps: {
      placeholder: '请选择任务来源',
      clearable: true,
      api: async () => {
        const resp: any = await getUserList({
          pageNum: 1,
          pageSize: 100,
          postId: 1,
        });
        return resp.rows.map((item: any) => ({
          label: item.nickName || item.userName,
          value: item.userId.toString(),
        }));
      },
      showSearch: true,
      filterable: true,
      remote: true,
      reserveKeyword: true,
      // filterable: true,
      remoteMethod: async (params: any) => {
        const resp: any = await getUserList({
          pageNum: 1,
          pageSize: 100,
          userName: params.query,
        });
        return resp.rows.map((item: any) => ({
          label: item.nickName || item.userName,
          value: item.userId.toString(),
        }));
      },
      labelField: 'label',
      valueField: 'value',
    },
    formItemClass: 'col-span-2 items-baseline',
  },
  {
    component: 'Select',
    fieldName: 'formType',
    label: '表单类型',
    componentProps: {
      placeholder: '请选择表单类型',
      options: getFormTypeOptions(),
      clearable: true,
    },
    rules: 'required',
    formItemClass: 'col-span-2 items-baseline',
  },
  {
    component: 'ApiSelect',
    fieldName: 'checklist',
    label: '关联表名称',
    componentProps: {
      placeholder: '请选择油站',
      clearable: true,
      api: async () => {
        const resp = await queryCheckFormList();
        console.log('关联表名称', resp);
        const data = resp?.rows || [];
        return Array.isArray(data)
          ? data.map((item: any) => ({
              label: item.name,
              value: item.id.toString(),
            }))
          : [];
      },
      labelField: 'label',
      valueField: 'value',
    },
    dependencies: {
      show(values: any) {
        return values.formType === 'inspection';
      },
      required(values: any) {
        return values.formType === 'inspection';
      },
      triggerFields: ['formType'],
    },
  },
  // {
  //   component: 'Select',
  //   fieldName: 'formType',
  //   label: '关联表名称',
  //   dependencies: {
  //     show: (values: any) => values.formType === 'inspection',
  //     triggerFields: ['formType'],
  //   },
  //   componentProps: {
  //     placeholder: '请选择关联表名称',
  //     options: getFormTypeOptions(),
  //     clearable: true,
  //   },
  //   rules: 'required',
  //   formItemClass: 'col-span-2 items-baseline',
  // },
  {
    component: 'RadioGroup',
    fieldName: 'isLicensable',
    label: '可授权',
    componentProps: createRadioConfig(yesNoOptions),
    rules: 'required',
    formItemClass: 'col-span-2 items-baseline',
  },
  {
    component: 'RadioGroup',
    fieldName: 'isRating',
    label: '评分',
    componentProps: createRadioConfig(yesNoOptions),
    rules: 'required',
    formItemClass: 'col-span-2 items-baseline',
  },
  {
    component: 'RadioGroup',
    fieldName: 'isMust',
    label: '必做',
    componentProps: createRadioConfig(yesNoOptions),
    rules: 'required',
    formItemClass: 'col-span-2 items-baseline',
  },
  {
    component: 'RadioGroup',
    fieldName: 'distributionMethod',
    label: '分发逻辑',
    formItemClass: 'col-span-2 items-baseline',
    // componentProps: createRadioConfig([
    //   { label: '油站', value: '0' },
    //   { label: '岗位', value: '1' },
    // ]),
    // slot:'distributionMethod'
  },
  {
    component: 'RadioGroup',
    fieldName: 'executionMethod',
    label: '执行方式',
    componentProps: createRadioConfig([
      { label: '人工', value: '1' },
      { label: '自动', value: '0' },
    ]),
    formItemClass: 'col-span-2 items-baseline',
  },
  {
    component: 'Select',
    fieldName: 'taskFrequency',
    label: '任务频率',
    defaultValue: 'daily',
    componentProps: {
      placeholder: '请选择任务频率',
      options: getTaskFrequencyOptions(),
      clearable: true,
      onChange: (values: any) => {
        console.log(values, 'values.taskFrequency');
      },
    },
    rules: 'required',
    formItemClass: 'col-span-2 items-baseline',
  },
  // 每天一次 daily
  // 每周一次 weekly
  // 每月一次 monthly
  // 每两月一次 every_two_months
  // 每三月一次 every_three_months
  // 每六月一次 every_six_months
  // 每年一次 yearly
  {
    component: 'Select',
    fieldName: 'startTimeDay',
    label: '开始时间 天',
    componentProps: {
      clearable: true,
      placeholder: '请输入开始时间（天）',
      options: Array.from({ length: 24 }, (_, i) => ({
        label: i.toString().padStart(2, '0'),
        value: i,
      })),
      // style: { width: '160px' },
    },
    dependencies: {
      componentProps(values: any) {
        if (values.taskFrequency === 'daily') {
          return {
            options: [
              {
                label: '-1',
                value: '-1',
              },
              {
                label: '1',
                value: '1',
              },
            ],
          };
        } else {
          let count = 7;
          switch (values.taskFrequency) {
            case 'every_six_months': {
              count = 180;

              break;
            }
            case 'every_three_months': {
              count = 90;

              break;
            }
            case 'every_two_months': {
              count = 60;

              break;
            }
            case 'monthly': {
              count = 30;

              break;
            }
            case 'yearly': {
              count = 12;

              break;
            }
            // No default
          }
          return {
            options: Array.from({ length: count }, (_, i) => ({
              label: (i + 1).toString(),
              value: i + 1,
            })),
          };
        }
      },
      triggerFields: ['taskFrequency'],
    },
    // rules: 'required',
    // slot: 'startTimeDay',
  },
  {
    component: 'Select',
    fieldName: 'startTimeHour',
    label: '时',
    componentProps: {
      clearable: true,
      placeholder: '请输入结束时间（小时）',
      options: Array.from({ length: 24 }, (_, i) => ({
        label: i.toString().padStart(2, '0'),
        value: i,
      })),
      // type: 'number',
      // placeholder: '请输入开始时间（小时）',
      // min: 0,
      // style: { width: '160px' },
    },
    // rules: 'required',
    // slot: 'startTimeHour',
  },
  {
    component: 'Select',
    fieldName: 'endTimeDay',
    label: '结束时间 天',
    dependencies: {
      disabled: (values: any) =>
        Array.isArray(values.endoftheperiod) &&
        values.endoftheperiod.length > 0,
      triggerFields: ['endoftheperiod'],
    },
    componentProps: {
      clearable: true,
      placeholder: '请输入结束时间（天）',
      options: Array.from({ length: 24 }, (_, i) => ({
        label: i.toString().padStart(2, '0'),
        value: i,
      })),
      // style: { width: '160px' },
    },
    rules: 'required',
  },
  {
    component: 'Select',
    fieldName: 'endTimeHour',
    label: '时',
    dependencies: {
      disabled: (values) =>
        Array.isArray(values.endoftheperiod) &&
        values.endoftheperiod.length > 0,
      triggerFields: ['endoftheperiod'],
    },
    componentProps: {
      clearable: true,
      placeholder: '请输入结束时间（小时）',
      options: Array.from({ length: 24 }, (_, i) => ({
        label: i.toString().padStart(2, '0'),
        value: i,
      })),
      // style: { width: '160px' },
    },
    // rules: 'required',
  },
  {
    component: 'CheckboxGroup',
    fieldName: 'endoftheperiod',
    label: '周期末',
    componentProps: {
      options: [{ label: '', value: '1' }],
    },
    formItemClass: 'col-span-2 items-baseline',
  },
  {
    component: 'InputNumber',
    fieldName: 'planTime',
    label: '计划时间',
    componentProps: {
      type: 'number',
      placeholder: '请输入计划时间',
      min: 0,
    },
    rules: 'required',
    formItemClass: 'col-span-2 items-baseline',
  },
  {
    component: 'InputNumber',
    fieldName: 'invalidDays',
    label: '失效天数',
    componentProps: {
      placeholder: '请输入失效天数',
      min: 0,
    },
    rules: 'required',
    formItemClass: 'col-span-2 items-baseline',
  },
  {
    component: 'InputNumber',
    fieldName: 'daysInterval',
    label: '间隔天数',
    componentProps: {
      placeholder: '请输入间隔天数',
      min: 0,
    },
    rules: 'required',
    formItemClass: 'col-span-2 items-baseline',
  },
  {
    component: 'InputNumber',
    fieldName: 'warningTime',
    label: '预警时间',
    componentProps: {
      placeholder: '请输入预警时间',
      min: 0,
    },
    formItemClass: 'col-span-2 items-baseline',
  },
  {
    component: 'Select',
    fieldName: 'level',
    label: '任务级别',
    componentProps: {
      placeholder: '请选择任务级别',
      options: [
        { label: '低', value: '0' },
        { label: '中', value: '1' },
        { label: '高', value: '2' },
      ],
      clearable: true,
    },
    formItemClass: 'col-span-2 items-baseline',
  },
  {
    component: 'Select',
    fieldName: 'repel',
    label: '任务排斥',
    componentProps: {
      placeholder: '请选择任务排斥',
      options: TaskExclusionOptions,
      clearable: true,
    },
    formItemClass: 'col-span-2 items-baseline',
  },
  {
    // component: 'Input',
    fieldName: 'icon',
    label: '任务图标',
    componentProps: {
      placeholder: '请输入任务图标',
      clearable: true,
    },
    rules: 'required',
    slot: 'icon',
    formItemClass: 'col-span-2 items-baseline',
  },
  {
    component: 'Input',
    fieldName: 'description',
    label: '任务描述',
    componentProps: {
      placeholder: '请输入任务描述',
      rows: 10,
      clearable: true,
    },
    // 使用自定义插槽渲染Tinymce编辑器
    slot: 'description',
    formItemClass: 'col-span-2 items-baseline',
  },
  {
    component: 'ApiTreeSelect',
    fieldName: 'standardGuideline',
    label: '标准指引',
    componentProps: {
      placeholder: '请选择标准指引',
      // api: async () => {
      //   try {
      //     const res = await queryKnowledgeCategory({});
      //     if (res?.rows && res.rows.length > 0) {
      //       // 使用Promise.all等待所有异步操作完成
      //       const treeData = await Promise.all(
      //         res.rows.map(async (item:any) => {
      //           let children = [];
      //           try {
      //             // 获取子项数据
      //             const childrenRes = await queryKnowledgeContentlist(item.id);
      //             // 由于isTransformResponse为false，childrenRes直接是数据数组
      //             const actualData = Array.isArray(childrenRes)
      //               ? childrenRes
      //               : childrenRes?.data || [];
      //             // 递归处理嵌套的children数组
      //             const processChildItem = (item: any) => {
      //               const processedItem = {
      //                 ...item,
      //                 label: item.title || item.id,
      //                 value: item.id,
      //               };
      //               // 如果item有children数组，递归处理
      //               if (
      //                 item.children &&
      //                 Array.isArray(item.children) &&
      //                 item.children.length > 0
      //               ) {
      //                 processedItem.children =
      //                   item.children.map(processChildItem);
      //               }
      //               return processedItem;
      //             };

      //             if (actualData.length > 0) {
      //               children = actualData.map(processChildItem);
      //             }
      //           } catch (error) {
      //             console.error('获取子项数据失败:', error);
      //           }
      //           return {
      //             ...item,
      //             label: item.name,
      //             value: item.id,
      //             children: children,
      //           };
      //         }),
      //       );

      //       console.log('最终树形数据:', treeData);
      //       return treeData;
      //     }
      //   } catch (error) {
      //     console.error('获取分类数据失败:', error);
      //   }
      //   return [];
      // },
      getPopupContainer,
      labelField: 'label',
      valueField: 'id',
      childrenField: 'children',
      checkStrictly: true,
      clearable: true,
    },
    formItemClass: 'col-span-2 items-baseline',
  },
  {
    component: 'Upload',
    fieldName: 'attachment',
    label: '附件',
    // 注意：该组件的详细实现已在taskTemplate-drawer.vue中通过插槽自定义
    // 这里仅保留基本配置，实际渲染由插槽控制
    componentProps: {
      // 基础配置
      action: '#',
      multiple: true,
    },
    formItemClass: 'col-span-2 items-baseline',
  },
  {
    component: 'RadioGroup',
    fieldName: 'status',
    label: '任务状态',
    componentProps: {
      options: [
        { label: '启用', value: '0' },
        { label: '关闭', value: '1' },
      ],
      defaultValue: '启用',
    },
    rules: 'required',
    formItemClass: 'col-span-2 items-baseline',
  },
  {
    component: 'RadioGroup',
    fieldName: 'isTiming',
    label: '定时分发',
    componentProps: {
      options: [
        { label: '是', value: '1' },
        { label: '否', value: '0' },
      ],
      defaultValue: '是',
    },
    rules: 'required',
    formItemClass: 'col-span-2 items-baseline',
  },
  // {
  //   component: 'Select',
  //   fieldName: 'archiveList',
  //   label: '归档列表',
  //   componentProps: {
  //     placeholder: '请选择归档列表',
  //     showSearch: true,
  //     filterOption: (input, option) =>
  //       (option?.label || '').toLowerCase().includes(input.toLowerCase()),
  //     // 模拟归档列表数据
  //     options: [
  //       { label: '日常巡检归档', value: '日常巡检归档' },
  //       { label: '安全检查归档', value: '安全检查归档' },
  //       { label: '财务报表归档', value: '财务报表归档' },
  //       { label: '市场调研归档', value: '市场调研归档' },
  //       { label: '人事档案归档', value: '人事档案归档' },
  //     ],
  //   },
  //   rules: 'required',
  // },
];

export const formActions = [
  {
    type: 'button',
    text: '查询',
    submit: true,
    buttonProps: { type: 'primary' },
  },
  { type: 'button', text: '重置', reset: true },
  {
    type: 'button',
    text: '导出',
    buttonProps: { type: 'primary', ghost: true },
  },
];

// export const mockData = [
//   {
//     id: '1',
//     taskName: '日常巡检任务',
//     taskType: '运营',
//     formType: '检查任务',
//     taskResponsible: '张三',
//     executivePost: '巡检员',
//     taskFrequency: '每天一次',
//     status: '启用',
//     timedDistribution: '是',
//     taskSource: '新增',
//     operator: '系统管理员',
//     operationTime: '2023-10-01 10:00:00',
//     // 示例附件数据
//     attachment: [
//       {
//         name: '设备巡检记录表.xlsx',
//         url: '#',
//         size: 204800,
//         type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
//         uid: '1622547135000_1',
//         status: 'success',
//       },
//       {
//         name: '巡检操作规范.pdf',
//         url: '#',
//         size: 153600,
//         type: 'application/pdf',
//         uid: '1622547135000_2',
//         status: 'success',
//       },
//     ],
//     taskDescription: '这是一个日常巡检任务，需要检查设备运行状态和环境安全。',
//     archiveList: '日常巡检归档',
//   },
//   {
//     id: '2',
//     taskName: '安全培训任务',
//     taskType: '安全',
//     formType: '表单任务',
//     taskResponsible: '李四',
//     executivePost: '安全员',
//     taskFrequency: '每月一次',
//     status: '启用',
//     timedDistribution: '是',
//     taskSource: '新增',
//     operator: '系统管理员',
//     operationTime: '2023-10-02 14:30:00',
//     // 示例附件数据
//     attachment: [
//       {
//         name: '安全培训教材.pdf',
//         url: '#',
//         size: 307200,
//         type: 'application/pdf',
//         uid: '1622547135000_3',
//         status: 'success',
//       },
//       {
//         name: '培训签到表.xlsx',
//         url: '#',
//         size: 51200,
//         type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
//         uid: '1622547135000_4',
//         status: 'success',
//       },
//     ],
//     taskDescription: '这是一个安全培训任务，需要组织员工进行安全知识学习。',
//     archiveList: '安全检查归档',
//   },
//   {
//     id: '3',
//     taskName: '财务报表提交',
//     taskType: '财务',
//     formType: '上传附件任务',
//     taskResponsible: '王五',
//     executivePost: '财务人员',
//     taskFrequency: '每月一次',
//     status: '启用',
//     timedDistribution: '否',
//     taskSource: '默认',
//     operator: '系统管理员',
//     operationTime: '2023-10-03 09:15:00',
//     // 示例附件数据
//     attachment: [
//       {
//         name: '财务报表模板.xlsx',
//         url: '#',
//         size: 102400,
//         type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
//         uid: '1622547135000_5',
//         status: 'success',
//       },
//     ],
//     taskDescription: '这是一个财务报表提交任务，需要按时提交月度财务报表。',
//     archiveList: '财务报表归档',
//   },
//   {
//     id: '4',
//     taskName: '市场调研任务',
//     taskType: '市场',
//     formType: '表单任务',
//     taskResponsible: '赵六',
//     executivePost: '市场专员',
//     taskFrequency: '每周一次',
//     status: '启用',
//     timedDistribution: '是',
//     taskSource: '新增',
//     operator: '系统管理员',
//     operationTime: '2023-10-04 16:45:00',
//   },
//   {
//     id: '5',
//     taskName: '人事档案更新',
//     taskType: '人事',
//     formType: '确认任务',
//     taskResponsible: '孙七',
//     executivePost: '人事专员',
//     taskFrequency: '每三月一次',
//     status: '关闭',
//     timedDistribution: '是',
//     taskSource: '默认',
//     operator: '系统管理员',
//     operationTime: '2023-10-05 11:20:00',
//   },
//   {
//     id: '6',
//     taskName: '合规检查任务',
//     taskType: '合规',
//     formType: '检查任务',
//     taskResponsible: '周八',
//     executivePost: '合规专员',
//     taskFrequency: '每六月一次',
//     status: '启用',
//     timedDistribution: '否',
//     taskSource: '新增',
//     operator: '系统管理员',
//     operationTime: '2023-10-06 15:10:00',
//   },
// ];
