import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import {h} from "vue";
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '错敏词列表',
    align: "center",
    dataIndex: 'sensitiveList',
    slots: { customRender: 'customColumnErr' },
    width:200
  },
  {
    title: '标题',
    align: "center",
    dataIndex: 'title',
    width:200
  },
  {
    title: '简介',
    align: "center",
    dataIndex: 'digest',
    width:200,
  },
  {
    title: '链接',
    align: "center",
    dataIndex: 'link',
    slots: { customRender: 'aurl' },
  },
  {
    title: '创建时间',
    align: "center",
    dataIndex: 'createAt'
  },
  {
    title: '添加时间',
    align: "center",
    dataIndex: 'publishAt'
  },

  {
    title: '微信公众号id',
    align: "center",
    dataIndex: 'wechatPostsId'
  },
  {
    title: '修改状态',
    align: "center",
    dataIndex: 'modifyState',
    customRender: (text) => {
      if(text.text == 1){
        return "未修改"
      }
      if(text.text == 2){
        return "已修改"
      }
    },
  },
  {
    title: '扫描次数',
    align: "center",
    dataIndex: 'numberScans'
  },
  {
    title: '是否忽略',
    align: "center",
    dataIndex: 'isIgnore',
    customRender: (text) => {
      if(text.text == 1){
        return "是"
      }
      if(text.text == 2){
        return "否"
      }
    },
  },
  {
    title: '复核时间',
    align: "center",
    dataIndex: 'checkTime'
  },
  {
    title: '复核状态',
    align: "center",
    dataIndex: 'checkState',
    customRender: (text) => {
      if(text.text == 1){
        return "已复核"
      }
      if(text.text == 2){
        return "未复核"
      }
    },
  },
  {
    title: '复核校对错误个数',
    align: "center",
    dataIndex: 'checkErrorCount'
  },
];

//查询数据
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: 'RangePicker',
    componentProps: {
      showTime: true,
    },
    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},
  },
  {
    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},
  },
];

//表单数据
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: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '请输入创建时间!'},
      ];
    },
  },
  {
    label: '简介',
    field: 'digest',
    component: 'JEditor',
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '请输入简介!'},
      ];
    },
  },
  {
    label: '链接',
    field: 'link',
    component: 'InputTextArea',
    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: 'InputTextArea',
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '请输入资源链接!'},
      ];
    },
  },
  {
    label: '标题',
    field: 'title',
    component: 'InputTextArea',
    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: '请输入更新数量时间!'},
      ];
    },
  },
  {
    label: '错敏词列表',
    field: 'sensitiveList',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '请输入错敏词列表!'},
      ];
    },
  },
  {
    label: '校对敏感词个数',
    field: 'sensitiveCount',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '请输入校对敏感词个数!'},
      ];
    },
  },
  {
    label: '错误原因',
    field: 'retMsg',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '请输入错误原因!'},
      ];
    },
  },
  {
    label: '成功标记',
    field: 'retCode',
    component: 'Input',
    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: '请输入复核校对错误个数!'},
      ];
    },
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
