| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391 | 
							- 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 Newuser from "./newUser.jsx"
 
- import './userMangagement.less'
 
- import {techAuditStatusList, station,post } from '../../../dataDic.js';
 
- const User=Form.create()(React.createClass({
 
- 	loadData(pageNo) {
 
-         this.state.data = [];
 
-         this.setState({
 
-             loading: true
 
-         });
 
-         $.ajax({
 
-             method: "get",
 
-             dataType: "json",
 
-             crossDomain: false,
 
-             url: globalConfig.context + '/api/admin/supervise/adminLi',
 
-             data: {
 
-                 pageNo: pageNo || 1,
 
-                 pageSize: this.state.pagination.pageSize,
 
-                 userName:this.state.userNameSearch,
 
- 				organization:this.state.organizationSearch,
 
- 				role:this.state.rolesSearch,
 
- 				post:this.state.postSearch,
 
- 				station:this.state.stationSearch,
 
- 				status:this.state.statusSeach,
 
- 				signName:this.state.signNameSearch,
 
- 				mobile:this.state.mobileSearch,
 
- 				proName:this.state.proNameSearch
 
-             },
 
-             success: function (data) {
 
-                 let theArr = [];
 
-                 if (!data.data || !data.data.list) {
 
-                     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,
 
-                             mobile: thisdata.mobile,
 
-                             name: thisdata.name,
 
-                             email: thisdata.email,
 
-                             createTime: thisdata.createTime,
 
-                             number: thisdata.number,
 
-                             province: thisdata.province,
 
-                             position: thisdata.position,
 
-                             superior: thisdata.superior,
 
-                             superiorId: thisdata.superiorId,
 
-                             createTimeFormattedDate: thisdata.createTimeFormattedDate
 
-                         });
 
-                     }; 
 
-                     this.state.pagination.current = data.data.pageNo?data.data.pageNo:'0';
 
-                     this.state.pagination.total = data.data.totalCount?data.data.totalCount:'0';
 
-                 };
 
-                 this.setState({
 
-                     dataSource: theArr,
 
-                     pagination: this.state.pagination
 
-                 });
 
-             }.bind(this),
 
-         }).always(function () {
 
-             this.setState({
 
-                 loading: false
 
-             });
 
-         }.bind(this));
 
-     },
 
-     getInitialState() {
 
-         return {
 
-         	datauser:{},
 
-             searchMore: true,
 
-             selectedRowKeys: [],
 
-             selectedRows: [],
 
-             loading: false,
 
-             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: 'key',
 
-                     key: 'key',
 
-                 }, {
 
-                     title: '登录用户名',
 
-                     dataIndex: 'name',
 
-                     key: 'name',
 
-                 }, {
 
-                     title: '角色',
 
-                     dataIndex: 'email',
 
-                     key: 'email',
 
-                 }, {
 
-                     title: '用户姓名',
 
-                     dataIndex: 'createTime',
 
-                     key: 'createTime',
 
-                 }, {
 
-                     title: '组织机构',
 
-                     dataIndex: 'number',
 
-                     key: 'number',
 
-                 }, {
 
-                     title: '职务',
 
-                     dataIndex: 'auditStatus',
 
-                     key: 'auditStatus',
 
-                 }, 
 
-                 {
 
-                     title: '岗位',
 
-                     dataIndex: 'boutique',
 
-                     key: 'boutique',
 
-                 },
 
-                 
 
-                 {
 
-                     title: '上级主管姓名',
 
-                     dataIndex: 'province',
 
-                     key: 'province',
 
-                 },
 
-                 {
 
-                     title: '状态',
 
-                     dataIndex: 'a',
 
-                     key: 'a',
 
-                 }
 
-             ],
 
-             dataSource: [],
 
-         };
 
-     },
 
-     componentWillMount() {
 
-         let organizationArr = [];
 
-         techAuditStatusList.map(function (item) {
 
-             organizationArr.push(
 
-                 <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
 
-             )
 
-         });
 
-         this.state.organizationList = organizationArr;
 
-         this.loadData();
 
-     },
 
-     tableRowClick(record, index) {
 
-     	this.state.userDetaile=true;
 
-         this.state.datauser = record;
 
-         this.setState({
 
-             showDesc: true
 
-         });
 
-     },
 
