newUser.jsx 33 KB

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