import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '公司名称',
    align:"center",
    dataIndex: 'corp'
   },
   {
    title: '填报用户',
    align:"center",
    dataIndex: 'filluser_dictText',
    customRender: ({ text }) => {
      return render.renderDict(text, 'rate_domain');
    },
   },
   {
    title: '创建时间',
    align:"center",
    dataIndex: 'createdTime',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
   {
    title: '填报电话',
    align:"center",
    dataIndex: 'corpTel'
   },
   {
    title: '调查年度',
    align:"center",
    dataIndex: 'validYear'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '公司名称',
    field: 'corp',
    component: 'Input',
  },
  {
    label: '填报用户',
    field: 'filluser',
    component: 'Input',
  },
  {
    label: '调查年度',
    field: 'validYear',
    component: 'Input',
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '公司名称',
    field: 'corp',
    component: 'Input',
  },
  {
    label: '填报用户',
    field: 'filluser',
    component: 'JSelectUser',
    componentProps:{
      labelKey: 'realname',
      rowKey: 'id',
      multi:false
   },
  },
  {
    label: '填报电话',
    field: 'corpTel',
    component: 'Input',
  },
  {
    label: '调查年度',
    field: 'validYear',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];



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