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: 'msgBiz'
  },
  {
    title: '公众号名称',
    align: "center",
    dataIndex: 'wechatTitle'
  },
  {
    title: '资源链接',
    align: "center",
    slots: { customRender: 'aurl' },
    dataIndex: 'source'
  },
  {
    title: '资源文章标题',
    align: "center",
    dataIndex: 'title'
  },
  {
    title: '文章发布时间',
    align: "center",
    dataIndex: 'articleReleaseTime'
  },

  {
    title: '错误个数',
    align: "center",
    dataIndex: 'errorCount'
  },
  {
    title: '标注信息',
    align: "center",
    dataIndex: 'htmlList',
    slots: { customRender: 'htmlSlot' },
  },
  {
    title: '标签原文本内容',
    align: "center",
    dataIndex: 'strList',
    slots: { customRender: 'htmlSlot' },
  },
  {
    title: '定位标注信息',
    align: "center",
    dataIndex: 'ahtmlList',
    slots: { customRender: 'htmlSlot' },
  },
  {
    title: '是否是失效文章',
    align: "center",
    dataIndex: 'isInvalid_dictText'
  },
  {
    title: '是否修改',
    align: "center",
    dataIndex: 'isRevise_dictText'
  },
  {
    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: 'checkMessage'
  },
  {
    title: '扫描次数',
    align: "center",
    dataIndex: 'numberScans'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "公众号唯一id",
    field: 'msgBiz',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "公众号名称",
    field: 'wechatTitle',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "资源链接",
    field: 'source',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "资源文章标题",
    field: 'title',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "文章发布时间",
    field: "articleReleaseTime",
    component: 'RangePicker',
    componentProps: {
      showTime: true,
    },
    colProps: {span: 6},
  },
  {
    label: "原网页内容",
    field: 'content',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "标注后网页内容",
    field: 'retMsg',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "错误个数",
    field: 'errorCount',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "标注信息",
    field: 'htmlList',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "标签原文本内容",
    field: 'strList',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "定位标注信息",
    field: 'ahtmlList',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "是否是失效文章",
    field: 'isInvalid',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "verify_status"
    },
    colProps: {span: 6},
  },
  {
    label: "是否修改",
    field: 'isRevise',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "modify_state"
    },
    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: 'checkMessage',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "扫描次数",
    field: 'numberScans',
    component: 'Input',
    colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '公众号唯一id',
    field: 'msgBiz',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入公众号唯一id!'},
             ];
    },
  },
  {
    label: '公众号名称',
    field: 'wechatTitle',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入公众号名称!'},
             ];
    },
  },
  {
    label: '资源链接',
    field: 'source',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入资源链接!'},
             ];
    },
  },
  {
    label: '资源文章标题',
    field: 'title',
    component: 'InputTextArea',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入资源文章标题!'},
             ];
    },
  },
  {
    label: '文章发布时间',
    field: 'articleReleaseTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入文章发布时间!'},
             ];
    },
  },
  {
    label: '原网页内容',
    field: 'content',
    component: 'JEditor',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入原网页内容!'},
             ];
    },
  },
  {
    label: '标注后网页内容',
    field: 'retMsg',
    component: 'JEditor',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入标注后网页内容!'},
             ];
    },
  },
  {
    label: '错误个数',
    field: 'errorCount',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入错误个数!'},
             ];
    },
  },
  {
    label: '标注信息',
    field: 'htmlList',
    component: 'JEditor',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入标注信息!'},
             ];
    },
  },
  {
    label: '标签原文本内容',
    field: 'strList',
    component: 'JEditor',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入标签原文本内容!'},
             ];
    },
  },
  {
    label: '定位标注信息',
    field: 'ahtmlList',
    component: 'JEditor',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入定位标注信息!'},
             ];
    },
  },
  {
    label: '是否是失效文章',
    field: 'isInvalid',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "verify_status"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入是否是失效文章!'},
             ];
    },
  },
  {
    label: '是否修改',
    field: 'isRevise',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "modify_state"
    },
    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: 'checkMessage',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入复核信息!'},
             ];
    },
  },
  {
    label: '扫描次数',
    field: 'numberScans',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入扫描次数!'},
             ];
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
