| | |
| | | loading: true |
| | | }); |
| | | Fetch.questionFindById(id).then(res => { |
| | | console.log('res', res); |
| | | res.questionDtos = res.questionDtos && res.questionDtos.length ? res.questionDtos.map((item) => ({ |
| | | ...item, |
| | | remark: true |
| | |
| | | if (!extraData.questionnairBusinessType) { |
| | | return message.error('请选择业务类型'); |
| | | } |
| | | let sum = questionDtos.reduce((p, n) => { |
| | | if (n.type == 'radio') { |
| | | return p.concat(Math.max.apply(null, n.scores)) |
| | | } else { |
| | | return p.concat(n.scores) |
| | | } |
| | | }, []).reduce(function (prev, curr, idx, arr) { |
| | | return Number(prev) + Number(curr); |
| | | }); |
| | | console.log('总分值', sum); |
| | | if (sum > 100) { |
| | | return message.error('分值超过最大值,请重新设定分值'); |
| | | } |
| | | |
| | | questionDtos = questionDtos.map(({ type, title, required, remarkText, options, scores, warnFlag }) => ({ |
| | | type, title, required, remarkText, options, scores, warnFlag |
| | | })); |
| | | |
| | | this.setState({ |
| | | btnLoading: true |
| | | }) |
| | |
| | | const { data, loading, resetKey, initData, btnLoading } = this.state; |
| | | const { id } = this.props.match.params; |
| | | return ( |
| | | <div className="app-page"> |
| | | <div className="app-page" > |
| | | <div style={{ |
| | | margin: '10px 0 0 10px' |
| | | }}> |
| | | <Breadcrumb> |
| | | <Breadcrumb.Item> |
| | | <a onClick={()=>{ |
| | | <a onClick={() => { |
| | | this.props.history.goBack(); |
| | | }}>问卷管理</a> |
| | | </Breadcrumb.Item> |
| | |
| | | </div> |
| | | { |
| | | loading ? |
| | | <div style={{ height: 200, width: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center' }}> |
| | | <div style={{ height: 200, width: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center' }} > |
| | | <Spin spinning={loading} /> |
| | | </div> : |
| | | </div > : |
| | | initData && <Questionnair submitQuestionTemp={this.submitQuestionTemp} btnLoading={btnLoading} initData={initData} editors={initData.questionDtos || []} /> |
| | | } |
| | | </div> |