import { BasicColumn, FormSchema } from '/@/components/Table';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '文件编号',
    align:"left",
    dataIndex: 'complianeNo',
    width:100,
   },
   {
    title: '文件名称',
    align:"left",
    dataIndex: 'fileName',
    width:150,
   },
   {
    title: '文件类型',
    align:"left",
    dataIndex: 'complianeClass',
    customRender:({text}) =>{
      return !text?"":(text==1?'法律文件':(text==2?'法规文件':(text==3?'监管意见文件':(text==4?'风险提示文件':'处罚通知'))))
    },
    width:80,
  },
   {
    title: '适用范围',
    align:"left",
    dataIndex: 'applyRangeNamestr',
    width:120,
   },
   {
    title: '发布单位',
    align:"left",
    dataIndex: 'issued',
    width:120,
   },
   {
    title: '发布日期',
    align:"left",
    dataIndex: 'issuedTime',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
    width:140,
   },
   {
    title: '状态',
    align:"left",
    dataIndex: 'statusName',
    width:80,
   },
   {
    title: '附件',
    align: "left",
    dataIndex: 'fileUploadPath',
    width:120,
   }
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "文件名称",
      field: 'fileName',
      component: 'Input',
      colProps: {span: 6},
 	},
  {
    label: "状态",
    field: 'checkStatus',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "发布日期",
    field: 'checkDates',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "类型",
    field: 'checkClassifys',
    component: 'Input',
    colProps: {span: 6},
  }
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '文件编号',
    field: 'complianeNo',
    component: 'Input',
    dynamicDisabled: true,
    colProps: {lg: 12},
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
  },
  {
    label: '文件名称',
    field: 'fileName',
    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: 'applyRangeCode',
    component: 'JSearchSelect',
    componentProps:{
      dict: "applyrange"
    },
    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: 'docNo',
    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: 'issued',
    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: 'issuedTime',
    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: 'status',
    component: 'JSearchSelect',
    ifShow: false,
    componentProps:{
      dict: "filestatus"
    },
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 3},},wrapperCol:{xs: {span: 24},sm: {span: 10},}},
    // dynamicRules: ({model,schema}) => {
    //   return [
    //          { required: true, message: '请选择发布状态!'},
    //   ];
    // },
  },
  {
    label: '备注说明',
    field: 'complianeDesc',
    component: 'InputTextArea',
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 3},},wrapperCol:{xs: {span: 24},sm: {span: 21},}},
    componentProps: {
      rows: 5
    }
  },
  {
    field: 'fileUploadPath',
    component: 'JUpload',
    label: '上传文件',
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 3},},wrapperCol:{xs: {span: 24},sm: {span: 21},}},
    componentProps: { maxCount: 1},
  },
  {
    label: '',
    field: 'complianeClass',
    component: 'Input',
    show: false
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];



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