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: '标题',
    align: "center",
    dataIndex: 'title'
  },
  {
    title: '文章类型',
    align: "center",
    customRender:({text}) =>{
      return !text?"":(text==='1'?'招生章程':text==='2'?'高考动态':'校内资讯')
    },
    dataIndex: 'type'
  },
  {
    title: '院校id',
    align: "center",
    dataIndex: 'schoolId'
  },
  {
    title: '院校名称',
    align: "center",
    dataIndex: 'schoolName'
  },
  {
    title: '发布者',
    align: "center",
    dataIndex: 'author'
  },
  {
    title: '发布日期',
    align: "center",
    dataIndex: 'releaseTime'
  },
  {
    title: '年份',
    align: "center",
    dataIndex: 'year'
  },
  {
    title: '阅读量',
    align: "center",
    dataIndex: 'viewCount'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '标题',
    field: 'title',
    component: 'Input',
  },
  {
    label: '文章类型(1.招生章程)',
    field: 'type',
    component: 'Input',
  },
  {
    label: '院校id',
    field: 'schoolId',
    component: 'Input',
  },
  {
    label: '院校名称',
    field: 'schoolName',
    component: 'Input',
  },
  {
    label: '发布者',
    field: 'author',
    component: 'Input',
  },
  {
    label: '发布日期',
    field: 'releaseTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
  },
  {
    label: '年份',
    field: 'year',
    component: 'Input',
  },
  {
    label: '阅读量',
    field: 'viewCount',
    component: 'InputNumber',
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