-     //锁定
 
-     locking() {
 
-         let deletedIds = [];
 
-         for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
 
-             let rowItem = this.state.selectedRows[idx];
 
-             if (rowItem.id) {
 
-                 deletedIds.push(rowItem.id)
 
-             };
 
-         };
 
-         this.setState({
 
-             selectedRowKeys: [],
 
-             loading: true
 
-         });
 
-         $.ajax({
 
-             method: "POST",
 
-             dataType: "json",
 
-             crossDomain: false,
 
-             url: globalConfig.context + "/api/admin/achievement/delete",
 
-             data: {
 
-                 ids: deletedIds
 
-             }
 
-         }).done(function (data) {
 
-             if (!data.error.length) {
 
-                 message.success('锁定成功!');
 
-                 this.setState({
 
-                     loading: false,
 
-                 });
 
-             } else {
 
-                 message.warning(data.error[0].message);
 
-             };
 
-             this.loadData();
 
-         }.bind(this));
 
-     },
 
-     //激活
 
-     activation() {
 
-         let deletedIds = [];
 
-         for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
 
-             let rowItem = this.state.selectedRows[idx];
 
-             if (rowItem.id) {
 
-                 deletedIds.push(rowItem.id)
 
-             };
 
-         };
 
-         this.setState({
 
-             selectedRowKeys: [],
 
-             loading: true
 
-         });
 
-         $.ajax({
 
-             method: "POST",
 
-             dataType: "json",
 
-             crossDomain: false,
 
-             url: globalConfig.context + "/api/admin/achievement/delete",
 
-             data: {
 
-                 ids: deletedIds
 
-             }
 
-         }).done(function (data) {
 
-             if (!data.error.length) {
 
-                 message.success('激活成功!');
 
-                 this.setState({
 
-                     loading: false,
 
-                 });
 
-             } else {
 
-                 message.warning(data.error[0].message);
 
-             };
 
-             this.loadData();
 
-         }.bind(this));
 
-     },
 
-     //删除
 
-     delectRow() {
 
-         let deletedIds = [];
 
-         for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
 
-             let rowItem = this.state.selectedRows[idx];
 
-             if (rowItem.id) {
 
-                 deletedIds.push(rowItem.id)
 
-             };
 
-         };
 
-         this.setState({
 
-             selectedRowKeys: [],
 
-             loading: true
 
-         });
 
-         $.ajax({
 
-             method: "POST",
 
-             dataType: "json",
 
-             crossDomain: false,
 
-             url: globalConfig.context + "/api/admin/achievement/delete",
 
-             data: {
 
-                 ids: deletedIds
 
-             }
 
-         }).done(function (data) {
 
-             if (!data.error.length) {
 
-                 message.success('删除成功!');
 
-                 this.setState({
 
-                     loading: false,
 
-                 });
 
-             } else {
 
-                 message.warning(data.error[0].message);
 
-             };
 
-             this.loadData();
 
-         }.bind(this));
 
-     },
 
-     addClick() {
 
-     	this.state.userDetaile=false;
 
-         this.setState({
 
-             showDesc: true
 
-         });
 
-     },
 
-     closeDesc(e, s) {
 
-         this.state.showDesc = e;
 
-         if (s) {
 
-             this.loadData();
 
-         };
 
-     },
 
-     search() {
 
-         this.loadData();
 
-     },
 
-     reset() {
 
-     	this.state.userNameSearch='';
 
- 		this.state.organizationSearch=undefined;
 
- 		this.state.rolesSearch=undefined;
 
- 		this.state.postSearch=undefined;
 
- 		this.state.stationSearch=undefined;
 
- 		this.state.statusSeach=undefined;
 
- 		this.state.signNameSearch='';
 
- 		this.state.mobileSearch='';
 
- 		this.state.proNameSearch='';
 
-         this.loadData();       
 
-     },
 
-     searchSwitch() {
 
-         this.setState({
 
-             searchMore: !this.state.searchMore
 
-         });
 
-     },
 
-     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 { RangePicker } = DatePicker;
 
