dengzhiguo 6 years ago
parent
commit
b5f441e296
1 changed files with 110 additions and 4 deletions
  1. 110 4
      js/component/manageCenter/set/userManagementS/user.jsx

+ 110 - 4
js/component/manageCenter/set/userManagementS/user.jsx

@@ -83,6 +83,80 @@ const User = Form.create()(React.createClass({
 			});
 		}.bind(this));
 	},
+	loadDatas(pageNo) {
+		this.state.data = [];
+		this.setState({
+			userDetaile:false,
+			loading: true,
+			page:pageNo
+		});
+		var admin=window.adminData.isSuperAdmin||'';
+		var departmentId=window.adminData.departmentId||'';
+		$.ajax({
+			method: "get",
+			dataType: "json",
+			crossDomain: false,
+			url: globalConfig.context + '/api/admin/superviser/adminList',
+			data: {
+				pageNo: pageNo || 1,
+				pageSize: this.state.paginations.pageSize,
+				name: this.state.userNameSearch,
+				departmentId: admin?this.state.organizationSearch:departmentId,
+				rid: this.state.rolesSearch,
+				duty: this.state.postSearch,
+				position: this.state.stationSearch,
+				status: this.state.statusSeach,
+				mobile: this.state.signNameSearch,
+				superiorId: this.state.theTypes
+			},
+			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,
+							province: thisdata.province,
+							position: thisdata.position,
+							superior: thisdata.superior, //上级名称
+							superiorId: thisdata.superiorId, //上级Id
+							duty: thisdata.duty, //职务
+							status: thisdata.status,
+							userNo: thisdata.userNo,
+							departmentName: thisdata.departmentName, //部门名称
+							departmentId: thisdata.departmentId, //部门id
+							roles:thisdata.roles[0],
+							rolesId:thisdata.rolesId
+						});
+					};
+					this.state.paginations.current = data.data.pageNo ? data.data.pageNo : '0';
+					this.state.paginations.total = data.data.totalCount ? data.data.totalCount : '0';
+				};
+				if(!data.data.list.length){
+					this.state.paginations.current=0
+					this.state.paginations.total=0
+				}
+				this.setState({
+					dataSourceData: theArr,
+					paginations: this.state.paginations,
+					selectedRowKeys:[]
+				});
+			}.bind(this),
+		}).always(function() {
+			this.setState({
+				loading: false
+			});
+		}.bind(this));
+	},
 	getInitialState() {
 		return {
 			datauser: {},
@@ -105,6 +179,18 @@ const User = Form.create()(React.createClass({
 					return '共' + total + '条数据';
 				}
 			},
+			paginations: {
+				defaultCurrent: 1,
+				defaultPageSize: 10,
+				showQuickJumper: true,
+				pageSize: 10,
+				onChange: function(page) {
+					this.loadDatas(page);
+				}.bind(this),
+				showTotal: function(total) {
+					return '共' + total + '条数据';
+				}
+			},
 			columns: [{
 					title: '用户编号',
 					dataIndex: 'userNo',
@@ -178,11 +264,12 @@ const User = Form.create()(React.createClass({
 					}
                 },
 			],
-			dataSource: [],
+			dataSourceData: [],
 		};
 	},
 	//点击离职一键转交
 	resources() {
+		this.loadDatas();
 		let deletedIds;
 		let rowItem;
 		for(let idx = 0; idx < this.state.selectedRows.length; idx++) {
@@ -202,6 +289,7 @@ const User = Form.create()(React.createClass({
 		this.setState({
 			visible: false
 		});
+		this.reset();
 	},
 	//一键离职
 	examineOK(record){
@@ -525,6 +613,10 @@ const User = Form.create()(React.createClass({
 		this.state.userDetaile = false
 		this.loadData();
 	},
+	searchs() {
+		this.state.userDetaile = false
+		this.loadDatas();
+	},
 	reset() {
 		this.state.userNameSearch = '';
 		this.state.organizationSearch = undefined;
@@ -538,6 +630,19 @@ const User = Form.create()(React.createClass({
 		this.state.theTypes='';
 		this.loadData();
 	},
+	resets() {
+		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.auto = '';
+		this.state.theTypes='';
+		this.loadDatas();
+	},
 	searchSwitch() {
 		this.setState({
 			searchMore: !this.state.searchMore
@@ -744,12 +849,13 @@ const User = Form.create()(React.createClass({
 		                    <Input placeholder="用户姓名" style={{width:'150px',marginRight:"10px",marginBottom:"10px"}}
 		                        value={this.state.userNameSearch}
 		                        onChange={(e) => { this.setState({ userNameSearch: e.target.value }); }} />
-		                    <Button type="primary" onClick={this.search}>搜索</Button>    
+		                    <Button type="primary" onClick={this.searchs}>搜索</Button> 
+		                    <Button onClick={this.resets}>重置</Button>
 	                        <div className="patent-table">
 			                    <Spin spinning={this.state.loading}>
 			                        <Table columns={this.state.column}
-			                            dataSource={this.state.dataSource}
-			                            pagination={this.state.pagination}
+			                            dataSource={this.state.dataSourceData}
+			                            pagination={this.state.paginations}
 			                            onRowClick={this.tableRowClick} />
 			                    </Spin>
 			                </div>