| | |
| | | 'page.export':'Export', |
| | | 'page.selected':' has been selected', |
| | | 'page.delete.batch':'Batch Delete', |
| | | 'page.assigning':'Assigning', |
| | | 'page.assign.success':'Assignment Successful', |
| | | 'page.assign.fail':'Assignment failed, please try again!', |
| | | 'page.assign.permission':'Assign', |
| | | 'page.permission.menu':'Menu', |
| | | 'page.role.assign.ec':'Expand/Collapse', |
| | | 'page.role.assign.sd':'Select All/Deselect All', |
| | | '':'', |
| | | '':'', |
| | | '':'', |
| | | 'personal.base.setting':'Basic Settings', |
| | |
| | | return props.treeData; |
| | | }} |
| | | colProps={{ md: 12, xl: 12 }} |
| | | placeholder="请选择" |
| | | rules={[{ required: true, message: "上级部门不能为空" }]} |
| | | fieldProps={{ |
| | | treeDefaultExpandedKeys: [0] |
| | |
| | | name="name" |
| | | label="部门名称" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | placeholder="请输入" |
| | | rules={[{ required: true, message: "部门名称不能为空!" }]} |
| | | /> |
| | | </ProForm.Group> |
| | |
| | | name="leader" |
| | | label="负责人" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | placeholder="请输入" |
| | | /> |
| | | <ProFormDigit |
| | | name="sort" |
| | | label="排序" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | fieldProps={{ precision: 0 }} |
| | | placeholder="请输入" |
| | | /> |
| | | </ProForm.Group> |
| | | <ProForm.Group> |
| | |
| | | name="status" |
| | | label="状态" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | placeholder="请选择" |
| | | options={[ |
| | | { label: '正常', value: 1 }, |
| | | { label: '禁用', value: 0 }, |
| | |
| | | name="memo" |
| | | label=" 备注" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | placeholder="请输入" |
| | | /> |
| | | </ProForm.Group> |
| | | |
| | |
| | | return props.treeData; |
| | | }} |
| | | colProps={{ md: 12, xl: 12 }} |
| | | placeholder="请选择" |
| | | rules={[{ required: true, message: "上级菜单不能为空" }]} |
| | | fieldProps={{ |
| | | treeDefaultExpandedKeys: [0] |
| | |
| | | name="name" |
| | | label="菜单名称" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | placeholder="请输入" |
| | | rules={[{ required: true, message: "菜单名称不能为空!" }]} |
| | | /> |
| | | </ProForm.Group> |
| | |
| | | name="route" |
| | | label="路由地址" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | placeholder="请输入" |
| | | /> |
| | | <ProFormText |
| | | name="component" |
| | | label="页面组件" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | placeholder="请输入" |
| | | /> |
| | | </ProForm.Group> |
| | | <ProForm.Group> |
| | |
| | | name="type" |
| | | label="类型" |
| | | colProps={{ md: 10, xl: 610 }} |
| | | placeholder="请选择" |
| | | options={[ |
| | | { label: '菜单', value: 0 }, |
| | | { label: '按钮', value: 1 }, |
| | |
| | | label="权限标识" |
| | | hidden={menuType !== 1} |
| | | colProps={{ md: 12, xl: 12 }} |
| | | placeholder="请输入" |
| | | /> |
| | | <ProFormSelect |
| | | name="icon" |
| | | label="菜单图标" |
| | | hidden={menuType !== 0} |
| | | colProps={{ md: 12, xl: 12 }} |
| | | placeholder="请输入" |
| | | valueEnum={{}} |
| | | addonBefore={createIcon(menuIconName)} |
| | | fieldProps={{ |
| | |
| | | label="排序" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | fieldProps={{ precision: 0 }} |
| | | placeholder="请输入" |
| | | /> |
| | | <ProFormSelect |
| | | name="status" |
| | | label="状态" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | placeholder="请选择" |
| | | options={[ |
| | | { label: '正常', value: 1 }, |
| | | { label: '禁用', value: 0 }, |
| | |
| | | return ( |
| | | <> |
| | | <Modal |
| | | title="Edit" |
| | | title={ |
| | | Object.keys(props.values).length > 0 |
| | | ? intl.formatMessage({ id: 'page.edit', defaultMessage: '编辑' }) |
| | | : intl.formatMessage({ id: 'page.add', defaultMessage: '添加' }) |
| | | } |
| | | width={640} |
| | | forceRender |
| | | destroyOnClose |
| | |
| | | name="name" |
| | | label="角色名称" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | placeholder="请输入" |
| | | rules={[{ required: true, message: "请输入角色名称!" }]} |
| | | /> |
| | | <ProFormText |
| | | name="code" |
| | | label="角色标识" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | placeholder="请输入" |
| | | rules={[{ required: true, message: "请输入角色标识!" }]} |
| | | /> |
| | | </ProForm.Group> |
| | |
| | | name="memo" |
| | | label="备注" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | placeholder="请输入" |
| | | /> |
| | | </ProForm.Group> |
| | | </ProForm> |
| | |
| | | return ( |
| | | <> |
| | | <Drawer |
| | | title={`分配权限 - ${name ? name : '-'}`} |
| | | title={`${intl.formatMessage({ id: 'page.assign.permission', defaultMessage: '分配权限' })} - ${name ? name : '-'}`} |
| | | width={640} |
| | | forceRender |
| | | destroyOnClose |
| | |
| | | |
| | | <ProForm.Item |
| | | name="deptIds" |
| | | label="权限菜单" |
| | | label={intl.formatMessage({ id: 'page.permission.menu', defaultMessage: '权限菜单' })} |
| | | colProps={{ md: 24, xl: 24 }} |
| | | > |
| | | <Row gutter={[16, 16]}> |
| | | <Col md={24}> |
| | | <Checkbox.Group |
| | | options={[ |
| | | { label: '展开/折叠', value: 'expandAll' }, |
| | | { label: '全选/全不选', value: 'checkAll' }, |
| | | { label: intl.formatMessage({ id: 'page.role.assign.ec', defaultMessage: '展开/折叠' }), value: 'expandAll' }, |
| | | { label: intl.formatMessage({ id: 'page.role.assign.sd', defaultMessage: '全选/全不选' }), value: 'checkAll' }, |
| | | ]} |
| | | defaultValue={['expandAll']} |
| | | onChange={(values) => { |
| | |
| | | const TABLE_KEY = "pro-table-role"; |
| | | |
| | | const handleSave = async (val, intl) => { |
| | | const hide = message.loading('正在添加'); |
| | | const hide = message.loading(intl.formatMessage({ id: 'page.adding', defaultMessage: '正在添加' })); |
| | | try { |
| | | const resp = await Http.doPost('api/role/save', val); |
| | | if (resp.code === 200) { |
| | | message.success('添加成功'); |
| | | message.success(intl.formatMessage({ id: 'page.add.success', defaultMessage: '添加成功' })); |
| | | return true; |
| | | } else { |
| | | message.error(resp.msg); |
| | | return false; |
| | | } |
| | | } catch (error) { |
| | | message.error('添加失败请重试!'); |
| | | message.error(intl.formatMessage({ id: 'page.add.fail', defaultMessage: '添加失败请重试!' })); |
| | | return false; |
| | | } finally { |
| | | hide(); |
| | |
| | | }; |
| | | |
| | | const handleUpdate = async (val, intl) => { |
| | | const hide = message.loading('正在更新'); |
| | | const hide = message.loading(intl.formatMessage({ id: 'page.updating', defaultMessage: '正在更新' })); |
| | | try { |
| | | const resp = await Http.doPost('api/role/update', val); |
| | | if (resp.code === 200) { |
| | | message.success('更新成功'); |
| | | message.success(intl.formatMessage({ id: 'page.update.success', defaultMessage: '更新成功' })); |
| | | return true; |
| | | } else { |
| | | message.error(resp.msg); |
| | | return false; |
| | | } |
| | | } catch (error) { |
| | | message.error('配置失败请重试!'); |
| | | message.error(intl.formatMessage({ id: 'page.update.fail', defaultMessage: '更新失败请重试!' })); |
| | | return false; |
| | | } finally { |
| | | hide(); |
| | |
| | | |
| | | const handleRemove = async (rows, intl) => { |
| | | if (!rows) return true; |
| | | const hide = message.loading('正在删除'); |
| | | const hide = message.loading(intl.formatMessage({ id: 'page.deleting', defaultMessage: '正在删除' })); |
| | | try { |
| | | const resp = await Http.doPost('api/role/remove/' + rows.map((row) => row.id).join(',')); |
| | | if (resp.code === 200) { |
| | | message.success('删除成功'); |
| | | message.success(intl.formatMessage({ id: 'page.delete.success', defaultMessage: '删除成功' })); |
| | | return true; |
| | | } else { |
| | | message.error(resp.msg); |
| | | return false; |
| | | } |
| | | } catch (error) { |
| | | message.error('删除失败,请重试'); |
| | | message.error(intl.formatMessage({ id: 'page.delete.fail', defaultMessage: '删除失败,请重试!' })); |
| | | return false; |
| | | } finally { |
| | | hide(); |
| | |
| | | }; |
| | | |
| | | const handleExport = async (intl) => { |
| | | const hide = message.loading('正在导出'); |
| | | const hide = message.loading(intl.formatMessage({ id: 'page.exporting', defaultMessage: '正在导出' })); |
| | | try { |
| | | const resp = await Http.doPostBlob('api/role/export'); |
| | | const blob = new Blob([resp], { type: 'application/vnd.ms-excel' }); |
| | | window.location.href = window.URL.createObjectURL(blob); |
| | | message.success('导出成功'); |
| | | message.success(intl.formatMessage({ id: 'page.export.success', defaultMessage: '导出成功' })); |
| | | return true; |
| | | } catch (error) { |
| | | message.error('导出失败,请重试'); |
| | | message.error(intl.formatMessage({ id: 'page.export.fail', defaultMessage: '导出失败,请重试' })); |
| | | return false; |
| | | } finally { |
| | | hide(); |
| | |
| | | }; |
| | | |
| | | const handleScope = async (val) => { |
| | | const hide = message.loading('正在分配'); |
| | | const hide = message.loading(intl.formatMessage({ id: 'page.assigning', defaultMessage: '正在分配' })); |
| | | try { |
| | | const resp = await Http.doPost('api/role/scope/update', val); |
| | | if (resp.code === 200) { |
| | | message.success('分配成功'); |
| | | message.success(intl.formatMessage({ id: 'page.assign.success', defaultMessage: '分配成功' })); |
| | | return true; |
| | | } else { |
| | | message.error(resp.msg); |
| | | return false; |
| | | } |
| | | } catch (error) { |
| | | message.error('分配失败请重试!'); |
| | | message.error(intl.formatMessage({ id: 'page.assign.fail', defaultMessage: '分配失败请重试!' })); |
| | | return false; |
| | | } finally { |
| | | hide(); |
| | |
| | | |
| | | const columns = [ |
| | | { |
| | | title: 'No', |
| | | title: intl.formatMessage({ |
| | | id: 'page.table.no', |
| | | defaultMessage: 'No' |
| | | }), |
| | | dataIndex: 'index', |
| | | valueType: 'indexBorder', |
| | | width: 60, |
| | |
| | | setCurrentRow(record); |
| | | }} |
| | | > |
| | | 编辑 |
| | | <FormattedMessage id='page.edit' defaultMessage='编辑' /> |
| | | </Button>, |
| | | <Button |
| | | type="link" |
| | |
| | | }); |
| | | }} |
| | | > |
| | | 分配权限 |
| | | <FormattedMessage id='page.assign.permission' defaultMessage='分配权限' /> |
| | | </Button>, |
| | | <Button |
| | | type="link" |
| | |
| | | key="batchRemove" |
| | | onClick={async () => { |
| | | Modal.confirm({ |
| | | title: '删除', |
| | | content: '确定删除该项吗?', |
| | | title: intl.formatMessage({ id: 'page.delete', defaultMessage: '删除' }), |
| | | content: intl.formatMessage({ id: 'page.delete.confirm', defaultMessage: '确定删除该项吗?' }), |
| | | onOk: async () => { |
| | | const success = await handleRemove([record], intl); |
| | | if (success) { |
| | |
| | | }); |
| | | }} |
| | | > |
| | | 删除 |
| | | <FormattedMessage id='page.delete' defaultMessage='删除' /> |
| | | </Button>, |
| | | ], |
| | | }, |
| | |
| | | }} |
| | | > |
| | | <PlusOutlined /> |
| | | 添加 |
| | | <FormattedMessage id='page.add' defaultMessage='添加' /> |
| | | </Button>, |
| | | <Button |
| | | key="export" |
| | |
| | | }} |
| | | > |
| | | <ExportOutlined /> |
| | | 导出 |
| | | <FormattedMessage id='page.export' defaultMessage='导出' /> |
| | | </Button>, |
| | | ], |
| | | }} |
| | |
| | | <FooterToolbar |
| | | extra={ |
| | | <div> |
| | | 已选择 |
| | | <a style={{ fontWeight: 600 }}>{selectedRows.length}</a> |
| | | 项 |
| | | <FormattedMessage id='page.selected' defaultMessage=' 项已选择' /> |
| | | </div> |
| | | } |
| | | > |
| | |
| | | danger |
| | | onClick={async () => { |
| | | Modal.confirm({ |
| | | title: '删除', |
| | | content: '确定删除该项吗?', |
| | | title: intl.formatMessage({ id: 'page.delete', defaultMessage: '删除' }), |
| | | content: intl.formatMessage({ id: 'page.delete.confirm', defaultMessage: '确定删除该项吗?' }), |
| | | onOk: async () => { |
| | | const success = await handleRemove(selectedRows, intl); |
| | | if (success) { |
| | |
| | | }); |
| | | }} |
| | | > |
| | | 批量删除 |
| | | <FormattedMessage id='page.delete.batch' defaultMessage='批量删除' /> |
| | | </Button> |
| | | </FooterToolbar> |
| | | )} |