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: 'mainSiteName'
  },
  {
    title: '主站点链接',
    align: "center",
    slots: { customRender: 'aurl' },
    dataIndex: 'mainSiteUrl'
  },
  {
    title: '错敏词列表',
    align: "center",
    slots: { customRender: 'customColumnErr' },
    dataIndex: 'sensitiveList',
    width:500
  },
  {
    title: '校对敏感词个数',
    align: "center",
    dataIndex: 'sensitiveCount'
  },
  {
    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: 'isInvalid_dictText'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "资源链接",
    field: 'source',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "内容",
    field: 'content',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "主站点链接",
    field: 'mainSiteUrl',
    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: 'source',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入资源链接!'},
             ];
    },
  },
  {
    label: '内容',
    field: 'content',
    component: 'JEditor',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入内容!'},
             ];
    },
  },
  {
    label: '主站点id',
    field: 'mainSiteId',
    component: 'Input',
  },
  {
    label: '主站点名称',
    field: 'mainSiteName',
    component: 'Input',
  },
  {
    label: '主站点链接',
    field: 'mainSiteUrl',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入主站点链接!'},
             ];
    },
  },
  {
    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: 'InputTextArea',
    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,
  },
];
