Commit 6cd02a57 by end

修改投票新建bug

parent bfe13a01
File deleted
...@@ -4,7 +4,6 @@ import TestModal from "./TestModal"; ...@@ -4,7 +4,6 @@ import TestModal from "./TestModal";
import { import {
insertTestFetch, insertTestFetch,
getTestListFetch, getTestListFetch,
addTest,
editTestFetch, editTestFetch,
jumpTestFetch, jumpTestFetch,
jumpReset, jumpReset,
...@@ -12,11 +11,8 @@ import { ...@@ -12,11 +11,8 @@ import {
import { import {
Button, Button,
Table, Table,
Popconfirm,
Modal, Modal,
Pagination,
message, message,
Empty,
} from "antd"; } from "antd";
import styles from "./index.less"; import styles from "./index.less";
import { DragDropContext, DragSource, DropTarget } from "react-dnd"; import { DragDropContext, DragSource, DropTarget } from "react-dnd";
...@@ -193,58 +189,20 @@ class AddTest extends Component { ...@@ -193,58 +189,20 @@ class AddTest extends Component {
if (values.type === 1) { if (values.type === 1) {
for (let i = 0; i < values.cont.length; i++) { for (let i = 0; i < values.cont.length; i++) {
if (values.cont[i] == null) continue; if (values.cont[i] == null) continue;
console.log(values, 11111);
objs.push({ objs.push({
content: values.cont[i], content: values.cont[i],
//correct:values.correct[i]?1:0,
//editable:values.editable[i]?1:0,
//jumpNum:values.jumpNum[i]?values.jumpNum[i]:"",
no: values.no[i], no: values.no[i],
researchId: surid, researchId: surid,
keywords: this.addother.state.keywords, keywords: this.addother.state.keywords,
}); });
} }
console.log("单选题其他", objs);
} }
if (values.type === 2) {
for (let i = 0; i < values.cont.length; i++) {
objs.push({
content: values.cont[i],
//correct:values.correct[i]?1:0,
//editable:values.editable[i]?1:0,
no: values.no[i],
researchId: surid,
});
}
// console.log(objs)
}
if (values.type === 4) {
for (let i = 0; i < values.cont.length; i++) {
// 最大值最小值判断
if (values.maxScore[i] <= values.minScore[i]) {
message.error("最大值不能小于最小值");
this.setState({
confirmLoading: false,
});
return;
}
objs.push({
content: values.cont[i],
maxScore: values.maxScore[i],
minScore: values.minScore[i],
no: values.no[i],
researchId: surid,
});
}
}
if (editstate) { if (editstate) {
const param = { const param = {
type: values.type, type: values.type,
content: values.content, content: values.content,
//bug-9797-liyuan 附件回显
contentAppendixUrl: this.state.fileUrl contentAppendixUrl: this.state.fileUrl
? this.state.fileUrl[0] ? this.state.fileUrl
: this.state.testItem.contentAppendixUrl : this.state.testItem.contentAppendixUrl
? this.state.testItem.contentAppendixUrl ? this.state.testItem.contentAppendixUrl
: "", : "",
...@@ -252,7 +210,6 @@ class AddTest extends Component { ...@@ -252,7 +210,6 @@ class AddTest extends Component {
questionOptions: objs, questionOptions: objs,
maxSelectItem: values.needAnswer2 ? values.maxSelectItem : "", maxSelectItem: values.needAnswer2 ? values.maxSelectItem : "",
minSelectItem: values.needAnswer1 ? values.minSelectItem : "", minSelectItem: values.needAnswer1 ? values.minSelectItem : "",
//no:this.state.testItem.no,
hasOther: this.addother.state.addother ? 1 : 0, hasOther: this.addother.state.addother ? 1 : 0,
otherOption: { otherOption: {
content: this.addother.state.other, content: this.addother.state.other,
...@@ -264,7 +221,6 @@ class AddTest extends Component { ...@@ -264,7 +221,6 @@ class AddTest extends Component {
questions: [{ id: editid, ...param }], questions: [{ id: editid, ...param }],
researchId: surid, researchId: surid,
}; };
// console.log(temp)
this.props.edit(temp, surid, this.state.pageNo, this.state.pageSize); this.props.edit(temp, surid, this.state.pageNo, this.state.pageSize);
this.setState({ fileUrl: "" }); this.setState({ fileUrl: "" });
} else { } else {
...@@ -272,13 +228,12 @@ class AddTest extends Component { ...@@ -272,13 +228,12 @@ class AddTest extends Component {
keywords: this.addother.state.keywords, keywords: this.addother.state.keywords,
type: values.type, type: values.type,
content: values.content, content: values.content,
contentAppendixUrl: this.state.fileUrl ? this.state.fileUrl[0] : "", contentAppendixUrl: this.state.fileUrl ? this.state.fileUrl : "",
needAnswer: values.needAnswer ? 1 : 0, needAnswer: values.needAnswer ? 1 : 0,
questionOptions: objs, questionOptions: objs,
maxSelectItem: values.needAnswer2 ? values.maxSelectItem : "", maxSelectItem: values.needAnswer2 ? values.maxSelectItem : "",
minSelectItem: values.needAnswer1 ? values.minSelectItem : "", minSelectItem: values.needAnswer1 ? values.minSelectItem : "",
reseachId: surid, reseachId: surid,
//no:tlist.list[0]?tlist.list[0].no+1:order,
hasOther: this.addother.state.addother ? 1 : 0, hasOther: this.addother.state.addother ? 1 : 0,
otherOption: { otherOption: {
content: this.addother.state.other, content: this.addother.state.other,
...@@ -286,17 +241,6 @@ class AddTest extends Component { ...@@ -286,17 +241,6 @@ class AddTest extends Component {
required: this.addother.state.ismust ? 1 : 0, required: this.addother.state.ismust ? 1 : 0,
}, },
}; };
console.clear();
console.log(param);
// 判断最大可选
// if( param.maxSelectItem !== '' && param.maxSelectItem > param.questionOptions.length){
// message.error('最多项错误')
// this.setState({
// confirmLoading: false,
// });
// return
// }
this.props.insert(param, this.state.pageNo, this.state.pageSize); this.props.insert(param, this.state.pageNo, this.state.pageSize);
this.setState({ fileUrl: "" }); this.setState({ fileUrl: "" });
} }
......
import React, { Component } from "react"; import React, { Component } from "react";
import Base from "./Base"; import Base from "./Base";
import AddTest from "./AddTest"; import AddTest from "./AddTest";
import Jumpquestion from "./jumpquestios.js";
import MessageRemind from "@/common/MessageRemind"; import MessageRemind from "@/common/MessageRemind";
import moment from "moment"; import moment from "moment";
import { message } from "antd"; import { message } from "antd";
import { Link, browserHistory, withRouter } from "react-router-dom"; import { Link, withRouter } from "react-router-dom";
import Breadcrumb from "@/common/Breadcrumb"; import Breadcrumb from "@/common/Breadcrumb";
import { import {
getTSdata, getTSdata,
insertSurFetch, insertSurFetch,
updateFetch, updateFetch,
insertTestFetch,
getSurDetailsFetch, getSurDetailsFetch,
getTestListFetch, getTestListFetch,
upFetch, upFetch,
reFetch, reFetch,
postNewsList, postNewsList,
getNewsListMessageRemind,
} from "../redux/actions"; } from "../redux/actions";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { Form, Steps, Button, Input, InputNumber, Radio } from "antd"; import { Form, Steps, Button, Input, InputNumber, Radio } from "antd";
import QRCode from "qrcode.react";
const FormItem = Form.Item; const FormItem = Form.Item;
const Step = Steps.Step; const Step = Steps.Step;
import styles from "./index.less"; import styles from "./index.less";
import Task from "@/common/task/Task";
var companyCode = location.pathname.split("/")[1]; var companyCode = location.pathname.split("/")[1];
var siteCode = location.pathname.split("/")[2]; var siteCode = location.pathname.split("/")[2];
...@@ -77,7 +72,6 @@ class SurveyCreact extends Component { ...@@ -77,7 +72,6 @@ class SurveyCreact extends Component {
FirstNext() { FirstNext() {
const current = this.state.current + 1; const current = this.state.current + 1;
const component = this.first; const component = this.first;
const dcomponent = this.remind;
const { trainJson } = this.state; const { trainJson } = this.state;
let _this = this; let _this = this;
...@@ -234,12 +228,6 @@ class SurveyCreact extends Component { ...@@ -234,12 +228,6 @@ class SurveyCreact extends Component {
labelCol: { span: 6 }, labelCol: { span: 6 },
wrapperCol: { span: 14 }, wrapperCol: { span: 14 },
}; };
// 938
let defaultTags = [];
if (details.keywords) {
defaultTags = details.keywords.split(",");
}
// 938 结束 // 938 结束
const remindProps = { const remindProps = {
defaultValue: details, defaultValue: details,
...@@ -365,37 +353,6 @@ class SurveyCreact extends Component { ...@@ -365,37 +353,6 @@ class SurveyCreact extends Component {
</Button> </Button>
</div> </div>
)} )}
{/* {this.state.current === 1 && (
<div>
<Link
to={
"/" +
companyCode +
"/" +
siteCode +
"/index/tool/survey/survey-management"
}
>
<Button className={styles.survey_create_action_btn}>
取消
</Button>
</Link>
<Button
className={styles.survey_create_action_btn}
type="primary"
onClick={this.prev}
>
上一步
</Button>
<Button
className={styles.survey_create_action_btn}
type="primary"
onClick={this.SecondSave}
>
下一步
</Button>
</div>
)} */}
{this.state.current === 1 && ( {this.state.current === 1 && (
<div> <div>
<Link <Link
...@@ -478,7 +435,6 @@ function mapDispatchToProps(dispatch) { ...@@ -478,7 +435,6 @@ function mapDispatchToProps(dispatch) {
getTSdata: obj => dispatch(getTSdata(obj)), getTSdata: obj => dispatch(getTSdata(obj)),
insert: (obj, callback) => dispatch(insertSurFetch(obj, callback)), insert: (obj, callback) => dispatch(insertSurFetch(obj, callback)),
update: (obj, callback) => dispatch(updateFetch(obj, callback)), update: (obj, callback) => dispatch(updateFetch(obj, callback)),
inserts: arr => dispatch(insertTestFetch(arr)),
getDetails: (obj, callback) => dispatch(getSurDetailsFetch(obj, callback)), getDetails: (obj, callback) => dispatch(getSurDetailsFetch(obj, callback)),
gettestlist: obj => dispatch(getTestListFetch(obj)), gettestlist: obj => dispatch(getTestListFetch(obj)),
up: id => dispatch(upFetch(id)), up: id => dispatch(upFetch(id)),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment