import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { RoleEnum } from '/@/enums/roleEnum';
import { serviceTags, checkStatus } from '../sysDic'

export enum KeysTypeEnum {
  DISABLED = 'disabled',
  ENABLED = 'enabled',
}

export const RoleMenuDictEnum: Recordable<{ key: string; keyType: KeysTypeEnum }> = {
  [RoleEnum.PLATFORM_ADMIN]: { key: 'enabled_platform_admin_auth', keyType: KeysTypeEnum.ENABLED },
  [RoleEnum.SYS_ADMIN]: { key: 'enabled_sysadmin_auth', keyType: KeysTypeEnum.ENABLED },
  [RoleEnum.TENANT_ADMIN]: { key: 'disabled_tenant_auth', keyType: KeysTypeEnum.DISABLED },
  [RoleEnum.CUSTOMER_USER]: { key: 'disabled_tenant_auth', keyType: KeysTypeEnum.DISABLED },
};

/**
 * 查询条件
*/
export const searchFormSchema: FormSchema[] = [
  {
    field: 'tagValue',
    label: '资源标签',
    component: 'Select',
    componentProps: {
      options: serviceTags,
    },
    colProps: { span: 5 },
  },
  {
    field: 'filterValue',
    label: '资源名称',
    component: 'Input',
    colProps: { span: 5 },
    componentProps: {
      maxLength: 255,
    },
  },
  {
    field: 'status',
    label: '审核状态',
    component: 'Select',
    componentProps: {
      options: checkStatus,
    },
    colProps: { span: 5 },
  },
];

/**
 * 列表显示信息
*/
export const columns: BasicColumn[] = [
  {
    title: '资源编号',
    dataIndex: 'serviceid',
    width: 120,
    align: 'left'
  },
  {
    title: '资源名称',
    dataIndex: 'servicename',
    width: 160,
    align: 'left'
  },
  {
    title: '坐标系名称',
    dataIndex: 'crs',
    width: 140,
    align: 'left'
  },
  // {
  //   title: '资源标签',
  //   dataIndex: 'service',
  //   width: 120,
  // },
  {
    title: '资源标签',
    dataIndex: 'keywords',
    slots: { customRender: 'keywords' },
    width: 200,
  },
  {
    title: '发布人',
    dataIndex: 'publisher',
    width: 100,
    align: 'left'
  },
  // {
  //   title: '发布时间',
  //   dataIndex: 'publishdate',
  //   width: 90,
  //   slots: { customRender: 'pdate' },
  // },
  {
    title: '当前环节',
    dataIndex: 'nodename',
    width: 90,
    slots: { customRender: 'nodename' },
    align: 'left'
  },
  {
    title: '当前处理人',
    dataIndex: 'checkname',
    width: 100,
    slots: { customRender: 'checkname' },
    align: 'left'
  },
  {
    title: '审核状态',
    dataIndex: 'status',
    width: 110,
    slots: { customRender: 'status' },
    align: 'left'
  },
  {
    title: '审核时间',
    dataIndex: 'checktime',
    width: 160,
    slots: { customRender: 'checktime' },
    align: 'left'
  },
];



/**
 * 表单
*/
export const formSchema: FormSchema[] = [
  {
    field: 'groupName',
    label: '角色名称',
    required: true,
    component: 'Input',
    componentProps: {
      maxLength: 255,
      placeholder: '请输入角色名称',
    },
  },
  {
    label: '排序',
    field: 'sort',
    component: 'Input',
    componentProps: {
      maxLength: 255,
      placeholder: '请输入排序',
    },
  }
];
