|
@@ -3,7 +3,7 @@ import { Icon, Modal, message, AutoComplete, Spin, Input, Select, Button, Form,
|
|
|
import $ from 'jquery/src/ajax';
|
|
|
import './userMangagement.less';
|
|
|
import { cityArr, station, post } from '../../../dataDic.js';
|
|
|
-import { splitUrl } from '../../../tools.js';
|
|
|
+import { splitUrl, getNewArray } from '../../../tools.js';
|
|
|
import moment from 'moment';
|
|
|
import ImgList from "../../../common/imgList";
|
|
|
|
|
@@ -73,7 +73,9 @@ const Newuser = Form.create()(React.createClass({
|
|
|
loading: false,
|
|
|
loaduser: {},
|
|
|
datauser: [],
|
|
|
- role: []
|
|
|
+ role: [],
|
|
|
+ Business: [{ reviewerName: "", reviewerId: "" }], // 公出审核
|
|
|
+ Coorder: [{ reviewerName: "", reviewerId: "" }], // 协单审核
|
|
|
};
|
|
|
},
|
|
|
getDefaultProps() {
|
|
@@ -101,7 +103,7 @@ const Newuser = Form.create()(React.createClass({
|
|
|
message.warning('请输入正确的上级主管');
|
|
|
return false;
|
|
|
};
|
|
|
- if (!this.state.reviewer) {
|
|
|
+ if (!getNewArray(this.state.Business, "value").toString()) {
|
|
|
message.warning('请输入正确的公出审核人');
|
|
|
return false;
|
|
|
}
|
|
@@ -152,7 +154,7 @@ const Newuser = Form.create()(React.createClass({
|
|
|
position: this.state.position,//岗位
|
|
|
email: this.state.email,
|
|
|
superiorId: this.state.theTypes ? this.state.theTypes : this.state.superiorId,
|
|
|
- reviewer: this.state.reviewer,
|
|
|
+ // reviewer: this.state.reviewer,
|
|
|
district: this.state.district,
|
|
|
headPortraitUrl: theorgCodeUrl.length ? theorgCodeUrl : '',
|
|
|
entryTime: this.state.selTime,
|
|
@@ -160,7 +162,9 @@ const Newuser = Form.create()(React.createClass({
|
|
|
managerId: this.state.managerId,
|
|
|
expenseSuperExamine: this.state.expenseSuperExamine, // 报销是否需要上级审核
|
|
|
publicCarbonCopy: this.state.publicCarbonCopy,// 公出抄送
|
|
|
- })
|
|
|
+ }),
|
|
|
+ publicReviewerIds: getNewArray(this.state.Business, "reviewerId").toString(),// 公出审核
|
|
|
+ assistReviewerIds: getNewArray(this.state.Coorder, "reviewerId").toString(),// 协单审核
|
|
|
}
|
|
|
}).done(function (data) {
|
|
|
this.setState({
|
|
@@ -291,6 +295,36 @@ const Newuser = Form.create()(React.createClass({
|
|
|
}.bind(this));
|
|
|
}
|
|
|
},
|
|
|
+ getReviewer(record) {
|
|
|
+ if (record) {
|
|
|
+ $.ajax({
|
|
|
+ method: "get",
|
|
|
+ dataType: "json",
|
|
|
+ crossDomain: false,
|
|
|
+ url: globalConfig.context + '/api/admin/superviser/publicReviewer',
|
|
|
+ data: {
|
|
|
+ id: record.id
|
|
|
+ },
|
|
|
+ success: function (data) {
|
|
|
+ let thisdata = data.data;
|
|
|
+ if (!thisdata) {
|
|
|
+ if (data.error && data.error.length) {
|
|
|
+ message.warning(data.error[0].message);
|
|
|
+ };
|
|
|
+ thisdata = {};
|
|
|
+ };
|
|
|
+ this.setState({
|
|
|
+ Business: thisdata.publicReviewer.length > 0 ? thisdata.publicReviewer : [{ reviewerName: "", reviewerId: "" }],
|
|
|
+ Coorder: thisdata.assistReviewer.length > 0 ? thisdata.assistReviewer : [{ reviewerName: "", reviewerId: "" }],
|
|
|
+ });
|
|
|
+ }.bind(this),
|
|
|
+ }).always(function () {
|
|
|
+ this.setState({
|
|
|
+ loading: false
|
|
|
+ });
|
|
|
+ }.bind(this));
|
|
|
+ }
|
|
|
+ },
|
|
|
//重置密码
|
|
|
resetPwd() {
|
|
|
this.setState({
|
|
@@ -343,13 +377,54 @@ const Newuser = Form.create()(React.createClass({
|
|
|
componentDidMount() {
|
|
|
if (this.props.datauser.id) {
|
|
|
this.loaduser(this.props.datauser)
|
|
|
+ this.getReviewer(this.props.datauser)
|
|
|
this.setState({
|
|
|
rolek: this.props.role
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
|
|
|
+ add() {
|
|
|
+ const { Coorder } = this.state;
|
|
|
+ let arr = Coorder
|
|
|
+ let obj = { title: "", value: "" }
|
|
|
+ arr.push(obj)
|
|
|
+ this.setState({
|
|
|
+ Coorder: arr
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ remove(i) {
|
|
|
+ const { Coorder } = this.state;
|
|
|
+ let arr = Coorder
|
|
|
+ arr.splice(i, 1)
|
|
|
+ this.setState({
|
|
|
+ Coorder: arr
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ add1() {
|
|
|
+ const { Business } = this.state;
|
|
|
+ let arr = Business
|
|
|
+ let obj = { title: "", value: "" }
|
|
|
+ arr.push(obj)
|
|
|
+ this.setState({
|
|
|
+ Business: arr
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ remove1(i) {
|
|
|
+ const { Business } = this.state;
|
|
|
+ let arr = Business
|
|
|
+ arr.splice(i, 1)
|
|
|
+ this.setState({
|
|
|
+ Business: arr
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
render() {
|
|
|
+ const { Coorder, Business } = this.state
|
|
|
const FormItem = Form.Item
|
|
|
const formItemLayout = {
|
|
|
labelCol: { span: 8 },
|
|
@@ -362,11 +437,12 @@ const Newuser = Form.create()(React.createClass({
|
|
|
const departmentArr = this.props.departmentArr || [];
|
|
|
const roleArrS = this.props.roleArr || [];
|
|
|
const rolst = this.state.rolek || [];
|
|
|
+
|
|
|
return (
|
|
|
<div>
|
|
|
<Modal maskClosable={false} visible={this.props.showDesc}
|
|
|
onOk={this.handleOk} onCancel={this.handleCancel}
|
|
|
- width='800px'
|
|
|
+ width='1000px'
|
|
|
title={this.props.userDetaile ? '用户详情' : '新建用户'}
|
|
|
footer=''
|
|
|
className="admin-desc-content">
|
|
@@ -564,49 +640,154 @@ const Newuser = Form.create()(React.createClass({
|
|
|
<span>{this.state.userNo}</span>
|
|
|
</FormItem>
|
|
|
: ''}
|
|
|
- <FormItem className="half-item"
|
|
|
- {...formItemLayout}
|
|
|
- label="公出审核"
|
|
|
- >
|
|
|
- <StaffSearch
|
|
|
- valueName={this.state.reviewerName}
|
|
|
- placeholder="输入名称"
|
|
|
- onBlurText={e => {
|
|
|
- this.setState({
|
|
|
- reviewerName: e.title
|
|
|
- })
|
|
|
- }}
|
|
|
- onBlurChange={(obj) => {
|
|
|
- this.setState({
|
|
|
- reviewer: obj.value,
|
|
|
- })
|
|
|
- }}
|
|
|
- />
|
|
|
- <span className="mandatory">*</span>
|
|
|
- </FormItem>
|
|
|
- <FormItem className="half-item"
|
|
|
- {...formItemLayout}
|
|
|
- label="经理审核"
|
|
|
- >
|
|
|
- <StaffSearch
|
|
|
- valueName={this.state.managerName}
|
|
|
- placeholder="输入名称"
|
|
|
- onBlurText={e => {
|
|
|
- this.setState({
|
|
|
- managerName: e.title
|
|
|
- })
|
|
|
- }}
|
|
|
- onBlurChange={(obj) => {
|
|
|
- this.setState({
|
|
|
- managerId: obj.value,
|
|
|
- })
|
|
|
- }}
|
|
|
- />
|
|
|
- </FormItem>
|
|
|
|
|
|
- <FormItem className="half-item"
|
|
|
+ <div className='clearfix'>
|
|
|
+ <FormItem className="half-item"
|
|
|
+ {...formItemLayout}
|
|
|
+ label='公出审核'
|
|
|
+ >
|
|
|
+ {
|
|
|
+ Business.map((k, index) =>
|
|
|
+ <div key={index}>
|
|
|
+ <StaffSearch
|
|
|
+ valueName={k.reviewerName}
|
|
|
+ placeholder="输入名称"
|
|
|
+ width={200}
|
|
|
+ onBlurText={e => {
|
|
|
+ let newBusiness = Business
|
|
|
+ for (var i = 0; i < newBusiness.length; i++) {
|
|
|
+ if (index == i) {
|
|
|
+ newBusiness[i].reviewerName = e.title
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.setState({
|
|
|
+ Business: newBusiness
|
|
|
+ })
|
|
|
+ }}
|
|
|
+ onBlurChange={(e) => {
|
|
|
+ let newBusiness = Business
|
|
|
+ for (var i = 0; i < newBusiness.length; i++) {
|
|
|
+ if (index == i) {
|
|
|
+ newBusiness[i].reviewerId = e.value
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.setState({
|
|
|
+ Business: newBusiness
|
|
|
+ })
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ <div style={{ width: 25, display: "inline-block" }}>
|
|
|
+ {Business.length > 1 ? (
|
|
|
+ <Icon
|
|
|
+ className="dynamic-delete-button"
|
|
|
+ type="minus-circle-o"
|
|
|
+ disabled={Business.length === 1}
|
|
|
+ onClick={() => this.remove1(index)}
|
|
|
+ />
|
|
|
+ ) : null}
|
|
|
+ </div>
|
|
|
+ {index === 0 && <Button style={{ marginLeft: 10 }} size="small" type="primary" onClick={this.add1}>新增</Button>}
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ </FormItem>
|
|
|
+
|
|
|
+ <FormItem className="half-item"
|
|
|
+ {...formItemLayout}
|
|
|
+ label="经理审核"
|
|
|
+ >
|
|
|
+ <StaffSearch
|
|
|
+ valueName={this.state.managerName}
|
|
|
+ placeholder="输入名称"
|
|
|
+ onBlurText={e => {
|
|
|
+ this.setState({
|
|
|
+ managerName: e.title
|
|
|
+ })
|
|
|
+ }}
|
|
|
+ onBlurChange={(obj) => {
|
|
|
+ this.setState({
|
|
|
+ managerId: obj.value,
|
|
|
+ })
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ </FormItem>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div className='clearfix'>
|
|
|
+ <FormItem className="half-item"
|
|
|
+ {...formItemLayout}
|
|
|
+ label='协单审核'
|
|
|
+ >
|
|
|
+ {
|
|
|
+ Coorder.map((k, index) =>
|
|
|
+ <div key={index}>
|
|
|
+ <StaffSearch
|
|
|
+ valueName={k.reviewerName}
|
|
|
+ placeholder="输入名称"
|
|
|
+ width={200}
|
|
|
+ onBlurText={e => {
|
|
|
+ let newCoorder = Coorder
|
|
|
+ for (var i = 0; i < newCoorder.length; i++) {
|
|
|
+ if (index == i) {
|
|
|
+ newCoorder[i].reviewerName = e.title
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.setState({
|
|
|
+ Coorder: newCoorder
|
|
|
+ })
|
|
|
+ }}
|
|
|
+ onBlurChange={(e) => {
|
|
|
+ let newCoorder = Coorder
|
|
|
+ for (var i = 0; i < newCoorder.length; i++) {
|
|
|
+ if (index == i) {
|
|
|
+ newCoorder[i].reviewerId = e.value
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.setState({
|
|
|
+ Coorder: newCoorder
|
|
|
+ })
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ <div style={{ width: 25, display: "inline-block" }} >
|
|
|
+ {Coorder.length > 1 ? (
|
|
|
+ <Icon
|
|
|
+ className="dynamic-delete-button"
|
|
|
+ type="minus-circle-o"
|
|
|
+ disabled={Coorder.length === 1}
|
|
|
+ onClick={() => this.remove(index)}
|
|
|
+ />
|
|
|
+ ) : null}
|
|
|
+ </div>
|
|
|
+ {index === 0 && <Button style={{ marginLeft: 10 }} size="small" type="primary" onClick={this.add}>新增</Button>}
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ </FormItem>
|
|
|
+
|
|
|
+ <FormItem className="half-item"
|
|
|
+ {...formItemLayout}
|
|
|
+ label="公出抄送"
|
|
|
+ >
|
|
|
+ <StaffSearch
|
|
|
+ valueName={this.state.publicCarbonCopyName}
|
|
|
+ placeholder="输入名称"
|
|
|
+ onBlurText={e => {
|
|
|
+ this.setState({
|
|
|
+ publicCarbonCopyName: e.title
|
|
|
+ })
|
|
|
+ }}
|
|
|
+ onBlurChange={(obj) => {
|
|
|
+ this.setState({
|
|
|
+ publicCarbonCopy: obj.value,
|
|
|
+ })
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ </FormItem>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ {/* <FormItem className="half-item"
|
|
|
{...formItemLayout}
|
|
|
- label="公出抄送"
|
|
|
+ label="协单审核"
|
|
|
>
|
|
|
<StaffSearch
|
|
|
valueName={this.state.publicCarbonCopyName}
|
|
@@ -622,7 +803,7 @@ const Newuser = Form.create()(React.createClass({
|
|
|
})
|
|
|
}}
|
|
|
/>
|
|
|
- </FormItem>
|
|
|
+ </FormItem> */}
|
|
|
|
|
|
<FormItem className="half-item"
|
|
|
{...formItemLayout}
|
|
@@ -638,6 +819,7 @@ const Newuser = Form.create()(React.createClass({
|
|
|
<Select.Option value={1} >是</Select.Option>
|
|
|
</Select>
|
|
|
</FormItem>
|
|
|
+
|
|
|
<div className='clearfix'>
|
|
|
<FormItem className="half-item"
|
|
|
{...formItemLayout}
|