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: 'caName',
    width:150
   },
   {
    title: '所属领域',
    align:"left",
    dataIndex: 'domainName',
    width:150
   },
   {
    title: '检查内容',
    align:"left",
    dataIndex: 'checkCountent',
    width:200
   },
   {
    title: '问题项',
    align:"left",
    dataIndex: 'problemItem',
    width:150
   },
   {
    title: '问题描述',
    align:"left",
    dataIndex: 'problemExample',
    width:250
   },
   {
    title: '状态',
    align:"center",
    dataIndex: 'confirmStatus',
    customRender:({text}) =>{
      const color =  text == '1' ?"green":"red";
      const temptext =  text == '1' ?"已建议":"待建议";
      return render.renderTag(temptext, color);

    },
    width:80
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [

];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '控制活动',
    field: 'caName',
    component: 'Input',
    dynamicDisabled: true,
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
  },
  {
    label: '检查内容',
    field: 'checkCountent',
    component: 'Input',
    dynamicDisabled: true,
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
  },
  {
    label: '检查依据',
    field: 'checkDoc',
    component: 'Input',
    dynamicDisabled: true,
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
  },
  {
    label: '现状描述',
    field: 'execContent',
    component: 'Input',
    dynamicDisabled: true,

    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
  },
  {
    label: '问题项',
    field: 'problemTitle',
    component: 'Input',
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
  },
  {
    label: '问题描述',
    field: 'problemContent',
    component: 'Input',
    dynamicDisabled: true,
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
  },
  {
    label: '问题严重程度',
    field: 'severity',
    component: 'Input',
    colProps: {lg: 12},
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
    dynamicRules: ({values}) => {
      if(values.showFooter){        
        return [        
             { required: true, message: '请选择问题严重程度'},
        ];
      }
      return [];
    },
  },
  {
    label: '整改优先级',
    field: 'adviceLevel',
    component: 'Input',
    colProps: {lg: 12},
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
    dynamicRules: ({values}) => {
      if(values.showFooter){        
        return [        
             { required: true, message: '请选择整改优先级'},
        ];
      }
      return [];
    },
  },
  {
    label: '整改建议',
    field: 'adviceAdvice',
    component: 'Input',
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
    dynamicRules: ({values}) => {
      if(values.showFooter){        
        return [        
             { required: true, message: '请选择整改建议'},
        ];
      }
      return [];
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
  {
    label: '',
    field: 'showFooter',
    component: 'Input',
    show: false,
  },
];



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