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: '微信公众号id',
    align: "center",
    dataIndex: 'wechatId'
  },
  {
    title: 'v',
    align: "center",
    dataIndex: 'contentV'
  },
  {
    title: '公众号唯一id',
    align: "center",
    dataIndex: 'msgBiz'
  },
  {
    title: '创建时间',
    align: "center",
    dataIndex: 'createAt'
  },
  {
    title: '头像',
    align: "center",
    dataIndex: 'heading',
    customRender: render.renderImage,
  },
  {
    title: '最大日期添加数',
    align: "center",
    dataIndex: 'maxDayPubCount'
  },
  {
    title: '打开历史页时间',
    align: "center",
    dataIndex: 'openHistoryPageAt'
  },
  {
    title: '标题',
    align: "center",
    dataIndex: 'title'
  },
  {
    title: '更新时间',
    align: "center",
    dataIndex: 'updatedAt'
  },
  {
    title: '用户名',
    align: "center",
    dataIndex: 'username'
  },
  {
    title: '最后添加时间',
    align: "center",
    dataIndex: 'latesPublishAt'
  },
  {
    title: '微信id',
    align: "center",
    dataIndex: 'wexintId'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "微信公众号id",
    field: 'wechatId',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "v",
    field: 'contentV',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "公众号唯一id",
    field: 'msgBiz',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "创建时间",
    field: "createAt",
    component: 'RangePicker',
    componentProps: {
      showTime: true,
    },
    colProps: {span: 6},
  },
  {
    label: "公众号简介",
    field: 'descContent',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "头像",
    field: 'heading',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "最大日期添加数",
    field: 'maxDayPubCount',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "打开历史页时间",
    field: "openHistoryPageAt",
    component: 'RangePicker',
    componentProps: {
      showTime: true,
    },
    colProps: {span: 6},
  },
  {
    label: "标题",
    field: 'title',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "更新时间",
    field: "updatedAt",
    component: 'RangePicker',
    componentProps: {
      showTime: true,
    },
    colProps: {span: 6},
  },
  {
    label: "用户名",
    field: 'username',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "最后添加时间",
    field: "latesPublishAt",
    component: 'RangePicker',
    componentProps: {
      showTime: true,
    },
    colProps: {span: 6},
  },
  {
    label: "微信id",
    field: 'wexintId',
    component: 'Input',
    colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '微信公众号id',
    field: 'wechatId',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入微信公众号id!'},
             ];
    },
  },
  {
    label: 'v',
    field: 'contentV',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入v!'},
             ];
    },
  },
  {
    label: '公众号唯一id',
    field: 'msgBiz',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入公众号唯一id!'},
             ];
    },
  },
  {
    label: '创建时间',
    field: 'createAt',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入创建时间!'},
             ];
    },
  },
  {
    label: '公众号简介',
    field: 'descContent',
    component: 'JEditor',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入公众号简介!'},
             ];
    },
  },
  {
    label: '头像',
    field: 'heading',
    component: 'JImageUpload',
    componentProps:{
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入头像!'},
             ];
    },
  },
  {
    label: '最大日期添加数',
    field: 'maxDayPubCount',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入最大日期添加数!'},
             ];
    },
  },
  {
    label: '打开历史页时间',
    field: 'openHistoryPageAt',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入打开历史页时间!'},
             ];
    },
  },
  {
    label: '标题',
    field: 'title',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入标题!'},
             ];
    },
  },
  {
    label: '更新时间',
    field: 'updatedAt',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入更新时间!'},
             ];
    },
  },
  {
    label: '用户名',
    field: 'username',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入用户名!'},
             ];
    },
  },
  {
    label: '最后添加时间',
    field: 'latesPublishAt',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入最后添加时间!'},
             ];
    },
  },
  {
    label: '微信id',
    field: 'wexintId',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入微信id!'},
             ];
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
