Commit b3ffb2aa by zhangleyuan

feat:修改培训任务排序模块

parent e5794c62
......@@ -2,7 +2,7 @@
* @Author: zhangleyuan
* @Date: 2021-02-20 16:45:51
* @LastEditors: zhangleyuan
* @LastEditTime: 2021-03-08 20:59:14
* @LastEditTime: 2021-03-09 10:04:40
* @Description: 描述一下
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
......@@ -192,9 +192,12 @@ class TrainingTask extends React.Component {
console.log("newIndex",newIndex);
if (oldIndex !== newIndex) {
const newData = arrayMove([].concat(dataSource), oldIndex, newIndex).filter(el => !!el);
console.log("newData",newData)
this.setState({ dataSource: newData });
this.setState({ dataSource: [...newData] });
}
};
onTaskSortEnd = ({ oldIndex, newIndex }) => {
......@@ -204,7 +207,9 @@ class TrainingTask extends React.Component {
console.log("newIndex",newIndex);
if (oldIndex !== newIndex) {
const newData = arrayMove([].concat(dataSource), oldIndex, newIndex).filter(el => !!el);
console.log("newData",newData)
this.setState({ dataSource: newData });
}
};
......@@ -246,6 +251,7 @@ class TrainingTask extends React.Component {
taskName: '',
index:dataSource.length,
type:'input',
open:false,
courseList:[
]
}
......@@ -341,6 +347,11 @@ class TrainingTask extends React.Component {
renderTaskItem = (record,index)=>{
return <div>
<span>
<span></span>
</span>
{record.type==='input'?
<Form>
<Form.Item
......@@ -386,7 +397,7 @@ class TrainingTask extends React.Component {
const { data } = this.props;
return (
<div className="training-task">
{/* <Table
<Table
pagination={false}
dataSource={dataSource}
columns={this.parseTaskColumns()}
......@@ -418,19 +429,18 @@ class TrainingTask extends React.Component {
row: this.DraggableBodyRow,
},
}}
/> */}
<SortableTaskContainer
/>
{/* <SortableTaskContainer
useDragHandle
disableAutoscroll
helperClass="row-dragging"
onSortEnd={this.onTaskSortEnd}
>
{data.map((item, index) =>
{dataSource.map((item, index) =>
<SortableTaskItem taskItem={this.renderTaskItem(item,index)} index={index}>
</SortableTaskItem>
)}
</SortableTaskContainer>
</SortableTaskContainer> */}
<div><Button onClick={()=>this.addTask()}><span>+</span><span>添加任务</span></Button></div>
{ relatedCourseModalVisible &&
......
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