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: 'content',
    ellipsis: true,
    width: 100,
  },
  {
    title: '执行规则',
    align: 'center',
    dataIndex: 'exeRule',
    ellipsis: true,
  },
  {
    title: '标签',
    align: 'left',
    dataIndex: 'lables',
    ifShow: false,
  },
  {
    title: '备注',
    align: 'center',
    dataIndex: 'des',
    ifShow: false,
  },
  {
    title: '来源文件',
    align: 'center',
    dataIndex: 'fileId',
    ifShow: false,
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '最佳实践',
    field: 'content',
    component: 'Input',
    componentProps: {
      showCount: true,
      maxlength: 64,
    },
    required: true,
  },
  {
    label: '执行规则',
    field: 'exeRule',
    component: 'JEditor',
    required: true,
    componentProps: {
      height:300,
      showCount: true,
      maxlength: 1024,
    },
  },
  {
    label: '标签',
    field: 'labels',
    component: 'StSelectLable',
  },
  {
    label: '创建人',
    field: 'createUser',
    component: 'Input',
    show: false,
  },
  {
    label: '备注',
    field: 'des',
    component: 'InputTextArea',
    componentProps: {
      rows: 5,
      showCount: true,
      maxlength: 1024,
    },
  },
  {
    label: '来源文件',
    field: 'fileId',
    component: 'InputNumber',
    show: false,
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

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