import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import {getAllqueryall} from './WbEmp.api';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '工号',
    align:"center",
    sorter: true,
    width: 80,
    dataIndex: 'workNo'
   },
   {
    title: '姓名',
    align:"center",
    sorter: true,
    width: 100,
    dataIndex: 'username'
   },
   {
    title: '岗位名称',
    align:"center",
    width: 100,
    dataIndex: 'post'
   },
   {
    title: '所属外包商',
    align:"center",
    sorter: true,
    width: 250,
    dataIndex: 'orgName'
   },
   {
    title: '在岗状态',
    align:"center",
    sorter: true,
    dataIndex: 'postStatus'
   },
   {
    title: '入场日期',
    align:"center",
    sorter: true,
    dataIndex: 'inDay'
   },
   {
    title: '退场日期',
    align:"center",
    sorter: true,
    dataIndex: 'outDay'
   },
   {
    title: '退场原因',
    align:"center",
    dataIndex: 'remark',
    ellipsis:true
    
   },
   /**
   {
    title: '入场日期',
    align:"center",
    dataIndex: 'inTime',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
   {
    title: '退场日期',
    align:"center",
    dataIndex: 'outTime',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
   {
    title: '岗位编码',
    align:"center",
    dataIndex: 'postCode'
   },
   {
    title: '所属外包商编码',
    align:"center",
    dataIndex: 'orgCode'
   },
   */
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "工号",
      field: 'workNo',
      component: 'Input',
      colProps: {span: 6},
 	},
	{
      label: "姓名",
      field: 'username',
      component: 'Input',
      colProps: {span: 6},
 	},
  
	{
      label: "外包商名称",
      field: 'orgName',
      component: 'ApiSelect',
      componentProps: {
      mode: 'multiple',
      api: getAllqueryall,
      labelField: 'orgName',
      valueField: 'orgName',
    },
 	},
   
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '工号',
    field: 'workNo',
    component: 'Input',
  },
  {
    label: '姓名',
    field: 'username',
    component: 'Input',
  },
  {
    label: '岗位名称',
    field: 'post',
    component: 'Input',
  },
  {
    label: '所属外包商',
    field: 'orgName',
    component: 'Input',
  },
  {
    label: '在岗状态',
    field: 'postStatus',
    component: 'Input',
  },
  {
    label: '入场日期',
    field: 'inDay',
    component: 'Input',
  },
  {
    label: '退场日期',
    field: 'outDay',
    component: 'Input',
  },
  {
    label: '退场原因',
    field: 'remark',
    component: 'InputTextArea',
  },
  /**
  {
    label: '入场日期',
    field: 'inTime',
    component: 'DatePicker',
  },
  {
    label: '退场日期',
    field: 'outTime',
    component: 'DatePicker',
  },
  {
    label: '岗位编码',
    field: 'postCode',
    component: 'Input',
  },
  {
    label: '所属外包商编码',
    field: 'orgCode',
    component: 'Input',
  },
  */
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];



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