import { BasicColumn, FormSchema } from '/@/components/Table';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '文件编号',
    align:"left",
    dataIndex: 'caseNo',
    width:100,
   },
   {
    title: '文件名称',
    align:"left",
    dataIndex: 'fileName',
    width:200,
   },
   {
    title: '适用范围',
    align:"left",
    dataIndex: 'applyRangeName',
    width:100,
   },
   {
    title: '发布单位',
    align:"left",
    dataIndex: 'issued',
    width:100,
   },
   {
    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,
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "文件名称",
      field: 'fileName',
      component: 'Input',
      colProps: {span: 6},
 	},
	{
      label: "适用范围",
      field: 'applyRangeCode',
      component: 'ApiSelect',
      colProps: {span: 6},
 	},
	{
      label: "状态",
      field: 'status',
      component: 'Input',
      colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '文件编号',
    field: 'caseNo',
    dynamicDisabled: true,
    component: 'Input',
    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: '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',
    show: false,
    component: 'Select',
    colProps: {lg: 12},
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 6},},wrapperCol:{xs: {span: 24},sm: {span: 18},}},
  },
  {
    label: '备注说明',
    field: 'fileDec',
    component: 'InputTextArea',
    itemProps:{labelCol:{xs: {span: 24},sm: {span: 3},},wrapperCol:{xs: {span: 24},sm: {span: 21},}},
    componentProps: {
      rows: 5
    }
  },
  {
    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
	},
];



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