import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';

export const columns: BasicColumn[] = [
  {
    title: '附件地址',
    dataIndex: 'id'
  },
  {
    title: '地块编码',
    dataIndex: 'wrdkbm'
  },
  {
    title: '附件名称',
    dataIndex: 'title'
  },
  {
    title: '所处阶段编码',
    dataIndex: 'scjdbm'
  },
  {
    title: '时间',
    dataIndex: 'tsamp'
  },
  {
    title: '推送结果',
    dataIndex: 'rest'
  },
  {
    title: '状态',
    dataIndex: 'status',
    resizable: true,
    customRender: ({ record }: any) => {
      return record.status == 1 ? '是' : record.status == 0 ? '否' : '未操作'
    },
    align: 'center'
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    label: '地块编码',
    field: 'wrdkbm',
    component: 'Input'
  },
  {
    label: '附件地址',
    field: 'id',
    component: 'Input'
  },
];

export const formSchema: FormSchema[] = [
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '附件地址', field: 'id', component: 'Input',
    componentProps: {
      disabled: false
    },
  },
  {
    label: '地块编码',
    field: 'wrdkbm',
    component: 'Input',
    componentProps: {
      disabled: false
    },
  },
  {
    label: '附件名称',
    field: 'title',
    component: 'Input',
    componentProps: {
      disabled: false
    },
  },
  {
    label: '所处阶段编码',
    field: 'scjdbm',
    component: 'Input',
    componentProps: {
      disabled: false
    },
  },
  {
    label: '时间',
    field: 'tsamp',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD hh:mm:ss',
      disabled: false
    },
  },
  {
    label: '推送结果',
    field: 'rest',
    component: 'Input',
    componentProps: {
      disabled: false
    },
  },
  {
    label: '状态',
    field: 'status',
    component: 'Select',
    componentProps: () => {
      return {
        options: [
          {
            label: '是',
            value: 1,
          },
          {
            label: '否',
            value: 0,
          },
          {
            label: '未操作',
            value: -1,
          },
        ],
        disabled: false
      };
    },
  },
];
