import { BasicColumn } from "/@/components/Table";
import { FormSchema } from "/@/components/Table";
import { rules } from "/@/utils/helper/validator";
import { render } from "/@/utils/common/renderUtils";
import { getWeekMonthQuarterYear } from "/@/utils";
import { defHttp } from "@/utils/http/axios";
//列表数据
export const columns: BasicColumn[] = [
  {
    title: "关键词",
    align: "center",
    dataIndex: "keywords",
    sorter: true,
    width: 300,
  },
  {
    title: "关键词所在URL",
    align: "center",
    dataIndex: "positionUrl",
    width: 500,
  },
  {
    title: "关键词类型",
    align: "center",
    dataIndex: "keywordType",
    width: 200,
  },
  {
    title: '添加时间',
    align: 'left',
    dataIndex: 'createTime',
    sorter: true,
  },
  {
    title: '最新排名日期',
    align: 'left',
    dataIndex: 'lastSearchTime',
    sorter: true,
  },
  {
    title: '查询日期（定时任务）',
    align: 'left',
    dataIndex: 'timerLastSearchTime',
  },

  {
    title: '最新排名',
    align: 'left',
    dataIndex: 'lastRank',
    sorter: true,
    width: 100,
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "关键词",
    field: 'keywords',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "关键词类型",
    field: 'keywordType',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: 'keyword_type',
      placeholder: '请选择关键词类型',
      stringToNumber: true,
    },
    //colProps: {span: 6},
  },
  // {
  //   label: "关键词排名",
  //   field: 'keywordRank',
  //   component: 'JDictSelectTag',
  //   //填写组件Select的属性
  //   componentProps: {
  //     options: [
  //       { label: '第一页(TOP 10)', value: 1 },
  //       { label: '前三页(TOP 30)', value: 3 },
  //       { label: '前五页(TOP 50)', value: 5 },
  //       { label: '前十页(TOP 100)', value: 10 },
  //     ],
  //   },
    //colProps: {span: 6},
  // },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: "关键词类型",
    field: "keywordType",
    component: "JDictSelectTag",
    componentProps: {
      dictCode: 'keyword_type',
      placeholder: '请选择关键词类型',
      stringToNumber: true,
    },
  },
  {
    label: "关键词",
    field: "keywords",
    component: "Input",
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: "请输入关键词!" }
      ];
    }
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: "",
    field: "id",
    component: "Input",
    show: false
  }
];

// 高级查询数据
export const superQuerySchema = {
  keywords: { title: "关键词", order: 2, view: "text", type: "string" },
  lastSearchTime: { title: "最新搜索时间", order: 5, view: "datetime", type: "string" },
  timerLastSearchTime: {
    title: "定时器的最新搜索时间",
    order: 6,
    view: "datetime",
    type: "string"
  },
  status: { title: "0删除，1有效，2过期", order: 7, view: "number", type: "number" },
  sourceId: { title: "数据复制源ID", order: 8, view: "number", type: "number" },
  priority: { title: "关键词优先级（1：高；2：中；3：低）", order: 9, view: "number", type: "number" },
  finishTime: { title: "SEO关键词优化完成时间", order: 10, view: "datetime", type: "string" },
  optimizeProcess: { title: "优化进度（默认0）", order: 11, view: "number", type: "number" },
  optimizeStatus: {
    title: "优化状态（0：未完成；1：已完成）",
    order: 12,
    view: "number",
    type: "number"
  },
  keywordType: { title: "关键词类型", order: 13, view: "number", type: "number" },
  lastRank: { title: "最近一次搜索排名", order: 14, view: "number", type: "number" },
  searchStatus: {
    title: "搜索状态，0为普通状态，1为搜索进行中状态",
    order: 15,
    view: "number",
    type: "number"
  },
  positionUrl: { title: "关键词所在URL", order: 16, view: "textarea", type: "string" },
  relatedKeywordId: {
    title: "相关关键词关联的关键词的id",
    order: 17,
    view: "number",
    type: "number"
  },
  planId: { title: "关键词对应套餐的ID", order: 18, view: "text", type: "string" },
  subscriptionId: { title: "订购表ID", order: 19, view: "text", type: "string" },
  siteId: { title: "网站表ID", order: 20, view: "text", type: "string" }
};

/**
 * 流程表单调用这个方法获取formSchema
 * @param param
 */
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
