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:200,
   },
   {
    title: '检查内容',
    align:"left",
    dataIndex: 'checkCountent',
    width:200,
   },
   {
    title: '确认部门',
    align:"left",
    dataIndex: 'confirmDepName',
    width:130
   },
   {
    title: '确认人',
    align:"left",
    dataIndex: 'confirmName',
    width:100
   },
   {
    title: '分配状态',
    align:"center",
    dataIndex: 'confirmStatus',
    customRender:({text}) =>{
      const color =  text == '1' ?"green":"red";
      const temptext =  text == '1' ?"已分配":"待分配";
      return render.renderTag(temptext, color);

    },
    width:100
   },
   {
    title: '确认情况',
    align:"center",
    dataIndex: 'trueStatus',
    customRender:({text}) =>{
      const color =  text == '1' ?"green": text == '0' ? 'red' : 'gray';
      const temptext =  text == '1' ?"属实": text == '0' ? '不属实' : '待确认';
      return render.renderTag(temptext, color);

    },
    width:100
   },
];
//查询数据
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},}},
    show:  ({values}) => {
      return values.uploadFiles;
    },
  },
  {
    label: '检查内容',
    field: 'checkCountent',
    component: 'Input',
    dynamicDisabled: true,
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
    show:  ({values}) => {
      return values.uploadFiles;
    },
  },
  {
    label: '检查依据',
    field: 'checkDoc',
    component: 'Input',
    dynamicDisabled: true,
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
    show:  ({values}) => {
      return values.uploadFiles;
    },
  },
  {
    label: '现状描述',
    field: 'execContent',
    component: 'Input',
    dynamicDisabled: true,

    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
    show:  ({values}) => {
      return values.uploadFiles;
    },
  },
  {
    label: '问题项',
    field: 'problemTitle',
    component: 'Input',
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
    show:  ({values}) => {
      return values.uploadFiles;
    },
  },
  {
    label: '问题描述',
    field: 'problemContent',
    component: 'Input',
    dynamicDisabled: true,
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
    show:  ({values}) => {
      return values.uploadFiles;
    },
  },
  {
    label: '事件分类',
    field: 'riskTitle',
    component: 'Input',
    dynamicDisabled: true,
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
    show:  ({values}) => {
      return values.uploadFiles;
    },
  },
  {
    label: '风险事件',
    field: 'riskContent',
    component: 'Input',
    dynamicDisabled: true,
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
    show:  ({values}) => {
      return values.uploadFiles;
    },
  },
  {
    label: '风险等级',
    field: 'damageLevel',
    component: 'Input',
    colProps: {lg: 12},
    dynamicDisabled: true,
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
    show:  ({values}) => {
      return values.uploadFiles;
    },
  },
  {
    label: '风险评分',
    field: 'damageScore',
    component: 'Input',
    colProps: {lg: 12},
    dynamicDisabled: true,
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
    show:  ({values}) => {
      return values.uploadFiles;
    },
  },
  {
    label: '是否属实',
    field: 'trueStatus',
    component: 'Input',
    colProps: {lg: 12},
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
    show:  ({values}) => {
      return values.uploadFiles&&values.confirmFlag;
    },
  },
  {
    label: '补充说明',
    field: 'execContentDes',
    component: 'Input',
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
    show:  ({values}) => {
      return values.uploadFiles;
    },
  },
  {
    label: '补充材料',
    field: 'fileUploadPath',
    component: 'JUpload',
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 3},},wrapperCol:{xs: {span: 24},sm: {span: 21},}},
    componentProps: { desText:"支持扩展名: .rar .zip .doc .docx .pdf .jpg..."},
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
  	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'projectCheckId',
	  component: 'Input',
	  show: false
	},
  {
    label: '',
    field: 'uploadFiles',
    component: 'Input',
    show: false,
  },
  {
    label: '',
    field: 'confirmFlag',
    component: 'Input',
    show: false,
  },
];



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