orgList.jsx 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. import React from 'react';
  2. import { Icon, Button, Input, Select, Spin, Table, Switch, message, DatePicker } from 'antd';
  3. import ajax from 'jquery/src/ajax/xhr.js';
  4. import $ from 'jquery/src/ajax';
  5. import moment from 'moment';
  6. import './userList.less';
  7. import OrgDesc from './orgDesc.jsx';
  8. import { auditStatusList } from '../../dataDic.js';
  9. export default class OrgList extends React.Component {
  10. loadData(pageNo) {
  11. this.state.data = [];
  12. this.setState({
  13. loading: true
  14. });
  15. $.ajax({
  16. method: "post",
  17. dataType: "json",
  18. crossDomain: false,
  19. url: globalConfig.context + "/api/admin/orgList",
  20. data: {
  21. pageNo: pageNo || 1,
  22. pageSize: this.state.pagination.pageSize,
  23. mobile: this.state.searchLoginId, //登录名
  24. email: this.state.searchEmail,
  25. createTime: this.state.searchTime,
  26. number: this.state.searchAftId, //阿凡提号
  27. aftUsername: this.state.searchAftUsername,
  28. auditStatus: this.state.searchAuditStatus
  29. },
  30. success: function (data) {
  31. if (data.error.length || !data.data || !data.data.list) {
  32. message.warning(data.error[0].message);
  33. return;
  34. }
  35. for (let i = 0; i < data.data.list.length; i++) {
  36. let thisdata = data.data.list[i];
  37. this.state.data.push({
  38. key: i,
  39. id: thisdata.id,
  40. mobile: thisdata.mobile,
  41. email: thisdata.email,
  42. createTime: thisdata.createTime,
  43. aftUsername: thisdata.aftUsername,
  44. number: thisdata.number,
  45. auditStatus: thisdata.auditStatus,
  46. createTimeFormattedDate: thisdata.createTimeFormattedDate
  47. });
  48. };
  49. this.state.pagination.current = data.data.pageNo;
  50. this.state.pagination.total = data.data.totalCount;
  51. this.setState({
  52. dataSource: this.state.data,
  53. pagination: this.state.pagination
  54. });
  55. }.bind(this),
  56. }).always(function () {
  57. this.setState({
  58. loading: false
  59. });
  60. }.bind(this));
  61. }
  62. constructor() {
  63. super();
  64. this.state = {
  65. searchMore: true,
  66. data: [],
  67. loading: false,
  68. searchTime: [,],
  69. pagination: {
  70. defaultCurrent: 1,
  71. defaultPageSize: 10,
  72. showQuickJumper: true,
  73. pageSize: 10,
  74. onChange: function (page) {
  75. this.loadData(page);
  76. }.bind(this),
  77. showTotal: function (total) {
  78. return '共' + total + '条数据';
  79. }
  80. },
  81. columns: [
  82. {
  83. title: '阿凡提号',
  84. dataIndex: 'number',
  85. key: 'number',
  86. }, {
  87. title: '登录名',
  88. dataIndex: 'mobile',
  89. key: 'mobile',
  90. }, {
  91. title: '认证状态',
  92. dataIndex: 'auditStatus',
  93. key: 'auditStatus',
  94. render: text => {
  95. switch (String(text)) {
  96. case "0":
  97. return "未提交审核";
  98. case "1":
  99. return "提交审核";
  100. case "2":
  101. return "审核未打款";
  102. case "3":
  103. return "审核已打款";
  104. case "4":
  105. return "认证未通过";
  106. case "5":
  107. return "已认证";
  108. }
  109. },
  110. }, {
  111. title: '注册时间',
  112. dataIndex: 'createTimeFormattedDate',
  113. key: 'createTimeFormattedDate',
  114. }, {
  115. title: '认证名称',
  116. dataIndex: 'aftUsername',
  117. key: 'aftUsername',
  118. }, {
  119. title: '联系方式',
  120. dataIndex: 'email',
  121. key: 'email',
  122. }, {
  123. title: '业务员',
  124. dataIndex: 'author',
  125. key: 'author',
  126. }
  127. ],
  128. dataSource: []
  129. };
  130. }
  131. componentWillMount() {
  132. this.loadData();
  133. }
  134. tableRowClick(record, index) {
  135. this.state.RowData = record;
  136. this.setState({
  137. showDesc: true
  138. });
  139. }
  140. closeDesc(e) {
  141. this.state.showDesc = e;
  142. this.loadData();
  143. }
  144. search() {
  145. this.loadData();
  146. }
  147. reset() {
  148. this.state.searchAftId = "";
  149. this.state.searchLoginId = "";
  150. this.state.searchAuditStatus = "";
  151. this.state.searchAftUsername = "";
  152. this.state.searchEmail = "";
  153. this.state.searchTime = [,];
  154. this.loadData();
  155. }
  156. searchSwitch() {
  157. this.setState({
  158. searchMore: !this.state.searchMore
  159. });
  160. }
  161. searchcreateTime(date, dateString) {
  162. this.state.createTime = dateString;
  163. }
  164. render() {
  165. const { RangePicker } = DatePicker;
  166. return (
  167. <div className="user-content" >
  168. <div className="content-title">
  169. <span>组织用户管理</span>
  170. </div>
  171. <div className="user-search">
  172. <Input placeholder="阿凡提号" value={this.state.searchAftId}
  173. onChange={(e) => { this.setState({ searchAftId: e.target.value }); }} />
  174. <Input placeholder="登录号" value={this.state.searchLoginId}
  175. onChange={(e) => { this.setState({ searchLoginId: e.target.value }); }} />
  176. <Select placeholder="选择认证状态" style={{ width: 140 }}
  177. value={this.state.searchAuditStatus}
  178. onChange={(e) => { this.setState({ searchAuditStatus: e }) }}>
  179. {
  180. auditStatusList.map(function (item, i) {
  181. return <Select.Option key={i} value={item.value} >{item.key}</Select.Option>
  182. })
  183. }
  184. </Select>
  185. <Input placeholder="认证名称" value={this.state.searchAftUsername}
  186. onChange={(e) => { this.setState({ searchAftUsername: e.target.value }); }} />
  187. <Input placeholder="联系方式" value={this.state.searchEmail}
  188. onChange={(e) => { this.setState({ searchEmail: e.target.value }); }} />
  189. <Button type="primary" onClick={this.search}>搜索</Button>
  190. <Button onClick={this.reset}>重置</Button>
  191. <span>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
  192. <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
  193. <p>
  194. <span>注册时间:</span>
  195. <RangePicker value={[moment(this.state.searchTime[0]), moment(this.state.searchTime[1])]}
  196. onChange={(data, dataString) => { this.setState({ searchTime: dataString }); }} />
  197. </p>
  198. </div>
  199. </div>
  200. <div className="patent-table">
  201. <Spin spinning={this.state.loading}>
  202. <Table columns={this.state.columns}
  203. dataSource={this.state.dataSource}
  204. pagination={this.state.pagination}
  205. onRowClick={this.tableRowClick} />
  206. </Spin>
  207. </div>
  208. <OrgDesc data={this.state.RowData} showDesc={this.state.showDesc} closeDesc={this.closeDesc} />
  209. </div >
  210. );
  211. }
  212. };
  213. module.exports = OrgList;