import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import {h} from "vue";
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '文章地址',
    align: "center",
    dataIndex: 'id',
    width:250,
    customRender: (text) => {
      if(text.text  == null){
        return "暂无"
      }
      if(text.text.length == 0){
        return "暂无"
      }
      let url = 'https://m.weibo.cn/detail/'+text.text;
      if(url.length > 30){
        url = url.substring(0,30) + "...."
      }
      return h('a', {
          title: 'https://m.weibo.cn/detail/'+text.text,
          href: 'https://m.weibo.cn/detail/'+text.text,
          target: '_blank'
        },
        url
      );
    },
  },
  {
    title: '用户地址',
    align: "center",
    dataIndex: 'userId',
    width:250,
    customRender: (text) => {
      if(text.text  == null){
        return "暂无"
      }
      if(text.text.length == 0){
        return "暂无"
      }
      let url = 'https://m.weibo.cn/u/'+text.text;
      if(url.length > 30){
        url = url.substring(0,30) + "...."
      }
      return h('a', {
          title: 'https://m.weibo.cn/u/'+text.text,
          href: 'https://m.weibo.cn/u/'+text.text,
          target: '_blank'
        },
        url
      );
    },
  },
  {
    title: '微博昵称',
    align: "center",
    dataIndex: 'screenName'
  },

  {
    title: '微博的发布时间',
    align: "center",
    dataIndex: 'createdAt',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text);
    },
  },

  {
    title: '微博获得的点赞数',
    align: "center",
    dataIndex: 'attitudesCount'
  },
  {
    title: '微博获得的评论数',
    align: "center",
    dataIndex: 'commentsCount'
  },
  {
    title: '微博获得的转发数',
    align: "center",
    dataIndex: 'repostsCount'
  },
  {
    title: '原文章地址',
    align: "center",
    dataIndex: 'retweetId',
    width:250,
    customRender: (text) => {
      if(text.text  == null){
        return "暂无"
      }
      if(text.text.length == 0){
        return "暂无"
      }
      let url = 'https://m.weibo.cn/detail/'+text.text;
      if(url.length > 30){
        url = url.substring(0,30) + "...."
      }
      return h('a', {
          title: 'https://m.weibo.cn/detail/'+text.text,
          href: 'https://m.weibo.cn/detail/'+text.text,
          target: '_blank'
        },
        url
      );
    },
  },
  {
    title: '错敏词列表',
    align: "center",
    dataIndex: 'sensitiveList'
  },
  {
    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: '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: "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: 'bid',
    field: 'bid',
    component: 'Input',
    dynamicRules: () => {
      return [
              { required: true, message: '请输入bid!'},
             ];
    },
  },
  {
    label: '微博用户id',
    field: 'userId',
    component: 'Input',
    dynamicRules: () => {
      return [
              { required: true, message: '请输入微博用户id!'},
             ];
    },
  },
  {
    label: '微博昵称',
    field: 'screenName',
    component: 'Input',
    dynamicRules: () => {
      return [
              { required: true, message: '请输入微博昵称!'},
             ];
    },
  },
  {
    label: '微博正文',
    field: 'text',
    component: 'JEditor',
    dynamicRules: () => {
      return [
              { required: true, message: '请输入微博正文!'},
             ];
    },
  },
  {
    label: '微博中头条文章的url',
    field: 'articleUrl',
    component: 'Input',
    dynamicRules: () => {
      return [
              { required: true, message: '请输入微博中头条文章的url!'},
             ];
    },
  },
  {
    label: '微博话题',
    field: 'topics',
    component: 'Input',
    dynamicRules: () => {
      return [
              { required: true, message: '请输入微博话题!'},
             ];
    },
  },
  {
    label: '微博at的用户',
    field: 'atUsers',
    component: 'Input',
    dynamicRules: () => {
      return [
              { required: true, message: '请输入微博at的用户!'},
             ];
    },
  },
  {
    label: '原创微博的原始图片url',
    field: 'pics',
    component: 'JImageUpload',
    componentProps:{
    },
    dynamicRules: () => {
      return [
              { required: true, message: '请输入原创微博的原始图片url!'},
             ];
    },
  },
  {
    label: '原创微博的视频',
    field: 'videoUrl',
    component: 'JEditor',
    dynamicRules: () => {
      return [
              { required: true, message: '请输入原创微博的视频!'},
             ];
    },
  },
  {
    label: '微博的发布位置',
    field: 'location',
    component: 'Input',
    dynamicRules: () => {
      return [
              { required: true, message: '请输入微博的发布位置!'},
             ];
    },
  },
  {
    label: '微博的发布时间',
    field: 'createdAt',
    component: 'DatePicker',
    dynamicRules: () => {
      return [
              { required: true, message: '请输入微博的发布时间!'},
             ];
    },
  },
  {
    label: '微博的发布工具',
    field: 'source',
    component: 'Input',
    dynamicRules: () => {
      return [
              { required: true, message: '请输入微博的发布工具!'},
             ];
    },
  },
  {
    label: '微博获得的点赞数',
    field: 'attitudesCount',
    component: 'InputNumber',
    dynamicRules: () => {
      return [
              { required: true, message: '请输入微博获得的点赞数!'},
             ];
    },
  },
  {
    label: '微博获得的评论数',
    field: 'commentsCount',
    component: 'InputNumber',
    dynamicRules: () => {
      return [
              { required: true, message: '请输入微博获得的评论数!'},
             ];
    },
  },
  {
    label: '微博获得的转发数',
    field: 'repostsCount',
    component: 'InputNumber',
    dynamicRules: () => {
      return [
              { required: true, message: '请输入微博获得的转发数!'},
             ];
    },
  },
  {
    label: '转发微博中原始微博的微博id',
    field: 'retweetId',
    component: 'Input',
    dynamicRules: () => {
      return [
              { required: true, message: '请输入转发微博中原始微博的微博id!'},
             ];
    },
  },
  {
    label: '错敏词列表',
    field: 'sensitiveList',
    component: 'InputTextArea',
    dynamicRules: () => {
      return [
              { required: true, message: '请输入错敏词列表!'},
             ];
    },
  },
  {
    label: '校对敏感词个数',
    field: 'sensitiveCount',
    component: 'InputNumber',
    dynamicRules: () => {
      return [
              { required: true, message: '请输入校对敏感词个数!'},
             ];
    },
  },
  {
    label: '错误原因；返回校对结果',
    field: 'retMsg',
    component: 'JEditor',
    dynamicRules: () => {
      return [
              { required: true, message: '请输入错误原因；返回校对结果!'},
             ];
    },
  },
  {
    label: '成功标记',
    field: 'retCode',
    component: 'InputNumber',
    dynamicRules: () => {
      return [
              { required: true, message: '请输入成功标记!'},
             ];
    },
  },
  {
    label: '校对错误个数',
    field: 'errorCount',
    component: 'InputNumber',
    dynamicRules: () => {
      return [
              { required: true, message: '请输入校对错误个数!'},
             ];
    },
  },
  {
    label: '校对重点关注词个数',
    field: 'heavyCount',
    component: 'InputNumber',
    dynamicRules: () => {
      return [
              { required: true, message: '请输入校对重点关注词个数!'},
             ];
    },
  },
  {
    label: '修改状态',
    field: 'modifyState',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "modify_state"
    },
    dynamicRules: () => {
      return [
              { required: true, message: '请输入修改状态!'},
             ];
    },
  },
  {
    label: '扫描次数',
    field: 'numberScans',
    component: 'InputNumber',
    dynamicRules: () => {
      return [
              { required: true, message: '请输入扫描次数!'},
             ];
    },
  },
  {
    label: '是否忽略',
    field: 'isIgnore',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "verify_status"
    },
    dynamicRules: () => {
      return [
              { required: true, message: '请输入是否忽略!'},
             ];
    },
  },
  {
    label: '复核时间',
    field: 'checkTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    dynamicRules: () => {
      return [
              { required: true, message: '请输入复核时间!'},
             ];
    },
  },
  {
    label: '复核状态',
    field: 'checkState',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "review_status"
    },
    dynamicRules: () => {
      return [
              { required: true, message: '请输入复核状态!'},
             ];
    },
  },
  {
    label: '复核校对错误个数',
    field: 'checkErrorCount',
    component: 'InputNumber',
    dynamicRules: () => {
      return [
              { required: true, message: '请输入复核校对错误个数!'},
             ];
    },
  },
  {
    label: '是否是失效文章',
    field: 'isInvalid',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "verify_status"
    },
    dynamicRules: () => {
      return [
              { required: true, message: '请输入是否是失效文章!'},
             ];
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
