import React from 'react'; import ReactDom from 'react-dom'; import ajax from 'jquery/src/ajax/xhr.js'; import $ from 'jquery/src/ajax'; import { Form,Radio, Icon, Button, Input, Select, Spin, Table, Switch, message, DatePicker, Modal, Upload ,Checkbox,Tabs} from 'antd'; import Newrole from "./newRole.jsx" import './userMangagement.less' import {roleResources} from '../../../dataDic.js'; import {ChooseList} from "../../order/orderNew/chooseList"; const CheckboxGroup = Checkbox.Group; const {TabPane} = Tabs const Roles=Form.create()(React.createClass({ loadData(pageNo) { this.state.data = []; this.setState({ loading: true }); $.ajax({ method: "post", dataType: "json", crossDomain: false, url: globalConfig.context + '/api/admin/roles', data: { pageNo: pageNo || 1, pageSize: this.state.pagination.pageSize, roleName:this.state.roleNameSearch, }, success: function (data) { let theArr = []; if (!data.data) { if (data.error && data.error.length) { message.warning(data.error[0].message); }; } else { for (let i = 0; i < data.data.list.length; i++) { let thisdata = data.data.list[i]; theArr.push({ key: i, id: thisdata.id, roleName: thisdata.roleName, creater:thisdata.creater, createTime:thisdata.createTimez, }); }; this.setState({ page: data.data.pageNo }) this.state.pagination.current = data.data.pageNo; this.state.pagination.total = data.data.totalCount; }; if(!data.data.list.length){ this.state.pagination.current=0 this.state.pagination.total=0 } this.setState({ dataSource: theArr, pagination: this.state.pagination, selectedRowKeys:[] }); }.bind(this), }).always(function () { this.setState({ loading: false }); }.bind(this)); }, getInitialState() { return { datauser:{}, selectedRowKeys: [], selectedRows: [], loading: false, page: 1, pagination: { defaultCurrent: 1, defaultPageSize: 10, showQuickJumper: true, pageSize: 10, onChange: function (page) { this.loadData(page); }.bind(this), showTotal: function (total) { return '共' + total + '条数据'; } }, columns: [ { title: '角色名称', dataIndex: 'roleName', key: 'roleName', width:'300px' }, { title: '创建人', dataIndex: 'creater', key: 'creater', width:'300px' }, { title: '创建时间', dataIndex: 'createTime', key: 'createTime', },{ title: '离职转交配置', dataIndex: 'ee', key: 'ee', render: (text, record, index) => { return
} }, ], dataSource: [], }; }, //进入离职权限配置 visit(record) { let rid=record.id; this.state.resources=undefined; this.setState({ visible2: true, rid:record.id, name:record.roleName, }); this.resourcesDetail(rid); }, //关闭离职配置 handleCancel2(){ this.setState({ visible2: false }); }, //点击离职资源配置保存 resourcesDetail(rid) { this.setState({ selectedRowKeys: [], loading: true, }); $.ajax({ method: "POST", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/role/ResourcesDetail", data: { rid:rid, } }).done(function (data) { if (!data.error.length) { let resourcesData=[]; for(let i=0;i { arr.forEach(val => { if (val === item.title) { newArr.push(item); } }); }); this.setState({ changeList: newArr }); }, render() { const rowSelection = { selectedRowKeys: this.state.selectedRowKeys, onChange: (selectedRowKeys, selectedRows) => { this.setState({ selectedRows: selectedRows.slice(-1), selectedRowKeys: selectedRowKeys.slice(-1) }); }, onSelectAll: (selected, selectedRows, changeRows) => { this.setState({ selectedRowKeys:[] }) }, }; const hasSelected = this.state.selectedRowKeys.length > 0; const FormItem = Form.Item return (
{ this.setState({ roleNameSearch: e.target.value }); }} />
{this.state.name} {this.setState({resources:e})}} />
); } })); export default Roles;