import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { pullDataFromAPI } from '../wb/manage/WbCompanyInfo.api';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '文件名称',
    align: 'left',
    dataIndex: 'fileName',
    // width: 280,
    resizable: true,
    sorter: true,
  },
  {
    title: '发布单位',
    align: 'center',
    width: 100,
    dataIndex: 'issued',
    resizable: true,
    sorter: false,
  },
  {
    title: '发布日期',
    align: 'center',
    width: 100,
    dataIndex: 'issuedDate',
    resizable: true,
    sorter: true,
  },
  {
    title: '发文号',
    align: 'center',
    width: 100,
    dataIndex: 'docNo',
    resizable: true,
    sorter: true,
  },
  {
    title: '适用范围',
    align: 'center',
    width: 150,
    dataIndex: 'applyRangeCodes',
    resizable: true,
    sorter: true,
  },
  {
    title: '标签',
    align: 'center',
    dataIndex: 'labelNames',
    width: 150,
    resizable: true,
    sorter: true,
  },
  {
    title: '',
    dataIndex: 'id',
    width: 1,
    ifShow: true,
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '文件名称',
    field: 'fileName',
    component: 'Input',
  },
  {
    label: '标签',
    field: 'labelNames',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'folder_file_labels',
      stringToNumber: true,
    },
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '文件名称',
    field: 'fileName',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [{ required: true, message: '请输入文件名称!' }];
    },
  },
  {
    label: '发布单位',
    field: 'issued',
    component: 'Input',
    componentProps: {
      showCount: true,
      maxlength: 64,
    },
    required: false,
  },
  {
    label: '发布日期',
    field: 'issuedDate',
    component: 'DatePicker',
    componentProps: {
      format: 'YYYY-MM-DD',
    },
  },
  {
    label: '状态',
    field: 'issuedSta',
    component: 'JSearchSelect',
    ifShow: true,
    componentProps: {
      dict: 'filestatus',
    },
  },
  {
    label: '发文号',
    field: 'docNo',
    component: 'Input',
    componentProps: {
      showCount: true,
      maxlength: 32,
    },
  },

  {
    label: '适用范围',
    field: 'applyRangeCodes',
    component: 'JSelectMultiple',
    componentProps: {
      dictCode: 'applyrange',
    },
  },
  {
    label: '标签',
    field: 'labels',
    component: 'StSelectLable',
  },
  {
    label: '内容分类',
    field: 'ctp',
    component: 'Input',
    show: false,
  },
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

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