|
@@ -2,10 +2,11 @@ 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 } from 'antd';
|
|
|
+import { Form,Radio, Icon, Button, Input, Select, Spin, Table, Switch, message, DatePicker, Modal, Upload ,Checkbox} from 'antd';
|
|
|
import Newrole from "./newRole.jsx"
|
|
|
import './userMangagement.less'
|
|
|
-import {} from '../../../dataDic.js';
|
|
|
+import {roleResources} from '../../../dataDic.js';
|
|
|
+const CheckboxGroup = Checkbox.Group;
|
|
|
|
|
|
const Roles=Form.create()(React.createClass({
|
|
|
loadData(pageNo) {
|
|
@@ -93,11 +94,97 @@ const Roles=Form.create()(React.createClass({
|
|
|
title: '创建时间',
|
|
|
dataIndex: 'createTime',
|
|
|
key: 'createTime',
|
|
|
- }
|
|
|
+ },{
|
|
|
+ title: '离职转交配置',
|
|
|
+ dataIndex: 'ee',
|
|
|
+ key: 'ee',
|
|
|
+ render: (text, record, index) => {
|
|
|
+ return <div>
|
|
|
+ <Button onClick={(e) =>{ e.stopPropagation(), this.visit(record)}} type="primary">离职转交配置</Button>
|
|
|
+ </div>
|
|
|
+ }
|
|
|
+ },
|
|
|
],
|
|
|
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<data.data.length;i++){
|
|
|
+ resourcesData.push(data.data[i].resources.toString())
|
|
|
+ }
|
|
|
+ this.setState({
|
|
|
+ loading: false,
|
|
|
+ resources:resourcesData
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ message.warning(data.error[0].message);
|
|
|
+ };
|
|
|
+
|
|
|
+ }.bind(this));
|
|
|
+ },
|
|
|
+ //点击离职资源配置保存
|
|
|
+ resourcesSubmit(e) {
|
|
|
+ e.preventDefault();
|
|
|
+ this.setState({
|
|
|
+ selectedRowKeys: [],
|
|
|
+ loading: true
|
|
|
+ });
|
|
|
+ $.ajax({
|
|
|
+ method: "POST",
|
|
|
+ dataType: "json",
|
|
|
+ crossDomain: false,
|
|
|
+ url: globalConfig.context + "/api/admin/role/addResources",
|
|
|
+ data: {
|
|
|
+ rid:this.state.rid,
|
|
|
+ resources:this.state.resources.join(","),
|
|
|
+
|
|
|
+ }
|
|
|
+ }).done(function (data) {
|
|
|
+ if (!data.error.length) {
|
|
|
+ message.success('配置成功!');
|
|
|
+ this.setState({
|
|
|
+ loading: false,
|
|
|
+ visible2: false
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ message.warning(data.error[0].message);
|
|
|
+ };
|
|
|
+
|
|
|
+ }.bind(this));
|
|
|
+ },
|
|
|
componentWillMount() {
|
|
|
this.loadData();
|
|
|
},
|
|
@@ -180,6 +267,7 @@ const Roles=Form.create()(React.createClass({
|
|
|
},
|
|
|
};
|
|
|
const hasSelected = this.state.selectedRowKeys.length > 0;
|
|
|
+ const FormItem = Form.Item
|
|
|
return (
|
|
|
<div className="user-content" >
|
|
|
<div className="content-title">
|
|
@@ -209,6 +297,38 @@ const Roles=Form.create()(React.createClass({
|
|
|
showDesc={this.state.showDesc}
|
|
|
closeDesc={this.closeDesc} />
|
|
|
</div >
|
|
|
+ <div className="patent-desc">
|
|
|
+ <Modal maskClosable={false} visible={this.state.visible2}
|
|
|
+ onOk={this.checkResources} onCancel={this.handleCancel2}
|
|
|
+ width='600px'
|
|
|
+ title='离职转交配置'
|
|
|
+ footer=''
|
|
|
+ className="admin-desc-content">
|
|
|
+ <Form horizontal onSubmit={this.resourcesSubmit} id="add-form">
|
|
|
+ <Spin spinning={this.state.loading}>
|
|
|
+ <FormItem
|
|
|
+ labelCol={{ span: 10 }}
|
|
|
+ wrapperCol={{ span: 4 }}
|
|
|
+ label="角色名称"
|
|
|
+ >
|
|
|
+ {this.state.name}
|
|
|
+ </FormItem>
|
|
|
+ <FormItem
|
|
|
+ labelCol={{ span: 10 }}
|
|
|
+ wrapperCol={{ span: 4 }}
|
|
|
+ label="请选择离职转交配置"
|
|
|
+ >
|
|
|
+ <CheckboxGroup options={roleResources} value={this.state.resources} onChange={(e)=>{this.setState({resources:e})}} />
|
|
|
+
|
|
|
+ </FormItem>
|
|
|
+ <FormItem wrapperCol={{ span: 12, offset: 7 }}>
|
|
|
+ <Button className="set-submit" type="primary" htmlType="submit">保存</Button>
|
|
|
+ <Button className="set-submit" type="ghost" onClick={this.handleCancel2} style={{marginLeft:'100px'}}>取消</Button>
|
|
|
+ </FormItem>
|
|
|
+ </Spin>
|
|
|
+ </Form >
|
|
|
+ </Modal>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
);
|
|
|
}
|