import { message } from 'ant-design-vue';
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: 'name',
    width: 350,
  },
  {
    title: '项目类型',
    align: 'left',
    dataIndex: 'tp',
    ifShow: false,
    width: 150,
  },
  {
    title: '项目类型',
    align: 'left',
    dataIndex: 'tpname',
    width: 150,
  },
  {
    title: '评分模型',
    align: 'left',
    dataIndex: 'scoreTp',
    width: 150,
    customRender:({text}) =>{
      if(!text) return ""
      if(text==1) return "成熟度"
      if(text==2) return "风险等级"
      return "混合模型"
    },
  },
  {
    title: '项目描述',
    align: 'left',
    dataIndex: 'des',
    width: 200,
  },
  {
    title: '负责人',
    align: 'center',
    dataIndex: 'respUser_dictText',
    width: 200,
    
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '项目名称',
    field: 'name',
    component: 'Input',
  },
  {
    field: 'tp',
    component: 'JCategorySelect',
    label: '项目类型',

    componentProps: {
      pcode: 'B09',
    },
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '项目名称',
    field: 'name',
    component: 'Input',
    required: true,
  },
  {
    label: '类型',
    field: 'tp',
    component: 'JCategorySelect',
    required: true,
    componentProps: {
      pcode: 'B09',
    },
  },
  {
    label: '负责人',
    field: 'respUser',
    component: 'JSelectUserByDept',
    componentProps: {
      labelKey: 'realname',
    },
    required: true,
  },
  {
    label: '评分模型',
    field: 'scoreTp',
    component: 'RadioGroup',
    componentProps: () => {
      return {
        options: [
          {
            label: '成熟度',
            value: 1,
          },
          {
            label: '风险等级',
            value: 2,
          },
          {
            label: '混合模型',
            value: 3,
          },
        ],
      };
    },
    required: true,
  },
  {
    label: '描述',
    field: 'des',
    component: 'InputTextArea',
    componentProps: {
      height: 300,
      showCount: true,
      maxlength: 2048,
    },
  },
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

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