Commit 2bdfeaae by yanglang123

新增工作任务已下架新增,移动,删除功能

parent f7f43b43
......@@ -260,30 +260,6 @@ class AddTest extends Component {
required: this.addother.state.ismust ? 1 : 0,
},
};
// console.log("777777777", param)
// return
// if( !(param.minSelectItem !== '' && param.minSelectItem <= param.questionOptions.length-1 && param.minSelectItem > 0)) {
// message.error('最少项错误')
// this.setState({
// confirmLoading: false,
// });
// return
// }
// // 判断最大可选
// if( param.maxSelectItem !== '' && param.maxSelectItem > param.questionOptions.length){
// message.error('最多项错误')
// this.setState({
// confirmLoading: false,
// });
// return
// }else if(param.maxSelectItem !== '' && param.minSelectItem !==''&& param.maxSelectItem < param.minSelectItem){
// message.error('最多项不能小于最少项')
// this.setState({
// confirmLoading: false,
// });
// return
// }
const temp = {
questions: [{ id: editid, ...param }],
researchId: surid,
......
......@@ -323,7 +323,7 @@ class TestModal extends Component {
{keys1.map((item, k) => {
// console.log(item.correct?item.correct!==0:false)
return (
<Row gutter={23}>
<Row key={item.no} gutter={23}>
<FormItem style={{ display: "none" }}>
{getFieldDecorator(`no[${item.no}]`, {
initialValue: item.no,
......@@ -489,7 +489,7 @@ class TestModal extends Component {
</Row>
{keys2.map((item, k) => {
return (
<Row gutter={23}>
<Row key={item.no} gutter={23}>
<FormItem style={{ display: "none" }}>
{getFieldDecorator(`no[${item.no}]`, {
initialValue: item.no,
......@@ -705,7 +705,8 @@ class TestModal extends Component {
{keys3.map((item, k) => {
// console.log(item)
return (
<Row gutter={23}>
// 添加 key 属性
<Row key={item.no} gutter={23}>
<FormItem style={{ display: "none" }}>
{getFieldDecorator(`no[${item.no}]`, {
initialValue: item.no,
......
.survey-details {
padding: 20px 60px;
}
.survey-details-title:before {
content: "";
display: inline-block;
width: 5px;
height: 20px;
background-color: #0e77ca;
vertical-align: middle;
margin-right: 15px;
}
.survey-details-pagination {
text-align: center;
padding: 40px 0;
}
.survey-details-return {
display: block;
width: 100%;
text-align: center;
margin: 40px 0;
}
.dqorde {
height: 200px;
text-align: center;
line-height: 200px;
}
.survey-details .ant-table-header {
padding-bottom: 20px !important;
}
.survey-details .ant-table-fixed-header .ant-table-scroll .ant-table-header {
overflow: hidden;
}
.survey-addtest .ant-table-header {
padding-bottom: 20px !important;
}
.survey-addtest .ant-table-fixed-header .ant-table-scroll .ant-table-header {
overflow: hidden;
}
.marr10 {
margin-right: 10px;
}
......@@ -23,6 +23,8 @@ import {
jumpTestFetch,
jumpReset,
editTestFetch,
insertTestFetch,
moveTestFetch,
updateFetch,
} from "../redux/actions";
// import Remind from '../../../../common/remind'
......@@ -285,6 +287,26 @@ class Details extends Component {
});
this.props.jump({ id: item.id });
}
dremove(record) {
const { surid } = this.props;
this.props.edit(
{ deleteIds: [record.id] },
surid,
this.state.pageNo,
this.state.pageSize
);
}
//上移下移 1下移 2上移
handleMove(record, type) {
let newNo = type == 2 ? record.no - 1 : record.no + 1;
const { surid } = this.props;
this.props.move(
{ questionId: record.id, no: newNo },
surid,
this.state.pageNo,
this.state.pageSize
);
}
handleOk() {
const { surid } = this.props;
const { order, editstate, editid } = this.state;
......@@ -573,13 +595,49 @@ class Details extends Component {
key: "operation",
width: 100,
render: (text, record) => (
<div style={{ display: "inline" }}>
<div style={{ display: "flex" }}>
{this.state.isupdata == 1 && (
<a onClick={() => this.handleTestView(record)}>编辑</a>
)}
{this.state.isupdata == 2 && (
<a onClick={() => this.handleTestView1(record)}>查看</a>
)}
<a
style={{ marginLeft: "10px" }}
onClick={() => this.dremove(record)}
>
删除
</a>
{record.no === 1 ? (
<a
style={{ marginLeft: "10px" }}
onClick={() => this.handleMove(record, 1)}
>
下移
</a>
) : tlist.list.length === record.no ? (
<a
style={{ marginLeft: "10px" }}
onClick={() => this.handleMove(record, 2)}
>
上移
</a>
) : (
<>
<a
style={{ marginLeft: "10px" }}
onClick={() => this.handleMove(record, 2)}
>
上移
</a>
<a
style={{ marginLeft: "10px" }}
onClick={() => this.handleMove(record, 1)}
>
下移
</a>
</>
)}
</div>
),
},
......@@ -706,7 +764,29 @@ class Details extends Component {
getFieldDecorator={getFieldDecorator}
changeTask={this.changeTask}
/>
<p className="survey-details-title">问题列表</p>
<div style={{ display: "flex" }}>
<p
style={{ marginRight: "15px" }}
className="survey-details-title"
>
问题列表
</p>
<Button
type="primary"
onClick={() => {
this.setState({
visibleQuestion: true,
testItem: {},
editstate: false,
editid: "",
canEdit: true,
});
}}
>
添加问题
</Button>
</div>
<div>
<Table
size="default"
......@@ -886,6 +966,8 @@ function mapDispatchToProps(dispatch) {
update: (obj, callback) => dispatch(updateFetch(obj, callback)),
jumpreset: () => dispatch(jumpReset()),
edit: (obj, id, no, size) => dispatch(editTestFetch(obj, id, no, size)),
move: (obj, id, no, size) => dispatch(moveTestFetch(obj, id, no, size)),
insert: (obj, no, size) => dispatch(insertTestFetch(obj, no, size)),
};
}
......
......@@ -576,6 +576,40 @@ export function editTestFetch(params, surid, no, size) {
};
}
//编辑问题
export function moveTestFetch(params, surid, no, size) {
console.log(surid);
let param = { ...params, researchId: surid };
let url = api.moveTestFetch;
return dispatch => {
return request({
url: url,
data: param,
}).then(res => {
if (res.code === "1000") {
dispatch({ type: Types.EDIT_TEST, data: res.data });
dispatch(
getTestListFetch({ researchId: surid, pageNo: no, pageSize: size })
);
message.success("操作成功");
} else {
message.success("操作失败");
}
});
// return fetch(url2 + `/batch/update`, {type: 'post', data: param}).then((res) => {
//
// if (res.code === "1000") {
// dispatch({type: Types.EDIT_TEST, data: res.data})
// dispatch(getTestListFetch({researchId: surid, pageNo: no, pageSize: size}))
// message.success('操作成功');
// } else {
// message.success('操作失败');
// }
// })
};
}
//跳题
export function jumpTestFetch(param) {
// console.log(param)
......
......@@ -25,6 +25,8 @@ export default {
editTestFetch: `POST ${services.webManage}/researchQuestion/batch/update`,
moveTestFetch: `POST ${services.webManage}/researchQuestion/batch/updateNo`,
jumpTestFetch: `GET ${services.webManage}/researchQuestion/jump/question/list`,
postNewsList: `GET ${services.newMessage}/manage/message/getList`,
......
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