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:"left",
    dataIndex: 'name'
   },
  //  {
  //   title: '应用系统编号',
  //   align:"center",
  //   dataIndex: 'code'
  //  },
   {
    title: '开始运行时间',
    align:"center",
    dataIndex: 'stDate',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
   {
    title: '运行状态',
    align:"center",
    dataIndex: 'sta',
    customRender: ({ text }) => {
      return render.renderDict(text, 'app_system_sta');
    },

   },
   {
    title: '负责人',
    align:"center",
    dataIndex: 'admin_dictText'
   },
   {
    title: '权重',
    align:"center",
    dataIndex: 'weight'
   },
   {
    title: '结束运行时间',
    align:"center",
    dataIndex: 'endDate',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
  //  {
  //   title: '说明',
  //   align:"center",
  //   dataIndex: 'des'
  //  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '应用系统名称',
    field: 'name',
    component: 'Input',
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '应用系统名称',
    field: 'name',
    required:true,
    component: 'Input',
  },
  // {
  //   label: '应用系统编号',
  //   field: 'code',
  //   required:true,
  //   component: 'Input',
  // },
  {
    label: '开始运行时间',
    field: 'stDate',
    component: 'DatePicker',
  },
  {
    label: '负责人',
    field: 'admin',
    component: 'JSelectUser',
    helpMessage: ['选择负责人'],
    
    componentProps:{
        labelKey:'realname',
        rowKey:'id'
    }
  },
  {
    label: '权重',
    field: 'weight',
    component: 'InputNumber',
    suffix:'%'
  },
  {
    label: '运行状态',
    field: 'sta',
    component: 'JDictSelectTag',
    defaultValue:1,
    componentProps: {
      dictCode: 'app_system_sta',
      stringToNumber: true,
      type: 'radio',
    },
  },
  {
    label: '结束运行时间',
    field: 'endDate',
    component: 'DatePicker',
  },
  {
    label: '说明',
    field: 'des',
    component: 'InputTextArea',
    componentProps: {
      rows: 5
    }
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];



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