| | |
| | | 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 |
| | | }) |