newUser.jsx 32 KB

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