|
@@ -278,8 +278,21 @@ class NewAddProject extends Component {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ let flag = true;
|
|
|
+ let errorText = '';
|
|
|
+ for (let i=0; i<this.state.subProList.length; i++) {
|
|
|
+ if (!this.state.subProList[i].serviceYear) {
|
|
|
+ flag = false;
|
|
|
+ errorText = "派单年份不能为空!"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!flag) {
|
|
|
+ message.warning(errorText);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
let sonList = this.state.subProList.map(item => {
|
|
|
- if (this.state.projectType == 1) {
|
|
|
+ if (this.state.projectType == 1 && item.newCheck) {
|
|
|
item.htMember = item.newCheck.includes(1) ? 1 : 0
|
|
|
item.additionalDeduction = item.newCheck.includes(2) ? 1 : 0
|
|
|
item.rdAwardsubsidy = item.newCheck.includes(3) ? 1 : 0
|
|
@@ -716,6 +729,22 @@ class NewAddProject extends Component {
|
|
|
return [...new Set(newCheckType)]
|
|
|
}
|
|
|
|
|
|
+ calcNewCheckType(list) {
|
|
|
+ let newCheckType = [];
|
|
|
+ list.map(item => {
|
|
|
+ if (item.htMember == 1) {
|
|
|
+ newCheckType.push(1);
|
|
|
+ }
|
|
|
+ if (item.additionalDeduction == 1) {
|
|
|
+ newCheckType.push(2)
|
|
|
+ }
|
|
|
+ if (item.rdAwardsubsidy == 1) {
|
|
|
+ newCheckType.push(3)
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return newCheckType;
|
|
|
+ }
|
|
|
+
|
|
|
render() {
|
|
|
let newOptions = this.state.customerArr.map((group, index) => (
|
|
|
<Select.Option key={index} value={group.bname}>
|
|
@@ -1351,31 +1380,7 @@ class NewAddProject extends Component {
|
|
|
</FormItem>
|
|
|
</div> : null
|
|
|
}
|
|
|
- {((isVip != 6) || (isVip == 6 && !isEdit)) &&
|
|
|
- <div className="clearfix">
|
|
|
- <FormItem
|
|
|
- wrapperCol={{ span: 12, offset: 8 }}
|
|
|
- className="half-middle"
|
|
|
- >
|
|
|
- <Button
|
|
|
- className="submitSave"
|
|
|
- type="primary"
|
|
|
- onClick={() => {
|
|
|
- this.onSubmit();
|
|
|
- }}
|
|
|
- >
|
|
|
- 保存
|
|
|
- </Button>
|
|
|
- <Button
|
|
|
- className="submitSave"
|
|
|
- type="ghost"
|
|
|
- onClick={this.props.onCancel}
|
|
|
- >
|
|
|
- 取消
|
|
|
- </Button>
|
|
|
- </FormItem>
|
|
|
- </div>
|
|
|
- }
|
|
|
+
|
|
|
{
|
|
|
// 会员项目子集列表
|
|
|
isEdit &&
|
|
@@ -1466,13 +1471,30 @@ class NewAddProject extends Component {
|
|
|
}
|
|
|
{ this.state.subProList.map((item, idx) => {
|
|
|
return (
|
|
|
- <div>
|
|
|
+ <div style={{margin: '15px 0'}}>
|
|
|
<FormItem
|
|
|
className="half-item"
|
|
|
{...formItemLayout}
|
|
|
- label="本次派单"
|
|
|
+ label="派单年份"
|
|
|
>
|
|
|
- { item.serviceYear }
|
|
|
+ <Select
|
|
|
+ placeholder="请选择本次派单年份"
|
|
|
+ style={{ width: "200px" }}
|
|
|
+ value={item.serviceYear}
|
|
|
+ onChange={(e) => {
|
|
|
+ item.serviceYear = e;
|
|
|
+ this.setState({ subProList: this.state.subProList });
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ {this.state.serviceLife.map(year => {
|
|
|
+ return (
|
|
|
+ <Select.Option key={year} disabled={this.state.subProList.some(item => item.serviceYear == year)}>
|
|
|
+ {year}
|
|
|
+ </Select.Option>
|
|
|
+ );
|
|
|
+ })}
|
|
|
+ </Select>
|
|
|
+ {<span className="mandatory">*</span>}
|
|
|
</FormItem>
|
|
|
<FormItem
|
|
|
className="half-item"
|
|
@@ -1509,8 +1531,12 @@ class NewAddProject extends Component {
|
|
|
value={item.newCheck}
|
|
|
onChange={e => {
|
|
|
item.newCheck = e;
|
|
|
+ item.htMember = item.newCheck.includes(1) ? 1 : 0
|
|
|
+ item.additionalDeduction = item.newCheck.includes(2) ? 1 : 0;
|
|
|
+ item.rdAwardsubsidy = item.newCheck.includes(3) ? 1 : 0;
|
|
|
this.setState({
|
|
|
- subProList: this.state.subProList
|
|
|
+ subProList: this.state.subProList,
|
|
|
+ checkType: this.calcNewCheckType(this.state.subProList), // 临时显示
|
|
|
})
|
|
|
}}
|
|
|
/>
|
|
@@ -1593,6 +1619,117 @@ class NewAddProject extends Component {
|
|
|
</div>
|
|
|
)
|
|
|
}) }
|
|
|
+
|
|
|
+ {((isVip != 6) || (isVip == 6 && !isEdit)) &&
|
|
|
+ <div className="clearfix">
|
|
|
+ { isVip != 6 ? (
|
|
|
+ <FormItem
|
|
|
+ wrapperCol={{ span: 12, offset: 8 }}
|
|
|
+ className="half-middle"
|
|
|
+ >
|
|
|
+
|
|
|
+ <Button
|
|
|
+ className="submitSave"
|
|
|
+ type="primary"
|
|
|
+ onClick={() => {
|
|
|
+ this.onSubmit();
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 保存
|
|
|
+ </Button>
|
|
|
+ <Button
|
|
|
+ className="submitSave"
|
|
|
+ type="ghost"
|
|
|
+ onClick={() => this.props.onCancel()}
|
|
|
+ >
|
|
|
+ 取消
|
|
|
+ </Button>
|
|
|
+
|
|
|
+ </FormItem>
|
|
|
+ ) : (
|
|
|
+ <FormItem
|
|
|
+ wrapperCol={{ span: 12, offset: 8 }}
|
|
|
+ className="half-middle"
|
|
|
+ >
|
|
|
+ { this.state.subProList && this.state.subProList.length ? (
|
|
|
+ <div>
|
|
|
+ <Button
|
|
|
+ className="submitSave"
|
|
|
+ type="primary"
|
|
|
+ onClick={() => {
|
|
|
+ const { subProList } = this.state;
|
|
|
+ if (!subProList[subProList.length - 1].serviceYear) {
|
|
|
+ message.warning("请先选择上一个派单的年份!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ subProList.push({});
|
|
|
+ this.setState({ subProList });
|
|
|
+ }}
|
|
|
+ disabled={this.state.subProList.length >= this.state.serviceLife.length}
|
|
|
+ >
|
|
|
+ + 继续添加,本次派单
|
|
|
+ </Button>
|
|
|
+ <Button
|
|
|
+ className="submitSave"
|
|
|
+ type="primary"
|
|
|
+ onClick={() => {
|
|
|
+ this.onSubmit();
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 保存,确定本次派单
|
|
|
+ </Button>
|
|
|
+ </div>
|
|
|
+ ) : (
|
|
|
+ <div>
|
|
|
+ <Button
|
|
|
+ className="submitSave"
|
|
|
+ type="primary"
|
|
|
+ onClick={() => {
|
|
|
+ const { subProList } = this.state;
|
|
|
+ subProList.push({});
|
|
|
+ this.setState({ subProList });
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ + 添加本次派单
|
|
|
+ </Button>
|
|
|
+ <Button
|
|
|
+ className="submitSave"
|
|
|
+ type="primary"
|
|
|
+ onClick={() => {
|
|
|
+ this.onSubmit();
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 暂不开启工作
|
|
|
+ </Button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ ) }
|
|
|
+
|
|
|
+ </FormItem>
|
|
|
+ ) }
|
|
|
+
|
|
|
+ </div>
|
|
|
+ }
|
|
|
+ {/* { this.state.subProList.length < this.state.serviceLife.length &&
|
|
|
+ <div className="clearfix">
|
|
|
+ <FormItem
|
|
|
+ wrapperCol={{ span: 19, offset: 8 }}
|
|
|
+ className="half-middle"
|
|
|
+ >
|
|
|
+ <Button
|
|
|
+ type="primary"
|
|
|
+ onClick={() => {
|
|
|
+ const { subProList } = this.state;
|
|
|
+ subProList.push({});
|
|
|
+ this.setState({ subProList });
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ + 添加本次派单
|
|
|
+ </Button>
|
|
|
+ <span style={{ color: "#61BBE2", marginLeft: 10 }}>请填写本次派单的年份,派单表示立即安排人员开始相关的工作!!!</span>
|
|
|
+ </FormItem>
|
|
|
+ </div>
|
|
|
+ } */}
|
|
|
{/* {
|
|
|
this.state.splitList.length < this.state.yearSum &&
|
|
|
<div
|
|
@@ -1814,12 +1951,13 @@ class NewAddProject extends Component {
|
|
|
|
|
|
const { subProList } = this.state;
|
|
|
|
|
|
+
|
|
|
if (this.state.isGive == 0) {
|
|
|
this.state.addyear.map(year => {
|
|
|
slist.push(year)
|
|
|
- if (!subProList.some(item => item.serviceYear == year)) {
|
|
|
- subProList.push({ serviceYear: year, newCheck: [] });
|
|
|
- }
|
|
|
+ // if (!subProList.some(item => item.serviceYear == year)) {
|
|
|
+ // subProList.push({ serviceYear: year, newCheck: [] });
|
|
|
+ // }
|
|
|
})
|
|
|
// slist.push(this.state.addyear)
|
|
|
} else if (this.state.isGive == 1) {
|
|
@@ -1827,17 +1965,17 @@ class NewAddProject extends Component {
|
|
|
// slist.push(newYear)
|
|
|
this.state.addyear.map(year => {
|
|
|
slist.push(year + "(赠)")
|
|
|
- if (!subProList.some(item => item.serviceYear == year)) {
|
|
|
- subProList.push({ serviceYear: year + "(赠)", newCheck: [] });
|
|
|
- }
|
|
|
+ // if (!subProList.some(item => item.serviceYear == year)) {
|
|
|
+ // subProList.push({ serviceYear: year + "(赠)", newCheck: [] });
|
|
|
+ // }
|
|
|
})
|
|
|
}
|
|
|
- console.log(subProList)
|
|
|
+
|
|
|
this.setState({
|
|
|
serviceLife: slist,
|
|
|
yearSum: slist.length.toString(),
|
|
|
addYears: false,
|
|
|
- subProList,
|
|
|
+ // subProList,
|
|
|
addForm: true
|
|
|
})
|
|
|
}}
|