|
@@ -15,6 +15,8 @@ const ActivityDescFrom = Form.create()(React.createClass({
|
|
|
},
|
|
|
componentWillMount() {
|
|
|
let _me = this;
|
|
|
+ this.state.internalAllCost = this.props.data.internalAllCost;
|
|
|
+ this.state.allCost = this.props.data.allCost;
|
|
|
this.props.activityNumberList.map(function (item) {
|
|
|
_me.state.activityNumberOption.push(
|
|
|
<Select.Option value={item.aid} key={item.uid}>{item.activityNumber}</Select.Option>
|
|
@@ -31,14 +33,14 @@ const ActivityDescFrom = Form.create()(React.createClass({
|
|
|
this.props.form.getFieldValue('internalDesignCost') + this.props.form.getFieldValue('internalEquipmentCost') +
|
|
|
this.props.form.getFieldValue('internalOtherCost') + this.props.form.getFieldValue('externalTotalCost');
|
|
|
},
|
|
|
- componentDidMount() {
|
|
|
- this.allCostCount();
|
|
|
- this.setState({
|
|
|
- loading: false
|
|
|
- });
|
|
|
- },
|
|
|
- componentWillReceiveProps() {
|
|
|
- this.allCostCount();
|
|
|
+ componentWillReceiveProps(nextProps) {
|
|
|
+ if (!this.props.visible && nextProps.visible) {
|
|
|
+ this.state.internalAllCost = nextProps.data.internalAllCost;
|
|
|
+ this.state.allCost = nextProps.data.allCost;
|
|
|
+ nextProps.form.resetFields();
|
|
|
+ } else {
|
|
|
+ this.allCostCount();
|
|
|
+ };
|
|
|
},
|
|
|
handleSubmit(e) {
|
|
|
e.preventDefault();
|
|
@@ -99,7 +101,10 @@ const ActivityDescFrom = Form.create()(React.createClass({
|
|
|
<p className="activityCost-title">项目编号</p>
|
|
|
{
|
|
|
theData.activityNumber ? <span>{theData.activityNumber}</span> :
|
|
|
- <Select placeholder="请选择项目编号" style={{ width: 200 }}
|
|
|
+ <Select
|
|
|
+ notFoundContent="无项目可选"
|
|
|
+ placeholder="请选择项目编号"
|
|
|
+ style={{ width: 200 }}
|
|
|
onSelect={(e, n) => { this.state.aid = e; this.state.activityNumber = n.props.children }}>
|
|
|
{this.state.activityNumberOption}
|
|
|
</Select>
|
|
@@ -110,11 +115,9 @@ const ActivityDescFrom = Form.create()(React.createClass({
|
|
|
{...formItemLayout}
|
|
|
label="共计(万元)"
|
|
|
>
|
|
|
- {getFieldDecorator('internalAllCost')(
|
|
|
- <span className="number-box">
|
|
|
- {this.state.internalAllCost}
|
|
|
- </span>
|
|
|
- )}
|
|
|
+ <span className="number-box">
|
|
|
+ {this.state.internalAllCost}
|
|
|
+ </span>
|
|
|
</FormItem>
|
|
|
<FormItem className="half-item"
|
|
|
{...formItemLayout}
|
|
@@ -122,7 +125,7 @@ const ActivityDescFrom = Form.create()(React.createClass({
|
|
|
>
|
|
|
{getFieldDecorator('internalLaborCost', {
|
|
|
rules: [{ type: "number", required: true, message: '此项为必填项!' }],
|
|
|
- initialValue: theData.internalLaborCost
|
|
|
+ initialValue: theData.internalLaborCost || 0
|
|
|
})(
|
|
|
<InputNumber />
|
|
|
)}
|
|
@@ -133,7 +136,7 @@ const ActivityDescFrom = Form.create()(React.createClass({
|
|
|
>
|
|
|
{getFieldDecorator('internalDirectCost', {
|
|
|
rules: [{ type: "number", required: true, message: '此项为必填项!' }],
|
|
|
- initialValue: theData.internalDirectCost
|
|
|
+ initialValue: theData.internalDirectCost || 0
|
|
|
})(
|
|
|
<InputNumber />
|
|
|
)}
|
|
@@ -144,7 +147,7 @@ const ActivityDescFrom = Form.create()(React.createClass({
|
|
|
>
|
|
|
{getFieldDecorator('internalDepreciationCost', {
|
|
|
rules: [{ type: "number", required: true, message: '此项为必填项!' }],
|
|
|
- initialValue: theData.internalDepreciationCost
|
|
|
+ initialValue: theData.internalDepreciationCost || 0
|
|
|
})(
|
|
|
<InputNumber />
|
|
|
)}
|
|
@@ -155,7 +158,7 @@ const ActivityDescFrom = Form.create()(React.createClass({
|
|
|
>
|
|
|
{getFieldDecorator('internalAmortizationCost', {
|
|
|
rules: [{ type: "number", required: true, message: '此项为必填项!' }],
|
|
|
- initialValue: theData.internalAmortizationCost
|
|
|
+ initialValue: theData.internalAmortizationCost || 0
|
|
|
})(
|
|
|
<InputNumber />
|
|
|
)}
|
|
@@ -166,7 +169,7 @@ const ActivityDescFrom = Form.create()(React.createClass({
|
|
|
>
|
|
|
{getFieldDecorator('internalDesignCost', {
|
|
|
rules: [{ type: "number", required: true, message: '此项为必填项!' }],
|
|
|
- initialValue: theData.internalDesignCost
|
|
|
+ initialValue: theData.internalDesignCost || 0
|
|
|
})(
|
|
|
<InputNumber />
|
|
|
)}
|
|
@@ -177,7 +180,7 @@ const ActivityDescFrom = Form.create()(React.createClass({
|
|
|
>
|
|
|
{getFieldDecorator('internalEquipmentCost', {
|
|
|
rules: [{ type: "number", required: true, message: '此项为必填项!' }],
|
|
|
- initialValue: theData.internalEquipmentCost
|
|
|
+ initialValue: theData.internalEquipmentCost || 0
|
|
|
})(
|
|
|
<InputNumber />
|
|
|
)}
|
|
@@ -188,7 +191,7 @@ const ActivityDescFrom = Form.create()(React.createClass({
|
|
|
>
|
|
|
{getFieldDecorator('internalOtherCost', {
|
|
|
rules: [{ type: "number", required: true, message: '此项为必填项!' }],
|
|
|
- initialValue: theData.internalOtherCost
|
|
|
+ initialValue: theData.internalOtherCost || 0
|
|
|
})(
|
|
|
<InputNumber />
|
|
|
)}
|
|
@@ -202,7 +205,7 @@ const ActivityDescFrom = Form.create()(React.createClass({
|
|
|
>
|
|
|
{getFieldDecorator('externalTotalCost', {
|
|
|
rules: [{ type: "number", required: true, message: '此项为必填项!' }],
|
|
|
- initialValue: theData.externalTotalCost
|
|
|
+ initialValue: theData.externalTotalCost || 0
|
|
|
})(
|
|
|
<InputNumber />
|
|
|
)}
|
|
@@ -213,7 +216,7 @@ const ActivityDescFrom = Form.create()(React.createClass({
|
|
|
>
|
|
|
{getFieldDecorator('externalAbroadCost', {
|
|
|
rules: [{ type: "number", required: true, message: '此项为必填项!' }],
|
|
|
- initialValue: theData.externalAbroadCost
|
|
|
+ initialValue: theData.externalAbroadCost || 0
|
|
|
})(
|
|
|
<InputNumber />
|
|
|
)}
|
|
@@ -345,6 +348,7 @@ const ActivityDesc = React.createClass({
|
|
|
>
|
|
|
<ActivityDescFrom
|
|
|
uid={this.props.uid}
|
|
|
+ visible={this.state.visible}
|
|
|
data={this.props.data}
|
|
|
activityNumberList={this.props.activityNumberList}
|
|
|
spinState={this.spinChange} closeModal={this.handleCancel} clickOk={this.handleOk} />
|