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: 'wechatPostsId'
  },
  {
    title: '微信公众号唯一id',
    align: "center",
    dataIndex: 'msgBiz'
  },
  {
    title: '文章顺序',
    align: "center",
    dataIndex: 'msgIdx'
  },
  {
    title: 'msgmid',
    align: "center",
    dataIndex: 'msgMid'
  },
  {
    title: 'v',
    align: "center",
    dataIndex: 'contentV'
  },
  {
    title: '作者',
    align: "center",
    dataIndex: 'author'
  },
  {
    title: '复制左边状态',
    align: "center",
    dataIndex: 'copyrightstat'
  },
  {
    title: '封面',
    align: "center",
    dataIndex: 'cover',
    customRender: render.renderImage,
  },
  {
    title: '创建时间',
    align: "center",
    dataIndex: 'createAt'
  },
  {
    title: '简介',
    align: "center",
    dataIndex: 'digest',
    slots: { customRender: 'htmlSlot' },
  },
  {
    title: '链接',
    align: "center",
    dataIndex: 'link'
  },
  {
    title: '添加时间',
    align: "center",
    dataIndex: 'publishAt'
  },
  {
    title: '资源链接',
    align: "center",
    dataIndex: 'sourceUrl'
  },
  {
    title: '标题',
    align: "center",
    dataIndex: 'title'
  },
  {
    title: '更新时间',
    align: "center",
    dataIndex: 'updateAt'
  },
  {
    title: '微信公众号id',
    align: "center",
    dataIndex: 'wechatId'
  },
  {
    title: '文章内容',
    align: "center",
    dataIndex: 'content',
    slots: { customRender: 'htmlSlot' },
  },
  {
    title: '点赞数',
    align: "center",
    dataIndex: 'likeNum'
  },
  {
    title: '点赞数2',
    align: "center",
    dataIndex: 'likeNum2'
  },
  {
    title: '阅读数',
    align: "center",
    dataIndex: 'readNum'
  },
  {
    title: '更新数量时间',
    align: "center",
    dataIndex: 'updateNumAt'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "微信公众号文章id",
    field: 'wechatPostsId',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "微信公众号唯一id",
    field: 'msgBiz',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "文章顺序",
    field: 'msgIdx',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "msgmid",
    field: 'msgMid',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "v",
    field: 'contentV',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "作者",
    field: 'author',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "复制左边状态",
    field: 'copyrightstat',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "封面",
    field: 'cover',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "创建时间",
    field: 'createAt',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "简介",
    field: 'digest',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "链接",
    field: 'link',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "添加时间",
    field: "publishAt",
    component: 'RangePicker',
    componentProps: {
      showTime: true,
    },
    colProps: {span: 6},
  },
  {
    label: "资源链接",
    field: 'sourceUrl',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "标题",
    field: 'title',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "更新时间",
    field: "updateAt",
    component: 'RangePicker',
    componentProps: {
      showTime: true,
    },
    colProps: {span: 6},
  },
  {
    label: "微信公众号id",
    field: 'wechatId',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "文章内容",
    field: 'content',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "点赞数",
    field: 'likeNum',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "点赞数2",
    field: 'likeNum2',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "阅读数",
    field: 'readNum',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "更新数量时间",
    field: "updateNumAt",
    component: 'RangePicker',
    componentProps: {
      showTime: true,
    },
    colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '微信公众号文章id',
    field: 'wechatPostsId',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入微信公众号文章id!'},
             ];
    },
  },
  {
    label: '微信公众号唯一id',
    field: 'msgBiz',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入微信公众号唯一id!'},
             ];
    },
  },
  {
    label: '文章顺序',
    field: 'msgIdx',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入文章顺序!'},
             ];
    },
  },
  {
    label: 'msgmid',
    field: 'msgMid',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入msgmid!'},
             ];
    },
  },
  {
    label: 'v',
    field: 'contentV',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入v!'},
             ];
    },
  },
  {
    label: '作者',
    field: 'author',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入作者!'},
             ];
    },
  },
  {
    label: '复制左边状态',
    field: 'copyrightstat',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入复制左边状态!'},
             ];
    },
  },
  {
    label: '封面',
    field: 'cover',
    component: 'JImageUpload',
    componentProps:{
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入封面!'},
             ];
    },
  },
  {
    label: '创建时间',
    field: 'createAt',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入创建时间!'},
             ];
    },
  },
  {
    label: '简介',
    field: 'digest',
    component: 'JEditor',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入简介!'},
             ];
    },
  },
  {
    label: '链接',
    field: 'link',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入链接!'},
             ];
    },
  },
  {
    label: '添加时间',
    field: 'publishAt',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入添加时间!'},
             ];
    },
  },
  {
    label: '资源链接',
    field: 'sourceUrl',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入资源链接!'},
             ];
    },
  },
  {
    label: '标题',
    field: 'title',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入标题!'},
             ];
    },
  },
  {
    label: '更新时间',
    field: 'updateAt',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入更新时间!'},
             ];
    },
  },
  {
    label: '微信公众号id',
    field: 'wechatId',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入微信公众号id!'},
             ];
    },
  },
  {
    label: '文章内容',
    field: 'content',
    component: 'JEditor',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入文章内容!'},
             ];
    },
  },
  {
    label: '点赞数',
    field: 'likeNum',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入点赞数!'},
             ];
    },
  },
  {
    label: '点赞数2',
    field: 'likeNum2',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入点赞数2!'},
             ];
    },
  },
  {
    label: '阅读数',
    field: 'readNum',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入阅读数!'},
             ];
    },
  },
  {
    label: '更新数量时间',
    field: 'updateNumAt',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入更新数量时间!'},
             ];
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
