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",
    sorter: true,
    dataIndex: 'valindex',
    width :50,
    
   },
   {
    title: '领域',
    align:"left",
    sorter: true,
    dataIndex: 'ratedomain',
    width :120,
    customRender: ({ text }) => {
      return render.renderDict(text, 'rate_domain');
    },
    
   },
   {
    title: '子领域',
    align:"left",
    sorter: true,
    dataIndex: 'sondomain',
    width :180,
   },
   {
    title: '备注说明',
    align:"left",
    dataIndex: 'remark',
    width :200,
   },
   
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	
	{
      label: "领域",
      field: 'ratedomain',
      component: 'JDictSelectTag',
      componentProps:{
          dictCode:"rate_domain"
      },
      colProps: {span: 6},
 	},
	{
      label: "子领域",
      field: 'sondomain',
      component: 'Input',
      colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  
  {
    label: '领域',
    field: 'ratedomain',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"rate_domain"
     },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入领域!'},
          ];
     },
  },
  {
    label: '子领域',
    field: 'sondomain',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入子领域!'},
          ];
     },
  },
  {
    label: '备注说明',
    field: 'remark',
    component: 'InputTextArea',
  },
  {
    label: '序号',
    field: 'valindex',
    component: 'InputNumber',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];


//表单数据
export const copyformSchema: FormSchema[] = [
  
  {
    label: '复制到目标评估规则',
    field: 'ruleId',
    required: true,
    component: 'JSelectRateRule',
    componentProps: {
      rowKey: 'id',
      labelKey: 'rulename',
    },
  },


	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];



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