From 590a8198e9fcb503aaeb04f6d550c65bf30c0566 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 11 三月 2020 18:01:06 +0800 Subject: [PATCH] 2020-03-11 --- src/tabviews/rolemanage/index.jsx | 91 ++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 84 insertions(+), 7 deletions(-) diff --git a/src/tabviews/rolemanage/index.jsx b/src/tabviews/rolemanage/index.jsx index 6f1619b..91b720c 100644 --- a/src/tabviews/rolemanage/index.jsx +++ b/src/tabviews/rolemanage/index.jsx @@ -1,11 +1,14 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Card, Col, Row, Icon } from 'antd' -// import Api from '@/api' +import { Card, Col, Row, Icon, Menu, notification, Spin, Input } from 'antd' + +import Api from '@/api' import zhCN from '@/locales/zh-CN/role.js' import enUS from '@/locales/en-US/role.js' import './index.scss' + +const { Search } = Input export default class RoleManage extends Component { static propTpyes = { @@ -14,11 +17,61 @@ } state = { - dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS + dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, + loadingview: true, + roleList: null, + primarykey: '' + } + + getRoleList = async () => { + let param = { + func: 's_rolemenu_get_list' + } + let result = await Api.getSystemConfig(param) + + if (result.status) { + this.setState({ + roleList: result.data + }) + } else { + this.setState({ + loadingview: false + }) + notification.warning({ + top: 92, + message: result.message, + duration: 10 + }) + } + } + + getMenuList = async () => { + let param = { + func: 's_rolemenu_get_FstMenu' + } + let result = await Api.getSystemConfig(param) + + if (result.status) { + + } else { + this.setState({ + loadingview: false + }) + notification.warning({ + top: 92, + message: result.message, + duration: 10 + }) + } + } + + changeRole = () => { + } UNSAFE_componentWillMount () { - + this.getRoleList() + this.getMenuList() } shouldComponentUpdate (nextProps, nextState) { @@ -26,14 +79,38 @@ } render() { + const { roleList, loadingview, primarykey } = this.state + + let _roleList = [] + + if (roleList && roleList.length > 0) { + _roleList = roleList.filter(role => role.RoleName.toLowerCase().indexOf(primarykey.toLowerCase()) >= 0) + } + return ( <div className="rolemanage"> + {loadingview && <Spin size="large" />} <Row gutter={16}> <Col span={6}> <Card - title={<span className="role-title"><Icon type="bank" /> {this.state.dict['role.title']}</span>} - bordered={false}> - Card content + className="role-list" + title={ + <span className="role-title"> + <Icon type="bank" /> + <span className="title">{this.state.dict['role.title']}</span> + <Search placeholder="" onSearch={value => this.setState({primarykey: value})} /> + </span> + } + bordered={false} + > + <Menu + onClick={this.handleClick} + mode="inline" + > + {_roleList.map((role, index) => + <Menu.Item key={index} onClick={() => this.changeRole(role)}>{role.RoleName}</Menu.Item> + )} + </Menu> </Card> </Col> <Col span={18}> -- Gitblit v1.8.0