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

export const columns: BasicColumn[] = [
  {
    title: '名称',
    dataIndex: 'name',
  },
  {
    title: '分类',
    dataIndex: 'category',
  },
  {
    title: '类型',
    dataIndex: 'formType',
    width: 80,
    customRender: ({ record }) => {
      const status = record.formType;
      const enable = ~~status === 0;
      const color = enable ? '#67c23a' : '#e6a23c';
      const text = enable ? '常规表单' : '视图表单';
      return h(Tag, { color: color }, () => text);
    },
  },
  {
    title: '创建人',
    dataIndex: 'createUserName',
  },
  {
    title: '创建时间',
    dataIndex: 'createDate',
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'key',
    label: '关键字',
    component: 'Input',
    colProps: { span: 8 },
  },
];
