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';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '序号',
    dataIndex: 'rowIndex',
    key: 'rowIndex',
    width: 40,
    align: 'center',
    fixed: 'left',
    scopedSlots: { customRender: 'dataNo' },

  },
  {
    title: '关键词',
    dataIndex: 'keywords',
    key: 'keywords',
    fixed: 'left',
    scopedSlots: { customRender: 'keywords' },
    width: 350,
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '站点code或营销方案code',
    field: 'hostCode',
    component: 'Input',
  },
  {
    label: '营销方案name',
    field: 'planName',
    component: 'Input',
  },
  {
    label: '0营销方案，1站点',
    field: 'type',
    component: 'InputNumber',
  },
  {
    label: '指标名称',
    field: 'kpiName',
    component: 'Input',
  },
  {
    label: '指标code',
    field: 'kpiCode',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入指标code!'},
          ];
     },
  },
  {
    label: '指标目标',
    field: 'kpiTarget',
    component: 'InputNumber',
  },
  {
    label: '已完成目标',
    field: 'finishTarget',
    component: 'InputNumber',
  },
  {
    label: '0未完成、1完成',
    field: 'finishStatus',
    component: 'InputNumber',
  },
  {
    label: '完成时间',
    field: 'finishTime',
    component: 'DatePicker',
    componentProps: {
       showTime: true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
  },
  {
    label: '完成人的id',
    field: 'finishUid',
    component: 'Input',
  },
  {
    label: '服务开始时间',
    field: 'startTime',
    component: 'DatePicker',
    componentProps: {
       showTime: true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
  },
  {
    label: '服务结束时间',
    field: 'endTime',
    component: 'DatePicker',
    componentProps: {
       showTime: true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
  },
  {
    label: '比重，总和为100',
    field: 'proportion',
    component: 'InputNumber',
  },
  {
    label: '排序',
    field: 'sort',
    component: 'InputNumber',
  },
  {
    label: '套餐id',
    field: 'planId',
    component: 'Input',
  },
  {
    label: '对应套餐绑定表ID',
    field: 'historyId',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  hostCode: {title: '站点code或营销方案code',order: 0,view: 'text', type: 'string',},
  planName: {title: '营销方案name',order: 1,view: 'text', type: 'string',},
  type: {title: '0营销方案，1站点',order: 2,view: 'number', type: 'number',},
  kpiName: {title: '指标名称',order: 3,view: 'text', type: 'string',},
  kpiCode: {title: '指标code',order: 4,view: 'text', type: 'string',},
  kpiTarget: {title: '指标目标',order: 5,view: 'number', type: 'number',},
  finishTarget: {title: '已完成目标',order: 6,view: 'number', type: 'number',},
  finishStatus: {title: '0未完成、1完成',order: 7,view: 'number', type: 'number',},
  finishTime: {title: '完成时间',order: 8,view: 'datetime', type: 'string',},
  finishUid: {title: '完成人的id',order: 9,view: 'text', type: 'string',},
  startTime: {title: '服务开始时间',order: 10,view: 'datetime', type: 'string',},
  endTime: {title: '服务结束时间',order: 11,view: 'datetime', type: 'string',},
  proportion: {title: '比重，总和为100',order: 12,view: 'number', type: 'number',},
  sort: {title: '排序',order: 13,view: 'number', type: 'number',},
  planId: {title: '套餐id',order: 15,view: 'text', type: 'string',},
  historyId: {title: '对应套餐绑定表ID',order: 16,view: 'text', type: 'string',},
};

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