user.jsx 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035
  1. import React from 'react';
  2. import ReactDom from 'react-dom';
  3. import ajax from 'jquery/src/ajax/xhr.js';
  4. import $ from 'jquery/src/ajax';
  5. import { Form, Radio, Icon, Button, Input, Select, AutoComplete, Spin, Table, Switch, message, DatePicker, Modal, Upload,Popconfirm,Tabs } from 'antd';
  6. import Newuser from "./newUser.jsx"
  7. import './userMangagement.less'
  8. import { techAuditStatusList, station, post } from '../../../dataDic.js';
  9. import {getPost,getStation} from '../../../tools.js';
  10. import {ChooseList} from "../../order/orderNew/chooseList";
  11. const {TabPane} = Tabs
  12. const User = Form.create()(React.createClass({
  13. loadData(pageNo) {
  14. this.state.data = [];
  15. this.setState({
  16. userDetaile:false,
  17. loading: true,
  18. page:pageNo
  19. });
  20. var admin=window.adminData.isSuperAdmin||'';
  21. var departmentId=window.adminData.departmentId||'';
  22. $.ajax({
  23. method: "get",
  24. dataType: "json",
  25. crossDomain: false,
  26. url: globalConfig.context + '/api/admin/superviser/adminList',
  27. data: {
  28. pageNo: pageNo || 1,
  29. pageSize: this.state.pagination.pageSize,
  30. name: this.state.userNameSearch,
  31. departmentId: admin?this.state.organizationSearch:departmentId,
  32. rid: this.state.rolesSearch,
  33. duty: this.state.postSearch,
  34. position: this.state.stationSearch,
  35. status: this.state.statusSeach,
  36. mobile: this.state.signNameSearch,
  37. superiorId: this.state.theTypes
  38. },
  39. success: function(data) {
  40. let theArr = [];
  41. if(!data.data || !data.data.list) {
  42. if(data.error && data.error.length) {
  43. message.warning(data.error[0].message);
  44. };
  45. } else {
  46. for(let i = 0; i < data.data.list.length; i++) {
  47. let thisdata = data.data.list[i];
  48. theArr.push({
  49. key: i,
  50. id: thisdata.id,
  51. mobile: thisdata.mobile,
  52. name: thisdata.name,
  53. email: thisdata.email,
  54. createTime: thisdata.createTime,
  55. province: thisdata.province,
  56. position: thisdata.position,
  57. superior: thisdata.superior, //上级名称
  58. superiorId: thisdata.superiorId, //上级Id
  59. duty: thisdata.duty, //职务
  60. status: thisdata.status,
  61. userNo: thisdata.userNo,
  62. departmentName: thisdata.departmentName, //部门名称
  63. departmentId: thisdata.departmentId, //部门id
  64. roles:thisdata.roles.join(','),
  65. rolesId:thisdata.rolesId,
  66. lastLoginTime:thisdata.lastLoginTime,
  67. });
  68. };
  69. this.state.pagination.current = data.data.pageNo ? data.data.pageNo : '0';
  70. this.state.pagination.total = data.data.totalCount ? data.data.totalCount : '0';
  71. };
  72. if(!data.data.list.length){
  73. this.state.pagination.current=0
  74. this.state.pagination.total=0
  75. }
  76. this.setState({
  77. dataSource: theArr,
  78. pagination: this.state.pagination,
  79. selectedRowKeys:[]
  80. });
  81. }.bind(this),
  82. }).always(function() {
  83. this.setState({
  84. loading: false
  85. });
  86. }.bind(this));
  87. },
  88. loadDatas(pageNo) {
  89. this.state.data = [];
  90. this.setState({
  91. userDetaile:false,
  92. loading: true,
  93. });
  94. var admin=window.adminData.isSuperAdmin||'';
  95. var departmentId=window.adminData.departmentId||'';
  96. $.ajax({
  97. method: "get",
  98. dataType: "json",
  99. crossDomain: false,
  100. url: globalConfig.context + '/api/admin/superviser/adminList',
  101. data: {
  102. pageNo: pageNo || 1,
  103. pageSize: this.state.paginations.pageSize,
  104. name: this.state.userNameSearchs,
  105. status: "正常"
  106. // departmentId: admin?this.state.organizationSearch:departmentId,
  107. // rid: this.state.rolesSearch,
  108. // duty: this.state.postSearch,
  109. // position: this.state.stationSearch,
  110. // status: this.state.statusSeach,
  111. // mobile: this.state.signNameSearch,
  112. // superiorId: this.state.theTypes
  113. },
  114. success: function(data) {
  115. let theArr = [];
  116. if(!data.data || !data.data.list) {
  117. if(data.error && data.error.length) {
  118. message.warning(data.error[0].message);
  119. };
  120. } else {
  121. for(let i = 0; i < data.data.list.length; i++) {
  122. let thisdata = data.data.list[i];
  123. theArr.push({
  124. key: i,
  125. id: thisdata.id,
  126. mobile: thisdata.mobile,
  127. name: thisdata.name,
  128. email: thisdata.email,
  129. createTime: thisdata.createTime,
  130. province: thisdata.province,
  131. position: thisdata.position,
  132. superior: thisdata.superior, //上级名称
  133. superiorId: thisdata.superiorId, //上级Id
  134. duty: thisdata.duty, //职务
  135. status: thisdata.status,
  136. userNo: thisdata.userNo,
  137. departmentName: thisdata.departmentName, //部门名称
  138. departmentId: thisdata.departmentId, //部门id
  139. roles:thisdata.roles.join(','),
  140. rolesId:thisdata.rolesId
  141. });
  142. };
  143. this.state.paginations.current = data.data.pageNo ? data.data.pageNo : '0';
  144. this.state.paginations.total = data.data.totalCount ? data.data.totalCount : '0';
  145. };
  146. if(!data.data.list.length){
  147. this.state.paginations.current=0
  148. this.state.paginations.total=0
  149. }
  150. this.setState({
  151. dataSourceData: theArr,
  152. paginations: this.state.paginations,
  153. });
  154. }.bind(this),
  155. }).always(function() {
  156. this.setState({
  157. loading: false
  158. });
  159. }.bind(this));
  160. },
  161. getInitialState() {
  162. return {
  163. datauser: {},
  164. searchMore: true,
  165. selectedRowKeys: [],
  166. selectedRows: [],
  167. userDetaile: false,
  168. departmentArr: [],
  169. loading: false,
  170. roleArr:[],
  171. pagination: {
  172. defaultCurrent: 1,
  173. defaultPageSize: 10,
  174. showQuickJumper: true,
  175. pageSize: 10,
  176. onChange: function(page) {
  177. this.loadData(page);
  178. }.bind(this),
  179. showTotal: function(total) {
  180. return '共' + total + '条数据';
  181. }
  182. },
  183. paginations: {
  184. defaultCurrent: 1,
  185. defaultPageSize: 10,
  186. showQuickJumper: true,
  187. pageSize: 10,
  188. onChange: function(page) {
  189. this.loadDatas(page);
  190. }.bind(this),
  191. showTotal: function(total) {
  192. return '共' + total + '条数据';
  193. }
  194. },
  195. columns: [{
  196. title: '用户编号',
  197. dataIndex: 'userNo',
  198. key: 'userNo',
  199. }, {
  200. title: '登录用户名',
  201. dataIndex: 'mobile',
  202. key: 'mobile',
  203. }, {
  204. title: '角色',
  205. dataIndex: 'roles',
  206. key: 'roles',
  207. }, {
  208. title: '用户姓名',
  209. dataIndex: 'name',
  210. key: 'name',
  211. }, {
  212. title: '部门',
  213. dataIndex: 'departmentName',
  214. key: 'departmentName',
  215. }, {
  216. title: '职务',
  217. dataIndex: 'duty',
  218. key: 'duty',
  219. render: text => { return getPost(text) }
  220. },
  221. {
  222. title: '岗位',
  223. dataIndex: 'position',
  224. key: 'position',
  225. render: text => { return getStation(text) }
  226. },
  227. {
  228. title: '上级主管姓名',
  229. dataIndex: 'superior',
  230. key: 'superior',
  231. },
  232. {
  233. title: '状态',
  234. dataIndex: 'status',
  235. key: 'status',
  236. },
  237. {
  238. title: '最后登录时间',
  239. dataIndex: 'lastLoginTime',
  240. key: 'lastLoginTime',
  241. }
  242. ],
  243. column: [{
  244. title: '用户编号',
  245. dataIndex: 'userNo',
  246. key: 'userNo',
  247. }, {
  248. title: '登录用户名',
  249. dataIndex: 'mobile',
  250. key: 'mobile',
  251. }, {
  252. title: '角色',
  253. dataIndex: 'roles',
  254. key: 'roles',
  255. }, {
  256. title: '用户姓名',
  257. dataIndex: 'name',
  258. key: 'name',
  259. }, {
  260. title: '转交',
  261. dataIndex: 'ee',
  262. key: 'ee',
  263. render: (text, record, index) => {
  264. return <div>
  265. <Popconfirm title={'请确认转交【'+record.name+'】'} onConfirm={(e)=>{this.examineOK(record)}} okText="确认" cancelText="取消">
  266. <Button style={{marginRight:'5px'}} onClick={(e) =>{ e.stopPropagation()}} type="primary">转交</Button>
  267. </Popconfirm>
  268. </div>
  269. }
  270. },
  271. ],
  272. dataSourceData: [],
  273. };
  274. },
  275. //点击离职一键转交
  276. resources() {
  277. this.loadDatas();
  278. let deletedIds;
  279. let rowItem;
  280. for(let idx = 0; idx < this.state.selectedRows.length; idx++) {
  281. rowItem = this.state.selectedRows[idx];
  282. // console.log(rowItem.id);
  283. if(rowItem.id) {
  284. deletedIds = rowItem.id;
  285. };
  286. };
  287. this.setState({
  288. visible: true,
  289. aid:deletedIds
  290. });
  291. },
  292. //关闭离职一键转交
  293. handleCancel(){
  294. this.setState({
  295. visible: false,
  296. selectedRowKeys:[]
  297. },()=>{
  298. this.loadData(this.state.page);
  299. });
  300. },
  301. //一键离职
  302. examineOK(record){
  303. console.log(record);
  304. this.setState({
  305. loading: true
  306. });
  307. $.ajax({
  308. method: "POST",
  309. dataType: "json",
  310. crossDomain: false,
  311. url: globalConfig.context + "/api/admin/role/dimission",
  312. data: {
  313. aid:this.state.aid,
  314. transferId:record.id,
  315. }
  316. }).done(function (data) {
  317. if (!data.error.length) {
  318. message.success('转交成功!');
  319. this.handleCancel()
  320. } else {
  321. message.warning(data.error[0].message);
  322. };
  323. this.setState({
  324. loading: false,
  325. visible2: false
  326. });
  327. }.bind(this));
  328. },
  329. componentWillMount() {
  330. this.loadData();
  331. this.departmentList();
  332. this.rolesList();
  333. },
  334. tableRowClick(record, index) {
  335. this.rolesArrS(record)
  336. },
  337. //新建获取id
  338. addIdS() {
  339. $.ajax({
  340. method: "get",
  341. dataType: "json",
  342. crossDomain: false,
  343. url: globalConfig.context + '/api/admin/superviser/newId',
  344. data: {},
  345. success: function(data) {
  346. this.setState({
  347. addId: data.data
  348. });
  349. }.bind(this),
  350. }).always(function() {
  351. this.setState({
  352. loading: false
  353. });
  354. }.bind(this));
  355. },
  356. //部门
  357. departmentList() {
  358. this.setState({
  359. loading: true
  360. });
  361. $.ajax({
  362. method: "get",
  363. dataType: "json",
  364. crossDomain: false,
  365. url: globalConfig.context + "/api/admin/organization/selectSuperId",
  366. data: {
  367. },
  368. success: function(data) {
  369. let thedata = data.data;
  370. let theArr = [];
  371. if(!thedata) {
  372. if(data.error && data.error.length) {
  373. message.warning(data.error[0].message);
  374. };
  375. thedata = {};
  376. } else {
  377. thedata.map(function(item, index) {
  378. theArr.push({
  379. key: index,
  380. name: item.name,
  381. id: item.id,
  382. depNo: item.depNo
  383. })
  384. })
  385. }
  386. this.setState({
  387. departmentArr: theArr,
  388. })
  389. }.bind(this),
  390. }).always(function() {
  391. this.setState({
  392. loading: false
  393. });
  394. }.bind(this));
  395. },
  396. //修改时获取角色数组
  397. rolesArrS(e) {
  398. $.ajax({
  399. method: "get",
  400. dataType: "json",
  401. crossDomain: false,
  402. url: globalConfig.context + "/api/admin/role",
  403. data: {
  404. uid:e.id
  405. },
  406. success: function(data) {
  407. let thedata = data.data;
  408. let theArr = [];
  409. let theId=[]
  410. if(!thedata) {
  411. if(data.error && data.error.length) {
  412. message.warning(data.error[0].message);
  413. };
  414. thedata = {};
  415. } else {
  416. }
  417. this.setState({
  418. role:thedata,
  419. userDetaile:true,
  420. showDesc: true,
  421. datauser:e
  422. })
  423. }.bind(this),
  424. }).always(function() {
  425. }.bind(this));
  426. },
  427. //角色
  428. rolesList() {
  429. this.setState({
  430. loading: true
  431. });
  432. $.ajax({
  433. method: "get",
  434. dataType: "json",
  435. crossDomain: false,
  436. url: globalConfig.context + "/api/roles",
  437. data: {
  438. },
  439. success: function(data) {
  440. let thedata = data.data;
  441. let theArr = [];
  442. if(!thedata) {
  443. if(data.error && data.error.length) {
  444. message.warning(data.error[0].message);
  445. };
  446. thedata = {};
  447. } else {
  448. thedata.map(function(item, index) {
  449. theArr.push({
  450. key: index,
  451. roleName: item.roleName,
  452. id: item.id,
  453. })
  454. })
  455. }
  456. this.setState({
  457. roleArr: theArr,
  458. })
  459. }.bind(this),
  460. }).always(function() {
  461. this.setState({
  462. loading: false
  463. });
  464. }.bind(this));
  465. },
  466. //锁定
  467. locking() {
  468. let deletedIds;
  469. let statust;
  470. let mobiles;
  471. let names;
  472. let rolesId=[];
  473. for(let idx = 0; idx < this.state.selectedRows.length; idx++) {
  474. let rowItem = this.state.selectedRows[idx];
  475. if(rowItem.id) {
  476. deletedIds=rowItem.id;
  477. statust=rowItem.status;
  478. names=rowItem.name;
  479. mobiles=rowItem.mobile;
  480. rolesId=rowItem.rolesId
  481. };
  482. };
  483. this.setState({
  484. selectedRowKeys: [],
  485. loading: true
  486. });
  487. $.ajax({
  488. method: "POST",
  489. dataType: "json",
  490. crossDomain: false,
  491. url: globalConfig.context + "/api/admin/superviser/updateAdmin",
  492. data: {
  493. roles:rolesId,
  494. data:JSON.stringify({
  495. id: deletedIds,
  496. status: '锁定',
  497. name: names,
  498. mobile: mobiles,
  499. }),
  500. }
  501. }).done(function(data) {
  502. if(!data.error.length) {
  503. message.success('锁定成功!');
  504. this.setState({
  505. loading: false,
  506. });
  507. } else {
  508. message.warning(data.error[0].message);
  509. };
  510. this.loadData();
  511. }.bind(this));
  512. },
  513. //激活
  514. activation() {
  515. let deletedIds;
  516. let statust;
  517. let mobiles;
  518. let names;
  519. let rolesId=[]
  520. for(let idx = 0; idx < this.state.selectedRows.length; idx++) {
  521. let rowItem = this.state.selectedRows[idx];
  522. if(rowItem.id) {
  523. deletedIds=rowItem.id;
  524. statust=rowItem.status;
  525. names=rowItem.name;
  526. mobiles=rowItem.mobile;
  527. rolesId=rowItem.rolesId
  528. };
  529. };
  530. this.setState({
  531. selectedRowKeys: [],
  532. loading: true
  533. });
  534. $.ajax({
  535. method: "POST",
  536. dataType: "json",
  537. crossDomain: false,
  538. url: globalConfig.context + "/api/admin/superviser/updateAdmin",
  539. data: {
  540. roles:rolesId,
  541. data:JSON.stringify({
  542. id: deletedIds,
  543. status: '正常',
  544. name: names,
  545. mobile: mobiles,
  546. })
  547. }
  548. }).done(function(data) {
  549. if(!data.error.length) {
  550. message.success('激活成功!');
  551. this.setState({
  552. loading: false,
  553. });
  554. } else {
  555. message.warning(data.error[0].message);
  556. };
  557. this.loadData();
  558. }.bind(this));
  559. },
  560. //删除
  561. delectRow() {
  562. let deletedIds;
  563. for(let idx = 0; idx < this.state.selectedRows.length; idx++) {
  564. let rowItem = this.state.selectedRows[idx];
  565. if(rowItem.id) {
  566. deletedIds=rowItem.id;
  567. };
  568. };
  569. this.setState({
  570. selectedRowKeys: [],
  571. loading: true
  572. });
  573. $.ajax({
  574. method: "POST",
  575. dataType: "json",
  576. crossDomain: false,
  577. url: globalConfig.context + "/api/admin/superviser/deleteById",
  578. data: {
  579. id: deletedIds,
  580. }
  581. }).done(function(data) {
  582. if(!data.error.length) {
  583. message.success('删除成功!');
  584. this.setState({
  585. loading: false,
  586. });
  587. } else {
  588. message.warning(data.error[0].message);
  589. };
  590. this.loadData(this.state.page);
  591. }.bind(this));
  592. },
  593. addClick() {
  594. this.addIdS()
  595. this.setState({
  596. datauser:{},
  597. showDesc: true,
  598. userDetaile: false,
  599. });
  600. },
  601. closeDesc(e, s) {
  602. this.setState({
  603. userDetaile:false,
  604. showDesc:e
  605. })
  606. if(s) {
  607. this.loadData(this.state.page);
  608. };
  609. },
  610. search() {
  611. this.state.userDetaile = false
  612. this.loadData();
  613. },
  614. searchs() {
  615. this.state.userDetaile = false
  616. this.loadDatas();
  617. },
  618. reset() {
  619. this.state.userNameSearch = '';
  620. this.state.organizationSearch = undefined;
  621. this.state.rolesSearch = undefined;
  622. this.state.postSearch = undefined;
  623. this.state.stationSearch = undefined;
  624. this.state.statusSeach = undefined;
  625. this.state.signNameSearch = '';
  626. this.state.mobileSearch = '';
  627. this.state.auto = '';
  628. this.state.theTypes='';
  629. this.loadData();
  630. },
  631. resets() {
  632. this.state.userNameSearchs = '';
  633. this.state.organizationSearch = undefined;
  634. this.state.rolesSearch = undefined;
  635. this.state.postSearch = undefined;
  636. this.state.stationSearch = undefined;
  637. this.state.statusSeach = undefined;
  638. this.state.signNameSearch = '';
  639. this.state.mobileSearch = '';
  640. this.state.auto = '';
  641. this.state.theTypes='';
  642. this.loadDatas();
  643. },
  644. searchSwitch() {
  645. this.setState({
  646. searchMore: !this.state.searchMore
  647. });
  648. },
  649. //主管初始加载(自动补全)
  650. supervisor(e) {
  651. $.ajax({
  652. method: "post",
  653. dataType: "json",
  654. crossDomain: false,
  655. url: globalConfig.context + "/api/admin/organization/selectName",
  656. data: {
  657. name: e
  658. },
  659. success: function(data) {
  660. let thedata = data.data;
  661. if(!thedata) {
  662. if(data.error && data.error.length) {
  663. message.warning(data.error[0].message);
  664. };
  665. thedata = {};
  666. };
  667. this.setState({
  668. customerArr: thedata,
  669. });
  670. }.bind(this),
  671. }).always(function() {
  672. this.setState({
  673. loading: false
  674. });
  675. }.bind(this));
  676. },
  677. //上级主管输入框失去焦点是判断客户是否存在
  678. selectAuto(value, options) {
  679. this.setState({
  680. auto: value
  681. })
  682. },
  683. blurChange(e) {
  684. let theType = '';
  685. let contactLists = this.state.customerArr || [];
  686. if(e) {
  687. contactLists.map(function(item) {
  688. if(item.name == e.toString()) {
  689. theType = item.id;
  690. }
  691. });
  692. }
  693. this.setState({
  694. theTypes: theType
  695. })
  696. },
  697. //值改变时请求客户名称
  698. httpChange(e) {
  699. if(e.length >= 1) {
  700. this.supervisor(e);
  701. }
  702. this.setState({
  703. auto: e
  704. })
  705. },
  706. changeList(arr) {
  707. const newArr = [];
  708. this.state.columns.forEach(item => {
  709. arr.forEach(val => {
  710. if (val === item.title) {
  711. newArr.push(item);
  712. }
  713. });
  714. });
  715. this.setState({
  716. changeList: newArr
  717. });
  718. },
  719. render() {
  720. const rowSelection = {
  721. selectedRowKeys: this.state.selectedRowKeys,
  722. onChange: (selectedRowKeys, selectedRows) => {
  723. this.setState({
  724. selectedRows: selectedRows.slice(-1),
  725. selectedRowKeys: selectedRowKeys.slice(-1)
  726. });
  727. },
  728. onSelectAll: (selected, selectedRows, changeRows) => {
  729. this.setState({
  730. selectedRowKeys: []
  731. })
  732. },
  733. };
  734. const dataSources = this.state.customerArr || [];
  735. const options = dataSources.map((group, index) =>
  736. <Select.Option key={index} value={group.name}>{group.name}</Select.Option>
  737. )
  738. const hasSelected = this.state.selectedRowKeys.length > 0;
  739. const { RangePicker } = DatePicker;
  740. let departmentArr = this.state.departmentArr || [];
  741. let roleArr = this.state.roleArr || [];
  742. return (
  743. <div className="user-content">
  744. <div className="content-title">
  745. <Tabs defaultActiveKey="1" onChange={this.callback} className="test">
  746. <TabPane tab="搜索" key="1">
  747. <div className="user-search">
  748. <Input
  749. placeholder="用户姓名"
  750. style={{ width: "150px" }}
  751. value={this.state.userNameSearch}
  752. onChange={e => {
  753. this.setState({ userNameSearch: e.target.value });
  754. }}
  755. />
  756. {window.adminData.isSuperAdmin ? (
  757. <Select
  758. placeholder="部门"
  759. style={{ width: 160 }}
  760. value={this.state.organizationSearch}
  761. onChange={e => {
  762. this.setState({ organizationSearch: e });
  763. }}
  764. >
  765. {departmentArr.map(function(item) {
  766. return (
  767. <Select.Option key={item.id}>{item.name}</Select.Option>
  768. );
  769. })}
  770. </Select>
  771. ) : (
  772. ""
  773. )}
  774. <Select
  775. placeholder="角色"
  776. style={{ width: 160 }}
  777. value={this.state.rolesSearch}
  778. onChange={e => {
  779. this.setState({ rolesSearch: e });
  780. }}
  781. >
  782. {roleArr.map(function(item) {
  783. return (
  784. <Select.Option key={item.id}>
  785. {item.roleName}
  786. </Select.Option>
  787. );
  788. })}
  789. </Select>
  790. <div
  791. className="search-more"
  792. style={{ display: "inline-block" }}
  793. >
  794. <Select
  795. placeholder="职务"
  796. style={{ width: 160 }}
  797. value={this.state.postSearch}
  798. onChange={e => {
  799. this.setState({ postSearch: e });
  800. }}
  801. >
  802. {post.map(function(item) {
  803. return (
  804. <Select.Option key={item.value}>
  805. {item.key}
  806. </Select.Option>
  807. );
  808. })}
  809. </Select>
  810. <Select
  811. placeholder="岗位"
  812. style={{ width: 160 }}
  813. value={this.state.stationSearch}
  814. onChange={e => {
  815. this.setState({ stationSearch: e });
  816. }}
  817. >
  818. {station.map(function(item) {
  819. return (
  820. <Select.Option key={item.value}>
  821. {item.key}
  822. </Select.Option>
  823. );
  824. })}
  825. </Select>
  826. <Select
  827. placeholder="状态"
  828. style={{ width: 160 }}
  829. value={this.state.statusSeach}
  830. onChange={e => {
  831. this.setState({ statusSeach: e });
  832. }}
  833. >
  834. <Select.Option value="正常">正常</Select.Option>
  835. <Select.Option value="锁定">锁定</Select.Option>
  836. <Select.Option value="注销">注销</Select.Option>
  837. </Select>
  838. <Input
  839. placeholder="登录用户名"
  840. style={{ width: "150px" }}
  841. value={this.state.signNameSearch}
  842. onChange={e => {
  843. this.setState({ signNameSearch: e.target.value });
  844. }}
  845. />
  846. <AutoComplete
  847. className="certain-category-search"
  848. dropdownClassName="certain-category-search-dropdown"
  849. dropdownMatchSelectWidth={false}
  850. dropdownStyle={{ width: 200 }}
  851. size="large"
  852. style={{
  853. width: "150px",
  854. height: "28px",
  855. marginLeft: "10px"
  856. }}
  857. dataSource={options}
  858. placeholder="输入上级主管名字"
  859. value={this.state.auto}
  860. onChange={this.httpChange}
  861. filterOption={true}
  862. onBlur={this.blurChange}
  863. onSelect={this.selectAuto}
  864. >
  865. <Input />
  866. </AutoComplete>
  867. </div>
  868. <Button type="primary" onClick={this.search}>
  869. 搜索
  870. </Button>
  871. <Button onClick={this.reset}>重置</Button>
  872. <Button
  873. style={{ background: "red", border: "none", color: "#fff" }}
  874. disabled={!hasSelected}
  875. onClick={this.delectRow}
  876. style={{ display: "none" }}
  877. >
  878. 删除
  879. <Icon type="minus" />
  880. </Button>
  881. {/* <span>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch} /></span> */}
  882. </div>
  883. </TabPane>
  884. <TabPane tab="操作" key="2">
  885. <Button
  886. style={{
  887. background: "#333333",
  888. border: "none",
  889. color: "#fff",
  890. marginBottom: 10,
  891. marginTop: 12,
  892. marginRight: 10
  893. }}
  894. disabled={!hasSelected}
  895. onClick={this.locking}
  896. >
  897. 锁定
  898. <Icon type="lock" />
  899. </Button>
  900. <Button
  901. style={{ background: "green", border: "none", color: "#fff", marginTop: 12 }}
  902. disabled={!hasSelected}
  903. onClick={this.activation}
  904. >
  905. 激活
  906. <Icon type="unlock" />
  907. </Button>
  908. {/* </TabPane>
  909. <TabPane tab="新增" key="3"> */}
  910. <Button
  911. type="primary"
  912. className="addButton"
  913. style={{ float: "left", marginBottom: 10, marginTop: 12 }}
  914. onClick={this.addClick}
  915. >
  916. 新增用户
  917. <Icon type="user" />
  918. </Button>
  919. {/* </TabPane>
  920. <TabPane tab="离职转交" key="4"> */}
  921. <Button
  922. type="primary"
  923. className="addButton"
  924. style={{ float: "left", marginBottom: 10, marginTop: 12 }}
  925. onClick={this.resources}
  926. disabled={!hasSelected}
  927. >
  928. 离职一键转交
  929. <Icon type="user" />
  930. </Button>
  931. </TabPane>
  932. <TabPane tab="更改表格显示数据" key="3">
  933. <div style={{ marginLeft: 10 }}>
  934. <ChooseList
  935. columns={this.state.columns}
  936. changeFn={this.changeList}
  937. changeList={this.state.changeList}
  938. top={55}
  939. margin={11}
  940. />
  941. </div>
  942. </TabPane>
  943. </Tabs>
  944. <div className="patent-table">
  945. <Spin spinning={this.state.loading}>
  946. <Table
  947. columns={
  948. this.state.changeList
  949. ? this.state.changeList
  950. : this.state.columns
  951. }
  952. style={{
  953. cursor: 'pointer',
  954. }}
  955. dataSource={this.state.dataSource}
  956. rowSelection={rowSelection}
  957. pagination={this.state.pagination}
  958. onRowClick={this.tableRowClick}
  959. />
  960. </Spin>
  961. </div>
  962. {this.state.showDesc && <Newuser
  963. role={this.state.role}
  964. addId={this.state.addId}
  965. roleArr={this.state.roleArr}
  966. departmentArr={this.state.departmentArr}
  967. userDetaile={this.state.userDetaile}
  968. datauser={this.state.datauser}
  969. showDesc={this.state.showDesc}
  970. closeDesc={this.closeDesc}
  971. />}
  972. <div className="patent-desc">
  973. <Modal
  974. maskClosable={false}
  975. visible={this.state.visible}
  976. onOk={this.checkResources}
  977. onCancel={this.handleCancel}
  978. width="800px"
  979. title="离职一键转交"
  980. footer=""
  981. className="admin-desc-content"
  982. >
  983. <Input
  984. placeholder="用户姓名"
  985. style={{
  986. width: "150px",
  987. marginRight: "10px",
  988. marginBottom: "10px"
  989. }}
  990. value={this.state.userNameSearchs}
  991. onChange={e => {
  992. this.setState({ userNameSearchs: e.target.value });
  993. }}
  994. />
  995. <Button type="primary" onClick={this.searchs}>
  996. 搜索
  997. </Button>
  998. <Button onClick={this.resets}>重置</Button>
  999. <div className="patent-table">
  1000. <Spin spinning={this.state.loading}>
  1001. <Table
  1002. columns={this.state.column}
  1003. dataSource={this.state.dataSourceData}
  1004. pagination={this.state.paginations}
  1005. style={{
  1006. cursor: 'pointer',
  1007. }}
  1008. onRowClick={this.tableRowClick}
  1009. />
  1010. </Spin>
  1011. </div>
  1012. </Modal>
  1013. </div>
  1014. </div>
  1015. </div>
  1016. );
  1017. }
  1018. }));
  1019. export default User;