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: 'rulenum',
    width :80,
   },
   {
    title: '规则名称',
    align:"left",
    dataIndex: 'rulename',
    width :260,
   },
   {
    title: '适用对象',
    align:"left",
    dataIndex: 'ruleobject',
    width :120,
    customRender: ({ text }) => {
      return render.renderDict(text, 'applyrange');
    },
   },
   {
    title: '规则说明',
    align:"left",
    dataIndex: 'ruleremark',
    width :120,
   },
   {
    title: '更新时间',
    align:"left",
    sorter: true,
    dataIndex: 'updateTime',
    width :120,
   },
   /** 
   {
    title: '计分规则',
    align:"center",
    dataIndex: 'rateScoretype_dictText'
   },  */
 
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "规则名称",
      field: 'rulename',
      component: 'Input',
      colProps: {span: 6},
 	},
	{
      label: "适用对象",
      field: 'ruleobject',
      component: 'JDictSelectTag',
      componentProps:{
          dictCode:"applyrange"
      },
      colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '规则编号',
    field: 'rulenum',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入规则编号!'},
          ];
     },
  },
  {
    label: '规则名称',
    field: 'rulename',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入规则名称!'},
          ];
     },
  },
  {
    label: '适用对象',
    field: 'ruleobject',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"applyrange"
     },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入适用对象!'},
          ];
     },
  },
  {
    label: '规则说明',
    field: 'ruleremark',
    component: 'InputTextArea',
    dynamicRules: ({model,schema}) => {
      return [
             { required: false, message: '请输入规则说明(500字以内)!'},
      ];
 },
  }, /** 
  {
    label: '计分规则',
    field: 'rateScoretype',
    component: 'RadioGroup',
    componentProps: {
      options:[
        {
          label:"得分制",
          value:"1"
        },{
          label:"扣分制",
          value:"2"
        }
      ]
    },
    dynamicRules: ({model,schema}) => {
      return [
             { required: true, message: '请选择计分规则!'},
      ];
    },
  },
   */
 
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];



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