newUser.jsx 32 KB

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