import { Select, Tag } from 'antd' import { memo, useEffect, useState } from 'react' import LoaderPortal from '../../components/LoaderPortal' import { PermissionView } from '../../components/Views' import { invokeWebApiWrapperAsync } from '../../components/factory' import { EditableTable, makeActionHandler, makeColumn, makeSelectColumn } from '../../components/Table' import { AdminPermissionService, AdminUserRoleService } from '../../services/api' import { arrayOrDefault } from '../../utils' const PermissionTag = memo(({ permissions, value, onChange }) => { const [options, setOptions] = useState([]) useEffect(() => { setOptions(permissions.map((elm) => ({ key: Date.now(), value: `${elm.id}`, label: elm.name }))) }, [permissions]) console.log({ permissions, value }) const onSelectChange = (values) => { const arr = values.map((id) => permissions.find((elm) => `${elm.id}` === id)) onChange?.(arr) } const selectValue = value?.map((val) => `${val.id}`) return (