user.jsx 25 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040
  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. render: (text) =>
  237. <span style={{ color: ["green", "red"][text] }}>
  238. {text == 0
  239. ? "正常" : text == 1
  240. ? "停用" : "-"}
  241. </span>
  242. },
  243. {
  244. title: '最后登录时间',
  245. dataIndex: 'lastLoginTime',
  246. key: 'lastLoginTime',
  247. }
  248. ],
  249. column: [{
  250. title: '用户编号',
  251. dataIndex: 'userNo',
  252. key: 'userNo',
  253. }, {
  254. title: '登录用户名',
  255. dataIndex: 'mobile',
  256. key: 'mobile',
  257. }, {
  258. title: '角色',
  259. dataIndex: 'roles',
  260. key: 'roles',
  261. }, {
  262. title: '用户姓名',
  263. dataIndex: 'name',
  264. key: 'name',
  265. }, {
  266. title: '转交',
  267. dataIndex: 'ee',
  268. key: 'ee',
  269. render: (text, record, index) => {
  270. return <div>
  271. <Popconfirm title={'请确认转交【' + record.name + '】'} onConfirm={(e) => { this.examineOK(record) }} okText="确认" cancelText="取消">
  272. <Button style={{ marginRight: '5px' }} onClick={(e) => { e.stopPropagation() }} type="primary">转交</Button>
  273. </Popconfirm>
  274. </div>
  275. }
  276. },
  277. ],
  278. dataSourceData: [],
  279. };
  280. },
  281. //点击离职一键转交
  282. resources() {
  283. this.loadDatas();
  284. let deletedIds;
  285. let rowItem;
  286. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  287. rowItem = this.state.selectedRows[idx];
  288. // console.log(rowItem.id);
  289. if (rowItem.id) {
  290. deletedIds = rowItem.id;
  291. };
  292. };
  293. this.setState({
  294. visible: true,
  295. aid: deletedIds
  296. });
  297. },
  298. //关闭离职一键转交
  299. handleCancel() {
  300. this.setState({
  301. visible: false,
  302. selectedRowKeys: []
  303. }, () => {
  304. this.loadData(this.state.page);
  305. });
  306. },
  307. //一键离职
  308. examineOK(record) {
  309. // console.log(record);
  310. this.setState({
  311. loading: true
  312. });
  313. $.ajax({
  314. method: "POST",
  315. dataType: "json",
  316. crossDomain: false,
  317. url: globalConfig.context + "/api/admin/role/dimission",
  318. data: {
  319. aid: this.state.aid,
  320. transferId: record.id,
  321. }
  322. }).done(function (data) {
  323. if (!data.error.length) {
  324. message.success('转交成功!');
  325. this.handleCancel()
  326. } else {
  327. message.warning(data.error[0].message);
  328. };
  329. this.setState({
  330. loading: false,
  331. visible2: false
  332. });
  333. }.bind(this));
  334. },
  335. componentWillMount() {
  336. this.loadData();
  337. this.departmentList();
  338. this.rolesList();
  339. },
  340. tableRowClick(record, index) {
  341. this.rolesArrS(record)
  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. userDetaile: true,
  426. showDesc: true,
  427. datauser: e
  428. })
  429. }.bind(this),
  430. }).always(function () {
  431. }.bind(this));
  432. },
  433. //角色
  434. rolesList() {
  435. this.setState({
  436. loading: true
  437. });
  438. $.ajax({
  439. method: "get",
  440. dataType: "json",
  441. crossDomain: false,
  442. url: globalConfig.context + "/api/roles",
  443. data: {
  444. },
  445. success: function (data) {
  446. let thedata = data.data;
  447. let theArr = [];
  448. if (!thedata) {
  449. if (data.error && data.error.length) {
  450. message.warning(data.error[0].message);
  451. };
  452. thedata = {};
  453. } else {
  454. thedata.map(function (item, index) {
  455. theArr.push({
  456. key: index,
  457. roleName: item.roleName,
  458. id: item.id,
  459. })
  460. })
  461. }
  462. this.setState({
  463. roleArr: theArr,
  464. })
  465. }.bind(this),
  466. }).always(function () {
  467. this.setState({
  468. loading: false
  469. });
  470. }.bind(this));
  471. },
  472. //锁定
  473. locking() {
  474. let deletedIds;
  475. let statust;
  476. let mobiles;
  477. let names;
  478. let rolesId = [];
  479. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  480. let rowItem = this.state.selectedRows[idx];
  481. if (rowItem.id) {
  482. deletedIds = rowItem.id;
  483. statust = rowItem.status;
  484. names = rowItem.name;
  485. mobiles = rowItem.mobile;
  486. rolesId = rowItem.rolesId
  487. };
  488. };
  489. this.setState({
  490. selectedRowKeys: [],
  491. loading: true
  492. });
  493. $.ajax({
  494. method: "POST",
  495. dataType: "json",
  496. crossDomain: false,
  497. url: globalConfig.context + "/api/admin/superviser/updateAdmin",
  498. data: {
  499. roles: rolesId,
  500. data: JSON.stringify({
  501. id: deletedIds,
  502. status: '锁定',
  503. name: names,
  504. mobile: mobiles,
  505. }),
  506. }
  507. }).done(function (data) {
  508. if (!data.error.length) {
  509. message.success('锁定成功!');
  510. this.setState({
  511. loading: false,
  512. });
  513. } else {
  514. message.warning(data.error[0].message);
  515. };
  516. this.loadData();
  517. }.bind(this));
  518. },
  519. //激活
  520. activation() {
  521. let deletedIds;
  522. let statust;
  523. let mobiles;
  524. let names;
  525. let rolesId = []
  526. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  527. let rowItem = this.state.selectedRows[idx];
  528. if (rowItem.id) {
  529. deletedIds = rowItem.id;
  530. statust = rowItem.status;
  531. names = rowItem.name;
  532. mobiles = rowItem.mobile;
  533. rolesId = rowItem.rolesId
  534. };
  535. };
  536. this.setState({
  537. selectedRowKeys: [],
  538. loading: true
  539. });
  540. $.ajax({
  541. method: "POST",
  542. dataType: "json",
  543. crossDomain: false,
  544. url: globalConfig.context + "/api/admin/superviser/updateAdmin",
  545. data: {
  546. roles: rolesId,
  547. data: JSON.stringify({
  548. id: deletedIds,
  549. status: '正常',
  550. name: names,
  551. mobile: mobiles,
  552. })
  553. }
  554. }).done(function (data) {
  555. if (!data.error.length) {
  556. message.success('激活成功!');
  557. this.setState({
  558. loading: false,
  559. });
  560. } else {
  561. message.warning(data.error[0].message);
  562. };
  563. this.loadData();
  564. }.bind(this));
  565. },
  566. //删除
  567. delectRow() {
  568. let deletedIds;
  569. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  570. let rowItem = this.state.selectedRows[idx];
  571. if (rowItem.id) {
  572. deletedIds = rowItem.id;
  573. };
  574. };
  575. this.setState({
  576. selectedRowKeys: [],
  577. loading: true
  578. });
  579. $.ajax({
  580. method: "POST",
  581. dataType: "json",
  582. crossDomain: false,
  583. url: globalConfig.context + "/api/admin/superviser/deleteById",
  584. data: {
  585. id: deletedIds,
  586. }
  587. }).done(function (data) {
  588. if (!data.error.length) {
  589. message.success('删除成功!');
  590. this.setState({
  591. loading: false,
  592. });
  593. } else {
  594. message.warning(data.error[0].message);
  595. };
  596. this.loadData(this.state.page);
  597. }.bind(this));
  598. },
  599. addClick() {
  600. this.addIdS()
  601. this.setState({
  602. datauser: {},
  603. showDesc: true,
  604. userDetaile: false,
  605. });
  606. },
  607. closeDesc(e, s) {
  608. this.setState({
  609. userDetaile: false,
  610. showDesc: e
  611. })
  612. if (s) {
  613. this.loadData(this.state.page);
  614. };
  615. },
  616. search() {
  617. this.state.userDetaile = false
  618. this.loadData();
  619. },
  620. searchs() {
  621. this.state.userDetaile = false
  622. this.loadDatas();
  623. },
  624. reset() {
  625. this.state.userNameSearch = '';
  626. this.state.organizationSearch = undefined;
  627. this.state.rolesSearch = undefined;
  628. this.state.postSearch = undefined;
  629. this.state.stationSearch = undefined;
  630. this.state.statusSeach = undefined;
  631. this.state.signNameSearch = '';
  632. this.state.mobileSearch = '';
  633. this.state.auto = '';
  634. this.state.theTypes = '';
  635. this.loadData();
  636. },
  637. resets() {
  638. this.state.userNameSearchs = '';
  639. this.state.organizationSearch = undefined;
  640. this.state.rolesSearch = undefined;
  641. this.state.postSearch = undefined;
  642. this.state.stationSearch = undefined;
  643. this.state.statusSeach = undefined;
  644. this.state.signNameSearch = '';
  645. this.state.mobileSearch = '';
  646. this.state.auto = '';
  647. this.state.theTypes = '';
  648. this.loadDatas();
  649. },
  650. searchSwitch() {
  651. this.setState({
  652. searchMore: !this.state.searchMore
  653. });
  654. },
  655. //主管初始加载(自动补全)
  656. supervisor(e) {
  657. $.ajax({
  658. method: "post",
  659. dataType: "json",
  660. crossDomain: false,
  661. url: globalConfig.context + "/api/admin/organization/selectName",
  662. data: {
  663. name: e
  664. },
  665. success: function (data) {
  666. let thedata = data.data;
  667. if (!thedata) {
  668. if (data.error && data.error.length) {
  669. message.warning(data.error[0].message);
  670. };
  671. thedata = {};
  672. };
  673. this.setState({
  674. customerArr: thedata,
  675. });
  676. }.bind(this),
  677. }).always(function () {
  678. this.setState({
  679. loading: false
  680. });
  681. }.bind(this));
  682. },
  683. //上级主管输入框失去焦点是判断客户是否存在
  684. selectAuto(value, options) {
  685. this.setState({
  686. auto: value
  687. })
  688. },
  689. blurChange(e) {
  690. let theType = '';
  691. let contactLists = this.state.customerArr || [];
  692. if (e) {
  693. contactLists.map(function (item) {
  694. if (item.name == e.toString()) {
  695. theType = item.id;
  696. }
  697. });
  698. }
  699. this.setState({
  700. theTypes: theType
  701. })
  702. },
  703. //值改变时请求客户名称
  704. httpChange(e) {
  705. if (e.length >= 1) {
  706. this.supervisor(e);
  707. }
  708. this.setState({
  709. auto: e
  710. })
  711. },
  712. changeList(arr) {
  713. const newArr = [];
  714. this.state.columns.forEach(item => {
  715. arr.forEach(val => {
  716. if (val === item.title) {
  717. newArr.push(item);
  718. }
  719. });
  720. });
  721. this.setState({
  722. changeList: newArr
  723. });
  724. },
  725. render() {
  726. const rowSelection = {
  727. selectedRowKeys: this.state.selectedRowKeys,
  728. onChange: (selectedRowKeys, selectedRows) => {
  729. this.setState({
  730. selectedRows: selectedRows.slice(-1),
  731. selectedRowKeys: selectedRowKeys.slice(-1)
  732. });
  733. },
  734. onSelectAll: (selected, selectedRows, changeRows) => {
  735. this.setState({
  736. selectedRowKeys: []
  737. })
  738. },
  739. };
  740. const dataSources = this.state.customerArr || [];
  741. const options = dataSources.map((group, index) =>
  742. <Select.Option key={index} value={group.name}>{group.name}</Select.Option>
  743. )
  744. const hasSelected = this.state.selectedRowKeys.length > 0;
  745. const { RangePicker } = DatePicker;
  746. let departmentArr = this.state.departmentArr || [];
  747. let roleArr = this.state.roleArr || [];
  748. return (
  749. <div className="user-content">
  750. <div className="content-title">
  751. <Tabs defaultActiveKey="1" onChange={this.callback} className="test">
  752. <TabPane tab="搜索" key="1">
  753. <div className="user-search">
  754. <Input
  755. placeholder="用户姓名"
  756. style={{ width: "150px" }}
  757. value={this.state.userNameSearch}
  758. onChange={e => {
  759. this.setState({ userNameSearch: e.target.value });
  760. }}
  761. />
  762. {window.adminData.isSuperAdmin ? (
  763. <Select
  764. placeholder="部门"
  765. style={{ width: 160 }}
  766. value={this.state.organizationSearch}
  767. onChange={e => {
  768. this.setState({ organizationSearch: e });
  769. }}
  770. >
  771. {departmentArr.map(function (item) {
  772. return (
  773. <Select.Option key={item.id}>{item.name}</Select.Option>
  774. );
  775. })}
  776. </Select>
  777. ) : (
  778. ""
  779. )}
  780. <Select
  781. placeholder="角色"
  782. style={{ width: 160 }}
  783. value={this.state.rolesSearch}
  784. onChange={e => {
  785. this.setState({ rolesSearch: e });
  786. }}
  787. >
  788. {roleArr.map(function (item) {
  789. return (
  790. <Select.Option key={item.id}>
  791. {item.roleName}
  792. </Select.Option>
  793. );
  794. })}
  795. </Select>
  796. <div
  797. className="search-more"
  798. style={{ display: "inline-block" }}
  799. >
  800. <Select
  801. placeholder="职务"
  802. style={{ width: 160 }}
  803. value={this.state.postSearch}
  804. onChange={e => {
  805. this.setState({ postSearch: e });
  806. }}
  807. >
  808. {post.map(function (item) {
  809. return (
  810. <Select.Option key={item.value}>
  811. {item.key}
  812. </Select.Option>
  813. );
  814. })}
  815. </Select>
  816. <Select
  817. placeholder="岗位"
  818. style={{ width: 160 }}
  819. value={this.state.stationSearch}
  820. onChange={e => {
  821. this.setState({ stationSearch: e });
  822. }}
  823. >
  824. {station.map(function (item) {
  825. return (
  826. <Select.Option key={item.value}>
  827. {item.key}
  828. </Select.Option>
  829. );
  830. })}
  831. </Select>
  832. <Select
  833. placeholder="状态"
  834. style={{ width: 160 }}
  835. value={this.state.statusSeach}
  836. onChange={e => {
  837. this.setState({ statusSeach: e });
  838. }}
  839. >
  840. <Select.Option value={0}>正常</Select.Option>
  841. <Select.Option value={1}>锁定</Select.Option>
  842. </Select>
  843. <Input
  844. placeholder="登录用户名"
  845. style={{ width: "150px" }}
  846. value={this.state.signNameSearch}
  847. onChange={e => {
  848. this.setState({ signNameSearch: e.target.value });
  849. }}
  850. />
  851. <AutoComplete
  852. className="certain-category-search"
  853. dropdownClassName="certain-category-search-dropdown"
  854. dropdownMatchSelectWidth={false}
  855. dropdownStyle={{ width: 200 }}
  856. size="large"
  857. style={{
  858. width: "150px",
  859. height: "28px",
  860. marginLeft: "10px"
  861. }}
  862. dataSource={options}
  863. placeholder="输入上级主管名字"
  864. value={this.state.auto}
  865. onChange={this.httpChange}
  866. filterOption={true}
  867. onBlur={this.blurChange}
  868. onSelect={this.selectAuto}
  869. >
  870. <Input />
  871. </AutoComplete>
  872. </div>
  873. <Button type="primary" onClick={this.search}>
  874. 搜索
  875. </Button>
  876. <Button onClick={this.reset}>重置</Button>
  877. <Button
  878. style={{ background: "red", border: "none", color: "#fff" }}
  879. disabled={!hasSelected}
  880. onClick={this.delectRow}
  881. style={{ display: "none" }}
  882. >
  883. 删除
  884. <Icon type="minus" />
  885. </Button>
  886. {/* <span>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch} /></span> */}
  887. </div>
  888. </TabPane>
  889. <TabPane tab="操作" key="2">
  890. <Button
  891. style={{
  892. background: "#333333",
  893. border: "none",
  894. color: "#fff",
  895. marginBottom: 10,
  896. marginTop: 12,
  897. marginRight: 10
  898. }}
  899. disabled={!hasSelected}
  900. onClick={this.locking}
  901. >
  902. 锁定
  903. <Icon type="lock" />
  904. </Button>
  905. <Button
  906. style={{ background: "green", border: "none", color: "#fff", marginTop: 12 }}
  907. disabled={!hasSelected}
  908. onClick={this.activation}
  909. >
  910. 激活
  911. <Icon type="unlock" />
  912. </Button>
  913. {/* </TabPane>
  914. <TabPane tab="新增" key="3"> */}
  915. <Button
  916. type="primary"
  917. className="addButton"
  918. style={{ float: "left", marginBottom: 10, marginTop: 12 }}
  919. onClick={this.addClick}
  920. >
  921. 新增用户
  922. <Icon type="user" />
  923. </Button>
  924. {/* </TabPane>
  925. <TabPane tab="离职转交" key="4"> */}
  926. <Button
  927. type="primary"
  928. className="addButton"
  929. style={{ float: "left", marginBottom: 10, marginTop: 12 }}
  930. onClick={this.resources}
  931. disabled={!hasSelected}
  932. >
  933. 离职一键转交
  934. <Icon type="user" />
  935. </Button>
  936. </TabPane>
  937. <TabPane tab="更改表格显示数据" key="3">
  938. <div style={{ marginLeft: 10 }}>
  939. <ChooseList
  940. columns={this.state.columns}
  941. changeFn={this.changeList}
  942. changeList={this.state.changeList}
  943. top={55}
  944. margin={11}
  945. />
  946. </div>
  947. </TabPane>
  948. </Tabs>
  949. <div className="patent-table">
  950. <Spin spinning={this.state.loading}>
  951. <Table
  952. columns={
  953. this.state.changeList
  954. ? this.state.changeList
  955. : this.state.columns
  956. }
  957. style={{
  958. cursor: 'pointer',
  959. }}
  960. dataSource={this.state.dataSource}
  961. rowSelection={rowSelection}
  962. pagination={this.state.pagination}
  963. onRowClick={this.tableRowClick}
  964. />
  965. </Spin>
  966. </div>
  967. {this.state.showDesc && <Newuser
  968. role={this.state.role}
  969. addId={this.state.addId}
  970. roleArr={this.state.roleArr}
  971. departmentArr={this.state.departmentArr}
  972. userDetaile={this.state.userDetaile}
  973. datauser={this.state.datauser}
  974. showDesc={this.state.showDesc}
  975. closeDesc={this.closeDesc}
  976. />}
  977. <div className="patent-desc">
  978. <Modal
  979. maskClosable={false}
  980. visible={this.state.visible}
  981. onOk={this.checkResources}
  982. onCancel={this.handleCancel}
  983. width="800px"
  984. title="离职一键转交"
  985. footer=""
  986. className="admin-desc-content"
  987. >
  988. <Input
  989. placeholder="用户姓名"
  990. style={{
  991. width: "150px",
  992. marginRight: "10px",
  993. marginBottom: "10px"
  994. }}
  995. value={this.state.userNameSearchs}
  996. onChange={e => {
  997. this.setState({ userNameSearchs: e.target.value });
  998. }}
  999. />
  1000. <Button type="primary" onClick={this.searchs}>
  1001. 搜索
  1002. </Button>
  1003. <Button onClick={this.resets}>重置</Button>
  1004. <div className="patent-table">
  1005. <Spin spinning={this.state.loading}>
  1006. <Table
  1007. columns={this.state.column}
  1008. dataSource={this.state.dataSourceData}
  1009. pagination={this.state.paginations}
  1010. style={{
  1011. cursor: 'pointer',
  1012. }}
  1013. // onRowClick={this.tableRowClick}
  1014. />
  1015. </Spin>
  1016. </div>
  1017. </Modal>
  1018. </div>
  1019. </div>
  1020. </div>
  1021. );
  1022. }
  1023. }));
  1024. export default User;