import { BasicColumn, FormSchema } from '/@/components/Table';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '违法违规事实',
    align:"center",
    dataIndex: 'violationFact',
    width:150,
   },
   {
    title: '处罚依据',
    align:"center",
    dataIndex: 'punishBasis',
    width:120,
   },
   {
    title: '处罚决定',
    align:"center",
    dataIndex: 'punishDecision',
    width:100,
   },
   {
    title: '处罚决定机关名称',
    align:"center",
    dataIndex: 'punishCom',
    width:150,
   },
   {
    title: '处罚决定日期',
    align:"center",
    dataIndex: 'punishDate',
    customRender:({text}) =>{
       let arr = text.split("-")
      return arr[0]+"年"+arr[1]+"月"+arr[2]+"日";
    },
    width:140,
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '违法违规事实',
    field: 'violationFact',
    component: 'Input',
    colProps: {lg: 12},
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
    dynamicRules: ({model,schema}) => {
      return [
             { required: true, message: '请输入违法违规事实!'},
      ];
    },
  },
  {
    label: '处罚依据',
    field: 'punishBasis',
    component: 'Input',
    colProps: {lg: 12},
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
    dynamicRules: ({model,schema}) => {
      return [
             { required: true, message: '请输入处罚依据!'},
      ];
    },
  },
  {
    label: '处罚决定',
    field: 'punishDecision',
    component: 'Input',
    colProps: {lg: 12},
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
    dynamicRules: ({model,schema}) => {
      return [
             { required: true, message: '请输入处罚决定!'},
      ];
    },
  },
  {
    label: '处罚决定机关',
    field: 'punishCom',
    component: 'Input',
    colProps: {lg: 12},
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
    dynamicRules: ({model,schema}) => {
      return [
             { required: true, message: '请输入处罚决定机关!'},
      ];
    },
  },
  {
    label: '处罚决定日期',
    field: 'punishDate',
    component: 'DatePicker',
    componentProps: {
      format: 'YYYY-MM-DD'
    },
    colProps: {lg: 12},
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
    dynamicRules: ({model,schema}) => {
      return [
             { required: true, message: '请选择处罚决定日期!'},
      ];
    },
  },
  {
    label: '',
    field: 'complianeNo',
    component: 'Input',
    show: false
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];



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