newUser.jsx 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080
  1. import React from 'react';
  2. import { Icon, Modal, message, AutoComplete, Spin, Input, Select, Button, Form, Popconfirm, TreeSelect } from 'antd';
  3. import $ from 'jquery/src/ajax';
  4. import './userMangagement.less';
  5. import { cityArr, station, post } from '../../../dataDic.js';
  6. import { splitUrl, getNewArray } from '../../../tools.js';
  7. import moment from 'moment';
  8. import ImgList from "../../../common/imgList";
  9. import StaffSearch from '../../../../component/common/staffSearch';
  10. //图片组件
  11. const PicturesWall = React.createClass({
  12. getInitialState() {
  13. return {
  14. previewVisible: false,
  15. previewImage: '',
  16. fileList: [],
  17. role: [],
  18. district: [],
  19. cityOption: [],
  20. }
  21. },
  22. handleCancel() {
  23. this.setState({ previewVisible: false })
  24. },
  25. handlePreview(file) {
  26. this.setState({
  27. previewImage: file.url || file.thumbUrl,
  28. previewVisible: true,
  29. });
  30. },
  31. handleChange(info) {
  32. let fileList = info.fileList;
  33. this.setState({ fileList });
  34. this.props.fileList(fileList);
  35. },
  36. componentWillReceiveProps(nextProps) {
  37. this.state.fileList = nextProps.pictureUrl;
  38. },
  39. render() {
  40. const { previewVisible, previewImage, fileList } = this.state;
  41. const uploadButton = (
  42. <div>
  43. <Icon type="plus" />
  44. <div className="ant-upload-text">点击上传</div>
  45. </div>
  46. );
  47. return (
  48. <div style={{ display: "inline-block" }}>
  49. <ImgList
  50. domId={this.props.domId}
  51. uploadConfig={{
  52. action: globalConfig.context + "/api/admin/superviser/uploadAdminImg",
  53. data: { 'sign': this.props.pictureSign },
  54. multiple: true,
  55. listType: "picture-card",
  56. }}
  57. onChange={(infor) => {
  58. this.handleChange(infor)
  59. }}
  60. fileList={fileList}
  61. />
  62. </div>
  63. );
  64. }
  65. });
  66. const Newuser = Form.create()(React.createClass({
  67. getInitialState() {
  68. return {
  69. orgCodeUrl: [],
  70. loading: false,
  71. loaduser: {},
  72. datauser: [],
  73. role: [],
  74. Business: [{ reviewerName: "", reviewerId: "" }], // 公出审核
  75. Coorder: [{ reviewerName: "", reviewerId: "" }], // 协单审核
  76. superiorList: [], // 上级主管
  77. publicCarbonCopyList: [], // 公出抄送
  78. };
  79. },
  80. getDefaultProps() {
  81. return {
  82. userDetaile: false
  83. }
  84. },
  85. handleSubmit(e) {
  86. e.preventDefault();
  87. if (!this.state.role || this.state.role.length === 0) {
  88. message.warning('请选择角色');
  89. return false;
  90. };
  91. // if (!this.state.status && this.props.userDetaile) {
  92. // message.warning('请选择角色状态');
  93. // return false;
  94. // };
  95. if (window.adminData.isSuperAdmin) {
  96. if (!this.state.departmentId) {
  97. message.warning('请选择组织部门');
  98. return false;
  99. };
  100. }
  101. if (!this.state.theTypes && !this.state.superiorId) {
  102. message.warning('请输入正确的上级主管');
  103. return false;
  104. };
  105. if (!this.state.superiorList.length) {
  106. message.warning('请输入正确的上级主管');
  107. return false;
  108. } else {
  109. let flag = true;
  110. let text = '';
  111. for (let i=0; i<this.state.superiorList.length; i++) {
  112. let superiorItem = this.state.superiorList[i];
  113. if (!superiorItem.superiorId) {
  114. text = `第${idx}行请输入正确的上级主管`;
  115. flag = false;
  116. continue;
  117. } else if (this.state.Business.some(item => item.reviewerId == superiorItem.superiorId)) {
  118. text = `上级主管【${superiorItem.superior}】在公出审核人员中存在`;
  119. flag = false;
  120. continue;
  121. } else if (this.state.Coorder.some(item => item.reviewerId == superiorItem.superiorId)) {
  122. text = `上级主管【${superiorItem.superior}】在协单审核人员中存在`;
  123. flag = false;
  124. continue;
  125. } else if (this.state.managerId == superiorItem.superiorId) {
  126. text = `上级主管【${superiorItem.superior}】在经理审核人员中存在`;
  127. flag = false;
  128. continue;
  129. } else if (this.state.publicCarbonCopyList.some(item => item.publicCarbonCopy == superiorItem.superiorId)) {
  130. text = `上级主管【${superiorItem.superior}】在公出抄送人员中存在`;
  131. flag = false;
  132. continue;
  133. }
  134. }
  135. if (!flag) {
  136. message.warning(text);
  137. return false;
  138. }
  139. }
  140. if (!getNewArray(this.state.Business, "reviewerId").toString()) {
  141. message.warning('请输入正确的公出审核人');
  142. return false;
  143. }
  144. if (this.state.publicCarbonCopyList.length) {
  145. let flag = true;
  146. let text = '';
  147. for (let i=0; i<this.state.publicCarbonCopyList.length; i++) {
  148. let item = this.state.publicCarbonCopyList[i];
  149. if (item.publicCarbonCopyName && !item.publicCarbonCopy) {
  150. text = `第${i}行请输入正确的公出抄送人员`;
  151. flag = false;
  152. continue;
  153. }
  154. }
  155. if (!flag) {
  156. message.warning(text);
  157. return false;
  158. }
  159. }
  160. if (this.state.contactMobile) {
  161. if (!(/^1[1-9][0-9]\d{4,8}$/.test(this.state.contactMobile))) {
  162. message.warning("不是完整的11位手机号或者正确的手机号前七位");
  163. this.setState({
  164. loading: false
  165. });
  166. return false;
  167. }
  168. }
  169. // if (this.state.ambId == null || this.state.ambId == undefined) {
  170. // message.warning('请选择所属巴');
  171. // return false;
  172. // }
  173. let theorgCodeUrl = [];
  174. if (this.state.orgCodeUrl.length) {
  175. let picArr = [];
  176. this.state.orgCodeUrl.map(function (item) {
  177. if (item.response && item.response.data && item.response.data.length) {
  178. picArr.push(item.response.data);
  179. }
  180. });
  181. theorgCodeUrl = picArr.join(",");
  182. };
  183. let api = this.props.userDetaile ? "/api/admin/superviser/updateAdmin" : '/api/admin/superviser/insertAdmin'
  184. this.setState({
  185. loading: true
  186. });
  187. $.ajax({
  188. method: "POST",
  189. dataType: "json",
  190. crossDomain: false,
  191. url: globalConfig.context + api,
  192. data: {
  193. roles: this.state.role,
  194. data: JSON.stringify({
  195. id: this.state.id ? this.state.id : this.props.addId,
  196. mobile: this.state.mobile,
  197. seniorStaff: this.state.seniorStaff,
  198. publicPurview: this.state.publicPurview,
  199. status: this.state.status,
  200. contactMobile: this.state.contactMobile,
  201. name: this.state.name,
  202. departmentId: window.adminData.isSuperAdmin ? this.state.departmentId : window.adminData.departmentId,
  203. duty: this.state.duty,
  204. position: this.state.position,//岗位
  205. email: this.state.email,
  206. // superiorId: this.state.theTypes ? this.state.theTypes : this.state.superiorId,
  207. // superior: this.state.superiorList.map(item => item.superiorId).join(','),
  208. // reviewer: this.state.reviewer,
  209. district: this.state.district,
  210. headPortraitUrl: theorgCodeUrl.length ? theorgCodeUrl : '',
  211. entryTime: this.state.selTime,
  212. ambId: !!this.state.ambId ? this.state.ambId : null,
  213. managerId: this.state.managerId,
  214. expenseSuperExamine: this.state.expenseSuperExamine, // 报销是否需要上级审核
  215. publicCarbonCopy: this.state.publicCarbonCopy,// 公出抄送
  216. callNo: this.state.callNo, // 外呼编号
  217. teamId: this.state.teamId, // 团队
  218. }),
  219. publicReviewerIds: getNewArray(this.state.Business, "reviewerId").toString(),// 公出审核
  220. assistReviewerIds: getNewArray(this.state.Coorder, "reviewerId").toString(),// 协单审核
  221. superReviewerIds: this.state.superiorList.map(item => item.superiorId).join(','), // 上级主管
  222. carbonCopyReviewerIds: this.state.publicCarbonCopyList.map(item => item.publicCarbonCopy).join(',') // 公出推送
  223. }
  224. }).done(function (data) {
  225. this.setState({
  226. loading: false
  227. });
  228. if (!data.error.length) {
  229. message.success('保存成功!');
  230. this.handleOk();
  231. } else {
  232. message.warning(data.error[0].message);
  233. }
  234. }.bind(this));
  235. },
  236. //主管初始加载(自动补全)
  237. supervisor(e) {
  238. $.ajax({
  239. method: "post",
  240. dataType: "json",
  241. crossDomain: false,
  242. url: globalConfig.context + "/api/admin/organization/selectName",
  243. data: {
  244. name: e
  245. },
  246. success: function (data) {
  247. let thedata = data.data;
  248. if (!thedata) {
  249. if (data.error && data.error.length) {
  250. message.warning(data.error[0].message);
  251. };
  252. thedata = {};
  253. };
  254. this.setState({
  255. customerArr: thedata,
  256. });
  257. }.bind(this),
  258. }).always(function () {
  259. this.setState({
  260. loading: false
  261. });
  262. }.bind(this));
  263. },
  264. //上级主管输入框失去焦点是判断客户是否存在
  265. selectAuto(value, idx) {
  266. let theType = '';
  267. let contactLists = this.state.customerArr || [];
  268. if (value) {
  269. contactLists.map(function (item) {
  270. if (item.name === value.toString()) {
  271. theType = item.id;
  272. }
  273. });
  274. }
  275. const { superiorList } = this.state;
  276. superiorList[idx].superiorId = theType;
  277. superiorList[idx].superior = value;
  278. this.setState({
  279. // theTypes: theType,
  280. // superior: value
  281. superiorList
  282. })
  283. if (!this.state.reviewerName || !this.state.reviewer) {
  284. this.setState({
  285. reviewerName: value,
  286. reviewer: theType
  287. })
  288. }
  289. },
  290. //值改变时请求客户名称
  291. httpChange(e, idx) {
  292. if (e.length >= 1) {
  293. this.supervisor(e);
  294. }
  295. const { superiorList } = this.state;
  296. superiorList[idx].superior = e;
  297. this.setState({
  298. superiorList
  299. })
  300. },
  301. //查看基本详情基本信息
  302. loaduser(record) {
  303. if (record) {
  304. $.ajax({
  305. method: "post",
  306. dataType: "json",
  307. crossDomain: false,
  308. url: globalConfig.context + '/api/admin/superviser/selectAllByid',
  309. data: {
  310. id: record.id
  311. },
  312. success: function (data) {
  313. let thisdata = data.data;
  314. if (!thisdata) {
  315. if (data.error && data.error.length) {
  316. message.warning(data.error[0].message);
  317. };
  318. thisdata = {};
  319. };
  320. // let superiorList = [];
  321. // let superiorIdArr = thisdata.superiorId ? thisdata.superiorId.toString().split(',') : [];
  322. // let superiorArr = thisdata.superior ? thisdata.superior.toString().split(',') : [];
  323. // superiorIdArr.map((id, idx) => {
  324. // superiorList.push({ superiorId: id, superior: superiorArr[idx] });
  325. // })
  326. this.setState({
  327. id: thisdata.id,
  328. mobile: thisdata.mobile,
  329. name: thisdata.name,
  330. email: thisdata.email,
  331. createTime: thisdata.createTime,
  332. district: thisdata.district != ' ' ? JSON.parse(thisdata.district) : undefined,
  333. position: thisdata.position ? thisdata.position : undefined,
  334. superior: thisdata.superior,
  335. superiorId: thisdata.superiorId,//上级Id
  336. // superiorList, // 上级list
  337. reviewerName: thisdata.reviewerName,
  338. reviewer: thisdata.reviewer, // 公出审核人
  339. managerName: thisdata.managerName,
  340. managerId: thisdata.managerId, // 经理审核
  341. theTypes: '',
  342. duty: thisdata.duty ? thisdata.duty : undefined,//职务
  343. publicPurview: thisdata.publicPurview,
  344. seniorStaff: thisdata.seniorStaff,
  345. status: Number(thisdata.status),
  346. contactMobile: thisdata.contactMobile ? thisdata.contactMobile : undefined,//手机号
  347. departmentId: thisdata.departmentId ? thisdata.departmentId : undefined,//部门id
  348. userNo: thisdata.userNo,
  349. orgCodeUrl: thisdata.headPortraitUrl ? splitUrl(thisdata.headPortraitUrl, ',', globalConfig.avatarHost + '/upload') : [],
  350. role: this.props.role,
  351. entryTime: thisdata.entryTime ? moment(thisdata.entryTime, 'YYYY-MM-DD') : undefined,
  352. selTime: thisdata.entryTime,
  353. ambId: !!thisdata.ambId && Number(thisdata.ambId), // 分巴id
  354. expenseSuperExamine: thisdata.expenseSuperExamine, // 报销是否需要上级主管审核
  355. publicCarbonCopy: thisdata.publicCarbonCopy, // 公出抄送
  356. publicCarbonCopyName: thisdata.publicCarbonCopyName,
  357. callNo: thisdata.callNo, // 外呼编号
  358. teamId: thisdata.teamId, // 团队
  359. });
  360. }.bind(this),
  361. }).always(function () {
  362. this.setState({
  363. loading: false
  364. });
  365. }.bind(this));
  366. }
  367. },
  368. getReviewer(record) {
  369. if (record) {
  370. $.ajax({
  371. method: "get",
  372. dataType: "json",
  373. crossDomain: false,
  374. url: globalConfig.context + '/api/admin/superviser/publicReviewer',
  375. data: {
  376. id: record.id
  377. },
  378. success: function (data) {
  379. let thisdata = data.data;
  380. if (!thisdata) {
  381. if (data.error && data.error.length) {
  382. message.warning(data.error[0].message);
  383. };
  384. thisdata = {};
  385. };
  386. let superiorList = [{ superior: '', superiorId: '' }];
  387. if (thisdata.superReviewer.length) {
  388. superiorList = thisdata.superReviewer.map(item => {
  389. return { superior: item.reviewerName, superiorId: item.reviewerId };
  390. })
  391. }
  392. let publicCarbonCopyList = [{ publicCarbonCopyName: '', publicCarbonCopy: '' }];
  393. if (thisdata.carbonCopyReviewer.length) {
  394. publicCarbonCopyList = thisdata.carbonCopyReviewer.map(item => {
  395. return { publicCarbonCopyName: item.reviewerName, publicCarbonCopy: item.reviewerId }
  396. });
  397. }
  398. this.setState({
  399. Business: thisdata.publicReviewer.length > 0 ? thisdata.publicReviewer : [{ reviewerName: "", reviewerId: "" }],
  400. Coorder: thisdata.assistReviewer.length > 0 ? thisdata.assistReviewer : [{ reviewerName: "", reviewerId: "" }],
  401. superiorList,
  402. publicCarbonCopyList,
  403. });
  404. }.bind(this),
  405. }).always(function () {
  406. this.setState({
  407. loading: false
  408. });
  409. }.bind(this));
  410. }
  411. },
  412. //重置密码
  413. resetPwd() {
  414. this.setState({
  415. loading: true
  416. })
  417. $.ajax({
  418. type: 'post',
  419. url: globalConfig.context + "/api/admin/superviser/resetPwd",
  420. dataType: "json",
  421. data: {
  422. id: this.props.datauser.id
  423. },
  424. }).done((res) => {
  425. if (res.error && res.error.length) {
  426. message.error(res.error[0].message);
  427. } else {
  428. message.success("密码重置成功");
  429. }
  430. }).always(() => {
  431. this.setState({
  432. loading: false
  433. })
  434. });
  435. },
  436. handleOk(e) {
  437. this.props.closeDesc(false, true);
  438. },
  439. handleCancel(e) {
  440. this.props.closeDesc(false);
  441. },
  442. //入职时间选择
  443. selTime(e, index) {
  444. this.setState({
  445. entryTime: e,
  446. selTime: index
  447. })
  448. },
  449. getOrgCodeUrl(e) {
  450. this.setState({ orgCodeUrl: e });
  451. },
  452. componentWillMount(e) {
  453. const cityArrs = [];
  454. cityArr.map(function (item) {
  455. cityArrs.push(
  456. <Select.Option key={item.value}>{item.key}</Select.Option>
  457. )
  458. });
  459. this.state.cityOption = cityArrs;
  460. },
  461. componentDidMount() {
  462. if (this.props.datauser.id) {
  463. this.loaduser(this.props.datauser)
  464. this.getReviewer(this.props.datauser)
  465. this.setState({
  466. rolek: this.props.role
  467. })
  468. }
  469. },
  470. add() {
  471. const { Coorder } = this.state;
  472. let arr = Coorder
  473. let obj = { title: "", value: "" }
  474. arr.push(obj)
  475. this.setState({
  476. Coorder: arr
  477. })
  478. },
  479. remove(i) {
  480. const { Coorder } = this.state;
  481. let arr = Coorder
  482. arr.splice(i, 1)
  483. this.setState({
  484. Coorder: arr
  485. })
  486. },
  487. add1() {
  488. const { Business } = this.state;
  489. let arr = Business
  490. let obj = { title: "", value: "" }
  491. arr.push(obj)
  492. this.setState({
  493. Business: arr
  494. })
  495. },
  496. remove1(i) {
  497. const { Business } = this.state;
  498. let arr = Business
  499. arr.splice(i, 1)
  500. this.setState({
  501. Business: arr
  502. })
  503. },
  504. addSupersor() {
  505. const { superiorList } = this.state;
  506. superiorList.push({ superiorId: '', superior: '' });
  507. this.setState({ superiorList });
  508. },
  509. removeSupersor(idx) {
  510. this.state.superiorList.splice(idx, 1)
  511. this.setState({
  512. superiorList: this.state.superiorList
  513. });
  514. },
  515. addPublicCarbonCopy() {
  516. const { publicCarbonCopyList } = this.state;
  517. publicCarbonCopyList.push({ publicCarbonCopy: '', publicCarbonCopyName: '' });
  518. this.setState({ publicCarbonCopyList });
  519. },
  520. removePublicCarbonCopy(idx) {
  521. this.state.publicCarbonCopyList.splice(idx, 1)
  522. this.setState({
  523. publicCarbonCopyList: this.state.publicCarbonCopyList
  524. });
  525. },
  526. render() {
  527. const { Coorder, Business } = this.state
  528. const FormItem = Form.Item
  529. const formItemLayout = {
  530. labelCol: { span: 8 },
  531. wrapperCol: { span: 14 },
  532. };
  533. const dataSources = this.state.customerArr || [];
  534. const options = dataSources.map((group, index) =>
  535. <Select.Option key={index} value={group.name}>{group.name}</Select.Option>
  536. )
  537. const departmentArr = this.props.departmentArr || [];
  538. const roleArrS = this.props.roleArr || [];
  539. const rolst = this.state.rolek || [];
  540. return (
  541. <div>
  542. <Modal maskClosable={false} visible={this.props.showDesc}
  543. onOk={this.handleOk} onCancel={this.handleCancel}
  544. width='1000px'
  545. title={this.props.userDetaile ? '用户详情' : '新建用户'}
  546. footer=''
  547. className="admin-desc-content">
  548. <Form layout="horizontal" onSubmit={this.handleSubmit} id="demand-form">
  549. <Spin spinning={this.state.loading}>
  550. <div className="clearfix">
  551. <div className="clearfix">
  552. <FormItem className="half-item"
  553. {...formItemLayout}
  554. label="用户名" >
  555. <Input placeholder="输入登录用户名" value={this.state.mobile}
  556. onChange={(e) => { this.setState({ mobile: e.target.value }) }} required="required" style={{ width: '200px' }} />
  557. <span className="mandatory">*</span>
  558. </FormItem>
  559. {this.props.userDetaile ?
  560. <Popconfirm
  561. title={"用户 [ " + this.props.datauser.name + " ] 的密码将会重置为123456,确认操作?"}
  562. onConfirm={this.resetPwd}
  563. okText="确认"
  564. cancelText="取消"
  565. placement="topLeft">
  566. <Button>重置密码</Button>
  567. </Popconfirm> : ''}
  568. </div>
  569. <FormItem className="half-item"
  570. {...formItemLayout}
  571. label="用户角色"
  572. >
  573. {roleArrS.length > 0 ?
  574. <Select
  575. mode="multiple"
  576. optionFilterProp={'title'}
  577. tokenSeparators={[',']}
  578. placeholder="选择用户角色"
  579. value={this.state.role}
  580. style={{ width: '200px', minHeight: '59px' }}
  581. onChange={(e) => {
  582. this.setState({
  583. role: e
  584. })
  585. }}>
  586. {
  587. roleArrS.map(function (item, _) {
  588. return <Select.Option title={item.roleName} value={item.id}>{item.roleName}</Select.Option>
  589. })
  590. }
  591. </Select> : null
  592. }
  593. <span className="mandatory">*</span>
  594. </FormItem>
  595. <FormItem className="half-item"
  596. {...formItemLayout}
  597. label=""
  598. >
  599. <span style={{ display: rolst.length > 1 ? 'block' : 'none', color: 'red' }}>存在多个角色</span>
  600. </FormItem>
  601. <FormItem className="half-item"
  602. {...formItemLayout}
  603. label="员工" >
  604. <Select
  605. placeholder="请选择"
  606. value={this.state.seniorStaff}
  607. style={{ width: '200px' }}
  608. onChange={(e) => { this.setState({ seniorStaff: e }) }}
  609. >
  610. <Select.Option value={0} >新员工</Select.Option>
  611. <Select.Option value={1} >老员工</Select.Option>
  612. </Select>
  613. <span className="mandatory">*</span>
  614. </FormItem>
  615. {this.props.userDetaile ? <FormItem className="half-item"
  616. {...formItemLayout}
  617. label="用户状态" >
  618. <Select
  619. placeholder="用户状态"
  620. value={this.state.status}
  621. style={{ width: '200px' }}
  622. onChange={(e) => { this.setState({ status: e }) }}
  623. >
  624. <Select.Option value={0} >正常</Select.Option>
  625. <Select.Option value={1} >锁定</Select.Option>
  626. </Select>
  627. <span className="mandatory">*</span>
  628. </FormItem> : ''}
  629. <FormItem className="half-item"
  630. {...formItemLayout}
  631. label="用户姓名" >
  632. <Input placeholder="请输入用户姓名" style={{ width: '200px' }} value={this.state.name}
  633. onChange={(e) => { this.setState({ name: e.target.value }) }} required="required" />
  634. <span className="mandatory">*</span>
  635. </FormItem>
  636. <FormItem className="half-item"
  637. {...formItemLayout}
  638. label="联系方式" >
  639. <Input placeholder="请输入手机号" style={{ width: '200px' }} value={this.state.contactMobile}
  640. onChange={(e) => { this.setState({ contactMobile: e.target.value }) }} />
  641. </FormItem>
  642. {/*<FormItem className="half-item"
  643. {...formItemLayout}
  644. label="入职时间" >
  645. <DatePicker
  646. style={{marginTop:'0',width:'200px',height:'27px'}}
  647. showTime
  648. format="YYYY-MM-DD"
  649. placeholder="选择入职时间"
  650. value={this.state.entryTime}
  651. onChange={(e,time)=>{this.selTime(e,time)}}
  652. />
  653. </FormItem>*/}
  654. {window.adminData.isSuperAdmin ? <FormItem className="half-item"
  655. {...formItemLayout}
  656. label="组织部门" >
  657. <Select placeholder="选择组织部门"
  658. style={{ width: 200 }}
  659. value={this.state.departmentId}
  660. onChange={(e) => { this.setState({ departmentId: e }) }}>
  661. {
  662. departmentArr.map(function (item) {
  663. return <Select.Option key={item.id} >{item.name}</Select.Option>
  664. })
  665. }
  666. </Select>
  667. <span className="mandatory">*</span>
  668. </FormItem> : ''}
  669. <FormItem className="half-item"
  670. {...formItemLayout}
  671. label="职务"
  672. >
  673. <Select placeholder="选择职务" style={{ width: '200px' }} value={this.state.duty} onChange={(e) => { this.setState({ duty: e }) }}>
  674. {
  675. post.map(function (item) {
  676. return <Select.Option key={item.value} >{item.key}</Select.Option>
  677. })
  678. }
  679. </Select>
  680. </FormItem>
  681. <FormItem className="half-item"
  682. {...formItemLayout}
  683. label="岗位"
  684. >
  685. <Select placeholder="选择岗位" style={{ width: '200px' }} value={this.state.position} onChange={(e) => { this.setState({ position: e }) }}>
  686. {
  687. station.map(function (item) {
  688. return <Select.Option key={item.value} >{item.key}</Select.Option>
  689. })
  690. }
  691. </Select>
  692. </FormItem>
  693. <FormItem className="half-item"
  694. {...formItemLayout}
  695. label="电子邮箱" >
  696. <Input placeholder="请输入邮箱" style={{ width: '200px' }} value={this.state.email}
  697. onChange={(e) => { this.setState({ email: e.target.value }) }} />
  698. </FormItem>
  699. <FormItem className="half-item"
  700. {...formItemLayout}
  701. label="上级主管"
  702. >
  703. {this.state.superiorList.map((item, idx) => (
  704. <div style={{ display: 'flex', alignItems: 'center', padding: '5px 0' }}>
  705. <AutoComplete
  706. className="certain-category-search"
  707. dropdownClassName="certain-category-search-dropdown"
  708. dropdownMatchSelectWidth={false}
  709. size="large"
  710. style={{ width: '200px' }}
  711. dataSource={options}
  712. placeholder="输入名称"
  713. value={item.superior}
  714. onChange={e=> {this.httpChange(e, idx)}}
  715. filterOption={true}
  716. onSelect={value => {this.selectAuto(value, idx)}}
  717. >
  718. <Input />
  719. </AutoComplete>
  720. <span className="mandatory">*</span>
  721. <div style={{ width: 25, display: "inline-block" }}>
  722. {this.state.superiorList.length > 1 ? (
  723. <Icon
  724. className="dynamic-delete-button"
  725. type="minus-circle-o"
  726. disabled={this.state.superiorList.length === 1}
  727. onClick={() => this.removeSupersor(idx)}
  728. />
  729. ) : null}
  730. </div>
  731. { idx === 0 && <Button style={{ marginLeft: 10 }} size="small" type="primary" onClick={this.addSupersor}>新增</Button> }
  732. </div>
  733. ))}
  734. </FormItem>
  735. <FormItem className="half-item"
  736. {...formItemLayout}
  737. label="报销是否需上级主管审核"
  738. >
  739. <Select
  740. placeholder="请选择"
  741. value={this.state.expenseSuperExamine}
  742. style={{ width: '200px' }}
  743. onChange={(e) => { this.setState({ expenseSuperExamine: e }) }}
  744. >
  745. <Select.Option value={0} >否</Select.Option>
  746. <Select.Option value={1} >是</Select.Option>
  747. </Select>
  748. </FormItem>
  749. {this.props.userDetaile ?
  750. <FormItem className="half-item"
  751. {...formItemLayout}
  752. label="用户编号" >
  753. <span>{this.state.userNo}</span>
  754. </FormItem>
  755. : ''}
  756. <div className='clearfix'>
  757. <FormItem className="half-item"
  758. {...formItemLayout}
  759. label='公出审核'
  760. >
  761. {
  762. Business.map((k, index) =>
  763. <div key={index}>
  764. <StaffSearch
  765. valueName={k.reviewerName}
  766. placeholder="输入名称"
  767. width={200}
  768. onBlurText={e => {
  769. let newBusiness = Business
  770. for (var i = 0; i < newBusiness.length; i++) {
  771. if (index == i) {
  772. newBusiness[i].reviewerName = e.title
  773. }
  774. }
  775. this.setState({
  776. Business: newBusiness
  777. })
  778. }}
  779. onBlurChange={(e) => {
  780. let newBusiness = Business
  781. for (var i = 0; i < newBusiness.length; i++) {
  782. if (index == i) {
  783. newBusiness[i].reviewerId = e.value
  784. }
  785. }
  786. this.setState({
  787. Business: newBusiness
  788. })
  789. }}
  790. />
  791. <div style={{ width: 25, display: "inline-block" }}>
  792. {Business.length > 1 ? (
  793. <Icon
  794. className="dynamic-delete-button"
  795. type="minus-circle-o"
  796. disabled={Business.length === 1}
  797. onClick={() => this.remove1(index)}
  798. />
  799. ) : null}
  800. </div>
  801. {index === 0 && <Button style={{ marginLeft: 10 }} size="small" type="primary" onClick={this.add1}>新增</Button>}
  802. </div>
  803. )
  804. }
  805. </FormItem>
  806. <FormItem className="half-item"
  807. {...formItemLayout}
  808. label="经理审核"
  809. >
  810. <StaffSearch
  811. valueName={this.state.managerName}
  812. placeholder="输入名称"
  813. onBlurText={e => {
  814. this.setState({
  815. managerName: e.title
  816. })
  817. }}
  818. onBlurChange={(obj) => {
  819. this.setState({
  820. managerId: obj.value,
  821. })
  822. }}
  823. />
  824. <Icon
  825. className="dynamic-delete-button"
  826. type="minus-circle-o"
  827. onClick={() => {
  828. this.setState({
  829. managerName: '',
  830. managerId: ''
  831. });
  832. }}
  833. />
  834. </FormItem>
  835. </div>
  836. <div className='clearfix'>
  837. <FormItem className="half-item"
  838. {...formItemLayout}
  839. label='协单审核'
  840. >
  841. {
  842. Coorder.map((k, index) =>
  843. <div key={index}>
  844. <StaffSearch
  845. valueName={k.reviewerName}
  846. placeholder="输入名称"
  847. width={200}
  848. onBlurText={e => {
  849. let newCoorder = Coorder
  850. for (var i = 0; i < newCoorder.length; i++) {
  851. if (index == i) {
  852. newCoorder[i].reviewerName = e.title
  853. }
  854. }
  855. this.setState({
  856. Coorder: newCoorder
  857. })
  858. }}
  859. onBlurChange={(e) => {
  860. let newCoorder = Coorder
  861. for (var i = 0; i < newCoorder.length; i++) {
  862. if (index == i) {
  863. newCoorder[i].reviewerId = e.value
  864. }
  865. }
  866. this.setState({
  867. Coorder: newCoorder
  868. })
  869. }}
  870. />
  871. <div style={{ width: 25, display: "inline-block" }} >
  872. {Coorder.length > 1 ? (
  873. <Icon
  874. className="dynamic-delete-button"
  875. type="minus-circle-o"
  876. disabled={Coorder.length === 1}
  877. onClick={() => this.remove(index)}
  878. />
  879. ) : null}
  880. </div>
  881. {index === 0 && <Button style={{ marginLeft: 10 }} size="small" type="primary" onClick={this.add}>新增</Button>}
  882. </div>
  883. )
  884. }
  885. </FormItem>
  886. <FormItem className="half-item"
  887. {...formItemLayout}
  888. label="公出抄送"
  889. >
  890. { this.state.publicCarbonCopyList.map((item, idx) => (
  891. <div style={{ display: 'flex', alignItems: 'center', padding: '5px 0' }}>
  892. <StaffSearch
  893. valueName={item.publicCarbonCopyName}
  894. placeholder="输入名称"
  895. onBlurText={e => {
  896. const { publicCarbonCopyList } = this.state;
  897. publicCarbonCopyList[idx].publicCarbonCopyName = e.title;
  898. this.setState({
  899. // publicCarbonCopyName: e.title
  900. publicCarbonCopyList
  901. })
  902. }}
  903. onBlurChange={(obj) => {
  904. const { publicCarbonCopyList } = this.state;
  905. publicCarbonCopyList[idx].publicCarbonCopy = obj.value;
  906. this.setState({
  907. // publicCarbonCopy: obj.value,
  908. publicCarbonCopyList
  909. })
  910. }}
  911. />
  912. <div style={{ width: 25, display: "inline-block" }}>
  913. {this.state.publicCarbonCopyList.length > 1 ? (
  914. <Icon
  915. className="dynamic-delete-button"
  916. type="minus-circle-o"
  917. disabled={this.state.publicCarbonCopyList.length === 1}
  918. onClick={() => this.removePublicCarbonCopy(idx)}
  919. />
  920. ) : null}
  921. </div>
  922. { idx === 0 && <Button style={{ marginLeft: 10 }} size="small" type="primary" onClick={this.addPublicCarbonCopy}>新增</Button> }
  923. </div>
  924. )) }
  925. </FormItem>
  926. </div>
  927. <div className='clearfix'>
  928. <FormItem className="half-item"
  929. {...formItemLayout}
  930. label="业务员"
  931. >
  932. <Select
  933. placeholder="请选择"
  934. value={this.state.publicPurview}
  935. style={{ width: '200px' }}
  936. onChange={(e) => { this.setState({ publicPurview: e }) }}
  937. >
  938. <Select.Option value={0} >否</Select.Option>
  939. <Select.Option value={1} >是</Select.Option>
  940. </Select>
  941. </FormItem>
  942. <FormItem className="half-item"
  943. {...formItemLayout}
  944. label="外呼编号" >
  945. <Input placeholder="请输入外呼编号" style={{ width: '200px' }} value={this.state.callNo}
  946. onChange={(e) => { this.setState({ callNo: e.target.value }) }} />
  947. </FormItem>
  948. </div>
  949. <div className='clearfix'>
  950. <FormItem className="half-item"
  951. {...formItemLayout}
  952. label="地区" >
  953. <Select
  954. multiple
  955. style={{ width: '685px' }}
  956. placeholder="选择地区"
  957. filterOption={(input, option) => { return option.props.children.indexOf(input) >= 0 }}
  958. value={this.state.district}
  959. onChange={(pids) => {
  960. this.state.district = pids;
  961. this.setState({
  962. district: this.state.district
  963. })
  964. }}
  965. >
  966. {this.state.cityOption}
  967. </Select>
  968. </FormItem>
  969. </div>
  970. <div className="clearfix">
  971. <FormItem
  972. className="half-item"
  973. {...formItemLayout}
  974. label="分巴"
  975. >
  976. <TreeSelect
  977. style={{ width: 200 }}
  978. value={this.state.ambId}
  979. dropdownStyle={{ maxHeight: 300, overflow: 'auto' }}
  980. treeData={this.props.level1Data}
  981. placeholder="请选择"
  982. showSearch
  983. treeNodeFilterProp="title"
  984. onChange={(e) => {
  985. this.setState({
  986. ambId: e,
  987. });
  988. }}
  989. />
  990. </FormItem>
  991. <FormItem
  992. className="half-item"
  993. {...formItemLayout}
  994. label="团队"
  995. >
  996. <TreeSelect
  997. style={{ width: 200 }}
  998. value={this.state.teamId}
  999. dropdownStyle={{ maxHeight: 300, overflow: 'auto' }}
  1000. treeData={this.props.teamList}
  1001. placeholder="请选择团队"
  1002. showSearch
  1003. treeNodeFilterProp="title"
  1004. onChange={(e) => {
  1005. this.setState({
  1006. teamId: e,
  1007. });
  1008. }}
  1009. />
  1010. {/* <Select
  1011. placeholder="上级团队"
  1012. style={{ width: 200 }}
  1013. value={this.state.teamId}
  1014. onChange={e => {
  1015. this.setState({
  1016. teamId: e,
  1017. });
  1018. }}
  1019. >
  1020. {this.props.teamList.map(function (item) {
  1021. return (
  1022. <Select.Option key={item.id} value={item.id}>{item.name}</Select.Option>
  1023. );
  1024. })}
  1025. </Select> */}
  1026. </FormItem>
  1027. </div>
  1028. <div className="clearfix">
  1029. <FormItem
  1030. className="half-item"
  1031. {...formItemLayout}
  1032. label="用户头像"
  1033. >
  1034. <PicturesWall
  1035. domId={'newUser1'}
  1036. pictureSign="customer_sys_file"
  1037. fileList={this.getOrgCodeUrl}
  1038. pictureUrl={this.state.orgCodeUrl} />
  1039. <p>图片建议:要清晰。</p>
  1040. </FormItem>
  1041. </div>
  1042. </div>
  1043. <FormItem wrapperCol={{ span: 12, offset: 4 }}>
  1044. <Button className="set-submit" type="primary" htmlType="submit">保存</Button>
  1045. <Button className="set-submit" type="ghost" onClick={this.handleCancel}>取消</Button>
  1046. </FormItem>
  1047. </Spin>
  1048. </Form >
  1049. </Modal>
  1050. </div>
  1051. )
  1052. }
  1053. }));
  1054. export default Newuser;