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',
    width:200
   },
   {
    title: '编码',
    align:"center",
    dataIndex: 'code',
    width:100
   },
   {
    title: '是否内置',
    align:"center",
    dataIndex: 'builtin',
    width:100,
    ifShow:false
   },
   {
    title: '顺序号',
    align:"center",
    dataIndex: 'ind',
    width:100
   }
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '编码',
    field: 'code',
    component: 'Input',
  },
  {
    label: '目录名称',
    field: 'name',
    component: 'Input',
  },
];

export const formSchema: FormSchema[] = [
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
  {
    label: '父节点',
    field: 'pid',
    required: true,
    component: 'TreeSelect',
    componentProps: {
      replaceFields: {
        value: 'key',
      },
      dropdownStyle: {
        maxHeight: '50vh',
      },
      getPopupContainer: () => document.body,
    },
    show: ({ values }) => {
      return values.pid !== '0';
    },
    // dynamicDisabled: ({ values }) => {
    //   return !!values.id;
    // }
  },
  {
    label: '节点名称',
    field: 'name',
    required: true,
    component: 'Input',
  },
  {
    label: '编码',
    field: 'code',
    required: false,
    component: 'Input',
    show: false,
  },
  {
    label: '顺序号',
    field: 'ind',
    required: false,
    component: 'InputNumber',
  },
];



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