newUser.jsx 41 KB

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