import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { queryAllTasks} from '../task/BaosongTask.api';
import { allTpls} from '../tpl/BaosongTpl.api';
import { render } from '/@/utils/common/renderUtils';


//列表数据
export const columns: BasicColumn[] = [
   {
    title: '任务名称',
    align:"left",
    dataIndex: 'taskid_dictText',
    resizable:true,
    width:200
   },
   {
    title: '模板名称',
    align:"left",
    dataIndex: 'tplid_dictText',

    width:200
   },
   {
    title: '模板项',
    align:"left",
    dataIndex: 'itemid_dictText',
    resizable:true,
    width:200
   },
   {
    title: '填报人',
    align:"left",
    dataIndex: 'fillUser_dictText',
    resizable:true,
    width:200
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '任务',
    field: 'taskid',
    component: 'ApiSelect',
    componentProps: {
      mode: 'select',
      api: queryAllTasks,
      labelField: 'name',
      valueField: 'id',
    },
  },
  {
    label: '模板',
    field: 'tplid',
    component: 'ApiSelect',
    componentProps: {
      mode: 'select',
      api: allTpls,
      labelField: 'nm',
      valueField: 'id',
    },
  },
  // {
  //   label: '模板项',
  //   field: 'title',
  //   component: 'Input',
  // },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '任务',
    field: 'taskid_dictText',
    component: 'Input',
  },
  {
    label: '模板ID',
    field: 'tplid_dictText',
    component: 'Input',
  },
  {
    label: '模板项',
    field: 'itemid_dictText',
    component: 'Input',
  },
  {
    label: '填报人',
    field: 'fillUser',
    component: 'JSelectUser',
    componentProps:{
       isRadioSelection:true,
        labelKey: 'realname',
        rowKey: 'id',
     },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];



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