import { BasicColumn, FormSchema } from '/@/components/Table';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '项目名称',
    align:"left",
    dataIndex: 'projectName',
    width:150
   },
   {
    title: '项目类型',
    align:"left",
    dataIndex: 'projectTypeName',
    width:100
   },
   {
    title: '执行部门',
    align:"left",
    dataIndex: 'execDepName',
    width:100
   },
   {
    title: '负责人',
    align:"left",
    dataIndex: 'headName',
    width:100
   },
   {
    title: '预计开始日期',
    align:"left",
    dataIndex: 'planStartDate',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
    width:130
   },
   {
    title: '预计结束日期',
    align:"left",
    dataIndex: 'planEndDate',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
    width:130
   },
   {
    title: '状态',
    align:"left",
    dataIndex: 'approveFlag',
    customRender:({text}) =>{
      return !text?"":("0"==text?'待审核':("1"==text?'已生效':("2"==text?'已驳回':'')))
    },
    width:80
   }
];

//列表数据
export const columnsPrepar: BasicColumn[] = [
  {
   title: '项目名称',
   align:"left",
   dataIndex: 'projectName'
  },
  {
   title: '项目类型',
   align:"left",
   dataIndex: 'projectTypeName'
  },
  {
   title: '执行部门',
   align:"left",
   dataIndex: 'execDepName'
  },
  {
   title: '负责人',
   align:"left",
   dataIndex: 'headName'
  },
  {
   title: '预计开始日期',
   align:"left",
   dataIndex: 'planStartDate',
   customRender:({text}) =>{
     return !text?"":(text.length>10?text.substr(0,10):text)
   },
  },
  {
   title: '预计结束日期',
   align:"left",
   dataIndex: 'planEndDate',
   customRender:({text}) =>{
     return !text?"":(text.length>10?text.substr(0,10):text)
   },
  },
  {
   title: '准备阶段',
   align:"left",
   dataIndex: 'configStatus'
  }
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '项目名称',
    field: 'projectName',
    component: 'Input',
  },
  {
    label: '项目类型',
    field: 'projectType',
    component: 'Input',
  },
  {
    label: '执行部门',
    field: 'execDepCode',
    component: 'Input',
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '立项类型',
    field: 'creType',
    component: 'RadioGroup',
    dynamicDisabled:true,
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 3},},wrapperCol:{xs: {span: 24},sm: {span: 21},}},
    componentProps:{
      options: [{ label: '计划内', value: '1' },{ label: '计划外', value: '0' }]
    }
  },
  {
    label: '计划名称',
    field: 'projectName',
    component: 'Input',
    dynamicDisabled:true,
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 3},},wrapperCol:{xs: {span: 24},sm: {span: 21},}},
  },
  {
    label: '项目名称',
    field: 'projectName',
    component: 'Input',
    dynamicDisabled:true,
    colProps: {lg: 12},
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
  },
  {
    label: '项目类型',
    field: 'projectType',
    component: 'JSearchSelect',
    componentProps:{
      dict: "projecttype"
    },
    dynamicDisabled:true,
    colProps: {lg: 12},
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
  },
  {
    label: '执行部门',
    field: 'execDepCode',
    component: 'JSelectDept',
    dynamicDisabled:true,
    colProps: {lg: 12},
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
  },
  {
    label: '负责人',
    field: 'headName',
    component: 'Input',
    dynamicDisabled:true,
    colProps: {lg: 12},
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
  },
  {
    label: '计划开始日期',
    field: 'planStartDate',
    component: 'DatePicker',
    dynamicDisabled:true,
    colProps: {lg: 12},
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
  },
  {
    label: '计划结束日期',
    field: 'planEndDate',
    component: 'DatePicker',
    dynamicDisabled:true,
    colProps: {lg: 12},
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
  },
  {
    label: '审核部门',
    field: 'approveDepCode',
    component: 'JSelectDept',
    dynamicDisabled:true,
    colProps: {lg: 12},
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
  },
  {
    label: '审核人',
    field: 'approveUserName',
    component: 'Input',
    dynamicDisabled:true,
    colProps: {lg: 12},
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
  },
  {
    label: '项目描述',
    field: 'projectDesc',
    dynamicDisabled:true,
    component: 'InputTextArea',
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 3},},wrapperCol:{xs: {span: 24},sm: {span: 21},}},
  },
  {
    label: '项目目的',
    field: 'projectAim',
    dynamicDisabled:true,
    component: 'Input',
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 3},},wrapperCol:{xs: {span: 24},sm: {span: 21},}},
  },
  {
    label: '立项报告',
    field: 'fileUploadPath',
    dynamicDisabled:true,
    component: 'JUpload',
    componentProps: { desText:"支持扩展名: .rar .zip .doc .docx .pdf .jpg..."},
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 3},},wrapperCol:{xs: {span: 24},sm: {span: 21},}},
  },
  {
    label: '审核标志',
    field: 'approveFlag',
    component: 'RadioGroup',
    componentProps:{
      options: [{ label: '通过', value: '1' },{ label: '驳回', value: '2' }]
    },
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 3},},wrapperCol:{xs: {span: 24},sm: {span: 21},}},
    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: '请选择审核信息!'},
      ];
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

export const checkViewFormSchema: FormSchema[] = [
  {
    label: '组织',
    field: 'orgNames',
    component: 'InputTextArea',
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 3},},wrapperCol:{xs: {span: 24},sm: {span: 21},}},
    componentProps:{
      readonly: true,
    }
  },
  {
    label: '人员',
    field: 'userNames',
    component: 'InputTextArea',
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 3},},wrapperCol:{xs: {span: 24},sm: {span: 21},}},
    componentProps:{
      readonly: true,
    }
  },
  {
    label: '系统',
    field: 'sysNames',
    component: 'InputTextArea',
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 3},},wrapperCol:{xs: {span: 24},sm: {span: 21},}},
    componentProps:{
      readonly: true,
    }
  },
  {
    label: '外包商',
    field: 'outerNames',
    component: 'InputTextArea',
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 3},},wrapperCol:{xs: {span: 24},sm: {span: 21},}},
    componentProps:{
      readonly: true,
    }
  },
  {
    label: '项目',
    field: 'xmNames',
    component: 'InputTextArea',
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 3},},wrapperCol:{xs: {span: 24},sm: {span: 21},}},
    componentProps:{
      readonly: true,
    }
  },
];

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