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: 'createTime'
  },
  {
    title: '更新时间',
    align: "center",
    dataIndex: 'updateTime'
  },
  {
    title: 'bid',
    align: "center",
    dataIndex: 'bid'
  },
  {
    title: '微博用户id',
    align: "center",
    dataIndex: 'userId'
  },
  {
    title: '微博昵称',
    align: "center",
    dataIndex: 'screenName'
  },
  {
    title: '微博正文',
    align: "center",
    dataIndex: 'text',
    slots: { customRender: 'htmlSlot' },
  },
  {
    title: '微博中头条文章的url',
    align: "center",
    dataIndex: 'articleUrl'
  },
  {
    title: '微博话题',
    align: "center",
    dataIndex: 'topics'
  },
  {
    title: '微博at的用户',
    align: "center",
    dataIndex: 'atUsers'
  },
  {
    title: '原创微博的原始图片url',
    align: "center",
    dataIndex: 'pics',
    customRender: render.renderImage,
  },
  {
    title: '原创微博的视频',
    align: "center",
    dataIndex: 'videoUrl',
    slots: { customRender: 'htmlSlot' },
  },
  {
    title: '微博的发布位置',
    align: "center",
    dataIndex: 'location'
  },
  {
    title: '微博的发布时间',
    align: "center",
    dataIndex: 'createdAt',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text);
    },
  },
  {
    title: '微博的发布工具',
    align: "center",
    dataIndex: 'source'
  },
  {
    title: '微博获得的点赞数',
    align: "center",
    dataIndex: 'attitudesCount'
  },
  {
    title: '微博获得的评论数',
    align: "center",
    dataIndex: 'commentsCount'
  },
  {
    title: '微博获得的转发数',
    align: "center",
    dataIndex: 'repostsCount'
  },
  {
    title: '转发微博中原始微博的微博id',
    align: "center",
    dataIndex: 'retweetId'
  },
  {
    title: '错敏词列表',
    align: "center",
    dataIndex: 'sensitiveList'
  },
  {
    title: '校对敏感词个数',
    align: "center",
    dataIndex: 'sensitiveCount'
  },
  {
    title: '错误原因；返回校对结果',
    align: "center",
    dataIndex: 'retMsg',
    slots: { customRender: 'htmlSlot' },
  },
  {
    title: '成功标记',
    align: "center",
    dataIndex: 'retCode'
  },
  {
    title: '校对错误个数',
    align: "center",
    dataIndex: 'errorCount'
  },
  {
    title: '校对重点关注词个数',
    align: "center",
    dataIndex: 'heavyCount'
  },
  {
    title: '修改状态',
    align: "center",
    dataIndex: 'modifyState_dictText'
  },
  {
    title: '扫描次数',
    align: "center",
    dataIndex: 'numberScans'
  },
  {
    title: '是否忽略',
    align: "center",
    dataIndex: 'isIgnore_dictText'
  },
  {
    title: '复核时间',
    align: "center",
    dataIndex: 'checkTime'
  },
  {
    title: '复核状态',
    align: "center",
    dataIndex: 'checkState_dictText'
  },
  {
    title: '复核校对错误个数',
    align: "center",
    dataIndex: 'checkErrorCount'
  },
  {
    title: '是否是失效文章',
    align: "center",
    dataIndex: 'isInvalid_dictText'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "创建时间",
    field: "createTime",
    component: 'RangePicker',
    componentProps: {
      showTime: true,
    },
    colProps: {span: 6},
  },
  {
    label: "更新时间",
    field: "updateTime",
    component: 'RangePicker',
    componentProps: {
      showTime: true,
    },
    colProps: {span: 6},
  },
  {
    label: "bid",
    field: 'bid',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "微博用户id",
    field: 'userId',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "微博昵称",
    field: 'screenName',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "微博正文",
    field: 'text',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "微博中头条文章的url",
    field: 'articleUrl',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "微博话题",
    field: 'topics',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "微博at的用户",
    field: 'atUsers',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "原创微博的原始图片url",
    field: 'pics',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "原创微博的视频",
    field: 'videoUrl',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "微博的发布位置",
    field: 'location',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "微博的发布时间",
    field: "createdAt",
    component: 'RangePicker',
    colProps: {span: 6},
  },
  {
    label: "微博的发布工具",
    field: 'source',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "微博获得的点赞数",
    field: 'attitudesCount',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "微博获得的评论数",
    field: 'commentsCount',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "微博获得的转发数",
    field: 'repostsCount',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "转发微博中原始微博的微博id",
    field: 'retweetId',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "错敏词列表",
    field: 'sensitiveList',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "校对敏感词个数",
    field: 'sensitiveCount',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "错误原因；返回校对结果",
    field: 'retMsg',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "成功标记",
    field: 'retCode',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "校对错误个数",
    field: 'errorCount',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "校对重点关注词个数",
    field: 'heavyCount',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "修改状态",
    field: 'modifyState',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "modify_state"
    },
    colProps: {span: 6},
  },
  {
    label: "扫描次数",
    field: 'numberScans',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "是否忽略",
    field: 'isIgnore',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "verify_status"
    },
    colProps: {span: 6},
  },
  {
    label: "复核时间",
    field: "checkTime",
    component: 'RangePicker',
    componentProps: {
      showTime: true,
    },
    colProps: {span: 6},
  },
  {
    label: "复核状态",
    field: 'checkState',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "review_status"
    },
    colProps: {span: 6},
  },
  {
    label: "复核校对错误个数",
    field: 'checkErrorCount',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "是否是失效文章",
    field: 'isInvalid',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "verify_status"
    },
    colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '创建时间',
    field: 'createTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入创建时间!'},
             ];
    },
  },
  {
    label: '更新时间',
    field: 'updateTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入更新时间!'},
             ];
    },
  },
  {
    label: 'bid',
    field: 'bid',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入bid!'},
             ];
    },
  },
  {
    label: '微博用户id',
    field: 'userId',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入微博用户id!'},
             ];
    },
  },
  {
    label: '微博昵称',
    field: 'screenName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入微博昵称!'},
             ];
    },
  },
  {
    label: '微博正文',
    field: 'text',
    component: 'JEditor',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入微博正文!'},
             ];
    },
  },
  {
    label: '微博中头条文章的url',
    field: 'articleUrl',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入微博中头条文章的url!'},
             ];
    },
  },
  {
    label: '微博话题',
    field: 'topics',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入微博话题!'},
             ];
    },
  },
  {
    label: '微博at的用户',
    field: 'atUsers',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入微博at的用户!'},
             ];
    },
  },
  {
    label: '原创微博的原始图片url',
    field: 'pics',
    component: 'JImageUpload',
    componentProps:{
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入原创微博的原始图片url!'},
             ];
    },
  },
  {
    label: '原创微博的视频',
    field: 'videoUrl',
    component: 'JEditor',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入原创微博的视频!'},
             ];
    },
  },
  {
    label: '微博的发布位置',
    field: 'location',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入微博的发布位置!'},
             ];
    },
  },
  {
    label: '微博的发布时间',
    field: 'createdAt',
    component: 'DatePicker',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入微博的发布时间!'},
             ];
    },
  },
  {
    label: '微博的发布工具',
    field: 'source',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入微博的发布工具!'},
             ];
    },
  },
  {
    label: '微博获得的点赞数',
    field: 'attitudesCount',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入微博获得的点赞数!'},
             ];
    },
  },
  {
    label: '微博获得的评论数',
    field: 'commentsCount',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入微博获得的评论数!'},
             ];
    },
  },
  {
    label: '微博获得的转发数',
    field: 'repostsCount',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入微博获得的转发数!'},
             ];
    },
  },
  {
    label: '转发微博中原始微博的微博id',
    field: 'retweetId',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入转发微博中原始微博的微博id!'},
             ];
    },
  },
  {
    label: '错敏词列表',
    field: 'sensitiveList',
    component: 'InputTextArea',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入错敏词列表!'},
             ];
    },
  },
  {
    label: '校对敏感词个数',
    field: 'sensitiveCount',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入校对敏感词个数!'},
             ];
    },
  },
  {
    label: '错误原因；返回校对结果',
    field: 'retMsg',
    component: 'JEditor',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入错误原因；返回校对结果!'},
             ];
    },
  },
  {
    label: '成功标记',
    field: 'retCode',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入成功标记!'},
             ];
    },
  },
  {
    label: '校对错误个数',
    field: 'errorCount',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入校对错误个数!'},
             ];
    },
  },
  {
    label: '校对重点关注词个数',
    field: 'heavyCount',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入校对重点关注词个数!'},
             ];
    },
  },
  {
    label: '修改状态',
    field: 'modifyState',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "modify_state"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入修改状态!'},
             ];
    },
  },
  {
    label: '扫描次数',
    field: 'numberScans',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入扫描次数!'},
             ];
    },
  },
  {
    label: '是否忽略',
    field: 'isIgnore',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "verify_status"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入是否忽略!'},
             ];
    },
  },
  {
    label: '复核时间',
    field: 'checkTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入复核时间!'},
             ];
    },
  },
  {
    label: '复核状态',
    field: 'checkState',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "review_status"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入复核状态!'},
             ];
    },
  },
  {
    label: '复核校对错误个数',
    field: 'checkErrorCount',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入复核校对错误个数!'},
             ];
    },
  },
  {
    label: '是否是失效文章',
    field: 'isInvalid',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "verify_status"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入是否是失效文章!'},
             ];
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
