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: 'left',
    dataIndex: 'pbItem',
    ellipsis: true,
    width: 100,
  },
  {
    title: '问题示例',
    align: 'center',
    dataIndex: 'pbExample',
    ifShow: false,
  },
  {
    title: '问题等级',
    align: 'center',
    dataIndex: 'pbLevel',
    ifShow: false,
  },
  {
    title: '改进建议',
    align: 'center',
    dataIndex: 'pbAdvise',
    ifShow: false,
  },
  {
    title: '影响分析',
    align: 'center',
    dataIndex: 'pbAnalysis',
    ifShow: false,
  },
  {
    title: '标签',
    align: 'left',
    dataIndex: 'lables',
    ifShow: false,
  },
  {
    title: '问题性质',
    align: 'center',
    dataIndex: 'pbNature',
    ifShow: false,
  },
  {
    title: '创建人',
    align: 'center',
    dataIndex: 'createUser',
    ifShow: false,
  },
  {
    title: '来源文件',
    align: 'center',
    dataIndex: 'fileId',
    ifShow: false,
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '问题项目',
    field: 'pbItem',
    component: 'Input',
    componentProps: {
      showCount: true,
      maxlength: 64,
    },
    required: true,
  },
  {
    label: '问题示例',
    field: 'pbExample',
    component: 'InputTextArea',
    componentProps: {
      rows: 5,
      showCount: true,
      maxlength: 1024,
    },
  },
  {
    label: '问题等级',
    field: 'pbLevel',
    component: 'Input',
    show: false,
  },
  {
    label: '改进建议',
    field: 'pbAdvise',
    component: 'InputTextArea',
    componentProps: {
      rows: 5,
      showCount: true,
      maxlength: 1024,
    },
  },
  {
    label: '影响分析',
    field: 'pbAnalysis',
    component: 'InputTextArea',
    componentProps: {
      rows: 5,
      showCount: true,
      maxlength: 1024,
    },
  },
  {
    label: '问题来源',
    field: 'pbSource',
    component: 'Input',
    show: true,
  },

  {
    label: '标签',
    field: 'labels',
    component: 'StSelectLable',
  },
  {
    label: '控制项',
    field: 'actIds',
    component: 'JCaSelect',
  },
  {
    label: '问题性质',
    field: 'pbNature',
    component: 'Input',
    show: false,
  },
  {
    label: '创建人',
    field: 'createUser',
    component: 'Input',
    show: false,
  },
  {
    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;
}
