import { BasicColumn, FormSchema } from '/@/components/Table';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '项目名称',
    align:"center",
    dataIndex: 'projectName',
    width:200,
   },{
    title: '项目类型',
    align:"center",
    dataIndex: 'projectTypeName',
    width:100,
   },{
    title: '执行部门',
    align:"center",
    dataIndex: 'execDepName',
    width:100
   },
   {
    title: '负责人',
    align:"center",
    dataIndex: 'headName',
    width:100
   },{
    title: '计划开始日期',
    align:"center",
    dataIndex: 'planStartDate',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
    width:120
   },
   {
    title: '计划结束日期',
    align:"center",
    dataIndex: 'planEndDate',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
    width:120
   },
   {
    title: '创建人',
    align:"center",
    dataIndex: 'createUserName',
    width:100
   },
   {
    title: '审核类型',
    align:"center",
    dataIndex: 'approvalTypeName',
    width:100
   },
   {
    title: '状态',
    align:"center",
    dataIndex: 'statusName',
    width:100
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "项目名称",
      field: 'projectName',
      component: 'Input',
      colProps: {span: 6},
 	},
	{
      label: "项目类型",
      field: 'projectType',
      component: 'Input',
      colProps: {span: 6},
 	},
	{
      label: "执行部门",
      field: 'execDepCode',
      component: 'Input',
      colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '项目名称',
    field: 'projectName',
    component: 'Input',
    colProps: {lg: 12},
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
    dynamicDisabled: true,
  },
  {
    label: '项目类型',
    field: 'projectTypeName',
    component: 'Input',
    colProps: {lg: 12},
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
    dynamicDisabled: true,
  },
  {
    label: '执行部门',
    field: 'execDepName',
    component: 'Input',
    colProps: {lg: 12},
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
    dynamicDisabled: true,
  },
  {
    label: '负责人',
    field: 'headName',
    component: 'Input',
    colProps: {lg: 12},
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
    dynamicDisabled: true,
  },
  {
    label: '计划开始日期',
    field: 'planStartDate',
    component: 'Input',
    colProps: {lg: 12},
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
    dynamicDisabled: true,
  },
  {
    label: '计划结束日期',
    field: 'planEndDate',
    component: 'Input',
    colProps: {lg: 12},
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
    dynamicDisabled: true,
  },
  {
    label: '审核部门',
    field: 'approveDepCodeName',
    component: 'Input',
    colProps: {lg: 12},
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
    dynamicDisabled: true,
  },
  {
    label: '审核人',
    field: 'planApproveUserName',
    component: 'Input',
    colProps: {lg: 12},
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
    dynamicDisabled: true,
  },
  {
    label: '项目描述',
    field: 'projectDesc',
    component: 'InputTextArea',
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 3},},wrapperCol:{xs: {span: 24},sm: {span: 21},}},
    dynamicDisabled: true,
    componentProps: {
      rows: 4
    }
  },
  {
    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...",buttonVisible: false},
    dynamicDisabled: true,
  },
  {
    label: '变更原因',
    field: 'optDes',
    component: 'InputTextArea',
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 3},},wrapperCol:{xs: {span: 24},sm: {span: 21},}},
    dynamicDisabled: true,
    show: false,
    componentProps: {
      rows: 4
    }
  },
  {
    label: '审核结果',
    field: 'approveFlag',
    component: 'RadioGroup',
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 3},},wrapperCol:{xs: {span: 24},sm: {span: 21},}},
    componentProps: {
      options:[
        {
          label:"通过",
          value:"1"
        },{
          label:"驳回",
          value:"0"
        }
      ]
    },
    dynamicRules: ({model,schema}) => {
      return [
             { required: true, message: '请选择审核结果!'},
      ];
    },
  },
  {
    label: '审核意见',
    field: 'approveDes',
    component: 'InputTextArea',
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 3},},wrapperCol:{xs: {span: 24},sm: {span: 21},}},
    dynamicRules: ({model,schema}) => {
      return [
             { required: true, message: '请输入审核意见!'},
      ];
    },
    componentProps: {
      rows: 4
    }
  },
  {
	  label: '',
	  field: 'planCode',
	  component: 'Input',
	  show: false
	},
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];



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