|
@@ -77,8 +77,8 @@ const Newuser = Form.create()(React.createClass({
|
|
|
Business: [{ reviewerName: "", reviewerId: "" }], // 公出审核
|
|
|
Coorder: [{ reviewerName: "", reviewerId: "" }], // 协单审核
|
|
|
|
|
|
- superiorList: [], // 上级主管
|
|
|
- publicCarbonCopyList: [], // 公出抄送
|
|
|
+ superiorList: [{ superior: '', superiorId: '' }], // 上级主管
|
|
|
+ publicCarbonCopyList: [{ publicCarbonCopy: "", publicCarbonCopyName: "" }], // 公出抄送
|
|
|
};
|
|
|
},
|
|
|
getDefaultProps() {
|
|
@@ -102,10 +102,10 @@ const Newuser = Form.create()(React.createClass({
|
|
|
return false;
|
|
|
};
|
|
|
}
|
|
|
- if (!this.state.theTypes && !this.state.superiorId) {
|
|
|
- message.warning('请输入正确的上级主管');
|
|
|
- return false;
|
|
|
- };
|
|
|
+ // if (!this.state.theTypes && !this.state.superiorId) {
|
|
|
+ // message.warning('请输入正确的上级主管');
|
|
|
+ // return false;
|
|
|
+ // };
|
|
|
if (!this.state.superiorList.length) {
|
|
|
message.warning('请输入正确的上级主管');
|
|
|
return false;
|
|
@@ -114,27 +114,28 @@ const Newuser = Form.create()(React.createClass({
|
|
|
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}】在公出抄送人员中存在`;
|
|
|
+ if (superiorItem.superior && !superiorItem.superiorId) {
|
|
|
+ text = `第${i + 1}行请输入正确的上级主管`;
|
|
|
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);
|
|
@@ -151,7 +152,7 @@ const Newuser = Form.create()(React.createClass({
|
|
|
for (let i=0; i<this.state.publicCarbonCopyList.length; i++) {
|
|
|
let item = this.state.publicCarbonCopyList[i];
|
|
|
if (item.publicCarbonCopyName && !item.publicCarbonCopy) {
|
|
|
- text = `第${i}行请输入正确的公出抄送人员`;
|
|
|
+ text = `第${i + 1}行请输入正确的公出抄送人员`;
|
|
|
flag = false;
|
|
|
continue;
|
|
|
}
|
|
@@ -188,6 +189,12 @@ const Newuser = Form.create()(React.createClass({
|
|
|
this.setState({
|
|
|
loading: true
|
|
|
});
|
|
|
+
|
|
|
+ let superReviewerArr = this.state.superiorList;
|
|
|
+ let uniqueSuperArr = [...new Set(superReviewerArr.map(JSON.stringify))].map(JSON.parse);
|
|
|
+
|
|
|
+ let carbonCopyReviewerArr = this.state.publicCarbonCopyList;
|
|
|
+ let uniqueCarbonCopyReviewerArr = [...new Set(carbonCopyReviewerArr.map(JSON.stringify))].map(JSON.parse);
|
|
|
$.ajax({
|
|
|
method: "POST",
|
|
|
dataType: "json",
|
|
@@ -222,8 +229,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(',') // 公出推送
|
|
|
+ superReviewerIds: uniqueSuperArr.map(item => item.superiorId).join(','), // 上级主管
|
|
|
+ carbonCopyReviewerIds: uniqueCarbonCopyReviewerArr.map(item => item.publicCarbonCopy).join(',') // 公出推送
|
|
|
}
|
|
|
}).done(function (data) {
|
|
|
this.setState({
|