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[0],
  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. page:pageNo
  94. });
  95. var admin=window.adminData.isSuperAdmin||'';
  96. var departmentId=window.adminData.departmentId||'';
  97. $.ajax({
  98. method: "get",
  99. dataType: "json",
  100. crossDomain: false,
  101. url: globalConfig.context + '/api/admin/superviser/adminList',
  102. data: {
  103. pageNo: pageNo || 1,
  104. pageSize: this.state.paginations.pageSize,
  105. name: this.state.userNameSearchs,
  106. status: "正常"
  107. // departmentId: admin?this.state.organizationSearch:departmentId,
  108. // rid: this.state.rolesSearch,
  109. // duty: this.state.postSearch,
  110. // position: this.state.stationSearch,
  111. // status: this.state.statusSeach,
  112. // mobile: this.state.signNameSearch,
  113. // superiorId: this.state.theTypes
  114. },
  115. success: function(data) {
  116. let theArr = [];
  117. if(!data.data || !data.data.list) {
  118. if(data.error && data.error.length) {
  119. message.warning(data.error[0].message);
  120. };
  121. } else {
  122. for(let i = 0; i < data.data.list.length; i++) {
  123. let thisdata = data.data.list[i];
  124. theArr.push({
  125. key: i,
  126. id: thisdata.id,
  127. mobile: thisdata.mobile,
  128. name: thisdata.name,
  129. email: thisdata.email,
  130. createTime: thisdata.createTime,
  131. province: thisdata.province,
  132. position: thisdata.position,
  133. superior: thisdata.superior, //上级名称
  134. superiorId: thisdata.superiorId, //上级Id
  135. duty: thisdata.duty, //职务
  136. status: thisdata.status,
  137. userNo: thisdata.userNo,
  138. departmentName: thisdata.departmentName, //部门名称
  139. departmentId: thisdata.departmentId, //部门id
  140. roles:thisdata.roles[0],
  141. rolesId:thisdata.rolesId
  142. });
  143. };
  144. this.state.paginations.current = data.data.pageNo ? data.data.pageNo : '0';
  145. this.state.paginations.total = data.data.totalCount ? data.data.totalCount : '0';
  146. };
  147. if(!data.data.list.length){
  148. this.state.paginations.current=0
  149. this.state.paginations.total=0
  150. }
  151. this.setState({
  152. dataSourceData: theArr,
  153. paginations: this.state.paginations,
  154. selectedRowKeys:[]
  155. });
  156. }.bind(this),
  157. }).always(function() {
  158. this.setState({
  159. loading: false
  160. });
  161. }.bind(this));
  162. },
  163. getInitialState() {
  164. return {
  165. datauser: {},
  166. searchMore: true,
  167. selectedRowKeys: [],
  168. selectedRows: [],
  169. userDetaile: false,
  170. departmentArr: [],
  171. loading: false,
  172. roleArr:[],
  173. pagination: {
  174. defaultCurrent: 1,
  175. defaultPageSize: 10,
  176. showQuickJumper: true,
  177. pageSize: 10,
  178. onChange: function(page) {
  179. this.loadData(page);
  180. }.bind(this),
  181. showTotal: function(total) {
  182. return '共' + total + '条数据';
  183. }
  184. },
  185. paginations: {
  186. defaultCurrent: 1,
  187. defaultPageSize: 10,
  188. showQuickJumper: true,
  189. pageSize: 10,
  190. onChange: function(page) {
  191. this.loadDatas(page);
  192. }.bind(this),
  193. showTotal: function(total) {
  194. return '共' + total + '条数据';
  195. }
  196. },
  197. columns: [{
  198. title: '用户编号',
  199. dataIndex: 'userNo',
  200. key: 'userNo',
  201. }, {
  202. title: '登录用户名',
  203. dataIndex: 'mobile',
  204. key: 'mobile',
  205. }, {
  206. title: '角色',
  207. dataIndex: 'roles',
  208. key: 'roles',
  209. }, {
  210. title: '用户姓名',
  211. dataIndex: 'name',
  212. key: 'name',
  213. }, {
  214. title: '部门',
  215. dataIndex: 'departmentName',
  216. key: 'departmentName',
  217. }, {
  218. title: '职务',
  219. dataIndex: 'duty',
  220. key: 'duty',
  221. render: text => { return getPost(text) }
  222. },
  223. {
  224. title: '岗位',
  225. dataIndex: 'position',
  226. key: 'position',
  227. render: text => { return getStation(text) }
  228. },
  229. {
  230. title: '上级主管姓名',
  231. dataIndex: 'superior',
  232. key: 'superior',
  233. },
  234. {
  235. title: '状态',
  236. dataIndex: 'status',
  237. key: 'status',
  238. },
  239. {
  240. title: '最后登录时间',
  241. dataIndex: 'lastLoginTime',
  242. key: 'lastLoginTime',
  243. }
  244. ],
  245. column: [{
  246. title: '用户编号',
  247. dataIndex: 'userNo',
  248. key: 'userNo',
  249. }, {
  250. title: '登录用户名',
  251. dataIndex: 'mobile',
  252. key: 'mobile',
  253. }, {
  254. title: '角色',
  255. dataIndex: 'roles',
  256. key: 'roles',
  257. }, {
  258. title: '用户姓名',
  259. dataIndex: 'name',
  260. key: 'name',
  261. }, {
  262. title: '转交',
  263. dataIndex: 'ee',
  264. key: 'ee',
  265. render: (text, record, index) => {
  266. return <div>
  267. <Popconfirm title={'请确认转交【'+record.name+'】'} onConfirm={(e)=>{this.examineOK(record)}} okText="确认" cancelText="取消">
  268. <Button style={{marginRight:'5px'}} onClick={(e) =>{ e.stopPropagation()}} type="primary">转交</Button>
  269. </Popconfirm>
  270. </div>
  271. }
  272. },
  273. ],
  274. dataSourceData: [],
  275. };
  276. },
  277. //点击离职一键转交
  278. resources() {
  279. this.loadDatas();
  280. let deletedIds;
  281. let rowItem;
  282. for(let idx = 0; idx < this.state.selectedRows.length; idx++) {
  283. rowItem = this.state.selectedRows[idx];
  284. // console.log(rowItem.id);
  285. if(rowItem.id) {
  286. deletedIds = rowItem.id;
  287. };
  288. };
  289. this.setState({
  290. visible: true,
  291. aid:deletedIds
  292. });
  293. },
  294. //关闭离职一键转交
  295. handleCancel(){
  296. this.setState({
  297. visible: false
  298. });
  299. this.resets();
  300. },
  301. //一键离职
  302. examineOK(record){
  303. console.log(record);
  304. this.setState({
  305. selectedRowKeys: [],
  306. loading: true
  307. });
  308. $.ajax({
  309. method: "POST",
  310. dataType: "json",
  311. crossDomain: false,
  312. url: globalConfig.context + "/api/admin/role/dimission",
  313. data: {
  314. aid:this.state.aid,
  315. transferId:record.id,
  316. }
  317. }).done(function (data) {
  318. if (!data.error.length) {
  319. message.success('转交成功!');
  320. this.handleCancel()
  321. } else {
  322. message.warning(data.error[0].message);
  323. };
  324. this.setState({
  325. loading: false,
  326. visible2: false
  327. });
  328. }.bind(this));
  329. },
  330. componentWillMount() {
  331. this.loadData();
  332. this.departmentList();
  333. this.rolesList();
  334. },
  335. tableRowClick(record, index) {
  336. this.rolesArrS(record)
  337. this.setState({
  338. userDetaile:true,
  339. showDesc: true,
  340. datauser:record
  341. });
  342. },
  343. //新建获取id
  344. addIdS() {
  345. $.ajax({
  346. method: "get",
  347. dataType: "json",
  348. crossDomain: false,
  349. url: globalConfig.context + '/api/admin/superviser/newId',
  350. data: {},
  351. success: function(data) {
  352. this.setState({
  353. addId: data.data
  354. });
  355. }.bind(this),
  356. }).always(function() {
  357. this.setState({
  358. loading: false
  359. });
  360. }.bind(this));
  361. },
  362. //部门
  363. departmentList() {
  364. this.setState({
  365. loading: true
  366. });
  367. $.ajax({
  368. method: "get",
  369. dataType: "json",
  370. crossDomain: false,
  371. url: globalConfig.context + "/api/admin/organization/selectSuperId",
  372. data: {
  373. },
  374. success: function(data) {
  375. let thedata = data.data;
  376. let theArr = [];
  377. if(!thedata) {
  378. if(data.error && data.error.length) {
  379. message.warning(data.error[0].message);
  380. };
  381. thedata = {};
  382. } else {
  383. thedata.map(function(item, index) {
  384. theArr.push({
  385. key: index,
  386. name: item.name,
  387. id: item.id,
  388. depNo: item.depNo
  389. })
  390. })
  391. }
  392. this.setState({
  393. departmentArr: theArr,
  394. })
  395. }.bind(this),
  396. }).always(function() {
  397. this.setState({
  398. loading: false
  399. });
  400. }.bind(this));
  401. },
  402. //修改时获取角色数组
  403. rolesArrS(e) {
  404. $.ajax({
  405. method: "get",
  406. dataType: "json",
  407. crossDomain: false,
  408. url: globalConfig.context + "/api/admin/role",
  409. data: {
  410. uid:e.id
  411. },
  412. success: function(data) {
  413. let thedata = data.data;
  414. let theArr = [];
  415. let theId=[]
  416. if(!thedata) {
  417. if(data.error && data.error.length) {
  418. message.warning(data.error[0].message);
  419. };
  420. thedata = {};
  421. } else {
  422. }
  423. this.setState({
  424. role:thedata
  425. })
  426. }.bind(this),
  427. }).always(function() {
  428. }.bind(this));
  429. },
  430. //角色
  431. rolesList() {
  432. this.setState({
  433. loading: true
  434. });
  435. $.ajax({
  436. method: "get",
  437. dataType: "json",
  438. crossDomain: false,
  439. url: globalConfig.context + "/api/roles",
  440. data: {
  441. },
  442. success: function(data) {
  443. let thedata = data.data;
  444. let theArr = [];
  445. if(!thedata) {
  446. if(data.error && data.error.length) {
  447. message.warning(data.error[0].message);
  448. };
  449. thedata = {};
  450. } else {
  451. thedata.map(function(item, index) {
  452. theArr.push({
  453. key: index,
  454. roleName: item.roleName,
  455. id: item.id,
  456. })
  457. })
  458. }
  459. this.setState({
  460. roleArr: theArr,
  461. })
  462. }.bind(this),
  463. }).always(function() {
  464. this.setState({
  465. loading: false
  466. });
  467. }.bind(this));
  468. },
  469. //锁定
  470. locking() {
  471. let deletedIds;
  472. let statust;
  473. let mobiles;
  474. let names;
  475. let rolesId=[];
  476. for(let idx = 0; idx < this.state.selectedRows.length; idx++) {
  477. let rowItem = this.state.selectedRows[idx];
  478. if(rowItem.id) {
  479. deletedIds=rowItem.id;
  480. statust=rowItem.status;
  481. names=rowItem.name;
  482. mobiles=rowItem.mobile;
  483. rolesId=rowItem.rolesId
  484. };
  485. };
  486. this.setState({
  487. selectedRowKeys: [],
  488. loading: true
  489. });
  490. $.ajax({
  491. method: "POST",
  492. dataType: "json",
  493. crossDomain: false,
  494. url: globalConfig.context + "/api/admin/superviser/updateAdmin",
  495. data: {
  496. roles:rolesId,
  497. data:JSON.stringify({
  498. id: deletedIds,
  499. status: '锁定',
  500. name: names,
  501. mobile: mobiles,
  502. }),
  503. }
  504. }).done(function(data) {
  505. if(!data.error.length) {
  506. message.success('锁定成功!');
  507. this.setState({
  508. loading: false,
  509. });
  510. } else {
  511. message.warning(data.error[0].message);
  512. };
  513. this.loadData();
  514. }.bind(this));
  515. },
  516. //激活
  517. activation() {
  518. let deletedIds;
  519. let statust;
  520. let mobiles;
  521. let names;
  522. let rolesId=[]
  523. for(let idx = 0; idx < this.state.selectedRows.length; idx++) {
  524. let rowItem = this.state.selectedRows[idx];
  525. if(rowItem.id) {
  526. deletedIds=rowItem.id;
  527. statust=rowItem.status;
  528. names=rowItem.name;
  529. mobiles=rowItem.mobile;
  530. rolesId=rowItem.rolesId
  531. };
  532. };
  533. this.setState({
  534. selectedRowKeys: [],
  535. loading: true
  536. });
  537. $.ajax({
  538. method: "POST",
  539. dataType: "json",
  540. crossDomain: false,
  541. url: globalConfig.context + "/api/admin/superviser/updateAdmin",
  542. data: {
  543. roles:rolesId,
  544. data:JSON.stringify({
  545. id: deletedIds,
  546. status: '正常',
  547. name: names,
  548. mobile: mobiles,
  549. })
  550. }
  551. }).done(function(data) {
  552. if(!data.error.length) {
  553. message.success('激活成功!');
  554. this.setState({
  555. loading: false,
  556. });
  557. } else {
  558. message.warning(data.error[0].message);
  559. };
  560. this.loadData();
  561. }.bind(this));
  562. },
  563. //删除
  564. delectRow() {
  565. let deletedIds;
  566. for(let idx = 0; idx < this.state.selectedRows.length; idx++) {
  567. let rowItem = this.state.selectedRows[idx];
  568. if(rowItem.id) {
  569. deletedIds=rowItem.id;
  570. };
  571. };
  572. this.setState({
  573. selectedRowKeys: [],
  574. loading: true
  575. });
  576. $.ajax({
  577. method: "POST",
  578. dataType: "json",
  579. crossDomain: false,
  580. url: globalConfig.context + "/api/admin/superviser/deleteById",
  581. data: {
  582. id: deletedIds,
  583. }
  584. }).done(function(data) {
  585. if(!data.error.length) {
  586. message.success('删除成功!');
  587. this.setState({
  588. loading: false,
  589. });
  590. } else {
  591. message.warning(data.error[0].message);
  592. };
  593. this.loadData(this.state.page);
  594. }.bind(this));
  595. },
  596. addClick() {
  597. this.addIdS()
  598. this.state.userDetaile = false;
  599. this.setState({
  600. showDesc: true
  601. });
  602. },
  603. closeDesc(e, s) {
  604. this.state.userDetaile=false;
  605. this.state.showDesc = e;
  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. <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;