-         return (
 
-             <div className="user-content" >
 
-                 <div className="content-title">
 
- 	                <div className="user-search">
 
- 	                    <Input placeholder="用户姓名" style={{width:'150px'}}
 
- 	                        value={this.state.userNameSearch}
 
- 	                        onChange={(e) => { this.setState({ userNameSearch: e.target.value }); }} />
 
- 	                    <Select placeholder="组织机构"
 
-                             style={{ width: 160 }}
 
-                             value={this.state.organizationSearch}
 
-                             onChange={(e) => { this.setState({ organizationSearch: e }) }}>
 
-                             {this.state.organizationList}
 
-                         </Select>
 
-                         <Select placeholder="角色"
 
-                             style={{ width: 160 }}
 
-                             value={this.state.rolesSearch}
 
-                             onChange={(e) => { this.setState({ rolesSearch: e }) }}>
 
-                             {this.state.organizationList}
 
-                         </Select>    
 
- 	                    <Button type="primary" onClick={this.search}>搜索</Button>
 
- 	                    <Button onClick={this.reset}>重置</Button>
 
- 	                    <Button style={{ background: "red", border: "none", color: "#fff" }}
 
- 	                        disabled={!hasSelected}
 
- 	                        onClick={this.delectRow}>删除<Icon type="minus" /></Button>
 
- 	                    <Button style={{ background: "#333333", border: "none", color: "#fff" }}
 
- 	                        disabled={!hasSelected}
 
- 	                        onClick={this.locking}>锁定<Icon type="lock" /></Button>
 
- 	                    <Button style={{ background: "green", border: "none", color: "#fff" }}
 
- 	                        disabled={!hasSelected}
 
- 	                        onClick={this.activation}>激活<Icon type="unlock" /></Button>
 
- 	                    
 
- 	                    <span>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
 
- 	                    <Button type="primary" className="addButton" onClick={this.addClick} >新增用户<Icon type="user" /></Button>
 
- 	                    <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
 
- 	                    	<Select placeholder="职务"
 
- 	                            style={{ width: 160 }}
 
- 	                            value={this.state.postSearch}
 
- 	                            onChange={(e) => { this.setState({ postSearch: e }) }}>
 
- 	                            {
 
-                                     post.map(function (item) {
 
-                                         return <Select.Option key={item.value} >{item.key}</Select.Option>
 
-                                     })
 
-                                 }
 
-                             </Select>
 
-                             <Select placeholder="岗位"
 
- 	                            style={{ width: 160 }}
 
- 	                            value={this.state.stationSearch}
 
- 	                            onChange={(e) => { this.setState({ stationSearch: e }) }}>
 
- 	                             {
 
-                                     station.map(function (item) {
 
-                                         return <Select.Option key={item.value} >{item.key}</Select.Option>
 
-                                     })
 
-                                 }
 
-                        		</Select>
 
-                        		<Select placeholder="状态"
 
- 	                            style={{ width: 160 }}
 
- 	                            value={this.state.statusSeach}
 
- 	                            onChange={(e) => { this.setState({ statusSeach: e }) }}>
 
- 	                            {this.state.organizationList}
 
-                        		</Select>
 
-                        		<Input placeholder="登录用户名" style={{width:'150px'}}
 
- 		                        value={this.state.signNameSearch}
 
- 		                        onChange={(e) => { this.setState({ signNameSearch: e.target.value }); }} />
 
- 	                        <Input placeholder="上级主管名称" style={{width:'150px'}}
 
- 		                        value={this.state.proNameSearch}
 
- 		                        onChange={(e) => { this.setState({ proNameSearch: e.target.value }); }} />
 
- 	                    </div>
 
- 	                </div>
 
- 	                <div className="patent-table">
 
- 	                    <Spin spinning={this.state.loading}>
 
- 	                        <Table columns={this.state.columns}
 
- 	                            dataSource={this.state.dataSource}
 
- 	                            rowSelection={rowSelection}
 
- 	                            pagination={this.state.pagination}
 
- 	                            onRowClick={this.tableRowClick} />
 
- 	                    </Spin>
 
- 	                </div>
 
- 	                <Newuser
 
- 	                    userDetaile={this.state.userDetaile}
 
- 	                    datauser={this.state.datauser}
 
- 	                    showDesc={this.state.showDesc}
 
- 	                    closeDesc={this.closeDesc} />
 
- 	            </div >
 
-             </div>
 
-         );
 
-     }
 
- }));
 
- export default User;
 
 
  |