|
@@ -76,6 +76,9 @@ const Newuser = Form.create()(React.createClass({
|
|
|
role: [],
|
|
|
Business: [{ reviewerName: "", reviewerId: "" }], // 公出审核
|
|
|
Coorder: [{ reviewerName: "", reviewerId: "" }], // 协单审核
|
|
|
+
|
|
|
+ superiorList: [], // 上级主管
|
|
|
+ publicCarbonCopyList: [], // 公出抄送
|
|
|
};
|
|
|
},
|
|
|
getDefaultProps() {
|
|
@@ -103,10 +106,61 @@ const Newuser = Form.create()(React.createClass({
|
|
|
message.warning('请输入正确的上级主管');
|
|
|
return false;
|
|
|
};
|
|
|
+ if (!this.state.superiorList.length) {
|
|
|
+ message.warning('请输入正确的上级主管');
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ let flag = true;
|
|
|
+ let text = '';
|
|
|
+ for (let i=0; i<this.state.superiorList.length; i++) {
|
|
|
+ let superiorItem = this.state.superiorList[i];
|
|
|
+ if (!superiorItem.superiorId) {
|
|
|
+ text = `第${idx}行请输入正确的上级主管`;
|
|
|
+ flag = false;
|
|
|
+ continue;
|
|
|
+ } else if (this.state.Business.some(item => item.reviewerId == superiorItem.superiorId)) {
|
|
|
+ text = `上级主管【${superiorItem.superior}】在公出审核人员中存在`;
|
|
|
+ flag = false;
|
|
|
+ continue;
|
|
|
+ } else if (this.state.Coorder.some(item => item.reviewerId == superiorItem.superiorId)) {
|
|
|
+ text = `上级主管【${superiorItem.superior}】在协单审核人员中存在`;
|
|
|
+ flag = false;
|
|
|
+ continue;
|
|
|
+ } else if (this.state.managerId == superiorItem.superiorId) {
|
|
|
+ text = `上级主管【${superiorItem.superior}】在经理审核人员中存在`;
|
|
|
+ flag = false;
|
|
|
+ continue;
|
|
|
+ } else if (this.state.publicCarbonCopyList.some(item => item.publicCarbonCopy == superiorItem.superiorId)) {
|
|
|
+ text = `上级主管【${superiorItem.superior}】在公出抄送人员中存在`;
|
|
|
+ flag = false;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!flag) {
|
|
|
+ message.warning(text);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
if (!getNewArray(this.state.Business, "reviewerId").toString()) {
|
|
|
message.warning('请输入正确的公出审核人');
|
|
|
return false;
|
|
|
}
|
|
|
+ if (this.state.publicCarbonCopyList.length) {
|
|
|
+ let flag = true;
|
|
|
+ let text = '';
|
|
|
+ for (let i=0; i<this.state.publicCarbonCopyList.length; i++) {
|
|
|
+ let item = this.state.publicCarbonCopyList[i];
|
|
|
+ if (item.publicCarbonCopyName && !item.publicCarbonCopy) {
|
|
|
+ text = `第${i}行请输入正确的公出抄送人员`;
|
|
|
+ flag = false;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!flag) {
|
|
|
+ message.warning(text);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
if (this.state.contactMobile) {
|
|
|
if (!(/^1[1-9][0-9]\d{4,8}$/.test(this.state.contactMobile))) {
|
|
|
message.warning("不是完整的11位手机号或者正确的手机号前七位");
|
|
@@ -153,7 +207,8 @@ const Newuser = Form.create()(React.createClass({
|
|
|
duty: this.state.duty,
|
|
|
position: this.state.position,//岗位
|
|
|
email: this.state.email,
|
|
|
- superiorId: this.state.theTypes ? this.state.theTypes : this.state.superiorId,
|
|
|
+ // superiorId: this.state.theTypes ? this.state.theTypes : this.state.superiorId,
|
|
|
+ // superior: this.state.superiorList.map(item => item.superiorId).join(','),
|
|
|
// reviewer: this.state.reviewer,
|
|
|
district: this.state.district,
|
|
|
headPortraitUrl: theorgCodeUrl.length ? theorgCodeUrl : '',
|
|
@@ -167,6 +222,8 @@ const Newuser = Form.create()(React.createClass({
|
|
|
}),
|
|
|
publicReviewerIds: getNewArray(this.state.Business, "reviewerId").toString(),// 公出审核
|
|
|
assistReviewerIds: getNewArray(this.state.Coorder, "reviewerId").toString(),// 协单审核
|
|
|
+ superReviewerIds: this.state.superiorList.map(item => item.superiorId).join(','), // 上级主管
|
|
|
+ carbonCopyReviewerIds: this.state.publicCarbonCopyList.map(item => item.publicCarbonCopy).join(',') // 公出推送
|
|
|
}
|
|
|
}).done(function (data) {
|
|
|
this.setState({
|
|
@@ -209,7 +266,7 @@ const Newuser = Form.create()(React.createClass({
|
|
|
}.bind(this));
|
|
|
},
|
|
|
//上级主管输入框失去焦点是判断客户是否存在
|
|
|
- selectAuto(value) {
|
|
|
+ selectAuto(value, idx) {
|
|
|
let theType = '';
|
|
|
let contactLists = this.state.customerArr || [];
|
|
|
if (value) {
|
|
@@ -219,9 +276,13 @@ const Newuser = Form.create()(React.createClass({
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+ const { superiorList } = this.state;
|
|
|
+ superiorList[idx].superiorId = theType;
|
|
|
+ superiorList[idx].superior = value;
|
|
|
this.setState({
|
|
|
- theTypes: theType,
|
|
|
- superior: value
|
|
|
+ // theTypes: theType,
|
|
|
+ // superior: value
|
|
|
+ superiorList
|
|
|
})
|
|
|
if (!this.state.reviewerName || !this.state.reviewer) {
|
|
|
this.setState({
|
|
@@ -231,12 +292,14 @@ const Newuser = Form.create()(React.createClass({
|
|
|
}
|
|
|
},
|
|
|
//值改变时请求客户名称
|
|
|
- httpChange(e) {
|
|
|
+ httpChange(e, idx) {
|
|
|
if (e.length >= 1) {
|
|
|
this.supervisor(e);
|
|
|
}
|
|
|
+ const { superiorList } = this.state;
|
|
|
+ superiorList[idx].superior = e;
|
|
|
this.setState({
|
|
|
- superior: e
|
|
|
+ superiorList
|
|
|
})
|
|
|
},
|
|
|
//查看基本详情基本信息
|
|
@@ -258,6 +321,12 @@ const Newuser = Form.create()(React.createClass({
|
|
|
};
|
|
|
thisdata = {};
|
|
|
};
|
|
|
+ // let superiorList = [];
|
|
|
+ // let superiorIdArr = thisdata.superiorId ? thisdata.superiorId.toString().split(',') : [];
|
|
|
+ // let superiorArr = thisdata.superior ? thisdata.superior.toString().split(',') : [];
|
|
|
+ // superiorIdArr.map((id, idx) => {
|
|
|
+ // superiorList.push({ superiorId: id, superior: superiorArr[idx] });
|
|
|
+ // })
|
|
|
this.setState({
|
|
|
id: thisdata.id,
|
|
|
mobile: thisdata.mobile,
|
|
@@ -268,6 +337,7 @@ const Newuser = Form.create()(React.createClass({
|
|
|
position: thisdata.position ? thisdata.position : undefined,
|
|
|
superior: thisdata.superior,
|
|
|
superiorId: thisdata.superiorId,//上级Id
|
|
|
+ // superiorList, // 上级list
|
|
|
reviewerName: thisdata.reviewerName,
|
|
|
reviewer: thisdata.reviewer, // 公出审核人
|
|
|
managerName: thisdata.managerName,
|
|
@@ -317,9 +387,23 @@ const Newuser = Form.create()(React.createClass({
|
|
|
};
|
|
|
thisdata = {};
|
|
|
};
|
|
|
+ let superiorList = [{ superior: '', superiorId: '' }];
|
|
|
+ if (thisdata.superReviewer.length) {
|
|
|
+ superiorList = thisdata.superReviewer.map(item => {
|
|
|
+ return { superior: item.reviewerName, superiorId: item.reviewerId };
|
|
|
+ })
|
|
|
+ }
|
|
|
+ let publicCarbonCopyList = [{ publicCarbonCopyName: '', publicCarbonCopy: '' }];
|
|
|
+ if (thisdata.carbonCopyReviewer.length) {
|
|
|
+ publicCarbonCopyList = thisdata.carbonCopyReviewer.map(item => {
|
|
|
+ return { publicCarbonCopyName: item.reviewerName, publicCarbonCopy: item.reviewerId }
|
|
|
+ });
|
|
|
+ }
|
|
|
this.setState({
|
|
|
Business: thisdata.publicReviewer.length > 0 ? thisdata.publicReviewer : [{ reviewerName: "", reviewerId: "" }],
|
|
|
Coorder: thisdata.assistReviewer.length > 0 ? thisdata.assistReviewer : [{ reviewerName: "", reviewerId: "" }],
|
|
|
+ superiorList,
|
|
|
+ publicCarbonCopyList,
|
|
|
});
|
|
|
}.bind(this),
|
|
|
}).always(function () {
|
|
@@ -426,6 +510,31 @@ const Newuser = Form.create()(React.createClass({
|
|
|
})
|
|
|
},
|
|
|
|
|
|
+ addSupersor() {
|
|
|
+ const { superiorList } = this.state;
|
|
|
+ superiorList.push({ superiorId: '', superior: '' });
|
|
|
+ this.setState({ superiorList });
|
|
|
+ },
|
|
|
+
|
|
|
+ removeSupersor(idx) {
|
|
|
+ this.state.superiorList.splice(idx, 1)
|
|
|
+ this.setState({
|
|
|
+ superiorList: this.state.superiorList
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ addPublicCarbonCopy() {
|
|
|
+ const { publicCarbonCopyList } = this.state;
|
|
|
+ publicCarbonCopyList.push({ publicCarbonCopy: '', publicCarbonCopyName: '' });
|
|
|
+ this.setState({ publicCarbonCopyList });
|
|
|
+ },
|
|
|
+
|
|
|
+ removePublicCarbonCopy(idx) {
|
|
|
+ this.state.publicCarbonCopyList.splice(idx, 1)
|
|
|
+ this.setState({
|
|
|
+ publicCarbonCopyList: this.state.publicCarbonCopyList
|
|
|
+ });
|
|
|
+ },
|
|
|
|
|
|
render() {
|
|
|
const { Coorder, Business } = this.state
|
|
@@ -606,22 +715,38 @@ const Newuser = Form.create()(React.createClass({
|
|
|
{...formItemLayout}
|
|
|
label="上级主管"
|
|
|
>
|
|
|
- <AutoComplete
|
|
|
- className="certain-category-search"
|
|
|
- dropdownClassName="certain-category-search-dropdown"
|
|
|
- dropdownMatchSelectWidth={false}
|
|
|
- size="large"
|
|
|
- style={{ width: '200px' }}
|
|
|
- dataSource={options}
|
|
|
- placeholder="输入名称"
|
|
|
- value={this.state.superior}
|
|
|
- onChange={this.httpChange}
|
|
|
- filterOption={true}
|
|
|
- onSelect={this.selectAuto}
|
|
|
- >
|
|
|
- <Input />
|
|
|
- </AutoComplete>
|
|
|
- <span className="mandatory">*</span>
|
|
|
+
|
|
|
+ {this.state.superiorList.map((item, idx) => (
|
|
|
+ <div style={{ display: 'flex', alignItems: 'center', padding: '5px 0' }}>
|
|
|
+ <AutoComplete
|
|
|
+ className="certain-category-search"
|
|
|
+ dropdownClassName="certain-category-search-dropdown"
|
|
|
+ dropdownMatchSelectWidth={false}
|
|
|
+ size="large"
|
|
|
+ style={{ width: '200px' }}
|
|
|
+ dataSource={options}
|
|
|
+ placeholder="输入名称"
|
|
|
+ value={item.superior}
|
|
|
+ onChange={e=> {this.httpChange(e, idx)}}
|
|
|
+ filterOption={true}
|
|
|
+ onSelect={value => {this.selectAuto(value, idx)}}
|
|
|
+ >
|
|
|
+ <Input />
|
|
|
+ </AutoComplete>
|
|
|
+ <span className="mandatory">*</span>
|
|
|
+ <div style={{ width: 25, display: "inline-block" }}>
|
|
|
+ {this.state.superiorList.length > 1 ? (
|
|
|
+ <Icon
|
|
|
+ className="dynamic-delete-button"
|
|
|
+ type="minus-circle-o"
|
|
|
+ disabled={this.state.superiorList.length === 1}
|
|
|
+ onClick={() => this.removeSupersor(idx)}
|
|
|
+ />
|
|
|
+ ) : null}
|
|
|
+ </div>
|
|
|
+ { idx === 0 && <Button style={{ marginLeft: 10 }} size="small" type="primary" onClick={this.addSupersor}>新增</Button> }
|
|
|
+ </div>
|
|
|
+ ))}
|
|
|
</FormItem>
|
|
|
<FormItem className="half-item"
|
|
|
{...formItemLayout}
|
|
@@ -714,6 +839,16 @@ const Newuser = Form.create()(React.createClass({
|
|
|
})
|
|
|
}}
|
|
|
/>
|
|
|
+ <Icon
|
|
|
+ className="dynamic-delete-button"
|
|
|
+ type="minus-circle-o"
|
|
|
+ onClick={() => {
|
|
|
+ this.setState({
|
|
|
+ managerName: '',
|
|
|
+ managerId: ''
|
|
|
+ });
|
|
|
+ }}
|
|
|
+ />
|
|
|
</FormItem>
|
|
|
</div>
|
|
|
|
|
@@ -772,20 +907,42 @@ const Newuser = Form.create()(React.createClass({
|
|
|
{...formItemLayout}
|
|
|
label="公出抄送"
|
|
|
>
|
|
|
- <StaffSearch
|
|
|
- valueName={this.state.publicCarbonCopyName}
|
|
|
- placeholder="输入名称"
|
|
|
- onBlurText={e => {
|
|
|
- this.setState({
|
|
|
- publicCarbonCopyName: e.title
|
|
|
- })
|
|
|
- }}
|
|
|
- onBlurChange={(obj) => {
|
|
|
- this.setState({
|
|
|
- publicCarbonCopy: obj.value,
|
|
|
- })
|
|
|
- }}
|
|
|
- />
|
|
|
+ { this.state.publicCarbonCopyList.map((item, idx) => (
|
|
|
+ <div style={{ display: 'flex', alignItems: 'center', padding: '5px 0' }}>
|
|
|
+ <StaffSearch
|
|
|
+ valueName={item.publicCarbonCopyName}
|
|
|
+ placeholder="输入名称"
|
|
|
+ onBlurText={e => {
|
|
|
+ const { publicCarbonCopyList } = this.state;
|
|
|
+ publicCarbonCopyList[idx].publicCarbonCopyName = e.title;
|
|
|
+ this.setState({
|
|
|
+ // publicCarbonCopyName: e.title
|
|
|
+ publicCarbonCopyList
|
|
|
+ })
|
|
|
+ }}
|
|
|
+ onBlurChange={(obj) => {
|
|
|
+ const { publicCarbonCopyList } = this.state;
|
|
|
+ publicCarbonCopyList[idx].publicCarbonCopy = obj.value;
|
|
|
+ this.setState({
|
|
|
+ // publicCarbonCopy: obj.value,
|
|
|
+ publicCarbonCopyList
|
|
|
+ })
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ <div style={{ width: 25, display: "inline-block" }}>
|
|
|
+ {this.state.publicCarbonCopyList.length > 1 ? (
|
|
|
+ <Icon
|
|
|
+ className="dynamic-delete-button"
|
|
|
+ type="minus-circle-o"
|
|
|
+ disabled={this.state.publicCarbonCopyList.length === 1}
|
|
|
+ onClick={() => this.removePublicCarbonCopy(idx)}
|
|
|
+ />
|
|
|
+ ) : null}
|
|
|
+ </div>
|
|
|
+ { idx === 0 && <Button style={{ marginLeft: 10 }} size="small" type="primary" onClick={this.addPublicCarbonCopy}>新增</Button> }
|
|
|
+ </div>
|
|
|
+ )) }
|
|
|
+
|
|
|
</FormItem>
|
|
|
</div>
|
|
|
|