import { BasicColumn, FormSchema } from '@/components/Table';
import { h } from 'vue';
import { Tag } from 'ant-design-vue';
import Icon from '@/components/Icon/Icon.vue';

export const columns: BasicColumn[] = [
  {
    title: '序号',
    dataIndex: 'name',
  },
  {
    title: '项目',
    dataIndex: 'domId',
  },
  {
    title: '计划',
    dataIndex: 'sort',
  },
  {
    title: '设备',
    dataIndex: 'class',
  },
  {
    title: '算法',
    dataIndex: 'enabledMark',
    width: 80,
    customRender: ({ record }) => {
      const color = record.status == 1 ? 'blue' : 'red';
      const text = record.status == 1 ? '启用' : '停用';
      return h(Tag, { color: color }, () => text);
    },
  },
];


export const searchFormSchema: FormSchema[] = [
  {
    field: 'key',
    label: '项目名称',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    field: '[startTime, endTime]',
    label: '巡检时间',
    component: 'RangePicker',
    colProps: { span: 6 },
    componentProps: {
      format: 'YYYY-MM-DD',
      placeholder: ['开始日期', '结束日期'],
    },
  },
    {
    field: 'status',
    component: 'Select',
    label: '当前状态',
    colProps: {
      span: 6,
    },
    componentProps: () => {
      
    },
  },
//   {
//     field: 'status',
//     component: 'ApiSelect',
//     label: '当前状态',
//     colProps: {
//       span: 6,
//     },
//     componentProps: () => {
//       return {
//         api: getFormsTypeList,
//         params: {
//           code: 'ssnyddqyt',
//         },
//         resultField: '',
//         labelField: 'itemName',
//         valueField: 'itemValue',
//       };
//     },
//   },
];

