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 :80,
   },
   {
    title: '评分依据',
    align:"left",
    dataIndex: 'stdopt',
    width :300,
   },
   {
    title: '系统自动评分',
    align:"center",
    dataIndex: 'valScore',
    width :100,
   },
   {
    title: '建议最小分值',
    align:"center",
    dataIndex: 'valScoremin',
    width :100,
   },
   {
    title: '建议最大分值',
    align:"center",
    dataIndex: 'valScoremax',
    width :100,
   }, /** 
   
   {
    title: '要素id',
    align:"center",
    dataIndex: 'rateKeyitemId'
   },
   {
    title: '显示类型',
    align:"center",
    dataIndex: 'stdtype'
   },
   */
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "评分依据",
      field: 'stdopt',
      component: 'Input',
      colProps: {span: 6},
 	}, /** 
	{
      label: "要素id",
      field: 'rateKeyitemId',
      component: 'Input',
      colProps: {span: 6},
 	}, */
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '评分依据',
    field: 'stdopt',
    component: 'InputTextArea',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入评分依据!'},
                 { min: 1, max: 1000, message: '长度最大1000个字符', trigger: 'blur' },
          ];
     },
  },
  {
    label: '系统自动评分',
    field: 'valScore',
    component: 'InputNumber',
    componentProps:{
      //带标签的 input，设置后置标签
      addonAfter:'扣分制输入负数，例如-1;得分制输入正数',
      //最大值
      max:10,
      //数值精度
      precision:1,
      //步数
      step: 0.1
    },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入自评分!'},
                
          ];
     },
  },
  {
    label: '建议分值',
    field: 'valScoremin',
    component: 'InputNumber',
    colProps: {lg: 12},
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 8},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
    componentProps:{
      //带标签的 input，设置后置标签
      addonAfter:'扣分制输入负数',
      //最大值
      max:10,
      //数值精度
      precision:1,
      //步数
      step: 0.1
    },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入最小分值!'},
          ];
     },
  },
  {
    label: '最大建议分值',
    field: 'valScoremax',
    component: 'InputNumber',
    colProps: {lg: 10},
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 8},},wrapperCol:{xs: {span: 24},sm: {span: 16},}},
    componentProps:{
      //带标签的 input，设置后置标签
      addonAfter:'扣分制输入负数',
      //最大值
      max:10,
      //数值精度
      precision:1,
      //步数
      step: 0.1
    },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入最大分值!'},
          ];
     },
  },
  {
    field: 'limitstatus',
    label: '是否关键要点', 
    component: 'Switch',
    defaultValue: '0',
    componentProps: {
      checkedChildren: '是',
      unCheckedChildren: '否',
      unCheckedValue:'0',
      checkedValue:'1',
    },
    /** 
    component: 'Switch',
      componentProps: {
        //开关大小，可选值：default small
        size:'default',
        //非选中时的内容
        unCheckedChildren:'否',
        //非选中时的值
        unCheckedValue:'0',
        //选中时的内容
        checkedChildren:'是',
        //选中时的值
        checkedValue:'1',
        defaultValue: '1',
        //是否禁用
        disabled: false
      },
      */
    dynamicRules: ({model,schema}) => {
      return [
             { required: true, message: '请输入是否审批!'},
      ];
 },
  },
  {
    label: '序号',
    field: 'valIndex',
    component: 'InputNumber',
    componentProps:{
      //带标签的 input，设置后置标签
      //addonAfter:'扣分模式输入负数，例如-1',
      //最大值
      max:100,
      min:1,
      //数值精度
      precision:0,
      //步数
      step: 1
    },
  }, /**
  {
    label: '要素id',
    field: 'rateKeyitemId',
    component: 'Input',
  },
  {
    label: '显示类型',
    field: 'stdtype',
    component: 'Input',
  },  */
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];



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